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
b49e3b8d2348bf3defe5b75559cce0555b613e63
523
asm
Assembly
data/baseStats/dodrio.asm
etdv-thevoid/pokemon-rgb-enhanced
5b244c1cf46aab98b9c820d1b7888814eb7fa53f
[ "MIT" ]
1
2022-01-09T05:28:52.000Z
2022-01-09T05:28:52.000Z
data/baseStats/dodrio.asm
ETDV-TheVoid/pokemon-rgb-enhanced
5b244c1cf46aab98b9c820d1b7888814eb7fa53f
[ "MIT" ]
null
null
null
data/baseStats/dodrio.asm
ETDV-TheVoid/pokemon-rgb-enhanced
5b244c1cf46aab98b9c820d1b7888814eb7fa53f
[ "MIT" ]
null
null
null
db DODRIO ; pokedex id db 60 ; base hp db 110 ; base attack db 70 ; base defense db 110 ; base speed db 60 ; base special db NORMAL ; species type 1 db FLYING ; species type 2 db 45 ; catch rate db 158 ; base exp yield INCBIN "pic/gsmon/dodrio.pic",0,1 ; 77, sprite dimensions dw DodrioPicFront dw DodrioPicBack ; attacks known at lvl 0 db PECK db GROWL db 0 db 0 db 0 ; growth rate ; learnset tmlearn 2,3,4,6,8 tmlearn 9,10,15 tmlearn 20 tmlearn 31,32 tmlearn 33,34 tmlearn 44 tmlearn 49,50 db BANK(DodrioPicFront)
18.034483
57
0.732314
cd92cb980d150a353da387cbf1d7a9168e089908
210
asm
Assembly
libsrc/gfx/portable/drawto.asm
Frodevan/z88dk
f27af9fe840ff995c63c80a73673ba7ee33fffac
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/gfx/portable/drawto.asm
Frodevan/z88dk
f27af9fe840ff995c63c80a73673ba7ee33fffac
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/gfx/portable/drawto.asm
Frodevan/z88dk
f27af9fe840ff995c63c80a73673ba7ee33fffac
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
SECTION code_graphics PUBLIC drawto PUBLIC _drawto EXTERN commondrawto EXTERN plot ;void drawto(int x2, int y2) __smallc ;Note ints are actually uint8_t drawto: _drawto: ld hl,plot jp commondrawto
12.352941
38
0.771429
37251c1c67283d03a5cbe7cd35930e23a432357f
1,062
asm
Assembly
programs/oeis/245/A245380.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/245/A245380.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/245/A245380.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A245380: (7*n^5+5*n^3)/12. ; 0,1,22,153,624,1875,4626,9947,19328,34749,58750,94501,145872,217503,314874,444375,613376,830297,1104678,1447249,1870000,2386251,3010722,3759603,4650624,5703125,6938126,8378397,10048528,11974999,14186250,16712751,19587072,22843953,26520374,30655625,35291376,40471747,46243378,52655499,59760000,67611501,76267422,85788053,96236624,107679375,120185626,133827847,148681728,164826249,182343750,201320001,221844272,244009403,267911874,293651875,321333376,351064197,382956078,417124749,453690000,492775751,534510122,579025503,626458624,676950625,730647126,787698297,848258928,912488499,980551250,1052616251,1128857472,1209453853,1294589374,1384453125,1479239376,1579147647,1684382778,1795154999,1911680000,2034179001,2162878822,2298011953,2439816624,2588536875,2744422626,2907729747,3078720128,3257661749,3444828750,3640501501,3844966672,4058517303,4281452874,4514079375,4756709376,5009662097,5273263478,5547846249 lpb $0 sub $0,1 mov $2,$0 max $2,0 seq $2,8384 ; Crystal ball sequence for A_4 lattice. add $1,$2 lpe mov $0,$1
88.5
909
0.84275
31a243306e7629e7c8c2f0f1cb53f92dc4bf24d3
498
asm
Assembly
oeis/218/A218173.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/218/A218173.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/218/A218173.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A218173: Expansion of f(x^7, x^17) - x^2 * f(x, x^23) in powers of x where f(,) is Ramanujan's two-variable theta function. ; Submitted by Christian Krause ; 1,0,-1,-1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,-1,0,0,-1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0 mul $0,2 add $0,1 seq $0,121373 ; Expansion of f(x) = f(x, -x^2) in powers of x where f(, ) is Ramanujan's general theta function.
62.25
207
0.594378
045044b6cb5043e3cdfdf2ff0b8f170f014b828a
170,240
asm
Assembly
Appl/Term/Screen/screenMain.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
504
2018-11-18T03:35:53.000Z
2022-03-29T01:02:51.000Z
Appl/Term/Screen/screenMain.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
96
2018-11-19T21:06:50.000Z
2022-03-06T10:26:48.000Z
Appl/Term/Screen/screenMain.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
73
2018-11-19T20:46:53.000Z
2022-03-29T00:59:26.000Z
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1989 -- All Rights Reserved PROJECT: PC GEOS MODULE: Screen FILE: screenMain.asm AUTHOR: Dennis Chow, September 8, 1989 ROUTINES: Name Description ---- ----------- ?? INT ScreenResetInitialValues When we are in a Lazarus state (opening up again before we have completely closed), the screenObject still has all of its old instance data. TermDetach frees all the buffers, but some of the values can still be problematic. Reset all the instance data to what it would be if we had started with a freshly instantiated object. Make sure this agrees with termui.ui MTD MSG_SCR_DISPLAY_DATA_FROM_REMOTE Display data sent from remote connection MTD MSG_SCR_DISPLAY_INTL_CHAR Display an international character as local echo MTD MSG_SCR_ERASE_INTL_CHAR Erase the current international character ?? INT ScreenCheckCursorPos Checks to make sure the cursor is in a valid position ?? INT AssertCurCharCurPos Process the data in auxilary buffer ?? INT ScreenSetViewSize Set the screen font to Bison 9 or Bison 12 ?? INT ScreenBison12 Set the screen font to Bison 12 MTD MSG_SCR_CURSOR_UP_OR_SCROLL Move cursor up 1 row. If already at top of scroll region, scroll region down. If cursor is above the scroll region will not scroll (VT100 behavior) MTD MSG_SCR_CURSOR_DOWN_OR_SCROLL Move cursor down 1 row. If already at bottom of scroll region, scroll the region up. If cursor is below the scroll region, will not scroll (VT100 behavior) MTD MSG_SCR_CLEAR_SCREEN_AND_SCROLL_BUF Clear screen and scroll buffer MTD MSG_SCR_CLEAR_TO_BEG_LINE Clears current line from first column to cursor (inclusive) MTD MSG_SCR_CLEAR_TO_BEG_DISP Clears chars from upper left of disp to cursor (inclusive) MTD MSG_SCR_CLEAR_LINE Clears entire current line MTD MSG_SCR_RESET_SCROLLREG Reset the scroll region MTD MSG_META_LOST_FOCUS_EXCL MTD MSG_META_LOST_SYS_FOCUS_EXCL MTD MSG_META_GAINED_FOCUS_EXCL MTD MSG_META_GAINED_SYS_FOCUS_EXCL INT SendScreenFocusNotification Sends the GWNT_EDITABLE_TEXT_OBJECT_HAS_FOCUS notification. ?? INT CheckForTextItem check if current quick-transfer item supports CIF_TEXT format ?? INT ScreenViewClosingQT handle closing of window, stop drag-selection and stop quick transfer MTD MSG_SCR_SEND_BREAK Send a BREAK signal out the serial line. MTD MSG_SCR_IGNORE_ESC_SEQ Do nothing for the parsed escape sequence MTD MSG_SCR_RENEW_GRAPHICS_ON Reset graphics attributes and then set the new ones MTD MSG_SCR_RENEW_SCROLL_REG_BOTTOM Reset the top of scroll region and set the bottom to new value MTD MSG_META_BRING_UP_HELP MSG_META_BRING_UP_HELP must be handled be a GenClass object ?? INT ScreenFepCallBack callback routine for FEP ?? INT ScreenFepGetTempTextBounds suggest bounds for the temp text window ?? INT ScreenFepGetTempTextAttr get temp text attributes for FEP ?? INT ScreenFepInsertTempText send the passed text to the serial port ?? INT ScreenFepDeleteText delete the N characters immediately before the current cursor position MTD MSG_SCR_GET_FEP_TEMP_TEXT_ATTR return character attributes of text at current position MTD MSG_SCR_GET_FEP_TEMP_TEXT_BOUNDS return bounds of text at current position MTD MSG_SCR_ZOOM Changes "zoom in" moniker to "zoom out", and sends change font size message to ourselves. MTD MSG_SCR_UNZOOM Changes "zoom out" moniker to "zoom in", and sends message to ourselves to reduce font size. ?? INT SetNotUsable Set a certain Object usable or not usable ?? INT SetUsable Set a certain Object usable or not usable MTD MSG_SCR_SPECIAL_KEY_INSERT Insert a special key MTD MSG_SCR_RESPOND_WHAT_ARE_YOU Respond to What Are You request MTD MSG_SCR_RESPOND_CURSOR_POSITION Sends current cursor position back to host ?? INT SendResponse Sends a string to the host, inserting numeric arguments as needed. MTD MSG_SCR_SELECT_G Select character set designator to G0 MTD MSG_SCR_SELECT_G Select character set designator to G1 MTD MSG_SCR_G Choose Special graphics character set for G0 MTD MSG_SCR_G Choose Special graphics character set for G1 MTD MSG_SCR_SAVE_INTL_CHAR Save the current editing international character MTD MSG_SCR_RESTORE_INTL_CHAR Restore the international character being edited MTD MSG_SCR_SAVE_CUR_CHAR Save the character at the current cursor position MTD MSG_SCR_RESTORE_CUR_CHAR Restore the character at cursor position saved by ScreenSaveCurChar MTD MSG_SCR_RESUME_KEYBOARD_INPUT Resume regular keyboard input sequence MTD MSG_SCR_SYNC Synchronize with sender of this message MTD MSG_SCR_RESET_VT Reset the Virtual Terminal settings REVISION HISTORY: Name Date Description ---- ---- ----------- dc 9/ 8/89 Initial revision. DESCRIPTION: There are a few method handlers in here that may seem obsolete, inconsistenly-named, or even downright buggy (check out the CURSOR_UP/DOWN messages). This was done to preserve any behavior that terminals other than VT100 might rely on. Someone with more time can go back through and figure out the minimal feature set the screen object must provide to implement all the desired terminal types. $Id: screenMain.asm,v 1.1 97/04/04 16:55:47 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenInitialize %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Initialize a screen object CALLED BY: MSG_META_INITIALIZE via TermAttach PASS: ds:*si - screen instance data es - dgroup RETURN: C - set if not enough memory to create screen obj DESTROYED: es, ax, cx, di, si PSEUDO CODE/STRATEGY: set default values for screen object allocate buffers KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 8/24/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenInitialize method ScreenClass, MSG_META_INITIALIZE mov si, ds:[si] ;dereference the ptr tst es:[termLazarusing] jz startingFresh call ScreenResetInitialValues startingFresh: mov ax, FILE_CACHE_SIZE ;get 1K swappable mov cx, ALLOC_DYNAMIC ; file cache call MemAlloc jc error_JC ;if no memory, flag error mov ds:[si][SI_cacheHandle], bx ;save handle to file cache mov ax, SCROLL_BUF_SIZE ;get swappable 25K buffer to mov cx, ALLOC_DYNAMIC ; hold scroll data call MemAlloc ; jc error_JC ;if no memory, flag error mov ds:[si][SI_scrollHandle], bx ;save handle to buffer mov ax, SCREEN_SIZE ;get memory for screen buffer mov cx, (mask HAF_ZERO_INIT shl 8) or ALLOC_DYNAMIC call MemAlloc ; error_JC: LONG jc error ;exit if can't get memory mov ds:[si][SI_screenHandle], bx ;store handle to segment call BufClear push si ;save ptr to instance data sub sp, size RectDWord mov dx, sp ;pass buffer in cx:dx mov cx, ss GetResourceHandleNS TermView, bx mov si, offset TermView mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_GEN_VIEW_GET_DOC_BOUNDS call ObjMessage mov bp, dx mov cx, ss:[bp].RD_right.low ;put size in cx, dx mov dx, ss:[bp].RD_bottom.low add sp, size RectDWord pop si ;restore ptr to instance data mov ds:[si][SI_docWidth], cx ;cx - width of doc mov ds:[si][SI_docHeight], dx ;dx - height of doc if _MODEM_STATUS ; ; Allocate the GState now ; push bp clr di ; no window yet call GrCreateState ; ^hdi <- GState mov ds:[si][SI_gState], di call RestoreScreenState pop bp endif push si ;save ptr to screen instance mov ax, MSG_VIS_GET_SIZE mov di, mask MF_RECORD mov bx, segment GenFieldClass mov si, offset GenFieldClass call ObjMessage mov cx, di ;event in cx mov ax, MSG_VIS_VUP_CALL_OBJECT_OF_CLASS GetResourceHandleNS MyApp, bx mov si, offset MyApp mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage mov ss:[fieldWinWidth], cx mov ss:[fieldWinHeight], dx ; ; force height to 12 if starting on CGA from scratch ; cmp ss:[restoreFromState], TRUE je noForce GetResourceHandleNS MyApp, bx mov si, offset MyApp mov ax, MSG_GEN_APPLICATION_GET_DISPLAY_SCHEME ; ah - display type mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage mov al, ah ; al = ah = display type andnf al, mask DT_DISP_CLASS cmp al, DC_GRAY_1 shl offset DT_DISP_CLASS ; mono? jne noForce ; nope cmp ah, CGA_DISPLAY_TYPE ; CGA? jne noForce mov dx, 12 ; #lines = (dx.cx) clr cx GetResourceHandleNS WinLinesRange, bx mov si, offset WinLinesRange mov ax, MSG_GEN_VALUE_SET_VALUE clr bp mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage noForce: pop si mov dl, FALSE mov ss:[inCopy], dl ;clear QUICK_COPY flag mov ss:[curInSelect], dl ;clear cursor in select region mov ss:[inDragSelect], dl ; flag mov ss:[scrollLocked], dl call ResetView CallMod DisableSaveScroll clc ;clear error flag jmp short exit error: segmov ds, ss, bp mov bp, ERR_NO_MEM_ABORT CallMod DisplayErrorMessage stc ;set error flag exit: ret ScreenInitialize endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenResetInitialValues %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: When we are in a Lazarus state (opening up again before we have completely closed), the screenObject still has all of its old instance data. TermDetach frees all the buffers, but some of the values can still be problematic. Reset all the instance data to what it would be if we had started with a freshly instantiated object. Make sure this agrees with termui.ui CALLED BY: ScreenInitialize PASS: ds:si - ScreenClass object RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- dlitwin 11/18/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenResetInitialValues proc near class ScreenClass uses ax, cx, es, di .enter segmov es, ds, di mov di, si ; es:di is ScreenClass instance data add di, offset SI_fontColor ; first instance data field ; ; Clear all of the instance data, then go back and set certain values ; clr ax ; ; the size of the instance data is the offset of the last instance ; field (plus the size of that field) minus the offset of the first. ; mov cx, (offset SI_intFlags) + \ (size ScreenInternalFlags) - \ (offset SI_fontColor) shr cx, 1 ; divide by two for # of words jnc evenAmount stosb ; account for odd byte, if there is one evenAmount: rep stosw ; ; set all the exceptions ; CheckHack< FALSE eq 0> ; all fields set to FALSE are already 0 mov ds:[si].SI_fontColor, C_BLACK mov ds:[si].SI_gState, BOGUS_VAL mov ds:[si].SI_lineHeight, DEF_FONT_HEIGHT mov ds:[si].SI_leading, DEF_FONT_LEADING mov ds:[si].SI_charWidth, DEF_FONT_WIDTH mov ds:[si].SI_backColor, C_WHITE mov ds:[si].SI_scrollRegBot, (MAX_LINES - 1) mov ds:[si].SI_autoWrap, TRUE mov ds:[si].SI_winWidth, INIT_WIDTH mov ds:[si].SI_winHeight, INIT_HEIGHT mov ds:[si].SI_capHandle, BOGUS_VAL mov ds:[si].SI_maxLines, MAX_LINES mov ds:[si].SI_maxCols, INIT_LINE_CHARS .leave ret ScreenResetInitialValues endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenDraw %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Draw the screen object CALLED BY: MSG_META_EXPOSED PASS: ds:*si - screen instance data es - dgroup cx - window to draw to [SI_screenBuf] - pointing to unlocked segment RETURN: --- DESTROYED: --- PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 8/24/89 Initial version dennis 12/06/89 transfered from TermClass to ScreenClass %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenDraw method ScreenClass, MSG_META_EXPOSED cmp ss:[termStatus], DORKED ;if this is bogus method je exit ; exit cmp ss:[termStatus], OFF_LINE ;if this is bogus method je exit ; exit mov si, ds:[si] ;get ptr to instance data cmp ds:[si][SI_iconified], TRUE ;if we've shrunk don't need to je exit ; update mov di, ds:[si][SI_gState] ;get gState cmp di, BOGUS_VAL ;is gState valid? jne SD_ok ;yes, continue mov ds:[si][SI_winHandle], cx ;else mov di, cx ;store the window and call GrCreateState ;create a GState mov ds:[si][SI_gState], di ; call RestoreScreenState SD_ok: call GrBeginUpdate call DrawDocument ;draw document on top call GrEndUpdate ;----------------------------------------------------------------------------- ;moved here from ScreenViewClosing call GrGetWinBounds ; mov cx, ds:[si][SI_lineHeight] ;The way scrolling is handle shl cx, 1 ; is that we compare the bottom sub dx, cx ; of the cursor against the inc dx ; bottom of the window. When mov ds:[si][SI_winBottom], dx ; we're iconified we have no ;----------------------------------------------------------------------------- exit: ret ScreenDraw endm ScreenViewOpening method ScreenClass, MSG_META_CONTENT_VIEW_OPENING mov ds:[di][SI_iconified], FALSE ret ScreenViewOpening endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenViewClosing %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Window being closed, destroy the GState CALLED BY: PASS: ds:*si - instance data es - dgroup RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenViewClosing method ScreenClass, MSG_META_CONTENT_VIEW_CLOSING call ScreenViewClosingQT ; handle ending QT, if needed ;if shutting down application cauz of lack of memory then ;we don't have a Gstate to destroy cmp ss:[termStatus], DORKED je exit mov si, ds:[si] ;dereference object pointer mov di, ds:[si][SI_gState] ;destroy our gstate ; ;brianc found a bug where if he launched all the applications and then ;quickly exited to DOS, geoComm crashed in this method handler ;because I expect to have a valid gState and conceiveably I may never have ;gotten a MSG_META_EXPOSED (which is where I create my gState. ; cmp di, BOGUS_VAL je exit ;too late to do this here, window is hosed, so do in ScreenDraw instead, ;slower but no crash - brianc 2/24/94 if 0 call GrGetWinBounds ; mov cx, ds:[si][SI_lineHeight] ;The way scrolling is handle shl cx, 1 ; is that we compare the bottom sub dx, cx ; of the cursor against the inc dx ; bottom of the window. When mov ds:[si][SI_winBottom], dx ; we're iconified we have no endif call GrDestroyState ; window, so we store the ; bottom of the window now. mov ds:[si][SI_gState], BOGUS_VAL ;flag gState dorked mov ds:[si][SI_iconified], TRUE ;we've shrunk exit: ret ScreenViewClosing endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenCheckCursorPos %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Checks to make sure the cursor is in a valid position CALLED BY: DrawCursor PASS: ds:si = ScreenClass instance data RETURN: nothing DESTROYED: nothing (not even flags) SIDE EFFECTS: FatalError's if invalid position PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- CT 2/21/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if ERROR_CHECK ScreenCheckCursorPos proc near class ScreenClass pushf .enter cmp ds:[si][SI_curChar], MAX_LINE_CHARS jae problem ; ERROR_AE TERM_ERROR_INVALID_CURSOR_POSITION cmp ds:[si][SI_curLine], MAX_LINES jb exit ; ERROR_AE TERM_ERROR_INVALID_CURSOR_POSITION problem: nop exit: .leave popf ret ScreenCheckCursorPos endp endif ; ERROR_CHECK COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenData %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Process the data in auxilary buffer CALLED BY: SerialInThread, TermScreenDraw PASS: *ds:si - instance data ss - dgroup (because the term:0 thread is running this object) *ds:si[SI_screenBuf] - pointing to unlocked segment cx - if 0, it means that the characters have been passed on the stack. Else, cx = handle of block which contains characters. Must free block when done with it! dx - number of bytes to process ss:bp = data on stack (if cx = 0) OLD: cx - number of chars in buffer dx:bp - buffer to read chars from RETURN: ds, dx = same DESTROYED: ax, bx, cx, bp, es, si PSEUDO CODE/STRATEGY: Create GState if character printable store it in buffer KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 8/22/89 Initial version eric 10/90 Updated to accept data from stack or a block on the global heap, but NOT auxBuf, allowing asynchronous operation. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenData method ScreenClass, MSG_SCR_DATA ;we will push DX as soon as we set bp = sp! if DBCS_PCGEOS mov ax, dx ;ax = # bytes shr ax, 1 ;ax = # chars mov ss:[scrNumChars], ax ;save num of chars to process else mov ss:[scrNumChars], dx ;save num of chars to process endif mov ss:[scrBlockToFree], cx ;save handle of block to free ;when exit handler. (0 means none) mov si, ds:[si] ;dereference object pointer tst cx jnz readFromBlock readFromStack: ForceRef readFromStack ;the characters have been passed on the stack. ; ; In Responder, not only FSM calls MSG_SCR_DATA, but also ; TermBogusGenText object. So it doesn't usually have ; dgroup:fsmStackDataID pushed for EC. Therefore, just ignore this ; check in Responder. ; EC < sub dx, 2 ;remove ID from count > EC < dec ss:[scrNumChars] > if not DBCS_PCGEOS ; if DBCS'd, error occurs here since in previous routine, the ID is treated ; as a word. Under SBCS, the # of bytes = # of chars, and # chars is ; decremented twice in the EC code below. However, under DBCS, the char ; count is reduced by one since the buffer size is div'd by 2. This leads ; to the problem of subtracting one too many characters from the actual ; length when decrementing below. So decrement again only if in SBCS. EC < dec ss:[scrNumChars] > endif ; ! DBCS_PCGEOS if ERROR_CHECK mov di, bp add di, dx mov ax, ss:[di] ;get ID cmp ax, ss:[scrStackDataID] ;compare to what we expect ERROR_NE TERM_ERROR ;bail if error inc ss:[scrStackDataID] ;prepare for next endif ; ERROR_CHECK segmov es, ss, bx ;set es:bp = data on stack jmp short readyToProcess ;skip to process chars... readFromBlock: ;the characters have been passed in a block on the global heap ;Point to the block (we will free it before exiting this handler) mov bx, cx ;bx = handle of block on global heap call MemLock ;lock block, set ax = segment mov es, ax ;set es:bp = data in block clr bp readyToProcess: ;es:bp = pointer to first character to process. if _CAPTURE_CLEAN_TEXT ; ; Capture text if necessary, otherwise, FileCaptureText just does ; nothing. ; call FileCaptureText ;nothing destroyed endif ; _CAPTURE_CLEAN_TEXT push dx ;MUST return same DX, or ObjMessage ;will screw up! mov bx, ds:[si][SI_screenHandle] ;lock screen buffer call MemLock ; mov ds:[si][SI_screenBuf], ax ; if _MODEM_STATUS ; ; Since the window hasn't been displayed yet, winHandle is null. But ; we still want to draw the data. So, test on GState instead. ; cmp ds:[si][SI_gState], BOGUS_VAL LONG je SD_ret else ; if !_MODEM_STATUS tst ds:[si][SI_winHandle] ;get pane window from core block jnz SD_winOK ;no jmp SD_ret ;yes, exit endif ; if _MODEM_STATUS SD_winOK: mov di, ds:[si][SI_gState] ;get gState for the window call EraseCursor ;nuke cursor before print NCUR < cmp ds:[si][SI_curChar], MAX_LINE_CHARS ;are we at end of line?> CUR < cmp ds:[si][SI_curPos], MAX_LINE_CHARS > jb printChars ;nope tst ds:[si][SI_autoWrap] jnz doWrap ; ; VT100 no-wrap mode puts overflow chars in 80th column ; cmp ss:[termType], VT100 jne SD_ret ;yep, bogus and bail. NCUR < dec ds:[si][SI_curChar] ; back up to 80th column > CUR < dec ds:[si][SI_curPos] > jmp printChars doWrap: call DoNewLine ;if at end of line insert line printChars: cmp ds:[si][SI_inScroll], FALSE ;if we scrolled away from je saveCursor ; window, then reset the call ScrollResetView ; view saveCursor: push ds:[si][SI_curChar] ;save the old cursor position CUR < push ds:[si][SI_curPos] > CUR <EC <call AssertCurCharCurPos >> SD_getChar: SBCS < mov dl, es:[bp] ;get char to process > DBCS < mov dx, es:[bp] ;get char to process > SBCS < cmp dl, CHAR_PRINT ;is this a printable char> DBCS < cmp dx, CHAR_PRINT ;is this a printable char> jae SD_store ;yep, store it ; (allow high-ASCII chars) jmp SD_next ;get next char SD_store: cmp ds:[si][SI_insertMode], TRUE jne SD_stuff call BufShiftLineRight SD_stuff: tst ds:[si][SI_ignoreNL] ;if VT100 don't wrap until write jz 10$ ; on 81st column NCUR < cmp ds:[si][SI_curChar], MAX_LINE_CHARS > CUR < cmp ds:[si][SI_curPos], MAX_LINE_CHARS > jb 10$ ;continue tst ds:[si][SI_autoWrap] ;else is wrapping set? je drawText ;no, quit storing stuff call DoNewLine ;yes, wrap to next line 10$: call BufStoreData ;stuff char into screen buf inc ds:[si][SI_curChar] ;increment cursor CUR < inc ds:[si][SI_curPos] > CUR < mov ax, dx ;ax = char > CUR < call CheckHalfWidth ;carry set if halfwidth > CUR < jc haveWidth > CUR < inc ds:[si][SI_curPos] ;full-width char > CUR <haveWidth: > CUR <EC <call AssertCurCharCurPos >> tst ds:[si][SI_ignoreNL] ;if this is VT100 jnz SD_next ;then don't wrap till later NCUR < cmp ds:[si][SI_curChar], MAX_LINE_CHARS > CUR < cmp ds:[si][SI_curPos], MAX_LINE_CHARS > jb SD_next ; tst ds:[si][SI_autoWrap] ;then wrap immediately je SD_next ; call DoNewLine ; SD_next: inc bp ;pt to next char DBCS < inc bp > dec ss:[scrNumChars] ;done with buffer? jne SD_getChar ;nope, do next char drawText: mov bp, ds:[si][SI_curChar] ;save updated cursor CUR < mov dx, ds:[si][SI_curPos] > CUR < pop ds:[si][SI_curPos] pop ds:[si][SI_curChar] ;get old cursor tst ss:[wrapped] jz noWrap clr ds:[si][SI_curChar] ;if wrap, reset cursor CUR < clr ds:[si][SI_curPos] > mov ss:[wrapped], FALSE noWrap: mov ax, bp ; sub ax, ds:[si][SI_curChar] ;calc #chars to erase tst ax jz done tst ds:[si][SI_insertMode] ;are we in insertmode? je 50$ mov ax, MAX_LINE_CHARS ;if in insert mode sub ax, ds:[si][SI_curChar] ;have to redraw whole line 50$: CUR < push dx > call EraseDrawLine call DrawRemLine ; and print current line CUR < pop dx > done: CUR < mov ds:[si][SI_curPos], dx > mov ds:[si][SI_curChar], bp ;restore updated cursor CUR <EC <call AssertCurCharCurPos >> call DrawCursor SD_ret: mov bx, ds:[si][SI_screenHandle] ;unlock screen buffer call MemUnlock ; EC < call NullScreenBuf ; stuff bogus segment > ;now, if we were passed data in a block on the global heap, ;free that block now. mov bx, ss:[scrBlockToFree] ;get handle of block to free tst bx jz exit ;skip if none... call MemFree exit: pop dx EC < add dx, 2 ;make room for ID > ret ScreenData endm if CURSOR AssertCurCharCurPos proc near class ScreenClass mov ax, ds:[si].SI_curChar call GetCurCharFromCurPos cmp ax, ds:[si].SI_curChar WARNING_NE 0 ret AssertCurCharCurPos endp endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenBison9Or12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the screen font to Bison 9 or Bison 12 CALLED BY: TermSetBison9 PASS: ds:*si - screen instance data es - dgroup cx - 9 or 12 RETURN: di - GState DESTROYED: cx, dx, si PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 8/29/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenBison9Or12 method ScreenClass, MSG_SCR_BISON_9_OR_12 cmp cx, 9 je set9 call ScreenBison12 jmp short exit set9: mov si, ds:[si] ;dereference ptr cmp ds:[si][SI_lineHeight], BISON_9_HEIGHT je exit ;if already using Bison 9, exit setBison9 label far mov di, ds:[si][SI_gState] ;get our gstate call EraseCursor mov cx, TERM_FONT ;else use non-proportional mov dx, TERM_FONT_9 ; 9 point BISON font clr ah ; no fractional pt sizes call ScreenSetFont mov ds:[si][SI_docHeight], BISON_9_DOC_HEIGHT mov ds:[si][SI_docWidth], BISON_9_DOC_WIDTH mov cx, BISON_9_DOC_WIDTH ;set Bison 9 doc size mov dx, BISON_9_DOC_HEIGHT call ScreenSetViewSize call SetFontNewScreen ;reset the view for new font exit: ret ScreenBison9Or12 endm ScreenSetViewSize proc near uses si .enter GetResourceHandleNS TermView, bx mov si, offset TermView mov di, mask MF_FIXUP_DS call GenViewSetSimpleBounds .leave ret ScreenSetViewSize endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenBison12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the screen font to Bison 12 CALLED BY: TermSetBison12 PASS: ds:*si - screen instance data es - dgroup RETURN: --- DESTROYED: cx, dx, si PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 12/07/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenBison12 proc far class ScreenClass mov si, ds:[si] ;dereference ptr cmp ds:[si][SI_lineHeight], BISON_12_HEIGHT je exit ;if we are using Bison 12, exit setBison12 label far mov di, ds:[si][SI_gState] ;get our gstate call EraseCursor mov cx, TERM_FONT ;else use non-proportional mov dx, 12 ; 12 point BISON font call ScreenSetFont mov ds:[si][SI_docHeight], BISON_12_DOC_HEIGHT mov ds:[si][SI_docWidth], BISON_12_DOC_WIDTH mov cx, BISON_12_DOC_WIDTH ;set Bison 12 doc size mov dx, BISON_12_DOC_HEIGHT call ScreenSetViewSize ; (preserves si) call SetFontNewScreen ;reset the view for new font exit: ret ScreenBison12 endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenKeyboard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: handle a press on the keyboard CALLED BY: MSG_META_KBD_CHAR PASS: cx - character value SBCS: ch = CharacterSet, cl = Chars DBCS: cx = Chars dl = CharFlags dh = ShiftState bp low = ToggleState bp high = scan code es - dgroup RETURN: nothing DESTROYED: ax, bx, cx, dx, di, si PSEUDO CODE/STRATEGY: user pressed on the keyboard. take the character and write it out the com port Send all Ctrl chars under x20h and all printable chars >= 0x20h and <= x80h. Only send out when CharFlags is first press KNOWN BUGS/SIDE EFFECTS/IDEAS: When in local echo mode, I only echo those characters that get sent out the modem in contrast to those characters the user has pressed. Is this a problem? *** Don't do half duplex for arrow keys chars. To handle the cursor keys I have to intercept all the accelerator chars. So the events that I don't handle have to be sent back the the view REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 8/24/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenKeyboard method ScreenClass, MSG_META_KBD_CHAR if USE_FEP tst es:[fepStrategy].segment jz noFep ; ; If it is a press send it to the FEP. ; test dl, mask CF_RELEASE jnz noFep ; ; Initialize error flag ; mov es:[scrKbdFepNoPortErr], BB_FALSE ; ; Pass call back information on the stack. ; sub sp, size FepCallBackInfo mov di, sp mov ax, segment ScreenFepCallBack mov bx, offset ScreenFepCallBack movdw ss:[di].FCBI_function, axbx mov ax, ds:[LMBH_handle] movdw ss:[di].FCBI_data, axsi movdw axbx, ssdi mov di, DR_FEP_KBD_CHAR call es:[fepStrategy] add sp, size FepCallBackInfo ; ; Check return value: iff al = 0 consume the character. ; tst al LONG jz exitFepConsumed noFep: endif test dl, mask CF_TEMP_ACCENT ; accent char pending? jnz jmpUnused ; yes, ignore it test dl, mask CF_FIRST_PRESS ;if not FIRST or REPEAT jnz checkState ; keypress then test dl, mask CF_REPEAT_PRESS ; exit jnz checkState ;else, process it jmpUnused: jmp unused checkState: SBCS < cmp ch, CS_CONTROL ;if this is a CTRL char then> DBCS < cmp ch, CS_CONTROL_HB ;if this is a CTRL char then> je checkArrow ; check for ARROW or NUM key ; else this is regular char and dh, mask SS_LCTRL or mask SS_RCTRL ; if CTRL key pressed ; jz 10$ ; then convert it ;allow all characters to be sent from keyboard - brianc 1/3/91 jz writeIt if DBCS_PCGEOS ;------------------------------------------------------------- and cx, CTRL_MASK ; cx = control char checkArrow: cmp cx, C_SYS_UP jb checkCtrl cmp cx, C_SYS_HOME LONG ja checkBreak call DoArrowKey jmp exit checkCtrl: cmp cx, C_SPACE ; allow true control chars jb writeIt cmp cx, C_SYS_F1 jae jmpUnused mov ax, cx ; ax = control char push es, di, cx segmov es, cs mov di, offset mapKeyTable ; table of keys to map mov cx, length mapKeyTable repne scasw pop es, di, cx jne jmpUnused ; not found, send it back up ; else, map and process mov ch, 0 ; cx = control char - 0xee00 else ;--------------------------------------------------------------------- and cl, CTRL_MASK ; convert char to Ctrl char ; if applied RSP < jmp checkArrowWithoutKeymap > ;10$: ; cmp cl, 080h ; jb writeIt ; jmp unused checkArrow: RSP < call InputKeyMap ; cx = mapped key > checkArrowWithoutKeymap:: cmp cl, VC_UP jb checkCtrl cmp cl, VC_HOME ja checkBreak call DoArrowKey ; jmp exit ; checkCtrl: cmp cl, 080h ;if illegal char, forget it LONG jae unused endif ;--------------------------------------------------------------------- writeIt: mov si, ds:[si] ;deref obj ptr mov di, ds:[si][SI_gState] ; and get gState cmp ds:[si][SI_inScroll], FALSE ;if we scrolled away from je noScroll ; window, then reset the push cx, dx ; view before sending output call ScrollResetView ; pop cx, dx ;restore keyboard char flags noScroll: ; ; convert char from GEOS code page to BBS code page, if needed ; cx = GEOS char ; if DBCS_PCGEOS ;------------------------------------------------------------- mov bx, es:[serialPort] ; check port first cmp bx, NO_PORT LONG je noPort push ds, si segmov ds, ss, si EC < mov di, es > EC < cmp di, si > EC < ERROR_NE -1 > push cx ; put GEOS character on stack mov si, sp ; ds:si = source sub sp, 6 ; plenty of room for expansion mov di, sp ; es:di = dest mov cx, 1 ; 1 GEOS char mov ax, MAPPING_DEFAULT_CHAR mov bx, ds:[bbsSendCP] ;don't do this as it sends unnecessary things though - brianc 11/29/94 if 0 ; ; force synchronization to SB mode if CR ; cmp bx, CODE_PAGE_JIS ; think we are in SB mode? jne noSync ; nope, continue cmp {wchar} ds:[si], CHAR_CR ; will be sending CR? jne noSync ; nope, continue mov bx, CODE_PAGE_JIS_DB ; else, pretend we are in DB ; mode, so we will turn ; on SB mode noSync: endif clr dx call LocalGeosToDos ; cx = new size of text (bytes) EC < WARNING_C KBD_CONVERSION_ERROR > jc dbcsErr mov ds:[bbsSendCP], bx ; ; write bytes one at a time in loop, can't write bytes all at once, ; cause there's nowhere safe to store them ; mov si, di ; ds:si = BBS chars push si, cx ; save count for echo sendLoop: if _TELNET lodsb ; al <- char mov_tr cl, al call SendChar ; carry set if error else push cx ; save count lodsb ; al <- char mov cl, al ; cl = BBS char mov bx, ds:[serialPort] mov ax, STREAM_BLOCK CallSer DR_STREAM_WRITE_BYTE, ds pop cx endif ; _TELNET loop sendLoop pop si, cx ; si = offset, cx = count ; ; echo if half-duplex, echo bytes one at a time in loop, can't echo ; bytes all at once, cause there's nowhere safe to store them ; ds = dgroup ; ds:si = chars ; cx = # chars ; cmp ds:[halfDuplex], TRUE jne noEcho ; ; maintain current bbsRecvCP by switching into mode of character to ; send (i.e. bbsSendCP) and then switching back ; push ds:[bbsRecvCP] ; save bbsRecvCP because it ; will be modified by ; FSMParseString sometime ; after echoEscape call StartEcho echoLoop: push cx lodsb mov cl, al ; cl = byte to echo mov ax, MSG_READ_CHAR SendSerialThread pop cx loop echoLoop ; ; escape back to bbsRecvCP ; pop ax ; ax = desired CP (bbsRecvCP) call EndEcho noEcho: dbcsErr: add sp, 8 ; clear stack pop ds, si else ;--------------------------------------------------------------------- mov al, cl ; al = character cmp al, MIN_MAP_CHAR ; any conversion needed? jb noConv ; nope clr ah mov bx, MAPPING_DEFAULT_CHAR ; default character push cx mov cx, es:[bbsCP] ; bx = destination code page call LocalGeosToCodePageChar pop cx noConv: if INPUT_OUTPUT_MAPPING call OutputMapChar endif clr ah test ds:[si].SI_modeFlags, mask SVTMF_LF_NEWLINE jz crLfLoop mov ah, TRUE crLfLoop: if _TELNET cmp al, C_CR jne sendNonCR call SendCR jmp sentOneChar sendNonCR: push ax ; ah = crlf mode, al = char mov_tr cl, al push ds segmov ds, es, ax ; ds <- dgroup call SendChar ; carry set if error pop ds else ; _TELNET mov bx, es:[serialPort] cmp bx, NO_PORT ;if no port opened? je noPort ; then exit push ax ; ah = crlf mode, al = char mov_tr cl, al ; cl = char to send mov ax, STREAM_BLOCK ;block, if necessary CallSer DR_STREAM_WRITE_BYTE, es ;else write char out the line endif ; !_TELNET pop ax ; get crlf mode, char sentOneChar:: cmp al, C_CR ; IF just sent CR, jne doneSending tst ah ; AND in LF mode, jz doneSending mov al, C_LF ; THEN send an LF jmp crLfLoop doneSending: cmp es:[halfDuplex], TRUE ; jne exit ; if not _TELNET mov ax, MSG_READ_CHAR ;if in local echo SendSerialThread endif ; !_TELNET endif ;--------------------------------------------------------------------- jmp short exit checkBreak: SBCS < cmp cl, VC_BREAK ;if BREAK key was pressed> DBCS < cmp cx, C_SYS_BREAK ;if BREAK key was pressed> jne unused ;then send Serial Break Signal segmov ds, es, bx ;ds->dgroup if not _TELNET CallMod SendSerialBreak endif jmp exit noPort: call noPortError unused: ;keyboard chars we don't mov ax,MSG_META_FUP_KBD_CHAR ;handle should be passed RSP < SendScreenView > NRSP < CallScreenView ;back to the view > exit: ret if USE_FEP exitFepConsumed: tst es:[scrKbdFepNoPortErr] jz exit call noPortError ret endif noPortError label near push cx, dx ;save character flags clr cx ;flag that String resource mov dx, offset keyCharErr ; should be stuffed mov bp, ERR_NO_COM segmov ds, es, ax ;make ds- dgrup CallMod DisplayErrorMessage pop cx, dx retn RSP < ScreenKbdCharReal endm > NRSP < ScreenKeyboard endm > if DBCS_PCGEOS mapKeyTable wchar C_SYS_BACKSPACE, C_SYS_TAB, C_SYS_ENTER, C_SYS_ESCAPE, C_SYS_NUMPAD_ENTER, C_SYS_NUMPAD_DIVIDE, C_SYS_NUMPAD_MULTIPLY, C_SYS_NUMPAD_PLUS, C_SYS_NUMPAD_MINUS, C_SYS_NUMPAD_PERIOD, C_SYS_NUMPAD_0, C_SYS_NUMPAD_2, C_SYS_NUMPAD_2, C_SYS_NUMPAD_3, C_SYS_NUMPAD_4, C_SYS_NUMPAD_5, C_SYS_NUMPAD_6, C_SYS_NUMPAD_7, C_SYS_NUMPAD_8, C_SYS_NUMPAD_9 endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenNormalizePos %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Make sure scroll bar scrolls by lines, not pixels CALLED BY: MSG_META_CONTENT_TRACK_SCROLLING PASS: *ds:si - instance data ss:bp - TrackScrollingParams dx - size TrackScrollingParams cx - Chunk Handle of scroll bar RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: look at OLTextDisplayNormalizePosition for example KNOWN BUGS/SIDE EFFECTS/IDEAS: Only normalizes dragging in vertical direction. REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 03/23/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if 0 ScreenNormalizePos method ScreenClass, MSG_META_CONTENT_TRACK_SCROLLING call GenSetupTrackingArgs ;set up all the normalize stuff mov si, ds:[si] ;dereference ptr to screen obj mov ax, ss:[bp].TSP_change.PD_y ;get scroll amount cmp ax, 0 ;if negative scroll amount je doScroll jg 10$ ; neg ax ;convert to positive # 10$: mov bx, ds:[si][SI_lineHeight] ;is scroll a multiple of div bl ;line height? tst ah ; jz doScroll ;yes, exit sub bl, ah ;no, cmp ss:[bp].TSP_change.PD_y, 0 ; jl scrollUp ; add ss:[bp].TSP_change.PD_y, bx ;normalize downward scroll jmp short doScroll ; scrollUp: ; sub ss:[bp].TSP_change.PD_y, bx ;normalize upward scroll doScroll: ; call GenReturnTrackingArgs ;return the arguments ret ScreenNormalizePos endm endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenExit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: kill screen object program CALLED BY: MSG_SCR_EXIT PASS: nothing RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: free memory blocks KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 8/22/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenExit method ScreenClass, MSG_SCR_EXIT mov si, ds:[si] mov bx, ds:[si][SI_cacheHandle] ;nuke our file cache tst bx jz noCache call MemFree noCache: mov bx, ds:[si][SI_screenHandle] ;nuke our screen buffer tst bx jz noScreen call MemFree noScreen: mov bx, ds:[si][SI_scrollHandle] ;nuke the scroll buffer tst bx jz noScroll call MemFree noScroll: ret ScreenExit endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenSoundBell %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Ring a bell CALLED BY: MSG_SCR_SOUND_BELL PASS: ds:*si - screen instance data es - dgroup [SI_screenBuf] - pointing to unlocked segment RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 01/24/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenSoundBell method ScreenClass, MSG_SCR_SOUND_BELL mov si, ds:[si] ;deref to instance data cmp ds:[si][SI_visualBell], TRUE je visBell mov ax, SST_CUSTOM_NOTE mov cx, BELL_FREQ mov dx, BELL_DUR call UserStandardSound jmp short exit visBell: mov di, ds:[si][SI_gState] ;get GState call DoVisualBell exit: ret ScreenSoundBell endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenVisualBell %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: make screen flash a bell CALLED BY: MSG_SCR_VISUAL_BELL PASS: ds:*si - screen instance data es - dgroup [SI_screenBuf] - pointing to unlocked segment RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: Calling audio bell temporarily KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 01/22/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenVisualBell method ScreenClass, MSG_SCR_VISUAL_BELL ;; call ScreenSoundBell ;;they are using visual for a reason... - brianc 8/17/90 mov si, ds:[si] ; deref. mov di, ds:[si].SI_gState call DoVisualBell ret ScreenVisualBell endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenCursorLeft %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle a backspace character CALLED BY: MSG_SCR_CURSOR_LEFT PASS: ds:*si - screen instance data es - dgroup [SI_screenBuf] - pointing to unlocked segment RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/04/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenCursorLeft method ScreenClass, MSG_SCR_CURSOR_LEFT mov si, ds:[si] ;deref to instance data NCUR < tst ds:[si][SI_curChar] ;if cursor at start of line> CUR < tst ds:[si][SI_curPos] > jz exit ; don't decrement it mov di, ds:[si][SI_gState] call EraseCursor NCUR < dec ds:[si][SI_curChar] ;adjust cursor position > CUR < dec ds:[si][SI_curPos] > CUR < call GetCurCharFromCurPos > call DrawCursor exit: ret ScreenCursorLeft endm ScreenCursorLeftN method ScreenClass, MSG_SCR_CURSOR_LEFT_N clr cl xchg cl, ch ; cx = N tst cx jnz doIt inc cx ; move even when arg=0 doIt: mov si, bx NCUR < tst ds:[si].SI_curChar > CUR < tst ds:[si][SI_curPos] > jz exit mov di, ds:[si].SI_gState push cx ; save N call EraseCursor pop cx ; restore N NCUR < sub ds:[si].SI_curChar, cx > CUR < sub ds:[si].SI_curPos, cx > jge onScreen NCUR < clr ds:[si].SI_curChar ; else, force to 0 > CUR < clr ds:[si].SI_curPos > onScreen: CUR < call GetCurCharFromCurPos > call DrawCursor exit: ret ScreenCursorLeftN endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenTab %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle a tab character CALLED BY: MSG_SCR_TAB PASS: ds:*si - screen instance data es - dgroup [SI_screenBuf] - pointing to unlocked segment RETURN: nothing DESTROYED: si, di, cx PSEUDO CODE/STRATEGY: Assume Tab stops set every TAB_STOP places so want to calculate how many cols till next tab and advance cursor that many columns. # spaces to add = TABSTOP - (column pos / TAB_STOP) KNOWN BUGS/SIDE EFFECTS/IDEAS: Don't allow user to tab past the end of line REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/04/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenTab method ScreenClass, MSG_SCR_TAB mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] call EraseCursor if HALF_AND_FULL_WIDTH ;----------------------------------------------------- if CURSOR mov ch, {byte} ds:[si][SI_curPos] ;get current col # (only byte) and ch, DIV_8_MASK ;find out how many space) mov cl, TAB_STOP ;till next tab stop sub cl, ch clr ch add cx, ds:[si][SI_curPos] ;get new cursor position cmp cx, MAX_LINE_CHARS ;if cursor past end of line jg exit ;don't update it mov ds:[si][SI_curPos], cx ; call GetCurCharFromCurPos exit: else push ax, bx, dx call CalcCursorPos ; ax = X pos, bx = Y pos mov dx, bx ; dx = Y pos mov cl, {byte} ds:[si].SI_charWidth div cl ; ax = char column and ax, not 7 add ax, 8 cmp ax, MAX_LINE_CHARS ; past end? jg exit ; yes, do nothing mov cl, {byte} ds:[si].SI_charWidth mul cl ; ax = desired X pos mov cx, ax ; cx = desired X pos call ConvertToTextCoords ; cx = text column, dx = text ; line EC < mov ax, ds:[si].SI_curLine > EC < add ax, ds:[si].SI_winTopLine > EC < cmp ax, dx > EC < ERROR_NE -1 > mov ds:[si].SI_curChar, cx ; new cursor position exit: pop ax, bx, dx endif else ;--------------------------------------------------------------------- mov ch, {byte} ds:[si][SI_curChar];get current col # (only byte) and ch, DIV_8_MASK ;find out how many spaces mov cl, TAB_STOP ;till next tab stop sub cl, ch clr ch add cx, ds:[si][SI_curChar] ;get new cursor position cmp cx, MAX_LINE_CHARS ;if cursor past end of line jg exit ;don't update it mov ds:[si][SI_curChar], cx ; exit: endif ;--------------------------------------------------------------------- call DrawCursor ret ScreenTab endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenCursorDownOrScroll %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Move cursor down 1 row. If already at bottom of scroll region, scroll the region up. If cursor is below the scroll region, will not scroll (VT100 behavior) CALLED BY: MSG_SCR_CURSOR_DOWN PASS: ds:*si - screen instance data es - dgroup [SI_screenBuf] - pointing to unlocked segment RETURN: nothing DESTROYED: es PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: This was formerly MSG_SCR_CURSOR_DOWN, but it does more than just move the cursor down. REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/04/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenCursorDownOrScroll method ScreenClass, MSG_SCR_CURSOR_DOWN_OR_SCROLL mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] NCUR < cmp ds:[si][SI_curChar], MAX_LINE_CHARS > CUR < cmp ds:[si][SI_curPos], MAX_LINE_CHARS > jne 10$ clr ds:[si][SI_curChar] ;if LF comes in at 81 column ;then autowrap CUR < clr ds:[si][SI_curPos] > 10$: call EraseCursor if (HALF_AND_FULL_WIDTH and not CURSOR) call CalcCursorPos ;ax = X pos, bx = Y pos push ax, bx call DoCursorDown pop cx, dx add dx, ds:[si].SI_lineHeight call ConvertToTextCoords ;cx = column, dx = line mov ds:[si].SI_curChar, cx ;store new column else call DoCursorDown endif CUR < call GetCurCharFromCurPos > call DrawCursor exit: ret ScreenCursorDownOrScroll endm ScreenCursorDownOrScrollN method ScreenClass, MSG_SCR_CURSOR_DOWN_OR_SCROLL_N clr cl xchg cl, ch ; cx = N jcxz exit mov si, bx mov di, ds:[si].SI_gState push cx ; save N call EraseCursor pop cx ; restore N if (HALF_AND_FULL_WIDTH and not CURSOR) call CalcCursorPos ;ax = X pos, bx = Y pos push ax, bx, cx downLoop: push cx call DoCursorDown pop cx loop downLoop pop cx, dx, bx ;cx = X pos, dx = Y pos, bx = N mov ax, ds:[si].SI_lineHeight mul bl ;ax = height of N lines add dx, ax call ConvertToTextCoords ;cx = column, dx = line mov ds:[si].SI_curChar, cx ;store new column else downLoop: push cx call DoCursorDown pop cx loop downLoop endif CUR < call GetCurCharFromCurPos > call DrawCursor exit: ret ScreenCursorDownOrScrollN endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenCR %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle a CR character CALLED BY: MSG_SCR_CR PASS: ds:*si - screen instance data es - dgroup RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: Move cursor to far left KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/04/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenCR method ScreenClass, MSG_SCR_CR CCT < GetResourceSegmentNS dgroup, es > mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] call EraseCursor clr ds:[si][SI_curChar] CUR < clr ds:[si][SI_curPos] > tst ds:[si][SI_autoLinefeed] ;is auto line feed set jz draw ;nope call DoCursorDown ;yep, insert a CR ;always redraw cursor, as DoCursorDown doesn't do it - brianc ; jnc exit ;if scrolled don't draw cursor draw: call DrawCursor DBCS < mov ax, CHAR_CR > SBCS < mov al, CHAR_CR > if _CAPTURE_CLEAN_TEXT ;------------------------------------------ CaptureCR label far cmp es:[fileHandle], BOGUS_VAL je dontCapture if ERROR_CHECK SBCS < mov ah, -1 ; make high byte null > endif call FileCaptureTextChar ; destroy ax,bx,cx,dx,si,di, ; ds, es dontCapture: endif ; _CAPTURE_CLEAN_TEXT ------------------------------------------- exit: ret ScreenCR endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenLF %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handles a linefeed character CALLED BY: MSG_SCR_LF PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data ds:bx = ScreenClass object (same as *ds:si) es = segment of ScreenClass ax = message # RETURN: DESTROYED: SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- CT 4/ 4/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenLF method dynamic ScreenClass, MSG_SCR_LF CCT < GetResourceSegmentNS dgroup, es > mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] call EraseCursor call DoCursorDown ; ; If linefeed/newline mode, append a newline ; test ds:[si][SI_modeFlags], mask SVTMF_LF_NEWLINE jz afterNewline clr ds:[si][SI_curChar] CUR < clr ds:[si][SI_curPos] > afterNewline: call DrawCursor if _CAPTURE_CLEAN_TEXT ;------------------------------------------ DBCS < mov ax, CHAR_LF > SBCS < mov al, CHAR_LF > GOTO CaptureCR else ; _CAPTURE_CLEAN_TEXT ------------------------------------------- ret endif ScreenLF endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenNextLine %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Moves cursor down (scrolling if necessary), and puts cursor on first position. CALLED BY: MSG_SCR_NEXT_LINE PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data ds:bx = ScreenClass object (same as *ds:si) es = segment of ScreenClass ax = message # RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- CT 2/22/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenNextLine method dynamic ScreenClass, MSG_SCR_NEXT_LINE mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] call EraseCursor clr ds:[si][SI_curChar] ; Beginning of line call DoCursorDown ; next line call DrawCursor ret ScreenNextLine endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenScrollTextDown %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle a scroll down character CALLED BY: MSG_SCR_SCROLL_DOWN PASS: ds:*si - screen instance data es - dgroup RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: Should combine this routine and CheckForScroll routines to make a common srollNLines routine. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/04/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenScrollTextDown method ScreenClass, MSG_SCR_SCROLL_DOWN call ScreenInsLine ret ScreenScrollTextDown endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenScrollTextUp %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle a scroll up character CALLED BY: MSG_SCR_SCROLL_UP PASS: ds:*si - screen instance data es - dgroup [SI_screenBuf] - unlocked segment RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 11/02/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenScrollTextUp method ScreenClass, MSG_SCR_SCROLL_UP mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState push di ; save it call EraseCursor mov bx, ds:[si][SI_screenHandle] call MemLock mov ds:[si][SI_screenBuf], ax call BufScrollUp ;scroll screen buf up call BufClearLine ;clear out buffer line call WinScrollUp ;scroll screen image up mov bx, ds:[si][SI_screenHandle] call MemUnlock EC < call NullScreenBuf ; stuff bogus segment > pop di ; retrieve gState call DrawCursor ; show cursor ret ScreenScrollTextUp endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenCursorUpOrScroll %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Move cursor up 1 row. If already at top of scroll region, scroll region down. If cursor is above the scroll region will not scroll (VT100 behavior) CALLED BY: MSG_SCR_CURSOR_UP_OR_SCROLL PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data ds:bx = ScreenClass object (same as *ds:si) es = segment of ScreenClass ax = message # RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- CT 2/21/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenCursorUpOrScroll method dynamic ScreenClass, MSG_SCR_CURSOR_UP_OR_SCROLL ; ; Cursor on top line of scroll region? ; mov ax, ds:[di].SI_curLine cmp ax, ds:[di].SI_scrollRegTop je scroll ; ; NO: just move up GOTO ScreenCursorUp scroll: ; ; YES: scroll region down (by inserting blank line on top) ; call ScreenInsLine ret ScreenCursorUpOrScroll endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenCursorDown %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Move cursor down 1 row, with no scrolling when it gets to the bootom of the screen or scorll area CALLED BY: MSG_SCR_CURSOR_DOWN PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data ds:bx = ScreenClass object (same as *ds:si) es = segment of ScreenClass ax = message # ch = # lines to move down (if DOWN_N) RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: Currently only implements the VT100 behavior of the cursor-down commands. You may have to modify this if your terminal does something different. REVISION HISTORY: Name Date Description ---- ---- ----------- CT 2/21/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenCursorDown method dynamic ScreenClass, MSG_SCR_CURSOR_DOWN, MSG_SCR_CURSOR_DOWN_N cmp ax, MSG_SCR_CURSOR_DOWN jne haveN mov ch, 1 ; N = 1 for CURSOR_DOWN haveN: clr cl xchg cl, ch ; cx = N tst cx jnz doIt inc cx ; an argument of 0 still moves ; the cursor doIt: mov si, ds:[si] add cx, ds:[si][SI_curLine] ; cx = desired destination ; ; If original position is outside the scroll area, then downward ; movement isn't constrained by it. ; mov ax, ds:[si][SI_curLine] cmp ax, ds:[si][SI_scrollRegBot] ja checkScreen ; ; Constrain to scroll area ; cmp cx, ds:[si][SI_scrollRegBot] jbe checkScreen mov cx, ds:[si][SI_scrollRegBot] checkScreen: ; ; Constrain to physical screen ; cmp cx, MAX_LINES jb newPos mov cx, MAX_LINES-1 newPos: GOTO CursorUpDownCommon ScreenCursorDown endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenCursorUp %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Move cursor up 1 row, with no scrolling when it gets to the bootom of the screen or scorll area CALLED BY: MSG_SCR_CURSOR_UP PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data ds:bx = ScreenClass object (same as *ds:si) es = segment of ScreenClass ax = message # ch = # lines to move up (if UP_N) RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: Currently only implements the VT100 behavior of the cursor-up commands. You may have to modify this if your terminal does something different. REVISION HISTORY: Name Date Description ---- ---- ----------- CT 2/21/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenCursorUp method ScreenClass, MSG_SCR_CURSOR_UP, MSG_SCR_CURSOR_UP_N cmp ax, MSG_SCR_CURSOR_UP jne haveN mov ch, 1 ; N = 1 for CURSOR_UP haveN: clr cl xchg cl, ch ; cx = N tst cx jnz doIt inc cx ; an argument of 0 still moves ; the cursor doIt: mov si, ds:[si] sub cx, ds:[si][SI_curLine] neg cx ; cx = desired destination ; ; Constrain to screen ; jns constrainScroll ; If < 0, clr cx ; make 0 constrainScroll: ; ; If original position is outside the scroll area, then upward ; movement isn't constrained by it. ; mov ax, ds:[si][SI_curLine] cmp ax, ds:[si][SI_scrollRegTop] jb newPos ; ; Constrain to scroll area ; cmp cx, ds:[si][SI_scrollRegTop] jae newPos mov cx, ds:[si][SI_scrollRegTop] newPos: FALL_THRU CursorUpDownCommon ScreenCursorUp endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CursorUpDownCommon %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Completes cursor positioning for UP/DOWN commands CALLED BY: (INTERNAL) ScreenCursorUp, ScreenCursorDown PASS: ds:si = ScreenClass instance data cx = new value for SI_curLine RETURN: nothing DESTROYED: di SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- CT 2/22/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CursorUpDownCommon proc far class ScreenClass ; ; If the cursor is in the phantom 81'st column, ; an up/down ALWAYS puts it back in the 80th (even if ; the cursor didn't actually move up or down) ; cmp ds:[si][SI_curChar], MAX_LINE_CHARS jb doDraw EC < ERROR_A TERM_ERROR_INVALID_CURSOR_POSITION > mov ds:[si][SI_curChar], MAX_LINE_CHARS-1 doDraw: ; ; Optimization: If cursor didn't physically move, don't bother ; drawing it. ; cmp cx, ds:[si][SI_curLine] je exit mov di, ds:[si][SI_gState] push cx call EraseCursor pop cx mov ds:[si][SI_curLine], cx call DrawCursor exit: ret CursorUpDownCommon endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenClearHomeCursor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle a clear screen and home cursor terminal sequence CALLED BY: MSG_SCR_CLEAR_HOME_CURSOR PASS: ds:*si - screen instance data es - dgroup RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: We want to clear the screen and home the cursor, already have method handlers to do this so just call them KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/04/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenClearHomeCursor method ScreenClass, MSG_SCR_CLEAR_HOME_CURSOR push si ;save ptr to instance data call ScreenHomeCursor pop si ;restore ptr call ScreenClearToEndDisplay ; and call method handler ret ScreenClearHomeCursor endm if _CLEAR_SCR_BUF COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenClearScreenAndScrollBuf %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Clear screen and scroll buffer CALLED BY: MSG_SCR_CLEAR_SCREEN_AND_SCROLL_BUF PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data es = segment of ScreenClass ax = message # RETURN: carry set if not enough memory DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: Clear screen; Clear scroll buffer; Set view to the top; REVISION HISTORY: Name Date Description ---- ---- ----------- simon 10/13/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenClearScreenAndScrollBuf method dynamic ScreenClass, MSG_SCR_CLEAR_SCREEN_AND_SCROLL_BUF .enter call ScreenClearHomeCursor ; clear screen call ScreenClearScreenAndScrollBufResetParams ; ; Clear scroll buffer ; call ScreenClearScrollBuf ; carry set if can't realloc ; scroll buffer pushf call ResetView ; set view to top of doc popf .leave ret ScreenClearScreenAndScrollBuf endm endif ; _CLEAR_SCR_BUF COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenCursorUpUnconstrained %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Moves cursor up <n> lines in the same column, without regard for the scroll area. CALLED BY: MSG_SCR_CURSOR_UP_UNCONSTRAINED PASS: ds:*si - screen instance data es - dgroup RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/04/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenCursorUpUnconstrained method ScreenClass, MSG_SCR_CURSOR_UP_UNCONSTRAINED mov si, ds:[si] ;deref to instance data tst ds:[si][SI_curLine] ;if cursor at top of screen je exit ; bug out mov di, ds:[si][SI_gState] ;get GState call EraseCursor if (HALF_AND_FULL_WIDTH and not CURSOR) call CalcCursorPos ;ax = X pos, bx = Y pos dec ds:[si].SI_curLine ;move cursor up one line mov cx, ax mov dx, bx sub dx, ds:[si].SI_lineHeight call ConvertToTextCoords ;cx = column, dx = line EC < mov ax, ds:[si].SI_curLine > EC < add ax, ds:[si].SI_winTopLine > EC < cmp ax, dx > EC < ERROR_NE -1 > mov ds:[si].SI_curChar, cx ;store new column else dec ds:[si][SI_curLine] ;move cursor up one line endif CUR < call GetCurCharFromCurPos > call DrawCursor exit: ret ScreenCursorUpUnconstrained endm ScreenCursorUpNUnconstrained method ScreenClass, MSG_SCR_CURSOR_UP_N_UNCONSTRAINED clr cl xchg cl, ch ; cx = N jcxz exit mov si, bx tst ds:[si].SI_curLine jz exit mov di, ds:[si].SI_gState push cx ; save N call EraseCursor pop cx ; restore N if (HALF_AND_FULL_WIDTH and not CURSOR) call CalcCursorPos ;ax = X pos, bx = Y pos sub ds:[si].SI_curLine, cx jge onScreen clr ds:[si].SI_curLine ; else, force to 0 onScreen: mov dx, cx ;dx = N mov cx, ds:[si].SI_lineHeight xchg cx, ax ;ax = line height, cx = X pos xchg dx, bx ;dx = Y pos, bx = N mul bl ;ax = height of N lines sub dx, ax call ConvertToTextCoords ;cx = column, dx = line EC < mov ax, ds:[si].SI_curLine > EC < add ax, ds:[si].SI_winTopLine > EC < cmp ax, dx > EC < ERROR_NE -1 > mov ds:[si].SI_curChar, cx ;store new column else sub ds:[si].SI_curLine, cx jge onScreen clr ds:[si].SI_curLine ; else, force to 0 onScreen: endif CUR < call GetCurCharFromCurPos > call DrawCursor exit: ret ScreenCursorUpNUnconstrained endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenCursorRight %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle a cursor right terminal sequence CALLED BY: MSG_SCR_CURSOR_RIGHT PASS: ds:*si - screen instance data es - dgroup RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: If cursor already at end of line can't advance it any more. If in phantom 81'st column, bring it back to the 80th (VT100 behavior) KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/04/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenCursorRight method ScreenClass, MSG_SCR_CURSOR_RIGHT mov si, ds:[si] ;deref to instance data NCUR < cmp ds:[si][SI_curChar], MAX_LINE_CHARS-1 > CUR < cmp ds:[si][SI_curPos], MAX_LINE_CHARS-1 > je exit jl moveIt NCUR < mov ds:[si][SI_curChar], MAX_LINE_CHARS-2 > CUR < mov ds:[si][SI_curPos], MAX_LINE_CHARS-2 > moveIt: mov di, ds:[si][SI_gState] ;get GState call EraseCursor NCUR < inc ds:[si][SI_curChar] > CUR < inc ds:[si][SI_curPos] > CUR < call GetCurCharFromCurPos > call DrawCursor exit: ret ScreenCursorRight endm ScreenCursorRightN method ScreenClass, MSG_SCR_CURSOR_RIGHT_N clr cl xchg cl, ch ; cx = N tst cx jnz doIt inc cx ; move even when arg=0 doIt: mov si, bx NCUR < cmp ds:[si].SI_curChar, MAX_LINE_CHARS-1 ; valid? > CUR < cmp ds:[si].SI_curPos, MAX_LINE_CHARS-1 > je exit mov di, ds:[si].SI_gState push cx ; save N call EraseCursor pop cx ; restore N NCUR < add ds:[si].SI_curChar, cx > NCUR < cmp ds:[si].SI_curChar, MAX_LINE_CHARS ; valid? > CUR < add ds:[si].SI_curPos, cx > CUR < cmp ds:[si].SI_curPos, MAX_LINE_CHARS > jl onScreen ; yes NCUR < mov ds:[si].SI_curChar, MAX_LINE_CHARS-1 ; force on screen> CUR < mov ds:[si].SI_curPos, MAX_LINE_CHARS-1 > CUR < call GetCurCharFromCurPos > onScreen: call DrawCursor exit: ret ScreenCursorRightN endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenHomeCursor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle a home cursor terminal sequence CALLED BY: MSG_SCR_HOME_CURSOR PASS: ds:*si - screen instance data RETURN: nothing DESTROYED: ax, bp, es PSEUDO CODE/STRATEGY: Delete the diplayed lines from scroll buffer Adjust cursor position KNOWN BUGS/SIDE EFFECTS/IDEAS: Should be modified to clear tabstops REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/13/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenHomeCursor method ScreenClass, MSG_SCR_HOME_CURSOR mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState call EraseCursor clr cx mov ds:[si][SI_curChar], cx CUR < mov ds:[si][SI_curPos], cx > mov ds:[si][SI_curLine], cx call DrawCursor ret ScreenHomeCursor endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenClearToEndDisplay %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Clear screen from cursor to end of display CALLED BY: MSG_SCR_CLEAR_TO_END_DISP PASS: ds:*si - screen instance data es - dgroup RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/04/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenClearToEndDisplay method ScreenClass, MSG_SCR_CLEAR_TO_END_DISP mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState push di ; save it call EraseCursor ;flag cursor nuked call WinClearToEnd ;clear the screen display mov bx, ds:[si][SI_screenHandle] ;lock screen buffer call MemLock mov ds:[si][SI_screenBuf], ax call BufClearToEndLine ; clear rest of current line mov bx, ds:[si][SI_screenHandle] ;unlock stinking block call MemUnlock EC < call NullScreenBuf ; stuff bogus segment > inc ds:[si][SI_curLine] call BufClear ;clear all lines below dec ds:[si][SI_curLine] pop di ; retrieve gState call DrawCursor ; show cursor ret ScreenClearToEndDisplay endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenClearToEndLine %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Clear screen from cursor to end of current line CALLED BY: MSG_SCR_CLEAR_TO_END_LINE PASS: ds:*si - screen instance data es - dgroup RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: To clear the line we blank out the rest of the line. REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/04/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenClearToEndLine method ScreenClass, MSG_SCR_CLEAR_TO_END_LINE mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState call EraseCursor mov bx, ds:[si][SI_screenHandle] call MemLock mov ds:[si][SI_screenBuf], ax call EraseRemLine ;erase the line on the screen call BufClearToEndLine mov ax, MAX_LINE_CHARS ;pass #chars to draw sub ax, ds:[si][SI_curChar] call DrawRemLine ;draw the line of blanks mov bx, ds:[si][SI_screenHandle] call MemUnlock EC < call NullScreenBuf ; stuff bogus segment > call DrawCursor ret ScreenClearToEndLine endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenClearToBegLine %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Clears current line from first column to cursor (inclusive) CALLED BY: MSG_SCR_CLEAR_TO_BEG_LINE PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data ds:bx = ScreenClass object (same as *ds:si) es = segment of ScreenClass ax = message # RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- CT 2/20/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenClearToBegLine method dynamic ScreenClass, MSG_SCR_CLEAR_TO_BEG_LINE .enter mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState call EraseCursor mov bx, ds:[si][SI_screenHandle] call MemLock mov ds:[si][SI_screenBuf], ax call EraseBegLine ;erase the line on the screen call BufClearToBegLine mov bx, ds:[si][SI_screenHandle] call MemUnlock EC < call NullScreenBuf ; stuff bogus segment > call DrawCursor .leave ret ScreenClearToBegLine endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenClearToBegDisp %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Clears chars from upper left of disp to cursor (inclusive) CALLED BY: MSG_SCR_CLEAR_TO_BEG_DISP PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data ds:bx = ScreenClass object (same as *ds:si) es = segment of ScreenClass ax = message # RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- CT 2/20/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenClearToBegDisp method dynamic ScreenClass, MSG_SCR_CLEAR_TO_BEG_DISP .enter mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState push di ; save it call EraseCursor ;flag cursor nuked call WinClearToBeg ;clear the screen display mov bx, ds:[si][SI_screenHandle] ;lock screen buffer call MemLock mov ds:[si][SI_screenBuf], ax call BufClearToBegLine ; clear rest of current line mov bx, ds:[si][SI_screenHandle] ;unlock stinking block call MemUnlock EC < call NullScreenBuf ; stuff bogus segment > dec ds:[si][SI_curLine] js resetLine call BufClearUpward ;clear all lines above resetLine: inc ds:[si][SI_curLine] pop di ; retrieve gState call DrawCursor ; show cursor .leave ret ScreenClearToBegDisp endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenClearLine %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Clears entire current line CALLED BY: MSG_SCR_CLEAR_LINE PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data ds:bx = ScreenClass object (same as *ds:si) es = segment of ScreenClass ax = message # RETURN: DESTROYED: SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- CT 2/20/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenClearLine method dynamic ScreenClass, MSG_SCR_CLEAR_LINE .enter mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState push di ; save it call EraseCursor mov bx, ds:[si][SI_screenHandle] call MemLock mov ds:[si][SI_screenBuf], ax call BufClearLine ;clear cur line in buffer call WinClearLine ; clear line in window mov bx, ds:[si][SI_screenHandle] call MemUnlock EC < call NullScreenBuf ; stuff bogus segment > pop di ; retrieve gState call DrawCursor ; redraw cursor .leave ret ScreenClearLine endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Screen(Save/Restore)Curosr %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: save cursor position, display enhancements, character set, end-of-line wrap state, selective erase state, and origin mode. CALLED BY: MSG_SCR_SAVE_CURSOR, MSG_SCR_RESTORE_CURSOR PASS: ds:*si - screen instance data RETURN: nothing DESTROYED: ax PSEUDO CODE/STRATEGY: DORKED : currently just save the character position this is supposed to be vt220 only. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/31/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenSaveCursor method ScreenClass, MSG_SCR_SAVE_CURSOR mov si, ds:[si] ;deref to instance data mov ax, ds:[si][SI_curLine] mov ds:[si][SI_saveCursorY], ax NCUR < mov ax, ds:[si][SI_curChar] > CUR < mov ax, ds:[si][SI_curPos] > mov ds:[si][SI_saveCursorX], ax ret ScreenSaveCursor endm ScreenRestoreCursor method ScreenClass, MSG_SCR_RESTORE_CURSOR mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState call EraseCursor mov ax, ds:[si][SI_saveCursorX] EC < cmp ax, MAX_LINE_CHARS > EC < ERROR_AE TERM_ERROR_INVALID_CURSOR_POSITION > NCUR < mov ds:[si][SI_curChar], ax > CUR < mov ds:[si][SI_curPos], ax > CUR < call GetCurCharFromCurPos > mov ax, ds:[si][SI_saveCursorY] EC < cmp ax, MAX_LINES > EC < ERROR_AE TERM_ERROR_INVALID_CURSOR_POSITION > mov ds:[si][SI_curLine], ax call DrawCursor ret ScreenRestoreCursor endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenChangeScrollReg %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Scrolling region is the area between top and bottom margins that moves during vertical scrolling. CALLED BY: MSG_SCR_CHANGE_SCROLLREG PASS: ds:*si - screen instance data es - dgroup ch - scroll reg top cl - scroll reg bottom RETURN: nothing DESTROYED: ax PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/31/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenChangeScrollReg method ScreenClass, MSG_SCR_CHANGE_SCROLLREG ; ; Scroll region bottom must be greater than scroll region top. If ; not, skip operation. ; cmp ch, cl ;top >= bottom ? jae done mov si, ds:[si] ;deref to instance data clr ah ;scroll region is byte value mov al, ch mov ds:[si][SI_scrollRegTop], ax ;store scroll reg top mov al, cl mov ds:[si][SI_scrollRegBot], ax ;store scroll reg bot done: ret ScreenChangeScrollReg endm ;func 26 COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenResetScrollReg %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Reset the scroll region CALLED BY: MSG_SCR_RESET_SCROLLREG PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data es = segment of ScreenClass ax = message # RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: Reset object instance's data SI_scrollRegTop and SI_scrollRegBot REVISION HISTORY: Name Date Description ---- ---- ----------- simon 1/16/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenResetScrollReg method dynamic ScreenClass, MSG_SCR_RESET_SCROLLREG .enter mov si, ds:[si] ; dssi <- instance data ; ; Default scroll region is whole screen ; clr ds:[si][SI_scrollRegTop] mov ds:[si][SI_scrollRegBot], (MAX_LINES - 1) .leave ret ScreenResetScrollReg endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenRelCursorMove %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Move the cursor relative to the screen CALLED BY: MSG_SCR_REL_CURSOR_MOVE PASS: ds:*si - screen instance data es - dgroup ch - row position cl - column position RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: Should I check for illegal (> 24,80) cursor coordinates, yes But not printing error message. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/04/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenRelCursorMove method ScreenClass, MSG_SCR_REL_CURSOR_MOVE mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState cmp ch, MAX_LINES ;is col value okay? jb checkCol ;yep ; ; Since the arguments can \E[0;0H, LoadArgs may change deliver it as ; -1, -1. So, we change it 0, 0 by default. ; cmp ch, -1 ;set to zero row? jne setDefRow clr ch ; default to 1st row jmp checkCol setDefRow: mov ch, MAX_LINES - 1 ;nope checkCol: cmp cl, MAX_LINE_CHARS ;is row value okay? jb moveCursor cmp cl, -1 ;line# zero? (converted to -1) jne setDefCol clr cl ;default to 1st col jmp moveCursor setDefCol: mov cl, MAX_LINE_CHARS - 1 ; jmp short moveCursor ;error: ; mov bp, ERR_CURSOR_MOVE ; segmov ds, es, cx ; CallMod DisplayErrorMessage ; jmp short exit moveCursor: mov bp, cx ;save cursor coordinates call EraseCursor ;erase the old cursor mov cx, bp ;restore cursor pos clr dh mov dl, ch ;get cursor's row position mov ds:[si][SI_curLine], dx ; and store it mov dl, cl ;get cursor's col position NCUR < mov ds:[si][SI_curChar], dx ; and store it > CUR < mov ds:[si][SI_curPos], dx > CUR < call GetCurCharFromCurPos > call DrawCursor CUR <EC <call AssertCurCharCurPos >> exit: ret ScreenRelCursorMove endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenInsLine %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Insert a line at the current cursor position CALLED BY: MSG_SCR_INS_LINE PASS: ds:*si - screen instance data es - dgroup RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: scroll rest of the window down one line KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/17/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenInsLine method ScreenClass, MSG_SCR_INS_LINE mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState push di ; save it call EraseCursor mov bx, ds:[si][SI_screenHandle] call MemLock mov ds:[si][SI_screenBuf], ax call BufScrollDown ;add blank line to screen buf call BufClearLine ;clear cur line in buffer call WinScrollDown ;insert a line on the screen mov bx, ds:[si][SI_screenHandle] call MemUnlock EC < call NullScreenBuf ; stuff bogus segment > pop di ; retrieve gState call DrawCursor ; redraw cursor ret ScreenInsLine endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenBackTab %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Moves the cursor backwards to the preceding tab position CALLED BY: MSG_SCR_BACK_TAB PASS: ds:*si - screen instance data es - dgroup ch - # of tabs to back up RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: Move the cursor back to the prev tab stop KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/31/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenBackTab method ScreenClass, MSG_SCR_BACK_TAB mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] NCUR < tst ds:[si][SI_curChar] ;if cursor at col 0 exit> CUR < tst ds:[si][SI_curPos] > je SBT_ret call EraseCursor if HALF_AND_FULL_WIDTH ;----------------------------------------------------- if CURSOR mov cx, ds:[si][SI_curPos] ;get current col # andnf cl, DIV_8_MASK ;how many spaces past tab tst cl ;if not on tab then jne SBT_sub ; go to prev tab mov cl, TAB_STOP ;till next tab stop SBT_sub: mov dx, ds:[si][SI_curPos] sub dx, cx ;get new cursor position tst dx ;make sure its valid jl exit mov ds:[si][SI_curPos], dx ;update cursor position call GetCurCharFromCurPos exit: else push ax, bx, dx call CalcCursorPos ; ax = X pos, bx = Y pos mov dx, bx ; dx = Y pos mov cl, {byte} ds:[si].SI_charWidth div cl ; ax = char column mov bx, ax and ax, not 7 tst ax ; at beginning? jz exit ; yes, do nothing test bx, 7 ; at tab stop before? jnz haveTab ; nope, move to this tab stop sub ax, 8 ; else, move to previous stop haveTab: mov cl, {byte} ds:[si].SI_charWidth mul cl ; ax = desired X pos mov cx, ax ; cx = desired X pos call ConvertToTextCoords ; cx = text column, dx = text ; line EC < mov ax, ds:[si].SI_curLine > EC < add ax, ds:[si].SI_winTopLine > EC < cmp ax, dx > EC < ERROR_NE -1 > mov ds:[si].SI_curChar, cx ; new cursor position exit: pop ax, bx, dx endif else ;--------------------------------------------------------------------- mov cx, ds:[si][SI_curChar] ;get current col # andnf cl, DIV_8_MASK ;how many spaces past tab tst cl ;if not on tab then jne SBT_sub ; go to prev tab mov cl, TAB_STOP ;till next tab stop SBT_sub: mov dx, ds:[si][SI_curChar] sub dx, cx ;get new cursor position tst dx ;make sure its valid jl exit mov ds:[si][SI_curChar], dx ;update cursor position exit: endif ;--------------------------------------------------------------------- call DrawCursor SBT_ret: ret ScreenBackTab endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenDelLine %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Delete the line at the current cursor position CALLED BY: MSG_SCR_DEL_LINE PASS: ds:*si - screen instance data es - dgroup RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: Scroll the rest of the window up one line to overwrite the current line. *** Blank out the bottom line, cause even if VI puts stuff to write there, with graphics not overwriting it'll look dorked. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/17/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenDelLine method ScreenClass, MSG_SCR_DEL_LINE mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState push di ; save it call EraseCursor call BufDelLine call WinDelLine pop di ; retreive gState call DrawCursor ; show cursor ret ScreenDelLine endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenDelChar %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Delete the char at the current cursor position CALLED BY: MSG_SCR_DEL_CHAR PASS: ds:*si - screen instance data es - dgroup RETURN: nothing DESTROYED: dx PSEUDO CODE/STRATEGY: Shift the current line starting from one past the cursor postion back one character. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/17/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenDelChar method ScreenClass, MSG_SCR_DEL_CHAR mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState call EraseCursor mov bx, ds:[si][SI_screenHandle] call MemLock mov ds:[si][SI_screenBuf], ax call BufShiftLineLeft call EraseRemLine ;HACK-no overstrike mov ax, MAX_LINE_CHARS sub ax, ds:[si][SI_curChar] call DrawRemLine mov bx, ds:[si][SI_screenHandle] call MemUnlock EC < call NullScreenBuf ; stuff bogus segment > call DrawCursor ret ScreenDelChar endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenInsChar %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Insert a char at the current cursor position CALLED BY: MSG_SCR_INS_CHAR PASS: ds:*si - screen instance data es - dgroup RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: Shift the line from the cursor on one postion to the right. Stick char at the current cursor position. KNOWN BUGS/SIDE EFFECTS/IDEAS: Is there a problem of the cursor being past the 80th char on a line? Test wyse with a long line. REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/17/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenInsChar method ScreenClass, MSG_SCR_INS_CHAR call ScreenEnterInsMode ret ScreenInsChar endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenEnterInsMode %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Enter mode that inserts the following characters onto the screen. CALLED BY: MSG_SCR_ENTER_INS_MODE PASS: ds:*si - screen instance data es - dgroup RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/26/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenEnterInsMode method ScreenClass, MSG_SCR_ENTER_INS_MODE mov si, ds:[si] ;deref to instance data mov ds:[si][SI_insertMode], TRUE ret ScreenEnterInsMode endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenExitInsMode %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Exit mode that inserts the following characters onto the screen. CALLED BY: MSG_SCR_EXIT_INS_MODE PASS: ds:*si - screen instance data es - dgroup RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/17/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenExitInsMode method ScreenClass, MSG_SCR_EXIT_INS_MODE mov si, ds:[si] mov ds:[si][SI_insertMode], FALSE ret ScreenExitInsMode endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Screen(Up,Down,Left,Right)Arrow %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Call routines to handle arrow movement keys CALLED BY: MSG_SCR_ARROW_(UP, DOWN, LEFT, RIGHT) PASS: ds:*si - screen instance data es - dgroup RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/15/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenUpArrow method ScreenClass, MSG_SCR_UP_ARROW call ScreenCursorUpUnconstrained ret ScreenUpArrow endm ScreenDownArrow method ScreenClass, MSG_SCR_DOWN_ARROW call ScreenCursorDownOrScroll ret ScreenDownArrow endm ScreenRightArrow method ScreenClass, MSG_SCR_RIGHT_ARROW call ScreenCursorRight ret ScreenRightArrow endm ;func 9 ScreenLeftArrow method ScreenClass, MSG_SCR_LEFT_ARROW call ScreenCursorLeft ret ScreenLeftArrow endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenFunc(1,2,3,4) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Call routines asscoiated with vt100 Function keys CALLED BY: MSG_SCR_FUNC_(1,2,3,4) PASS: ds:*si - screen instance data es - dgroup RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/15/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenFunc1 method ScreenClass, MSG_SCR_FUNC_1 ret ScreenFunc1 endm ;func 11 ScreenFunc2 method ScreenClass, MSG_SCR_FUNC_2 ret ScreenFunc2 endm ;func 12 ScreenFunc3 method ScreenClass, MSG_SCR_FUNC_3 ret ScreenFunc3 endm ;func 13 ScreenFunc4 method ScreenClass, MSG_SCR_FUNC_4 ret ScreenFunc4 endm ScreenApplicationKeypad method ScreenClass, MSG_SCR_APPLICATION_KEYPAD BitSet ds:[di][SI_modeFlags], SVTMF_KEYPAD ret ScreenApplicationKeypad endm ScreenNumericKeypad method ScreenClass, MSG_SCR_NUMERIC_KEYPAD BitClr ds:[di][SI_modeFlags], SVTMF_KEYPAD ret ScreenNumericKeypad endm ScreenCursorOff method ScreenClass, MSG_SCR_CURSOR_OFF ret ScreenCursorOff endm ScreenCursorOn method ScreenClass, MSG_SCR_CURSOR_ON ret ScreenCursorOn endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenBoldOn %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Turn on BOLD screen attribute CALLED BY: MSG_SCR_BOLD_ON PASS: ds:*si - screen instance data es - dgroup RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 10/04/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenBoldOn method ScreenClass, MSG_SCR_BOLD_ON mov si, ds:[si] ;deref to instance data or ds:[si][SI_attributes], mask CA_BOLD_LO ret ScreenBoldOn endm ScreenUnderScoreOn method ScreenClass, MSG_SCR_UNDERSCORE_ON mov si, ds:[si] ;deref to instance data or ds:[si][SI_attributes], mask CA_UNDER_LO ret ScreenUnderScoreOn endm ScreenBlinkOn method ScreenClass, MSG_SCR_BLINK_ON ;;replaced with CA_SELECTED - 8/21/90 brianc ;;(CA_BLINK has no effect anyway) if 0 mov si, ds:[si] ;deref to instance data or ds:[si][SI_attributes], mask CA_BLINK_LO endif ret ScreenBlinkOn endm ScreenReverseOn method ScreenClass, MSG_SCR_REV_ON mov si, ds:[si] ;deref to instance data or ds:[si][SI_attributes], mask CA_REV_LO ret ScreenReverseOn endm ScreenUnderScoreOff method ScreenClass, MSG_SCR_UNDERSCORE_OFF mov si, ds:[si] ;deref to instance data and ds:[si][SI_attributes], not mask CA_UNDER_LO ret ScreenUnderScoreOff endm ScreenReverseOff method ScreenClass, MSG_SCR_REV_OFF mov si, ds:[si] ;deref to instance data and ds:[si][SI_attributes], not mask CA_REV_LO ret ScreenReverseOff endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenNormalMode %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Put Term in normal mode CALLED BY: MSG_SCR_NORMAL_MODE PASS: ds:*si - screen instance data es - dgroup RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: Brian Chin suggested that the GState not be changed to reflect the attribute byte. He thought that the GState should only be changed when writing to the screen. Well there was a bug cause WinClearToEnd and WinClear both didn't check the attributes. I think that when setting the mode to normal the GState can be changed immediately. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 01/22/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenNormalMode method ScreenClass, MSG_SCR_NORMAL_MODE mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState if _CHAR_SET ; ; Normal mode only resets the character style attr, but not character ; set. It clears all these attrs. ; andnf ds:[si][SI_attributes], \ not (mask CA_BOLD_LO or mask CA_UNDER_LO or mask CA_REV_LO) call SetTextStyleNormalAttr else clr ds:[si][SI_attributes] call SetNormalAttribute endif ; _CHAR_SET ret ScreenNormalMode endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenGoStatusCol %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Go to the given column in the status line CALLED BY: MSG_SCR_GO_STATUS_COL PASS: ds:*si - screen instance data es - dgroup ch - col # to go to RETURN: nothing DESTROYED: everything PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 01/22/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenGoStatusCol method ScreenClass, MSG_SCR_GO_STATUS_COL ret ScreenGoStatusCol endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenTermInit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Terminal initialization string CALLED BY: MSG_SCR_TERM_INIT PASS: ds:*si - screen instance data es - dgroup RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 11/03/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenTermInit method ScreenClass, MSG_SCR_TERM_INIT ret ScreenTermInit endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenSaneReset %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Reset terminal completely to sane modes CALLED BY: MSG_SCR_SANE_RESET PASS: ds:*si - screen instance data es - dgroup RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 11/03/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenSaneReset method ScreenClass, MSG_SCR_SANE_RESET ret ScreenSaneReset endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenScrollBufEmpty %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Empty out the scroll buffer CALLED BY: MSG_SCR_SCROLLBUF_EMPTY PASS: ds:*si - screen instance data es - dgroup RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: * When empty out the scroll buffer do you want to * clear out the current screen? currently doesn't do that REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 12/05/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenScrollBufEmpty method ScreenClass, MSG_SCR_SCROLLBUF_EMPTY mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState call EraseCursor if not _CHAR_SET mov ax, ds:[si][SI_scrollLines] ;scroll selected text call ScrollSelectRegion endif clr ax mov ds:[si][SI_scrollLines], ax ;nuke scroll variables mov ds:[si][SI_scrollTop], ax mov ds:[si][SI_winTopLine], ax ;reposition current screen mov ds:[si][SI_wrap], FALSE ;let ui scroll cmp di, BOGUS_VAL je exit call GrGetWinBounds ;get top of window position neg bx ;scroll back this amount push di mov dx, size PointDWord sub sp, dx mov bp, sp clr ax ;don't scroll horizontally mov ss:[bp].PD_x.low, ax ;zero x origin mov ss:[bp].PD_x.high, ax mov ss:[bp].PD_y.low, bx ;y origin in bx mov ss:[bp].PD_y.high, ax tst bx jns notSign mov ss:[bp].PD_y.high, 0xffff ; sign extend sword to dword notSign: GetResourceHandleNS TermView, bx mov si, offset TermView mov di, mask MF_CALL or mask MF_FIXUP_DS or mask MF_STACK mov ax, MSG_GEN_VIEW_SCROLL call ObjMessage add sp, size PointDWord pop di call WinInvalScreen ;redraw the whole screen exit: ret ScreenScrollBufEmpty endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenGraphicsOn %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Turn on graphics features CALLED BY: MSG_SCR_GRAPHICS_ON PASS: ds:*si - screen instance data es - dgroup if RESPONDER ch - 1st arg cl - 2nd arg dh - 3rd arg dl - 4th arg bp - Number of arguments passed else dgroup:[argArray] arguments: endif Character attribute in arguments: 0 : Turn off all attributes 1 : Bold Mode on 4 : Underscore on 5 : ScreenBlinkOn 7 : ScreenReverseOn RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: for (each numeric argument) { Set the character attribute accordingly; } KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 12/05/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenGraphicsOn method ScreenClass, MSG_SCR_GRAPHICS_ON EC < Assert_dgroup es > mov cx, es:[argNum] ; arg counter mov di, offset argArray ; es:di <- argArray setAttrLoop: CheckHack <(size argArray) eq MAX_EMULATION_ARG> EC < push di > EC < sub di, offset argArray > EC < cmp di, MAX_EMULATION_ARG > EC < ERROR_AE TERM_TOO_MANY_ARGS_TO_FUNCTIONS > EC < pop di > mov ah, es:[di] ; ; Set the graphics attribute according to the arguments. If arg ; is not one of graphics attributes, ignore the argument and move on. ; push si, di cmp ah, 1 je boldOn cmp ah, 4 je underScoreOn cmp ah, 5 je blinkOn cmp ah, 7 je reverseOn tst ah jz normal jmp endOfLoop boldOn: call ScreenBoldOn jmp short endOfLoop underScoreOn: call ScreenUnderScoreOn jmp short endOfLoop blinkOn: call ScreenBlinkOn jmp short endOfLoop reverseOn: call ScreenReverseOn jmp short endOfLoop normal: call ScreenNormalMode ; si destroyed endOfLoop: pop si, di ; *ds:si<- screenObject inc di ; es:di <- next argArray arg loop setAttrLoop ret ScreenGraphicsOn endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenMacro[1,2,3,4] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Execute user defined macros CALLED BY: MSG_SCR_MACRO_[1,2,3,4] PASS: ds:*si - screen instance data es - dgroup RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 12/11/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenMacro1 method ScreenClass, MSG_SCR_MACRO_1 ret ScreenMacro1 endm ScreenMacro2 method ScreenClass, MSG_SCR_MACRO_2 ret ScreenMacro2 endm ScreenMacro3 method ScreenClass, MSG_SCR_MACRO_3 ret ScreenMacro3 endm ScreenMacro4 method ScreenClass, MSG_SCR_MACRO_4 ret ScreenMacro4 endm ScreenMacro5 method ScreenClass, MSG_SCR_MACRO_5 ret ScreenMacro5 endm ScreenMacro6 method ScreenClass, MSG_SCR_MACRO_6 ret ScreenMacro6 endm ScreenMacro7 method ScreenClass, MSG_SCR_MACRO_7 ret ScreenMacro7 endm ScreenMacro8 method ScreenClass, MSG_SCR_MACRO_8 ret ScreenMacro8 endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenAutoLinefeed %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Toggle Auto Linefeed option. CALLED BY: MSG_SCR_AUTO_LINEFEED PASS: ds:*si - screen instance data es - dgroup cx - selected booleans bp - modified booleans RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 01/19/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenAutoLinefeedAndWrap method ScreenClass, MSG_SCR_AUTO_LINEFEED_AND_WRAP mov es:[termOptions], cx mov si, ds:[si] ;deref to instance data test cx, mask LAW_WRAP jnz wrapSet mov ds:[si][SI_autoWrap], FALSE jmp short skip wrapSet: mov ds:[si][SI_autoWrap], TRUE skip: test cx, mask LAW_LINEFEED jnz feedSet mov ds:[si][SI_autoLinefeed], FALSE jmp short exit feedSet: mov ds:[si][SI_autoLinefeed], TRUE exit: ret ScreenAutoLinefeedAndWrap endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenSetRow %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set #lines of text displayed CALLED BY: MSG_SCR_SET_ROW PASS: ds:*si - screen instance data es - dgroup ch - row position RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 01/22/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenSetRow method ScreenClass, MSG_SCR_SET_ROW ; ; CalcNumber may change 0 to -1. ; cmp ch, MAX_LINES jb setRow cmp ch, -1 ; is it first row? \E[0H je setDefRow mov ch, MAX_LINES - 1 ; max line# jmp setRow setDefRow: clr ch ; set default row setRow: mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState mov {byte} ds:[si][SI_curLine], ch clr {byte}ds:[si][SI_curChar] ;default col is 1 if not ;specified in this case call EraseCursor ;erase the old cursor call DrawCursor ret ScreenSetRow endm ScreenSetCol method ScreenClass, MSG_SCR_SET_COL ; ; CalcNumber may change 0 to -1. ; cmp ch, MAX_LINE_CHARS jb setCol cmp ch, -1 ; is it default col? \E[;0H? jne setDefCol clr ch ;set default col. jmp setCol setDefCol: mov ch, MAX_LINE_CHARS - 1 setCol: mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState NCUR < mov {byte} ds:[si][SI_curChar], ch > CUR < mov {byte} ds:[si][SI_curPos], ch > CUR < call GetCurCharFromCurPos > clr {byte}ds:[si][SI_curLine] ;default row is 1 if not ;specified in this case call EraseCursor ;erase the old cursor call DrawCursor ret ScreenSetCol endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenSetXN %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Either clear or set flag that checks if Newlines at end of line should be ignored or not. CALLED BY: MSG_SCR_SET_XN PASS: ds:*si - screen instance data es - dgroup dh - value to set flag with (TRUE/FALSE) RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 01/26/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenSetXN method ScreenClass, MSG_SCR_SET_XN mov si, ds:[si] ;deref to instance data mov ds:[si][SI_ignoreNL], dh ret ScreenSetXN endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenSetTab %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: CALLED BY: MSG_SCR_SET_TAB PASS: ds:*si - screen instance data RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 01/30/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenSetTab method ScreenClass, MSG_SCR_SET_TAB ret ScreenSetTab endm ScreenClearTab method ScreenClass, MSG_SCR_CLEAR_TAB ret ScreenClearTab endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenLostFocusExcl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: CALLED BY: MSG_META_LOST_FOCUS_EXCL PASS: ds:*si - screen instance data RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 01/30/90 Initial version martin 8/18/93 Added SendTextFocusNotification %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenLostFocusExcl method dynamic ScreenClass, MSG_META_LOST_FOCUS_EXCL .enter push si mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState cmp di, BOGUS_VAL ;if dorked forget this je exit call CheckCursorInSelect ;if cursor in select region jc 10$ ; don't dork it call EraseCursor 10$: mov ds:[si][SI_gotFocus], FALSE call DrawSelectCursor ;unselect the text just exit: pop si clr bp call SendScreenFocusNotification .leave ret ScreenLostFocusExcl endm ScreenLostSysFocusExcl method dynamic ScreenClass, MSG_META_LOST_SYS_FOCUS_EXCL if USE_FEP tst es:[fepStrategy].segment jz noFep ; ; Call the FEP ; sub sp, size FepCallBackInfo mov bp, sp mov cx, segment ScreenFepCallBack mov dx, offset ScreenFepCallBack movdw ss:[bp].FCBI_function, cxdx mov cx, ds:[LMBH_handle] movdw ss:[bp].FCBI_data, cxsi movdw cxdx, ssbp mov di, DR_FEP_LOST_FOCUS call es:[fepStrategy] add sp, size FepCallBackInfo noFep: endif ret ScreenLostSysFocusExcl endm ScreenGainFocusExcl method dynamic ScreenClass, MSG_META_GAINED_FOCUS_EXCL .enter push si mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState call CheckCursorInSelect ;if cursor in select region jc 10$ ; don't dork it call EraseCursor 10$: mov ds:[si][SI_gotFocus], TRUE call DrawSelectCursor pop si mov bp, mask TFF_EDITABLE_TEXT_OBJECT_HAS_FOCUS call SendScreenFocusNotification .leave ret ScreenGainFocusExcl endm ScreenGainedSysFocusExcl method dynamic ScreenClass, MSG_META_GAINED_SYS_FOCUS_EXCL if USE_FEP tst es:[fepStrategy].segment jz noFep ; ; Call the FEP ; mov ax, segment ScreenFepCallBack mov bx, offset ScreenFepCallBack mov cx, ds:[LMBH_handle] mov dx, si mov di, DR_FEP_GAIN_FOCUS call es:[fepStrategy] noFep: endif ret ScreenGainedSysFocusExcl endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SendScreenFocusNotification %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Sends the GWNT_EDITABLE_TEXT_OBJECT_HAS_FOCUS notification. CALLED BY: INTERNAL PASS: bp - data to send out *ds:si - ink obj RETURN: DESTROYED: ax, bx, cx, dx, bp, di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- martin 8/18/93 Initial revision (copied from text %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SendScreenFocusNotification proc far uses si class ScreenClass .enter ; Check to see if the object is run by the UI thread - if so, set the ; appropriate bit. clr bx call GeodeGetAppObject call ObjTestIfObjBlockRunByCurThread jnz notRunByUIThread ornf bp, mask TFF_OBJECT_RUN_BY_UI_THREAD notRunByUIThread: ; Record event to send to ink controller mov ax, MSG_META_NOTIFY mov cx, MANUFACTURER_ID_GEOWORKS mov dx, GWNT_EDITABLE_TEXT_OBJECT_HAS_FOCUS mov di, mask MF_RECORD call ObjMessage mov ax, mask GCNLSF_SET_STATUS test bp, mask TFF_EDITABLE_TEXT_OBJECT_HAS_FOCUS jnz 10$ ornf ax, mask GCNLSF_IGNORE_IF_STATUS_TRANSITIONING 10$: ; Send it to the appropriate gcn list mov dx, size GCNListMessageParams sub sp, dx mov bp, sp mov ss:[bp].GCNLMP_ID.GCNLT_manuf, MANUFACTURER_ID_GEOWORKS mov ss:[bp].GCNLMP_ID.GCNLT_type, GAGCNLT_NOTIFY_FOCUS_TEXT_OBJECT clr ss:[bp].GCNLMP_block mov ss:[bp].GCNLMP_event, di mov ss:[bp].GCNLMP_flags, ax ; If a UserDoDialog is running, the process thread could be blocked, so ; send this directly to the app object. mov ax, MSG_GEN_APPLICATION_CHECK_IF_RUNNING_USER_DO_DIALOG push cx, dx, bp call UserCallApplication pop cx, dx, bp tst ax ;If a UserDoDialog is active, send jnz sendDirectly ; this directly on. mov ax, MSG_GEN_PROCESS_SEND_TO_APP_GCN_LIST call GeodeGetProcessHandle common: mov di, mask MF_FIXUP_DS or mask MF_STACK call ObjMessage add sp, dx .leave ret sendDirectly: clr bx call GeodeGetAppObject mov ax, MSG_META_GCN_LIST_SEND jmp common SendScreenFocusNotification endp if not _CHAR_SET COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenLostTargetWinExcl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Visibily unselect the text because we lost the target excl CALLED BY: MSG_META_LOST_TARGET_EXCL PASS: ds:*si - screen instance data RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 03/15/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenLostTargetWinExcl method ScreenClass, MSG_META_LOST_TARGET_EXCL mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState mov cx, ss:[selEndLine] ;restore endline ptr call UnHighlightArea ;unselect the area mov ss:[selEndLine], cx ;restore endline ptr call CheckCursorInSelect ;if cursor in select region jnc exit ; then its been erased mov ds:[si][SI_cursorDrawn], FALSE ; so redraw it call DrawSelectCursor ; exit: ret ScreenLostTargetWinExcl endm ScreenGainTargetWinExcl method ScreenClass, MSG_META_GAINED_TARGET_EXCL tst ss:[textSelected] ;if no area to re-select je exit ;then bail mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState mov cx, ss:[selEndCol] ;pass the area to select mov dx, ss:[selEndLine] mov ax, ss:[selStartCol] ;nuke the old selected area mov ss:[selEndCol], ax mov ax, ss:[selStartLine] mov ss:[selEndLine], ax call AdjustSelection ;select the new area exit: ret ScreenGainTargetWinExcl endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenStartSelect %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle button presses CALLED BY: MSG_META_START_SELECT PASS: ds:*si - screen instance data es - dgroup ax - MSG_META_START_SELECT cx - x position (document coord) dx - y position (document coord) bp - button info RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: Unhighlight any selected area If was not a double click then Find nearest valid position to the press. Position cursor. else if was a double click then Find nearest character position to press. Find the word around the click. Set selection to surround word. endif KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 02/22/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenStartSelect method ScreenClass, MSG_META_START_SELECT mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState call UnSelectArea ;unselect text call ConvertToTextCoords ; mov ss:[selStartCol], cx ;save select start position mov ss:[selEndCol], cx ;save select start position mov ss:[selStartLine], dx ; mov ss:[selEndLine], dx ; test bp, mask BI_DOUBLE_PRESS ; jz quit ; inc ss:[dblClickCtr] cmp ss:[dblClickCtr], CLICK_SELECT_WORD je selWord cmp ss:[dblClickCtr], CLICK_SELECT_LINE jne done call SelectLine ;select the current Line jmp short done selWord: call SelectWord ;is there a word at mouse pos jmp short done quit: clr ss:[dblClickCtr] ;reset ctr for consecutive done: mov ax, mask MRF_PROCESSED ;flag the mouse event handled ret ScreenStartSelect endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenDragSelect %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle mouse dragging CALLED BY: MSG_META_DRAG_SELECT PASS: ds:*si - screen instance data es - dgroup ax - MSG_META_DRAG_SELECT cx - x position dx - y position bp - button info RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: Find the nearest coordinate for drag select KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 02/22/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenDragSelect method ScreenClass, MSG_META_DRAG_SELECT mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState mov ss:[inDragSelect], TRUE ; call ConvertToTextCoords ; call AdjustSelection ; mov ax, mask MRF_PROCESSED ;flag the mouse event handled ret ScreenDragSelect endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenPtr %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle mouse dragging CALLED BY: MSG_META_PTR PASS: ds:*si - screen instance data es - dgroup ax - MSG_META_PTR cx - x position dx - y position bp low - button info bp high - UIFunctionsActive RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: Make sure that text has been selected. This means that lastAddr contains the address of the last mouse position and lastPos contains the true position (for selecting) of that address. Since drag selecting can only mean inverting between the last position and the current one the basic selecting algorithm looks like this: bx <- address of current drag position. cx, dx <- new true position. if (new drag address != old drag address) { TextInvRangeCoords( new true position, old true position ); } KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 03/06/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenPtr method ScreenClass, MSG_META_PTR tst ss:[inDragSelect] ; drag selection? jnz dragSelect ; yes test bp, mask UIFA_MOVE_COPY shl 8 ; quick-transfer active? jz exit ; nope call ClipboardGetQuickTransferStatus ; actually in progress? jz exit ; nope ;no more MSG_META_VIS_ENTER/MSG_META_VIS_LEAVE - brianc 4/6/92 ; ; are we in the view? ; test ds:[bx].SI_intFlags, mask SIF_IN_VIEW ; jz exit ; no, skip feedback ; ; quick-transfer is active, provide feedback ; call CheckForTextItem ; check if CIF_TEXT supported ; ; assume so, do copy (if we are the source, we do copy because we ; can't delete source text; if some other text object is the source, ; default behavior is to do copy because source and destination are ; different) ; (move override is handled in ClipboardSetQuickTransferFeedback) ; mov ax, CQTF_COPY ; assume so jnc haveCursor ; yes mov ax, CQTF_CLEAR ; else, clear copy cursor haveCursor: call ClipboardSetQuickTransferFeedback ; pass bp ornf ds:[bx].SI_intFlags, mask SIF_FEEDBACK_ON jmp short exit dragSelect: mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState call ConvertToTextCoords ; call AdjustSelection call CheckCursorErased ;check if adjusting the select exit: ; region erased the cursor ;flag the mouse event handled mov ax, mask MRF_PROCESSED or mask MRF_CLEAR_POINTER_IMAGE ret ScreenPtr endm endif ; if !_CHAR_SET COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CheckForTextItem %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: check if current quick-transfer item supports CIF_TEXT format CALLED BY: ScreenPtr PASS: nothing RETURN: carry clear if CIF_TEXT supported carry set if not DESTROYED: ax PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 02/02/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CheckForTextItem proc near uses bx, cx, di, si, bp, es .enter mov bp, mask CIF_QUICK call ClipboardQueryItem ; bp = # formats, cx:dx = owner ; bx:ax = VM file:VM block tst bp stc ; in case no item jz done ; no item (carry set) mov cx, MANUFACTURER_ID_GEOWORKS mov dx, CIF_TEXT call ClipboardTestItemFormat ; is CIF_TEXT there? ; (carry clear if so) done: pushf ; save result flag call ClipboardDoneWithItem popf ; retreive result flag .leave ret CheckForTextItem endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenEndSelect %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle mouse dragging CALLED BY: MSG_META_END_SELECT PASS: ds:*si - screen instance data es - dgroup ax - MSG_META_END_SELECT cx - x position dx - y position bp - button info RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 02/22/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenEndSelect method ScreenClass, MSG_META_END_SELECT mov si, ds:[si] ;deref to instance data mov di, ds:[si][SI_gState] ;get GState mov ss:[inDragSelect], FALSE ; call CheckSelectTopBottom ;check select region pointers call CheckCursorErased ;check if cursor got erased mov ax, mask MRF_PROCESSED ;flag the mouse event handled ret ScreenEndSelect endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenEndMoveCopy %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle when selected text object scrap is dropped on us CALLED BY: MSG_META_END_MOVE_COPY PASS: ds:*si - screen instance data es - dgroup ax - MSG_META_END_MOVE_COPY cx - x position dx - y position bp - button info RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 02/22/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenEndMoveCopy method ScreenClass, MSG_META_END_MOVE_COPY mov cx, mask CIF_QUICK call PasteText ; pass bp ; returns ax = ClipboardQuickNotifyFlags mov bp, ax call ClipboardEndQuickTransfer ; stop quick transfer mov ax, mask MRF_PROCESSED ;flag the mouse event handled ret ScreenEndMoveCopy endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenStartCopy %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Start a quick copy CALLED BY: MSG_META_START_MOVE_COPY PASS: ds:*si - screen instance data es - dgroup ax - MSG_META_START_MOVE_COPY cx - x mouse position dx - y mouse position bp low - UIButtonFlags bp high - UIFunctionsActive RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 02/22/90 Initial version ted 12/1/92 MakeTransferItem doesn't return errors %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenStartCopy method ScreenClass, MSG_META_START_MOVE_COPY test bp, mask UIFA_MOVE_COPY shl 8 ;is this a move/copy event jz exitJMP test bp, mask UIFA_MOVE shl 8 ;ignore if this is a move LONG jnz noCopy tst ss:[textSelected] ;exit if no text selected jz exitJMP push si ;save ptr to instance data mov si, ds:[si] call ConvertToTextCoords call CheckCoordInSelect ; C set if in selected region pop si ;restore ptr to object data jnc noCopy if _TELNET jmp 10$ else cmp ss:[serialPort], NO_PORT ;don't start copy if no port jne 10$ ; opened segmov ds, ss, bp clr cx ;flag that String resouce should mov dx, offset pasteErr ; be stuffed into cx mov bp, ERR_NO_COM CallMod DisplayErrorMessage endif ; !_TELNET exitJMP: jmp exit 10$: ; ;start the UI part of the quick move ; push si ; save instance handle mov si, mask CQTF_COPY_ONLY ;set for copy preference mov ax, CQTF_COPY ; set initial cursor call ClipboardStartQuickTransfer pop si ; retrieve instance handle jc noCopy ; if quick-transfer already ; in progress, abort mov bx, ds:[si] ; deref. instance handle ornf ds:[bx].SI_intFlags, mask SIF_FEEDBACK_ON ; ; create and register quick-transfer item ; call MakeTransferItem ;ax = VM block, bx = VM file mov ss:[inCopy], TRUE ;flag registering COPY item mov bp, mask CIF_QUICK ;not RAW, QUICK call ClipboardRegisterItem jc error ; handle error ; ; successfully started quick-transfer, allow mouse to roam to all ; quick-transfer destinations ; GetResourceHandleNS TermView, bx mov si, offset TermView mov ax, MSG_GEN_VIEW_ALLOW_GLOBAL_TRANSFER mov di, mask MF_FIXUP_DS call ObjMessage jmp short exit error: call ScreenStopQuickTransferFeedback ; stop feedback segmov ds, ss, bp ;we're dorked mov bp, ERR_NO_MEM_TRANS_OBJ CallMod DisplayErrorMessage noCopy: mov ss:[inCopy], FALSE exit: mov ax, mask MRF_PROCESSED ;flag the mouse event handled ret ScreenStartCopy endm ; ; needed because View has 'grabWhilePressed' set and grabs on both ; MSG_META_START_MOVE_COPY and MSG_META_DRAG_MOVE_COPY, so we want to make ; sure that it is released ; ScreenDragMoveCopy method ScreenClass, MSG_META_DRAG_MOVE_COPY cmp ss:[inCopy], TRUE jne done GetResourceHandleNS TermView, bx mov si, offset TermView mov ax, MSG_GEN_VIEW_ALLOW_GLOBAL_TRANSFER mov di, mask MF_FIXUP_DS call ObjMessage done: ret ScreenDragMoveCopy endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenCopy %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Send selected text to UI CALLED BY: MSG_META_CLIPBOARD_COPY PASS: ds:*si - screen instance data es - dgroup ax - MSG_META_CLIPBOARD_COPY RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 03/14/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenCut method ScreenClass, MSG_META_CLIPBOARD_CUT ret ScreenCut endm ScreenCopy method ScreenClass, MSG_META_CLIPBOARD_COPY tst ss:[textSelected] ;exit if no text selected jz exit ; call MakeTransferItem ;ax = VM block, bx = VM file clr bp ;not RAW, not QUICK call ClipboardRegisterItem exit: ret ScreenCopy endm ScreenPaste method ScreenClass, MSG_META_CLIPBOARD_PASTE clr cx ;normal transfer call PasteText ret ScreenPaste endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenViewClosingQT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: handle closing of window, stop drag-selection and stop quick transfer CALLED BY: MSG_META_CONTENT_VIEW_CLOSING handler PASS: ds:*si - screen object RETURN: nothing DESTROYED: ax, bx, cx, dx, di, bp PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 10/10/90 Initial version brianc 3/25/91 Updated for 2.0 quick-transfer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenViewClosingQT proc near uses si .enter tst ss:[inCopy] ; doing quick transfer? jz notCopy ; nope call ClipboardAbortQuickTransfer ; if so, stop quick transfer jmp short done notCopy: tst ss:[inDragSelect] ; doing drag selection? jz done ; nope call ScreenEndSelect ; else, end drag selection done: .leave ret ScreenViewClosingQT endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenStopQuickTransferFeedback %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: handle MSG_META_CONTENT_VIEW_LOST_GADGET_EXCL - clear move/copy cursor if doing quick transfer CALLED BY: MSG_META_CONTENT_VIEW_LOST_GADGET_EXCL PASS: ds:bx - instance data RETURN: DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 03/25/91 Initial version for 2.0 quick-transfer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenStopQuickTransferFeedback method ScreenClass, \ MSG_META_CONTENT_VIEW_LOST_GADGET_EXCL test ds:[bx].SI_intFlags, mask SIF_FEEDBACK_ON jz done ; feedback not occuring ;no more MSG_META_VIS_LEAVE - brianc 3/6/92 ; cmp ax, MSG_META_VIS_LEAVE ; jne notVisLeave ; ; ; ; indicate that we have left the view, in case we get a few lingering ; ; MSG_PTRs, while waiting for MSG_GEN_VIEW_ALLOW_GLOBAL_TRANSFER ; ; to take effect ; ; ; andnf ds:[bx].SI_intFlags, not mask SIF_IN_VIEW ;notVisLeave: mov ax, CQTF_CLEAR ; clear any move/copy cursor call ClipboardSetQuickTransferFeedback andnf ds:[bx].SI_intFlags, not mask SIF_FEEDBACK_ON done: ret ScreenStopQuickTransferFeedback endm ;ScreenVisEnter method ScreenClass, MSG_META_VIS_ENTER ; ornf ds:[bx].SI_intFlags, mask SIF_IN_VIEW ; ret ;ScreenVisEnter endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenSetWinLines %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Change #lines fit in a view CALLED BY: MSG_SCR_SET_WIN_LINES PASS: ds:*si - screen instance data es - dgroup ax - MSG_SCR_SET_WIN_LINES dx - #lines to set RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: if window doesn't need to be resized, then exit else calc the new height (to save time) if window width has changed set that too KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 03/16/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenSetWinLines method ScreenClass, MSG_SCR_SET_WIN_LINES mov cx, dx ; cx - number of lines mov si, ds:[si] mov ds:[si][SI_maxLines], cl ;store #lines in screen mov {byte} ds:[si][SI_scrollRegBot], cl ;store bottom (0-CL) dec ds:[si][SI_scrollRegBot] ; line of scroll region mov ax, ds:[si][SI_lineHeight] ;if window height hasn't changed mul cl ;then cmp ax, ds:[si][SI_winHeight] ; can exit je exit ; mov ds:[si][SI_winHeight], ax ;store the new window width push ax ;and save it call GetScreenWidth mov cx, ax ; mov ds:[si][SI_winWidth], cx ; store it pop dx ; and resize the window call ResetWindow exit: ret ScreenSetWinLines endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenSetWinCols %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Changed #cols fit in a view CALLED BY: MSG_SCR_SET_WIN_COLS PASS: ds:*si - screen instance data es - dgroup ax - MSG_SCR_SET_WIN_COLS dx - #cols to set RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: if window doesn't need to be resized then exit else calc the new window height (to save time) if window width has changed set that too KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 03/16/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenSetWinCols method ScreenClass, MSG_SCR_SET_WIN_COLS mov cx, dx ; cx - number of lines mov si, ds:[si] mov ds:[si][SI_maxCols], cl ;store #cols in screen mov ax, ds:[si][SI_charWidth] ;if window width hasn't changed mul cl ;then cmp ax, ds:[si][SI_winWidth] ; can exit je exit ; mov ds:[si][SI_winWidth], ax push ax ;save new width call GetScreenHeight mov dx, ax ; mov ds:[si][SI_winHeight], dx ;and store it pop cx ;get new width call ResetWindow ;and reset the window exit: ret ScreenSetWinCols endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenSubviewChange %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle when the view size changes. CALLED BY: MSG_META_CONTENT_VIEW_SIZE_CHANGED PASS: ds:*si - screen instance data es - dgroup ax - MSG_META_CONTENT_VIEW_SIZE_CHANGED cx - document width dx - document height RETURN: nothing DESTROYED: ax, bx, cx, dx, bp, di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 03/16/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenSubviewChange method ScreenClass, MSG_META_CONTENT_VIEW_SIZE_CHANGED mov si, ds:[si] call CheckViewSize ret ScreenSubviewChange endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenRecordOn %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: bring up dialog box to ask user what he wants to capture CALLED BY: MSG_SCR_RECORD_ON PASS: ds:*si - screen instance data es - dgroup ax - MSG_SCR_RECORD_ON RETURN: ds:[si][SI_capHandle] != BOGUS_VAL if recording DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- dennis 04/24/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenRecordOn method ScreenClass, MSG_SCR_RECORD_ON push ds, si segmov ds, es, si ;set ds to dgroup GetResourceHandleNS SaveAsFileSelector, dx ; dx:si = file selector mov si, offset SaveAsFileSelector CallMod SetFilePath ;set path of the selected file jc exit ;exit if path dorked GetResourceHandleNS SaveAsTextEdit, dx ; dx:si = text object mov si, offset SaveAsTextEdit ; CallMod GetFileName ; jc exit ;exit if filename dorked push bx ; save filename block handle CallMod CheckFileStatus pop bx pushf call MemFree ; free filename block popf jc exit mov cx, FILE_OVERWRITE GetResourceHandleNS SaveAsTextEdit, dx ; dx:si = text object mov si, offset SaveAsTextEdit CallMod GetFileHandle ;get the file handle jc exit ;exit if can't pop ds, si mov si, ds:[si] call StartCapture jmp short bye exit: pop ds, si bye: ret ScreenRecordOn endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenIgnoreEscapeSeq %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Do nothing for the parsed escape sequence CALLED BY: MSG_SCR_IGNORE_ESC_SEQ PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data es = segment of ScreenClass ax = message # RETURN: nothing DESTROYED: ax SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- simon 4/ 3/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenIgnoreEscapeSeq method dynamic ScreenClass, MSG_SCR_IGNORE_ESC_SEQ ret ScreenIgnoreEscapeSeq endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenRenewGraphicsOn %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Reset graphics attributes and then set the new ones CALLED BY: MSG_SCR_RENEW_GRAPHICS_ON PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data es = segment of ScreenClass ax = message # dgroup:[argArray] arguments: 0 : Turn off all attributes 1 : Bold Mode on 4 : Underscore on 5 : ScreenBlinkOn 7 : ScreenReverseOn RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: Reset graphics attributes; Set to the new ones; REVISION HISTORY: Name Date Description ---- ---- ----------- simon 2/ 8/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenRenewGraphicsOn method dynamic ScreenClass, MSG_SCR_RENEW_GRAPHICS_ON .enter push si, di call ScreenNormalMode pop si, di call ScreenGraphicsOn .leave ret ScreenRenewGraphicsOn endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenRenewScrollRegBottom %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Reset the top of scroll region and set the bottom to new value CALLED BY: MSG_SCR_RENEW_SCROLL_REG_BOTTOM PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data es = segment of ScreenClass ax = message # ch = scroll reg bottom RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: Use default scroll region top; Set the scroll region; REVISION HISTORY: Name Date Description ---- ---- ----------- simon 2/ 9/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenRenewScrollRegBottom method dynamic ScreenClass, MSG_SCR_RENEW_SCROLL_REG_BOTTOM .enter clr cl ; default scroll region top line xchg cl, ch ; ch <- scroll region top ; cl <- new scroll region bottom call ScreenChangeScrollReg .leave ret ScreenRenewScrollRegBottom endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenBringUpHelp %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_META_BRING_UP_HELP must be handled be a GenClass object CALLED BY: MSG_META_BRING_UP_HELP PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data ds:bx = ScreenClass object (same as *ds:si) es = segment of ScreenClass ax = message # RETURN: nothing DESTROYED: ax SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Joon 6/12/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenBringUpHelp method dynamic ScreenClass, MSG_META_BRING_UP_HELP GetResourceHandleNS TermPrimary, bx mov si, offset TermPrimary clr di GOTO ObjMessage ScreenBringUpHelp endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenFepCallBack %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: callback routine for FEP CALLED BY: PASS: cx:dx = optr of Screen object di = FepCallBackFunction ss:sp = FEP stack RETURN: depends on passed di DESTROYED: bx, si PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 2/9/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if USE_FEP Fixed segment resource ScreenFepCallBack proc far movdw bxsi, cxdx ; ^lbx:si = Screen object call cs:[ScreenFepCallBackTable][di] ret ScreenFepCallBack endp ScreenFepCallBackTable nptr.near \ ScreenFepGetTempTextBounds, ;FCBF_GET_TEMP_TEXT_BOUNDS ScreenFepGetTempTextAttr, ;FCBF_GET_TEMP_TEXT_ATTR ScreenFepInsertTempText, ;FCBF_INSERT_TEMP_TEXT ScreenFepDeleteText ;FCBF_DELETE_TEXT .assert (size ScreenFepCallBackTable eq FepCallBackFunction) COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenFepGetTempTextBounds %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: suggest bounds for the temp text window CALLED BY: ScreenFepCallBack PASS: ^lbx:si = Screen object ? RETURN: ax, bx = top left cx, dx = bottom right si = layer ID bp = baseline offset carry = set iff bounds are invalid ? DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 2/9/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenFepGetTempTextBounds proc near mov ax, MSG_SCR_GET_FEP_TEMP_TEXT_BOUNDS mov di, mask MF_CALL call ObjMessage ; returns status in carry flag ret ScreenFepGetTempTextBounds endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenFepGetTempTextAttr %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: get temp text attributes for FEP CALLED BY: ScreenFepCallBack PASS: ss:bp = FepTempTextAttr to fill in ^lbx:si = Screen object RETURN: ss:bp = FepTempTextAttr filled in carry = set iff data invalid DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 2/9/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenFepGetTempTextAttr proc near mov ax, MSG_SCR_GET_FEP_TEMP_TEXT_ATTR mov cx, ss ; cx:dx = FepTempTextAttr mov dx, bp mov di, mask MF_CALL call ObjMessage ; returns status in carry flag ret ScreenFepGetTempTextAttr endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenFepInsertTempText %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: send the passed text to the serial port CALLED BY: ScreenFepCallBack PASS: ^lbx:si = Screen object es:bp = text string to insert (Unicode) ax = number of characters RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 2/9/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenFepInsertTempText proc near push ds, ax, cx, si mov cx, ax ; cx = # chars GetResourceSegmentNS dgroup, ds, ax ; ds = dgroup cmp ds:[serialPort], NO_PORT jne continue mov ds:[scrKbdFepNoPortErr], BB_TRUE jmp short done continue: mov si, bp ; es:si = text call BufferedSendBuffer done: pop ds, ax, cx, si ret ScreenFepInsertTempText endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenFepDeleteText %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: delete the N characters immediately before the current cursor position CALLED BY: ScreenFepCallBack PASS: ^lbx:si = Screen object ax = number of characters to delete RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 2/9/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenFepDeleteText proc near ; ; nothing to do ; ret ScreenFepDeleteText endp Fixed ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenGetFepTempTextAttr %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: return character attributes of text at current position CALLED BY: MSG_SCR_GET_FEP_TEMP_TEXT_ATTR PASS: *ds:si - Screen object cx:dx - FepTempTextAttr to fill in ax - MSG_SCR_GET_FEP_TEMP_TEXT_ATTR RETURN: cx:dx - FepTempTextAttr filled in carry set if info not available DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 4/4/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenGetFepTempTextAttr method dynamic ScreenClass, MSG_SCR_GET_FEP_TEMP_TEXT_ATTR mov si, ds:[si] ; ds:si = Screen object clr ax mov ah, {byte} ds:[si].SI_curLine ; ds:ax = start of line SBCS < shr ax, 1 > add ax, LINE_GRAFX_START ; ds:ax = start of line attrs add ax, ds:[si].SI_curChar ; ds:ax = cur char attr mov bx, ds:[si].SI_screenHandle mov si, ax call MemLock mov ds, ax ; ds:si = cur char attr mov al, ds:[si] ; al = cur char CharAttributes call MemUnlock mov es, cx ; es:di = FepTempTextAttr mov di, dx segmov ds, cs mov si, offset screenFepTempTextAttr mov cx, size FepTempTextAttr rep movsb ; copy over defaults mov di, dx clr ah test al, mask CA_UNDER_LO jz noUnder ornf ah, mask TS_UNDERLINE noUnder: test al, mask CA_BOLD_LO jz noBold ornf ah, mask TS_BOLD noBold: mov es:[di].FTTA_textCharAttr.VTCA_textStyles, ah clc ; indicate info available ret ScreenGetFepTempTextAttr endm screenFepTempTextAttr FepTempTextAttr < ;FTTA_winAttributes (FepTempWindowAttr) < <0, 1>, ;FTWA_xScale (WWFixed) <0, 1>, ;FTWA_yScale (WWFixed) 0, ;FTWA_winColorFlags (WinColorFlags) C_WHITE, ;FTWA_redOrIndex (byte) 0, ;FTWA_green (byte) 0 ;FTWA_blue (byte) >, < ;FTTA_textCharAttr (VisTextCharAttr) <>, ;VTCA_meta (StyleSheetElementHeader) TERM_FONT, ;VTCA_fontID (FontID) <0, 16>, ;VTCA_pointSize (WBFixed) 0, ;VTCA_textStyles (TextStyle) <C_BLACK,CF_INDEX,0,0>, ;VTCA_color (ColorQuad) 0, ;VTCA_trackKerning (sword) 100, ;VTCA_fontWeight (byte) 100, ;VTCA_fontWidth (byte) 0, ;VTCA_extendedStyles (VisTextExtendedStyles) SDM_50, ;VTCA_grayScreen (SystemDrawMask) <PT_SOLID,0>, ;VTCA_pattern (GraphicPattern) <C_WHITE,CF_INDEX,0,0>, ;VTCA_bgColor (ColorQuad) SDM_50, ;VTCA_bgGrayScreen (SystemDrawMask) <PT_SOLID,0>, ;VTCA_bgPattern (GraphicPattern) 0 ;VTCA_reserved (byte 7 dup (0)) > > COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenGetFepTempTextBounds %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: return bounds of text at current position CALLED BY: MSG_SCR_GET_FEP_TEMP_TEXT_BOUNDS PASS: *ds:si - Screen object ax - MSG_SCR_GET_FEP_TEMP_TEXT_BOUNDS ? RETURN: ? DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 4/4/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenGetFepTempTextBounds method dynamic ScreenClass, MSG_SCR_GET_FEP_TEMP_TEXT_BOUNDS stc ret ScreenGetFepTempTextBounds endm endif if _SPECIAL_KEY COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenSpecialKeyInsert %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Insert a special key CALLED BY: MSG_SCR_SPECIAL_KEY_INSERT PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data es = segment of ScreenClass ax = message # RETURN: nothing DESTROYED: ax SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- simon 5/12/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenSpecialKeyInsert method dynamic ScreenClass, MSG_SCR_SPECIAL_KEY_INSERT .enter ; ; Query SpecialKeyList for the entry selected ; push si GetResourceHandleNS TermSpecialKeyList, bx mov si, offset TermSpecialKeyList mov di, mask MF_CALL or mask MF_FIXUP_DS mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION call ObjMessage ; ax <- selection EC < tst ah > EC < ERROR_NZ TERM_INVALID_SPECIAL_KEY_SELECTION > call SpecialKeyListEntryToKOMBI ; al <- KOMBI pop si mov di, ds:[si] if _TELNET ; ; If it is a telnet command, send it. ; cmp al, KOMBI_PF jae nonTelnetCmd call TelnetSendCommandKey ; carry set if error jmp exit nonTelnetCmd: endif ; _TELNET ; ; If it is PF1-4, it sends out same escape codes no matter what ; CheckHack <KOMBI_PF lt KOMBI_ENTER> cmp al, KOMBI_ENTER jb sendAppKeys ; jmp if PF ; ; Reset terminal special key? ; CheckHack < KOMBI_MINUS lt KOMBI_RESET> cmp al, KOMBI_RESET je resetTerm ; ; Ctrl character? ; CheckHack <KOMBI_CTRL28 eq (KeypadOutMapBeginIndex-1)> cmp al, KOMBI_CTRL28 jb testKeypadMode call ScreenSendSpecialControlKey jmp exit resetTerm: ; ; Reset Terminal settings ; call ScreenResetVT ; ax,cx,dx,bp,si,di destroyed jmp exit testKeypadMode: ; ; Check out what keypad mode we are in and determine if we should ; send out regular keys or escape codes. ; CheckHack <FALSE eq 0> BitTest ds:[di][SI_modeFlags], SVTMF_KEYPAD jnz sendAppKeys call ScreenSendNumKeypadKey ; ax,bx,cx,dx,di,bp destroyed jmp exit sendAppKeys: call ScreenSendAppKeypadKey exit: .leave ret ScreenSpecialKeyInsert endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SpecialKeyListEntryToKOMBI %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Maps a selection number from the special keys list to the coresponding KeypadOutMapBeginEntry value CALLED BY: INTERNAL ScreenSpecialKeyInsert PASS: ax = selection # RETURN: al = KeypadOutMapBeginEntry DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- CT 3/20/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SpecialKeyListEntryToKOMBI proc near uses bx,bp,si,ds .enter CheckHack <KOMBI_CTRL28+3 eq NUM_SPECIAL_KEYS-1> ; Num special key is valid ; ; Deref the entry string block ; mov_tr bp, ax GetResourceHandleNS SpecialKeyEntryStrings, bx call MemLock ; ax<-stpr of string blk mov ds, ax mov si, offset SpecialKeyEntryStringsTable mov si, ds:[si] ; ds:si<-fptr key string table ; ; calc offset to KOMBI entry for given selection ; stc rcl bp ; bp = index*2+1 shl bp ; bp = index*4+2 ; ; Fetch KOMBI ; mov al, {byte}ds:[si][bp] ; ; unlock string block ; call MemUnlock .leave ret SpecialKeyListEntryToKOMBI endp endif ; if _SPECIAL_KEY EmulationCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenRespondWhatAreYou %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Respond to What Are You request CALLED BY: MSG_SCR_RESPOND_WHAT_ARE_YOU PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data es = segment of ScreenClass ax = message # RETURN: nothing DESTROYED: ax SIDE EFFECTS: PSEUDO CODE/STRATEGY: ONLY VALID FOR VT100 REVISION HISTORY: Name Date Description ---- ---- ----------- simon 4/16/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ; ; The response is to Advanced Video Option (AVO) as default ; WhatAreYouResponseSeq char C_ESCAPE, "[?1;2c" ScreenRespondWhatAreYou method dynamic ScreenClass, MSG_SCR_RESPOND_WHAT_ARE_YOU WAYEscCode local (size WhatAreYouResponseSeq) \ dup (char) ; Code to send (XIP happy) .enter ; ; Copy argument to send ; segmov ds, cs, ax mov si, offset WhatAreYouResponseSeq segmov es, ss, ax lea di, ss:[WAYEscCode] copybuf <size WhatAreYouResponseSeq> ; ; Write the default response to this question. ; lea si, ss:[WAYEscCode] ; essi<-code to send mov cx, size WhatAreYouResponseSeq GetResourceSegmentNS dgroup, ds CallMod SendBuffer ; es:si<-past text ; carry set if error .leave ret ScreenRespondWhatAreYou endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenRespondCursorPosition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Sends current cursor position back to host CALLED BY: MSG_SCR_RESPOND_CURSOR_POSITION PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data ds:bx = ScreenClass object (same as *ds:si) es = segment of ScreenClass ax = message # RETURN: DESTROYED: SIDE EFFECTS: PSEUDO CODE/STRATEGY: For all terminal types: Arg 0 is the column (1-based) Arg 1 is row (1-based) REVISION HISTORY: Name Date Description ---- ---- ----------- CT 2/18/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ vt100CursorPosReply char C_ESCAPE, "[%0;%1R", C_NULL nullCursorPosReply char C_NULL termCursorReplies word \ offset nullCursorPosReply, ; TTY offset nullCursorPosReply, ; VT52 offset vt100CursorPosReply, ; VT100 offset nullCursorPosReply, ; WYSE50 offset nullCursorPosReply, ; ANSI offset nullCursorPosReply, ; IBM3101 offset nullCursorPosReply ; TVI950 ScreenRespondCursorPosition method dynamic ScreenClass, MSG_SCR_RESPOND_CURSOR_POSITION .enter ; ; Load Col, Row into arg registers ; mov al, {byte}ds:[di].SI_curLine mov ah, {byte}ds:[di].SI_curChar inc al inc ah ; ; Load up cursor position reply template for current terminal ; type ; segmov ds, cs, bx GetResourceSegmentNS dgroup, es, TRASH_BX mov bl, es:[termType] clr bh shl bx, 1 mov si, ds:termCursorReplies[bx] ; ds:si <- reply template ; ; And spit out the reply ; call SendResponse .leave ret ScreenRespondCursorPosition endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SendResponse %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Sends a string to the host, inserting numeric arguments as needed. CALLED BY: PASS: ds:si = template buffer to send (null terminated) %0 - %7 = insert n'th argument as ascii decimal al,ah,bl,bh,cl,ch,dl,ch = args 0-7 RETURN: DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- CT 2/18/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SendResponse proc near uses ax,bx,cx,dx,si,di SEND_RESPONSE_BUF_SIZE equ 20 SEND_MAX_ARG_SIZE equ 4 argsArray local 8 dup (byte) sendBuf local SEND_RESPONSE_BUF_SIZE dup (char) .enter ; ; Load args into arg array ; mov {word}ss:argsArray[0], ax mov {word}ss:argsArray[2], bx mov {word}ss:argsArray[4], cx mov {word}ss:argsArray[6], dx ; ; Set up to start stuffing the template into the send buffer ; clr cx ; cx = chars in output buf segmov es, ss, ax lea di, sendBuf ; es:di = next pos in output stuffLoop: lodsb ; al = template char tst al jz endLoop cmp al, '%' je handleEsc ; ; Copy char from template to output ; stosb inc cx jmp next handleEsc: ; ; Insert argument N in output ; lodsb ; al = N (ascii) sub al, '0' Assert_urange al, 0, 7 clr dx mov bh, dl ; bx = N mov bl, al xchg bx, di mov ah, dl mov al, ss:argsArray[di] ; dx.ax = dword arg xchg bx, di push cx clr cx ; no leading zeros, null call UtilHex32ToAscii ; cx = length EC < cmp cx, SEND_MAX_ARG_SIZE > EC < ERROR_A TERM_RESPONSE_ARGUMENT_TOO_LONG > mov_tr ax, cx add di, ax pop cx add cx, ax next: ; ; send buffer full? ; cmp cx, SEND_RESPONSE_BUF_SIZE-SEND_MAX_ARG_SIZE jle stuffLoop call sendBuffer jmp stuffLoop endLoop: call sendBuffer .leave ret ; ; PASS: cx = # chars to send from sendBuf ; es = segment sendBuf (ss) ; ; Return: cx = 0, di = reset to offset sendBuf ; sendBuffer label near lea di, sendBuf ; reset output to beginning jcxz sbExit push ds, si segmov ds, ss, si mov si, di ; es:si = buffer CallMod SendBuffer pop ds, si ; ds:si = template clr cx ; reset buffer to nothing sbExit: ret SendResponse endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenResetMode %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: To reset the modes like ANSI/VT52, Cursor key mode, etc CALLED BY: MSG_SCR_RESET_MODE PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data es = segment of ScreenClass ax = message # ch = TermVTModeType RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: Find out which mode flags to set/reset in tables indexed by TermType and TermMode Get the argument (which mode to reset); Set/Clear the internal flag according to the mode; This was written with VT100 in mind. In particular, it assumes that the terminal mode values are fairly dense, and that "Set" means "turn the corresponding flag ON" When adding new terminal types, if this doesn't serve your purposes, feel free to change it. REVISION HISTORY: Name Date Description ---- ---- ----------- simon 2/23/96 Initial version cthomas 4/2/96 rewrote to be table-driven %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DiddleInstanceParams struct DIP_mode word ; mode enum DIP_offset word ; instance data field offset DIP_set word ; bits to set/clear DiddleInstanceParams ends ScreenResetMode method dynamic ScreenClass, MSG_SCR_SET_MODE, MSG_SCR_RESET_MODE .enter GetResourceSegmentNS dgroup, es, TRASH_BX ; ; Find the mode flag table for the current terminal emulation ; mov bl, es:[termType] clr bh shl bx, 1 mov bx, cs:[vtModeTables][bx] ; cs:bx = mode table for term tst bx EC < WARNING_Z TERM_FUNCTION_NOT_SUPPORTED > jz done ; ; Get the mode flags that correspond to the mode to set/reset ; clr cl xchg ch, cl ; cx <- Mode type mov dx, cs:[bx-(size word)] xchg cx, dx ; cx <- list length ; dx <- mode jcxz done mov si, bx modeLoop: cmp dx, cs:[si].DIP_mode jne next ; ; Found an entry for this mode. Diddle the instance data. ; mov bx, cs:[si].DIP_offset mov bp, cs:[si].DIP_set ; ; Set / reset the mode flags as appropriate ; cmp ax, MSG_SCR_RESET_MODE je reset ornf ds:[di][bx], bp jmp next reset: not bp andnf ds:[di][bx], bp next: add si, size DiddleInstanceParams loop modeLoop done: .leave ret ScreenResetMode endm .warn -private vtModeTables nptr.DiddleInstanceParams \ 0, ; TTY 0, ; VT50 offset vt100ModeTable, ; VT100 0, ; WYSE50 0, ; ANSI 0, ; IBM3101 0 ; TVI950 CheckHack <length vtModeTables eq Terminals> ; ; These ModeTables map a mode enumeration to mode flags that should ; be turned on/off when the mode is set & reset. The word before ; each table is the length of the table. Don't separate them! ; vt100ModeTableLength word length vt100ModeTable vt100ModeTable DiddleInstanceParams \ <TVTMT_CURSOR_KEY, SI_modeFlags, mask SVTMF_CURSOR_KEY>, <TVTMT_ANSI_VT52, SI_modeFlags, mask SVTMF_ANSI_VT52>, <TVTMT_COLUMN, SI_modeFlags, mask SVTMF_COLUMN>, <TVTMT_SCROLLING, SI_modeFlags, mask SVTMF_SCROLLING>, <TVTMT_SCREEN, SI_modeFlags, mask SVTMF_SCREEN>, <TVTMT_ORIGIN, SI_modeFlags, mask SVTMF_ORIGIN>, <TVTMT_WRAPAROUND, SI_autoWrap, BB_TRUE>, <TVTMT_LINEFEED, SI_modeFlags, mask SVTMF_LF_NEWLINE>, <TVTMT_INTERLACE, SI_modeFlags, mask SVTMF_INTERLACE>, <TVTMT_AUTO_REPEAT, SI_modeFlags, mask SVTMF_AUTO_REPEAT> .warn @private EmulationCode ends if _CHAR_SET COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenSelectG0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Select character set designator to G0 CALLED BY: MSG_SCR_SELECT_G0 PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data es = segment of ScreenClass ax = message # RETURN: nothing DESTROYED: ax SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- simon 5/ 5/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenSelectG0 method dynamic ScreenClass, MSG_SCR_SELECT_G0 .enter mov ds:[di][SI_charSetDesignator], CSD_G0 ; ; See what character set G0 is having and set attr according ; cmp ds:[di][SI_G0CharSet], TCS_GRAPHICS je graphics ; set graphics char EC < cmp ds:[di][SI_G0CharSet], TCS_USASCII > EC < ERROR_NE TERM_INVALID_CHARACTER_SET > ; ; Set non-graphics font ; call ScreenSetUSASCIICommon jmp exit graphics: ; ; Set graphics font ; call ScreenSetGraphicsCommon exit: .leave ret ScreenSelectG0 endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenSelectG1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Select character set designator to G1 CALLED BY: MSG_SCR_SELECT_G1 PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data es = segment of ScreenClass ax = message # RETURN: nothing DESTROYED: ax SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- simon 5/ 5/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenSelectG1 method dynamic ScreenClass, MSG_SCR_SELECT_G1 .enter mov ds:[di][SI_charSetDesignator], CSD_G1 ; ; See what character set G1 is having and set attr according ; cmp ds:[di][SI_G1CharSet], TCS_GRAPHICS je graphics ; set graphics char EC < cmp ds:[di][SI_G1CharSet], TCS_USASCII > EC < ERROR_NE TERM_INVALID_CHARACTER_SET > ; ; Set non-graphics font ; call ScreenSetUSASCIICommon jmp exit graphics: ; ; Set graphics font ; call ScreenSetGraphicsCommon exit: .leave ret ScreenSelectG1 endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenG0SelectUSASCII %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Choose USASCII character set for G0 CALLED BY: MSG_SCR_G0_SELECT_USASCII PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data es = segment of ScreenClass ax = message # RETURN: nothing DESTROYED: ax SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- simon 5/ 5/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenG0SelectUSASCII method ScreenClass, MSG_SCR_G0_SELECT_USASCII .enter mov ds:[di][SI_G0CharSet], TCS_USASCII ; ; If we are in G1, ignore ; CheckHack <CSD_G0 eq 0> ; assuming G0 is 0 tst ds:[di][SI_charSetDesignator] jnz exit call ScreenSetUSASCIICommon exit: .leave ret ScreenG0SelectUSASCII endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenG0SelectGraphics %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Choose Special graphics character set for G0 CALLED BY: MSG_SCR_G0_SELECT_GRAPHICS PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data es = segment of ScreenClass ax = message # RETURN: nothing DESTROYED: ax SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- simon 5/ 5/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenG0SelectGraphics method dynamic ScreenClass, MSG_SCR_G0_SELECT_GRAPHICS .enter mov ds:[di][SI_G0CharSet], TCS_GRAPHICS ; ; Check if we are in G1. If so, ignore ; tst ds:[di][SI_charSetDesignator] jnz exit call ScreenSetGraphicsCommon exit: .leave ret ScreenG0SelectGraphics endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenG1SelectUSASCII %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Choose USASCII character set for G1 CALLED BY: MSG_SCR_G1_SELECT_USASCII PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data es = segment of ScreenClass ax = message # RETURN: nothing DESTROYED: ax SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- simon 5/ 5/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenG1SelectUSASCII method ScreenClass, MSG_SCR_G1_SELECT_USASCII .enter mov ds:[di][SI_G1CharSet], TCS_USASCII ; ; Check if we are in G1. If not, ignore chaging char attr ; tst ds:[di][SI_charSetDesignator] jz exit ; G0, ignore call ScreenSetUSASCIICommon exit: .leave ret ScreenG1SelectUSASCII endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ScreenG1SelectGraphics %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Choose Special graphics character set for G1 CALLED BY: MSG_SCR_G1_SELECT_GRAPHICS PASS: *ds:si = ScreenClass object ds:di = ScreenClass instance data es = segment of ScreenClass ax = message # RETURN: nothing DESTROYED: ax SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- simon 5/ 5/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ScreenG1SelectGraphics method dynamic ScreenClass, MSG_SCR_G1_SELECT_GRAPHICS .enter mov ds:[di][SI_G1CharSet], TCS_GRAPHICS ; ; If we are in G1, change the attr so that information can be stored. ; tst ds:[di][SI_charSetDesignator] jz exit ; G0, ignore call ScreenSetGraphicsCommon exit: .leave ret ScreenG1SelectGraphics endm endif ; if _CHAR_SET
25.84877
84
0.592558
98d4f1bde76f4e68f5f71dd46406cec22ac4a22d
452
asm
Assembly
wof/lcs/123p/6C.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
a4a0c86c200241494b3f1834cd0aef8dc02f7683
[ "Apache-2.0" ]
6
2020-10-14T15:29:10.000Z
2022-02-12T18:58:54.000Z
wof/lcs/123p/6C.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
a4a0c86c200241494b3f1834cd0aef8dc02f7683
[ "Apache-2.0" ]
null
null
null
wof/lcs/123p/6C.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
a4a0c86c200241494b3f1834cd0aef8dc02f7683
[ "Apache-2.0" ]
1
2020-12-17T08:59:10.000Z
2020-12-17T08:59:10.000Z
copyright zengfr site:http://github.com/zengfr/romhack 00249A move.l -(A6), (A4)+ [123p+ 6C, enemy+6C] 0024B6 move.l -(A6), (A4)+ [123p+ 6C, enemy+6C] 0024E8 move.l -(A6), (A4)+ [123p+ 6C, enemy+6C] 00250A move.l -(A6), (A4)+ [123p+ 6C, enemy+6C] 007A54 btst #$5, ($30,A1) [123p+ 6C, enemy+6C] 008F4C beq $8e58 [123p+ 6C] 01A74C dbra D7, $1a74a 01A75E dbra D4, $1a75c copyright zengfr site:http://github.com/zengfr/romhack
34.769231
54
0.626106
322a06e6d9e59a00ae1b2ff168568992cbdb8777
16,763
asm
Assembly
Driver/Video/Dumb/VidMem/Main/mainMain.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
504
2018-11-18T03:35:53.000Z
2022-03-29T01:02:51.000Z
Driver/Video/Dumb/VidMem/Main/mainMain.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
96
2018-11-19T21:06:50.000Z
2022-03-06T10:26:48.000Z
Driver/Video/Dumb/VidMem/Main/mainMain.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 1988 -- All Rights Reserved PROJECT: PC GEOS MODULE: Memory video drivers FILE: mainMain.asm AUTHOR: Jim DeFrisco ROUTINES: Name Description ---- ----------- DriverStrategy entry point to driver VidStartExclusive Enter into exclusive use VidEndExclusive Finished with exclusive use VidInfo Return address of info block VidEscape Generalized escape function REVISION HISTORY: Name Date Description ---- ---- ----------- jim 5/88 initial verison jim 8/89 moved into mem module for special modifications DESCRIPTION: This file contains the entry point routine for the video drivers. $Id: mainMain.asm,v 1.1 97/04/18 11:42:43 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%} COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DriverStrategy %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Entry point for vidmem calls CALLED BY: KERNEL PASS: [di] - offset into driver function table RETURN: see individual routines DESTROYED: depends on routine called PSEUDO CODE/STRATEGY: call function thru the jump table KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 10/88... Initial version of strategy routine Jim 10/88 Modified for video drivers Jim 5/89 Modified to add escape capability %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DriverStrategy proc far ; this is really simple, folks. The REAL DriverStrategy ; routine (well, the one you normally see for video drivers) ; is executed in each individual module of vidmem. So there ; is one for Mono, one for Color4, etc. But many of the normal ; driver functions are NULL for vidmem (pointer, save-under...) ; so they are handled locally. Basically, all we do here is ; either call into one of the modules or call a local routine. ; yawn. ; Of course, we also need to deal with escape codes. So check ; that first. tst di js handleEscape call cs:driverJumpTable[di] done: ret handleEscape: call VidEscape ; ESC function handler jmp done DriverStrategy endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VidCallMod %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Prepare to call into one of the main modules (Mono, etc) CALLED BY: INTERNAL DriverStrategy PASS: di - function number es - window structure RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: save necc variables, call into other module. KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Jim 10/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ VidCallMod proc near ; first, save away ax/bx since they are trashed by CallMod mov ss:[TPD_dataAX], ax ; trashed by CallMod mov ss:[TPD_dataBX], bx ; find out what type of bitmap it is, then call the appropriate ; module's entry point push ds ; save segreg EC < tst es:[W_bmSegment] ; if zero, hosed > EC < ERROR_Z VIDMEM_HUGE_ARRAY_PROBLEM > mov ds, es:[W_bmSegment] ; get bitmap segment mov bx, offset EB_bm ; ds:bx -> bitmap mov bl, ds:[bx].B_type ; get color info mov ax, ds:[EB_flags] ; grab edit mask flag pop ds and bx, mask BMT_FORMAT ; isolate type bits shl bx, 1 ; dword table shl bx, 1 ; if we're going to edit the mask, then we need to do a ; bit different work push es:[LMBH_handle] ; save win blk handle test ax, mask BM_EDIT_MASK jnz editMask mov ax, cs:[colorModTable][bx].offset ; grab pointer mov bx, cs:[colorModTable][bx].segment ; ; if bx = 0, that means this module is not supported. So ; we don't do anything. ; tst bx jz done call ProcCallFixedOrMovable done: mov ss:[TPD_dataBX], bx ; save bx return val pop bx ; restore win blk han call MemDerefES ; es -> window mov bx, ss:[TPD_dataBX] ; restore bx return val ret ; OK, we want to edit just the mask part of the bitmap. That ; means that we want to use the Mono module, but we need to ; get some information from the module that the bitmap ; naturally would go to (to have the picture part edited). editMask: mov ax, cs:[maskInfoTable][bx].offset ; get pointer mov bx, cs:[maskInfoTable][bx].segment ; ; if bx = 0, that means this module is not supported. So ; we don't do anything. ; tst bx jz done call ProcCallFixedOrMovable call MonoEditMask ; always use mono mod jmp done VidCallMod endp colorModTable label fptr if _MONO fptr Mono:MonoEntry ; mono bitmap else fptr 0 ; not supported endif ; if _MONO if _4BIT fptr Clr4:Clr4Entry ; 4-bit bitmap else fptr 0 ; not supported endif ; if _4BIT if _8BIT fptr Clr8:Clr8Entry ; 8-bit bitmap else fptr 0 ; not supported endif ; if _8BIT if _24BIT fptr Clr24:Clr24Entry ; 24-bit bitmap else fptr 0 ; not supported endif ; if _24BIT if _CMYK fptr cmykcode:CMYKEntry ; CMYK bitmap fptr cmykcode:CMYKEntry ; CMY bitmap else fptr 0 ; not supported fptr 0 ; not supported endif ; if _CMYK maskInfoTable label fptr if _MONO fptr Mono:MonoMaskInfo else fptr 0 ; not supported endif ; if _MONO if _4BIT fptr Clr4:Clr4MaskInfo else fptr 0 ; not supported endif ; if _4BIT if _8BIT fptr Clr8:Clr8MaskInfo else fptr 0 ; not supported endif ; if _8BIT if _24BIT ; fptr Clr24:Clr24MaskInfo ; re-enable this when fptr Clr24:Clr24Entry ; 24-bit implemented else fptr 0 ; not supported endif ; if _24BIT if _CMYK fptr cmykcode:CMYKMaskInfo fptr cmykcode:CMYKMaskInfo ; 3CMY bitmap else fptr 0 ; not supported fptr 0 ; not supported endif ; if _CMYK COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VideoNull %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: A null routine that takes the place of many non-implemented functions in vidmem CALLED BY: DriverStrategy (GLOBAL) PASS: various, depends on routine RETURN: carry clear cx clear (Set/Test device would like this) DESTROYED: nothing PSEUDO CODE/STRATEGY: just clear the carry, since a few routines use that to signal all is ok. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jim 11/21/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ VideoNull proc near clr cx VideoNullCLCOnly label near clc ret VideoNull endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VideoNullSet %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: A null routine that takes the place of many non-implemented functions in vidmem that requires carry set on exit CALLED BY: DriverStrategy (GLOBAL) PASS: various, depends on routine RETURN: set clear DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jim 11/21/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ VideoNullSet proc near stc ret VideoNullSet endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VidInit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Initialization routine for the driver. Called when driver is loaded, or when a new memory space is allocated to be drawn to. CALLED BY: GLOBAL PASS: nothing RETURN: carry clear - no errors possible DESTROYED: nothing PSEUDO CODE/STRATEGY: nothing for this driver; KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Jim 07/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ VidInit proc near ; A hack for logging -- don't discard the Mono resource if logging is ; on since that is where the log is kept (a hack, but it was quick) ifdef LOGGING push ax, bx, dx mov bx, handle Mono mov ah, MODIFY_FLAGS clr dl mov dh, mask HF_DISCARDABLE ;make not discardable call MemModify pop ax, bx, dx endif clc ; return no error ret VidInit endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VidInfo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Return a pointer to the driver info block CALLED BY: GLOBAL PASS: es - locked window segment RETURN: dx:si - pointer to DriverInfo block DESTROYED: nothing PSEUDO CODE/STRATEGY: Look up the bitmap segment in the window structure, then find the right offset (stored in the bitmap header) KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Jim 05/89 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ VidInfo proc near uses ax, ds .enter mov ds, es:[W_bmSegment] ; get segment of bitmap mov dx, ds ; this is where we return in mov ax, ds:[EB_flags] ; get edit-mask flag mov si, offset EB_bm ; bump past dir header mov ah, ds:[si].B_type ; grab type of bitmap add si, ds:[si][CB_devInfo] ; get offset to device info and ah, mask BMT_FORMAT ; isolate color format mov ds:[si].VDI_bmFormat, ah ; assume NOT editing mask test al, mask BM_EDIT_MASK ; see if editing mask jnz editingMask done: .leave ret ; we're editing the bitmap mask. Alter some info in the buffer editingMask: mov ds:[si].VDI_bmFormat, BMF_MONO jmp done VidInfo endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VidSetPalette %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set some palette regs for bitmap CALLED BY: GLOBAL PASS: es - Window segment dx:si - fptr to array of RGBValues al - palette register to start with ah - 0 = custom palette 1 = default palette cx - count of palette registers to change RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jim 11/16/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ VidSetPalette proc near uses es, di .enter ; setup destination of write clr ah EC < tst es:[W_bmSegment] ; check for valid segment > EC < ERROR_Z VIDMEM_HUGE_ARRAY_PROBLEM > mov es, es:[W_bmSegment] ; get segment of bitmap mov di, offset EB_bm ; es:di -> bitmap structure tst es:[di].CB_palette ; if zero, no palette jz done ; OK, so there is a palette. Copy the values over. ; the source palette is at dx:si push ds, ax, cx mov ds, dx ; ds:si -> buffer of values ; setup destination offset add di, es:[di].CB_palette ; es:di -> palette entries add di, 2 ; point past size add di, ax ; calculate first index shl ax, 1 add di, ax ; es:[di] -> first entry mov ax, cx shl cx, 1 ; calc #bytes to move add cx, ax rep movsb ; copy the palette entries pop ds, ax, cx done: .leave ret VidSetPalette endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VidGetPalette %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set some palette regs for bitmap CALLED BY: GLOBAL PASS: es - Window segment dx:si - fptr to array of RGBValues ax - palette register to start with cx - count of palette registers to change RETURN: cx - #pal regs changed, or zero if no palette DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jim 11/16/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ VidGetPalette proc near uses ds, di, ax, es, cx, si, bx .enter mov ds, es:[W_bmSegment] ; get segment of bitmap mov di, offset EB_bm ; es:di -> bitmap structure tst ds:[di].CB_palette ; if zero, no palette jz noPalette ; OK, so there is a palette. Copy the values over. xchg si, di ; ds:si -> our palette, mov es, dx ; es:di -> buffer to fill add si, ax shl ax, 1 add si, ax ; ds:si -> starting offset mov ax, cx ; calc #bytes to move shl cx, 1 add cx, ax rep movsb ; fill buffer done: .leave ret ; signal use of default noPalette: push ax clr di ; use GetPalette mov al, GPT_DEFAULT ; get the default palette call GrGetPalette call MemLock mov ds, ax pop ax clr di xchg si, di ; ds:si -> newly acquired pal mov es, dx ; es:di -> passed buffer add si, ax shl ax, 1 add si, ax ; ds:si -> right one mov ax, cx shl cx, 1 add cx, ax ; cx = #bytes to transfer rep movsb ; copy bytes over call MemFree ; release block jmp done VidGetPalette endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VidCheckIfFormatIsSupported %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Check to see if the passed bitmap format is supported by VidMem. CALLED BY: PASS: al = BMFormat RETURN: carry = clear (supported) = set (not supported) DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- CL 11/ 2/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ VidCheckIfFormatIsSupported proc near uses ax, bp .enter ; ; if the value of the corresponding entry in the table doesn't ; match the passed bitmap format, that bitmap format is not supported. ; clr ah mov bp, ax ;bp = BMFormat mov al, cs:[supportedFormatTable][bp] cmp bp, ax ;supported or not? .leave ret VidCheckIfFormatIsSupported endp supportedFormatTable label byte if _MONO db BMF_MONO else db 0xff endif ; if _MONO if _4BIT db BMF_4BIT else db 0xff endif ; if _4BIT if _8BIT db BMF_8BIT else db 0xff endif ; if _8BIT if _24BIT db BMF_24BIT else db 0xff endif ; if _24BIT if _CMYK db BMF_4CMYK db BMF_3CMY else db 0xff db 0xff endif ; if _CMYK DefEscapeTable 2 DefEscape VidQEscape, DRV_ESC_QUERY_ESC ; query esc capability DefEscape VidCheckIfFormatIsSupported, VID_ESC_CHECK_IF_FORMAT_IS_SUPPORTED COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VidEscape %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Execute some escape function CALLED BY: GLOBAL PASS: di - escape code (ORed with 8000h) RETURN: di - set to 0 if escape not supported - return unchanged if handled DESTROYED: see individual functions PSEUDO CODE/STRATEGY: scan through the table, find the code, call the handler. KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Jim 05/89 Initial version CL 11/11/95 Copied from vidcomEntry.asm %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ VidEscape proc near push di ; save a few regs push cx push ax push es segmov es, cs, cx ; es -> driver segment mov ax, di ; setup match value mov di, offset escCodes ; si -> esc code tab mov cx, NUM_ESC_ENTRIES ; init rep count repne scasw ; find the right one pop es pop ax jne VE_notFound ; not in table, quit ; function is supported, call through vector pop cx call cs:[di+((offset escRoutines)-(offset escCodes)-2)] pop di ret ; function not supported, return di==0 VE_notFound: pop cx ; restore stack pop di clr di ; set return value ret VidEscape endp
24.834074
79
0.569409
43f319dcf6c3c65dcd2b0c216dee586342d7df25
1,033
asm
Assembly
aom_20170505/aom_ports/emms.asm
rainliu/aom_analyzer
440652d155140c00a2827512a54103be3d6ff7e4
[ "MIT" ]
null
null
null
aom_20170505/aom_ports/emms.asm
rainliu/aom_analyzer
440652d155140c00a2827512a54103be3d6ff7e4
[ "MIT" ]
null
null
null
aom_20170505/aom_ports/emms.asm
rainliu/aom_analyzer
440652d155140c00a2827512a54103be3d6ff7e4
[ "MIT" ]
null
null
null
; ; Copyright (c) 2016, Alliance for Open Media. All rights reserved ; ; This source code is subject to the terms of the BSD 2 Clause License and ; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License ; was not distributed with this source code in the LICENSE file, you can ; obtain it at www.aomedia.org/license/software. If the Alliance for Open ; Media Patent License 1.0 was not distributed with this source code in the ; PATENTS file, you can obtain it at www.aomedia.org/license/patent. ; ; %include "aom_ports/x86_abi_support.asm" section .text global sym(aom_reset_mmx_state) PRIVATE sym(aom_reset_mmx_state): emms ret %if LIBAOM_YASM_WIN64 global sym(aom_winx64_fldcw) PRIVATE sym(aom_winx64_fldcw): sub rsp, 8 mov [rsp], rcx ; win x64 specific fldcw [rsp] add rsp, 8 ret global sym(aom_winx64_fstcw) PRIVATE sym(aom_winx64_fstcw): sub rsp, 8 fstcw [rsp] mov rax, [rsp] add rsp, 8 ret %endif
24.595238
78
0.691191
bc8946fc771203efa0415fa1a623cdc2b7b0451f
448
asm
Assembly
programs/oeis/131/A131844.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/131/A131844.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
programs/oeis/131/A131844.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
; A131844: 3*A131821 - 2*A000012. ; 1,4,4,7,1,7,10,1,1,10,13,1,1,1,13,16,1,1,1,1,16,19,1,1,1,1,1,19,22,1,1,1,1,1,1,22,25,1,1,1,1,1,1,1,25,28,1,1,1,1,1,1,1,1,28 mov $3,$0 mov $5,2 lpb $5 mov $0,$3 sub $5,1 add $0,$5 sub $0,1 mov $4,1 lpb $0 add $4,1 sub $0,$4 trn $0,$4 add $0,$4 lpe mul $0,$4 mov $2,$5 mov $4,$0 lpb $2 mov $1,$4 sub $2,1 lpe lpe lpb $3 sub $1,$4 mov $3,0 lpe mul $1,3 add $1,1
14
125
0.491071
7efc1edf413f62b78ffe72f901f95d3ccd46178b
1,058
asm
Assembly
exploit/server.asm
roguematter/malware-csg513
959ecdfad5efc8c95fd7143ef243fc07366f29e8
[ "CC0-1.0" ]
null
null
null
exploit/server.asm
roguematter/malware-csg513
959ecdfad5efc8c95fd7143ef243fc07366f29e8
[ "CC0-1.0" ]
null
null
null
exploit/server.asm
roguematter/malware-csg513
959ecdfad5efc8c95fd7143ef243fc07366f29e8
[ "CC0-1.0" ]
null
null
null
section .text global _start _socket: mov eax,102 mov ebx,1 mov ecx,esp add ecx,4 int 0x80 ret 12 _bind: mov eax,102 mov ebx,2 mov ecx,esp add ecx,4 int 0x80 ret 28 _listen: mov eax,102 mov ebx,4 mov ecx,esp add ecx,4 int 0x80 ret 5 _accept: mov eax,102 mov ebx,5 mov ecx,esp add ecx,4 int 0x80 ret 12 _overflow: mov ebp,esp sub esp,256 mov eax,esp __copy: cmp byte[ecx],0 je __done mov bl,byte [ecx] inc ecx mov byte [eax],bl inc eax jmp __copy __done: mov esp,ebp ret _start: push dword 6 push dword 1 push dword 2 call _socket mov esi,eax ;esi has sockfd push dword 0 push dword 0 push dword 0 push word 0xcca9 push word 2 mov edi,esp push dword 16 push edi push esi call _bind push byte 1 push esi call _listen __callaccept: push dword 0 push dword 0 push esi call _accept mov edi,eax ;edi has connfd sub esp,512 mov ecx,esp mov eax,3 mov ebx,edi mov edx,512 int 0x80 mov eax,6 mov ebx,edi int 0x80 call _overflow add esp,512 jmp __callaccept mov eax,1 mov ebx,0 int 0x80
11.020833
18
0.700378
be3fe84240f9b4bd200d38a1bd7b9e5e7510d9f2
5,353
asm
Assembly
src/cm_equipment.asm
spannerisms/lttphack
8309fecd1b73db4d81616ec500253ae1aa52b399
[ "MIT" ]
6
2020-02-14T17:14:52.000Z
2021-12-06T19:51:25.000Z
src/cm_equipment.asm
spannerisms/lttphack
8309fecd1b73db4d81616ec500253ae1aa52b399
[ "MIT" ]
1
2020-09-26T07:40:33.000Z
2020-09-26T07:40:33.000Z
src/cm_equipment.asm
spannerisms/lttphack
8309fecd1b73db4d81616ec500253ae1aa52b399
[ "MIT" ]
7
2019-12-02T21:51:51.000Z
2021-07-03T17:53:04.000Z
EQUIPMENT_SUBMENU: %menu_header("EQUIPMENT", 19) ;=================================================================================================== %numfield_long_func_prgtext("Health", $7EF36D, 0, $A0, 8, this, cm_draw_hp) LDA.l $7EF36D CMP.l $7EF36C BCC ..not_max LDA.l $7EF36C BRA ..set ..not_max BIT.b SA1IRAM.cm_shoulder BVS ..flatten BPL ..set ..flatten AND.b #$F8 ..set STA.l $7EF36D RTL #cm_draw_hp: PHA ; save A LSR ; divide by 8 for hearts LSR LSR JSL CMDRAW_NUMFIELD_DEC_FROM_FUNC ; draw our max HP SEP #$20 PLA AND.b #$07 ; get fractional ORA.b #$40 JML CMDRAW_1_CHARACTER ;=================================================================================================== %numfield_func("Max HP", SA1RAM.cm_equipment_maxhp, 3, 20, 5, this) LDA.w SA1RAM.cm_equipment_maxhp ASL #3 STA.l $7EF36C RTL ;=================================================================================================== %numfield_long("Magic", $7EF36E, 0, $80, 8) ;=================================================================================================== %func("Fill rupees", this) REP #$20 LDA.w #999 STA.l $7EF360 STA.l $7EF362 RTL ;=================================================================================================== %func("Fill everything", this) JSL Shortcut_FillEverything JSL CM_CacheWRAM JML RedrawCurrentMenu ;=================================================================================================== %choice_long_func_filtered_here("Sword", $7EF359, 5, set_sword) %list_item("No") %list_item("Fighter") %list_item("Master") %list_item("Tempered") %list_item("Gold") #set_sword: JSL DecompSwordGfx JML Palette_Sword ;=================================================================================================== %choice_long_func_filtered_here("Shield", $7EF35A, 4, set_shield) %list_item("No") %list_item("Fighter") %list_item("Red") %list_item("Mirror") #set_shield: JSL DecompShieldGfx JML Palette_Shield ;=================================================================================================== %choice_long_func_filtered_here("Armor", $7EF35B, 3, Palette_Armor) %list_item("Green") %list_item("Blue") %list_item("Red") ;=================================================================================================== %choice_long_func_filtered_here("Gloves", $7EF354, 3, Palette_Armor) %list_item("No") %list_item("Power glove") %list_item("Titan's mitt") ;=================================================================================================== %toggle_long_func("Boots", $7EF355, this) LDA.l $7EF355 LSR LDA.l $7EF379 AND.b #$FB BCC ++ ORA.b #$04 ++ STA.l $7EF379 RTL ;=================================================================================================== %toggle_long_func("Flippers", $7EF356, this) LDA.l $7EF356 LSR LDA.l $7EF379 AND.b #$FD BCC ++ ORA.b #$02 ++ STA.l $7EF379 RTL ;=================================================================================================== %toggle_long("Moon pearl", $7EF357) ;=================================================================================================== %toggle_long("Half magic", $7EF37B) ;=================================================================================================== %numfield_long_2digits("Heart pieces", $7EF36B, 0, 3, 1) ;=================================================================================================== %add_menu_item(BOMBS_SETTER) %numfield_long_2digits("Arrows", $7EF377, 0, 50, 5) %numfield_long_2digits("Keys", $7EF36F, 0, 9, 1) ;=================================================================================================== %submenu("Big keys", BIG_KEYS_SUBMENU) ;=================================================================================================== %submenu("Small keys", SMALL_KEYS_SUBMENU) ;=================================================================================================== BIG_KEYS_SUBMENU: %menu_header("BIG KEYS", 14) %toggle_bit_long("Sewers", $7EF367, 7) %toggle_bit_long("Escape", $7EF367, 6) %toggle_bit_long("Eastern", $7EF367, 5) %toggle_bit_long("Desert", $7EF367, 4) %toggle_bit_long("Hera", $7EF366, 5) %toggle_bit_long("ATower", $7EF367, 3) %toggle_bit_long("Darkness", $7EF367, 1) %toggle_bit_long("Swamp", $7EF367, 2) %toggle_bit_long("Skull", $7EF366, 7) %toggle_bit_long("Thieves", $7EF366, 4) %toggle_bit_long("Mire", $7EF367, 0) %toggle_bit_long("Ice", $7EF366, 6) %toggle_bit_long("Turtle Rock", $7EF366, 3) %toggle_bit_long("GTower", $7EF366, 2) ;=================================================================================================== SMALL_KEYS_SUBMENU: %menu_header("SMALL KEYS", 13) %numfield_long("Escape", $7EF37C, 0, 9, 1) %numfield_long("Eastern", $7EF37E, 0, 9, 1) %numfield_long("Desert", $7EF37F, 0, 9, 1) %numfield_long("Hera", $7EF386, 0, 9, 1) %numfield_long("ATower", $7EF380, 0, 9, 1) %numfield_long("Darkness", $7EF382, 0, 9, 1) %numfield_long("Swamp", $7EF381, 0, 9, 1) %numfield_long("Skull", $7EF384, 0, 9, 1) %numfield_long("Thieves", $7EF387, 0, 9, 1) %numfield_long("Ice", $7EF385, 0, 9, 1) %numfield_long("Mire", $7EF383, 0, 9, 1) %numfield_long("Turtle Rock", $7EF388, 0, 9, 1) %numfield_long("GTower", $7EF389, 0, 9, 1)
28.935135
100
0.445171
83a01a642d685277626907d7087dbdcce76296b3
665,807
asm
Assembly
xv6/kernel.asm
ZhangHnu/xv6FileSystem
a1bb5b607c45f8fa833f8f7b62aa2563d2b9007c
[ "MIT" ]
null
null
null
xv6/kernel.asm
ZhangHnu/xv6FileSystem
a1bb5b607c45f8fa833f8f7b62aa2563d2b9007c
[ "MIT" ]
null
null
null
xv6/kernel.asm
ZhangHnu/xv6FileSystem
a1bb5b607c45f8fa833f8f7b62aa2563d2b9007c
[ "MIT" ]
null
null
null
kernel: file format elf32-i386 Disassembly of section .text: 80100000 <multiboot_header>: 80100000: 02 b0 ad 1b 00 00 add 0x1bad(%eax),%dh 80100006: 00 00 add %al,(%eax) 80100008: fe 4f 52 decb 0x52(%edi) 8010000b: e4 0f in $0xf,%al 8010000c <entry>: # Entering xv6 on boot processor, with paging off. .globl entry entry: # Turn on page size extension for 4Mbyte pages movl %cr4, %eax 8010000c: 0f 20 e0 mov %cr4,%eax orl $(CR4_PSE), %eax 8010000f: 83 c8 10 or $0x10,%eax movl %eax, %cr4 80100012: 0f 22 e0 mov %eax,%cr4 # Set page directory movl $(V2P_WO(entrypgdir)), %eax 80100015: b8 00 90 10 00 mov $0x109000,%eax movl %eax, %cr3 8010001a: 0f 22 d8 mov %eax,%cr3 # Turn on paging. movl %cr0, %eax 8010001d: 0f 20 c0 mov %cr0,%eax orl $(CR0_PG|CR0_WP), %eax 80100020: 0d 00 00 01 80 or $0x80010000,%eax movl %eax, %cr0 80100025: 0f 22 c0 mov %eax,%cr0 # Set up the stack pointer. movl $(stack + KSTACKSIZE), %esp 80100028: bc b0 b5 10 80 mov $0x8010b5b0,%esp # Jump to main(), and switch to executing at # high addresses. The indirect call is needed because # the assembler produces a PC-relative instruction # for a direct jump. mov $main, %eax 8010002d: b8 50 2e 10 80 mov $0x80102e50,%eax jmp *%eax 80100032: ff e0 jmp *%eax ... 80100040 <binit>: struct buf head; } bcache; void binit(void) { 80100040: 55 push %ebp 80100041: 89 e5 mov %esp,%ebp 80100043: 53 push %ebx //PAGEBREAK! // Create linked list of buffers bcache.head.prev = &bcache.head; bcache.head.next = &bcache.head; for(b = bcache.buf; b < bcache.buf+NBUF; b++){ 80100044: bb f4 b5 10 80 mov $0x8010b5f4,%ebx struct buf head; } bcache; void binit(void) { 80100049: 83 ec 14 sub $0x14,%esp struct buf *b; initlock(&bcache.lock, "bcache"); 8010004c: c7 44 24 04 40 6d 10 movl $0x80106d40,0x4(%esp) 80100053: 80 80100054: c7 04 24 c0 b5 10 80 movl $0x8010b5c0,(%esp) 8010005b: e8 b0 40 00 00 call 80104110 <initlock> //PAGEBREAK! // Create linked list of buffers bcache.head.prev = &bcache.head; bcache.head.next = &bcache.head; 80100060: ba bc fc 10 80 mov $0x8010fcbc,%edx initlock(&bcache.lock, "bcache"); //PAGEBREAK! // Create linked list of buffers bcache.head.prev = &bcache.head; 80100065: c7 05 0c fd 10 80 bc movl $0x8010fcbc,0x8010fd0c 8010006c: fc 10 80 bcache.head.next = &bcache.head; 8010006f: c7 05 10 fd 10 80 bc movl $0x8010fcbc,0x8010fd10 80100076: fc 10 80 80100079: eb 09 jmp 80100084 <binit+0x44> 8010007b: 90 nop 8010007c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for(b = bcache.buf; b < bcache.buf+NBUF; b++){ 80100080: 89 da mov %ebx,%edx 80100082: 89 c3 mov %eax,%ebx b->next = bcache.head.next; 80100084: 89 53 54 mov %edx,0x54(%ebx) b->prev = &bcache.head; initsleeplock(&b->lock, "buffer"); 80100087: 8d 43 0c lea 0xc(%ebx),%eax // Create linked list of buffers bcache.head.prev = &bcache.head; bcache.head.next = &bcache.head; for(b = bcache.buf; b < bcache.buf+NBUF; b++){ b->next = bcache.head.next; b->prev = &bcache.head; 8010008a: c7 43 50 bc fc 10 80 movl $0x8010fcbc,0x50(%ebx) initsleeplock(&b->lock, "buffer"); 80100091: 89 04 24 mov %eax,(%esp) 80100094: c7 44 24 04 47 6d 10 movl $0x80106d47,0x4(%esp) 8010009b: 80 8010009c: e8 3f 3f 00 00 call 80103fe0 <initsleeplock> bcache.head.next->prev = b; 801000a1: a1 10 fd 10 80 mov 0x8010fd10,%eax 801000a6: 89 58 50 mov %ebx,0x50(%eax) //PAGEBREAK! // Create linked list of buffers bcache.head.prev = &bcache.head; bcache.head.next = &bcache.head; for(b = bcache.buf; b < bcache.buf+NBUF; b++){ 801000a9: 8d 83 5c 02 00 00 lea 0x25c(%ebx),%eax 801000af: 3d bc fc 10 80 cmp $0x8010fcbc,%eax b->next = bcache.head.next; b->prev = &bcache.head; initsleeplock(&b->lock, "buffer"); bcache.head.next->prev = b; bcache.head.next = b; 801000b4: 89 1d 10 fd 10 80 mov %ebx,0x8010fd10 //PAGEBREAK! // Create linked list of buffers bcache.head.prev = &bcache.head; bcache.head.next = &bcache.head; for(b = bcache.buf; b < bcache.buf+NBUF; b++){ 801000ba: 72 c4 jb 80100080 <binit+0x40> b->prev = &bcache.head; initsleeplock(&b->lock, "buffer"); bcache.head.next->prev = b; bcache.head.next = b; } } 801000bc: 83 c4 14 add $0x14,%esp 801000bf: 5b pop %ebx 801000c0: 5d pop %ebp 801000c1: c3 ret 801000c2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801000c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801000d0 <bread>: } // Return a locked buf with the contents of the indicated block. struct buf* bread(uint dev, uint blockno) { 801000d0: 55 push %ebp 801000d1: 89 e5 mov %esp,%ebp 801000d3: 57 push %edi 801000d4: 56 push %esi 801000d5: 53 push %ebx 801000d6: 83 ec 1c sub $0x1c,%esp 801000d9: 8b 75 08 mov 0x8(%ebp),%esi 801000dc: 8b 7d 0c mov 0xc(%ebp),%edi static struct buf* bget(uint dev, uint blockno) { struct buf *b; acquire(&bcache.lock); 801000df: c7 04 24 c0 b5 10 80 movl $0x8010b5c0,(%esp) 801000e6: e8 95 41 00 00 call 80104280 <acquire> // Is the block already cached? for(b = bcache.head.next; b != &bcache.head; b = b->next){ 801000eb: 8b 1d 10 fd 10 80 mov 0x8010fd10,%ebx 801000f1: 81 fb bc fc 10 80 cmp $0x8010fcbc,%ebx 801000f7: 75 12 jne 8010010b <bread+0x3b> 801000f9: eb 25 jmp 80100120 <bread+0x50> 801000fb: 90 nop 801000fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100100: 8b 5b 54 mov 0x54(%ebx),%ebx 80100103: 81 fb bc fc 10 80 cmp $0x8010fcbc,%ebx 80100109: 74 15 je 80100120 <bread+0x50> if(b->dev == dev && b->blockno == blockno){ 8010010b: 3b 73 04 cmp 0x4(%ebx),%esi 8010010e: 75 f0 jne 80100100 <bread+0x30> 80100110: 3b 7b 08 cmp 0x8(%ebx),%edi 80100113: 75 eb jne 80100100 <bread+0x30> b->refcnt++; 80100115: 83 43 4c 01 addl $0x1,0x4c(%ebx) 80100119: eb 3f jmp 8010015a <bread+0x8a> 8010011b: 90 nop 8010011c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } // Not cached; recycle an unused buffer. // Even if refcnt==0, B_DIRTY indicates a buffer is in use // because log.c has modified it but not yet committed it. for(b = bcache.head.prev; b != &bcache.head; b = b->prev){ 80100120: 8b 1d 0c fd 10 80 mov 0x8010fd0c,%ebx 80100126: 81 fb bc fc 10 80 cmp $0x8010fcbc,%ebx 8010012c: 75 0d jne 8010013b <bread+0x6b> 8010012e: eb 58 jmp 80100188 <bread+0xb8> 80100130: 8b 5b 50 mov 0x50(%ebx),%ebx 80100133: 81 fb bc fc 10 80 cmp $0x8010fcbc,%ebx 80100139: 74 4d je 80100188 <bread+0xb8> if(b->refcnt == 0 && (b->flags & B_DIRTY) == 0) { 8010013b: 8b 43 4c mov 0x4c(%ebx),%eax 8010013e: 85 c0 test %eax,%eax 80100140: 75 ee jne 80100130 <bread+0x60> 80100142: f6 03 04 testb $0x4,(%ebx) 80100145: 75 e9 jne 80100130 <bread+0x60> b->dev = dev; 80100147: 89 73 04 mov %esi,0x4(%ebx) b->blockno = blockno; 8010014a: 89 7b 08 mov %edi,0x8(%ebx) b->flags = 0; 8010014d: c7 03 00 00 00 00 movl $0x0,(%ebx) b->refcnt = 1; 80100153: c7 43 4c 01 00 00 00 movl $0x1,0x4c(%ebx) release(&bcache.lock); 8010015a: c7 04 24 c0 b5 10 80 movl $0x8010b5c0,(%esp) 80100161: e8 8a 41 00 00 call 801042f0 <release> acquiresleep(&b->lock); 80100166: 8d 43 0c lea 0xc(%ebx),%eax 80100169: 89 04 24 mov %eax,(%esp) 8010016c: e8 af 3e 00 00 call 80104020 <acquiresleep> bread(uint dev, uint blockno) { struct buf *b; b = bget(dev, blockno); if((b->flags & B_VALID) == 0) { 80100171: f6 03 02 testb $0x2,(%ebx) 80100174: 75 08 jne 8010017e <bread+0xae> iderw(b); 80100176: 89 1c 24 mov %ebx,(%esp) 80100179: e8 12 20 00 00 call 80102190 <iderw> } return b; } 8010017e: 83 c4 1c add $0x1c,%esp 80100181: 89 d8 mov %ebx,%eax 80100183: 5b pop %ebx 80100184: 5e pop %esi 80100185: 5f pop %edi 80100186: 5d pop %ebp 80100187: c3 ret release(&bcache.lock); acquiresleep(&b->lock); return b; } } panic("bget: no buffers"); 80100188: c7 04 24 4e 6d 10 80 movl $0x80106d4e,(%esp) 8010018f: e8 dc 01 00 00 call 80100370 <panic> 80100194: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 8010019a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 801001a0 <bwrite>: } // Write b's contents to disk. Must be locked. void bwrite(struct buf *b) { 801001a0: 55 push %ebp 801001a1: 89 e5 mov %esp,%ebp 801001a3: 53 push %ebx 801001a4: 83 ec 14 sub $0x14,%esp 801001a7: 8b 5d 08 mov 0x8(%ebp),%ebx if(!holdingsleep(&b->lock)) 801001aa: 8d 43 0c lea 0xc(%ebx),%eax 801001ad: 89 04 24 mov %eax,(%esp) 801001b0: e8 0b 3f 00 00 call 801040c0 <holdingsleep> 801001b5: 85 c0 test %eax,%eax 801001b7: 74 10 je 801001c9 <bwrite+0x29> panic("bwrite"); b->flags |= B_DIRTY; 801001b9: 83 0b 04 orl $0x4,(%ebx) iderw(b); 801001bc: 89 5d 08 mov %ebx,0x8(%ebp) } 801001bf: 83 c4 14 add $0x14,%esp 801001c2: 5b pop %ebx 801001c3: 5d pop %ebp bwrite(struct buf *b) { if(!holdingsleep(&b->lock)) panic("bwrite"); b->flags |= B_DIRTY; iderw(b); 801001c4: e9 c7 1f 00 00 jmp 80102190 <iderw> // Write b's contents to disk. Must be locked. void bwrite(struct buf *b) { if(!holdingsleep(&b->lock)) panic("bwrite"); 801001c9: c7 04 24 5f 6d 10 80 movl $0x80106d5f,(%esp) 801001d0: e8 9b 01 00 00 call 80100370 <panic> 801001d5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801001d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801001e0 <brelse>: // Release a locked buffer. // Move to the head of the MRU list. void brelse(struct buf *b) { 801001e0: 55 push %ebp 801001e1: 89 e5 mov %esp,%ebp 801001e3: 56 push %esi 801001e4: 53 push %ebx 801001e5: 83 ec 10 sub $0x10,%esp 801001e8: 8b 5d 08 mov 0x8(%ebp),%ebx if(!holdingsleep(&b->lock)) 801001eb: 8d 73 0c lea 0xc(%ebx),%esi 801001ee: 89 34 24 mov %esi,(%esp) 801001f1: e8 ca 3e 00 00 call 801040c0 <holdingsleep> 801001f6: 85 c0 test %eax,%eax 801001f8: 74 62 je 8010025c <brelse+0x7c> panic("brelse"); releasesleep(&b->lock); 801001fa: 89 34 24 mov %esi,(%esp) 801001fd: e8 7e 3e 00 00 call 80104080 <releasesleep> acquire(&bcache.lock); 80100202: c7 04 24 c0 b5 10 80 movl $0x8010b5c0,(%esp) 80100209: e8 72 40 00 00 call 80104280 <acquire> b->refcnt--; 8010020e: 8b 43 4c mov 0x4c(%ebx),%eax 80100211: 83 e8 01 sub $0x1,%eax if (b->refcnt == 0) { 80100214: 85 c0 test %eax,%eax panic("brelse"); releasesleep(&b->lock); acquire(&bcache.lock); b->refcnt--; 80100216: 89 43 4c mov %eax,0x4c(%ebx) if (b->refcnt == 0) { 80100219: 75 2f jne 8010024a <brelse+0x6a> // no one is waiting for it. b->next->prev = b->prev; 8010021b: 8b 43 54 mov 0x54(%ebx),%eax 8010021e: 8b 53 50 mov 0x50(%ebx),%edx 80100221: 89 50 50 mov %edx,0x50(%eax) b->prev->next = b->next; 80100224: 8b 43 50 mov 0x50(%ebx),%eax 80100227: 8b 53 54 mov 0x54(%ebx),%edx 8010022a: 89 50 54 mov %edx,0x54(%eax) b->next = bcache.head.next; 8010022d: a1 10 fd 10 80 mov 0x8010fd10,%eax b->prev = &bcache.head; 80100232: c7 43 50 bc fc 10 80 movl $0x8010fcbc,0x50(%ebx) b->refcnt--; if (b->refcnt == 0) { // no one is waiting for it. b->next->prev = b->prev; b->prev->next = b->next; b->next = bcache.head.next; 80100239: 89 43 54 mov %eax,0x54(%ebx) b->prev = &bcache.head; bcache.head.next->prev = b; 8010023c: a1 10 fd 10 80 mov 0x8010fd10,%eax 80100241: 89 58 50 mov %ebx,0x50(%eax) bcache.head.next = b; 80100244: 89 1d 10 fd 10 80 mov %ebx,0x8010fd10 } release(&bcache.lock); 8010024a: c7 45 08 c0 b5 10 80 movl $0x8010b5c0,0x8(%ebp) } 80100251: 83 c4 10 add $0x10,%esp 80100254: 5b pop %ebx 80100255: 5e pop %esi 80100256: 5d pop %ebp b->prev = &bcache.head; bcache.head.next->prev = b; bcache.head.next = b; } release(&bcache.lock); 80100257: e9 94 40 00 00 jmp 801042f0 <release> // Move to the head of the MRU list. void brelse(struct buf *b) { if(!holdingsleep(&b->lock)) panic("brelse"); 8010025c: c7 04 24 66 6d 10 80 movl $0x80106d66,(%esp) 80100263: e8 08 01 00 00 call 80100370 <panic> ... 80100270 <consoleread>: } } int consoleread(struct inode *ip, char *dst, int n) { 80100270: 55 push %ebp 80100271: 89 e5 mov %esp,%ebp 80100273: 57 push %edi 80100274: 56 push %esi 80100275: 53 push %ebx 80100276: 83 ec 2c sub $0x2c,%esp 80100279: 8b 5d 10 mov 0x10(%ebp),%ebx 8010027c: 8b 7d 08 mov 0x8(%ebp),%edi 8010027f: 8b 75 0c mov 0xc(%ebp),%esi uint target; int c; iunlock(ip); 80100282: 89 3c 24 mov %edi,(%esp) 80100285: e8 f6 14 00 00 call 80101780 <iunlock> target = n; 8010028a: 89 5d e4 mov %ebx,-0x1c(%ebp) acquire(&cons.lock); 8010028d: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) 80100294: e8 e7 3f 00 00 call 80104280 <acquire> while(n > 0){ 80100299: 31 c0 xor %eax,%eax 8010029b: 85 db test %ebx,%ebx 8010029d: 7f 29 jg 801002c8 <consoleread+0x58> 8010029f: eb 6a jmp 8010030b <consoleread+0x9b> 801002a1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi while(input.r == input.w){ if(myproc()->killed){ 801002a8: e8 83 34 00 00 call 80103730 <myproc> 801002ad: 8b 40 24 mov 0x24(%eax),%eax 801002b0: 85 c0 test %eax,%eax 801002b2: 75 7c jne 80100330 <consoleread+0xc0> release(&cons.lock); ilock(ip); return -1; } sleep(&input.r, &cons.lock); 801002b4: c7 44 24 04 20 a5 10 movl $0x8010a520,0x4(%esp) 801002bb: 80 801002bc: c7 04 24 a0 ff 10 80 movl $0x8010ffa0,(%esp) 801002c3: e8 c8 39 00 00 call 80103c90 <sleep> iunlock(ip); target = n; acquire(&cons.lock); while(n > 0){ while(input.r == input.w){ 801002c8: a1 a0 ff 10 80 mov 0x8010ffa0,%eax 801002cd: 3b 05 a4 ff 10 80 cmp 0x8010ffa4,%eax 801002d3: 74 d3 je 801002a8 <consoleread+0x38> ilock(ip); return -1; } sleep(&input.r, &cons.lock); } c = input.buf[input.r++ % INPUT_BUF]; 801002d5: 89 c2 mov %eax,%edx 801002d7: 83 e2 7f and $0x7f,%edx 801002da: 0f b6 8a 20 ff 10 80 movzbl -0x7fef00e0(%edx),%ecx 801002e1: 0f be d1 movsbl %cl,%edx 801002e4: 89 55 dc mov %edx,-0x24(%ebp) 801002e7: 8d 50 01 lea 0x1(%eax),%edx if(c == C('D')){ // EOF 801002ea: 83 7d dc 04 cmpl $0x4,-0x24(%ebp) ilock(ip); return -1; } sleep(&input.r, &cons.lock); } c = input.buf[input.r++ % INPUT_BUF]; 801002ee: 89 15 a0 ff 10 80 mov %edx,0x8010ffa0 if(c == C('D')){ // EOF 801002f4: 74 5b je 80100351 <consoleread+0xe1> // caller gets a 0-byte result. input.r--; } break; } *dst++ = c; 801002f6: 88 0e mov %cl,(%esi) --n; 801002f8: 83 eb 01 sub $0x1,%ebx // caller gets a 0-byte result. input.r--; } break; } *dst++ = c; 801002fb: 83 c6 01 add $0x1,%esi --n; if(c == '\n') 801002fe: 83 7d dc 0a cmpl $0xa,-0x24(%ebp) 80100302: 74 57 je 8010035b <consoleread+0xeb> int c; iunlock(ip); target = n; acquire(&cons.lock); while(n > 0){ 80100304: 85 db test %ebx,%ebx 80100306: 75 c0 jne 801002c8 <consoleread+0x58> 80100308: 8b 45 e4 mov -0x1c(%ebp),%eax *dst++ = c; --n; if(c == '\n') break; } release(&cons.lock); 8010030b: 89 45 e0 mov %eax,-0x20(%ebp) 8010030e: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) 80100315: e8 d6 3f 00 00 call 801042f0 <release> ilock(ip); 8010031a: 89 3c 24 mov %edi,(%esp) 8010031d: e8 7e 13 00 00 call 801016a0 <ilock> 80100322: 8b 45 e0 mov -0x20(%ebp),%eax return target - n; } 80100325: 83 c4 2c add $0x2c,%esp 80100328: 5b pop %ebx 80100329: 5e pop %esi 8010032a: 5f pop %edi 8010032b: 5d pop %ebp 8010032c: c3 ret 8010032d: 8d 76 00 lea 0x0(%esi),%esi target = n; acquire(&cons.lock); while(n > 0){ while(input.r == input.w){ if(myproc()->killed){ release(&cons.lock); 80100330: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) 80100337: e8 b4 3f 00 00 call 801042f0 <release> ilock(ip); 8010033c: 89 3c 24 mov %edi,(%esp) 8010033f: e8 5c 13 00 00 call 801016a0 <ilock> } release(&cons.lock); ilock(ip); return target - n; } 80100344: 83 c4 2c add $0x2c,%esp while(n > 0){ while(input.r == input.w){ if(myproc()->killed){ release(&cons.lock); ilock(ip); return -1; 80100347: b8 ff ff ff ff mov $0xffffffff,%eax } release(&cons.lock); ilock(ip); return target - n; } 8010034c: 5b pop %ebx 8010034d: 5e pop %esi 8010034e: 5f pop %edi 8010034f: 5d pop %ebp 80100350: c3 ret } sleep(&input.r, &cons.lock); } c = input.buf[input.r++ % INPUT_BUF]; if(c == C('D')){ // EOF if(n < target){ 80100351: 39 5d e4 cmp %ebx,-0x1c(%ebp) 80100354: 76 05 jbe 8010035b <consoleread+0xeb> // Save ^D for next time, to make sure // caller gets a 0-byte result. input.r--; 80100356: a3 a0 ff 10 80 mov %eax,0x8010ffa0 8010035b: 8b 45 e4 mov -0x1c(%ebp),%eax 8010035e: 29 d8 sub %ebx,%eax 80100360: eb a9 jmp 8010030b <consoleread+0x9b> 80100362: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100369: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80100370 <panic>: release(&cons.lock); } void panic(char *s) { 80100370: 55 push %ebp 80100371: 89 e5 mov %esp,%ebp 80100373: 56 push %esi 80100374: 53 push %ebx 80100375: 83 ec 40 sub $0x40,%esp int i; uint pcs[10]; cli(); cons.locking = 0; 80100378: c7 05 54 a5 10 80 00 movl $0x0,0x8010a554 8010037f: 00 00 00 } static inline void cli(void) { asm volatile("cli"); 80100382: fa cli // use lapiccpunum so that we can call panic from mycpu() cprintf("lapicid %d: panic: ", lapicid()); 80100383: e8 68 23 00 00 call 801026f0 <lapicid> cprintf(s); cprintf("\n"); getcallerpcs(&s, pcs); 80100388: 8d 5d d0 lea -0x30(%ebp),%ebx uint pcs[10]; cli(); cons.locking = 0; // use lapiccpunum so that we can call panic from mycpu() cprintf("lapicid %d: panic: ", lapicid()); 8010038b: c7 04 24 6d 6d 10 80 movl $0x80106d6d,(%esp) if(locking) release(&cons.lock); } void panic(char *s) 80100392: 8d 75 f8 lea -0x8(%ebp),%esi uint pcs[10]; cli(); cons.locking = 0; // use lapiccpunum so that we can call panic from mycpu() cprintf("lapicid %d: panic: ", lapicid()); 80100395: 89 44 24 04 mov %eax,0x4(%esp) 80100399: e8 b2 02 00 00 call 80100650 <cprintf> cprintf(s); 8010039e: 8b 45 08 mov 0x8(%ebp),%eax 801003a1: 89 04 24 mov %eax,(%esp) 801003a4: e8 a7 02 00 00 call 80100650 <cprintf> cprintf("\n"); 801003a9: c7 04 24 97 76 10 80 movl $0x80107697,(%esp) 801003b0: e8 9b 02 00 00 call 80100650 <cprintf> getcallerpcs(&s, pcs); 801003b5: 8d 45 08 lea 0x8(%ebp),%eax 801003b8: 89 5c 24 04 mov %ebx,0x4(%esp) 801003bc: 89 04 24 mov %eax,(%esp) 801003bf: e8 6c 3d 00 00 call 80104130 <getcallerpcs> 801003c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for(i=0; i<10; i++) cprintf(" %p", pcs[i]); 801003c8: 8b 03 mov (%ebx),%eax 801003ca: 83 c3 04 add $0x4,%ebx 801003cd: c7 04 24 81 6d 10 80 movl $0x80106d81,(%esp) 801003d4: 89 44 24 04 mov %eax,0x4(%esp) 801003d8: e8 73 02 00 00 call 80100650 <cprintf> // use lapiccpunum so that we can call panic from mycpu() cprintf("lapicid %d: panic: ", lapicid()); cprintf(s); cprintf("\n"); getcallerpcs(&s, pcs); for(i=0; i<10; i++) 801003dd: 39 f3 cmp %esi,%ebx 801003df: 75 e7 jne 801003c8 <panic+0x58> cprintf(" %p", pcs[i]); panicked = 1; // freeze other CPU 801003e1: c7 05 58 a5 10 80 01 movl $0x1,0x8010a558 801003e8: 00 00 00 801003eb: eb fe jmp 801003eb <panic+0x7b> 801003ed: 8d 76 00 lea 0x0(%esi),%esi 801003f0 <consputc>: crt[pos] = ' ' | 0x0700; } void consputc(int c) { 801003f0: 55 push %ebp 801003f1: 89 e5 mov %esp,%ebp 801003f3: 57 push %edi 801003f4: 56 push %esi 801003f5: 89 c6 mov %eax,%esi 801003f7: 53 push %ebx 801003f8: 83 ec 1c sub $0x1c,%esp if(panicked){ 801003fb: 8b 15 58 a5 10 80 mov 0x8010a558,%edx 80100401: 85 d2 test %edx,%edx 80100403: 74 03 je 80100408 <consputc+0x18> 80100405: fa cli 80100406: eb fe jmp 80100406 <consputc+0x16> cli(); for(;;) ; } if(c == BACKSPACE){ 80100408: 3d 00 01 00 00 cmp $0x100,%eax 8010040d: 0f 84 ac 00 00 00 je 801004bf <consputc+0xcf> uartputc('\b'); uartputc(' '); uartputc('\b'); } else uartputc(c); 80100413: 89 04 24 mov %eax,(%esp) 80100416: e8 75 54 00 00 call 80105890 <uartputc> } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 8010041b: b9 d4 03 00 00 mov $0x3d4,%ecx 80100420: b8 0e 00 00 00 mov $0xe,%eax 80100425: 89 ca mov %ecx,%edx 80100427: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80100428: bf d5 03 00 00 mov $0x3d5,%edi 8010042d: 89 fa mov %edi,%edx 8010042f: ec in (%dx),%al { int pos; // Cursor position: col + 80*row. outb(CRTPORT, 14); pos = inb(CRTPORT+1) << 8; 80100430: 0f b6 d8 movzbl %al,%ebx } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80100433: 89 ca mov %ecx,%edx 80100435: c1 e3 08 shl $0x8,%ebx 80100438: b8 0f 00 00 00 mov $0xf,%eax 8010043d: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 8010043e: 89 fa mov %edi,%edx 80100440: ec in (%dx),%al outb(CRTPORT, 15); pos |= inb(CRTPORT+1); 80100441: 0f b6 c0 movzbl %al,%eax 80100444: 09 c3 or %eax,%ebx if(c == '\n') 80100446: 83 fe 0a cmp $0xa,%esi 80100449: 0f 84 fd 00 00 00 je 8010054c <consputc+0x15c> pos += 80 - pos%80; else if(c == BACKSPACE){ 8010044f: 81 fe 00 01 00 00 cmp $0x100,%esi 80100455: 0f 84 e3 00 00 00 je 8010053e <consputc+0x14e> if(pos > 0) --pos; } else crt[pos++] = (c&0xff) | 0x0700; // black on white 8010045b: 66 81 e6 ff 00 and $0xff,%si 80100460: 66 81 ce 00 07 or $0x700,%si 80100465: 66 89 b4 1b 00 80 0b mov %si,-0x7ff48000(%ebx,%ebx,1) 8010046c: 80 8010046d: 83 c3 01 add $0x1,%ebx if(pos < 0 || pos > 25*80) 80100470: 81 fb d0 07 00 00 cmp $0x7d0,%ebx 80100476: 0f 87 b6 00 00 00 ja 80100532 <consputc+0x142> panic("pos under/overflow"); if((pos/80) >= 24){ // Scroll up. 8010047c: 81 fb 7f 07 00 00 cmp $0x77f,%ebx 80100482: 8d b4 1b 00 80 0b 80 lea -0x7ff48000(%ebx,%ebx,1),%esi 80100489: 7f 5d jg 801004e8 <consputc+0xf8> } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 8010048b: b9 d4 03 00 00 mov $0x3d4,%ecx 80100490: b8 0e 00 00 00 mov $0xe,%eax 80100495: 89 ca mov %ecx,%edx 80100497: ee out %al,(%dx) 80100498: bf d5 03 00 00 mov $0x3d5,%edi pos -= 80; memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos)); } outb(CRTPORT, 14); outb(CRTPORT+1, pos>>8); 8010049d: 89 d8 mov %ebx,%eax 8010049f: c1 f8 08 sar $0x8,%eax 801004a2: 89 fa mov %edi,%edx 801004a4: ee out %al,(%dx) 801004a5: b8 0f 00 00 00 mov $0xf,%eax 801004aa: 89 ca mov %ecx,%edx 801004ac: ee out %al,(%dx) 801004ad: 89 d8 mov %ebx,%eax 801004af: 89 fa mov %edi,%edx 801004b1: ee out %al,(%dx) outb(CRTPORT, 15); outb(CRTPORT+1, pos); crt[pos] = ' ' | 0x0700; 801004b2: 66 c7 06 20 07 movw $0x720,(%esi) if(c == BACKSPACE){ uartputc('\b'); uartputc(' '); uartputc('\b'); } else uartputc(c); cgaputc(c); } 801004b7: 83 c4 1c add $0x1c,%esp 801004ba: 5b pop %ebx 801004bb: 5e pop %esi 801004bc: 5f pop %edi 801004bd: 5d pop %ebp 801004be: c3 ret for(;;) ; } if(c == BACKSPACE){ uartputc('\b'); uartputc(' '); uartputc('\b'); 801004bf: c7 04 24 08 00 00 00 movl $0x8,(%esp) 801004c6: e8 c5 53 00 00 call 80105890 <uartputc> 801004cb: c7 04 24 20 00 00 00 movl $0x20,(%esp) 801004d2: e8 b9 53 00 00 call 80105890 <uartputc> 801004d7: c7 04 24 08 00 00 00 movl $0x8,(%esp) 801004de: e8 ad 53 00 00 call 80105890 <uartputc> 801004e3: e9 33 ff ff ff jmp 8010041b <consputc+0x2b> if(pos < 0 || pos > 25*80) panic("pos under/overflow"); if((pos/80) >= 24){ // Scroll up. memmove(crt, crt+80, sizeof(crt[0])*23*80); 801004e8: c7 44 24 08 60 0e 00 movl $0xe60,0x8(%esp) 801004ef: 00 pos -= 80; 801004f0: 8d 7b b0 lea -0x50(%ebx),%edi if(pos < 0 || pos > 25*80) panic("pos under/overflow"); if((pos/80) >= 24){ // Scroll up. memmove(crt, crt+80, sizeof(crt[0])*23*80); 801004f3: c7 44 24 04 a0 80 0b movl $0x800b80a0,0x4(%esp) 801004fa: 80 pos -= 80; memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos)); 801004fb: 8d b4 3f 00 80 0b 80 lea -0x7ff48000(%edi,%edi,1),%esi if(pos < 0 || pos > 25*80) panic("pos under/overflow"); if((pos/80) >= 24){ // Scroll up. memmove(crt, crt+80, sizeof(crt[0])*23*80); 80100502: c7 04 24 00 80 0b 80 movl $0x800b8000,(%esp) 80100509: e8 f2 3e 00 00 call 80104400 <memmove> pos -= 80; memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos)); 8010050e: b8 d0 07 00 00 mov $0x7d0,%eax 80100513: 29 d8 sub %ebx,%eax if(pos < 0 || pos > 25*80) panic("pos under/overflow"); if((pos/80) >= 24){ // Scroll up. memmove(crt, crt+80, sizeof(crt[0])*23*80); pos -= 80; 80100515: 89 fb mov %edi,%ebx memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos)); 80100517: 01 c0 add %eax,%eax 80100519: 89 44 24 08 mov %eax,0x8(%esp) 8010051d: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80100524: 00 80100525: 89 34 24 mov %esi,(%esp) 80100528: e8 13 3e 00 00 call 80104340 <memset> 8010052d: e9 59 ff ff ff jmp 8010048b <consputc+0x9b> if(pos > 0) --pos; } else crt[pos++] = (c&0xff) | 0x0700; // black on white if(pos < 0 || pos > 25*80) panic("pos under/overflow"); 80100532: c7 04 24 85 6d 10 80 movl $0x80106d85,(%esp) 80100539: e8 32 fe ff ff call 80100370 <panic> pos |= inb(CRTPORT+1); if(c == '\n') pos += 80 - pos%80; else if(c == BACKSPACE){ if(pos > 0) --pos; 8010053e: 31 c0 xor %eax,%eax 80100540: 85 db test %ebx,%ebx 80100542: 0f 9f c0 setg %al 80100545: 29 c3 sub %eax,%ebx 80100547: e9 24 ff ff ff jmp 80100470 <consputc+0x80> pos = inb(CRTPORT+1) << 8; outb(CRTPORT, 15); pos |= inb(CRTPORT+1); if(c == '\n') pos += 80 - pos%80; 8010054c: 89 d8 mov %ebx,%eax 8010054e: ba 67 66 66 66 mov $0x66666667,%edx 80100553: f7 ea imul %edx 80100555: c1 ea 05 shr $0x5,%edx 80100558: 8d 04 92 lea (%edx,%edx,4),%eax 8010055b: c1 e0 04 shl $0x4,%eax 8010055e: 8d 58 50 lea 0x50(%eax),%ebx 80100561: e9 0a ff ff ff jmp 80100470 <consputc+0x80> 80100566: 8d 76 00 lea 0x0(%esi),%esi 80100569: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80100570 <consolewrite>: return target - n; } int consolewrite(struct inode *ip, char *buf, int n) { 80100570: 55 push %ebp 80100571: 89 e5 mov %esp,%ebp 80100573: 57 push %edi 80100574: 56 push %esi 80100575: 53 push %ebx 80100576: 83 ec 1c sub $0x1c,%esp int i; iunlock(ip); 80100579: 8b 45 08 mov 0x8(%ebp),%eax return target - n; } int consolewrite(struct inode *ip, char *buf, int n) { 8010057c: 8b 75 10 mov 0x10(%ebp),%esi 8010057f: 8b 7d 0c mov 0xc(%ebp),%edi int i; iunlock(ip); 80100582: 89 04 24 mov %eax,(%esp) 80100585: e8 f6 11 00 00 call 80101780 <iunlock> acquire(&cons.lock); 8010058a: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) 80100591: e8 ea 3c 00 00 call 80104280 <acquire> for(i = 0; i < n; i++) 80100596: 85 f6 test %esi,%esi 80100598: 7e 16 jle 801005b0 <consolewrite+0x40> 8010059a: 31 db xor %ebx,%ebx 8010059c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi consputc(buf[i] & 0xff); 801005a0: 0f b6 04 1f movzbl (%edi,%ebx,1),%eax { int i; iunlock(ip); acquire(&cons.lock); for(i = 0; i < n; i++) 801005a4: 83 c3 01 add $0x1,%ebx consputc(buf[i] & 0xff); 801005a7: e8 44 fe ff ff call 801003f0 <consputc> { int i; iunlock(ip); acquire(&cons.lock); for(i = 0; i < n; i++) 801005ac: 39 f3 cmp %esi,%ebx 801005ae: 75 f0 jne 801005a0 <consolewrite+0x30> consputc(buf[i] & 0xff); release(&cons.lock); 801005b0: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) 801005b7: e8 34 3d 00 00 call 801042f0 <release> ilock(ip); 801005bc: 8b 45 08 mov 0x8(%ebp),%eax 801005bf: 89 04 24 mov %eax,(%esp) 801005c2: e8 d9 10 00 00 call 801016a0 <ilock> return n; } 801005c7: 83 c4 1c add $0x1c,%esp 801005ca: 89 f0 mov %esi,%eax 801005cc: 5b pop %ebx 801005cd: 5e pop %esi 801005ce: 5f pop %edi 801005cf: 5d pop %ebp 801005d0: c3 ret 801005d1: eb 0d jmp 801005e0 <printint> 801005d3: 90 nop 801005d4: 90 nop 801005d5: 90 nop 801005d6: 90 nop 801005d7: 90 nop 801005d8: 90 nop 801005d9: 90 nop 801005da: 90 nop 801005db: 90 nop 801005dc: 90 nop 801005dd: 90 nop 801005de: 90 nop 801005df: 90 nop 801005e0 <printint>: int locking; } cons; static void printint(int xx, int base, int sign) { 801005e0: 55 push %ebp 801005e1: 89 e5 mov %esp,%ebp 801005e3: 56 push %esi 801005e4: 53 push %ebx 801005e5: 89 d3 mov %edx,%ebx 801005e7: 83 ec 10 sub $0x10,%esp static char digits[] = "0123456789abcdef"; char buf[16]; int i; uint x; if(sign && (sign = xx < 0)) 801005ea: 85 c9 test %ecx,%ecx 801005ec: 74 5a je 80100648 <printint+0x68> 801005ee: 85 c0 test %eax,%eax 801005f0: 79 56 jns 80100648 <printint+0x68> x = -xx; 801005f2: f7 d8 neg %eax 801005f4: be 01 00 00 00 mov $0x1,%esi else x = xx; i = 0; 801005f9: 31 c9 xor %ecx,%ecx 801005fb: eb 05 jmp 80100602 <printint+0x22> 801005fd: 8d 76 00 lea 0x0(%esi),%esi do{ buf[i++] = digits[x % base]; 80100600: 89 d1 mov %edx,%ecx 80100602: 31 d2 xor %edx,%edx 80100604: f7 f3 div %ebx 80100606: 0f b6 92 b0 6d 10 80 movzbl -0x7fef9250(%edx),%edx }while((x /= base) != 0); 8010060d: 85 c0 test %eax,%eax else x = xx; i = 0; do{ buf[i++] = digits[x % base]; 8010060f: 88 54 0d e8 mov %dl,-0x18(%ebp,%ecx,1) 80100613: 8d 51 01 lea 0x1(%ecx),%edx }while((x /= base) != 0); 80100616: 75 e8 jne 80100600 <printint+0x20> if(sign) 80100618: 85 f6 test %esi,%esi 8010061a: 74 08 je 80100624 <printint+0x44> buf[i++] = '-'; 8010061c: c6 44 15 e8 2d movb $0x2d,-0x18(%ebp,%edx,1) 80100621: 8d 51 02 lea 0x2(%ecx),%edx while(--i >= 0) 80100624: 8d 5a ff lea -0x1(%edx),%ebx 80100627: 90 nop consputc(buf[i]); 80100628: 0f be 44 1d e8 movsbl -0x18(%ebp,%ebx,1),%eax }while((x /= base) != 0); if(sign) buf[i++] = '-'; while(--i >= 0) 8010062d: 83 eb 01 sub $0x1,%ebx consputc(buf[i]); 80100630: e8 bb fd ff ff call 801003f0 <consputc> }while((x /= base) != 0); if(sign) buf[i++] = '-'; while(--i >= 0) 80100635: 83 fb ff cmp $0xffffffff,%ebx 80100638: 75 ee jne 80100628 <printint+0x48> consputc(buf[i]); } 8010063a: 83 c4 10 add $0x10,%esp 8010063d: 5b pop %ebx 8010063e: 5e pop %esi 8010063f: 5d pop %ebp 80100640: c3 ret 80100641: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi uint x; if(sign && (sign = xx < 0)) x = -xx; else x = xx; 80100648: 31 f6 xor %esi,%esi 8010064a: eb ad jmp 801005f9 <printint+0x19> 8010064c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100650 <cprintf>: //PAGEBREAK: 50 // Print to the console. only understands %d, %x, %p, %s. void cprintf(char *fmt, ...) { 80100650: 55 push %ebp 80100651: 89 e5 mov %esp,%ebp 80100653: 57 push %edi 80100654: 56 push %esi 80100655: 53 push %ebx 80100656: 83 ec 2c sub $0x2c,%esp int i, c, locking; uint *argp; char *s; locking = cons.locking; 80100659: 8b 3d 54 a5 10 80 mov 0x8010a554,%edi if(locking) 8010065f: 85 ff test %edi,%edi 80100661: 0f 85 39 01 00 00 jne 801007a0 <cprintf+0x150> acquire(&cons.lock); if (fmt == 0) 80100667: 8b 4d 08 mov 0x8(%ebp),%ecx 8010066a: 85 c9 test %ecx,%ecx 8010066c: 0f 84 3f 01 00 00 je 801007b1 <cprintf+0x161> panic("null fmt"); argp = (uint*)(void*)(&fmt + 1); for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ 80100672: 0f b6 01 movzbl (%ecx),%eax 80100675: 31 db xor %ebx,%ebx 80100677: 8d 75 0c lea 0xc(%ebp),%esi 8010067a: 85 c0 test %eax,%eax 8010067c: 0f 84 89 00 00 00 je 8010070b <cprintf+0xbb> 80100682: 89 7d e4 mov %edi,-0x1c(%ebp) 80100685: eb 3c jmp 801006c3 <cprintf+0x73> 80100687: 90 nop continue; } c = fmt[++i] & 0xff; if(c == 0) break; switch(c){ 80100688: 83 fa 25 cmp $0x25,%edx 8010068b: 0f 84 f7 00 00 00 je 80100788 <cprintf+0x138> 80100691: 83 fa 64 cmp $0x64,%edx 80100694: 0f 84 ce 00 00 00 je 80100768 <cprintf+0x118> case '%': consputc('%'); break; default: // Print unknown % sequence to draw attention. consputc('%'); 8010069a: b8 25 00 00 00 mov $0x25,%eax 8010069f: 89 55 e0 mov %edx,-0x20(%ebp) 801006a2: e8 49 fd ff ff call 801003f0 <consputc> consputc(c); 801006a7: 8b 55 e0 mov -0x20(%ebp),%edx 801006aa: 89 d0 mov %edx,%eax 801006ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801006b0: e8 3b fd ff ff call 801003f0 <consputc> 801006b5: 8b 4d 08 mov 0x8(%ebp),%ecx if (fmt == 0) panic("null fmt"); argp = (uint*)(void*)(&fmt + 1); for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ 801006b8: 83 c3 01 add $0x1,%ebx 801006bb: 0f b6 04 19 movzbl (%ecx,%ebx,1),%eax 801006bf: 85 c0 test %eax,%eax 801006c1: 74 45 je 80100708 <cprintf+0xb8> if(c != '%'){ 801006c3: 83 f8 25 cmp $0x25,%eax 801006c6: 75 e8 jne 801006b0 <cprintf+0x60> consputc(c); continue; } c = fmt[++i] & 0xff; 801006c8: 83 c3 01 add $0x1,%ebx 801006cb: 0f b6 14 19 movzbl (%ecx,%ebx,1),%edx if(c == 0) 801006cf: 85 d2 test %edx,%edx 801006d1: 74 35 je 80100708 <cprintf+0xb8> break; switch(c){ 801006d3: 83 fa 70 cmp $0x70,%edx 801006d6: 74 0f je 801006e7 <cprintf+0x97> 801006d8: 7e ae jle 80100688 <cprintf+0x38> 801006da: 83 fa 73 cmp $0x73,%edx 801006dd: 8d 76 00 lea 0x0(%esi),%esi 801006e0: 74 46 je 80100728 <cprintf+0xd8> 801006e2: 83 fa 78 cmp $0x78,%edx 801006e5: 75 b3 jne 8010069a <cprintf+0x4a> case 'd': printint(*argp++, 10, 1); break; case 'x': case 'p': printint(*argp++, 16, 0); 801006e7: 8b 06 mov (%esi),%eax 801006e9: 31 c9 xor %ecx,%ecx 801006eb: ba 10 00 00 00 mov $0x10,%edx if (fmt == 0) panic("null fmt"); argp = (uint*)(void*)(&fmt + 1); for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ 801006f0: 83 c3 01 add $0x1,%ebx case 'd': printint(*argp++, 10, 1); break; case 'x': case 'p': printint(*argp++, 16, 0); 801006f3: 83 c6 04 add $0x4,%esi 801006f6: e8 e5 fe ff ff call 801005e0 <printint> 801006fb: 8b 4d 08 mov 0x8(%ebp),%ecx if (fmt == 0) panic("null fmt"); argp = (uint*)(void*)(&fmt + 1); for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ 801006fe: 0f b6 04 19 movzbl (%ecx,%ebx,1),%eax 80100702: 85 c0 test %eax,%eax 80100704: 75 bd jne 801006c3 <cprintf+0x73> 80100706: 66 90 xchg %ax,%ax 80100708: 8b 7d e4 mov -0x1c(%ebp),%edi consputc(c); break; } } if(locking) 8010070b: 85 ff test %edi,%edi 8010070d: 74 0c je 8010071b <cprintf+0xcb> release(&cons.lock); 8010070f: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) 80100716: e8 d5 3b 00 00 call 801042f0 <release> } 8010071b: 83 c4 2c add $0x2c,%esp 8010071e: 5b pop %ebx 8010071f: 5e pop %esi 80100720: 5f pop %edi 80100721: 5d pop %ebp 80100722: c3 ret 80100723: 90 nop 80100724: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi case 'x': case 'p': printint(*argp++, 16, 0); break; case 's': if((s = (char*)*argp++) == 0) 80100728: 8b 16 mov (%esi),%edx s = "(null)"; 8010072a: b8 98 6d 10 80 mov $0x80106d98,%eax case 'x': case 'p': printint(*argp++, 16, 0); break; case 's': if((s = (char*)*argp++) == 0) 8010072f: 83 c6 04 add $0x4,%esi s = "(null)"; 80100732: 85 d2 test %edx,%edx 80100734: 0f 44 d0 cmove %eax,%edx for(; *s; s++) 80100737: 0f b6 02 movzbl (%edx),%eax 8010073a: 84 c0 test %al,%al 8010073c: 0f 84 76 ff ff ff je 801006b8 <cprintf+0x68> 80100742: 89 f7 mov %esi,%edi 80100744: 89 de mov %ebx,%esi 80100746: 89 d3 mov %edx,%ebx consputc(*s); 80100748: 0f be c0 movsbl %al,%eax printint(*argp++, 16, 0); break; case 's': if((s = (char*)*argp++) == 0) s = "(null)"; for(; *s; s++) 8010074b: 83 c3 01 add $0x1,%ebx consputc(*s); 8010074e: e8 9d fc ff ff call 801003f0 <consputc> printint(*argp++, 16, 0); break; case 's': if((s = (char*)*argp++) == 0) s = "(null)"; for(; *s; s++) 80100753: 0f b6 03 movzbl (%ebx),%eax 80100756: 84 c0 test %al,%al 80100758: 75 ee jne 80100748 <cprintf+0xf8> 8010075a: 89 f3 mov %esi,%ebx 8010075c: 8b 4d 08 mov 0x8(%ebp),%ecx 8010075f: 89 fe mov %edi,%esi 80100761: e9 52 ff ff ff jmp 801006b8 <cprintf+0x68> 80100766: 66 90 xchg %ax,%ax c = fmt[++i] & 0xff; if(c == 0) break; switch(c){ case 'd': printint(*argp++, 10, 1); 80100768: 8b 06 mov (%esi),%eax 8010076a: b9 01 00 00 00 mov $0x1,%ecx 8010076f: ba 0a 00 00 00 mov $0xa,%edx 80100774: 83 c6 04 add $0x4,%esi 80100777: e8 64 fe ff ff call 801005e0 <printint> 8010077c: 8b 4d 08 mov 0x8(%ebp),%ecx break; 8010077f: e9 34 ff ff ff jmp 801006b8 <cprintf+0x68> 80100784: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi s = "(null)"; for(; *s; s++) consputc(*s); break; case '%': consputc('%'); 80100788: b8 25 00 00 00 mov $0x25,%eax 8010078d: e8 5e fc ff ff call 801003f0 <consputc> 80100792: 8b 4d 08 mov 0x8(%ebp),%ecx break; 80100795: e9 1e ff ff ff jmp 801006b8 <cprintf+0x68> 8010079a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi uint *argp; char *s; locking = cons.locking; if(locking) acquire(&cons.lock); 801007a0: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) 801007a7: e8 d4 3a 00 00 call 80104280 <acquire> 801007ac: e9 b6 fe ff ff jmp 80100667 <cprintf+0x17> if (fmt == 0) panic("null fmt"); 801007b1: c7 04 24 9f 6d 10 80 movl $0x80106d9f,(%esp) 801007b8: e8 b3 fb ff ff call 80100370 <panic> 801007bd: 8d 76 00 lea 0x0(%esi),%esi 801007c0 <consoleintr>: #define C(x) ((x)-'@') // Control-x void consoleintr(int (*getc)(void)) { 801007c0: 55 push %ebp 801007c1: 89 e5 mov %esp,%ebp 801007c3: 57 push %edi int c, doprocdump = 0; 801007c4: 31 ff xor %edi,%edi #define C(x) ((x)-'@') // Control-x void consoleintr(int (*getc)(void)) { 801007c6: 56 push %esi 801007c7: 53 push %ebx 801007c8: 83 ec 1c sub $0x1c,%esp 801007cb: 8b 75 08 mov 0x8(%ebp),%esi int c, doprocdump = 0; acquire(&cons.lock); 801007ce: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) 801007d5: e8 a6 3a 00 00 call 80104280 <acquire> 801007da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi while((c = getc()) >= 0){ 801007e0: ff d6 call *%esi 801007e2: 85 c0 test %eax,%eax 801007e4: 89 c3 mov %eax,%ebx 801007e6: 0f 88 8c 00 00 00 js 80100878 <consoleintr+0xb8> switch(c){ 801007ec: 83 fb 10 cmp $0x10,%ebx 801007ef: 90 nop 801007f0: 0f 84 da 00 00 00 je 801008d0 <consoleintr+0x110> 801007f6: 0f 8f 9c 00 00 00 jg 80100898 <consoleintr+0xd8> 801007fc: 83 fb 08 cmp $0x8,%ebx 801007ff: 90 nop 80100800: 0f 84 a0 00 00 00 je 801008a6 <consoleintr+0xe6> input.e--; consputc(BACKSPACE); } break; default: if(c != 0 && input.e-input.r < INPUT_BUF){ 80100806: 85 db test %ebx,%ebx 80100808: 74 d6 je 801007e0 <consoleintr+0x20> 8010080a: a1 a8 ff 10 80 mov 0x8010ffa8,%eax 8010080f: 89 c2 mov %eax,%edx 80100811: 2b 15 a0 ff 10 80 sub 0x8010ffa0,%edx 80100817: 83 fa 7f cmp $0x7f,%edx 8010081a: 77 c4 ja 801007e0 <consoleintr+0x20> c = (c == '\r') ? '\n' : c; input.buf[input.e++ % INPUT_BUF] = c; 8010081c: 89 c2 mov %eax,%edx 8010081e: 83 e2 7f and $0x7f,%edx consputc(BACKSPACE); } break; default: if(c != 0 && input.e-input.r < INPUT_BUF){ c = (c == '\r') ? '\n' : c; 80100821: 83 fb 0d cmp $0xd,%ebx 80100824: 0f 84 12 01 00 00 je 8010093c <consoleintr+0x17c> input.buf[input.e++ % INPUT_BUF] = c; 8010082a: 83 c0 01 add $0x1,%eax 8010082d: 88 9a 20 ff 10 80 mov %bl,-0x7fef00e0(%edx) 80100833: a3 a8 ff 10 80 mov %eax,0x8010ffa8 consputc(c); 80100838: 89 d8 mov %ebx,%eax 8010083a: e8 b1 fb ff ff call 801003f0 <consputc> if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){ 8010083f: 83 fb 04 cmp $0x4,%ebx 80100842: a1 a8 ff 10 80 mov 0x8010ffa8,%eax 80100847: 74 12 je 8010085b <consoleintr+0x9b> 80100849: 83 fb 0a cmp $0xa,%ebx 8010084c: 74 0d je 8010085b <consoleintr+0x9b> 8010084e: 8b 15 a0 ff 10 80 mov 0x8010ffa0,%edx 80100854: 83 ea 80 sub $0xffffff80,%edx 80100857: 39 d0 cmp %edx,%eax 80100859: 75 85 jne 801007e0 <consoleintr+0x20> input.w = input.e; 8010085b: a3 a4 ff 10 80 mov %eax,0x8010ffa4 wakeup(&input.r); 80100860: c7 04 24 a0 ff 10 80 movl $0x8010ffa0,(%esp) 80100867: e8 c4 35 00 00 call 80103e30 <wakeup> consoleintr(int (*getc)(void)) { int c, doprocdump = 0; acquire(&cons.lock); while((c = getc()) >= 0){ 8010086c: ff d6 call *%esi 8010086e: 85 c0 test %eax,%eax 80100870: 89 c3 mov %eax,%ebx 80100872: 0f 89 74 ff ff ff jns 801007ec <consoleintr+0x2c> } } break; } } release(&cons.lock); 80100878: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) 8010087f: e8 6c 3a 00 00 call 801042f0 <release> if(doprocdump) { 80100884: 85 ff test %edi,%edi 80100886: 0f 85 a4 00 00 00 jne 80100930 <consoleintr+0x170> procdump(); // now call procdump() wo. cons.lock held } } 8010088c: 83 c4 1c add $0x1c,%esp 8010088f: 5b pop %ebx 80100890: 5e pop %esi 80100891: 5f pop %edi 80100892: 5d pop %ebp 80100893: c3 ret 80100894: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi { int c, doprocdump = 0; acquire(&cons.lock); while((c = getc()) >= 0){ switch(c){ 80100898: 83 fb 15 cmp $0x15,%ebx 8010089b: 74 43 je 801008e0 <consoleintr+0x120> 8010089d: 83 fb 7f cmp $0x7f,%ebx 801008a0: 0f 85 60 ff ff ff jne 80100806 <consoleintr+0x46> input.e--; consputc(BACKSPACE); } break; case C('H'): case '\x7f': // Backspace if(input.e != input.w){ 801008a6: a1 a8 ff 10 80 mov 0x8010ffa8,%eax 801008ab: 3b 05 a4 ff 10 80 cmp 0x8010ffa4,%eax 801008b1: 0f 84 29 ff ff ff je 801007e0 <consoleintr+0x20> input.e--; 801008b7: 83 e8 01 sub $0x1,%eax 801008ba: a3 a8 ff 10 80 mov %eax,0x8010ffa8 consputc(BACKSPACE); 801008bf: b8 00 01 00 00 mov $0x100,%eax 801008c4: e8 27 fb ff ff call 801003f0 <consputc> 801008c9: e9 12 ff ff ff jmp 801007e0 <consoleintr+0x20> 801008ce: 66 90 xchg %ax,%ax acquire(&cons.lock); while((c = getc()) >= 0){ switch(c){ case C('P'): // Process listing. // procdump() locks cons.lock indirectly; invoke later doprocdump = 1; 801008d0: bf 01 00 00 00 mov $0x1,%edi 801008d5: e9 06 ff ff ff jmp 801007e0 <consoleintr+0x20> 801008da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi break; case C('U'): // Kill line. while(input.e != input.w && 801008e0: a1 a8 ff 10 80 mov 0x8010ffa8,%eax 801008e5: 3b 05 a4 ff 10 80 cmp 0x8010ffa4,%eax 801008eb: 75 2b jne 80100918 <consoleintr+0x158> 801008ed: e9 ee fe ff ff jmp 801007e0 <consoleintr+0x20> 801008f2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi input.buf[(input.e-1) % INPUT_BUF] != '\n'){ input.e--; 801008f8: a3 a8 ff 10 80 mov %eax,0x8010ffa8 consputc(BACKSPACE); 801008fd: b8 00 01 00 00 mov $0x100,%eax 80100902: e8 e9 fa ff ff call 801003f0 <consputc> case C('P'): // Process listing. // procdump() locks cons.lock indirectly; invoke later doprocdump = 1; break; case C('U'): // Kill line. while(input.e != input.w && 80100907: a1 a8 ff 10 80 mov 0x8010ffa8,%eax 8010090c: 3b 05 a4 ff 10 80 cmp 0x8010ffa4,%eax 80100912: 0f 84 c8 fe ff ff je 801007e0 <consoleintr+0x20> input.buf[(input.e-1) % INPUT_BUF] != '\n'){ 80100918: 83 e8 01 sub $0x1,%eax 8010091b: 89 c2 mov %eax,%edx 8010091d: 83 e2 7f and $0x7f,%edx case C('P'): // Process listing. // procdump() locks cons.lock indirectly; invoke later doprocdump = 1; break; case C('U'): // Kill line. while(input.e != input.w && 80100920: 80 ba 20 ff 10 80 0a cmpb $0xa,-0x7fef00e0(%edx) 80100927: 75 cf jne 801008f8 <consoleintr+0x138> 80100929: e9 b2 fe ff ff jmp 801007e0 <consoleintr+0x20> 8010092e: 66 90 xchg %ax,%ax } release(&cons.lock); if(doprocdump) { procdump(); // now call procdump() wo. cons.lock held } } 80100930: 83 c4 1c add $0x1c,%esp 80100933: 5b pop %ebx 80100934: 5e pop %esi 80100935: 5f pop %edi 80100936: 5d pop %ebp break; } } release(&cons.lock); if(doprocdump) { procdump(); // now call procdump() wo. cons.lock held 80100937: e9 d4 35 00 00 jmp 80103f10 <procdump> } break; default: if(c != 0 && input.e-input.r < INPUT_BUF){ c = (c == '\r') ? '\n' : c; input.buf[input.e++ % INPUT_BUF] = c; 8010093c: 83 c0 01 add $0x1,%eax 8010093f: c6 82 20 ff 10 80 0a movb $0xa,-0x7fef00e0(%edx) 80100946: a3 a8 ff 10 80 mov %eax,0x8010ffa8 consputc(c); 8010094b: b8 0a 00 00 00 mov $0xa,%eax 80100950: e8 9b fa ff ff call 801003f0 <consputc> 80100955: a1 a8 ff 10 80 mov 0x8010ffa8,%eax 8010095a: e9 fc fe ff ff jmp 8010085b <consoleintr+0x9b> 8010095f: 90 nop 80100960 <consoleinit>: return n; } void consoleinit(void) { 80100960: 55 push %ebp 80100961: 89 e5 mov %esp,%ebp 80100963: 83 ec 18 sub $0x18,%esp initlock(&cons.lock, "console"); 80100966: c7 44 24 04 a8 6d 10 movl $0x80106da8,0x4(%esp) 8010096d: 80 8010096e: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) 80100975: e8 96 37 00 00 call 80104110 <initlock> devsw[CONSOLE].write = consolewrite; devsw[CONSOLE].read = consoleread; cons.locking = 1; ioapicenable(IRQ_KBD, 0); 8010097a: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80100981: 00 80100982: c7 04 24 01 00 00 00 movl $0x1,(%esp) void consoleinit(void) { initlock(&cons.lock, "console"); devsw[CONSOLE].write = consolewrite; 80100989: c7 05 6c 09 11 80 70 movl $0x80100570,0x8011096c 80100990: 05 10 80 devsw[CONSOLE].read = consoleread; 80100993: c7 05 68 09 11 80 70 movl $0x80100270,0x80110968 8010099a: 02 10 80 cons.locking = 1; 8010099d: c7 05 54 a5 10 80 01 movl $0x1,0x8010a554 801009a4: 00 00 00 ioapicenable(IRQ_KBD, 0); 801009a7: e8 54 19 00 00 call 80102300 <ioapicenable> } 801009ac: c9 leave 801009ad: c3 ret ... 801009b0 <exec>: #include "x86.h" #include "elf.h" int exec(char *path, char **argv) { 801009b0: 55 push %ebp 801009b1: 89 e5 mov %esp,%ebp 801009b3: 81 ec 38 01 00 00 sub $0x138,%esp 801009b9: 89 5d f4 mov %ebx,-0xc(%ebp) 801009bc: 89 75 f8 mov %esi,-0x8(%ebp) 801009bf: 89 7d fc mov %edi,-0x4(%ebp) uint argc, sz, sp, ustack[3+MAXARG+1]; struct elfhdr elf; struct inode *ip; struct proghdr ph; pde_t *pgdir, *oldpgdir; struct proc *curproc = myproc(); 801009c2: e8 69 2d 00 00 call 80103730 <myproc> 801009c7: 89 85 f4 fe ff ff mov %eax,-0x10c(%ebp) begin_op(); 801009cd: e8 9e 21 00 00 call 80102b70 <begin_op> if((ip = namei(path)) == 0){ 801009d2: 8b 55 08 mov 0x8(%ebp),%edx 801009d5: 89 14 24 mov %edx,(%esp) 801009d8: e8 93 15 00 00 call 80101f70 <namei> 801009dd: 85 c0 test %eax,%eax 801009df: 89 c3 mov %eax,%ebx 801009e1: 0f 84 42 02 00 00 je 80100c29 <exec+0x279> end_op(); cprintf("exec: fail\n"); return -1; } ilock(ip); 801009e7: 89 04 24 mov %eax,(%esp) 801009ea: e8 b1 0c 00 00 call 801016a0 <ilock> pgdir = 0; // Check ELF header if(readi(ip, (char*)&elf, 0, sizeof(elf)) != sizeof(elf)) 801009ef: 8d 45 94 lea -0x6c(%ebp),%eax 801009f2: c7 44 24 0c 34 00 00 movl $0x34,0xc(%esp) 801009f9: 00 801009fa: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 80100a01: 00 80100a02: 89 44 24 04 mov %eax,0x4(%esp) 80100a06: 89 1c 24 mov %ebx,(%esp) 80100a09: e8 72 0f 00 00 call 80101980 <readi> 80100a0e: 83 f8 34 cmp $0x34,%eax 80100a11: 74 25 je 80100a38 <exec+0x88> bad: if(pgdir) freevm(pgdir); if(ip){ iunlockput(ip); 80100a13: 89 1c 24 mov %ebx,(%esp) 80100a16: e8 15 0f 00 00 call 80101930 <iunlockput> end_op(); 80100a1b: e8 c0 21 00 00 call 80102be0 <end_op> } return -1; 80100a20: b8 ff ff ff ff mov $0xffffffff,%eax } 80100a25: 8b 5d f4 mov -0xc(%ebp),%ebx 80100a28: 8b 75 f8 mov -0x8(%ebp),%esi 80100a2b: 8b 7d fc mov -0x4(%ebp),%edi 80100a2e: 89 ec mov %ebp,%esp 80100a30: 5d pop %ebp 80100a31: c3 ret 80100a32: 8d b6 00 00 00 00 lea 0x0(%esi),%esi pgdir = 0; // Check ELF header if(readi(ip, (char*)&elf, 0, sizeof(elf)) != sizeof(elf)) goto bad; if(elf.magic != ELF_MAGIC) 80100a38: 81 7d 94 7f 45 4c 46 cmpl $0x464c457f,-0x6c(%ebp) 80100a3f: 75 d2 jne 80100a13 <exec+0x63> goto bad; if((pgdir = setupkvm()) == 0) 80100a41: e8 7a 60 00 00 call 80106ac0 <setupkvm> 80100a46: 85 c0 test %eax,%eax 80100a48: 89 85 ec fe ff ff mov %eax,-0x114(%ebp) 80100a4e: 74 c3 je 80100a13 <exec+0x63> goto bad; // Load program into memory. sz = 0; for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){ 80100a50: 66 83 7d c0 00 cmpw $0x0,-0x40(%ebp) 80100a55: 8b 75 b0 mov -0x50(%ebp),%esi if((pgdir = setupkvm()) == 0) goto bad; // Load program into memory. sz = 0; 80100a58: c7 85 f0 fe ff ff 00 movl $0x0,-0x110(%ebp) 80100a5f: 00 00 00 for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){ 80100a62: 0f 84 cb 00 00 00 je 80100b33 <exec+0x183> 80100a68: 31 ff xor %edi,%edi 80100a6a: eb 16 jmp 80100a82 <exec+0xd2> 80100a6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100a70: 0f b7 45 c0 movzwl -0x40(%ebp),%eax 80100a74: 83 c7 01 add $0x1,%edi #include "defs.h" #include "x86.h" #include "elf.h" int exec(char *path, char **argv) 80100a77: 83 c6 20 add $0x20,%esi if((pgdir = setupkvm()) == 0) goto bad; // Load program into memory. sz = 0; for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){ 80100a7a: 39 f8 cmp %edi,%eax 80100a7c: 0f 8e b1 00 00 00 jle 80100b33 <exec+0x183> if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph)) 80100a82: 8d 4d c8 lea -0x38(%ebp),%ecx 80100a85: c7 44 24 0c 20 00 00 movl $0x20,0xc(%esp) 80100a8c: 00 80100a8d: 89 74 24 08 mov %esi,0x8(%esp) 80100a91: 89 4c 24 04 mov %ecx,0x4(%esp) 80100a95: 89 1c 24 mov %ebx,(%esp) 80100a98: e8 e3 0e 00 00 call 80101980 <readi> 80100a9d: 83 f8 20 cmp $0x20,%eax 80100aa0: 75 76 jne 80100b18 <exec+0x168> goto bad; if(ph.type != ELF_PROG_LOAD) 80100aa2: 83 7d c8 01 cmpl $0x1,-0x38(%ebp) 80100aa6: 75 c8 jne 80100a70 <exec+0xc0> continue; if(ph.memsz < ph.filesz) 80100aa8: 8b 45 dc mov -0x24(%ebp),%eax 80100aab: 3b 45 d8 cmp -0x28(%ebp),%eax 80100aae: 72 68 jb 80100b18 <exec+0x168> goto bad; if(ph.vaddr + ph.memsz < ph.vaddr) 80100ab0: 03 45 d0 add -0x30(%ebp),%eax 80100ab3: 72 63 jb 80100b18 <exec+0x168> goto bad; if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0) 80100ab5: 89 44 24 08 mov %eax,0x8(%esp) 80100ab9: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax 80100abf: 89 44 24 04 mov %eax,0x4(%esp) 80100ac3: 8b 85 ec fe ff ff mov -0x114(%ebp),%eax 80100ac9: 89 04 24 mov %eax,(%esp) 80100acc: e8 3f 5e 00 00 call 80106910 <allocuvm> 80100ad1: 85 c0 test %eax,%eax 80100ad3: 89 85 f0 fe ff ff mov %eax,-0x110(%ebp) 80100ad9: 74 3d je 80100b18 <exec+0x168> goto bad; if(ph.vaddr % PGSIZE != 0) 80100adb: 8b 45 d0 mov -0x30(%ebp),%eax 80100ade: a9 ff 0f 00 00 test $0xfff,%eax 80100ae3: 75 33 jne 80100b18 <exec+0x168> goto bad; if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0) 80100ae5: 8b 55 d8 mov -0x28(%ebp),%edx 80100ae8: 89 44 24 04 mov %eax,0x4(%esp) 80100aec: 8b 85 ec fe ff ff mov -0x114(%ebp),%eax 80100af2: 89 5c 24 08 mov %ebx,0x8(%esp) 80100af6: 89 54 24 10 mov %edx,0x10(%esp) 80100afa: 8b 55 cc mov -0x34(%ebp),%edx 80100afd: 89 04 24 mov %eax,(%esp) 80100b00: 89 54 24 0c mov %edx,0xc(%esp) 80100b04: e8 a7 5c 00 00 call 801067b0 <loaduvm> 80100b09: 85 c0 test %eax,%eax 80100b0b: 0f 89 5f ff ff ff jns 80100a70 <exec+0xc0> 80100b11: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi freevm(oldpgdir); return 0; bad: if(pgdir) freevm(pgdir); 80100b18: 8b 85 ec fe ff ff mov -0x114(%ebp),%eax 80100b1e: 89 04 24 mov %eax,(%esp) 80100b21: e8 1a 5f 00 00 call 80106a40 <freevm> if(ip){ 80100b26: 85 db test %ebx,%ebx 80100b28: 0f 85 e5 fe ff ff jne 80100a13 <exec+0x63> 80100b2e: e9 ed fe ff ff jmp 80100a20 <exec+0x70> if(ph.vaddr % PGSIZE != 0) goto bad; if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0) goto bad; } iunlockput(ip); 80100b33: 89 1c 24 mov %ebx,(%esp) end_op(); ip = 0; 80100b36: 31 db xor %ebx,%ebx if(ph.vaddr % PGSIZE != 0) goto bad; if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0) goto bad; } iunlockput(ip); 80100b38: e8 f3 0d 00 00 call 80101930 <iunlockput> end_op(); 80100b3d: e8 9e 20 00 00 call 80102be0 <end_op> ip = 0; // Allocate two pages at the next page boundary. // Make the first inaccessible. Use the second as the user stack. sz = PGROUNDUP(sz); 80100b42: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax 80100b48: 05 ff 0f 00 00 add $0xfff,%eax 80100b4d: 25 00 f0 ff ff and $0xfffff000,%eax if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0) 80100b52: 8d 90 00 20 00 00 lea 0x2000(%eax),%edx 80100b58: 89 44 24 04 mov %eax,0x4(%esp) 80100b5c: 8b 85 ec fe ff ff mov -0x114(%ebp),%eax 80100b62: 89 54 24 08 mov %edx,0x8(%esp) 80100b66: 89 04 24 mov %eax,(%esp) 80100b69: e8 a2 5d 00 00 call 80106910 <allocuvm> 80100b6e: 85 c0 test %eax,%eax 80100b70: 89 85 f0 fe ff ff mov %eax,-0x110(%ebp) 80100b76: 74 a0 je 80100b18 <exec+0x168> goto bad; clearpteu(pgdir, (char*)(sz - 2*PGSIZE)); 80100b78: 2d 00 20 00 00 sub $0x2000,%eax 80100b7d: 89 44 24 04 mov %eax,0x4(%esp) 80100b81: 8b 85 ec fe ff ff mov -0x114(%ebp),%eax 80100b87: 89 04 24 mov %eax,(%esp) 80100b8a: e8 d1 5f 00 00 call 80106b60 <clearpteu> sp = sz; // Push argument strings, prepare rest of stack in ustack. for(argc = 0; argv[argc]; argc++) { 80100b8f: 8b 55 0c mov 0xc(%ebp),%edx 80100b92: 8b 02 mov (%edx),%eax 80100b94: 85 c0 test %eax,%eax 80100b96: 0f 84 af 00 00 00 je 80100c4b <exec+0x29b> #include "defs.h" #include "x86.h" #include "elf.h" int exec(char *path, char **argv) 80100b9c: 89 d7 mov %edx,%edi 80100b9e: 8b 9d f0 fe ff ff mov -0x110(%ebp),%ebx goto bad; clearpteu(pgdir, (char*)(sz - 2*PGSIZE)); sp = sz; // Push argument strings, prepare rest of stack in ustack. for(argc = 0; argv[argc]; argc++) { 80100ba4: 31 f6 xor %esi,%esi #include "defs.h" #include "x86.h" #include "elf.h" int exec(char *path, char **argv) 80100ba6: 83 c7 04 add $0x4,%edi 80100ba9: 89 d1 mov %edx,%ecx 80100bab: eb 27 jmp 80100bd4 <exec+0x224> 80100bad: 8d 76 00 lea 0x0(%esi),%esi goto bad; clearpteu(pgdir, (char*)(sz - 2*PGSIZE)); sp = sz; // Push argument strings, prepare rest of stack in ustack. for(argc = 0; argv[argc]; argc++) { 80100bb0: 8b 07 mov (%edi),%eax if(argc >= MAXARG) goto bad; sp = (sp - (strlen(argv[argc]) + 1)) & ~3; if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) goto bad; ustack[3+argc] = sp; 80100bb2: 8d 95 04 ff ff ff lea -0xfc(%ebp),%edx goto bad; clearpteu(pgdir, (char*)(sz - 2*PGSIZE)); sp = sz; // Push argument strings, prepare rest of stack in ustack. for(argc = 0; argv[argc]; argc++) { 80100bb8: 89 f9 mov %edi,%ecx if(argc >= MAXARG) goto bad; sp = (sp - (strlen(argv[argc]) + 1)) & ~3; if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) goto bad; ustack[3+argc] = sp; 80100bba: 89 9c b5 10 ff ff ff mov %ebx,-0xf0(%ebp,%esi,4) goto bad; clearpteu(pgdir, (char*)(sz - 2*PGSIZE)); sp = sz; // Push argument strings, prepare rest of stack in ustack. for(argc = 0; argv[argc]; argc++) { 80100bc1: 83 c6 01 add $0x1,%esi 80100bc4: 85 c0 test %eax,%eax 80100bc6: 0f 84 8d 00 00 00 je 80100c59 <exec+0x2a9> 80100bcc: 83 c7 04 add $0x4,%edi if(argc >= MAXARG) 80100bcf: 83 fe 20 cmp $0x20,%esi 80100bd2: 74 4e je 80100c22 <exec+0x272> goto bad; sp = (sp - (strlen(argv[argc]) + 1)) & ~3; 80100bd4: 89 8d e8 fe ff ff mov %ecx,-0x118(%ebp) 80100bda: 89 04 24 mov %eax,(%esp) 80100bdd: e8 8e 39 00 00 call 80104570 <strlen> if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) 80100be2: 8b 8d e8 fe ff ff mov -0x118(%ebp),%ecx // Push argument strings, prepare rest of stack in ustack. for(argc = 0; argv[argc]; argc++) { if(argc >= MAXARG) goto bad; sp = (sp - (strlen(argv[argc]) + 1)) & ~3; 80100be8: f7 d0 not %eax 80100bea: 01 c3 add %eax,%ebx if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) 80100bec: 8b 01 mov (%ecx),%eax // Push argument strings, prepare rest of stack in ustack. for(argc = 0; argv[argc]; argc++) { if(argc >= MAXARG) goto bad; sp = (sp - (strlen(argv[argc]) + 1)) & ~3; 80100bee: 83 e3 fc and $0xfffffffc,%ebx if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) 80100bf1: 89 04 24 mov %eax,(%esp) 80100bf4: e8 77 39 00 00 call 80104570 <strlen> 80100bf9: 8b 8d e8 fe ff ff mov -0x118(%ebp),%ecx 80100bff: 83 c0 01 add $0x1,%eax 80100c02: 89 44 24 0c mov %eax,0xc(%esp) 80100c06: 8b 01 mov (%ecx),%eax 80100c08: 89 5c 24 04 mov %ebx,0x4(%esp) 80100c0c: 89 44 24 08 mov %eax,0x8(%esp) 80100c10: 8b 85 ec fe ff ff mov -0x114(%ebp),%eax 80100c16: 89 04 24 mov %eax,(%esp) 80100c19: e8 82 60 00 00 call 80106ca0 <copyout> 80100c1e: 85 c0 test %eax,%eax 80100c20: 79 8e jns 80100bb0 <exec+0x200> if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0) goto bad; } iunlockput(ip); end_op(); ip = 0; 80100c22: 31 db xor %ebx,%ebx 80100c24: e9 ef fe ff ff jmp 80100b18 <exec+0x168> 80100c29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi struct proc *curproc = myproc(); begin_op(); if((ip = namei(path)) == 0){ end_op(); 80100c30: e8 ab 1f 00 00 call 80102be0 <end_op> cprintf("exec: fail\n"); 80100c35: c7 04 24 c1 6d 10 80 movl $0x80106dc1,(%esp) 80100c3c: e8 0f fa ff ff call 80100650 <cprintf> return -1; 80100c41: b8 ff ff ff ff mov $0xffffffff,%eax 80100c46: e9 da fd ff ff jmp 80100a25 <exec+0x75> goto bad; clearpteu(pgdir, (char*)(sz - 2*PGSIZE)); sp = sz; // Push argument strings, prepare rest of stack in ustack. for(argc = 0; argv[argc]; argc++) { 80100c4b: 8b 9d f0 fe ff ff mov -0x110(%ebp),%ebx 80100c51: 31 f6 xor %esi,%esi 80100c53: 8d 95 04 ff ff ff lea -0xfc(%ebp),%edx } ustack[3+argc] = 0; ustack[0] = 0xffffffff; // fake return PC ustack[1] = argc; ustack[2] = sp - (argc+1)*4; // argv pointer 80100c59: 8d 04 b5 04 00 00 00 lea 0x4(,%esi,4),%eax 80100c60: 89 d9 mov %ebx,%ecx 80100c62: 29 c1 sub %eax,%ecx sp -= (3+argc+1) * 4; 80100c64: 8d 04 b5 10 00 00 00 lea 0x10(,%esi,4),%eax 80100c6b: 29 c3 sub %eax,%ebx if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0) 80100c6d: 89 44 24 0c mov %eax,0xc(%esp) 80100c71: 8b 85 ec fe ff ff mov -0x114(%ebp),%eax sp = (sp - (strlen(argv[argc]) + 1)) & ~3; if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) goto bad; ustack[3+argc] = sp; } ustack[3+argc] = 0; 80100c77: c7 84 b5 10 ff ff ff movl $0x0,-0xf0(%ebp,%esi,4) 80100c7e: 00 00 00 00 ustack[0] = 0xffffffff; // fake return PC ustack[1] = argc; ustack[2] = sp - (argc+1)*4; // argv pointer sp -= (3+argc+1) * 4; if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0) 80100c82: 89 54 24 08 mov %edx,0x8(%esp) goto bad; ustack[3+argc] = sp; } ustack[3+argc] = 0; ustack[0] = 0xffffffff; // fake return PC 80100c86: c7 85 04 ff ff ff ff movl $0xffffffff,-0xfc(%ebp) 80100c8d: ff ff ff ustack[1] = argc; 80100c90: 89 b5 08 ff ff ff mov %esi,-0xf8(%ebp) ustack[2] = sp - (argc+1)*4; // argv pointer 80100c96: 89 8d 0c ff ff ff mov %ecx,-0xf4(%ebp) sp -= (3+argc+1) * 4; if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0) 80100c9c: 89 5c 24 04 mov %ebx,0x4(%esp) 80100ca0: 89 04 24 mov %eax,(%esp) 80100ca3: e8 f8 5f 00 00 call 80106ca0 <copyout> 80100ca8: 85 c0 test %eax,%eax 80100caa: 0f 88 72 ff ff ff js 80100c22 <exec+0x272> goto bad; // Save program name for debugging. for(last=s=path; *s; s++) 80100cb0: 8b 4d 08 mov 0x8(%ebp),%ecx 80100cb3: 0f b6 11 movzbl (%ecx),%edx 80100cb6: 84 d2 test %dl,%dl 80100cb8: 74 14 je 80100cce <exec+0x31e> #include "defs.h" #include "x86.h" #include "elf.h" int exec(char *path, char **argv) 80100cba: 8d 41 01 lea 0x1(%ecx),%eax goto bad; // Save program name for debugging. for(last=s=path; *s; s++) if(*s == '/') last = s+1; 80100cbd: 80 fa 2f cmp $0x2f,%dl 80100cc0: 0f 44 c8 cmove %eax,%ecx 80100cc3: 83 c0 01 add $0x1,%eax sp -= (3+argc+1) * 4; if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0) goto bad; // Save program name for debugging. for(last=s=path; *s; s++) 80100cc6: 0f b6 50 ff movzbl -0x1(%eax),%edx 80100cca: 84 d2 test %dl,%dl 80100ccc: 75 ef jne 80100cbd <exec+0x30d> if(*s == '/') last = s+1; safestrcpy(curproc->name, last, sizeof(curproc->name)); 80100cce: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax 80100cd4: 89 4c 24 04 mov %ecx,0x4(%esp) 80100cd8: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) 80100cdf: 00 80100ce0: 83 c0 6c add $0x6c,%eax 80100ce3: 89 04 24 mov %eax,(%esp) 80100ce6: e8 45 38 00 00 call 80104530 <safestrcpy> // Commit to the user image. oldpgdir = curproc->pgdir; 80100ceb: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax curproc->pgdir = pgdir; 80100cf1: 8b 95 ec fe ff ff mov -0x114(%ebp),%edx curproc->sz = sz; 80100cf7: 8b 8d f0 fe ff ff mov -0x110(%ebp),%ecx if(*s == '/') last = s+1; safestrcpy(curproc->name, last, sizeof(curproc->name)); // Commit to the user image. oldpgdir = curproc->pgdir; 80100cfd: 8b 70 04 mov 0x4(%eax),%esi curproc->pgdir = pgdir; 80100d00: 89 50 04 mov %edx,0x4(%eax) curproc->sz = sz; 80100d03: 89 08 mov %ecx,(%eax) curproc->tf->eip = elf.entry; // main 80100d05: 8b 40 18 mov 0x18(%eax),%eax curproc->tf->esp = sp; 80100d08: 8b 8d f4 fe ff ff mov -0x10c(%ebp),%ecx // Commit to the user image. oldpgdir = curproc->pgdir; curproc->pgdir = pgdir; curproc->sz = sz; curproc->tf->eip = elf.entry; // main 80100d0e: 8b 55 ac mov -0x54(%ebp),%edx 80100d11: 89 50 38 mov %edx,0x38(%eax) curproc->tf->esp = sp; 80100d14: 8b 41 18 mov 0x18(%ecx),%eax 80100d17: 89 58 44 mov %ebx,0x44(%eax) switchuvm(curproc); 80100d1a: 89 0c 24 mov %ecx,(%esp) 80100d1d: e8 fe 58 00 00 call 80106620 <switchuvm> freevm(oldpgdir); 80100d22: 89 34 24 mov %esi,(%esp) 80100d25: e8 16 5d 00 00 call 80106a40 <freevm> return 0; 80100d2a: 31 c0 xor %eax,%eax 80100d2c: e9 f4 fc ff ff jmp 80100a25 <exec+0x75> ... 80100d40 <fileinit>: struct file file[NFILE]; } ftable; void fileinit(void) { 80100d40: 55 push %ebp 80100d41: 89 e5 mov %esp,%ebp 80100d43: 83 ec 18 sub $0x18,%esp initlock(&ftable.lock, "ftable"); 80100d46: c7 44 24 04 cd 6d 10 movl $0x80106dcd,0x4(%esp) 80100d4d: 80 80100d4e: c7 04 24 c0 ff 10 80 movl $0x8010ffc0,(%esp) 80100d55: e8 b6 33 00 00 call 80104110 <initlock> } 80100d5a: c9 leave 80100d5b: c3 ret 80100d5c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100d60 <filealloc>: // Allocate a file structure. struct file* filealloc(void) { 80100d60: 55 push %ebp 80100d61: 89 e5 mov %esp,%ebp 80100d63: 53 push %ebx struct file *f; acquire(&ftable.lock); for(f = ftable.file; f < ftable.file + NFILE; f++){ 80100d64: bb f4 ff 10 80 mov $0x8010fff4,%ebx } // Allocate a file structure. struct file* filealloc(void) { 80100d69: 83 ec 14 sub $0x14,%esp struct file *f; acquire(&ftable.lock); 80100d6c: c7 04 24 c0 ff 10 80 movl $0x8010ffc0,(%esp) 80100d73: e8 08 35 00 00 call 80104280 <acquire> for(f = ftable.file; f < ftable.file + NFILE; f++){ if(f->ref == 0){ 80100d78: 8b 15 f8 ff 10 80 mov 0x8010fff8,%edx 80100d7e: 85 d2 test %edx,%edx 80100d80: 74 18 je 80100d9a <filealloc+0x3a> 80100d82: 8d b6 00 00 00 00 lea 0x0(%esi),%esi filealloc(void) { struct file *f; acquire(&ftable.lock); for(f = ftable.file; f < ftable.file + NFILE; f++){ 80100d88: 83 c3 18 add $0x18,%ebx 80100d8b: 81 fb 54 09 11 80 cmp $0x80110954,%ebx 80100d91: 73 25 jae 80100db8 <filealloc+0x58> if(f->ref == 0){ 80100d93: 8b 43 04 mov 0x4(%ebx),%eax 80100d96: 85 c0 test %eax,%eax 80100d98: 75 ee jne 80100d88 <filealloc+0x28> f->ref = 1; 80100d9a: c7 43 04 01 00 00 00 movl $0x1,0x4(%ebx) release(&ftable.lock); 80100da1: c7 04 24 c0 ff 10 80 movl $0x8010ffc0,(%esp) 80100da8: e8 43 35 00 00 call 801042f0 <release> return f; } } release(&ftable.lock); return 0; } 80100dad: 83 c4 14 add $0x14,%esp 80100db0: 89 d8 mov %ebx,%eax 80100db2: 5b pop %ebx 80100db3: 5d pop %ebp 80100db4: c3 ret 80100db5: 8d 76 00 lea 0x0(%esi),%esi f->ref = 1; release(&ftable.lock); return f; } } release(&ftable.lock); 80100db8: c7 04 24 c0 ff 10 80 movl $0x8010ffc0,(%esp) return 0; 80100dbf: 31 db xor %ebx,%ebx f->ref = 1; release(&ftable.lock); return f; } } release(&ftable.lock); 80100dc1: e8 2a 35 00 00 call 801042f0 <release> return 0; } 80100dc6: 83 c4 14 add $0x14,%esp 80100dc9: 89 d8 mov %ebx,%eax 80100dcb: 5b pop %ebx 80100dcc: 5d pop %ebp 80100dcd: c3 ret 80100dce: 66 90 xchg %ax,%ax 80100dd0 <filedup>: // Increment ref count for file f. struct file* filedup(struct file *f) { 80100dd0: 55 push %ebp 80100dd1: 89 e5 mov %esp,%ebp 80100dd3: 53 push %ebx 80100dd4: 83 ec 14 sub $0x14,%esp 80100dd7: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&ftable.lock); 80100dda: c7 04 24 c0 ff 10 80 movl $0x8010ffc0,(%esp) 80100de1: e8 9a 34 00 00 call 80104280 <acquire> if(f->ref < 1) 80100de6: 8b 43 04 mov 0x4(%ebx),%eax 80100de9: 85 c0 test %eax,%eax 80100deb: 7e 1a jle 80100e07 <filedup+0x37> panic("filedup"); f->ref++; 80100ded: 83 c0 01 add $0x1,%eax 80100df0: 89 43 04 mov %eax,0x4(%ebx) release(&ftable.lock); 80100df3: c7 04 24 c0 ff 10 80 movl $0x8010ffc0,(%esp) 80100dfa: e8 f1 34 00 00 call 801042f0 <release> return f; } 80100dff: 83 c4 14 add $0x14,%esp 80100e02: 89 d8 mov %ebx,%eax 80100e04: 5b pop %ebx 80100e05: 5d pop %ebp 80100e06: c3 ret struct file* filedup(struct file *f) { acquire(&ftable.lock); if(f->ref < 1) panic("filedup"); 80100e07: c7 04 24 d4 6d 10 80 movl $0x80106dd4,(%esp) 80100e0e: e8 5d f5 ff ff call 80100370 <panic> 80100e13: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80100e19: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80100e20 <fileclose>: } // Close file f. (Decrement ref count, close when reaches 0.) void fileclose(struct file *f) { 80100e20: 55 push %ebp 80100e21: 89 e5 mov %esp,%ebp 80100e23: 83 ec 38 sub $0x38,%esp 80100e26: 89 5d f4 mov %ebx,-0xc(%ebp) 80100e29: 8b 5d 08 mov 0x8(%ebp),%ebx 80100e2c: 89 75 f8 mov %esi,-0x8(%ebp) 80100e2f: 89 7d fc mov %edi,-0x4(%ebp) struct file ff; acquire(&ftable.lock); 80100e32: c7 04 24 c0 ff 10 80 movl $0x8010ffc0,(%esp) 80100e39: e8 42 34 00 00 call 80104280 <acquire> if(f->ref < 1) 80100e3e: 8b 43 04 mov 0x4(%ebx),%eax 80100e41: 85 c0 test %eax,%eax 80100e43: 0f 8e 9c 00 00 00 jle 80100ee5 <fileclose+0xc5> panic("fileclose"); if(--f->ref > 0){ 80100e49: 83 e8 01 sub $0x1,%eax 80100e4c: 85 c0 test %eax,%eax 80100e4e: 89 43 04 mov %eax,0x4(%ebx) 80100e51: 74 1d je 80100e70 <fileclose+0x50> release(&ftable.lock); 80100e53: c7 45 08 c0 ff 10 80 movl $0x8010ffc0,0x8(%ebp) else if(ff.type == FD_INODE){ begin_op(); iput(ff.ip); end_op(); } } 80100e5a: 8b 5d f4 mov -0xc(%ebp),%ebx 80100e5d: 8b 75 f8 mov -0x8(%ebp),%esi 80100e60: 8b 7d fc mov -0x4(%ebp),%edi 80100e63: 89 ec mov %ebp,%esp 80100e65: 5d pop %ebp acquire(&ftable.lock); if(f->ref < 1) panic("fileclose"); if(--f->ref > 0){ release(&ftable.lock); 80100e66: e9 85 34 00 00 jmp 801042f0 <release> 80100e6b: 90 nop 80100e6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi return; } ff = *f; 80100e70: 0f b6 43 09 movzbl 0x9(%ebx),%eax 80100e74: 8b 33 mov (%ebx),%esi f->ref = 0; f->type = FD_NONE; 80100e76: c7 03 00 00 00 00 movl $0x0,(%ebx) panic("fileclose"); if(--f->ref > 0){ release(&ftable.lock); return; } ff = *f; 80100e7c: 8b 7b 10 mov 0x10(%ebx),%edi 80100e7f: 88 45 e7 mov %al,-0x19(%ebp) 80100e82: 8b 43 0c mov 0xc(%ebx),%eax f->ref = 0; f->type = FD_NONE; release(&ftable.lock); 80100e85: c7 04 24 c0 ff 10 80 movl $0x8010ffc0,(%esp) panic("fileclose"); if(--f->ref > 0){ release(&ftable.lock); return; } ff = *f; 80100e8c: 89 45 e0 mov %eax,-0x20(%ebp) f->ref = 0; f->type = FD_NONE; release(&ftable.lock); 80100e8f: e8 5c 34 00 00 call 801042f0 <release> if(ff.type == FD_PIPE) 80100e94: 83 fe 01 cmp $0x1,%esi 80100e97: 74 37 je 80100ed0 <fileclose+0xb0> pipeclose(ff.pipe, ff.writable); else if(ff.type == FD_INODE){ 80100e99: 83 fe 02 cmp $0x2,%esi 80100e9c: 74 12 je 80100eb0 <fileclose+0x90> begin_op(); iput(ff.ip); end_op(); } } 80100e9e: 8b 5d f4 mov -0xc(%ebp),%ebx 80100ea1: 8b 75 f8 mov -0x8(%ebp),%esi 80100ea4: 8b 7d fc mov -0x4(%ebp),%edi 80100ea7: 89 ec mov %ebp,%esp 80100ea9: 5d pop %ebp 80100eaa: c3 ret 80100eab: 90 nop 80100eac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi release(&ftable.lock); if(ff.type == FD_PIPE) pipeclose(ff.pipe, ff.writable); else if(ff.type == FD_INODE){ begin_op(); 80100eb0: e8 bb 1c 00 00 call 80102b70 <begin_op> iput(ff.ip); 80100eb5: 89 3c 24 mov %edi,(%esp) 80100eb8: e8 13 09 00 00 call 801017d0 <iput> end_op(); } } 80100ebd: 8b 5d f4 mov -0xc(%ebp),%ebx 80100ec0: 8b 75 f8 mov -0x8(%ebp),%esi 80100ec3: 8b 7d fc mov -0x4(%ebp),%edi 80100ec6: 89 ec mov %ebp,%esp 80100ec8: 5d pop %ebp if(ff.type == FD_PIPE) pipeclose(ff.pipe, ff.writable); else if(ff.type == FD_INODE){ begin_op(); iput(ff.ip); end_op(); 80100ec9: e9 12 1d 00 00 jmp 80102be0 <end_op> 80100ece: 66 90 xchg %ax,%ax f->ref = 0; f->type = FD_NONE; release(&ftable.lock); if(ff.type == FD_PIPE) pipeclose(ff.pipe, ff.writable); 80100ed0: 0f be 45 e7 movsbl -0x19(%ebp),%eax 80100ed4: 89 44 24 04 mov %eax,0x4(%esp) 80100ed8: 8b 45 e0 mov -0x20(%ebp),%eax 80100edb: 89 04 24 mov %eax,(%esp) 80100ede: e8 ed 23 00 00 call 801032d0 <pipeclose> 80100ee3: eb b9 jmp 80100e9e <fileclose+0x7e> { struct file ff; acquire(&ftable.lock); if(f->ref < 1) panic("fileclose"); 80100ee5: c7 04 24 dc 6d 10 80 movl $0x80106ddc,(%esp) 80100eec: e8 7f f4 ff ff call 80100370 <panic> 80100ef1: eb 0d jmp 80100f00 <filestat> 80100ef3: 90 nop 80100ef4: 90 nop 80100ef5: 90 nop 80100ef6: 90 nop 80100ef7: 90 nop 80100ef8: 90 nop 80100ef9: 90 nop 80100efa: 90 nop 80100efb: 90 nop 80100efc: 90 nop 80100efd: 90 nop 80100efe: 90 nop 80100eff: 90 nop 80100f00 <filestat>: } // Get metadata about file f. int filestat(struct file *f, struct stat *st) { 80100f00: 55 push %ebp ilock(f->ip); stati(f->ip, st); iunlock(f->ip); return 0; } return -1; 80100f01: b8 ff ff ff ff mov $0xffffffff,%eax } // Get metadata about file f. int filestat(struct file *f, struct stat *st) { 80100f06: 89 e5 mov %esp,%ebp 80100f08: 53 push %ebx 80100f09: 83 ec 14 sub $0x14,%esp 80100f0c: 8b 5d 08 mov 0x8(%ebp),%ebx if(f->type == FD_INODE){ 80100f0f: 83 3b 02 cmpl $0x2,(%ebx) 80100f12: 75 2a jne 80100f3e <filestat+0x3e> ilock(f->ip); 80100f14: 8b 43 10 mov 0x10(%ebx),%eax 80100f17: 89 04 24 mov %eax,(%esp) 80100f1a: e8 81 07 00 00 call 801016a0 <ilock> stati(f->ip, st); 80100f1f: 8b 45 0c mov 0xc(%ebp),%eax 80100f22: 89 44 24 04 mov %eax,0x4(%esp) 80100f26: 8b 43 10 mov 0x10(%ebx),%eax 80100f29: 89 04 24 mov %eax,(%esp) 80100f2c: e8 1f 0a 00 00 call 80101950 <stati> iunlock(f->ip); 80100f31: 8b 43 10 mov 0x10(%ebx),%eax 80100f34: 89 04 24 mov %eax,(%esp) 80100f37: e8 44 08 00 00 call 80101780 <iunlock> return 0; 80100f3c: 31 c0 xor %eax,%eax } return -1; } 80100f3e: 83 c4 14 add $0x14,%esp 80100f41: 5b pop %ebx 80100f42: 5d pop %ebp 80100f43: c3 ret 80100f44: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80100f4a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 80100f50 <fileread>: // Read from file f. int fileread(struct file *f, char *addr, int n) { 80100f50: 55 push %ebp 80100f51: 89 e5 mov %esp,%ebp 80100f53: 83 ec 28 sub $0x28,%esp 80100f56: 89 5d f4 mov %ebx,-0xc(%ebp) 80100f59: 8b 5d 08 mov 0x8(%ebp),%ebx 80100f5c: 89 75 f8 mov %esi,-0x8(%ebp) 80100f5f: 8b 75 0c mov 0xc(%ebp),%esi 80100f62: 89 7d fc mov %edi,-0x4(%ebp) 80100f65: 8b 7d 10 mov 0x10(%ebp),%edi int r; if(f->readable == 0) 80100f68: 80 7b 08 00 cmpb $0x0,0x8(%ebx) 80100f6c: 74 72 je 80100fe0 <fileread+0x90> return -1; if(f->type == FD_PIPE) 80100f6e: 8b 03 mov (%ebx),%eax 80100f70: 83 f8 01 cmp $0x1,%eax 80100f73: 74 53 je 80100fc8 <fileread+0x78> return piperead(f->pipe, addr, n); if(f->type == FD_INODE){ 80100f75: 83 f8 02 cmp $0x2,%eax 80100f78: 75 6d jne 80100fe7 <fileread+0x97> ilock(f->ip); 80100f7a: 8b 43 10 mov 0x10(%ebx),%eax 80100f7d: 89 04 24 mov %eax,(%esp) 80100f80: e8 1b 07 00 00 call 801016a0 <ilock> if((r = readi(f->ip, addr, f->off, n)) > 0) 80100f85: 89 7c 24 0c mov %edi,0xc(%esp) 80100f89: 8b 43 14 mov 0x14(%ebx),%eax 80100f8c: 89 74 24 04 mov %esi,0x4(%esp) 80100f90: 89 44 24 08 mov %eax,0x8(%esp) 80100f94: 8b 43 10 mov 0x10(%ebx),%eax 80100f97: 89 04 24 mov %eax,(%esp) 80100f9a: e8 e1 09 00 00 call 80101980 <readi> 80100f9f: 85 c0 test %eax,%eax 80100fa1: 89 c6 mov %eax,%esi 80100fa3: 7e 03 jle 80100fa8 <fileread+0x58> f->off += r; 80100fa5: 01 43 14 add %eax,0x14(%ebx) iunlock(f->ip); 80100fa8: 8b 43 10 mov 0x10(%ebx),%eax 80100fab: 89 04 24 mov %eax,(%esp) 80100fae: e8 cd 07 00 00 call 80101780 <iunlock> return r; } panic("fileread"); } 80100fb3: 89 f0 mov %esi,%eax 80100fb5: 8b 5d f4 mov -0xc(%ebp),%ebx 80100fb8: 8b 75 f8 mov -0x8(%ebp),%esi 80100fbb: 8b 7d fc mov -0x4(%ebp),%edi 80100fbe: 89 ec mov %ebp,%esp 80100fc0: 5d pop %ebp 80100fc1: c3 ret 80100fc2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi int r; if(f->readable == 0) return -1; if(f->type == FD_PIPE) return piperead(f->pipe, addr, n); 80100fc8: 8b 43 0c mov 0xc(%ebx),%eax f->off += r; iunlock(f->ip); return r; } panic("fileread"); } 80100fcb: 8b 75 f8 mov -0x8(%ebp),%esi 80100fce: 8b 5d f4 mov -0xc(%ebp),%ebx 80100fd1: 8b 7d fc mov -0x4(%ebp),%edi int r; if(f->readable == 0) return -1; if(f->type == FD_PIPE) return piperead(f->pipe, addr, n); 80100fd4: 89 45 08 mov %eax,0x8(%ebp) f->off += r; iunlock(f->ip); return r; } panic("fileread"); } 80100fd7: 89 ec mov %ebp,%esp 80100fd9: 5d pop %ebp int r; if(f->readable == 0) return -1; if(f->type == FD_PIPE) return piperead(f->pipe, addr, n); 80100fda: e9 81 24 00 00 jmp 80103460 <piperead> 80100fdf: 90 nop fileread(struct file *f, char *addr, int n) { int r; if(f->readable == 0) return -1; 80100fe0: be ff ff ff ff mov $0xffffffff,%esi 80100fe5: eb cc jmp 80100fb3 <fileread+0x63> if((r = readi(f->ip, addr, f->off, n)) > 0) f->off += r; iunlock(f->ip); return r; } panic("fileread"); 80100fe7: c7 04 24 e6 6d 10 80 movl $0x80106de6,(%esp) 80100fee: e8 7d f3 ff ff call 80100370 <panic> 80100ff3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80100ff9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80101000 <filewrite>: //PAGEBREAK! // Write to file f. int filewrite(struct file *f, char *addr, int n) { 80101000: 55 push %ebp 80101001: 89 e5 mov %esp,%ebp 80101003: 57 push %edi 80101004: 56 push %esi 80101005: 53 push %ebx 80101006: 83 ec 2c sub $0x2c,%esp 80101009: 8b 45 0c mov 0xc(%ebp),%eax 8010100c: 8b 5d 08 mov 0x8(%ebp),%ebx 8010100f: 89 45 e0 mov %eax,-0x20(%ebp) 80101012: 8b 45 10 mov 0x10(%ebp),%eax int r; if(f->writable == 0) 80101015: 80 7b 09 00 cmpb $0x0,0x9(%ebx) //PAGEBREAK! // Write to file f. int filewrite(struct file *f, char *addr, int n) { 80101019: 89 45 e4 mov %eax,-0x1c(%ebp) int r; if(f->writable == 0) 8010101c: 0f 84 ae 00 00 00 je 801010d0 <filewrite+0xd0> return -1; if(f->type == FD_PIPE) 80101022: 8b 03 mov (%ebx),%eax 80101024: 83 f8 01 cmp $0x1,%eax 80101027: 0f 84 c6 00 00 00 je 801010f3 <filewrite+0xf3> return pipewrite(f->pipe, addr, n); if(f->type == FD_INODE){ 8010102d: 83 f8 02 cmp $0x2,%eax 80101030: 0f 85 db 00 00 00 jne 80101111 <filewrite+0x111> // and 2 blocks of slop for non-aligned writes. // this really belongs lower down, since writei() // might be writing a device like the console. int max = ((MAXOPBLOCKS-1-1-2) / 2) * 512; int i = 0; while(i < n){ 80101036: 8b 4d e4 mov -0x1c(%ebp),%ecx 80101039: 31 f6 xor %esi,%esi 8010103b: 85 c9 test %ecx,%ecx 8010103d: 7f 31 jg 80101070 <filewrite+0x70> 8010103f: e9 9c 00 00 00 jmp 801010e0 <filewrite+0xe0> 80101044: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi n1 = max; begin_op(); ilock(f->ip); if ((r = writei(f->ip, addr + i, f->off, n1)) > 0) f->off += r; 80101048: 01 43 14 add %eax,0x14(%ebx) iunlock(f->ip); 8010104b: 8b 53 10 mov 0x10(%ebx),%edx 8010104e: 89 45 dc mov %eax,-0x24(%ebp) 80101051: 89 14 24 mov %edx,(%esp) 80101054: e8 27 07 00 00 call 80101780 <iunlock> end_op(); 80101059: e8 82 1b 00 00 call 80102be0 <end_op> 8010105e: 8b 45 dc mov -0x24(%ebp),%eax if(r < 0) break; if(r != n1) 80101061: 39 f8 cmp %edi,%eax 80101063: 0f 85 9c 00 00 00 jne 80101105 <filewrite+0x105> panic("short filewrite"); i += r; 80101069: 01 c6 add %eax,%esi // and 2 blocks of slop for non-aligned writes. // this really belongs lower down, since writei() // might be writing a device like the console. int max = ((MAXOPBLOCKS-1-1-2) / 2) * 512; int i = 0; while(i < n){ 8010106b: 39 75 e4 cmp %esi,-0x1c(%ebp) 8010106e: 7e 70 jle 801010e0 <filewrite+0xe0> int n1 = n - i; 80101070: 8b 7d e4 mov -0x1c(%ebp),%edi 80101073: b8 00 06 00 00 mov $0x600,%eax 80101078: 29 f7 sub %esi,%edi 8010107a: 81 ff 00 06 00 00 cmp $0x600,%edi 80101080: 0f 4f f8 cmovg %eax,%edi if(n1 > max) n1 = max; begin_op(); 80101083: e8 e8 1a 00 00 call 80102b70 <begin_op> ilock(f->ip); 80101088: 8b 43 10 mov 0x10(%ebx),%eax 8010108b: 89 04 24 mov %eax,(%esp) 8010108e: e8 0d 06 00 00 call 801016a0 <ilock> if ((r = writei(f->ip, addr + i, f->off, n1)) > 0) 80101093: 89 7c 24 0c mov %edi,0xc(%esp) 80101097: 8b 43 14 mov 0x14(%ebx),%eax 8010109a: 89 44 24 08 mov %eax,0x8(%esp) 8010109e: 8b 45 e0 mov -0x20(%ebp),%eax 801010a1: 01 f0 add %esi,%eax 801010a3: 89 44 24 04 mov %eax,0x4(%esp) 801010a7: 8b 43 10 mov 0x10(%ebx),%eax 801010aa: 89 04 24 mov %eax,(%esp) 801010ad: e8 fe 09 00 00 call 80101ab0 <writei> 801010b2: 85 c0 test %eax,%eax 801010b4: 7f 92 jg 80101048 <filewrite+0x48> f->off += r; iunlock(f->ip); 801010b6: 8b 53 10 mov 0x10(%ebx),%edx 801010b9: 89 45 dc mov %eax,-0x24(%ebp) 801010bc: 89 14 24 mov %edx,(%esp) 801010bf: e8 bc 06 00 00 call 80101780 <iunlock> end_op(); 801010c4: e8 17 1b 00 00 call 80102be0 <end_op> if(r < 0) 801010c9: 8b 45 dc mov -0x24(%ebp),%eax 801010cc: 85 c0 test %eax,%eax 801010ce: 74 91 je 80101061 <filewrite+0x61> i += r; } return i == n ? n : -1; } panic("filewrite"); } 801010d0: 83 c4 2c add $0x2c,%esp break; if(r != n1) panic("short filewrite"); i += r; } return i == n ? n : -1; 801010d3: b8 ff ff ff ff mov $0xffffffff,%eax } panic("filewrite"); } 801010d8: 5b pop %ebx 801010d9: 5e pop %esi 801010da: 5f pop %edi 801010db: 5d pop %ebp 801010dc: c3 ret 801010dd: 8d 76 00 lea 0x0(%esi),%esi break; if(r != n1) panic("short filewrite"); i += r; } return i == n ? n : -1; 801010e0: 3b 75 e4 cmp -0x1c(%ebp),%esi 801010e3: b8 ff ff ff ff mov $0xffffffff,%eax 801010e8: 0f 44 c6 cmove %esi,%eax } panic("filewrite"); } 801010eb: 83 c4 2c add $0x2c,%esp 801010ee: 5b pop %ebx 801010ef: 5e pop %esi 801010f0: 5f pop %edi 801010f1: 5d pop %ebp 801010f2: c3 ret int r; if(f->writable == 0) return -1; if(f->type == FD_PIPE) return pipewrite(f->pipe, addr, n); 801010f3: 8b 43 0c mov 0xc(%ebx),%eax 801010f6: 89 45 08 mov %eax,0x8(%ebp) i += r; } return i == n ? n : -1; } panic("filewrite"); } 801010f9: 83 c4 2c add $0x2c,%esp 801010fc: 5b pop %ebx 801010fd: 5e pop %esi 801010fe: 5f pop %edi 801010ff: 5d pop %ebp int r; if(f->writable == 0) return -1; if(f->type == FD_PIPE) return pipewrite(f->pipe, addr, n); 80101100: e9 6b 22 00 00 jmp 80103370 <pipewrite> end_op(); if(r < 0) break; if(r != n1) panic("short filewrite"); 80101105: c7 04 24 ef 6d 10 80 movl $0x80106def,(%esp) 8010110c: e8 5f f2 ff ff call 80100370 <panic> i += r; } return i == n ? n : -1; } panic("filewrite"); 80101111: c7 04 24 f5 6d 10 80 movl $0x80106df5,(%esp) 80101118: e8 53 f2 ff ff call 80100370 <panic> 8010111d: 00 00 add %al,(%eax) ... 80101120 <iget>: // Find the inode with number inum on device dev // and return the in-memory copy. Does not lock // the inode and does not read it from disk. static struct inode* iget(uint dev, uint inum) { 80101120: 55 push %ebp 80101121: 89 e5 mov %esp,%ebp 80101123: 57 push %edi 80101124: 89 d7 mov %edx,%edi 80101126: 56 push %esi struct inode *ip, *empty; acquire(&icache.lock); // Is the inode already cached? empty = 0; 80101127: 31 f6 xor %esi,%esi // Find the inode with number inum on device dev // and return the in-memory copy. Does not lock // the inode and does not read it from disk. static struct inode* iget(uint dev, uint inum) { 80101129: 53 push %ebx 8010112a: 89 c3 mov %eax,%ebx 8010112c: 83 ec 2c sub $0x2c,%esp struct inode *ip, *empty; acquire(&icache.lock); 8010112f: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) 80101136: e8 45 31 00 00 call 80104280 <acquire> // Is the inode already cached? empty = 0; for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ 8010113b: b8 14 0a 11 80 mov $0x80110a14,%eax 80101140: eb 16 jmp 80101158 <iget+0x38> 80101142: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){ ip->ref++; release(&icache.lock); return ip; } if(empty == 0 && ip->ref == 0) // Remember empty slot. 80101148: 85 f6 test %esi,%esi 8010114a: 74 3c je 80101188 <iget+0x68> acquire(&icache.lock); // Is the inode already cached? empty = 0; for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ 8010114c: 05 90 00 00 00 add $0x90,%eax 80101151: 3d 34 26 11 80 cmp $0x80112634,%eax 80101156: 73 48 jae 801011a0 <iget+0x80> if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){ 80101158: 8b 48 08 mov 0x8(%eax),%ecx 8010115b: 85 c9 test %ecx,%ecx 8010115d: 7e e9 jle 80101148 <iget+0x28> 8010115f: 39 18 cmp %ebx,(%eax) 80101161: 75 e5 jne 80101148 <iget+0x28> 80101163: 39 78 04 cmp %edi,0x4(%eax) 80101166: 75 e0 jne 80101148 <iget+0x28> ip->ref++; 80101168: 83 c1 01 add $0x1,%ecx 8010116b: 89 48 08 mov %ecx,0x8(%eax) release(&icache.lock); 8010116e: 89 45 e4 mov %eax,-0x1c(%ebp) 80101171: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) 80101178: e8 73 31 00 00 call 801042f0 <release> return ip; 8010117d: 8b 45 e4 mov -0x1c(%ebp),%eax ip->ref = 1; ip->valid = 0; release(&icache.lock); return ip; } 80101180: 83 c4 2c add $0x2c,%esp 80101183: 5b pop %ebx 80101184: 5e pop %esi 80101185: 5f pop %edi 80101186: 5d pop %ebp 80101187: c3 ret if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){ ip->ref++; release(&icache.lock); return ip; } if(empty == 0 && ip->ref == 0) // Remember empty slot. 80101188: 85 c9 test %ecx,%ecx 8010118a: 0f 44 f0 cmove %eax,%esi acquire(&icache.lock); // Is the inode already cached? empty = 0; for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ 8010118d: 05 90 00 00 00 add $0x90,%eax 80101192: 3d 34 26 11 80 cmp $0x80112634,%eax 80101197: 72 bf jb 80101158 <iget+0x38> 80101199: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(empty == 0 && ip->ref == 0) // Remember empty slot. empty = ip; } // Recycle an inode cache entry. if(empty == 0) 801011a0: 85 f6 test %esi,%esi 801011a2: 74 29 je 801011cd <iget+0xad> panic("iget: no inodes"); ip = empty; ip->dev = dev; 801011a4: 89 1e mov %ebx,(%esi) ip->inum = inum; 801011a6: 89 7e 04 mov %edi,0x4(%esi) ip->ref = 1; 801011a9: c7 46 08 01 00 00 00 movl $0x1,0x8(%esi) ip->valid = 0; 801011b0: c7 46 4c 00 00 00 00 movl $0x0,0x4c(%esi) release(&icache.lock); 801011b7: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) 801011be: e8 2d 31 00 00 call 801042f0 <release> return ip; } 801011c3: 83 c4 2c add $0x2c,%esp ip->inum = inum; ip->ref = 1; ip->valid = 0; release(&icache.lock); return ip; 801011c6: 89 f0 mov %esi,%eax } 801011c8: 5b pop %ebx 801011c9: 5e pop %esi 801011ca: 5f pop %edi 801011cb: 5d pop %ebp 801011cc: c3 ret empty = ip; } // Recycle an inode cache entry. if(empty == 0) panic("iget: no inodes"); 801011cd: c7 04 24 ff 6d 10 80 movl $0x80106dff,(%esp) 801011d4: e8 97 f1 ff ff call 80100370 <panic> 801011d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801011e0 <bfree>: } // Free a disk block. static void bfree(int dev, uint b) { 801011e0: 55 push %ebp 801011e1: 89 e5 mov %esp,%ebp 801011e3: 83 ec 28 sub $0x28,%esp 801011e6: 89 75 f8 mov %esi,-0x8(%ebp) 801011e9: 89 d6 mov %edx,%esi struct buf *bp; int bi, m; bp = bread(dev, BBLOCK(b, sb)); 801011eb: c1 ea 0c shr $0xc,%edx 801011ee: 03 15 d8 09 11 80 add 0x801109d8,%edx } // Free a disk block. static void bfree(int dev, uint b) { 801011f4: 89 5d f4 mov %ebx,-0xc(%ebp) struct buf *bp; int bi, m; bp = bread(dev, BBLOCK(b, sb)); bi = b % BPB; 801011f7: 89 f3 mov %esi,%ebx } // Free a disk block. static void bfree(int dev, uint b) { 801011f9: 89 7d fc mov %edi,-0x4(%ebp) struct buf *bp; int bi, m; bp = bread(dev, BBLOCK(b, sb)); bi = b % BPB; 801011fc: 81 e3 ff 0f 00 00 and $0xfff,%ebx bfree(int dev, uint b) { struct buf *bp; int bi, m; bp = bread(dev, BBLOCK(b, sb)); 80101202: 89 54 24 04 mov %edx,0x4(%esp) bi = b % BPB; m = 1 << (bi % 8); if((bp->data[bi/8] & m) == 0) 80101206: c1 fb 03 sar $0x3,%ebx bfree(int dev, uint b) { struct buf *bp; int bi, m; bp = bread(dev, BBLOCK(b, sb)); 80101209: 89 04 24 mov %eax,(%esp) 8010120c: e8 bf ee ff ff call 801000d0 <bread> bi = b % BPB; m = 1 << (bi % 8); 80101211: 89 f1 mov %esi,%ecx 80101213: be 01 00 00 00 mov $0x1,%esi 80101218: 83 e1 07 and $0x7,%ecx 8010121b: d3 e6 shl %cl,%esi if((bp->data[bi/8] & m) == 0) 8010121d: 0f b6 54 18 5c movzbl 0x5c(%eax,%ebx,1),%edx bfree(int dev, uint b) { struct buf *bp; int bi, m; bp = bread(dev, BBLOCK(b, sb)); 80101222: 89 c7 mov %eax,%edi bi = b % BPB; m = 1 << (bi % 8); if((bp->data[bi/8] & m) == 0) 80101224: 0f b6 c2 movzbl %dl,%eax 80101227: 85 f0 test %esi,%eax 80101229: 74 27 je 80101252 <bfree+0x72> panic("freeing free block"); bp->data[bi/8] &= ~m; 8010122b: 89 f0 mov %esi,%eax 8010122d: f7 d0 not %eax 8010122f: 21 d0 and %edx,%eax 80101231: 88 44 1f 5c mov %al,0x5c(%edi,%ebx,1) log_write(bp); 80101235: 89 3c 24 mov %edi,(%esp) 80101238: e8 d3 1a 00 00 call 80102d10 <log_write> brelse(bp); 8010123d: 89 3c 24 mov %edi,(%esp) 80101240: e8 9b ef ff ff call 801001e0 <brelse> } 80101245: 8b 5d f4 mov -0xc(%ebp),%ebx 80101248: 8b 75 f8 mov -0x8(%ebp),%esi 8010124b: 8b 7d fc mov -0x4(%ebp),%edi 8010124e: 89 ec mov %ebp,%esp 80101250: 5d pop %ebp 80101251: c3 ret bp = bread(dev, BBLOCK(b, sb)); bi = b % BPB; m = 1 << (bi % 8); if((bp->data[bi/8] & m) == 0) panic("freeing free block"); 80101252: c7 04 24 0f 6e 10 80 movl $0x80106e0f,(%esp) 80101259: e8 12 f1 ff ff call 80100370 <panic> 8010125e: 66 90 xchg %ax,%ax 80101260 <balloc>: // Blocks. // Allocate a zeroed disk block. static uint balloc(uint dev) { 80101260: 55 push %ebp 80101261: 89 e5 mov %esp,%ebp 80101263: 57 push %edi 80101264: 56 push %esi 80101265: 53 push %ebx 80101266: 83 ec 3c sub $0x3c,%esp 80101269: 89 45 d8 mov %eax,-0x28(%ebp) int b, bi, m; struct buf *bp; bp = 0; for(b = 0; b < sb.size; b += BPB){ 8010126c: a1 c0 09 11 80 mov 0x801109c0,%eax 80101271: 85 c0 test %eax,%eax 80101273: 0f 84 90 00 00 00 je 80101309 <balloc+0xa9> 80101279: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp) bp = bread(dev, BBLOCK(b, sb)); 80101280: 8b 45 dc mov -0x24(%ebp),%eax 80101283: c1 f8 0c sar $0xc,%eax 80101286: 03 05 d8 09 11 80 add 0x801109d8,%eax 8010128c: 89 44 24 04 mov %eax,0x4(%esp) 80101290: 8b 45 d8 mov -0x28(%ebp),%eax 80101293: 89 04 24 mov %eax,(%esp) 80101296: e8 35 ee ff ff call 801000d0 <bread> 8010129b: 8b 15 c0 09 11 80 mov 0x801109c0,%edx 801012a1: 8b 5d dc mov -0x24(%ebp),%ebx 801012a4: 89 55 e0 mov %edx,-0x20(%ebp) 801012a7: 89 45 e4 mov %eax,-0x1c(%ebp) for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ 801012aa: 31 c0 xor %eax,%eax 801012ac: eb 35 jmp 801012e3 <balloc+0x83> 801012ae: 66 90 xchg %ax,%ax m = 1 << (bi % 8); 801012b0: 89 c1 mov %eax,%ecx 801012b2: bf 01 00 00 00 mov $0x1,%edi 801012b7: 83 e1 07 and $0x7,%ecx if((bp->data[bi/8] & m) == 0){ // Is block free? 801012ba: 89 c2 mov %eax,%edx bp = 0; for(b = 0; b < sb.size; b += BPB){ bp = bread(dev, BBLOCK(b, sb)); for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ m = 1 << (bi % 8); 801012bc: d3 e7 shl %cl,%edi if((bp->data[bi/8] & m) == 0){ // Is block free? 801012be: 8b 4d e4 mov -0x1c(%ebp),%ecx 801012c1: c1 fa 03 sar $0x3,%edx bp = 0; for(b = 0; b < sb.size; b += BPB){ bp = bread(dev, BBLOCK(b, sb)); for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ m = 1 << (bi % 8); 801012c4: 89 7d d4 mov %edi,-0x2c(%ebp) if((bp->data[bi/8] & m) == 0){ // Is block free? 801012c7: 0f b6 74 11 5c movzbl 0x5c(%ecx,%edx,1),%esi 801012cc: 89 f1 mov %esi,%ecx 801012ce: 0f b6 f9 movzbl %cl,%edi 801012d1: 85 7d d4 test %edi,-0x2c(%ebp) 801012d4: 74 42 je 80101318 <balloc+0xb8> struct buf *bp; bp = 0; for(b = 0; b < sb.size; b += BPB){ bp = bread(dev, BBLOCK(b, sb)); for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ 801012d6: 83 c0 01 add $0x1,%eax 801012d9: 83 c3 01 add $0x1,%ebx 801012dc: 3d 00 10 00 00 cmp $0x1000,%eax 801012e1: 74 05 je 801012e8 <balloc+0x88> 801012e3: 3b 5d e0 cmp -0x20(%ebp),%ebx 801012e6: 72 c8 jb 801012b0 <balloc+0x50> brelse(bp); bzero(dev, b + bi); return b + bi; } } brelse(bp); 801012e8: 8b 45 e4 mov -0x1c(%ebp),%eax 801012eb: 89 04 24 mov %eax,(%esp) 801012ee: e8 ed ee ff ff call 801001e0 <brelse> { int b, bi, m; struct buf *bp; bp = 0; for(b = 0; b < sb.size; b += BPB){ 801012f3: 81 45 dc 00 10 00 00 addl $0x1000,-0x24(%ebp) 801012fa: 8b 55 dc mov -0x24(%ebp),%edx 801012fd: 3b 15 c0 09 11 80 cmp 0x801109c0,%edx 80101303: 0f 82 77 ff ff ff jb 80101280 <balloc+0x20> return b + bi; } } brelse(bp); } panic("balloc: out of blocks"); 80101309: c7 04 24 22 6e 10 80 movl $0x80106e22,(%esp) 80101310: e8 5b f0 ff ff call 80100370 <panic> 80101315: 8d 76 00 lea 0x0(%esi),%esi 80101318: 8b 4d d4 mov -0x2c(%ebp),%ecx for(b = 0; b < sb.size; b += BPB){ bp = bread(dev, BBLOCK(b, sb)); for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ m = 1 << (bi % 8); if((bp->data[bi/8] & m) == 0){ // Is block free? bp->data[bi/8] |= m; // Mark block in use. 8010131b: 8b 45 e4 mov -0x1c(%ebp),%eax 8010131e: 09 f1 or %esi,%ecx 80101320: 88 4c 10 5c mov %cl,0x5c(%eax,%edx,1) log_write(bp); 80101324: 89 04 24 mov %eax,(%esp) 80101327: e8 e4 19 00 00 call 80102d10 <log_write> brelse(bp); 8010132c: 8b 45 e4 mov -0x1c(%ebp),%eax 8010132f: 89 04 24 mov %eax,(%esp) 80101332: e8 a9 ee ff ff call 801001e0 <brelse> static void bzero(int dev, int bno) { struct buf *bp; bp = bread(dev, bno); 80101337: 8b 45 d8 mov -0x28(%ebp),%eax 8010133a: 89 5c 24 04 mov %ebx,0x4(%esp) 8010133e: 89 04 24 mov %eax,(%esp) 80101341: e8 8a ed ff ff call 801000d0 <bread> memset(bp->data, 0, BSIZE); 80101346: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) 8010134d: 00 8010134e: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80101355: 00 static void bzero(int dev, int bno) { struct buf *bp; bp = bread(dev, bno); 80101356: 89 c6 mov %eax,%esi memset(bp->data, 0, BSIZE); 80101358: 8d 40 5c lea 0x5c(%eax),%eax 8010135b: 89 04 24 mov %eax,(%esp) 8010135e: e8 dd 2f 00 00 call 80104340 <memset> log_write(bp); 80101363: 89 34 24 mov %esi,(%esp) 80101366: e8 a5 19 00 00 call 80102d10 <log_write> brelse(bp); 8010136b: 89 34 24 mov %esi,(%esp) 8010136e: e8 6d ee ff ff call 801001e0 <brelse> } } brelse(bp); } panic("balloc: out of blocks"); } 80101373: 83 c4 3c add $0x3c,%esp 80101376: 89 d8 mov %ebx,%eax 80101378: 5b pop %ebx 80101379: 5e pop %esi 8010137a: 5f pop %edi 8010137b: 5d pop %ebp 8010137c: c3 ret 8010137d: 8d 76 00 lea 0x0(%esi),%esi 80101380 <bmap.part.0>: // listed in block ip->addrs[NDIRECT]. // Return the disk block address of the nth block in inode ip. // If there is no such block, bmap allocates one. static uint bmap(struct inode *ip, uint bn) 80101380: 55 push %ebp 80101381: 89 e5 mov %esp,%ebp 80101383: 83 ec 38 sub $0x38,%esp 80101386: 89 7d fc mov %edi,-0x4(%ebp) if(bn < NDIRECT){ if((addr = ip->addrs[bn]) == 0) ip->addrs[bn] = addr = balloc(ip->dev); return addr; } bn -= NDIRECT; 80101389: 8d 7a f4 lea -0xc(%edx),%edi if(bn < NINDIRECT){ 8010138c: 83 ff 7f cmp $0x7f,%edi // listed in block ip->addrs[NDIRECT]. // Return the disk block address of the nth block in inode ip. // If there is no such block, bmap allocates one. static uint bmap(struct inode *ip, uint bn) 8010138f: 89 5d f4 mov %ebx,-0xc(%ebp) 80101392: 89 c3 mov %eax,%ebx 80101394: 89 75 f8 mov %esi,-0x8(%ebp) ip->addrs[bn] = addr = balloc(ip->dev); return addr; } bn -= NDIRECT; if(bn < NINDIRECT){ 80101397: 77 66 ja 801013ff <bmap.part.0+0x7f> // Load indirect block, allocating if necessary. if((addr = ip->addrs[NDIRECT]) == 0) 80101399: 8b 80 8c 00 00 00 mov 0x8c(%eax),%eax 8010139f: 85 c0 test %eax,%eax 801013a1: 74 4d je 801013f0 <bmap.part.0+0x70> ip->addrs[NDIRECT] = addr = balloc(ip->dev); bp = bread(ip->dev, addr); 801013a3: 89 44 24 04 mov %eax,0x4(%esp) 801013a7: 8b 03 mov (%ebx),%eax 801013a9: 89 04 24 mov %eax,(%esp) 801013ac: e8 1f ed ff ff call 801000d0 <bread> a = (uint*)bp->data; if((addr = a[bn]) == 0){ 801013b1: 8d 7c b8 5c lea 0x5c(%eax,%edi,4),%edi if(bn < NINDIRECT){ // Load indirect block, allocating if necessary. if((addr = ip->addrs[NDIRECT]) == 0) ip->addrs[NDIRECT] = addr = balloc(ip->dev); bp = bread(ip->dev, addr); 801013b5: 89 c6 mov %eax,%esi a = (uint*)bp->data; if((addr = a[bn]) == 0){ 801013b7: 8b 07 mov (%edi),%eax 801013b9: 85 c0 test %eax,%eax 801013bb: 75 17 jne 801013d4 <bmap.part.0+0x54> a[bn] = addr = balloc(ip->dev); 801013bd: 8b 03 mov (%ebx),%eax 801013bf: e8 9c fe ff ff call 80101260 <balloc> 801013c4: 89 07 mov %eax,(%edi) log_write(bp); 801013c6: 89 45 e4 mov %eax,-0x1c(%ebp) 801013c9: 89 34 24 mov %esi,(%esp) 801013cc: e8 3f 19 00 00 call 80102d10 <log_write> 801013d1: 8b 45 e4 mov -0x1c(%ebp),%eax } brelse(bp); 801013d4: 89 34 24 mov %esi,(%esp) 801013d7: 89 45 e4 mov %eax,-0x1c(%ebp) 801013da: e8 01 ee ff ff call 801001e0 <brelse> return addr; } panic("bmap: out of range"); } 801013df: 8b 45 e4 mov -0x1c(%ebp),%eax 801013e2: 8b 5d f4 mov -0xc(%ebp),%ebx 801013e5: 8b 75 f8 mov -0x8(%ebp),%esi 801013e8: 8b 7d fc mov -0x4(%ebp),%edi 801013eb: 89 ec mov %ebp,%esp 801013ed: 5d pop %ebp 801013ee: c3 ret 801013ef: 90 nop bn -= NDIRECT; if(bn < NINDIRECT){ // Load indirect block, allocating if necessary. if((addr = ip->addrs[NDIRECT]) == 0) ip->addrs[NDIRECT] = addr = balloc(ip->dev); 801013f0: 8b 03 mov (%ebx),%eax 801013f2: e8 69 fe ff ff call 80101260 <balloc> 801013f7: 89 83 8c 00 00 00 mov %eax,0x8c(%ebx) 801013fd: eb a4 jmp 801013a3 <bmap.part.0+0x23> } brelse(bp); return addr; } panic("bmap: out of range"); 801013ff: c7 04 24 38 6e 10 80 movl $0x80106e38,(%esp) 80101406: e8 65 ef ff ff call 80100370 <panic> 8010140b: 90 nop 8010140c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101410 <readsb>: struct superblock sb; // Read the super block. void readsb(int dev, struct superblock *sb) { 80101410: 55 push %ebp 80101411: 89 e5 mov %esp,%ebp 80101413: 83 ec 18 sub $0x18,%esp struct buf *bp; bp = bread(dev, 1); 80101416: 8b 45 08 mov 0x8(%ebp),%eax struct superblock sb; // Read the super block. void readsb(int dev, struct superblock *sb) { 80101419: 89 5d f8 mov %ebx,-0x8(%ebp) 8010141c: 89 75 fc mov %esi,-0x4(%ebp) 8010141f: 8b 75 0c mov 0xc(%ebp),%esi struct buf *bp; bp = bread(dev, 1); 80101422: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) 80101429: 00 8010142a: 89 04 24 mov %eax,(%esp) 8010142d: e8 9e ec ff ff call 801000d0 <bread> memmove(sb, bp->data, sizeof(*sb)); 80101432: 89 34 24 mov %esi,(%esp) 80101435: c7 44 24 08 1c 00 00 movl $0x1c,0x8(%esp) 8010143c: 00 void readsb(int dev, struct superblock *sb) { struct buf *bp; bp = bread(dev, 1); 8010143d: 89 c3 mov %eax,%ebx memmove(sb, bp->data, sizeof(*sb)); 8010143f: 8d 40 5c lea 0x5c(%eax),%eax 80101442: 89 44 24 04 mov %eax,0x4(%esp) 80101446: e8 b5 2f 00 00 call 80104400 <memmove> brelse(bp); } 8010144b: 8b 75 fc mov -0x4(%ebp),%esi { struct buf *bp; bp = bread(dev, 1); memmove(sb, bp->data, sizeof(*sb)); brelse(bp); 8010144e: 89 5d 08 mov %ebx,0x8(%ebp) } 80101451: 8b 5d f8 mov -0x8(%ebp),%ebx 80101454: 89 ec mov %ebp,%esp 80101456: 5d pop %ebp { struct buf *bp; bp = bread(dev, 1); memmove(sb, bp->data, sizeof(*sb)); brelse(bp); 80101457: e9 84 ed ff ff jmp 801001e0 <brelse> 8010145c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101460 <iinit>: struct inode inode[NINODE]; } icache; void iinit(int dev) { 80101460: 55 push %ebp 80101461: 89 e5 mov %esp,%ebp 80101463: 53 push %ebx int i = 0; initlock(&icache.lock, "icache"); for(i = 0; i < NINODE; i++) { 80101464: 31 db xor %ebx,%ebx struct inode inode[NINODE]; } icache; void iinit(int dev) { 80101466: 83 ec 24 sub $0x24,%esp int i = 0; initlock(&icache.lock, "icache"); 80101469: c7 44 24 04 4b 6e 10 movl $0x80106e4b,0x4(%esp) 80101470: 80 80101471: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) 80101478: e8 93 2c 00 00 call 80104110 <initlock> 8010147d: 8d 76 00 lea 0x0(%esi),%esi for(i = 0; i < NINODE; i++) { initsleeplock(&icache.inode[i].lock, "inode"); 80101480: 8d 04 db lea (%ebx,%ebx,8),%eax iinit(int dev) { int i = 0; initlock(&icache.lock, "icache"); for(i = 0; i < NINODE; i++) { 80101483: 83 c3 01 add $0x1,%ebx initsleeplock(&icache.inode[i].lock, "inode"); 80101486: c1 e0 04 shl $0x4,%eax 80101489: 05 20 0a 11 80 add $0x80110a20,%eax 8010148e: c7 44 24 04 52 6e 10 movl $0x80106e52,0x4(%esp) 80101495: 80 80101496: 89 04 24 mov %eax,(%esp) 80101499: e8 42 2b 00 00 call 80103fe0 <initsleeplock> iinit(int dev) { int i = 0; initlock(&icache.lock, "icache"); for(i = 0; i < NINODE; i++) { 8010149e: 83 fb 32 cmp $0x32,%ebx 801014a1: 75 dd jne 80101480 <iinit+0x20> initsleeplock(&icache.inode[i].lock, "inode"); } readsb(dev, &sb); 801014a3: 8b 45 08 mov 0x8(%ebp),%eax 801014a6: c7 44 24 04 c0 09 11 movl $0x801109c0,0x4(%esp) 801014ad: 80 801014ae: 89 04 24 mov %eax,(%esp) 801014b1: e8 5a ff ff ff call 80101410 <readsb> cprintf("sb: size %d nblocks %d ninodes %d nlog %d logstart %d\ 801014b6: a1 d8 09 11 80 mov 0x801109d8,%eax 801014bb: c7 04 24 b8 6e 10 80 movl $0x80106eb8,(%esp) 801014c2: 89 44 24 1c mov %eax,0x1c(%esp) 801014c6: a1 d4 09 11 80 mov 0x801109d4,%eax 801014cb: 89 44 24 18 mov %eax,0x18(%esp) 801014cf: a1 d0 09 11 80 mov 0x801109d0,%eax 801014d4: 89 44 24 14 mov %eax,0x14(%esp) 801014d8: a1 cc 09 11 80 mov 0x801109cc,%eax 801014dd: 89 44 24 10 mov %eax,0x10(%esp) 801014e1: a1 c8 09 11 80 mov 0x801109c8,%eax 801014e6: 89 44 24 0c mov %eax,0xc(%esp) 801014ea: a1 c4 09 11 80 mov 0x801109c4,%eax 801014ef: 89 44 24 08 mov %eax,0x8(%esp) 801014f3: a1 c0 09 11 80 mov 0x801109c0,%eax 801014f8: 89 44 24 04 mov %eax,0x4(%esp) 801014fc: e8 4f f1 ff ff call 80100650 <cprintf> inodestart %d bmap start %d\n", sb.size, sb.nblocks, sb.ninodes, sb.nlog, sb.logstart, sb.inodestart, sb.bmapstart); } 80101501: 83 c4 24 add $0x24,%esp 80101504: 5b pop %ebx 80101505: 5d pop %ebp 80101506: c3 ret 80101507: 89 f6 mov %esi,%esi 80101509: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80101510 <ialloc>: // Allocate an inode on device dev. // Mark it as allocated by giving it type type. // Returns an unlocked but allocated and referenced inode. struct inode* ialloc(uint dev, short type) { 80101510: 55 push %ebp 80101511: 89 e5 mov %esp,%ebp 80101513: 57 push %edi 80101514: 56 push %esi 80101515: 53 push %ebx 80101516: 83 ec 2c sub $0x2c,%esp 80101519: 8b 45 08 mov 0x8(%ebp),%eax int inum; struct buf *bp; struct dinode *dip; for(inum = 1; inum < sb.ninodes; inum++){ 8010151c: 83 3d c8 09 11 80 01 cmpl $0x1,0x801109c8 // Allocate an inode on device dev. // Mark it as allocated by giving it type type. // Returns an unlocked but allocated and referenced inode. struct inode* ialloc(uint dev, short type) { 80101523: 89 45 e4 mov %eax,-0x1c(%ebp) 80101526: 0f b7 45 0c movzwl 0xc(%ebp),%eax 8010152a: 66 89 45 e2 mov %ax,-0x1e(%ebp) int inum; struct buf *bp; struct dinode *dip; for(inum = 1; inum < sb.ninodes; inum++){ 8010152e: 0f 86 95 00 00 00 jbe 801015c9 <ialloc+0xb9> 80101534: be 01 00 00 00 mov $0x1,%esi 80101539: bb 01 00 00 00 mov $0x1,%ebx 8010153e: eb 15 jmp 80101555 <ialloc+0x45> 80101540: 83 c3 01 add $0x1,%ebx dip->type = type; log_write(bp); // mark it allocated on the disk brelse(bp); return iget(dev, inum); } brelse(bp); 80101543: 89 3c 24 mov %edi,(%esp) { int inum; struct buf *bp; struct dinode *dip; for(inum = 1; inum < sb.ninodes; inum++){ 80101546: 89 de mov %ebx,%esi dip->type = type; log_write(bp); // mark it allocated on the disk brelse(bp); return iget(dev, inum); } brelse(bp); 80101548: e8 93 ec ff ff call 801001e0 <brelse> { int inum; struct buf *bp; struct dinode *dip; for(inum = 1; inum < sb.ninodes; inum++){ 8010154d: 3b 1d c8 09 11 80 cmp 0x801109c8,%ebx 80101553: 73 74 jae 801015c9 <ialloc+0xb9> bp = bread(dev, IBLOCK(inum, sb)); 80101555: 89 f0 mov %esi,%eax 80101557: c1 e8 03 shr $0x3,%eax 8010155a: 03 05 d4 09 11 80 add 0x801109d4,%eax 80101560: 89 44 24 04 mov %eax,0x4(%esp) 80101564: 8b 45 e4 mov -0x1c(%ebp),%eax 80101567: 89 04 24 mov %eax,(%esp) 8010156a: e8 61 eb ff ff call 801000d0 <bread> 8010156f: 89 c7 mov %eax,%edi dip = (struct dinode*)bp->data + inum%IPB; 80101571: 89 f0 mov %esi,%eax 80101573: 83 e0 07 and $0x7,%eax 80101576: c1 e0 06 shl $0x6,%eax 80101579: 8d 54 07 5c lea 0x5c(%edi,%eax,1),%edx if(dip->type == 0){ // a free inode 8010157d: 66 83 3a 00 cmpw $0x0,(%edx) 80101581: 75 bd jne 80101540 <ialloc+0x30> memset(dip, 0, sizeof(*dip)); 80101583: 89 14 24 mov %edx,(%esp) 80101586: 89 55 dc mov %edx,-0x24(%ebp) 80101589: c7 44 24 08 40 00 00 movl $0x40,0x8(%esp) 80101590: 00 80101591: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80101598: 00 80101599: e8 a2 2d 00 00 call 80104340 <memset> dip->type = type; 8010159e: 8b 55 dc mov -0x24(%ebp),%edx 801015a1: 0f b7 45 e2 movzwl -0x1e(%ebp),%eax 801015a5: 66 89 02 mov %ax,(%edx) log_write(bp); // mark it allocated on the disk 801015a8: 89 3c 24 mov %edi,(%esp) 801015ab: e8 60 17 00 00 call 80102d10 <log_write> brelse(bp); 801015b0: 89 3c 24 mov %edi,(%esp) 801015b3: e8 28 ec ff ff call 801001e0 <brelse> return iget(dev, inum); 801015b8: 8b 45 e4 mov -0x1c(%ebp),%eax } brelse(bp); } panic("ialloc: no inodes"); } 801015bb: 83 c4 2c add $0x2c,%esp 801015be: 5b pop %ebx if(dip->type == 0){ // a free inode memset(dip, 0, sizeof(*dip)); dip->type = type; log_write(bp); // mark it allocated on the disk brelse(bp); return iget(dev, inum); 801015bf: 89 f2 mov %esi,%edx } brelse(bp); } panic("ialloc: no inodes"); } 801015c1: 5e pop %esi 801015c2: 5f pop %edi 801015c3: 5d pop %ebp if(dip->type == 0){ // a free inode memset(dip, 0, sizeof(*dip)); dip->type = type; log_write(bp); // mark it allocated on the disk brelse(bp); return iget(dev, inum); 801015c4: e9 57 fb ff ff jmp 80101120 <iget> } brelse(bp); } panic("ialloc: no inodes"); 801015c9: c7 04 24 58 6e 10 80 movl $0x80106e58,(%esp) 801015d0: e8 9b ed ff ff call 80100370 <panic> 801015d5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801015d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801015e0 <iupdate>: // Must be called after every change to an ip->xxx field // that lives on disk, since i-node cache is write-through. // Caller must hold ip->lock. void iupdate(struct inode *ip) { 801015e0: 55 push %ebp 801015e1: 89 e5 mov %esp,%ebp 801015e3: 56 push %esi 801015e4: 53 push %ebx 801015e5: 83 ec 10 sub $0x10,%esp 801015e8: 8b 5d 08 mov 0x8(%ebp),%ebx struct buf *bp; struct dinode *dip; bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 801015eb: 8b 43 04 mov 0x4(%ebx),%eax 801015ee: c1 e8 03 shr $0x3,%eax 801015f1: 03 05 d4 09 11 80 add 0x801109d4,%eax 801015f7: 89 44 24 04 mov %eax,0x4(%esp) 801015fb: 8b 03 mov (%ebx),%eax 801015fd: 89 04 24 mov %eax,(%esp) 80101600: e8 cb ea ff ff call 801000d0 <bread> dip = (struct dinode*)bp->data + ip->inum%IPB; dip->type = ip->type; 80101605: 0f b7 53 50 movzwl 0x50(%ebx),%edx iupdate(struct inode *ip) { struct buf *bp; struct dinode *dip; bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 80101609: 89 c6 mov %eax,%esi dip = (struct dinode*)bp->data + ip->inum%IPB; 8010160b: 8b 43 04 mov 0x4(%ebx),%eax 8010160e: 83 e0 07 and $0x7,%eax 80101611: c1 e0 06 shl $0x6,%eax 80101614: 8d 44 06 5c lea 0x5c(%esi,%eax,1),%eax dip->type = ip->type; 80101618: 66 89 10 mov %dx,(%eax) dip->major = ip->major; 8010161b: 0f b7 53 52 movzwl 0x52(%ebx),%edx 8010161f: 66 89 50 02 mov %dx,0x2(%eax) dip->minor = ip->minor; 80101623: 0f b7 53 54 movzwl 0x54(%ebx),%edx 80101627: 66 89 50 04 mov %dx,0x4(%eax) dip->nlink = ip->nlink; 8010162b: 0f b7 53 56 movzwl 0x56(%ebx),%edx 8010162f: 66 89 50 06 mov %dx,0x6(%eax) dip->size = ip->size; 80101633: 8b 53 58 mov 0x58(%ebx),%edx memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); 80101636: 83 c3 5c add $0x5c,%ebx dip = (struct dinode*)bp->data + ip->inum%IPB; dip->type = ip->type; dip->major = ip->major; dip->minor = ip->minor; dip->nlink = ip->nlink; dip->size = ip->size; 80101639: 89 50 08 mov %edx,0x8(%eax) memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); 8010163c: 83 c0 0c add $0xc,%eax 8010163f: 89 5c 24 04 mov %ebx,0x4(%esp) 80101643: c7 44 24 08 34 00 00 movl $0x34,0x8(%esp) 8010164a: 00 8010164b: 89 04 24 mov %eax,(%esp) 8010164e: e8 ad 2d 00 00 call 80104400 <memmove> log_write(bp); 80101653: 89 34 24 mov %esi,(%esp) 80101656: e8 b5 16 00 00 call 80102d10 <log_write> brelse(bp); 8010165b: 89 75 08 mov %esi,0x8(%ebp) } 8010165e: 83 c4 10 add $0x10,%esp 80101661: 5b pop %ebx 80101662: 5e pop %esi 80101663: 5d pop %ebp dip->minor = ip->minor; dip->nlink = ip->nlink; dip->size = ip->size; memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); log_write(bp); brelse(bp); 80101664: e9 77 eb ff ff jmp 801001e0 <brelse> 80101669: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101670 <idup>: // Increment reference count for ip. // Returns ip to enable ip = idup(ip1) idiom. struct inode* idup(struct inode *ip) { 80101670: 55 push %ebp 80101671: 89 e5 mov %esp,%ebp 80101673: 53 push %ebx 80101674: 83 ec 14 sub $0x14,%esp 80101677: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&icache.lock); 8010167a: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) 80101681: e8 fa 2b 00 00 call 80104280 <acquire> ip->ref++; 80101686: 83 43 08 01 addl $0x1,0x8(%ebx) release(&icache.lock); 8010168a: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) 80101691: e8 5a 2c 00 00 call 801042f0 <release> return ip; } 80101696: 83 c4 14 add $0x14,%esp 80101699: 89 d8 mov %ebx,%eax 8010169b: 5b pop %ebx 8010169c: 5d pop %ebp 8010169d: c3 ret 8010169e: 66 90 xchg %ax,%ax 801016a0 <ilock>: // Lock the given inode. // Reads the inode from disk if necessary. void ilock(struct inode *ip) { 801016a0: 55 push %ebp 801016a1: 89 e5 mov %esp,%ebp 801016a3: 56 push %esi 801016a4: 53 push %ebx 801016a5: 83 ec 10 sub $0x10,%esp 801016a8: 8b 5d 08 mov 0x8(%ebp),%ebx struct buf *bp; struct dinode *dip; if(ip == 0 || ip->ref < 1) 801016ab: 85 db test %ebx,%ebx 801016ad: 0f 84 b3 00 00 00 je 80101766 <ilock+0xc6> 801016b3: 8b 4b 08 mov 0x8(%ebx),%ecx 801016b6: 85 c9 test %ecx,%ecx 801016b8: 0f 8e a8 00 00 00 jle 80101766 <ilock+0xc6> panic("ilock"); acquiresleep(&ip->lock); 801016be: 8d 43 0c lea 0xc(%ebx),%eax 801016c1: 89 04 24 mov %eax,(%esp) 801016c4: e8 57 29 00 00 call 80104020 <acquiresleep> if(ip->valid == 0){ 801016c9: 8b 53 4c mov 0x4c(%ebx),%edx 801016cc: 85 d2 test %edx,%edx 801016ce: 74 08 je 801016d8 <ilock+0x38> brelse(bp); ip->valid = 1; if(ip->type == 0) panic("ilock: no type"); } } 801016d0: 83 c4 10 add $0x10,%esp 801016d3: 5b pop %ebx 801016d4: 5e pop %esi 801016d5: 5d pop %ebp 801016d6: c3 ret 801016d7: 90 nop panic("ilock"); acquiresleep(&ip->lock); if(ip->valid == 0){ bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 801016d8: 8b 43 04 mov 0x4(%ebx),%eax 801016db: c1 e8 03 shr $0x3,%eax 801016de: 03 05 d4 09 11 80 add 0x801109d4,%eax 801016e4: 89 44 24 04 mov %eax,0x4(%esp) 801016e8: 8b 03 mov (%ebx),%eax 801016ea: 89 04 24 mov %eax,(%esp) 801016ed: e8 de e9 ff ff call 801000d0 <bread> 801016f2: 89 c6 mov %eax,%esi dip = (struct dinode*)bp->data + ip->inum%IPB; 801016f4: 8b 43 04 mov 0x4(%ebx),%eax 801016f7: 83 e0 07 and $0x7,%eax 801016fa: c1 e0 06 shl $0x6,%eax 801016fd: 8d 44 06 5c lea 0x5c(%esi,%eax,1),%eax ip->type = dip->type; 80101701: 0f b7 10 movzwl (%eax),%edx 80101704: 66 89 53 50 mov %dx,0x50(%ebx) ip->major = dip->major; 80101708: 0f b7 50 02 movzwl 0x2(%eax),%edx 8010170c: 66 89 53 52 mov %dx,0x52(%ebx) ip->minor = dip->minor; 80101710: 0f b7 50 04 movzwl 0x4(%eax),%edx 80101714: 66 89 53 54 mov %dx,0x54(%ebx) ip->nlink = dip->nlink; 80101718: 0f b7 50 06 movzwl 0x6(%eax),%edx 8010171c: 66 89 53 56 mov %dx,0x56(%ebx) ip->size = dip->size; 80101720: 8b 50 08 mov 0x8(%eax),%edx memmove(ip->addrs, dip->addrs, sizeof(ip->addrs)); 80101723: 83 c0 0c add $0xc,%eax dip = (struct dinode*)bp->data + ip->inum%IPB; ip->type = dip->type; ip->major = dip->major; ip->minor = dip->minor; ip->nlink = dip->nlink; ip->size = dip->size; 80101726: 89 53 58 mov %edx,0x58(%ebx) memmove(ip->addrs, dip->addrs, sizeof(ip->addrs)); 80101729: 89 44 24 04 mov %eax,0x4(%esp) 8010172d: 8d 43 5c lea 0x5c(%ebx),%eax 80101730: c7 44 24 08 34 00 00 movl $0x34,0x8(%esp) 80101737: 00 80101738: 89 04 24 mov %eax,(%esp) 8010173b: e8 c0 2c 00 00 call 80104400 <memmove> brelse(bp); 80101740: 89 34 24 mov %esi,(%esp) 80101743: e8 98 ea ff ff call 801001e0 <brelse> ip->valid = 1; if(ip->type == 0) 80101748: 66 83 7b 50 00 cmpw $0x0,0x50(%ebx) ip->minor = dip->minor; ip->nlink = dip->nlink; ip->size = dip->size; memmove(ip->addrs, dip->addrs, sizeof(ip->addrs)); brelse(bp); ip->valid = 1; 8010174d: c7 43 4c 01 00 00 00 movl $0x1,0x4c(%ebx) if(ip->type == 0) 80101754: 0f 85 76 ff ff ff jne 801016d0 <ilock+0x30> panic("ilock: no type"); 8010175a: c7 04 24 70 6e 10 80 movl $0x80106e70,(%esp) 80101761: e8 0a ec ff ff call 80100370 <panic> { struct buf *bp; struct dinode *dip; if(ip == 0 || ip->ref < 1) panic("ilock"); 80101766: c7 04 24 6a 6e 10 80 movl $0x80106e6a,(%esp) 8010176d: e8 fe eb ff ff call 80100370 <panic> 80101772: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101779: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80101780 <iunlock>: } // Unlock the given inode. void iunlock(struct inode *ip) { 80101780: 55 push %ebp 80101781: 89 e5 mov %esp,%ebp 80101783: 83 ec 18 sub $0x18,%esp 80101786: 89 5d f8 mov %ebx,-0x8(%ebp) 80101789: 8b 5d 08 mov 0x8(%ebp),%ebx 8010178c: 89 75 fc mov %esi,-0x4(%ebp) if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) 8010178f: 85 db test %ebx,%ebx 80101791: 74 27 je 801017ba <iunlock+0x3a> 80101793: 8d 73 0c lea 0xc(%ebx),%esi 80101796: 89 34 24 mov %esi,(%esp) 80101799: e8 22 29 00 00 call 801040c0 <holdingsleep> 8010179e: 85 c0 test %eax,%eax 801017a0: 74 18 je 801017ba <iunlock+0x3a> 801017a2: 8b 5b 08 mov 0x8(%ebx),%ebx 801017a5: 85 db test %ebx,%ebx 801017a7: 7e 11 jle 801017ba <iunlock+0x3a> panic("iunlock"); releasesleep(&ip->lock); 801017a9: 89 75 08 mov %esi,0x8(%ebp) } 801017ac: 8b 5d f8 mov -0x8(%ebp),%ebx 801017af: 8b 75 fc mov -0x4(%ebp),%esi 801017b2: 89 ec mov %ebp,%esp 801017b4: 5d pop %ebp iunlock(struct inode *ip) { if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) panic("iunlock"); releasesleep(&ip->lock); 801017b5: e9 c6 28 00 00 jmp 80104080 <releasesleep> // Unlock the given inode. void iunlock(struct inode *ip) { if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) panic("iunlock"); 801017ba: c7 04 24 7f 6e 10 80 movl $0x80106e7f,(%esp) 801017c1: e8 aa eb ff ff call 80100370 <panic> 801017c6: 8d 76 00 lea 0x0(%esi),%esi 801017c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801017d0 <iput>: // to it, free the inode (and its content) on disk. // All calls to iput() must be inside a transaction in // case it has to free the inode. void iput(struct inode *ip) { 801017d0: 55 push %ebp 801017d1: 89 e5 mov %esp,%ebp 801017d3: 83 ec 38 sub $0x38,%esp 801017d6: 89 75 f8 mov %esi,-0x8(%ebp) 801017d9: 8b 75 08 mov 0x8(%ebp),%esi 801017dc: 89 7d fc mov %edi,-0x4(%ebp) 801017df: 89 5d f4 mov %ebx,-0xc(%ebp) acquiresleep(&ip->lock); 801017e2: 8d 7e 0c lea 0xc(%esi),%edi 801017e5: 89 3c 24 mov %edi,(%esp) 801017e8: e8 33 28 00 00 call 80104020 <acquiresleep> if(ip->valid && ip->nlink == 0){ 801017ed: 8b 46 4c mov 0x4c(%esi),%eax 801017f0: 85 c0 test %eax,%eax 801017f2: 74 07 je 801017fb <iput+0x2b> 801017f4: 66 83 7e 56 00 cmpw $0x0,0x56(%esi) 801017f9: 74 35 je 80101830 <iput+0x60> ip->type = 0; iupdate(ip); ip->valid = 0; } } releasesleep(&ip->lock); 801017fb: 89 3c 24 mov %edi,(%esp) 801017fe: e8 7d 28 00 00 call 80104080 <releasesleep> acquire(&icache.lock); 80101803: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) 8010180a: e8 71 2a 00 00 call 80104280 <acquire> ip->ref--; 8010180f: 83 6e 08 01 subl $0x1,0x8(%esi) release(&icache.lock); } 80101813: 8b 5d f4 mov -0xc(%ebp),%ebx } releasesleep(&ip->lock); acquire(&icache.lock); ip->ref--; release(&icache.lock); 80101816: c7 45 08 e0 09 11 80 movl $0x801109e0,0x8(%ebp) } 8010181d: 8b 75 f8 mov -0x8(%ebp),%esi 80101820: 8b 7d fc mov -0x4(%ebp),%edi 80101823: 89 ec mov %ebp,%esp 80101825: 5d pop %ebp } releasesleep(&ip->lock); acquire(&icache.lock); ip->ref--; release(&icache.lock); 80101826: e9 c5 2a 00 00 jmp 801042f0 <release> 8010182b: 90 nop 8010182c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi void iput(struct inode *ip) { acquiresleep(&ip->lock); if(ip->valid && ip->nlink == 0){ acquire(&icache.lock); 80101830: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) 80101837: e8 44 2a 00 00 call 80104280 <acquire> int r = ip->ref; 8010183c: 8b 5e 08 mov 0x8(%esi),%ebx release(&icache.lock); 8010183f: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) 80101846: e8 a5 2a 00 00 call 801042f0 <release> if(r == 1){ 8010184b: 83 fb 01 cmp $0x1,%ebx 8010184e: 75 ab jne 801017fb <iput+0x2b> // If that was the last reference and the inode has no links // to it, free the inode (and its content) on disk. // All calls to iput() must be inside a transaction in // case it has to free the inode. void iput(struct inode *ip) 80101850: 8d 4e 30 lea 0x30(%esi),%ecx acquiresleep(&ip->lock); if(ip->valid && ip->nlink == 0){ acquire(&icache.lock); int r = ip->ref; release(&icache.lock); if(r == 1){ 80101853: 89 f3 mov %esi,%ebx // If that was the last reference and the inode has no links // to it, free the inode (and its content) on disk. // All calls to iput() must be inside a transaction in // case it has to free the inode. void iput(struct inode *ip) 80101855: 89 7d e4 mov %edi,-0x1c(%ebp) 80101858: 89 cf mov %ecx,%edi 8010185a: eb 0b jmp 80101867 <iput+0x97> 8010185c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi uint *a; for(i = 0; i < NDIRECT; i++){ if(ip->addrs[i]){ bfree(ip->dev, ip->addrs[i]); ip->addrs[i] = 0; 80101860: 83 c3 04 add $0x4,%ebx { int i, j; struct buf *bp; uint *a; for(i = 0; i < NDIRECT; i++){ 80101863: 39 fb cmp %edi,%ebx 80101865: 74 19 je 80101880 <iput+0xb0> if(ip->addrs[i]){ 80101867: 8b 53 5c mov 0x5c(%ebx),%edx 8010186a: 85 d2 test %edx,%edx 8010186c: 74 f2 je 80101860 <iput+0x90> bfree(ip->dev, ip->addrs[i]); 8010186e: 8b 06 mov (%esi),%eax 80101870: e8 6b f9 ff ff call 801011e0 <bfree> ip->addrs[i] = 0; 80101875: c7 43 5c 00 00 00 00 movl $0x0,0x5c(%ebx) 8010187c: eb e2 jmp 80101860 <iput+0x90> 8010187e: 66 90 xchg %ax,%ax } } if(ip->addrs[NDIRECT]){ 80101880: 8b 86 8c 00 00 00 mov 0x8c(%esi),%eax 80101886: 8b 7d e4 mov -0x1c(%ebp),%edi 80101889: 85 c0 test %eax,%eax 8010188b: 75 2b jne 801018b8 <iput+0xe8> brelse(bp); bfree(ip->dev, ip->addrs[NDIRECT]); ip->addrs[NDIRECT] = 0; } ip->size = 0; 8010188d: c7 46 58 00 00 00 00 movl $0x0,0x58(%esi) iupdate(ip); 80101894: 89 34 24 mov %esi,(%esp) 80101897: e8 44 fd ff ff call 801015e0 <iupdate> int r = ip->ref; release(&icache.lock); if(r == 1){ // inode has no links and no other references: truncate and free. itrunc(ip); ip->type = 0; 8010189c: 66 c7 46 50 00 00 movw $0x0,0x50(%esi) iupdate(ip); 801018a2: 89 34 24 mov %esi,(%esp) 801018a5: e8 36 fd ff ff call 801015e0 <iupdate> ip->valid = 0; 801018aa: c7 46 4c 00 00 00 00 movl $0x0,0x4c(%esi) 801018b1: e9 45 ff ff ff jmp 801017fb <iput+0x2b> 801018b6: 66 90 xchg %ax,%ax ip->addrs[i] = 0; } } if(ip->addrs[NDIRECT]){ bp = bread(ip->dev, ip->addrs[NDIRECT]); 801018b8: 89 44 24 04 mov %eax,0x4(%esp) 801018bc: 8b 06 mov (%esi),%eax a = (uint*)bp->data; for(j = 0; j < NINDIRECT; j++){ 801018be: 31 db xor %ebx,%ebx ip->addrs[i] = 0; } } if(ip->addrs[NDIRECT]){ bp = bread(ip->dev, ip->addrs[NDIRECT]); 801018c0: 89 04 24 mov %eax,(%esp) 801018c3: e8 08 e8 ff ff call 801000d0 <bread> a = (uint*)bp->data; for(j = 0; j < NINDIRECT; j++){ 801018c8: 89 7d e0 mov %edi,-0x20(%ebp) 801018cb: 89 f7 mov %esi,%edi } } if(ip->addrs[NDIRECT]){ bp = bread(ip->dev, ip->addrs[NDIRECT]); a = (uint*)bp->data; 801018cd: 89 c1 mov %eax,%ecx 801018cf: 83 c1 5c add $0x5c,%ecx ip->addrs[i] = 0; } } if(ip->addrs[NDIRECT]){ bp = bread(ip->dev, ip->addrs[NDIRECT]); 801018d2: 89 45 e4 mov %eax,-0x1c(%ebp) a = (uint*)bp->data; for(j = 0; j < NINDIRECT; j++){ 801018d5: 89 ce mov %ecx,%esi 801018d7: 31 c0 xor %eax,%eax 801018d9: eb 12 jmp 801018ed <iput+0x11d> 801018db: 90 nop 801018dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801018e0: 83 c3 01 add $0x1,%ebx 801018e3: 81 fb 80 00 00 00 cmp $0x80,%ebx 801018e9: 89 d8 mov %ebx,%eax 801018eb: 74 10 je 801018fd <iput+0x12d> if(a[j]) 801018ed: 8b 14 86 mov (%esi,%eax,4),%edx 801018f0: 85 d2 test %edx,%edx 801018f2: 74 ec je 801018e0 <iput+0x110> bfree(ip->dev, a[j]); 801018f4: 8b 07 mov (%edi),%eax 801018f6: e8 e5 f8 ff ff call 801011e0 <bfree> 801018fb: eb e3 jmp 801018e0 <iput+0x110> } brelse(bp); 801018fd: 8b 45 e4 mov -0x1c(%ebp),%eax 80101900: 89 fe mov %edi,%esi 80101902: 8b 7d e0 mov -0x20(%ebp),%edi 80101905: 89 04 24 mov %eax,(%esp) 80101908: e8 d3 e8 ff ff call 801001e0 <brelse> bfree(ip->dev, ip->addrs[NDIRECT]); 8010190d: 8b 96 8c 00 00 00 mov 0x8c(%esi),%edx 80101913: 8b 06 mov (%esi),%eax 80101915: e8 c6 f8 ff ff call 801011e0 <bfree> ip->addrs[NDIRECT] = 0; 8010191a: c7 86 8c 00 00 00 00 movl $0x0,0x8c(%esi) 80101921: 00 00 00 80101924: e9 64 ff ff ff jmp 8010188d <iput+0xbd> 80101929: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101930 <iunlockput>: } // Common idiom: unlock, then put. void iunlockput(struct inode *ip) { 80101930: 55 push %ebp 80101931: 89 e5 mov %esp,%ebp 80101933: 53 push %ebx 80101934: 83 ec 14 sub $0x14,%esp 80101937: 8b 5d 08 mov 0x8(%ebp),%ebx iunlock(ip); 8010193a: 89 1c 24 mov %ebx,(%esp) 8010193d: e8 3e fe ff ff call 80101780 <iunlock> iput(ip); 80101942: 89 5d 08 mov %ebx,0x8(%ebp) } 80101945: 83 c4 14 add $0x14,%esp 80101948: 5b pop %ebx 80101949: 5d pop %ebp // Common idiom: unlock, then put. void iunlockput(struct inode *ip) { iunlock(ip); iput(ip); 8010194a: e9 81 fe ff ff jmp 801017d0 <iput> 8010194f: 90 nop 80101950 <stati>: // Copy stat information from inode. // Caller must hold ip->lock. void stati(struct inode *ip, struct stat *st) { 80101950: 55 push %ebp 80101951: 89 e5 mov %esp,%ebp 80101953: 8b 55 08 mov 0x8(%ebp),%edx 80101956: 8b 45 0c mov 0xc(%ebp),%eax st->dev = ip->dev; 80101959: 8b 0a mov (%edx),%ecx 8010195b: 89 48 04 mov %ecx,0x4(%eax) st->ino = ip->inum; 8010195e: 8b 4a 04 mov 0x4(%edx),%ecx 80101961: 89 48 08 mov %ecx,0x8(%eax) st->type = ip->type; 80101964: 0f b7 4a 50 movzwl 0x50(%edx),%ecx 80101968: 66 89 08 mov %cx,(%eax) st->nlink = ip->nlink; 8010196b: 0f b7 4a 56 movzwl 0x56(%edx),%ecx 8010196f: 66 89 48 0c mov %cx,0xc(%eax) st->size = ip->size; 80101973: 8b 52 58 mov 0x58(%edx),%edx 80101976: 89 50 10 mov %edx,0x10(%eax) } 80101979: 5d pop %ebp 8010197a: c3 ret 8010197b: 90 nop 8010197c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101980 <readi>: //PAGEBREAK! // Read data from inode. // Caller must hold ip->lock. int readi(struct inode *ip, char *dst, uint off, uint n) { 80101980: 55 push %ebp 80101981: 89 e5 mov %esp,%ebp 80101983: 57 push %edi 80101984: 56 push %esi 80101985: 53 push %ebx 80101986: 83 ec 2c sub $0x2c,%esp 80101989: 8b 75 08 mov 0x8(%ebp),%esi 8010198c: 8b 45 0c mov 0xc(%ebp),%eax 8010198f: 8b 55 14 mov 0x14(%ebp),%edx 80101992: 8b 5d 10 mov 0x10(%ebp),%ebx uint tot, m; struct buf *bp; if(ip->type == T_DEV){ 80101995: 66 83 7e 50 03 cmpw $0x3,0x50(%esi) //PAGEBREAK! // Read data from inode. // Caller must hold ip->lock. int readi(struct inode *ip, char *dst, uint off, uint n) { 8010199a: 89 45 e0 mov %eax,-0x20(%ebp) 8010199d: 89 55 dc mov %edx,-0x24(%ebp) uint tot, m; struct buf *bp; if(ip->type == T_DEV){ 801019a0: 0f 84 da 00 00 00 je 80101a80 <readi+0x100> if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read) return -1; return devsw[ip->major].read(ip, dst, n); } if(off > ip->size || off + n < off) 801019a6: 8b 56 58 mov 0x58(%esi),%edx return -1; 801019a9: b8 ff ff ff ff mov $0xffffffff,%eax if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read) return -1; return devsw[ip->major].read(ip, dst, n); } if(off > ip->size || off + n < off) 801019ae: 39 da cmp %ebx,%edx 801019b0: 0f 82 bd 00 00 00 jb 80101a73 <readi+0xf3> 801019b6: 8b 4d dc mov -0x24(%ebp),%ecx 801019b9: 01 d9 add %ebx,%ecx 801019bb: 0f 82 b2 00 00 00 jb 80101a73 <readi+0xf3> return -1; if(off + n > ip->size) n = ip->size - off; 801019c1: 89 d0 mov %edx,%eax 801019c3: 29 d8 sub %ebx,%eax 801019c5: 39 ca cmp %ecx,%edx 801019c7: 0f 43 45 dc cmovae -0x24(%ebp),%eax for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ 801019cb: 85 c0 test %eax,%eax } if(off > ip->size || off + n < off) return -1; if(off + n > ip->size) n = ip->size - off; 801019cd: 89 45 dc mov %eax,-0x24(%ebp) for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ 801019d0: 0f 84 9a 00 00 00 je 80101a70 <readi+0xf0> 801019d6: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) 801019dd: eb 6a jmp 80101a49 <readi+0xc9> 801019df: 90 nop { uint addr, *a; struct buf *bp; if(bn < NDIRECT){ if((addr = ip->addrs[bn]) == 0) 801019e0: 8d 7a 14 lea 0x14(%edx),%edi 801019e3: 8b 44 be 0c mov 0xc(%esi,%edi,4),%eax 801019e7: 85 c0 test %eax,%eax 801019e9: 74 75 je 80101a60 <readi+0xe0> return -1; if(off + n > ip->size) n = ip->size - off; for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ bp = bread(ip->dev, bmap(ip, off/BSIZE)); 801019eb: 89 44 24 04 mov %eax,0x4(%esp) 801019ef: 8b 06 mov (%esi),%eax m = min(n - tot, BSIZE - off%BSIZE); 801019f1: bf 00 02 00 00 mov $0x200,%edi return -1; if(off + n > ip->size) n = ip->size - off; for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ bp = bread(ip->dev, bmap(ip, off/BSIZE)); 801019f6: 89 04 24 mov %eax,(%esp) 801019f9: e8 d2 e6 ff ff call 801000d0 <bread> m = min(n - tot, BSIZE - off%BSIZE); 801019fe: 8b 4d dc mov -0x24(%ebp),%ecx 80101a01: 2b 4d e4 sub -0x1c(%ebp),%ecx return -1; if(off + n > ip->size) n = ip->size - off; for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ bp = bread(ip->dev, bmap(ip, off/BSIZE)); 80101a04: 89 c2 mov %eax,%edx m = min(n - tot, BSIZE - off%BSIZE); 80101a06: 89 d8 mov %ebx,%eax 80101a08: 25 ff 01 00 00 and $0x1ff,%eax 80101a0d: 29 c7 sub %eax,%edi memmove(dst, bp->data + off%BSIZE, m); 80101a0f: 8d 44 02 5c lea 0x5c(%edx,%eax,1),%eax if(off + n > ip->size) n = ip->size - off; for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ bp = bread(ip->dev, bmap(ip, off/BSIZE)); m = min(n - tot, BSIZE - off%BSIZE); 80101a13: 39 cf cmp %ecx,%edi memmove(dst, bp->data + off%BSIZE, m); 80101a15: 89 44 24 04 mov %eax,0x4(%esp) 80101a19: 8b 45 e0 mov -0x20(%ebp),%eax if(off + n > ip->size) n = ip->size - off; for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ bp = bread(ip->dev, bmap(ip, off/BSIZE)); m = min(n - tot, BSIZE - off%BSIZE); 80101a1c: 0f 47 f9 cmova %ecx,%edi memmove(dst, bp->data + off%BSIZE, m); 80101a1f: 89 55 d8 mov %edx,-0x28(%ebp) if(off > ip->size || off + n < off) return -1; if(off + n > ip->size) n = ip->size - off; for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ 80101a22: 01 fb add %edi,%ebx bp = bread(ip->dev, bmap(ip, off/BSIZE)); m = min(n - tot, BSIZE - off%BSIZE); memmove(dst, bp->data + off%BSIZE, m); 80101a24: 89 7c 24 08 mov %edi,0x8(%esp) 80101a28: 89 04 24 mov %eax,(%esp) 80101a2b: e8 d0 29 00 00 call 80104400 <memmove> brelse(bp); 80101a30: 8b 55 d8 mov -0x28(%ebp),%edx 80101a33: 89 14 24 mov %edx,(%esp) 80101a36: e8 a5 e7 ff ff call 801001e0 <brelse> if(off > ip->size || off + n < off) return -1; if(off + n > ip->size) n = ip->size - off; for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ 80101a3b: 01 7d e4 add %edi,-0x1c(%ebp) 80101a3e: 8b 55 e4 mov -0x1c(%ebp),%edx 80101a41: 01 7d e0 add %edi,-0x20(%ebp) 80101a44: 39 55 dc cmp %edx,-0x24(%ebp) 80101a47: 76 27 jbe 80101a70 <readi+0xf0> bp = bread(ip->dev, bmap(ip, off/BSIZE)); 80101a49: 89 da mov %ebx,%edx 80101a4b: c1 ea 09 shr $0x9,%edx bmap(struct inode *ip, uint bn) { uint addr, *a; struct buf *bp; if(bn < NDIRECT){ 80101a4e: 83 fa 0b cmp $0xb,%edx 80101a51: 76 8d jbe 801019e0 <readi+0x60> if((addr = ip->addrs[bn]) == 0) ip->addrs[bn] = addr = balloc(ip->dev); 80101a53: 89 f0 mov %esi,%eax 80101a55: e8 26 f9 ff ff call 80101380 <bmap.part.0> 80101a5a: eb 8f jmp 801019eb <readi+0x6b> 80101a5c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101a60: 8b 06 mov (%esi),%eax 80101a62: e8 f9 f7 ff ff call 80101260 <balloc> 80101a67: 89 44 be 0c mov %eax,0xc(%esi,%edi,4) 80101a6b: e9 7b ff ff ff jmp 801019eb <readi+0x6b> bp = bread(ip->dev, bmap(ip, off/BSIZE)); m = min(n - tot, BSIZE - off%BSIZE); memmove(dst, bp->data + off%BSIZE, m); brelse(bp); } return n; 80101a70: 8b 45 dc mov -0x24(%ebp),%eax } 80101a73: 83 c4 2c add $0x2c,%esp 80101a76: 5b pop %ebx 80101a77: 5e pop %esi 80101a78: 5f pop %edi 80101a79: 5d pop %ebp 80101a7a: c3 ret 80101a7b: 90 nop 80101a7c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi { uint tot, m; struct buf *bp; if(ip->type == T_DEV){ if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read) 80101a80: 0f b7 46 52 movzwl 0x52(%esi),%eax 80101a84: 66 83 f8 09 cmp $0x9,%ax 80101a88: 77 18 ja 80101aa2 <readi+0x122> 80101a8a: 98 cwtl 80101a8b: 8b 04 c5 60 09 11 80 mov -0x7feef6a0(,%eax,8),%eax 80101a92: 85 c0 test %eax,%eax 80101a94: 74 0c je 80101aa2 <readi+0x122> return -1; return devsw[ip->major].read(ip, dst, n); 80101a96: 89 55 10 mov %edx,0x10(%ebp) m = min(n - tot, BSIZE - off%BSIZE); memmove(dst, bp->data + off%BSIZE, m); brelse(bp); } return n; } 80101a99: 83 c4 2c add $0x2c,%esp 80101a9c: 5b pop %ebx 80101a9d: 5e pop %esi 80101a9e: 5f pop %edi 80101a9f: 5d pop %ebp struct buf *bp; if(ip->type == T_DEV){ if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read) return -1; return devsw[ip->major].read(ip, dst, n); 80101aa0: ff e0 jmp *%eax uint tot, m; struct buf *bp; if(ip->type == T_DEV){ if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read) return -1; 80101aa2: b8 ff ff ff ff mov $0xffffffff,%eax 80101aa7: eb ca jmp 80101a73 <readi+0xf3> 80101aa9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101ab0 <writei>: // PAGEBREAK! // Write data to inode. // Caller must hold ip->lock. int writei(struct inode *ip, char *src, uint off, uint n) { 80101ab0: 55 push %ebp 80101ab1: 89 e5 mov %esp,%ebp 80101ab3: 57 push %edi 80101ab4: 56 push %esi 80101ab5: 53 push %ebx 80101ab6: 83 ec 2c sub $0x2c,%esp 80101ab9: 8b 4d 0c mov 0xc(%ebp),%ecx 80101abc: 8b 75 08 mov 0x8(%ebp),%esi 80101abf: 8b 5d 10 mov 0x10(%ebp),%ebx 80101ac2: 89 4d e0 mov %ecx,-0x20(%ebp) 80101ac5: 8b 4d 14 mov 0x14(%ebp),%ecx uint tot, m; struct buf *bp; if(ip->type == T_DEV){ 80101ac8: 66 83 7e 50 03 cmpw $0x3,0x50(%esi) // PAGEBREAK! // Write data to inode. // Caller must hold ip->lock. int writei(struct inode *ip, char *src, uint off, uint n) { 80101acd: 89 4d dc mov %ecx,-0x24(%ebp) uint tot, m; struct buf *bp; if(ip->type == T_DEV){ 80101ad0: 0f 84 f2 00 00 00 je 80101bc8 <writei+0x118> if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write) return -1; return devsw[ip->major].write(ip, src, n); } if(off > ip->size || off + n < off) 80101ad6: 39 5e 58 cmp %ebx,0x58(%esi) return -1; 80101ad9: b8 ff ff ff ff mov $0xffffffff,%eax if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write) return -1; return devsw[ip->major].write(ip, src, n); } if(off > ip->size || off + n < off) 80101ade: 0f 82 d7 00 00 00 jb 80101bbb <writei+0x10b> 80101ae4: 8b 55 dc mov -0x24(%ebp),%edx 80101ae7: 01 da add %ebx,%edx 80101ae9: 0f 82 cc 00 00 00 jb 80101bbb <writei+0x10b> return -1; if(off + n > MAXFILE*BSIZE) 80101aef: 81 fa 00 18 01 00 cmp $0x11800,%edx 80101af5: 0f 87 c0 00 00 00 ja 80101bbb <writei+0x10b> return -1; for(tot=0; tot<n; tot+=m, off+=m, src+=m){ 80101afb: 8b 45 dc mov -0x24(%ebp),%eax 80101afe: 85 c0 test %eax,%eax 80101b00: 0f 84 b2 00 00 00 je 80101bb8 <writei+0x108> 80101b06: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) 80101b0d: eb 75 jmp 80101b84 <writei+0xd4> 80101b0f: 90 nop { uint addr, *a; struct buf *bp; if(bn < NDIRECT){ if((addr = ip->addrs[bn]) == 0) 80101b10: 8d 7a 14 lea 0x14(%edx),%edi 80101b13: 8b 44 be 0c mov 0xc(%esi,%edi,4),%eax 80101b17: 85 c0 test %eax,%eax 80101b19: 74 7d je 80101b98 <writei+0xe8> return -1; if(off + n > MAXFILE*BSIZE) return -1; for(tot=0; tot<n; tot+=m, off+=m, src+=m){ bp = bread(ip->dev, bmap(ip, off/BSIZE)); 80101b1b: 89 44 24 04 mov %eax,0x4(%esp) 80101b1f: 8b 06 mov (%esi),%eax m = min(n - tot, BSIZE - off%BSIZE); 80101b21: bf 00 02 00 00 mov $0x200,%edi return -1; if(off + n > MAXFILE*BSIZE) return -1; for(tot=0; tot<n; tot+=m, off+=m, src+=m){ bp = bread(ip->dev, bmap(ip, off/BSIZE)); 80101b26: 89 04 24 mov %eax,(%esp) 80101b29: e8 a2 e5 ff ff call 801000d0 <bread> m = min(n - tot, BSIZE - off%BSIZE); 80101b2e: 8b 4d dc mov -0x24(%ebp),%ecx 80101b31: 2b 4d e4 sub -0x1c(%ebp),%ecx return -1; if(off + n > MAXFILE*BSIZE) return -1; for(tot=0; tot<n; tot+=m, off+=m, src+=m){ bp = bread(ip->dev, bmap(ip, off/BSIZE)); 80101b34: 89 c2 mov %eax,%edx m = min(n - tot, BSIZE - off%BSIZE); 80101b36: 89 d8 mov %ebx,%eax 80101b38: 25 ff 01 00 00 and $0x1ff,%eax 80101b3d: 29 c7 sub %eax,%edi 80101b3f: 39 cf cmp %ecx,%edi 80101b41: 0f 47 f9 cmova %ecx,%edi memmove(bp->data + off%BSIZE, src, m); 80101b44: 8b 4d e0 mov -0x20(%ebp),%ecx 80101b47: 8d 44 02 5c lea 0x5c(%edx,%eax,1),%eax if(off > ip->size || off + n < off) return -1; if(off + n > MAXFILE*BSIZE) return -1; for(tot=0; tot<n; tot+=m, off+=m, src+=m){ 80101b4b: 01 fb add %edi,%ebx bp = bread(ip->dev, bmap(ip, off/BSIZE)); m = min(n - tot, BSIZE - off%BSIZE); memmove(bp->data + off%BSIZE, src, m); 80101b4d: 89 55 d8 mov %edx,-0x28(%ebp) 80101b50: 89 7c 24 08 mov %edi,0x8(%esp) 80101b54: 89 4c 24 04 mov %ecx,0x4(%esp) 80101b58: 89 04 24 mov %eax,(%esp) 80101b5b: e8 a0 28 00 00 call 80104400 <memmove> log_write(bp); 80101b60: 8b 55 d8 mov -0x28(%ebp),%edx 80101b63: 89 14 24 mov %edx,(%esp) 80101b66: e8 a5 11 00 00 call 80102d10 <log_write> brelse(bp); 80101b6b: 8b 55 d8 mov -0x28(%ebp),%edx 80101b6e: 89 14 24 mov %edx,(%esp) 80101b71: e8 6a e6 ff ff call 801001e0 <brelse> if(off > ip->size || off + n < off) return -1; if(off + n > MAXFILE*BSIZE) return -1; for(tot=0; tot<n; tot+=m, off+=m, src+=m){ 80101b76: 01 7d e4 add %edi,-0x1c(%ebp) 80101b79: 8b 4d e4 mov -0x1c(%ebp),%ecx 80101b7c: 01 7d e0 add %edi,-0x20(%ebp) 80101b7f: 39 4d dc cmp %ecx,-0x24(%ebp) 80101b82: 76 24 jbe 80101ba8 <writei+0xf8> bp = bread(ip->dev, bmap(ip, off/BSIZE)); 80101b84: 89 da mov %ebx,%edx 80101b86: c1 ea 09 shr $0x9,%edx bmap(struct inode *ip, uint bn) { uint addr, *a; struct buf *bp; if(bn < NDIRECT){ 80101b89: 83 fa 0b cmp $0xb,%edx 80101b8c: 76 82 jbe 80101b10 <writei+0x60> if((addr = ip->addrs[bn]) == 0) ip->addrs[bn] = addr = balloc(ip->dev); 80101b8e: 89 f0 mov %esi,%eax 80101b90: e8 eb f7 ff ff call 80101380 <bmap.part.0> 80101b95: eb 84 jmp 80101b1b <writei+0x6b> 80101b97: 90 nop 80101b98: 8b 06 mov (%esi),%eax 80101b9a: e8 c1 f6 ff ff call 80101260 <balloc> 80101b9f: 89 44 be 0c mov %eax,0xc(%esi,%edi,4) 80101ba3: e9 73 ff ff ff jmp 80101b1b <writei+0x6b> memmove(bp->data + off%BSIZE, src, m); log_write(bp); brelse(bp); } if(n > 0 && off > ip->size){ 80101ba8: 39 5e 58 cmp %ebx,0x58(%esi) 80101bab: 73 0b jae 80101bb8 <writei+0x108> ip->size = off; 80101bad: 89 5e 58 mov %ebx,0x58(%esi) iupdate(ip); 80101bb0: 89 34 24 mov %esi,(%esp) 80101bb3: e8 28 fa ff ff call 801015e0 <iupdate> } return n; 80101bb8: 8b 45 dc mov -0x24(%ebp),%eax } 80101bbb: 83 c4 2c add $0x2c,%esp 80101bbe: 5b pop %ebx 80101bbf: 5e pop %esi 80101bc0: 5f pop %edi 80101bc1: 5d pop %ebp 80101bc2: c3 ret 80101bc3: 90 nop 80101bc4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi { uint tot, m; struct buf *bp; if(ip->type == T_DEV){ if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write) 80101bc8: 0f b7 46 52 movzwl 0x52(%esi),%eax 80101bcc: 66 83 f8 09 cmp $0x9,%ax 80101bd0: 77 18 ja 80101bea <writei+0x13a> 80101bd2: 98 cwtl 80101bd3: 8b 04 c5 64 09 11 80 mov -0x7feef69c(,%eax,8),%eax 80101bda: 85 c0 test %eax,%eax 80101bdc: 74 0c je 80101bea <writei+0x13a> return -1; return devsw[ip->major].write(ip, src, n); 80101bde: 89 4d 10 mov %ecx,0x10(%ebp) if(n > 0 && off > ip->size){ ip->size = off; iupdate(ip); } return n; } 80101be1: 83 c4 2c add $0x2c,%esp 80101be4: 5b pop %ebx 80101be5: 5e pop %esi 80101be6: 5f pop %edi 80101be7: 5d pop %ebp struct buf *bp; if(ip->type == T_DEV){ if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write) return -1; return devsw[ip->major].write(ip, src, n); 80101be8: ff e0 jmp *%eax uint tot, m; struct buf *bp; if(ip->type == T_DEV){ if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write) return -1; 80101bea: b8 ff ff ff ff mov $0xffffffff,%eax 80101bef: eb ca jmp 80101bbb <writei+0x10b> 80101bf1: eb 0d jmp 80101c00 <namecmp> 80101bf3: 90 nop 80101bf4: 90 nop 80101bf5: 90 nop 80101bf6: 90 nop 80101bf7: 90 nop 80101bf8: 90 nop 80101bf9: 90 nop 80101bfa: 90 nop 80101bfb: 90 nop 80101bfc: 90 nop 80101bfd: 90 nop 80101bfe: 90 nop 80101bff: 90 nop 80101c00 <namecmp>: //PAGEBREAK! // Directories int namecmp(const char *s, const char *t) { 80101c00: 55 push %ebp 80101c01: 89 e5 mov %esp,%ebp 80101c03: 83 ec 18 sub $0x18,%esp return strncmp(s, t, DIRSIZ); 80101c06: 8b 45 0c mov 0xc(%ebp),%eax 80101c09: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp) 80101c10: 00 80101c11: 89 44 24 04 mov %eax,0x4(%esp) 80101c15: 8b 45 08 mov 0x8(%ebp),%eax 80101c18: 89 04 24 mov %eax,(%esp) 80101c1b: e8 60 28 00 00 call 80104480 <strncmp> } 80101c20: c9 leave 80101c21: c3 ret 80101c22: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101c29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80101c30 <dirlookup>: // Look for a directory entry in a directory. // If found, set *poff to byte offset of entry. struct inode* dirlookup(struct inode *dp, char *name, uint *poff) { 80101c30: 55 push %ebp 80101c31: 89 e5 mov %esp,%ebp 80101c33: 57 push %edi 80101c34: 56 push %esi 80101c35: 53 push %ebx 80101c36: 83 ec 2c sub $0x2c,%esp 80101c39: 8b 5d 08 mov 0x8(%ebp),%ebx uint off, inum; struct dirent de; if(dp->type != T_DIR) 80101c3c: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) 80101c41: 0f 85 8f 00 00 00 jne 80101cd6 <dirlookup+0xa6> panic("dirlookup not DIR"); for(off = 0; off < dp->size; off += sizeof(de)){ 80101c47: 8b 43 58 mov 0x58(%ebx),%eax 80101c4a: 31 f6 xor %esi,%esi 80101c4c: 8d 7d d8 lea -0x28(%ebp),%edi 80101c4f: 85 c0 test %eax,%eax 80101c51: 75 0d jne 80101c60 <dirlookup+0x30> 80101c53: eb 6b jmp 80101cc0 <dirlookup+0x90> 80101c55: 8d 76 00 lea 0x0(%esi),%esi 80101c58: 83 c6 10 add $0x10,%esi 80101c5b: 39 73 58 cmp %esi,0x58(%ebx) 80101c5e: 76 60 jbe 80101cc0 <dirlookup+0x90> if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80101c60: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp) 80101c67: 00 80101c68: 89 74 24 08 mov %esi,0x8(%esp) 80101c6c: 89 7c 24 04 mov %edi,0x4(%esp) 80101c70: 89 1c 24 mov %ebx,(%esp) 80101c73: e8 08 fd ff ff call 80101980 <readi> 80101c78: 83 f8 10 cmp $0x10,%eax 80101c7b: 75 4d jne 80101cca <dirlookup+0x9a> panic("dirlookup read"); if(de.inum == 0) 80101c7d: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp) 80101c82: 74 d4 je 80101c58 <dirlookup+0x28> continue; if(namecmp(name, de.name) == 0){ 80101c84: 8d 45 da lea -0x26(%ebp),%eax 80101c87: 89 44 24 04 mov %eax,0x4(%esp) 80101c8b: 8b 45 0c mov 0xc(%ebp),%eax 80101c8e: 89 04 24 mov %eax,(%esp) 80101c91: e8 6a ff ff ff call 80101c00 <namecmp> 80101c96: 85 c0 test %eax,%eax 80101c98: 75 be jne 80101c58 <dirlookup+0x28> // entry matches path element if(poff) 80101c9a: 8b 45 10 mov 0x10(%ebp),%eax 80101c9d: 85 c0 test %eax,%eax 80101c9f: 74 05 je 80101ca6 <dirlookup+0x76> *poff = off; 80101ca1: 8b 45 10 mov 0x10(%ebp),%eax 80101ca4: 89 30 mov %esi,(%eax) inum = de.inum; 80101ca6: 0f b7 55 d8 movzwl -0x28(%ebp),%edx return iget(dp->dev, inum); 80101caa: 8b 03 mov (%ebx),%eax 80101cac: e8 6f f4 ff ff call 80101120 <iget> } } return 0; } 80101cb1: 83 c4 2c add $0x2c,%esp 80101cb4: 5b pop %ebx 80101cb5: 5e pop %esi 80101cb6: 5f pop %edi 80101cb7: 5d pop %ebp 80101cb8: c3 ret 80101cb9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101cc0: 83 c4 2c add $0x2c,%esp inum = de.inum; return iget(dp->dev, inum); } } return 0; 80101cc3: 31 c0 xor %eax,%eax } 80101cc5: 5b pop %ebx 80101cc6: 5e pop %esi 80101cc7: 5f pop %edi 80101cc8: 5d pop %ebp 80101cc9: c3 ret if(dp->type != T_DIR) panic("dirlookup not DIR"); for(off = 0; off < dp->size; off += sizeof(de)){ if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) panic("dirlookup read"); 80101cca: c7 04 24 99 6e 10 80 movl $0x80106e99,(%esp) 80101cd1: e8 9a e6 ff ff call 80100370 <panic> { uint off, inum; struct dirent de; if(dp->type != T_DIR) panic("dirlookup not DIR"); 80101cd6: c7 04 24 87 6e 10 80 movl $0x80106e87,(%esp) 80101cdd: e8 8e e6 ff ff call 80100370 <panic> 80101ce2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101ce9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80101cf0 <namex>: // If parent != 0, return the inode for the parent and copy the final // path element into name, which must have room for DIRSIZ bytes. // Must be called inside a transaction since it calls iput(). static struct inode* namex(char *path, int nameiparent, char *name) { 80101cf0: 55 push %ebp 80101cf1: 89 e5 mov %esp,%ebp 80101cf3: 57 push %edi 80101cf4: 56 push %esi 80101cf5: 53 push %ebx 80101cf6: 89 c3 mov %eax,%ebx 80101cf8: 83 ec 2c sub $0x2c,%esp struct inode *ip, *next; if(*path == '/') 80101cfb: 80 38 2f cmpb $0x2f,(%eax) // If parent != 0, return the inode for the parent and copy the final // path element into name, which must have room for DIRSIZ bytes. // Must be called inside a transaction since it calls iput(). static struct inode* namex(char *path, int nameiparent, char *name) { 80101cfe: 89 55 e0 mov %edx,-0x20(%ebp) 80101d01: 89 4d e4 mov %ecx,-0x1c(%ebp) struct inode *ip, *next; if(*path == '/') 80101d04: 0f 84 1d 01 00 00 je 80101e27 <namex+0x137> ip = iget(ROOTDEV, ROOTINO); else ip = idup(myproc()->cwd); 80101d0a: e8 21 1a 00 00 call 80103730 <myproc> 80101d0f: 8b 40 68 mov 0x68(%eax),%eax 80101d12: 89 04 24 mov %eax,(%esp) 80101d15: e8 56 f9 ff ff call 80101670 <idup> 80101d1a: 89 c7 mov %eax,%edi 80101d1c: eb 05 jmp 80101d23 <namex+0x33> 80101d1e: 66 90 xchg %ax,%ax { char *s; int len; while(*path == '/') path++; 80101d20: 83 c3 01 add $0x1,%ebx skipelem(char *path, char *name) { char *s; int len; while(*path == '/') 80101d23: 0f b6 03 movzbl (%ebx),%eax 80101d26: 3c 2f cmp $0x2f,%al 80101d28: 74 f6 je 80101d20 <namex+0x30> path++; if(*path == 0) 80101d2a: 84 c0 test %al,%al 80101d2c: 75 1a jne 80101d48 <namex+0x58> return 0; } iunlockput(ip); ip = next; } if(nameiparent){ 80101d2e: 8b 45 e0 mov -0x20(%ebp),%eax 80101d31: 85 c0 test %eax,%eax 80101d33: 0f 85 3b 01 00 00 jne 80101e74 <namex+0x184> iput(ip); return 0; } return ip; } 80101d39: 83 c4 2c add $0x2c,%esp 80101d3c: 89 f8 mov %edi,%eax 80101d3e: 5b pop %ebx 80101d3f: 5e pop %esi 80101d40: 5f pop %edi 80101d41: 5d pop %ebp 80101d42: c3 ret 80101d43: 90 nop 80101d44: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi while(*path == '/') path++; if(*path == 0) return 0; s = path; while(*path != '/' && *path != 0) 80101d48: 0f b6 03 movzbl (%ebx),%eax 80101d4b: 89 de mov %ebx,%esi 80101d4d: 84 c0 test %al,%al 80101d4f: 0f 84 a6 00 00 00 je 80101dfb <namex+0x10b> 80101d55: 3c 2f cmp $0x2f,%al 80101d57: 75 0b jne 80101d64 <namex+0x74> 80101d59: e9 9d 00 00 00 jmp 80101dfb <namex+0x10b> 80101d5e: 66 90 xchg %ax,%ax 80101d60: 3c 2f cmp $0x2f,%al 80101d62: 74 0a je 80101d6e <namex+0x7e> path++; 80101d64: 83 c6 01 add $0x1,%esi while(*path == '/') path++; if(*path == 0) return 0; s = path; while(*path != '/' && *path != 0) 80101d67: 0f b6 06 movzbl (%esi),%eax 80101d6a: 84 c0 test %al,%al 80101d6c: 75 f2 jne 80101d60 <namex+0x70> 80101d6e: 89 f2 mov %esi,%edx 80101d70: 29 da sub %ebx,%edx path++; len = path - s; if(len >= DIRSIZ) 80101d72: 83 fa 0d cmp $0xd,%edx 80101d75: 0f 8e 85 00 00 00 jle 80101e00 <namex+0x110> memmove(name, s, DIRSIZ); 80101d7b: 8b 45 e4 mov -0x1c(%ebp),%eax 80101d7e: 89 5c 24 04 mov %ebx,0x4(%esp) path++; if(*path == 0) return 0; s = path; while(*path != '/' && *path != 0) path++; 80101d82: 89 f3 mov %esi,%ebx len = path - s; if(len >= DIRSIZ) memmove(name, s, DIRSIZ); 80101d84: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp) 80101d8b: 00 80101d8c: 89 04 24 mov %eax,(%esp) 80101d8f: e8 6c 26 00 00 call 80104400 <memmove> else { memmove(name, s, len); name[len] = 0; } while(*path == '/') 80101d94: 80 3e 2f cmpb $0x2f,(%esi) 80101d97: 75 0f jne 80101da8 <namex+0xb8> 80101d99: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi path++; 80101da0: 83 c3 01 add $0x1,%ebx memmove(name, s, DIRSIZ); else { memmove(name, s, len); name[len] = 0; } while(*path == '/') 80101da3: 80 3b 2f cmpb $0x2f,(%ebx) 80101da6: 74 f8 je 80101da0 <namex+0xb0> if(*path == '/') ip = iget(ROOTDEV, ROOTINO); else ip = idup(myproc()->cwd); while((path = skipelem(path, name)) != 0){ 80101da8: 85 db test %ebx,%ebx 80101daa: 74 82 je 80101d2e <namex+0x3e> ilock(ip); 80101dac: 89 3c 24 mov %edi,(%esp) 80101daf: e8 ec f8 ff ff call 801016a0 <ilock> if(ip->type != T_DIR){ 80101db4: 66 83 7f 50 01 cmpw $0x1,0x50(%edi) 80101db9: 0f 85 7e 00 00 00 jne 80101e3d <namex+0x14d> iunlockput(ip); return 0; } if(nameiparent && *path == '\0'){ 80101dbf: 8b 45 e0 mov -0x20(%ebp),%eax 80101dc2: 85 c0 test %eax,%eax 80101dc4: 74 09 je 80101dcf <namex+0xdf> 80101dc6: 80 3b 00 cmpb $0x0,(%ebx) 80101dc9: 0f 84 93 00 00 00 je 80101e62 <namex+0x172> // Stop one level early. iunlock(ip); return ip; } if((next = dirlookup(ip, name, 0)) == 0){ 80101dcf: 8b 45 e4 mov -0x1c(%ebp),%eax 80101dd2: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 80101dd9: 00 80101dda: 89 3c 24 mov %edi,(%esp) 80101ddd: 89 44 24 04 mov %eax,0x4(%esp) 80101de1: e8 4a fe ff ff call 80101c30 <dirlookup> iunlockput(ip); 80101de6: 89 3c 24 mov %edi,(%esp) if(nameiparent && *path == '\0'){ // Stop one level early. iunlock(ip); return ip; } if((next = dirlookup(ip, name, 0)) == 0){ 80101de9: 85 c0 test %eax,%eax 80101deb: 89 c6 mov %eax,%esi 80101ded: 74 62 je 80101e51 <namex+0x161> iunlockput(ip); return 0; } iunlockput(ip); 80101def: e8 3c fb ff ff call 80101930 <iunlockput> ip = next; 80101df4: 89 f7 mov %esi,%edi 80101df6: e9 28 ff ff ff jmp 80101d23 <namex+0x33> while(*path == '/') path++; if(*path == 0) return 0; s = path; while(*path != '/' && *path != 0) 80101dfb: 31 d2 xor %edx,%edx 80101dfd: 8d 76 00 lea 0x0(%esi),%esi path++; len = path - s; if(len >= DIRSIZ) memmove(name, s, DIRSIZ); else { memmove(name, s, len); 80101e00: 8b 45 e4 mov -0x1c(%ebp),%eax 80101e03: 89 54 24 08 mov %edx,0x8(%esp) 80101e07: 89 5c 24 04 mov %ebx,0x4(%esp) name[len] = 0; 80101e0b: 89 f3 mov %esi,%ebx path++; len = path - s; if(len >= DIRSIZ) memmove(name, s, DIRSIZ); else { memmove(name, s, len); 80101e0d: 89 55 dc mov %edx,-0x24(%ebp) 80101e10: 89 04 24 mov %eax,(%esp) 80101e13: e8 e8 25 00 00 call 80104400 <memmove> name[len] = 0; 80101e18: 8b 55 dc mov -0x24(%ebp),%edx 80101e1b: 8b 45 e4 mov -0x1c(%ebp),%eax 80101e1e: c6 04 10 00 movb $0x0,(%eax,%edx,1) 80101e22: e9 6d ff ff ff jmp 80101d94 <namex+0xa4> namex(char *path, int nameiparent, char *name) { struct inode *ip, *next; if(*path == '/') ip = iget(ROOTDEV, ROOTINO); 80101e27: ba 01 00 00 00 mov $0x1,%edx 80101e2c: b8 01 00 00 00 mov $0x1,%eax 80101e31: e8 ea f2 ff ff call 80101120 <iget> 80101e36: 89 c7 mov %eax,%edi 80101e38: e9 e6 fe ff ff jmp 80101d23 <namex+0x33> ip = idup(myproc()->cwd); while((path = skipelem(path, name)) != 0){ ilock(ip); if(ip->type != T_DIR){ iunlockput(ip); 80101e3d: 89 3c 24 mov %edi,(%esp) return 0; 80101e40: 31 ff xor %edi,%edi ip = idup(myproc()->cwd); while((path = skipelem(path, name)) != 0){ ilock(ip); if(ip->type != T_DIR){ iunlockput(ip); 80101e42: e8 e9 fa ff ff call 80101930 <iunlockput> if(nameiparent){ iput(ip); return 0; } return ip; } 80101e47: 83 c4 2c add $0x2c,%esp 80101e4a: 89 f8 mov %edi,%eax 80101e4c: 5b pop %ebx 80101e4d: 5e pop %esi 80101e4e: 5f pop %edi 80101e4f: 5d pop %ebp 80101e50: c3 ret // Stop one level early. iunlock(ip); return ip; } if((next = dirlookup(ip, name, 0)) == 0){ iunlockput(ip); 80101e51: e8 da fa ff ff call 80101930 <iunlockput> return 0; 80101e56: 31 ff xor %edi,%edi if(nameiparent){ iput(ip); return 0; } return ip; } 80101e58: 83 c4 2c add $0x2c,%esp 80101e5b: 5b pop %ebx 80101e5c: 89 f8 mov %edi,%eax 80101e5e: 5e pop %esi 80101e5f: 5f pop %edi 80101e60: 5d pop %ebp 80101e61: c3 ret iunlockput(ip); return 0; } if(nameiparent && *path == '\0'){ // Stop one level early. iunlock(ip); 80101e62: 89 3c 24 mov %edi,(%esp) 80101e65: e8 16 f9 ff ff call 80101780 <iunlock> if(nameiparent){ iput(ip); return 0; } return ip; } 80101e6a: 83 c4 2c add $0x2c,%esp 80101e6d: 89 f8 mov %edi,%eax 80101e6f: 5b pop %ebx 80101e70: 5e pop %esi 80101e71: 5f pop %edi 80101e72: 5d pop %ebp 80101e73: c3 ret } iunlockput(ip); ip = next; } if(nameiparent){ iput(ip); 80101e74: 89 3c 24 mov %edi,(%esp) return 0; 80101e77: 31 ff xor %edi,%edi } iunlockput(ip); ip = next; } if(nameiparent){ iput(ip); 80101e79: e8 52 f9 ff ff call 801017d0 <iput> return 0; 80101e7e: e9 b6 fe ff ff jmp 80101d39 <namex+0x49> 80101e83: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80101e89: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80101e90 <dirlink>: } // Write a new directory entry (name, inum) into the directory dp. int dirlink(struct inode *dp, char *name, uint inum) { 80101e90: 55 push %ebp 80101e91: 89 e5 mov %esp,%ebp 80101e93: 57 push %edi 80101e94: 56 push %esi 80101e95: 53 push %ebx 80101e96: 83 ec 2c sub $0x2c,%esp 80101e99: 8b 75 08 mov 0x8(%ebp),%esi int off; struct dirent de; struct inode *ip; // Check that name is not present. if((ip = dirlookup(dp, name, 0)) != 0){ 80101e9c: 8b 45 0c mov 0xc(%ebp),%eax 80101e9f: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 80101ea6: 00 80101ea7: 89 34 24 mov %esi,(%esp) 80101eaa: 89 44 24 04 mov %eax,0x4(%esp) 80101eae: e8 7d fd ff ff call 80101c30 <dirlookup> 80101eb3: 85 c0 test %eax,%eax 80101eb5: 0f 85 89 00 00 00 jne 80101f44 <dirlink+0xb4> iput(ip); return -1; } // Look for an empty dirent. for(off = 0; off < dp->size; off += sizeof(de)){ 80101ebb: 8b 56 58 mov 0x58(%esi),%edx 80101ebe: 31 db xor %ebx,%ebx 80101ec0: 8d 7d d8 lea -0x28(%ebp),%edi 80101ec3: 85 d2 test %edx,%edx 80101ec5: 75 11 jne 80101ed8 <dirlink+0x48> 80101ec7: eb 33 jmp 80101efc <dirlink+0x6c> 80101ec9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101ed0: 83 c3 10 add $0x10,%ebx 80101ed3: 39 5e 58 cmp %ebx,0x58(%esi) 80101ed6: 76 24 jbe 80101efc <dirlink+0x6c> if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80101ed8: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp) 80101edf: 00 80101ee0: 89 5c 24 08 mov %ebx,0x8(%esp) 80101ee4: 89 7c 24 04 mov %edi,0x4(%esp) 80101ee8: 89 34 24 mov %esi,(%esp) 80101eeb: e8 90 fa ff ff call 80101980 <readi> 80101ef0: 83 f8 10 cmp $0x10,%eax 80101ef3: 75 5e jne 80101f53 <dirlink+0xc3> panic("dirlink read"); if(de.inum == 0) 80101ef5: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp) 80101efa: 75 d4 jne 80101ed0 <dirlink+0x40> break; } strncpy(de.name, name, DIRSIZ); 80101efc: 8b 45 0c mov 0xc(%ebp),%eax 80101eff: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp) 80101f06: 00 80101f07: 89 44 24 04 mov %eax,0x4(%esp) 80101f0b: 8d 45 da lea -0x26(%ebp),%eax 80101f0e: 89 04 24 mov %eax,(%esp) 80101f11: e8 ca 25 00 00 call 801044e0 <strncpy> de.inum = inum; 80101f16: 8b 45 10 mov 0x10(%ebp),%eax if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80101f19: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp) 80101f20: 00 80101f21: 89 5c 24 08 mov %ebx,0x8(%esp) 80101f25: 89 7c 24 04 mov %edi,0x4(%esp) if(de.inum == 0) break; } strncpy(de.name, name, DIRSIZ); de.inum = inum; 80101f29: 66 89 45 d8 mov %ax,-0x28(%ebp) if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80101f2d: 89 34 24 mov %esi,(%esp) 80101f30: e8 7b fb ff ff call 80101ab0 <writei> 80101f35: 83 f8 10 cmp $0x10,%eax 80101f38: 75 25 jne 80101f5f <dirlink+0xcf> panic("dirlink"); return 0; 80101f3a: 31 c0 xor %eax,%eax } 80101f3c: 83 c4 2c add $0x2c,%esp 80101f3f: 5b pop %ebx 80101f40: 5e pop %esi 80101f41: 5f pop %edi 80101f42: 5d pop %ebp 80101f43: c3 ret struct dirent de; struct inode *ip; // Check that name is not present. if((ip = dirlookup(dp, name, 0)) != 0){ iput(ip); 80101f44: 89 04 24 mov %eax,(%esp) 80101f47: e8 84 f8 ff ff call 801017d0 <iput> return -1; 80101f4c: b8 ff ff ff ff mov $0xffffffff,%eax 80101f51: eb e9 jmp 80101f3c <dirlink+0xac> } // Look for an empty dirent. for(off = 0; off < dp->size; off += sizeof(de)){ if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) panic("dirlink read"); 80101f53: c7 04 24 a8 6e 10 80 movl $0x80106ea8,(%esp) 80101f5a: e8 11 e4 ff ff call 80100370 <panic> } strncpy(de.name, name, DIRSIZ); de.inum = inum; if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) panic("dirlink"); 80101f5f: c7 04 24 7e 74 10 80 movl $0x8010747e,(%esp) 80101f66: e8 05 e4 ff ff call 80100370 <panic> 80101f6b: 90 nop 80101f6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101f70 <namei>: return ip; } struct inode* namei(char *path) { 80101f70: 55 push %ebp char name[DIRSIZ]; return namex(path, 0, name); 80101f71: 31 d2 xor %edx,%edx return ip; } struct inode* namei(char *path) { 80101f73: 89 e5 mov %esp,%ebp 80101f75: 83 ec 18 sub $0x18,%esp char name[DIRSIZ]; return namex(path, 0, name); 80101f78: 8b 45 08 mov 0x8(%ebp),%eax 80101f7b: 8d 4d ea lea -0x16(%ebp),%ecx 80101f7e: e8 6d fd ff ff call 80101cf0 <namex> } 80101f83: c9 leave 80101f84: c3 ret 80101f85: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101f89: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80101f90 <nameiparent>: struct inode* nameiparent(char *path, char *name) { 80101f90: 55 push %ebp return namex(path, 1, name); 80101f91: ba 01 00 00 00 mov $0x1,%edx return namex(path, 0, name); } struct inode* nameiparent(char *path, char *name) { 80101f96: 89 e5 mov %esp,%ebp return namex(path, 1, name); 80101f98: 8b 4d 0c mov 0xc(%ebp),%ecx 80101f9b: 8b 45 08 mov 0x8(%ebp),%eax } 80101f9e: 5d pop %ebp } struct inode* nameiparent(char *path, char *name) { return namex(path, 1, name); 80101f9f: e9 4c fd ff ff jmp 80101cf0 <namex> ... 80101fb0 <idestart>: } // Start the request for b. Caller must hold idelock. static void idestart(struct buf *b) { 80101fb0: 55 push %ebp 80101fb1: 89 e5 mov %esp,%ebp 80101fb3: 56 push %esi 80101fb4: 89 c6 mov %eax,%esi 80101fb6: 53 push %ebx 80101fb7: 83 ec 10 sub $0x10,%esp if(b == 0) 80101fba: 85 c0 test %eax,%eax 80101fbc: 0f 84 99 00 00 00 je 8010205b <idestart+0xab> panic("idestart"); if(b->blockno >= FSSIZE) 80101fc2: 8b 48 08 mov 0x8(%eax),%ecx 80101fc5: 81 f9 e7 03 00 00 cmp $0x3e7,%ecx 80101fcb: 0f 87 7e 00 00 00 ja 8010204f <idestart+0x9f> static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80101fd1: ba f7 01 00 00 mov $0x1f7,%edx 80101fd6: 66 90 xchg %ax,%ax 80101fd8: ec in (%dx),%al static int idewait(int checkerr) { int r; while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) 80101fd9: 25 c0 00 00 00 and $0xc0,%eax 80101fde: 83 f8 40 cmp $0x40,%eax 80101fe1: 75 f5 jne 80101fd8 <idestart+0x28> } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80101fe3: 31 db xor %ebx,%ebx 80101fe5: ba f6 03 00 00 mov $0x3f6,%edx 80101fea: 89 d8 mov %ebx,%eax 80101fec: ee out %al,(%dx) 80101fed: ba f2 01 00 00 mov $0x1f2,%edx 80101ff2: b8 01 00 00 00 mov $0x1,%eax 80101ff7: ee out %al,(%dx) 80101ff8: b2 f3 mov $0xf3,%dl 80101ffa: 89 c8 mov %ecx,%eax 80101ffc: ee out %al,(%dx) idewait(0); outb(0x3f6, 0); // generate interrupt outb(0x1f2, sector_per_block); // number of sectors outb(0x1f3, sector & 0xff); outb(0x1f4, (sector >> 8) & 0xff); 80101ffd: 89 c8 mov %ecx,%eax 80101fff: b2 f4 mov $0xf4,%dl 80102001: c1 f8 08 sar $0x8,%eax 80102004: ee out %al,(%dx) 80102005: b2 f5 mov $0xf5,%dl 80102007: 89 d8 mov %ebx,%eax 80102009: ee out %al,(%dx) outb(0x1f5, (sector >> 16) & 0xff); outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((sector>>24)&0x0f)); 8010200a: 8b 46 04 mov 0x4(%esi),%eax 8010200d: b2 f6 mov $0xf6,%dl 8010200f: 83 e0 01 and $0x1,%eax 80102012: c1 e0 04 shl $0x4,%eax 80102015: 83 c8 e0 or $0xffffffe0,%eax 80102018: ee out %al,(%dx) if(b->flags & B_DIRTY){ 80102019: f6 06 04 testb $0x4,(%esi) 8010201c: 75 12 jne 80102030 <idestart+0x80> 8010201e: ba f7 01 00 00 mov $0x1f7,%edx 80102023: b8 20 00 00 00 mov $0x20,%eax 80102028: ee out %al,(%dx) outb(0x1f7, write_cmd); outsl(0x1f0, b->data, BSIZE/4); } else { outb(0x1f7, read_cmd); } } 80102029: 83 c4 10 add $0x10,%esp 8010202c: 5b pop %ebx 8010202d: 5e pop %esi 8010202e: 5d pop %ebp 8010202f: c3 ret 80102030: b2 f7 mov $0xf7,%dl 80102032: b8 30 00 00 00 mov $0x30,%eax 80102037: ee out %al,(%dx) } static inline void outsl(int port, const void *addr, int cnt) { asm volatile("cld; rep outsl" : 80102038: b9 80 00 00 00 mov $0x80,%ecx outb(0x1f4, (sector >> 8) & 0xff); outb(0x1f5, (sector >> 16) & 0xff); outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((sector>>24)&0x0f)); if(b->flags & B_DIRTY){ outb(0x1f7, write_cmd); outsl(0x1f0, b->data, BSIZE/4); 8010203d: 83 c6 5c add $0x5c,%esi 80102040: ba f0 01 00 00 mov $0x1f0,%edx 80102045: fc cld 80102046: f3 6f rep outsl %ds:(%esi),(%dx) } else { outb(0x1f7, read_cmd); } } 80102048: 83 c4 10 add $0x10,%esp 8010204b: 5b pop %ebx 8010204c: 5e pop %esi 8010204d: 5d pop %ebp 8010204e: c3 ret idestart(struct buf *b) { if(b == 0) panic("idestart"); if(b->blockno >= FSSIZE) panic("incorrect blockno"); 8010204f: c7 04 24 14 6f 10 80 movl $0x80106f14,(%esp) 80102056: e8 15 e3 ff ff call 80100370 <panic> // Start the request for b. Caller must hold idelock. static void idestart(struct buf *b) { if(b == 0) panic("idestart"); 8010205b: c7 04 24 0b 6f 10 80 movl $0x80106f0b,(%esp) 80102062: e8 09 e3 ff ff call 80100370 <panic> 80102067: 89 f6 mov %esi,%esi 80102069: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80102070 <ideinit>: return 0; } void ideinit(void) { 80102070: 55 push %ebp 80102071: 89 e5 mov %esp,%ebp 80102073: 83 ec 18 sub $0x18,%esp int i; initlock(&idelock, "ide"); 80102076: c7 44 24 04 26 6f 10 movl $0x80106f26,0x4(%esp) 8010207d: 80 8010207e: c7 04 24 60 a5 10 80 movl $0x8010a560,(%esp) 80102085: e8 86 20 00 00 call 80104110 <initlock> ioapicenable(IRQ_IDE, ncpu - 1); 8010208a: a1 00 2d 11 80 mov 0x80112d00,%eax 8010208f: c7 04 24 0e 00 00 00 movl $0xe,(%esp) 80102096: 83 e8 01 sub $0x1,%eax 80102099: 89 44 24 04 mov %eax,0x4(%esp) 8010209d: e8 5e 02 00 00 call 80102300 <ioapicenable> static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801020a2: ba f7 01 00 00 mov $0x1f7,%edx 801020a7: 90 nop 801020a8: ec in (%dx),%al static int idewait(int checkerr) { int r; while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) 801020a9: 25 c0 00 00 00 and $0xc0,%eax 801020ae: 83 f8 40 cmp $0x40,%eax 801020b1: 75 f5 jne 801020a8 <ideinit+0x38> } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801020b3: ba f6 01 00 00 mov $0x1f6,%edx 801020b8: b8 f0 ff ff ff mov $0xfffffff0,%eax 801020bd: ee out %al,(%dx) 801020be: b9 e8 03 00 00 mov $0x3e8,%ecx static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801020c3: b2 f7 mov $0xf7,%dl 801020c5: eb 06 jmp 801020cd <ideinit+0x5d> 801020c7: 90 nop ioapicenable(IRQ_IDE, ncpu - 1); idewait(0); // Check if disk 1 is present outb(0x1f6, 0xe0 | (1<<4)); for(i=0; i<1000; i++){ 801020c8: 83 e9 01 sub $0x1,%ecx 801020cb: 74 0f je 801020dc <ideinit+0x6c> 801020cd: ec in (%dx),%al if(inb(0x1f7) != 0){ 801020ce: 84 c0 test %al,%al 801020d0: 74 f6 je 801020c8 <ideinit+0x58> havedisk1 = 1; 801020d2: c7 05 94 a5 10 80 01 movl $0x1,0x8010a594 801020d9: 00 00 00 } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801020dc: ba f6 01 00 00 mov $0x1f6,%edx 801020e1: b8 e0 ff ff ff mov $0xffffffe0,%eax 801020e6: ee out %al,(%dx) } } // Switch back to disk 0. outb(0x1f6, 0xe0 | (0<<4)); } 801020e7: c9 leave 801020e8: c3 ret 801020e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801020f0 <ideintr>: } // Interrupt handler. void ideintr(void) { 801020f0: 55 push %ebp 801020f1: 89 e5 mov %esp,%ebp 801020f3: 57 push %edi 801020f4: 53 push %ebx 801020f5: 83 ec 10 sub $0x10,%esp struct buf *b; // First queued buffer is the active request. acquire(&idelock); 801020f8: c7 04 24 60 a5 10 80 movl $0x8010a560,(%esp) 801020ff: e8 7c 21 00 00 call 80104280 <acquire> if((b = idequeue) == 0){ 80102104: 8b 1d 98 a5 10 80 mov 0x8010a598,%ebx 8010210a: 85 db test %ebx,%ebx 8010210c: 74 2d je 8010213b <ideintr+0x4b> release(&idelock); return; } idequeue = b->qnext; 8010210e: 8b 43 58 mov 0x58(%ebx),%eax 80102111: a3 98 a5 10 80 mov %eax,0x8010a598 // Read data if needed. if(!(b->flags & B_DIRTY) && idewait(1) >= 0) 80102116: 8b 0b mov (%ebx),%ecx 80102118: f6 c1 04 test $0x4,%cl 8010211b: 74 33 je 80102150 <ideintr+0x60> insl(0x1f0, b->data, BSIZE/4); // Wake process waiting for this buf. b->flags |= B_VALID; 8010211d: 83 c9 02 or $0x2,%ecx b->flags &= ~B_DIRTY; 80102120: 83 e1 fb and $0xfffffffb,%ecx 80102123: 89 0b mov %ecx,(%ebx) wakeup(b); 80102125: 89 1c 24 mov %ebx,(%esp) 80102128: e8 03 1d 00 00 call 80103e30 <wakeup> // Start disk on next buf in queue. if(idequeue != 0) 8010212d: a1 98 a5 10 80 mov 0x8010a598,%eax 80102132: 85 c0 test %eax,%eax 80102134: 74 05 je 8010213b <ideintr+0x4b> idestart(idequeue); 80102136: e8 75 fe ff ff call 80101fb0 <idestart> release(&idelock); 8010213b: c7 04 24 60 a5 10 80 movl $0x8010a560,(%esp) 80102142: e8 a9 21 00 00 call 801042f0 <release> } 80102147: 83 c4 10 add $0x10,%esp 8010214a: 5b pop %ebx 8010214b: 5f pop %edi 8010214c: 5d pop %ebp 8010214d: c3 ret 8010214e: 66 90 xchg %ax,%ax static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102150: ba f7 01 00 00 mov $0x1f7,%edx 80102155: 8d 76 00 lea 0x0(%esi),%esi 80102158: ec in (%dx),%al static int idewait(int checkerr) { int r; while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) 80102159: 0f b6 c0 movzbl %al,%eax 8010215c: 89 c7 mov %eax,%edi 8010215e: 81 e7 c0 00 00 00 and $0xc0,%edi 80102164: 83 ff 40 cmp $0x40,%edi 80102167: 75 ef jne 80102158 <ideintr+0x68> ; if(checkerr && (r & (IDE_DF|IDE_ERR)) != 0) 80102169: a8 21 test $0x21,%al 8010216b: 75 b0 jne 8010211d <ideintr+0x2d> } idequeue = b->qnext; // Read data if needed. if(!(b->flags & B_DIRTY) && idewait(1) >= 0) insl(0x1f0, b->data, BSIZE/4); 8010216d: 8d 7b 5c lea 0x5c(%ebx),%edi } static inline void insl(int port, void *addr, int cnt) { asm volatile("cld; rep insl" : 80102170: b9 80 00 00 00 mov $0x80,%ecx 80102175: ba f0 01 00 00 mov $0x1f0,%edx 8010217a: fc cld 8010217b: f3 6d rep insl (%dx),%es:(%edi) 8010217d: 8b 0b mov (%ebx),%ecx 8010217f: eb 9c jmp 8010211d <ideintr+0x2d> 80102181: eb 0d jmp 80102190 <iderw> 80102183: 90 nop 80102184: 90 nop 80102185: 90 nop 80102186: 90 nop 80102187: 90 nop 80102188: 90 nop 80102189: 90 nop 8010218a: 90 nop 8010218b: 90 nop 8010218c: 90 nop 8010218d: 90 nop 8010218e: 90 nop 8010218f: 90 nop 80102190 <iderw>: // Sync buf with disk. // If B_DIRTY is set, write buf to disk, clear B_DIRTY, set B_VALID. // Else if B_VALID is not set, read buf from disk, set B_VALID. void iderw(struct buf *b) { 80102190: 55 push %ebp 80102191: 89 e5 mov %esp,%ebp 80102193: 53 push %ebx 80102194: 83 ec 14 sub $0x14,%esp 80102197: 8b 5d 08 mov 0x8(%ebp),%ebx struct buf **pp; if(!holdingsleep(&b->lock)) 8010219a: 8d 43 0c lea 0xc(%ebx),%eax 8010219d: 89 04 24 mov %eax,(%esp) 801021a0: e8 1b 1f 00 00 call 801040c0 <holdingsleep> 801021a5: 85 c0 test %eax,%eax 801021a7: 0f 84 8f 00 00 00 je 8010223c <iderw+0xac> panic("iderw: buf not locked"); if((b->flags & (B_VALID|B_DIRTY)) == B_VALID) 801021ad: 8b 03 mov (%ebx),%eax 801021af: 83 e0 06 and $0x6,%eax 801021b2: 83 f8 02 cmp $0x2,%eax 801021b5: 0f 84 99 00 00 00 je 80102254 <iderw+0xc4> panic("iderw: nothing to do"); if(b->dev != 0 && !havedisk1) 801021bb: 8b 53 04 mov 0x4(%ebx),%edx 801021be: 85 d2 test %edx,%edx 801021c0: 74 09 je 801021cb <iderw+0x3b> 801021c2: a1 94 a5 10 80 mov 0x8010a594,%eax 801021c7: 85 c0 test %eax,%eax 801021c9: 74 7d je 80102248 <iderw+0xb8> panic("iderw: ide disk 1 not present"); acquire(&idelock); //DOC:acquire-lock 801021cb: c7 04 24 60 a5 10 80 movl $0x8010a560,(%esp) 801021d2: e8 a9 20 00 00 call 80104280 <acquire> // Append b to idequeue. b->qnext = 0; for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue 801021d7: a1 98 a5 10 80 mov 0x8010a598,%eax 801021dc: ba 98 a5 10 80 mov $0x8010a598,%edx panic("iderw: ide disk 1 not present"); acquire(&idelock); //DOC:acquire-lock // Append b to idequeue. b->qnext = 0; 801021e1: c7 43 58 00 00 00 00 movl $0x0,0x58(%ebx) for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue 801021e8: 85 c0 test %eax,%eax 801021ea: 74 0e je 801021fa <iderw+0x6a> 801021ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801021f0: 8d 50 58 lea 0x58(%eax),%edx 801021f3: 8b 40 58 mov 0x58(%eax),%eax 801021f6: 85 c0 test %eax,%eax 801021f8: 75 f6 jne 801021f0 <iderw+0x60> ; *pp = b; 801021fa: 89 1a mov %ebx,(%edx) // Start disk if necessary. if(idequeue == b) 801021fc: 39 1d 98 a5 10 80 cmp %ebx,0x8010a598 80102202: 75 14 jne 80102218 <iderw+0x88> 80102204: eb 2d jmp 80102233 <iderw+0xa3> 80102206: 66 90 xchg %ax,%ax idestart(b); // Wait for request to finish. while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){ sleep(b, &idelock); 80102208: c7 44 24 04 60 a5 10 movl $0x8010a560,0x4(%esp) 8010220f: 80 80102210: 89 1c 24 mov %ebx,(%esp) 80102213: e8 78 1a 00 00 call 80103c90 <sleep> // Start disk if necessary. if(idequeue == b) idestart(b); // Wait for request to finish. while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){ 80102218: 8b 03 mov (%ebx),%eax 8010221a: 83 e0 06 and $0x6,%eax 8010221d: 83 f8 02 cmp $0x2,%eax 80102220: 75 e6 jne 80102208 <iderw+0x78> sleep(b, &idelock); } release(&idelock); 80102222: c7 45 08 60 a5 10 80 movl $0x8010a560,0x8(%ebp) } 80102229: 83 c4 14 add $0x14,%esp 8010222c: 5b pop %ebx 8010222d: 5d pop %ebp while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){ sleep(b, &idelock); } release(&idelock); 8010222e: e9 bd 20 00 00 jmp 801042f0 <release> ; *pp = b; // Start disk if necessary. if(idequeue == b) idestart(b); 80102233: 89 d8 mov %ebx,%eax 80102235: e8 76 fd ff ff call 80101fb0 <idestart> 8010223a: eb dc jmp 80102218 <iderw+0x88> iderw(struct buf *b) { struct buf **pp; if(!holdingsleep(&b->lock)) panic("iderw: buf not locked"); 8010223c: c7 04 24 2a 6f 10 80 movl $0x80106f2a,(%esp) 80102243: e8 28 e1 ff ff call 80100370 <panic> if((b->flags & (B_VALID|B_DIRTY)) == B_VALID) panic("iderw: nothing to do"); if(b->dev != 0 && !havedisk1) panic("iderw: ide disk 1 not present"); 80102248: c7 04 24 55 6f 10 80 movl $0x80106f55,(%esp) 8010224f: e8 1c e1 ff ff call 80100370 <panic> struct buf **pp; if(!holdingsleep(&b->lock)) panic("iderw: buf not locked"); if((b->flags & (B_VALID|B_DIRTY)) == B_VALID) panic("iderw: nothing to do"); 80102254: c7 04 24 40 6f 10 80 movl $0x80106f40,(%esp) 8010225b: e8 10 e1 ff ff call 80100370 <panic> 80102260 <ioapicinit>: ioapic->data = data; } void ioapicinit(void) { 80102260: 55 push %ebp 80102261: 89 e5 mov %esp,%ebp 80102263: 56 push %esi 80102264: 53 push %ebx static uint ioapicread(int reg) { ioapic->reg = reg; return ioapic->data; 80102265: bb 00 00 c0 fe mov $0xfec00000,%ebx ioapic->data = data; } void ioapicinit(void) { 8010226a: 83 ec 10 sub $0x10,%esp int i, id, maxintr; ioapic = (volatile struct ioapic*)IOAPIC; maxintr = (ioapicread(REG_VER) >> 16) & 0xFF; id = ioapicread(REG_ID) >> 24; if(id != ioapicid) 8010226d: 0f b6 15 60 27 11 80 movzbl 0x80112760,%edx }; static uint ioapicread(int reg) { ioapic->reg = reg; 80102274: c7 05 00 00 c0 fe 01 movl $0x1,0xfec00000 8010227b: 00 00 00 return ioapic->data; 8010227e: 8b 35 10 00 c0 fe mov 0xfec00010,%esi }; static uint ioapicread(int reg) { ioapic->reg = reg; 80102284: c7 05 00 00 c0 fe 00 movl $0x0,0xfec00000 8010228b: 00 00 00 return ioapic->data; 8010228e: a1 10 00 c0 fe mov 0xfec00010,%eax void ioapicinit(void) { int i, id, maxintr; ioapic = (volatile struct ioapic*)IOAPIC; 80102293: c7 05 34 26 11 80 00 movl $0xfec00000,0x80112634 8010229a: 00 c0 fe maxintr = (ioapicread(REG_VER) >> 16) & 0xFF; 8010229d: c1 ee 10 shr $0x10,%esi id = ioapicread(REG_ID) >> 24; 801022a0: c1 e8 18 shr $0x18,%eax ioapicinit(void) { int i, id, maxintr; ioapic = (volatile struct ioapic*)IOAPIC; maxintr = (ioapicread(REG_VER) >> 16) & 0xFF; 801022a3: 81 e6 ff 00 00 00 and $0xff,%esi id = ioapicread(REG_ID) >> 24; if(id != ioapicid) 801022a9: 39 c2 cmp %eax,%edx 801022ab: 74 12 je 801022bf <ioapicinit+0x5f> cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n"); 801022ad: c7 04 24 74 6f 10 80 movl $0x80106f74,(%esp) 801022b4: e8 97 e3 ff ff call 80100650 <cprintf> 801022b9: 8b 1d 34 26 11 80 mov 0x80112634,%ebx ioapic->data = data; } void ioapicinit(void) { 801022bf: ba 10 00 00 00 mov $0x10,%edx 801022c4: 31 c0 xor %eax,%eax 801022c6: 66 90 xchg %ax,%ax } static void ioapicwrite(int reg, uint data) { ioapic->reg = reg; 801022c8: 89 13 mov %edx,(%ebx) ioapic->data = data; 801022ca: 8b 1d 34 26 11 80 mov 0x80112634,%ebx } void ioapicinit(void) 801022d0: 8d 48 20 lea 0x20(%eax),%ecx cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n"); // Mark all interrupts edge-triggered, active high, disabled, // and not routed to any CPUs. for(i = 0; i <= maxintr; i++){ ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i)); 801022d3: 81 c9 00 00 01 00 or $0x10000,%ecx if(id != ioapicid) cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n"); // Mark all interrupts edge-triggered, active high, disabled, // and not routed to any CPUs. for(i = 0; i <= maxintr; i++){ 801022d9: 83 c0 01 add $0x1,%eax static void ioapicwrite(int reg, uint data) { ioapic->reg = reg; ioapic->data = data; 801022dc: 89 4b 10 mov %ecx,0x10(%ebx) } void ioapicinit(void) 801022df: 8d 4a 01 lea 0x1(%edx),%ecx if(id != ioapicid) cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n"); // Mark all interrupts edge-triggered, active high, disabled, // and not routed to any CPUs. for(i = 0; i <= maxintr; i++){ 801022e2: 83 c2 02 add $0x2,%edx } static void ioapicwrite(int reg, uint data) { ioapic->reg = reg; 801022e5: 89 0b mov %ecx,(%ebx) ioapic->data = data; 801022e7: 8b 1d 34 26 11 80 mov 0x80112634,%ebx if(id != ioapicid) cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n"); // Mark all interrupts edge-triggered, active high, disabled, // and not routed to any CPUs. for(i = 0; i <= maxintr; i++){ 801022ed: 39 c6 cmp %eax,%esi static void ioapicwrite(int reg, uint data) { ioapic->reg = reg; ioapic->data = data; 801022ef: c7 43 10 00 00 00 00 movl $0x0,0x10(%ebx) if(id != ioapicid) cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n"); // Mark all interrupts edge-triggered, active high, disabled, // and not routed to any CPUs. for(i = 0; i <= maxintr; i++){ 801022f6: 7d d0 jge 801022c8 <ioapicinit+0x68> ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i)); ioapicwrite(REG_TABLE+2*i+1, 0); } } 801022f8: 83 c4 10 add $0x10,%esp 801022fb: 5b pop %ebx 801022fc: 5e pop %esi 801022fd: 5d pop %ebp 801022fe: c3 ret 801022ff: 90 nop 80102300 <ioapicenable>: void ioapicenable(int irq, int cpunum) { 80102300: 55 push %ebp 80102301: 89 e5 mov %esp,%ebp 80102303: 8b 55 08 mov 0x8(%ebp),%edx 80102306: 53 push %ebx 80102307: 8b 45 0c mov 0xc(%ebp),%eax // Mark interrupt edge-triggered, active high, // enabled, and routed to the given cpunum, // which happens to be that cpu's APIC ID. ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq); 8010230a: 8d 5a 20 lea 0x20(%edx),%ebx 8010230d: 8d 4c 12 10 lea 0x10(%edx,%edx,1),%ecx } static void ioapicwrite(int reg, uint data) { ioapic->reg = reg; 80102311: 8b 15 34 26 11 80 mov 0x80112634,%edx { // Mark interrupt edge-triggered, active high, // enabled, and routed to the given cpunum, // which happens to be that cpu's APIC ID. ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq); ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24); 80102317: c1 e0 18 shl $0x18,%eax } static void ioapicwrite(int reg, uint data) { ioapic->reg = reg; 8010231a: 89 0a mov %ecx,(%edx) ioapic->data = data; 8010231c: 8b 15 34 26 11 80 mov 0x80112634,%edx { // Mark interrupt edge-triggered, active high, // enabled, and routed to the given cpunum, // which happens to be that cpu's APIC ID. ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq); ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24); 80102322: 83 c1 01 add $0x1,%ecx static void ioapicwrite(int reg, uint data) { ioapic->reg = reg; ioapic->data = data; 80102325: 89 5a 10 mov %ebx,0x10(%edx) } static void ioapicwrite(int reg, uint data) { ioapic->reg = reg; 80102328: 89 0a mov %ecx,(%edx) ioapic->data = data; 8010232a: 8b 15 34 26 11 80 mov 0x80112634,%edx 80102330: 89 42 10 mov %eax,0x10(%edx) // Mark interrupt edge-triggered, active high, // enabled, and routed to the given cpunum, // which happens to be that cpu's APIC ID. ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq); ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24); } 80102333: 5b pop %ebx 80102334: 5d pop %ebp 80102335: c3 ret ... 80102340 <kfree>: // which normally should have been returned by a // call to kalloc(). (The exception is when // initializing the allocator; see kinit above.) void kfree(char *v) { 80102340: 55 push %ebp 80102341: 89 e5 mov %esp,%ebp 80102343: 53 push %ebx 80102344: 83 ec 14 sub $0x14,%esp 80102347: 8b 5d 08 mov 0x8(%ebp),%ebx struct run *r; if((uint)v % PGSIZE || v < end || V2P(v) >= PHYSTOP) 8010234a: f7 c3 ff 0f 00 00 test $0xfff,%ebx 80102350: 75 7c jne 801023ce <kfree+0x8e> 80102352: 81 fb a8 54 11 80 cmp $0x801154a8,%ebx 80102358: 72 74 jb 801023ce <kfree+0x8e> 8010235a: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax 80102360: 3d ff ff ff 0d cmp $0xdffffff,%eax 80102365: 77 67 ja 801023ce <kfree+0x8e> panic("kfree"); // Fill with junk to catch dangling refs. memset(v, 1, PGSIZE); 80102367: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) 8010236e: 00 8010236f: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) 80102376: 00 80102377: 89 1c 24 mov %ebx,(%esp) 8010237a: e8 c1 1f 00 00 call 80104340 <memset> if(kmem.use_lock) 8010237f: 8b 15 74 26 11 80 mov 0x80112674,%edx 80102385: 85 d2 test %edx,%edx 80102387: 75 37 jne 801023c0 <kfree+0x80> acquire(&kmem.lock); r = (struct run*)v; r->next = kmem.freelist; 80102389: a1 78 26 11 80 mov 0x80112678,%eax 8010238e: 89 03 mov %eax,(%ebx) kmem.freelist = r; if(kmem.use_lock) 80102390: a1 74 26 11 80 mov 0x80112674,%eax if(kmem.use_lock) acquire(&kmem.lock); r = (struct run*)v; r->next = kmem.freelist; kmem.freelist = r; 80102395: 89 1d 78 26 11 80 mov %ebx,0x80112678 if(kmem.use_lock) 8010239b: 85 c0 test %eax,%eax 8010239d: 75 09 jne 801023a8 <kfree+0x68> release(&kmem.lock); } 8010239f: 83 c4 14 add $0x14,%esp 801023a2: 5b pop %ebx 801023a3: 5d pop %ebp 801023a4: c3 ret 801023a5: 8d 76 00 lea 0x0(%esi),%esi acquire(&kmem.lock); r = (struct run*)v; r->next = kmem.freelist; kmem.freelist = r; if(kmem.use_lock) release(&kmem.lock); 801023a8: c7 45 08 40 26 11 80 movl $0x80112640,0x8(%ebp) } 801023af: 83 c4 14 add $0x14,%esp 801023b2: 5b pop %ebx 801023b3: 5d pop %ebp acquire(&kmem.lock); r = (struct run*)v; r->next = kmem.freelist; kmem.freelist = r; if(kmem.use_lock) release(&kmem.lock); 801023b4: e9 37 1f 00 00 jmp 801042f0 <release> 801023b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi // Fill with junk to catch dangling refs. memset(v, 1, PGSIZE); if(kmem.use_lock) acquire(&kmem.lock); 801023c0: c7 04 24 40 26 11 80 movl $0x80112640,(%esp) 801023c7: e8 b4 1e 00 00 call 80104280 <acquire> 801023cc: eb bb jmp 80102389 <kfree+0x49> kfree(char *v) { struct run *r; if((uint)v % PGSIZE || v < end || V2P(v) >= PHYSTOP) panic("kfree"); 801023ce: c7 04 24 a6 6f 10 80 movl $0x80106fa6,(%esp) 801023d5: e8 96 df ff ff call 80100370 <panic> 801023da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801023e0 <freerange>: kmem.use_lock = 1; } void freerange(void *vstart, void *vend) { 801023e0: 55 push %ebp 801023e1: 89 e5 mov %esp,%ebp 801023e3: 56 push %esi 801023e4: 53 push %ebx 801023e5: 83 ec 10 sub $0x10,%esp char *p; p = (char*)PGROUNDUP((uint)vstart); 801023e8: 8b 55 08 mov 0x8(%ebp),%edx kmem.use_lock = 1; } void freerange(void *vstart, void *vend) { 801023eb: 8b 75 0c mov 0xc(%ebp),%esi char *p; p = (char*)PGROUNDUP((uint)vstart); 801023ee: 81 c2 ff 0f 00 00 add $0xfff,%edx 801023f4: 81 e2 00 f0 ff ff and $0xfffff000,%edx for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 801023fa: 8d 9a 00 10 00 00 lea 0x1000(%edx),%ebx 80102400: 39 de cmp %ebx,%esi 80102402: 73 08 jae 8010240c <freerange+0x2c> 80102404: eb 18 jmp 8010241e <freerange+0x3e> 80102406: 66 90 xchg %ax,%ax 80102408: 89 da mov %ebx,%edx 8010240a: 89 c3 mov %eax,%ebx kfree(p); 8010240c: 89 14 24 mov %edx,(%esp) 8010240f: e8 2c ff ff ff call 80102340 <kfree> void freerange(void *vstart, void *vend) { char *p; p = (char*)PGROUNDUP((uint)vstart); for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 80102414: 8d 83 00 10 00 00 lea 0x1000(%ebx),%eax 8010241a: 39 f0 cmp %esi,%eax 8010241c: 76 ea jbe 80102408 <freerange+0x28> kfree(p); } 8010241e: 83 c4 10 add $0x10,%esp 80102421: 5b pop %ebx 80102422: 5e pop %esi 80102423: 5d pop %ebp 80102424: c3 ret 80102425: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102429: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80102430 <kinit2>: freerange(vstart, vend); } void kinit2(void *vstart, void *vend) { 80102430: 55 push %ebp 80102431: 89 e5 mov %esp,%ebp 80102433: 83 ec 18 sub $0x18,%esp freerange(vstart, vend); 80102436: 8b 45 0c mov 0xc(%ebp),%eax 80102439: 89 44 24 04 mov %eax,0x4(%esp) 8010243d: 8b 45 08 mov 0x8(%ebp),%eax 80102440: 89 04 24 mov %eax,(%esp) 80102443: e8 98 ff ff ff call 801023e0 <freerange> kmem.use_lock = 1; 80102448: c7 05 74 26 11 80 01 movl $0x1,0x80112674 8010244f: 00 00 00 } 80102452: c9 leave 80102453: c3 ret 80102454: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 8010245a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 80102460 <kinit1>: // the pages mapped by entrypgdir on free list. // 2. main() calls kinit2() with the rest of the physical pages // after installing a full page table that maps them on all cores. void kinit1(void *vstart, void *vend) { 80102460: 55 push %ebp 80102461: 89 e5 mov %esp,%ebp 80102463: 83 ec 18 sub $0x18,%esp 80102466: 89 5d f8 mov %ebx,-0x8(%ebp) 80102469: 8b 5d 08 mov 0x8(%ebp),%ebx 8010246c: 89 75 fc mov %esi,-0x4(%ebp) 8010246f: 8b 75 0c mov 0xc(%ebp),%esi initlock(&kmem.lock, "kmem"); 80102472: c7 44 24 04 ac 6f 10 movl $0x80106fac,0x4(%esp) 80102479: 80 8010247a: c7 04 24 40 26 11 80 movl $0x80112640,(%esp) 80102481: e8 8a 1c 00 00 call 80104110 <initlock> kmem.use_lock = 0; freerange(vstart, vend); 80102486: 89 75 0c mov %esi,0xc(%ebp) } 80102489: 8b 75 fc mov -0x4(%ebp),%esi void kinit1(void *vstart, void *vend) { initlock(&kmem.lock, "kmem"); kmem.use_lock = 0; freerange(vstart, vend); 8010248c: 89 5d 08 mov %ebx,0x8(%ebp) } 8010248f: 8b 5d f8 mov -0x8(%ebp),%ebx // after installing a full page table that maps them on all cores. void kinit1(void *vstart, void *vend) { initlock(&kmem.lock, "kmem"); kmem.use_lock = 0; 80102492: c7 05 74 26 11 80 00 movl $0x0,0x80112674 80102499: 00 00 00 freerange(vstart, vend); } 8010249c: 89 ec mov %ebp,%esp 8010249e: 5d pop %ebp void kinit1(void *vstart, void *vend) { initlock(&kmem.lock, "kmem"); kmem.use_lock = 0; freerange(vstart, vend); 8010249f: e9 3c ff ff ff jmp 801023e0 <freerange> 801024a4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801024aa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 801024b0 <kalloc>: // Allocate one 4096-byte page of physical memory. // Returns a pointer that the kernel can use. // Returns 0 if the memory cannot be allocated. char* kalloc(void) { 801024b0: 55 push %ebp struct run *r; if(kmem.use_lock) 801024b1: 31 c0 xor %eax,%eax // Allocate one 4096-byte page of physical memory. // Returns a pointer that the kernel can use. // Returns 0 if the memory cannot be allocated. char* kalloc(void) { 801024b3: 89 e5 mov %esp,%ebp 801024b5: 53 push %ebx 801024b6: 83 ec 14 sub $0x14,%esp struct run *r; if(kmem.use_lock) 801024b9: 8b 0d 74 26 11 80 mov 0x80112674,%ecx 801024bf: 85 c9 test %ecx,%ecx 801024c1: 75 2d jne 801024f0 <kalloc+0x40> acquire(&kmem.lock); r = kmem.freelist; 801024c3: 8b 1d 78 26 11 80 mov 0x80112678,%ebx if(r) 801024c9: 85 db test %ebx,%ebx 801024cb: 74 08 je 801024d5 <kalloc+0x25> kmem.freelist = r->next; 801024cd: 8b 13 mov (%ebx),%edx 801024cf: 89 15 78 26 11 80 mov %edx,0x80112678 if(kmem.use_lock) 801024d5: 85 c0 test %eax,%eax 801024d7: 74 0c je 801024e5 <kalloc+0x35> release(&kmem.lock); 801024d9: c7 04 24 40 26 11 80 movl $0x80112640,(%esp) 801024e0: e8 0b 1e 00 00 call 801042f0 <release> return (char*)r; } 801024e5: 83 c4 14 add $0x14,%esp 801024e8: 89 d8 mov %ebx,%eax 801024ea: 5b pop %ebx 801024eb: 5d pop %ebp 801024ec: c3 ret 801024ed: 8d 76 00 lea 0x0(%esi),%esi kalloc(void) { struct run *r; if(kmem.use_lock) acquire(&kmem.lock); 801024f0: c7 04 24 40 26 11 80 movl $0x80112640,(%esp) 801024f7: e8 84 1d 00 00 call 80104280 <acquire> 801024fc: a1 74 26 11 80 mov 0x80112674,%eax 80102501: eb c0 jmp 801024c3 <kalloc+0x13> ... 80102510 <kbdgetc>: #include "defs.h" #include "kbd.h" int kbdgetc(void) { 80102510: 55 push %ebp static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102511: ba 64 00 00 00 mov $0x64,%edx 80102516: 89 e5 mov %esp,%ebp 80102518: ec in (%dx),%al normalmap, shiftmap, ctlmap, ctlmap }; uint st, data, c; st = inb(KBSTATP); if((st & KBS_DIB) == 0) 80102519: a8 01 test $0x1,%al return -1; 8010251b: b9 ff ff ff ff mov $0xffffffff,%ecx normalmap, shiftmap, ctlmap, ctlmap }; uint st, data, c; st = inb(KBSTATP); if((st & KBS_DIB) == 0) 80102520: 74 3e je 80102560 <kbdgetc+0x50> 80102522: b2 60 mov $0x60,%dl 80102524: ec in (%dx),%al return -1; data = inb(KBDATAP); 80102525: 0f b6 c0 movzbl %al,%eax if(data == 0xE0){ 80102528: 3d e0 00 00 00 cmp $0xe0,%eax 8010252d: 0f 84 85 00 00 00 je 801025b8 <kbdgetc+0xa8> shift |= E0ESC; return 0; } else if(data & 0x80){ 80102533: a8 80 test $0x80,%al 80102535: 74 31 je 80102568 <kbdgetc+0x58> // Key released data = (shift & E0ESC ? data : data & 0x7F); 80102537: 8b 15 9c a5 10 80 mov 0x8010a59c,%edx 8010253d: 89 c1 mov %eax,%ecx 8010253f: 83 e1 7f and $0x7f,%ecx 80102542: f6 c2 40 test $0x40,%dl 80102545: 0f 44 c1 cmove %ecx,%eax shift &= ~(shiftcode[data] | E0ESC); return 0; 80102548: 31 c9 xor %ecx,%ecx shift |= E0ESC; return 0; } else if(data & 0x80){ // Key released data = (shift & E0ESC ? data : data & 0x7F); shift &= ~(shiftcode[data] | E0ESC); 8010254a: 0f b6 80 c0 6f 10 80 movzbl -0x7fef9040(%eax),%eax 80102551: 83 c8 40 or $0x40,%eax 80102554: 0f b6 c0 movzbl %al,%eax 80102557: f7 d0 not %eax 80102559: 21 d0 and %edx,%eax 8010255b: a3 9c a5 10 80 mov %eax,0x8010a59c c += 'A' - 'a'; else if('A' <= c && c <= 'Z') c += 'a' - 'A'; } return c; } 80102560: 89 c8 mov %ecx,%eax 80102562: 5d pop %ebp 80102563: c3 ret 80102564: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } else if(data & 0x80){ // Key released data = (shift & E0ESC ? data : data & 0x7F); shift &= ~(shiftcode[data] | E0ESC); return 0; } else if(shift & E0ESC){ 80102568: 8b 0d 9c a5 10 80 mov 0x8010a59c,%ecx 8010256e: f6 c1 40 test $0x40,%cl 80102571: 74 05 je 80102578 <kbdgetc+0x68> // Last character was an E0 escape; or with 0x80 data |= 0x80; 80102573: 0c 80 or $0x80,%al shift &= ~E0ESC; 80102575: 83 e1 bf and $0xffffffbf,%ecx } shift |= shiftcode[data]; 80102578: 0f b6 90 c0 6f 10 80 movzbl -0x7fef9040(%eax),%edx 8010257f: 09 ca or %ecx,%edx shift ^= togglecode[data]; 80102581: 0f b6 88 c0 70 10 80 movzbl -0x7fef8f40(%eax),%ecx 80102588: 31 ca xor %ecx,%edx c = charcode[shift & (CTL | SHIFT)][data]; 8010258a: 89 d1 mov %edx,%ecx 8010258c: 83 e1 03 and $0x3,%ecx 8010258f: 8b 0c 8d c0 71 10 80 mov -0x7fef8e40(,%ecx,4),%ecx data |= 0x80; shift &= ~E0ESC; } shift |= shiftcode[data]; shift ^= togglecode[data]; 80102596: 89 15 9c a5 10 80 mov %edx,0x8010a59c c = charcode[shift & (CTL | SHIFT)][data]; if(shift & CAPSLOCK){ 8010259c: 83 e2 08 and $0x8,%edx shift &= ~E0ESC; } shift |= shiftcode[data]; shift ^= togglecode[data]; c = charcode[shift & (CTL | SHIFT)][data]; 8010259f: 0f b6 0c 01 movzbl (%ecx,%eax,1),%ecx if(shift & CAPSLOCK){ 801025a3: 74 bb je 80102560 <kbdgetc+0x50> if('a' <= c && c <= 'z') 801025a5: 8d 41 9f lea -0x61(%ecx),%eax 801025a8: 83 f8 19 cmp $0x19,%eax 801025ab: 77 1b ja 801025c8 <kbdgetc+0xb8> c += 'A' - 'a'; 801025ad: 83 e9 20 sub $0x20,%ecx 801025b0: eb ae jmp 80102560 <kbdgetc+0x50> 801025b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi return -1; data = inb(KBDATAP); if(data == 0xE0){ shift |= E0ESC; return 0; 801025b8: 31 c9 xor %ecx,%ecx c += 'A' - 'a'; else if('A' <= c && c <= 'Z') c += 'a' - 'A'; } return c; } 801025ba: 89 c8 mov %ecx,%eax if((st & KBS_DIB) == 0) return -1; data = inb(KBDATAP); if(data == 0xE0){ shift |= E0ESC; 801025bc: 83 0d 9c a5 10 80 40 orl $0x40,0x8010a59c c += 'A' - 'a'; else if('A' <= c && c <= 'Z') c += 'a' - 'A'; } return c; } 801025c3: 5d pop %ebp 801025c4: c3 ret 801025c5: 8d 76 00 lea 0x0(%esi),%esi shift ^= togglecode[data]; c = charcode[shift & (CTL | SHIFT)][data]; if(shift & CAPSLOCK){ if('a' <= c && c <= 'z') c += 'A' - 'a'; else if('A' <= c && c <= 'Z') 801025c8: 8d 51 bf lea -0x41(%ecx),%edx c += 'a' - 'A'; 801025cb: 8d 41 20 lea 0x20(%ecx),%eax 801025ce: 83 fa 19 cmp $0x19,%edx 801025d1: 0f 46 c8 cmovbe %eax,%ecx } return c; 801025d4: eb 8a jmp 80102560 <kbdgetc+0x50> 801025d6: 8d 76 00 lea 0x0(%esi),%esi 801025d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801025e0 <kbdintr>: } void kbdintr(void) { 801025e0: 55 push %ebp 801025e1: 89 e5 mov %esp,%ebp 801025e3: 83 ec 18 sub $0x18,%esp consoleintr(kbdgetc); 801025e6: c7 04 24 10 25 10 80 movl $0x80102510,(%esp) 801025ed: e8 ce e1 ff ff call 801007c0 <consoleintr> } 801025f2: c9 leave 801025f3: c3 ret ... 80102600 <lapicinit>: } void lapicinit(void) { if(!lapic) 80102600: a1 7c 26 11 80 mov 0x8011267c,%eax lapic[ID]; // wait for write to finish, by reading } void lapicinit(void) { 80102605: 55 push %ebp 80102606: 89 e5 mov %esp,%ebp if(!lapic) 80102608: 85 c0 test %eax,%eax 8010260a: 0f 84 c0 00 00 00 je 801026d0 <lapicinit+0xd0> //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 80102610: c7 80 f0 00 00 00 3f movl $0x13f,0xf0(%eax) 80102617: 01 00 00 lapic[ID]; // wait for write to finish, by reading 8010261a: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 8010261d: c7 80 e0 03 00 00 0b movl $0xb,0x3e0(%eax) 80102624: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80102627: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 8010262a: c7 80 20 03 00 00 20 movl $0x20020,0x320(%eax) 80102631: 00 02 00 lapic[ID]; // wait for write to finish, by reading 80102634: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 80102637: c7 80 80 03 00 00 80 movl $0x989680,0x380(%eax) 8010263e: 96 98 00 lapic[ID]; // wait for write to finish, by reading 80102641: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 80102644: c7 80 50 03 00 00 00 movl $0x10000,0x350(%eax) 8010264b: 00 01 00 lapic[ID]; // wait for write to finish, by reading 8010264e: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 80102651: c7 80 60 03 00 00 00 movl $0x10000,0x360(%eax) 80102658: 00 01 00 lapic[ID]; // wait for write to finish, by reading 8010265b: 8b 50 20 mov 0x20(%eax),%edx lapicw(LINT0, MASKED); lapicw(LINT1, MASKED); // Disable performance counter overflow interrupts // on machines that provide that interrupt entry. if(((lapic[VER]>>16) & 0xFF) >= 4) 8010265e: 8b 50 30 mov 0x30(%eax),%edx 80102661: c1 ea 10 shr $0x10,%edx 80102664: 80 fa 03 cmp $0x3,%dl 80102667: 77 6f ja 801026d8 <lapicinit+0xd8> //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 80102669: c7 80 70 03 00 00 33 movl $0x33,0x370(%eax) 80102670: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80102673: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 80102676: c7 80 80 02 00 00 00 movl $0x0,0x280(%eax) 8010267d: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80102680: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 80102683: c7 80 80 02 00 00 00 movl $0x0,0x280(%eax) 8010268a: 00 00 00 lapic[ID]; // wait for write to finish, by reading 8010268d: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 80102690: c7 80 b0 00 00 00 00 movl $0x0,0xb0(%eax) 80102697: 00 00 00 lapic[ID]; // wait for write to finish, by reading 8010269a: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 8010269d: c7 80 10 03 00 00 00 movl $0x0,0x310(%eax) 801026a4: 00 00 00 lapic[ID]; // wait for write to finish, by reading 801026a7: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 801026aa: c7 80 00 03 00 00 00 movl $0x88500,0x300(%eax) 801026b1: 85 08 00 lapic[ID]; // wait for write to finish, by reading 801026b4: 8b 50 20 mov 0x20(%eax),%edx 801026b7: 90 nop lapicw(EOI, 0); // Send an Init Level De-Assert to synchronise arbitration ID's. lapicw(ICRHI, 0); lapicw(ICRLO, BCAST | INIT | LEVEL); while(lapic[ICRLO] & DELIVS) 801026b8: 8b 90 00 03 00 00 mov 0x300(%eax),%edx 801026be: 80 e6 10 and $0x10,%dh 801026c1: 75 f5 jne 801026b8 <lapicinit+0xb8> //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 801026c3: c7 80 80 00 00 00 00 movl $0x0,0x80(%eax) 801026ca: 00 00 00 lapic[ID]; // wait for write to finish, by reading 801026cd: 8b 40 20 mov 0x20(%eax),%eax while(lapic[ICRLO] & DELIVS) ; // Enable interrupts on the APIC (but not on the processor). lapicw(TPR, 0); } 801026d0: 5d pop %ebp 801026d1: c3 ret 801026d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 801026d8: c7 80 40 03 00 00 00 movl $0x10000,0x340(%eax) 801026df: 00 01 00 lapic[ID]; // wait for write to finish, by reading 801026e2: 8b 50 20 mov 0x20(%eax),%edx 801026e5: eb 82 jmp 80102669 <lapicinit+0x69> 801026e7: 89 f6 mov %esi,%esi 801026e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801026f0 <lapicid>: } int lapicid(void) { if (!lapic) 801026f0: 8b 15 7c 26 11 80 mov 0x8011267c,%edx return 0; 801026f6: 31 c0 xor %eax,%eax lapicw(TPR, 0); } int lapicid(void) { 801026f8: 55 push %ebp 801026f9: 89 e5 mov %esp,%ebp if (!lapic) 801026fb: 85 d2 test %edx,%edx 801026fd: 74 06 je 80102705 <lapicid+0x15> return 0; return lapic[ID] >> 24; 801026ff: 8b 42 20 mov 0x20(%edx),%eax 80102702: c1 e8 18 shr $0x18,%eax } 80102705: 5d pop %ebp 80102706: c3 ret 80102707: 89 f6 mov %esi,%esi 80102709: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80102710 <lapiceoi>: // Acknowledge interrupt. void lapiceoi(void) { if(lapic) 80102710: a1 7c 26 11 80 mov 0x8011267c,%eax } // Acknowledge interrupt. void lapiceoi(void) { 80102715: 55 push %ebp 80102716: 89 e5 mov %esp,%ebp if(lapic) 80102718: 85 c0 test %eax,%eax 8010271a: 74 0d je 80102729 <lapiceoi+0x19> //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 8010271c: c7 80 b0 00 00 00 00 movl $0x0,0xb0(%eax) 80102723: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80102726: 8b 40 20 mov 0x20(%eax),%eax void lapiceoi(void) { if(lapic) lapicw(EOI, 0); } 80102729: 5d pop %ebp 8010272a: c3 ret 8010272b: 90 nop 8010272c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102730 <microdelay>: // Spin for a given number of microseconds. // On real hardware would want to tune this dynamically. void microdelay(int us) { 80102730: 55 push %ebp 80102731: 89 e5 mov %esp,%ebp } 80102733: 5d pop %ebp 80102734: c3 ret 80102735: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102739: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80102740 <lapicstartap>: // Start additional processor running entry code at addr. // See Appendix B of MultiProcessor Specification. void lapicstartap(uchar apicid, uint addr) { 80102740: 55 push %ebp } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102741: ba 70 00 00 00 mov $0x70,%edx 80102746: 89 e5 mov %esp,%ebp 80102748: b8 0f 00 00 00 mov $0xf,%eax 8010274d: 53 push %ebx 8010274e: 8b 4d 0c mov 0xc(%ebp),%ecx 80102751: 0f b6 5d 08 movzbl 0x8(%ebp),%ebx 80102755: ee out %al,(%dx) 80102756: b8 0a 00 00 00 mov $0xa,%eax 8010275b: b2 71 mov $0x71,%dl 8010275d: ee out %al,(%dx) // the AP startup code prior to the [universal startup algorithm]." outb(CMOS_PORT, 0xF); // offset 0xF is shutdown code outb(CMOS_PORT+1, 0x0A); wrv = (ushort*)P2V((0x40<<4 | 0x67)); // Warm reset vector wrv[0] = 0; wrv[1] = addr >> 4; 8010275e: 89 c8 mov %ecx,%eax 80102760: c1 e8 04 shr $0x4,%eax 80102763: 66 a3 69 04 00 80 mov %ax,0x80000469 //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 80102769: a1 7c 26 11 80 mov 0x8011267c,%eax // when it is in the halted state due to an INIT. So the second // should be ignored, but it is part of the official Intel algorithm. // Bochs complains about the second one. Too bad for Bochs. for(i = 0; i < 2; i++){ lapicw(ICRHI, apicid<<24); lapicw(ICRLO, STARTUP | (addr>>12)); 8010276e: c1 e9 0c shr $0xc,%ecx wrv[0] = 0; wrv[1] = addr >> 4; // "Universal startup algorithm." // Send INIT (level-triggered) interrupt to reset other CPU. lapicw(ICRHI, apicid<<24); 80102771: c1 e3 18 shl $0x18,%ebx // when it is in the halted state due to an INIT. So the second // should be ignored, but it is part of the official Intel algorithm. // Bochs complains about the second one. Too bad for Bochs. for(i = 0; i < 2; i++){ lapicw(ICRHI, apicid<<24); lapicw(ICRLO, STARTUP | (addr>>12)); 80102774: 80 cd 06 or $0x6,%ch // and the warm reset vector (DWORD based at 40:67) to point at // the AP startup code prior to the [universal startup algorithm]." outb(CMOS_PORT, 0xF); // offset 0xF is shutdown code outb(CMOS_PORT+1, 0x0A); wrv = (ushort*)P2V((0x40<<4 | 0x67)); // Warm reset vector wrv[0] = 0; 80102777: 66 c7 05 67 04 00 80 movw $0x0,0x80000467 8010277e: 00 00 //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 80102780: 89 98 10 03 00 00 mov %ebx,0x310(%eax) lapic[ID]; // wait for write to finish, by reading 80102786: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 80102789: c7 80 00 03 00 00 00 movl $0xc500,0x300(%eax) 80102790: c5 00 00 lapic[ID]; // wait for write to finish, by reading 80102793: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 80102796: c7 80 00 03 00 00 00 movl $0x8500,0x300(%eax) 8010279d: 85 00 00 lapic[ID]; // wait for write to finish, by reading 801027a0: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 801027a3: 89 98 10 03 00 00 mov %ebx,0x310(%eax) lapic[ID]; // wait for write to finish, by reading 801027a9: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 801027ac: 89 88 00 03 00 00 mov %ecx,0x300(%eax) lapic[ID]; // wait for write to finish, by reading 801027b2: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 801027b5: 89 98 10 03 00 00 mov %ebx,0x310(%eax) lapic[ID]; // wait for write to finish, by reading 801027bb: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 801027be: 89 88 00 03 00 00 mov %ecx,0x300(%eax) lapic[ID]; // wait for write to finish, by reading 801027c4: 8b 40 20 mov 0x20(%eax),%eax for(i = 0; i < 2; i++){ lapicw(ICRHI, apicid<<24); lapicw(ICRLO, STARTUP | (addr>>12)); microdelay(200); } } 801027c7: 5b pop %ebx 801027c8: 5d pop %ebp 801027c9: c3 ret 801027ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801027d0 <cmostime>: } // qemu seems to use 24-hour GWT and the values are BCD encoded void cmostime(struct rtcdate *r) { 801027d0: 55 push %ebp 801027d1: ba 70 00 00 00 mov $0x70,%edx 801027d6: 89 e5 mov %esp,%ebp 801027d8: b8 0b 00 00 00 mov $0xb,%eax 801027dd: 57 push %edi 801027de: 56 push %esi 801027df: 53 push %ebx 801027e0: 83 ec 6c sub $0x6c,%esp 801027e3: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801027e4: b2 71 mov $0x71,%dl 801027e6: ec in (%dx),%al struct rtcdate t1, t2; int sb, bcd; sb = cmos_read(CMOS_STATB); bcd = (sb & (1 << 2)) == 0; 801027e7: 89 c2 mov %eax,%edx } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801027e9: bb 70 00 00 00 mov $0x70,%ebx 801027ee: 83 e2 04 and $0x4,%edx 801027f1: 89 55 a4 mov %edx,-0x5c(%ebp) 801027f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801027f8: 31 c0 xor %eax,%eax 801027fa: 89 da mov %ebx,%edx 801027fc: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801027fd: b9 71 00 00 00 mov $0x71,%ecx 80102802: 89 ca mov %ecx,%edx 80102804: ec in (%dx),%al cmos_read(uint reg) { outb(CMOS_PORT, reg); microdelay(200); return inb(CMOS_RETURN); 80102805: 0f b6 f0 movzbl %al,%esi } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102808: 89 da mov %ebx,%edx 8010280a: b8 02 00 00 00 mov $0x2,%eax 8010280f: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102810: 89 ca mov %ecx,%edx 80102812: ec in (%dx),%al 80102813: 0f b6 c0 movzbl %al,%eax } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102816: 89 da mov %ebx,%edx 80102818: 89 45 b4 mov %eax,-0x4c(%ebp) 8010281b: b8 04 00 00 00 mov $0x4,%eax 80102820: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102821: 89 ca mov %ecx,%edx 80102823: ec in (%dx),%al 80102824: 0f b6 c0 movzbl %al,%eax } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102827: 89 da mov %ebx,%edx 80102829: 89 45 b0 mov %eax,-0x50(%ebp) 8010282c: b8 07 00 00 00 mov $0x7,%eax 80102831: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102832: 89 ca mov %ecx,%edx 80102834: ec in (%dx),%al 80102835: 0f b6 c0 movzbl %al,%eax } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102838: 89 da mov %ebx,%edx 8010283a: 89 45 ac mov %eax,-0x54(%ebp) 8010283d: b8 08 00 00 00 mov $0x8,%eax 80102842: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102843: 89 ca mov %ecx,%edx 80102845: ec in (%dx),%al 80102846: 0f b6 c0 movzbl %al,%eax } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102849: 89 da mov %ebx,%edx 8010284b: 89 45 a8 mov %eax,-0x58(%ebp) 8010284e: b8 09 00 00 00 mov $0x9,%eax 80102853: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102854: 89 ca mov %ecx,%edx 80102856: ec in (%dx),%al 80102857: 0f b6 f8 movzbl %al,%edi } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 8010285a: 89 da mov %ebx,%edx 8010285c: b8 0a 00 00 00 mov $0xa,%eax 80102861: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102862: 89 ca mov %ecx,%edx 80102864: ec in (%dx),%al bcd = (sb & (1 << 2)) == 0; // make sure CMOS doesn't modify time while we read it for(;;) { fill_rtcdate(&t1); if(cmos_read(CMOS_STATA) & CMOS_UIP) 80102865: a8 80 test $0x80,%al 80102867: 75 8f jne 801027f8 <cmostime+0x28> 80102869: 8b 45 b4 mov -0x4c(%ebp),%eax 8010286c: 8b 55 b0 mov -0x50(%ebp),%edx 8010286f: 89 75 b8 mov %esi,-0x48(%ebp) 80102872: 89 7d cc mov %edi,-0x34(%ebp) 80102875: 89 45 bc mov %eax,-0x44(%ebp) 80102878: 8b 45 ac mov -0x54(%ebp),%eax 8010287b: 89 55 c0 mov %edx,-0x40(%ebp) 8010287e: 8b 55 a8 mov -0x58(%ebp),%edx 80102881: 89 45 c4 mov %eax,-0x3c(%ebp) } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102884: 31 c0 xor %eax,%eax 80102886: 89 55 c8 mov %edx,-0x38(%ebp) 80102889: 89 da mov %ebx,%edx 8010288b: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 8010288c: 89 ca mov %ecx,%edx 8010288e: ec in (%dx),%al cmos_read(uint reg) { outb(CMOS_PORT, reg); microdelay(200); return inb(CMOS_RETURN); 8010288f: 0f b6 c0 movzbl %al,%eax } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102892: 89 da mov %ebx,%edx 80102894: 89 45 d0 mov %eax,-0x30(%ebp) 80102897: b8 02 00 00 00 mov $0x2,%eax 8010289c: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 8010289d: 89 ca mov %ecx,%edx 8010289f: ec in (%dx),%al 801028a0: 0f b6 c0 movzbl %al,%eax } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801028a3: 89 da mov %ebx,%edx 801028a5: 89 45 d4 mov %eax,-0x2c(%ebp) 801028a8: b8 04 00 00 00 mov $0x4,%eax 801028ad: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801028ae: 89 ca mov %ecx,%edx 801028b0: ec in (%dx),%al 801028b1: 0f b6 c0 movzbl %al,%eax } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801028b4: 89 da mov %ebx,%edx 801028b6: 89 45 d8 mov %eax,-0x28(%ebp) 801028b9: b8 07 00 00 00 mov $0x7,%eax 801028be: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801028bf: 89 ca mov %ecx,%edx 801028c1: ec in (%dx),%al 801028c2: 0f b6 c0 movzbl %al,%eax } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801028c5: 89 da mov %ebx,%edx 801028c7: 89 45 dc mov %eax,-0x24(%ebp) 801028ca: b8 08 00 00 00 mov $0x8,%eax 801028cf: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801028d0: 89 ca mov %ecx,%edx 801028d2: ec in (%dx),%al 801028d3: 0f b6 c0 movzbl %al,%eax } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801028d6: 89 da mov %ebx,%edx 801028d8: 89 45 e0 mov %eax,-0x20(%ebp) 801028db: b8 09 00 00 00 mov $0x9,%eax 801028e0: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801028e1: 89 ca mov %ecx,%edx 801028e3: ec in (%dx),%al 801028e4: 0f b6 c8 movzbl %al,%ecx for(;;) { fill_rtcdate(&t1); if(cmos_read(CMOS_STATA) & CMOS_UIP) continue; fill_rtcdate(&t2); if(memcmp(&t1, &t2, sizeof(t1)) == 0) 801028e7: 8d 55 b8 lea -0x48(%ebp),%edx 801028ea: 8d 45 d0 lea -0x30(%ebp),%eax cmos_read(uint reg) { outb(CMOS_PORT, reg); microdelay(200); return inb(CMOS_RETURN); 801028ed: 89 4d e4 mov %ecx,-0x1c(%ebp) for(;;) { fill_rtcdate(&t1); if(cmos_read(CMOS_STATA) & CMOS_UIP) continue; fill_rtcdate(&t2); if(memcmp(&t1, &t2, sizeof(t1)) == 0) 801028f0: c7 44 24 08 18 00 00 movl $0x18,0x8(%esp) 801028f7: 00 801028f8: 89 44 24 04 mov %eax,0x4(%esp) 801028fc: 89 14 24 mov %edx,(%esp) 801028ff: e8 9c 1a 00 00 call 801043a0 <memcmp> 80102904: 85 c0 test %eax,%eax 80102906: 0f 85 ec fe ff ff jne 801027f8 <cmostime+0x28> break; } // convert if(bcd) { 8010290c: 8b 45 a4 mov -0x5c(%ebp),%eax 8010290f: 85 c0 test %eax,%eax 80102911: 75 78 jne 8010298b <cmostime+0x1bb> #define CONV(x) (t1.x = ((t1.x >> 4) * 10) + (t1.x & 0xf)) CONV(second); 80102913: 8b 45 b8 mov -0x48(%ebp),%eax 80102916: 89 c2 mov %eax,%edx 80102918: 83 e0 0f and $0xf,%eax 8010291b: c1 ea 04 shr $0x4,%edx 8010291e: 8d 14 92 lea (%edx,%edx,4),%edx 80102921: 8d 04 50 lea (%eax,%edx,2),%eax 80102924: 89 45 b8 mov %eax,-0x48(%ebp) CONV(minute); 80102927: 8b 45 bc mov -0x44(%ebp),%eax 8010292a: 89 c2 mov %eax,%edx 8010292c: 83 e0 0f and $0xf,%eax 8010292f: c1 ea 04 shr $0x4,%edx 80102932: 8d 14 92 lea (%edx,%edx,4),%edx 80102935: 8d 04 50 lea (%eax,%edx,2),%eax 80102938: 89 45 bc mov %eax,-0x44(%ebp) CONV(hour ); 8010293b: 8b 45 c0 mov -0x40(%ebp),%eax 8010293e: 89 c2 mov %eax,%edx 80102940: 83 e0 0f and $0xf,%eax 80102943: c1 ea 04 shr $0x4,%edx 80102946: 8d 14 92 lea (%edx,%edx,4),%edx 80102949: 8d 04 50 lea (%eax,%edx,2),%eax 8010294c: 89 45 c0 mov %eax,-0x40(%ebp) CONV(day ); 8010294f: 8b 45 c4 mov -0x3c(%ebp),%eax 80102952: 89 c2 mov %eax,%edx 80102954: 83 e0 0f and $0xf,%eax 80102957: c1 ea 04 shr $0x4,%edx 8010295a: 8d 14 92 lea (%edx,%edx,4),%edx 8010295d: 8d 04 50 lea (%eax,%edx,2),%eax 80102960: 89 45 c4 mov %eax,-0x3c(%ebp) CONV(month ); 80102963: 8b 45 c8 mov -0x38(%ebp),%eax 80102966: 89 c2 mov %eax,%edx 80102968: 83 e0 0f and $0xf,%eax 8010296b: c1 ea 04 shr $0x4,%edx 8010296e: 8d 14 92 lea (%edx,%edx,4),%edx 80102971: 8d 04 50 lea (%eax,%edx,2),%eax 80102974: 89 45 c8 mov %eax,-0x38(%ebp) CONV(year ); 80102977: 8b 45 cc mov -0x34(%ebp),%eax 8010297a: 89 c2 mov %eax,%edx 8010297c: 83 e0 0f and $0xf,%eax 8010297f: c1 ea 04 shr $0x4,%edx 80102982: 8d 14 92 lea (%edx,%edx,4),%edx 80102985: 8d 04 50 lea (%eax,%edx,2),%eax 80102988: 89 45 cc mov %eax,-0x34(%ebp) #undef CONV } *r = t1; 8010298b: 8b 55 08 mov 0x8(%ebp),%edx 8010298e: 8b 45 b8 mov -0x48(%ebp),%eax 80102991: 89 02 mov %eax,(%edx) 80102993: 8b 45 bc mov -0x44(%ebp),%eax 80102996: 89 42 04 mov %eax,0x4(%edx) 80102999: 8b 45 c0 mov -0x40(%ebp),%eax 8010299c: 89 42 08 mov %eax,0x8(%edx) 8010299f: 8b 45 c4 mov -0x3c(%ebp),%eax 801029a2: 89 42 0c mov %eax,0xc(%edx) 801029a5: 8b 45 c8 mov -0x38(%ebp),%eax 801029a8: 89 42 10 mov %eax,0x10(%edx) 801029ab: 8b 45 cc mov -0x34(%ebp),%eax 801029ae: 89 42 14 mov %eax,0x14(%edx) r->year += 2000; 801029b1: 81 42 14 d0 07 00 00 addl $0x7d0,0x14(%edx) } 801029b8: 83 c4 6c add $0x6c,%esp 801029bb: 5b pop %ebx 801029bc: 5e pop %esi 801029bd: 5f pop %edi 801029be: 5d pop %ebp 801029bf: c3 ret 801029c0 <install_trans>: } // Copy committed blocks from log to their home location static void install_trans(void) { 801029c0: 55 push %ebp 801029c1: 89 e5 mov %esp,%ebp 801029c3: 57 push %edi 801029c4: 56 push %esi 801029c5: 53 push %ebx 801029c6: 83 ec 1c sub $0x1c,%esp int tail; for (tail = 0; tail < log.lh.n; tail++) { 801029c9: a1 c8 26 11 80 mov 0x801126c8,%eax 801029ce: 85 c0 test %eax,%eax 801029d0: 7e 7a jle 80102a4c <install_trans+0x8c> 801029d2: 31 db xor %ebx,%ebx 801029d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block 801029d8: a1 b4 26 11 80 mov 0x801126b4,%eax 801029dd: 01 d8 add %ebx,%eax 801029df: 83 c0 01 add $0x1,%eax 801029e2: 89 44 24 04 mov %eax,0x4(%esp) 801029e6: a1 c4 26 11 80 mov 0x801126c4,%eax 801029eb: 89 04 24 mov %eax,(%esp) 801029ee: e8 dd d6 ff ff call 801000d0 <bread> 801029f3: 89 c7 mov %eax,%edi struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst 801029f5: 8b 04 9d cc 26 11 80 mov -0x7feed934(,%ebx,4),%eax static void install_trans(void) { int tail; for (tail = 0; tail < log.lh.n; tail++) { 801029fc: 83 c3 01 add $0x1,%ebx struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst 801029ff: 89 44 24 04 mov %eax,0x4(%esp) 80102a03: a1 c4 26 11 80 mov 0x801126c4,%eax 80102a08: 89 04 24 mov %eax,(%esp) 80102a0b: e8 c0 d6 ff ff call 801000d0 <bread> memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst 80102a10: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) 80102a17: 00 { int tail; for (tail = 0; tail < log.lh.n; tail++) { struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst 80102a18: 89 c6 mov %eax,%esi memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst 80102a1a: 8d 47 5c lea 0x5c(%edi),%eax 80102a1d: 89 44 24 04 mov %eax,0x4(%esp) 80102a21: 8d 46 5c lea 0x5c(%esi),%eax 80102a24: 89 04 24 mov %eax,(%esp) 80102a27: e8 d4 19 00 00 call 80104400 <memmove> bwrite(dbuf); // write dst to disk 80102a2c: 89 34 24 mov %esi,(%esp) 80102a2f: e8 6c d7 ff ff call 801001a0 <bwrite> brelse(lbuf); 80102a34: 89 3c 24 mov %edi,(%esp) 80102a37: e8 a4 d7 ff ff call 801001e0 <brelse> brelse(dbuf); 80102a3c: 89 34 24 mov %esi,(%esp) 80102a3f: e8 9c d7 ff ff call 801001e0 <brelse> static void install_trans(void) { int tail; for (tail = 0; tail < log.lh.n; tail++) { 80102a44: 39 1d c8 26 11 80 cmp %ebx,0x801126c8 80102a4a: 7f 8c jg 801029d8 <install_trans+0x18> memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst bwrite(dbuf); // write dst to disk brelse(lbuf); brelse(dbuf); } } 80102a4c: 83 c4 1c add $0x1c,%esp 80102a4f: 5b pop %ebx 80102a50: 5e pop %esi 80102a51: 5f pop %edi 80102a52: 5d pop %ebp 80102a53: c3 ret 80102a54: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80102a5a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 80102a60 <write_head>: // Write in-memory log header to disk. // This is the true point at which the // current transaction commits. static void write_head(void) { 80102a60: 55 push %ebp 80102a61: 89 e5 mov %esp,%ebp 80102a63: 57 push %edi 80102a64: 56 push %esi 80102a65: 53 push %ebx 80102a66: 83 ec 1c sub $0x1c,%esp struct buf *buf = bread(log.dev, log.start); 80102a69: a1 b4 26 11 80 mov 0x801126b4,%eax 80102a6e: 89 44 24 04 mov %eax,0x4(%esp) 80102a72: a1 c4 26 11 80 mov 0x801126c4,%eax 80102a77: 89 04 24 mov %eax,(%esp) 80102a7a: e8 51 d6 ff ff call 801000d0 <bread> struct logheader *hb = (struct logheader *) (buf->data); int i; hb->n = log.lh.n; 80102a7f: 8b 1d c8 26 11 80 mov 0x801126c8,%ebx for (i = 0; i < log.lh.n; i++) { 80102a85: 85 db test %ebx,%ebx // This is the true point at which the // current transaction commits. static void write_head(void) { struct buf *buf = bread(log.dev, log.start); 80102a87: 89 c7 mov %eax,%edi struct logheader *hb = (struct logheader *) (buf->data); int i; hb->n = log.lh.n; 80102a89: 89 58 5c mov %ebx,0x5c(%eax) for (i = 0; i < log.lh.n; i++) { 80102a8c: 7e 1c jle 80102aaa <write_head+0x4a> 80102a8e: 31 d2 xor %edx,%edx 80102a90: 8d 70 5c lea 0x5c(%eax),%esi 80102a93: 90 nop 80102a94: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi hb->block[i] = log.lh.block[i]; 80102a98: 8b 0c 95 cc 26 11 80 mov -0x7feed934(,%edx,4),%ecx 80102a9f: 89 4c 96 04 mov %ecx,0x4(%esi,%edx,4) { struct buf *buf = bread(log.dev, log.start); struct logheader *hb = (struct logheader *) (buf->data); int i; hb->n = log.lh.n; for (i = 0; i < log.lh.n; i++) { 80102aa3: 83 c2 01 add $0x1,%edx 80102aa6: 39 da cmp %ebx,%edx 80102aa8: 75 ee jne 80102a98 <write_head+0x38> hb->block[i] = log.lh.block[i]; } bwrite(buf); 80102aaa: 89 3c 24 mov %edi,(%esp) 80102aad: e8 ee d6 ff ff call 801001a0 <bwrite> brelse(buf); 80102ab2: 89 3c 24 mov %edi,(%esp) 80102ab5: e8 26 d7 ff ff call 801001e0 <brelse> } 80102aba: 83 c4 1c add $0x1c,%esp 80102abd: 5b pop %ebx 80102abe: 5e pop %esi 80102abf: 5f pop %edi 80102ac0: 5d pop %ebp 80102ac1: c3 ret 80102ac2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102ac9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80102ad0 <initlog>: static void recover_from_log(void); static void commit(); void initlog(int dev) { 80102ad0: 55 push %ebp 80102ad1: 89 e5 mov %esp,%ebp 80102ad3: 56 push %esi 80102ad4: 53 push %ebx 80102ad5: 83 ec 30 sub $0x30,%esp 80102ad8: 8b 5d 08 mov 0x8(%ebp),%ebx if (sizeof(struct logheader) >= BSIZE) panic("initlog: too big logheader"); struct superblock sb; initlock(&log.lock, "log"); 80102adb: c7 44 24 04 d0 71 10 movl $0x801071d0,0x4(%esp) 80102ae2: 80 80102ae3: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) 80102aea: e8 21 16 00 00 call 80104110 <initlock> readsb(dev, &sb); 80102aef: 8d 45 dc lea -0x24(%ebp),%eax 80102af2: 89 44 24 04 mov %eax,0x4(%esp) 80102af6: 89 1c 24 mov %ebx,(%esp) 80102af9: e8 12 e9 ff ff call 80101410 <readsb> log.start = sb.logstart; 80102afe: 8b 45 ec mov -0x14(%ebp),%eax log.size = sb.nlog; 80102b01: 8b 55 e8 mov -0x18(%ebp),%edx log.dev = dev; 80102b04: 89 1d c4 26 11 80 mov %ebx,0x801126c4 // Read the log header from disk into the in-memory log header static void read_head(void) { struct buf *buf = bread(log.dev, log.start); 80102b0a: 89 1c 24 mov %ebx,(%esp) panic("initlog: too big logheader"); struct superblock sb; initlock(&log.lock, "log"); readsb(dev, &sb); log.start = sb.logstart; 80102b0d: a3 b4 26 11 80 mov %eax,0x801126b4 log.size = sb.nlog; 80102b12: 89 15 b8 26 11 80 mov %edx,0x801126b8 // Read the log header from disk into the in-memory log header static void read_head(void) { struct buf *buf = bread(log.dev, log.start); 80102b18: 89 44 24 04 mov %eax,0x4(%esp) 80102b1c: e8 af d5 ff ff call 801000d0 <bread> struct logheader *lh = (struct logheader *) (buf->data); int i; log.lh.n = lh->n; 80102b21: 8b 58 5c mov 0x5c(%eax),%ebx for (i = 0; i < log.lh.n; i++) { 80102b24: 85 db test %ebx,%ebx read_head(void) { struct buf *buf = bread(log.dev, log.start); struct logheader *lh = (struct logheader *) (buf->data); int i; log.lh.n = lh->n; 80102b26: 89 1d c8 26 11 80 mov %ebx,0x801126c8 for (i = 0; i < log.lh.n; i++) { 80102b2c: 7e 1c jle 80102b4a <initlog+0x7a> 80102b2e: 31 d2 xor %edx,%edx 80102b30: 8d 70 5c lea 0x5c(%eax),%esi 80102b33: 90 nop 80102b34: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi log.lh.block[i] = lh->block[i]; 80102b38: 8b 4c 96 04 mov 0x4(%esi,%edx,4),%ecx 80102b3c: 89 0c 95 cc 26 11 80 mov %ecx,-0x7feed934(,%edx,4) { struct buf *buf = bread(log.dev, log.start); struct logheader *lh = (struct logheader *) (buf->data); int i; log.lh.n = lh->n; for (i = 0; i < log.lh.n; i++) { 80102b43: 83 c2 01 add $0x1,%edx 80102b46: 39 da cmp %ebx,%edx 80102b48: 75 ee jne 80102b38 <initlog+0x68> log.lh.block[i] = lh->block[i]; } brelse(buf); 80102b4a: 89 04 24 mov %eax,(%esp) 80102b4d: e8 8e d6 ff ff call 801001e0 <brelse> static void recover_from_log(void) { read_head(); install_trans(); // if committed, copy from log to disk 80102b52: e8 69 fe ff ff call 801029c0 <install_trans> log.lh.n = 0; 80102b57: c7 05 c8 26 11 80 00 movl $0x0,0x801126c8 80102b5e: 00 00 00 write_head(); // clear the log 80102b61: e8 fa fe ff ff call 80102a60 <write_head> readsb(dev, &sb); log.start = sb.logstart; log.size = sb.nlog; log.dev = dev; recover_from_log(); } 80102b66: 83 c4 30 add $0x30,%esp 80102b69: 5b pop %ebx 80102b6a: 5e pop %esi 80102b6b: 5d pop %ebp 80102b6c: c3 ret 80102b6d: 8d 76 00 lea 0x0(%esi),%esi 80102b70 <begin_op>: } // called at the start of each FS system call. void begin_op(void) { 80102b70: 55 push %ebp 80102b71: 89 e5 mov %esp,%ebp 80102b73: 83 ec 18 sub $0x18,%esp acquire(&log.lock); 80102b76: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) 80102b7d: e8 fe 16 00 00 call 80104280 <acquire> 80102b82: eb 18 jmp 80102b9c <begin_op+0x2c> 80102b84: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi while(1){ if(log.committing){ sleep(&log, &log.lock); } else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){ // this op might exhaust log space; wait for commit. sleep(&log, &log.lock); 80102b88: c7 44 24 04 80 26 11 movl $0x80112680,0x4(%esp) 80102b8f: 80 80102b90: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) 80102b97: e8 f4 10 00 00 call 80103c90 <sleep> void begin_op(void) { acquire(&log.lock); while(1){ if(log.committing){ 80102b9c: a1 c0 26 11 80 mov 0x801126c0,%eax 80102ba1: 85 c0 test %eax,%eax 80102ba3: 75 e3 jne 80102b88 <begin_op+0x18> sleep(&log, &log.lock); } else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){ 80102ba5: 8b 15 bc 26 11 80 mov 0x801126bc,%edx 80102bab: 8b 0d c8 26 11 80 mov 0x801126c8,%ecx 80102bb1: 83 c2 01 add $0x1,%edx 80102bb4: 8d 04 92 lea (%edx,%edx,4),%eax 80102bb7: 8d 04 41 lea (%ecx,%eax,2),%eax 80102bba: 83 f8 1e cmp $0x1e,%eax 80102bbd: 7f c9 jg 80102b88 <begin_op+0x18> // this op might exhaust log space; wait for commit. sleep(&log, &log.lock); } else { log.outstanding += 1; release(&log.lock); 80102bbf: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) sleep(&log, &log.lock); } else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){ // this op might exhaust log space; wait for commit. sleep(&log, &log.lock); } else { log.outstanding += 1; 80102bc6: 89 15 bc 26 11 80 mov %edx,0x801126bc release(&log.lock); 80102bcc: e8 1f 17 00 00 call 801042f0 <release> break; } } } 80102bd1: c9 leave 80102bd2: c3 ret 80102bd3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80102bd9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80102be0 <end_op>: // called at the end of each FS system call. // commits if this was the last outstanding operation. void end_op(void) { 80102be0: 55 push %ebp 80102be1: 89 e5 mov %esp,%ebp 80102be3: 57 push %edi 80102be4: 56 push %esi 80102be5: 53 push %ebx 80102be6: 83 ec 1c sub $0x1c,%esp int do_commit = 0; acquire(&log.lock); 80102be9: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) 80102bf0: e8 8b 16 00 00 call 80104280 <acquire> log.outstanding -= 1; 80102bf5: a1 bc 26 11 80 mov 0x801126bc,%eax if(log.committing) 80102bfa: 8b 15 c0 26 11 80 mov 0x801126c0,%edx end_op(void) { int do_commit = 0; acquire(&log.lock); log.outstanding -= 1; 80102c00: 83 e8 01 sub $0x1,%eax if(log.committing) 80102c03: 85 d2 test %edx,%edx end_op(void) { int do_commit = 0; acquire(&log.lock); log.outstanding -= 1; 80102c05: a3 bc 26 11 80 mov %eax,0x801126bc if(log.committing) 80102c0a: 0f 85 f3 00 00 00 jne 80102d03 <end_op+0x123> panic("log.committing"); if(log.outstanding == 0){ 80102c10: 85 c0 test %eax,%eax 80102c12: 0f 85 cb 00 00 00 jne 80102ce3 <end_op+0x103> do_commit = 1; log.committing = 1; 80102c18: c7 05 c0 26 11 80 01 movl $0x1,0x801126c0 80102c1f: 00 00 00 } static void commit() { if (log.lh.n > 0) { 80102c22: 31 db xor %ebx,%ebx // begin_op() may be waiting for log space, // and decrementing log.outstanding has decreased // the amount of reserved space. wakeup(&log); } release(&log.lock); 80102c24: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) 80102c2b: e8 c0 16 00 00 call 801042f0 <release> } static void commit() { if (log.lh.n > 0) { 80102c30: a1 c8 26 11 80 mov 0x801126c8,%eax 80102c35: 85 c0 test %eax,%eax 80102c37: 0f 8e 90 00 00 00 jle 80102ccd <end_op+0xed> 80102c3d: 8d 76 00 lea 0x0(%esi),%esi write_log(void) { int tail; for (tail = 0; tail < log.lh.n; tail++) { struct buf *to = bread(log.dev, log.start+tail+1); // log block 80102c40: a1 b4 26 11 80 mov 0x801126b4,%eax 80102c45: 01 d8 add %ebx,%eax 80102c47: 83 c0 01 add $0x1,%eax 80102c4a: 89 44 24 04 mov %eax,0x4(%esp) 80102c4e: a1 c4 26 11 80 mov 0x801126c4,%eax 80102c53: 89 04 24 mov %eax,(%esp) 80102c56: e8 75 d4 ff ff call 801000d0 <bread> 80102c5b: 89 c6 mov %eax,%esi struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block 80102c5d: 8b 04 9d cc 26 11 80 mov -0x7feed934(,%ebx,4),%eax static void write_log(void) { int tail; for (tail = 0; tail < log.lh.n; tail++) { 80102c64: 83 c3 01 add $0x1,%ebx struct buf *to = bread(log.dev, log.start+tail+1); // log block struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block 80102c67: 89 44 24 04 mov %eax,0x4(%esp) 80102c6b: a1 c4 26 11 80 mov 0x801126c4,%eax 80102c70: 89 04 24 mov %eax,(%esp) 80102c73: e8 58 d4 ff ff call 801000d0 <bread> memmove(to->data, from->data, BSIZE); 80102c78: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp) 80102c7f: 00 { int tail; for (tail = 0; tail < log.lh.n; tail++) { struct buf *to = bread(log.dev, log.start+tail+1); // log block struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block 80102c80: 89 c7 mov %eax,%edi memmove(to->data, from->data, BSIZE); 80102c82: 8d 40 5c lea 0x5c(%eax),%eax 80102c85: 89 44 24 04 mov %eax,0x4(%esp) 80102c89: 8d 46 5c lea 0x5c(%esi),%eax 80102c8c: 89 04 24 mov %eax,(%esp) 80102c8f: e8 6c 17 00 00 call 80104400 <memmove> bwrite(to); // write the log 80102c94: 89 34 24 mov %esi,(%esp) 80102c97: e8 04 d5 ff ff call 801001a0 <bwrite> brelse(from); 80102c9c: 89 3c 24 mov %edi,(%esp) 80102c9f: e8 3c d5 ff ff call 801001e0 <brelse> brelse(to); 80102ca4: 89 34 24 mov %esi,(%esp) 80102ca7: e8 34 d5 ff ff call 801001e0 <brelse> static void write_log(void) { int tail; for (tail = 0; tail < log.lh.n; tail++) { 80102cac: 3b 1d c8 26 11 80 cmp 0x801126c8,%ebx 80102cb2: 7c 8c jl 80102c40 <end_op+0x60> static void commit() { if (log.lh.n > 0) { write_log(); // Write modified blocks from cache to log write_head(); // Write header to disk -- the real commit 80102cb4: e8 a7 fd ff ff call 80102a60 <write_head> install_trans(); // Now install writes to home locations 80102cb9: e8 02 fd ff ff call 801029c0 <install_trans> log.lh.n = 0; 80102cbe: c7 05 c8 26 11 80 00 movl $0x0,0x801126c8 80102cc5: 00 00 00 write_head(); // Erase the transaction from the log 80102cc8: e8 93 fd ff ff call 80102a60 <write_head> if(do_commit){ // call commit w/o holding locks, since not allowed // to sleep with locks. commit(); acquire(&log.lock); 80102ccd: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) 80102cd4: e8 a7 15 00 00 call 80104280 <acquire> log.committing = 0; 80102cd9: c7 05 c0 26 11 80 00 movl $0x0,0x801126c0 80102ce0: 00 00 00 wakeup(&log); 80102ce3: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) 80102cea: e8 41 11 00 00 call 80103e30 <wakeup> release(&log.lock); 80102cef: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) 80102cf6: e8 f5 15 00 00 call 801042f0 <release> } } 80102cfb: 83 c4 1c add $0x1c,%esp 80102cfe: 5b pop %ebx 80102cff: 5e pop %esi 80102d00: 5f pop %edi 80102d01: 5d pop %ebp 80102d02: c3 ret int do_commit = 0; acquire(&log.lock); log.outstanding -= 1; if(log.committing) panic("log.committing"); 80102d03: c7 04 24 d4 71 10 80 movl $0x801071d4,(%esp) 80102d0a: e8 61 d6 ff ff call 80100370 <panic> 80102d0f: 90 nop 80102d10 <log_write>: // modify bp->data[] // log_write(bp) // brelse(bp) void log_write(struct buf *b) { 80102d10: 55 push %ebp 80102d11: 89 e5 mov %esp,%ebp 80102d13: 53 push %ebx 80102d14: 83 ec 14 sub $0x14,%esp int i; if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1) 80102d17: a1 c8 26 11 80 mov 0x801126c8,%eax // modify bp->data[] // log_write(bp) // brelse(bp) void log_write(struct buf *b) { 80102d1c: 8b 5d 08 mov 0x8(%ebp),%ebx int i; if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1) 80102d1f: 83 f8 1d cmp $0x1d,%eax 80102d22: 0f 8f 98 00 00 00 jg 80102dc0 <log_write+0xb0> 80102d28: 8b 15 b8 26 11 80 mov 0x801126b8,%edx 80102d2e: 83 ea 01 sub $0x1,%edx 80102d31: 39 d0 cmp %edx,%eax 80102d33: 0f 8d 87 00 00 00 jge 80102dc0 <log_write+0xb0> panic("too big a transaction"); if (log.outstanding < 1) 80102d39: 8b 0d bc 26 11 80 mov 0x801126bc,%ecx 80102d3f: 85 c9 test %ecx,%ecx 80102d41: 0f 8e 85 00 00 00 jle 80102dcc <log_write+0xbc> panic("log_write outside of trans"); acquire(&log.lock); 80102d47: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) 80102d4e: e8 2d 15 00 00 call 80104280 <acquire> for (i = 0; i < log.lh.n; i++) { 80102d53: 8b 15 c8 26 11 80 mov 0x801126c8,%edx 80102d59: 83 fa 00 cmp $0x0,%edx 80102d5c: 7e 53 jle 80102db1 <log_write+0xa1> if (log.lh.block[i] == b->blockno) // log absorbtion 80102d5e: 8b 4b 08 mov 0x8(%ebx),%ecx panic("too big a transaction"); if (log.outstanding < 1) panic("log_write outside of trans"); acquire(&log.lock); for (i = 0; i < log.lh.n; i++) { 80102d61: 31 c0 xor %eax,%eax if (log.lh.block[i] == b->blockno) // log absorbtion 80102d63: 39 0d cc 26 11 80 cmp %ecx,0x801126cc 80102d69: 75 0e jne 80102d79 <log_write+0x69> 80102d6b: eb 3b jmp 80102da8 <log_write+0x98> 80102d6d: 8d 76 00 lea 0x0(%esi),%esi 80102d70: 39 0c 85 cc 26 11 80 cmp %ecx,-0x7feed934(,%eax,4) 80102d77: 74 2f je 80102da8 <log_write+0x98> panic("too big a transaction"); if (log.outstanding < 1) panic("log_write outside of trans"); acquire(&log.lock); for (i = 0; i < log.lh.n; i++) { 80102d79: 83 c0 01 add $0x1,%eax 80102d7c: 39 d0 cmp %edx,%eax 80102d7e: 75 f0 jne 80102d70 <log_write+0x60> if (log.lh.block[i] == b->blockno) // log absorbtion break; } log.lh.block[i] = b->blockno; 80102d80: 89 0c 95 cc 26 11 80 mov %ecx,-0x7feed934(,%edx,4) if (i == log.lh.n) log.lh.n++; 80102d87: 83 c2 01 add $0x1,%edx 80102d8a: 89 15 c8 26 11 80 mov %edx,0x801126c8 b->flags |= B_DIRTY; // prevent eviction 80102d90: 83 0b 04 orl $0x4,(%ebx) release(&log.lock); 80102d93: c7 45 08 80 26 11 80 movl $0x80112680,0x8(%ebp) } 80102d9a: 83 c4 14 add $0x14,%esp 80102d9d: 5b pop %ebx 80102d9e: 5d pop %ebp } log.lh.block[i] = b->blockno; if (i == log.lh.n) log.lh.n++; b->flags |= B_DIRTY; // prevent eviction release(&log.lock); 80102d9f: e9 4c 15 00 00 jmp 801042f0 <release> 80102da4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi acquire(&log.lock); for (i = 0; i < log.lh.n; i++) { if (log.lh.block[i] == b->blockno) // log absorbtion break; } log.lh.block[i] = b->blockno; 80102da8: 89 0c 85 cc 26 11 80 mov %ecx,-0x7feed934(,%eax,4) 80102daf: eb df jmp 80102d90 <log_write+0x80> 80102db1: 8b 43 08 mov 0x8(%ebx),%eax 80102db4: a3 cc 26 11 80 mov %eax,0x801126cc if (i == log.lh.n) 80102db9: 75 d5 jne 80102d90 <log_write+0x80> 80102dbb: eb ca jmp 80102d87 <log_write+0x77> 80102dbd: 8d 76 00 lea 0x0(%esi),%esi log_write(struct buf *b) { int i; if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1) panic("too big a transaction"); 80102dc0: c7 04 24 e3 71 10 80 movl $0x801071e3,(%esp) 80102dc7: e8 a4 d5 ff ff call 80100370 <panic> if (log.outstanding < 1) panic("log_write outside of trans"); 80102dcc: c7 04 24 f9 71 10 80 movl $0x801071f9,(%esp) 80102dd3: e8 98 d5 ff ff call 80100370 <panic> ... 80102de0 <mpmain>: } // Common CPU setup code. static void mpmain(void) { 80102de0: 55 push %ebp 80102de1: 89 e5 mov %esp,%ebp 80102de3: 53 push %ebx 80102de4: 83 ec 14 sub $0x14,%esp cprintf("cpu%d: starting %d\n", cpuid(), cpuid()); 80102de7: e8 24 09 00 00 call 80103710 <cpuid> 80102dec: 89 c3 mov %eax,%ebx 80102dee: e8 1d 09 00 00 call 80103710 <cpuid> 80102df3: 89 5c 24 08 mov %ebx,0x8(%esp) 80102df7: c7 04 24 14 72 10 80 movl $0x80107214,(%esp) 80102dfe: 89 44 24 04 mov %eax,0x4(%esp) 80102e02: e8 49 d8 ff ff call 80100650 <cprintf> idtinit(); // load idt register 80102e07: e8 a4 27 00 00 call 801055b0 <idtinit> xchg(&(mycpu()->started), 1); // tell startothers() we're up 80102e0c: e8 7f 08 00 00 call 80103690 <mycpu> 80102e11: 89 c2 mov %eax,%edx xchg(volatile uint *addr, uint newval) { uint result; // The + in "+m" denotes a read-modify-write operand. asm volatile("lock; xchgl %0, %1" : 80102e13: b8 01 00 00 00 mov $0x1,%eax 80102e18: f0 87 82 a0 00 00 00 lock xchg %eax,0xa0(%edx) scheduler(); // start running processes 80102e1f: e8 cc 0b 00 00 call 801039f0 <scheduler> 80102e24: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80102e2a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 80102e30 <mpenter>: } // Other CPUs jump here from entryother.S. static void mpenter(void) { 80102e30: 55 push %ebp 80102e31: 89 e5 mov %esp,%ebp 80102e33: 83 ec 08 sub $0x8,%esp switchkvm(); 80102e36: e8 c5 37 00 00 call 80106600 <switchkvm> seginit(); 80102e3b: e8 e0 36 00 00 call 80106520 <seginit> lapicinit(); 80102e40: e8 bb f7 ff ff call 80102600 <lapicinit> mpmain(); 80102e45: e8 96 ff ff ff call 80102de0 <mpmain> 80102e4a: 00 00 add %al,(%eax) 80102e4c: 00 00 add %al,(%eax) ... 80102e50 <main>: // Bootstrap processor starts running C code here. // Allocate a real stack and switch to it, first // doing some setup required for memory allocator to work. int main(void) { 80102e50: 55 push %ebp 80102e51: 89 e5 mov %esp,%ebp 80102e53: 53 push %ebx 80102e54: 83 e4 f0 and $0xfffffff0,%esp 80102e57: 83 ec 10 sub $0x10,%esp kinit1(end, P2V(4*1024*1024)); // phys page allocator 80102e5a: c7 44 24 04 00 00 40 movl $0x80400000,0x4(%esp) 80102e61: 80 80102e62: c7 04 24 a8 54 11 80 movl $0x801154a8,(%esp) 80102e69: e8 f2 f5 ff ff call 80102460 <kinit1> kvmalloc(); // kernel page table 80102e6e: e8 cd 3c 00 00 call 80106b40 <kvmalloc> mpinit(); // detect other processors 80102e73: e8 68 01 00 00 call 80102fe0 <mpinit> lapicinit(); // interrupt controller 80102e78: e8 83 f7 ff ff call 80102600 <lapicinit> 80102e7d: 8d 76 00 lea 0x0(%esi),%esi seginit(); // segment descriptors 80102e80: e8 9b 36 00 00 call 80106520 <seginit> picinit(); // disable pic 80102e85: e8 26 03 00 00 call 801031b0 <picinit> ioapicinit(); // another interrupt controller 80102e8a: e8 d1 f3 ff ff call 80102260 <ioapicinit> 80102e8f: 90 nop consoleinit(); // console hardware 80102e90: e8 cb da ff ff call 80100960 <consoleinit> uartinit(); // serial port 80102e95: e8 46 2a 00 00 call 801058e0 <uartinit> pinit(); // process table 80102e9a: e8 d1 07 00 00 call 80103670 <pinit> 80102e9f: 90 nop tvinit(); // trap vectors 80102ea0: e8 7b 26 00 00 call 80105520 <tvinit> binit(); // buffer cache 80102ea5: e8 96 d1 ff ff call 80100040 <binit> fileinit(); // file table 80102eaa: e8 91 de ff ff call 80100d40 <fileinit> 80102eaf: 90 nop ideinit(); // disk 80102eb0: e8 bb f1 ff ff call 80102070 <ideinit> // Write entry code to unused memory at 0x7000. // The linker has placed the image of entryother.S in // _binary_entryother_start. code = P2V(0x7000); memmove(code, _binary_entryother_start, (uint)_binary_entryother_size); 80102eb5: c7 44 24 08 8a 00 00 movl $0x8a,0x8(%esp) 80102ebc: 00 80102ebd: c7 44 24 04 8c a4 10 movl $0x8010a48c,0x4(%esp) 80102ec4: 80 80102ec5: c7 04 24 00 70 00 80 movl $0x80007000,(%esp) 80102ecc: e8 2f 15 00 00 call 80104400 <memmove> for(c = cpus; c < cpus+ncpu; c++){ 80102ed1: 69 05 00 2d 11 80 b0 imul $0xb0,0x80112d00,%eax 80102ed8: 00 00 00 80102edb: 05 80 27 11 80 add $0x80112780,%eax 80102ee0: 3d 80 27 11 80 cmp $0x80112780,%eax 80102ee5: 76 6c jbe 80102f53 <main+0x103> 80102ee7: bb 80 27 11 80 mov $0x80112780,%ebx 80102eec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if(c == mycpu()) // We've started already. 80102ef0: e8 9b 07 00 00 call 80103690 <mycpu> 80102ef5: 39 d8 cmp %ebx,%eax 80102ef7: 74 41 je 80102f3a <main+0xea> continue; // Tell entryother.S what stack to use, where to enter, and what // pgdir to use. We cannot use kpgdir yet, because the AP processor // is running in low memory, so we use entrypgdir for the APs too. stack = kalloc(); 80102ef9: e8 b2 f5 ff ff call 801024b0 <kalloc> *(void**)(code-4) = stack + KSTACKSIZE; *(void(**)(void))(code-8) = mpenter; 80102efe: c7 05 f8 6f 00 80 30 movl $0x80102e30,0x80006ff8 80102f05: 2e 10 80 *(int**)(code-12) = (void *) V2P(entrypgdir); 80102f08: c7 05 f4 6f 00 80 00 movl $0x109000,0x80006ff4 80102f0f: 90 10 00 // Tell entryother.S what stack to use, where to enter, and what // pgdir to use. We cannot use kpgdir yet, because the AP processor // is running in low memory, so we use entrypgdir for the APs too. stack = kalloc(); *(void**)(code-4) = stack + KSTACKSIZE; 80102f12: 05 00 10 00 00 add $0x1000,%eax 80102f17: a3 fc 6f 00 80 mov %eax,0x80006ffc *(void(**)(void))(code-8) = mpenter; *(int**)(code-12) = (void *) V2P(entrypgdir); lapicstartap(c->apicid, V2P(code)); 80102f1c: 0f b6 03 movzbl (%ebx),%eax 80102f1f: c7 44 24 04 00 70 00 movl $0x7000,0x4(%esp) 80102f26: 00 80102f27: 89 04 24 mov %eax,(%esp) 80102f2a: e8 11 f8 ff ff call 80102740 <lapicstartap> 80102f2f: 90 nop // wait for cpu to finish mpmain() while(c->started == 0) 80102f30: 8b 83 a0 00 00 00 mov 0xa0(%ebx),%eax 80102f36: 85 c0 test %eax,%eax 80102f38: 74 f6 je 80102f30 <main+0xe0> // The linker has placed the image of entryother.S in // _binary_entryother_start. code = P2V(0x7000); memmove(code, _binary_entryother_start, (uint)_binary_entryother_size); for(c = cpus; c < cpus+ncpu; c++){ 80102f3a: 69 05 00 2d 11 80 b0 imul $0xb0,0x80112d00,%eax 80102f41: 00 00 00 80102f44: 81 c3 b0 00 00 00 add $0xb0,%ebx 80102f4a: 05 80 27 11 80 add $0x80112780,%eax 80102f4f: 39 c3 cmp %eax,%ebx 80102f51: 72 9d jb 80102ef0 <main+0xa0> tvinit(); // trap vectors binit(); // buffer cache fileinit(); // file table ideinit(); // disk startothers(); // start other processors kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers() 80102f53: c7 44 24 04 00 00 00 movl $0x8e000000,0x4(%esp) 80102f5a: 8e 80102f5b: c7 04 24 00 00 40 80 movl $0x80400000,(%esp) 80102f62: e8 c9 f4 ff ff call 80102430 <kinit2> userinit(); // first user process 80102f67: e8 f4 07 00 00 call 80103760 <userinit> mpmain(); // finish this processor's setup 80102f6c: e8 6f fe ff ff call 80102de0 <mpmain> ... 80102f80 <mpsearch1>: } // Look for an MP structure in the len bytes at addr. static struct mp* mpsearch1(uint a, int len) { 80102f80: 55 push %ebp uchar *e, *p, *addr; addr = P2V(a); 80102f81: 05 00 00 00 80 add $0x80000000,%eax } // Look for an MP structure in the len bytes at addr. static struct mp* mpsearch1(uint a, int len) { 80102f86: 89 e5 mov %esp,%ebp 80102f88: 56 push %esi 80102f89: 53 push %ebx addr = P2V(a); e = addr+len; for(p = addr; p < e; p += sizeof(struct mp)) if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) return (struct mp*)p; return 0; 80102f8a: 31 db xor %ebx,%ebx mpsearch1(uint a, int len) { uchar *e, *p, *addr; addr = P2V(a); e = addr+len; 80102f8c: 8d 34 10 lea (%eax,%edx,1),%esi } // Look for an MP structure in the len bytes at addr. static struct mp* mpsearch1(uint a, int len) { 80102f8f: 83 ec 10 sub $0x10,%esp uchar *e, *p, *addr; addr = P2V(a); e = addr+len; for(p = addr; p < e; p += sizeof(struct mp)) 80102f92: 39 f0 cmp %esi,%eax 80102f94: 73 3d jae 80102fd3 <mpsearch1+0x53> 80102f96: 89 c3 mov %eax,%ebx if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) 80102f98: c7 44 24 08 04 00 00 movl $0x4,0x8(%esp) 80102f9f: 00 80102fa0: c7 44 24 04 28 72 10 movl $0x80107228,0x4(%esp) 80102fa7: 80 80102fa8: 89 1c 24 mov %ebx,(%esp) 80102fab: e8 f0 13 00 00 call 801043a0 <memcmp> 80102fb0: 85 c0 test %eax,%eax 80102fb2: 75 16 jne 80102fca <mpsearch1+0x4a> 80102fb4: 31 d2 xor %edx,%edx 80102fb6: 66 90 xchg %ax,%ax { int i, sum; sum = 0; for(i=0; i<len; i++) sum += addr[i]; 80102fb8: 0f b6 0c 03 movzbl (%ebx,%eax,1),%ecx sum(uchar *addr, int len) { int i, sum; sum = 0; for(i=0; i<len; i++) 80102fbc: 83 c0 01 add $0x1,%eax sum += addr[i]; 80102fbf: 01 ca add %ecx,%edx sum(uchar *addr, int len) { int i, sum; sum = 0; for(i=0; i<len; i++) 80102fc1: 83 f8 10 cmp $0x10,%eax 80102fc4: 75 f2 jne 80102fb8 <mpsearch1+0x38> uchar *e, *p, *addr; addr = P2V(a); e = addr+len; for(p = addr; p < e; p += sizeof(struct mp)) if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) 80102fc6: 84 d2 test %dl,%dl 80102fc8: 74 09 je 80102fd3 <mpsearch1+0x53> { uchar *e, *p, *addr; addr = P2V(a); e = addr+len; for(p = addr; p < e; p += sizeof(struct mp)) 80102fca: 83 c3 10 add $0x10,%ebx 80102fcd: 39 de cmp %ebx,%esi 80102fcf: 77 c7 ja 80102f98 <mpsearch1+0x18> if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) return (struct mp*)p; return 0; 80102fd1: 31 db xor %ebx,%ebx } 80102fd3: 83 c4 10 add $0x10,%esp 80102fd6: 89 d8 mov %ebx,%eax 80102fd8: 5b pop %ebx 80102fd9: 5e pop %esi 80102fda: 5d pop %ebp 80102fdb: c3 ret 80102fdc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102fe0 <mpinit>: return conf; } void mpinit(void) { 80102fe0: 55 push %ebp 80102fe1: 89 e5 mov %esp,%ebp 80102fe3: 57 push %edi 80102fe4: 56 push %esi 80102fe5: 53 push %ebx 80102fe6: 83 ec 2c sub $0x2c,%esp uchar *bda; uint p; struct mp *mp; bda = (uchar *) P2V(0x400); if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){ 80102fe9: 0f b6 05 0f 04 00 80 movzbl 0x8000040f,%eax 80102ff0: 0f b6 15 0e 04 00 80 movzbl 0x8000040e,%edx 80102ff7: c1 e0 08 shl $0x8,%eax 80102ffa: 09 d0 or %edx,%eax 80102ffc: c1 e0 04 shl $0x4,%eax 80102fff: 85 c0 test %eax,%eax 80103001: 75 1b jne 8010301e <mpinit+0x3e> if((mp = mpsearch1(p, 1024))) return mp; } else { p = ((bda[0x14]<<8)|bda[0x13])*1024; 80103003: 0f b6 05 14 04 00 80 movzbl 0x80000414,%eax 8010300a: 0f b6 15 13 04 00 80 movzbl 0x80000413,%edx 80103011: c1 e0 08 shl $0x8,%eax 80103014: 09 d0 or %edx,%eax 80103016: c1 e0 0a shl $0xa,%eax if((mp = mpsearch1(p-1024, 1024))) 80103019: 2d 00 04 00 00 sub $0x400,%eax 8010301e: ba 00 04 00 00 mov $0x400,%edx 80103023: e8 58 ff ff ff call 80102f80 <mpsearch1> 80103028: 85 c0 test %eax,%eax 8010302a: 89 c6 mov %eax,%esi 8010302c: 0f 84 38 01 00 00 je 8010316a <mpinit+0x18a> mpconfig(struct mp **pmp) { struct mpconf *conf; struct mp *mp; if((mp = mpsearch()) == 0 || mp->physaddr == 0) 80103032: 8b 5e 04 mov 0x4(%esi),%ebx 80103035: 85 db test %ebx,%ebx 80103037: 0f 84 46 01 00 00 je 80103183 <mpinit+0x1a3> return 0; conf = (struct mpconf*) P2V((uint) mp->physaddr); 8010303d: 8d 93 00 00 00 80 lea -0x80000000(%ebx),%edx 80103043: 89 55 e4 mov %edx,-0x1c(%ebp) if(memcmp(conf, "PCMP", 4) != 0) 80103046: c7 44 24 08 04 00 00 movl $0x4,0x8(%esp) 8010304d: 00 8010304e: c7 44 24 04 2d 72 10 movl $0x8010722d,0x4(%esp) 80103055: 80 80103056: 89 14 24 mov %edx,(%esp) 80103059: e8 42 13 00 00 call 801043a0 <memcmp> 8010305e: 85 c0 test %eax,%eax 80103060: 0f 85 1d 01 00 00 jne 80103183 <mpinit+0x1a3> return 0; if(conf->version != 1 && conf->version != 4) 80103066: 0f b6 83 06 00 00 80 movzbl -0x7ffffffa(%ebx),%eax 8010306d: 3c 04 cmp $0x4,%al 8010306f: 0f 85 1b 01 00 00 jne 80103190 <mpinit+0x1b0> return 0; if(sum((uchar*)conf, conf->length) != 0) 80103075: 0f b7 bb 04 00 00 80 movzwl -0x7ffffffc(%ebx),%edi sum(uchar *addr, int len) { int i, sum; sum = 0; for(i=0; i<len; i++) 8010307c: 85 ff test %edi,%edi 8010307e: 74 21 je 801030a1 <mpinit+0xc1> 80103080: 31 d2 xor %edx,%edx 80103082: 31 c0 xor %eax,%eax 80103084: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi sum += addr[i]; 80103088: 0f b6 8c 03 00 00 00 movzbl -0x80000000(%ebx,%eax,1),%ecx 8010308f: 80 sum(uchar *addr, int len) { int i, sum; sum = 0; for(i=0; i<len; i++) 80103090: 83 c0 01 add $0x1,%eax sum += addr[i]; 80103093: 01 ca add %ecx,%edx sum(uchar *addr, int len) { int i, sum; sum = 0; for(i=0; i<len; i++) 80103095: 39 c7 cmp %eax,%edi 80103097: 7f ef jg 80103088 <mpinit+0xa8> conf = (struct mpconf*) P2V((uint) mp->physaddr); if(memcmp(conf, "PCMP", 4) != 0) return 0; if(conf->version != 1 && conf->version != 4) return 0; if(sum((uchar*)conf, conf->length) != 0) 80103099: 84 d2 test %dl,%dl 8010309b: 0f 85 e2 00 00 00 jne 80103183 <mpinit+0x1a3> struct mp *mp; struct mpconf *conf; struct mpproc *proc; struct mpioapic *ioapic; if((conf = mpconfig(&mp)) == 0) 801030a1: 8b 45 e4 mov -0x1c(%ebp),%eax 801030a4: 85 c0 test %eax,%eax 801030a6: 0f 84 d7 00 00 00 je 80103183 <mpinit+0x1a3> panic("Expect to run on an SMP"); ismp = 1; lapic = (uint*)conf->lapicaddr; 801030ac: 8b 83 24 00 00 80 mov -0x7fffffdc(%ebx),%eax 801030b2: 89 75 e0 mov %esi,-0x20(%ebp) 801030b5: a3 7c 26 11 80 mov %eax,0x8011267c for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){ 801030ba: 0f b7 8b 04 00 00 80 movzwl -0x7ffffffc(%ebx),%ecx 801030c1: 8d 83 2c 00 00 80 lea -0x7fffffd4(%ebx),%eax 801030c7: 03 4d e4 add -0x1c(%ebp),%ecx struct mpproc *proc; struct mpioapic *ioapic; if((conf = mpconfig(&mp)) == 0) panic("Expect to run on an SMP"); ismp = 1; 801030ca: bb 01 00 00 00 mov $0x1,%ebx 801030cf: 90 nop lapic = (uint*)conf->lapicaddr; for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){ 801030d0: 39 c8 cmp %ecx,%eax 801030d2: 73 23 jae 801030f7 <mpinit+0x117> 801030d4: 0f b6 10 movzbl (%eax),%edx switch(*p){ 801030d7: 80 fa 04 cmp $0x4,%dl 801030da: 76 07 jbe 801030e3 <mpinit+0x103> case MPIOINTR: case MPLINTR: p += 8; continue; default: ismp = 0; 801030dc: 31 db xor %ebx,%ebx if((conf = mpconfig(&mp)) == 0) panic("Expect to run on an SMP"); ismp = 1; lapic = (uint*)conf->lapicaddr; for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){ switch(*p){ 801030de: 80 fa 04 cmp $0x4,%dl 801030e1: 77 f9 ja 801030dc <mpinit+0xfc> 801030e3: 0f b6 d2 movzbl %dl,%edx 801030e6: ff 24 95 6c 72 10 80 jmp *-0x7fef8d94(,%edx,4) 801030ed: 8d 76 00 lea 0x0(%esi),%esi p += sizeof(struct mpioapic); continue; case MPBUS: case MPIOINTR: case MPLINTR: p += 8; 801030f0: 83 c0 08 add $0x8,%eax if((conf = mpconfig(&mp)) == 0) panic("Expect to run on an SMP"); ismp = 1; lapic = (uint*)conf->lapicaddr; for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){ 801030f3: 39 c8 cmp %ecx,%eax 801030f5: 72 dd jb 801030d4 <mpinit+0xf4> default: ismp = 0; break; } } if(!ismp) 801030f7: 85 db test %ebx,%ebx 801030f9: 8b 75 e0 mov -0x20(%ebp),%esi 801030fc: 0f 84 98 00 00 00 je 8010319a <mpinit+0x1ba> panic("Didn't find a suitable machine"); if(mp->imcrp){ 80103102: 80 7e 0c 00 cmpb $0x0,0xc(%esi) 80103106: 74 12 je 8010311a <mpinit+0x13a> } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80103108: ba 22 00 00 00 mov $0x22,%edx 8010310d: b8 70 00 00 00 mov $0x70,%eax 80103112: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80103113: b2 23 mov $0x23,%dl 80103115: ec in (%dx),%al // Bochs doesn't support IMCR, so this doesn't run on Bochs. // But it would on real hardware. outb(0x22, 0x70); // Select IMCR outb(0x23, inb(0x23) | 1); // Mask external interrupts. 80103116: 83 c8 01 or $0x1,%eax } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80103119: ee out %al,(%dx) } } 8010311a: 83 c4 2c add $0x2c,%esp 8010311d: 5b pop %ebx 8010311e: 5e pop %esi 8010311f: 5f pop %edi 80103120: 5d pop %ebp 80103121: c3 ret 80103122: 8d b6 00 00 00 00 lea 0x0(%esi),%esi lapic = (uint*)conf->lapicaddr; for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){ switch(*p){ case MPPROC: proc = (struct mpproc*)p; if(ncpu < NCPU) { 80103128: 8b 15 00 2d 11 80 mov 0x80112d00,%edx 8010312e: 83 fa 07 cmp $0x7,%edx 80103131: 7f 1b jg 8010314e <mpinit+0x16e> cpus[ncpu].apicid = proc->apicid; // apicid may differ from ncpu 80103133: 0f b6 78 01 movzbl 0x1(%eax),%edi 80103137: 69 d2 b0 00 00 00 imul $0xb0,%edx,%edx ncpu++; 8010313d: 83 05 00 2d 11 80 01 addl $0x1,0x80112d00 for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){ switch(*p){ case MPPROC: proc = (struct mpproc*)p; if(ncpu < NCPU) { cpus[ncpu].apicid = proc->apicid; // apicid may differ from ncpu 80103144: 89 d6 mov %edx,%esi 80103146: 89 fa mov %edi,%edx 80103148: 88 96 80 27 11 80 mov %dl,-0x7feed880(%esi) ncpu++; } p += sizeof(struct mpproc); 8010314e: 83 c0 14 add $0x14,%eax continue; 80103151: e9 7a ff ff ff jmp 801030d0 <mpinit+0xf0> 80103156: 66 90 xchg %ax,%ax case MPIOAPIC: ioapic = (struct mpioapic*)p; ioapicid = ioapic->apicno; 80103158: 0f b6 50 01 movzbl 0x1(%eax),%edx p += sizeof(struct mpioapic); 8010315c: 83 c0 08 add $0x8,%eax } p += sizeof(struct mpproc); continue; case MPIOAPIC: ioapic = (struct mpioapic*)p; ioapicid = ioapic->apicno; 8010315f: 88 15 60 27 11 80 mov %dl,0x80112760 p += sizeof(struct mpioapic); continue; 80103165: e9 66 ff ff ff jmp 801030d0 <mpinit+0xf0> } else { p = ((bda[0x14]<<8)|bda[0x13])*1024; if((mp = mpsearch1(p-1024, 1024))) return mp; } return mpsearch1(0xF0000, 0x10000); 8010316a: ba 00 00 01 00 mov $0x10000,%edx 8010316f: b8 00 00 0f 00 mov $0xf0000,%eax 80103174: e8 07 fe ff ff call 80102f80 <mpsearch1> mpconfig(struct mp **pmp) { struct mpconf *conf; struct mp *mp; if((mp = mpsearch()) == 0 || mp->physaddr == 0) 80103179: 85 c0 test %eax,%eax } else { p = ((bda[0x14]<<8)|bda[0x13])*1024; if((mp = mpsearch1(p-1024, 1024))) return mp; } return mpsearch1(0xF0000, 0x10000); 8010317b: 89 c6 mov %eax,%esi mpconfig(struct mp **pmp) { struct mpconf *conf; struct mp *mp; if((mp = mpsearch()) == 0 || mp->physaddr == 0) 8010317d: 0f 85 af fe ff ff jne 80103032 <mpinit+0x52> struct mpconf *conf; struct mpproc *proc; struct mpioapic *ioapic; if((conf = mpconfig(&mp)) == 0) panic("Expect to run on an SMP"); 80103183: c7 04 24 32 72 10 80 movl $0x80107232,(%esp) 8010318a: e8 e1 d1 ff ff call 80100370 <panic> 8010318f: 90 nop if((mp = mpsearch()) == 0 || mp->physaddr == 0) return 0; conf = (struct mpconf*) P2V((uint) mp->physaddr); if(memcmp(conf, "PCMP", 4) != 0) return 0; if(conf->version != 1 && conf->version != 4) 80103190: 3c 01 cmp $0x1,%al 80103192: 0f 84 dd fe ff ff je 80103075 <mpinit+0x95> 80103198: eb e9 jmp 80103183 <mpinit+0x1a3> ismp = 0; break; } } if(!ismp) panic("Didn't find a suitable machine"); 8010319a: c7 04 24 4c 72 10 80 movl $0x8010724c,(%esp) 801031a1: e8 ca d1 ff ff call 80100370 <panic> ... 801031b0 <picinit>: #define IO_PIC2 0xA0 // Slave (IRQs 8-15) // Don't use the 8259A interrupt controllers. Xv6 assumes SMP hardware. void picinit(void) { 801031b0: 55 push %ebp 801031b1: ba 21 00 00 00 mov $0x21,%edx 801031b6: 89 e5 mov %esp,%ebp 801031b8: b8 ff ff ff ff mov $0xffffffff,%eax 801031bd: ee out %al,(%dx) 801031be: b2 a1 mov $0xa1,%dl 801031c0: ee out %al,(%dx) // mask all interrupts outb(IO_PIC1+1, 0xFF); outb(IO_PIC2+1, 0xFF); } 801031c1: 5d pop %ebp 801031c2: c3 ret ... 801031d0 <pipealloc>: int writeopen; // write fd is still open }; int pipealloc(struct file **f0, struct file **f1) { 801031d0: 55 push %ebp 801031d1: 89 e5 mov %esp,%ebp 801031d3: 83 ec 28 sub $0x28,%esp 801031d6: 89 5d f4 mov %ebx,-0xc(%ebp) 801031d9: 8b 5d 0c mov 0xc(%ebp),%ebx 801031dc: 89 75 f8 mov %esi,-0x8(%ebp) 801031df: 8b 75 08 mov 0x8(%ebp),%esi 801031e2: 89 7d fc mov %edi,-0x4(%ebp) struct pipe *p; p = 0; *f0 = *f1 = 0; 801031e5: c7 03 00 00 00 00 movl $0x0,(%ebx) 801031eb: c7 06 00 00 00 00 movl $0x0,(%esi) if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0) 801031f1: e8 6a db ff ff call 80100d60 <filealloc> 801031f6: 85 c0 test %eax,%eax 801031f8: 89 06 mov %eax,(%esi) 801031fa: 0f 84 a6 00 00 00 je 801032a6 <pipealloc+0xd6> 80103200: e8 5b db ff ff call 80100d60 <filealloc> 80103205: 85 c0 test %eax,%eax 80103207: 89 03 mov %eax,(%ebx) 80103209: 0f 84 89 00 00 00 je 80103298 <pipealloc+0xc8> goto bad; if((p = (struct pipe*)kalloc()) == 0) 8010320f: e8 9c f2 ff ff call 801024b0 <kalloc> 80103214: 85 c0 test %eax,%eax 80103216: 89 c7 mov %eax,%edi 80103218: 74 7e je 80103298 <pipealloc+0xc8> goto bad; p->readopen = 1; 8010321a: c7 80 3c 02 00 00 01 movl $0x1,0x23c(%eax) 80103221: 00 00 00 p->writeopen = 1; 80103224: c7 80 40 02 00 00 01 movl $0x1,0x240(%eax) 8010322b: 00 00 00 p->nwrite = 0; 8010322e: c7 80 38 02 00 00 00 movl $0x0,0x238(%eax) 80103235: 00 00 00 p->nread = 0; 80103238: c7 80 34 02 00 00 00 movl $0x0,0x234(%eax) 8010323f: 00 00 00 initlock(&p->lock, "pipe"); 80103242: 89 04 24 mov %eax,(%esp) 80103245: c7 44 24 04 80 72 10 movl $0x80107280,0x4(%esp) 8010324c: 80 8010324d: e8 be 0e 00 00 call 80104110 <initlock> (*f0)->type = FD_PIPE; 80103252: 8b 06 mov (%esi),%eax 80103254: c7 00 01 00 00 00 movl $0x1,(%eax) (*f0)->readable = 1; 8010325a: 8b 06 mov (%esi),%eax 8010325c: c6 40 08 01 movb $0x1,0x8(%eax) (*f0)->writable = 0; 80103260: 8b 06 mov (%esi),%eax 80103262: c6 40 09 00 movb $0x0,0x9(%eax) (*f0)->pipe = p; 80103266: 8b 06 mov (%esi),%eax 80103268: 89 78 0c mov %edi,0xc(%eax) (*f1)->type = FD_PIPE; 8010326b: 8b 03 mov (%ebx),%eax 8010326d: c7 00 01 00 00 00 movl $0x1,(%eax) (*f1)->readable = 0; 80103273: 8b 03 mov (%ebx),%eax 80103275: c6 40 08 00 movb $0x0,0x8(%eax) (*f1)->writable = 1; 80103279: 8b 03 mov (%ebx),%eax 8010327b: c6 40 09 01 movb $0x1,0x9(%eax) (*f1)->pipe = p; 8010327f: 8b 03 mov (%ebx),%eax return 0; 80103281: 31 db xor %ebx,%ebx (*f0)->writable = 0; (*f0)->pipe = p; (*f1)->type = FD_PIPE; (*f1)->readable = 0; (*f1)->writable = 1; (*f1)->pipe = p; 80103283: 89 78 0c mov %edi,0xc(%eax) if(*f0) fileclose(*f0); if(*f1) fileclose(*f1); return -1; } 80103286: 89 d8 mov %ebx,%eax 80103288: 8b 75 f8 mov -0x8(%ebp),%esi 8010328b: 8b 5d f4 mov -0xc(%ebp),%ebx 8010328e: 8b 7d fc mov -0x4(%ebp),%edi 80103291: 89 ec mov %ebp,%esp 80103293: 5d pop %ebp 80103294: c3 ret 80103295: 8d 76 00 lea 0x0(%esi),%esi //PAGEBREAK: 20 bad: if(p) kfree((char*)p); if(*f0) 80103298: 8b 06 mov (%esi),%eax 8010329a: 85 c0 test %eax,%eax 8010329c: 74 08 je 801032a6 <pipealloc+0xd6> fileclose(*f0); 8010329e: 89 04 24 mov %eax,(%esp) 801032a1: e8 7a db ff ff call 80100e20 <fileclose> if(*f1) 801032a6: 8b 03 mov (%ebx),%eax fileclose(*f1); return -1; 801032a8: bb ff ff ff ff mov $0xffffffff,%ebx bad: if(p) kfree((char*)p); if(*f0) fileclose(*f0); if(*f1) 801032ad: 85 c0 test %eax,%eax 801032af: 74 d5 je 80103286 <pipealloc+0xb6> fileclose(*f1); 801032b1: 89 04 24 mov %eax,(%esp) 801032b4: e8 67 db ff ff call 80100e20 <fileclose> return -1; } 801032b9: 89 d8 mov %ebx,%eax 801032bb: 8b 75 f8 mov -0x8(%ebp),%esi 801032be: 8b 5d f4 mov -0xc(%ebp),%ebx 801032c1: 8b 7d fc mov -0x4(%ebp),%edi 801032c4: 89 ec mov %ebp,%esp 801032c6: 5d pop %ebp 801032c7: c3 ret 801032c8: 90 nop 801032c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801032d0 <pipeclose>: void pipeclose(struct pipe *p, int writable) { 801032d0: 55 push %ebp 801032d1: 89 e5 mov %esp,%ebp 801032d3: 83 ec 18 sub $0x18,%esp 801032d6: 89 5d f8 mov %ebx,-0x8(%ebp) 801032d9: 8b 5d 08 mov 0x8(%ebp),%ebx 801032dc: 89 75 fc mov %esi,-0x4(%ebp) 801032df: 8b 75 0c mov 0xc(%ebp),%esi acquire(&p->lock); 801032e2: 89 1c 24 mov %ebx,(%esp) 801032e5: e8 96 0f 00 00 call 80104280 <acquire> if(writable){ 801032ea: 85 f6 test %esi,%esi 801032ec: 74 42 je 80103330 <pipeclose+0x60> p->writeopen = 0; 801032ee: c7 83 40 02 00 00 00 movl $0x0,0x240(%ebx) 801032f5: 00 00 00 wakeup(&p->nread); 801032f8: 8d 83 34 02 00 00 lea 0x234(%ebx),%eax 801032fe: 89 04 24 mov %eax,(%esp) 80103301: e8 2a 0b 00 00 call 80103e30 <wakeup> } else { p->readopen = 0; wakeup(&p->nwrite); } if(p->readopen == 0 && p->writeopen == 0){ 80103306: 8b 93 3c 02 00 00 mov 0x23c(%ebx),%edx 8010330c: 85 d2 test %edx,%edx 8010330e: 75 0a jne 8010331a <pipeclose+0x4a> 80103310: 8b 83 40 02 00 00 mov 0x240(%ebx),%eax 80103316: 85 c0 test %eax,%eax 80103318: 74 36 je 80103350 <pipeclose+0x80> release(&p->lock); kfree((char*)p); } else release(&p->lock); 8010331a: 89 5d 08 mov %ebx,0x8(%ebp) } 8010331d: 8b 75 fc mov -0x4(%ebp),%esi 80103320: 8b 5d f8 mov -0x8(%ebp),%ebx 80103323: 89 ec mov %ebp,%esp 80103325: 5d pop %ebp } if(p->readopen == 0 && p->writeopen == 0){ release(&p->lock); kfree((char*)p); } else release(&p->lock); 80103326: e9 c5 0f 00 00 jmp 801042f0 <release> 8010332b: 90 nop 8010332c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi acquire(&p->lock); if(writable){ p->writeopen = 0; wakeup(&p->nread); } else { p->readopen = 0; 80103330: c7 83 3c 02 00 00 00 movl $0x0,0x23c(%ebx) 80103337: 00 00 00 wakeup(&p->nwrite); 8010333a: 8d 83 38 02 00 00 lea 0x238(%ebx),%eax 80103340: 89 04 24 mov %eax,(%esp) 80103343: e8 e8 0a 00 00 call 80103e30 <wakeup> 80103348: eb bc jmp 80103306 <pipeclose+0x36> 8010334a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi } if(p->readopen == 0 && p->writeopen == 0){ release(&p->lock); 80103350: 89 1c 24 mov %ebx,(%esp) 80103353: e8 98 0f 00 00 call 801042f0 <release> kfree((char*)p); } else release(&p->lock); } 80103358: 8b 75 fc mov -0x4(%ebp),%esi p->readopen = 0; wakeup(&p->nwrite); } if(p->readopen == 0 && p->writeopen == 0){ release(&p->lock); kfree((char*)p); 8010335b: 89 5d 08 mov %ebx,0x8(%ebp) } else release(&p->lock); } 8010335e: 8b 5d f8 mov -0x8(%ebp),%ebx 80103361: 89 ec mov %ebp,%esp 80103363: 5d pop %ebp p->readopen = 0; wakeup(&p->nwrite); } if(p->readopen == 0 && p->writeopen == 0){ release(&p->lock); kfree((char*)p); 80103364: e9 d7 ef ff ff jmp 80102340 <kfree> 80103369: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103370 <pipewrite>: } //PAGEBREAK: 40 int pipewrite(struct pipe *p, char *addr, int n) { 80103370: 55 push %ebp 80103371: 89 e5 mov %esp,%ebp 80103373: 57 push %edi 80103374: 56 push %esi 80103375: 53 push %ebx 80103376: 83 ec 2c sub $0x2c,%esp 80103379: 8b 5d 08 mov 0x8(%ebp),%ebx int i; acquire(&p->lock); 8010337c: 89 1c 24 mov %ebx,(%esp) 8010337f: e8 fc 0e 00 00 call 80104280 <acquire> for(i = 0; i < n; i++){ 80103384: 8b 45 10 mov 0x10(%ebp),%eax 80103387: 85 c0 test %eax,%eax 80103389: 0f 8e 97 00 00 00 jle 80103426 <pipewrite+0xb6> 8010338f: 8b 83 38 02 00 00 mov 0x238(%ebx),%eax while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full if(p->readopen == 0 || myproc()->killed){ release(&p->lock); return -1; } wakeup(&p->nread); 80103395: 8d bb 34 02 00 00 lea 0x234(%ebx),%edi pipewrite(struct pipe *p, char *addr, int n) { int i; acquire(&p->lock); for(i = 0; i < n; i++){ 8010339b: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) if(p->readopen == 0 || myproc()->killed){ release(&p->lock); return -1; } wakeup(&p->nread); sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep 801033a2: 8d b3 38 02 00 00 lea 0x238(%ebx),%esi 801033a8: eb 3a jmp 801033e4 <pipewrite+0x74> 801033aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi int i; acquire(&p->lock); for(i = 0; i < n; i++){ while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full if(p->readopen == 0 || myproc()->killed){ 801033b0: 8b 83 3c 02 00 00 mov 0x23c(%ebx),%eax 801033b6: 85 c0 test %eax,%eax 801033b8: 0f 84 82 00 00 00 je 80103440 <pipewrite+0xd0> 801033be: e8 6d 03 00 00 call 80103730 <myproc> 801033c3: 8b 48 24 mov 0x24(%eax),%ecx 801033c6: 85 c9 test %ecx,%ecx 801033c8: 75 76 jne 80103440 <pipewrite+0xd0> release(&p->lock); return -1; } wakeup(&p->nread); 801033ca: 89 3c 24 mov %edi,(%esp) 801033cd: e8 5e 0a 00 00 call 80103e30 <wakeup> sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep 801033d2: 89 5c 24 04 mov %ebx,0x4(%esp) 801033d6: 89 34 24 mov %esi,(%esp) 801033d9: e8 b2 08 00 00 call 80103c90 <sleep> { int i; acquire(&p->lock); for(i = 0; i < n; i++){ while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full 801033de: 8b 83 38 02 00 00 mov 0x238(%ebx),%eax 801033e4: 8b 93 34 02 00 00 mov 0x234(%ebx),%edx 801033ea: 81 c2 00 02 00 00 add $0x200,%edx 801033f0: 39 d0 cmp %edx,%eax 801033f2: 74 bc je 801033b0 <pipewrite+0x40> return -1; } wakeup(&p->nread); sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep } p->data[p->nwrite++ % PIPESIZE] = addr[i]; 801033f4: 8b 4d 0c mov 0xc(%ebp),%ecx 801033f7: 8b 55 e4 mov -0x1c(%ebp),%edx pipewrite(struct pipe *p, char *addr, int n) { int i; acquire(&p->lock); for(i = 0; i < n; i++){ 801033fa: 83 45 e4 01 addl $0x1,-0x1c(%ebp) return -1; } wakeup(&p->nread); sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep } p->data[p->nwrite++ % PIPESIZE] = addr[i]; 801033fe: 0f b6 14 11 movzbl (%ecx,%edx,1),%edx 80103402: 88 55 e3 mov %dl,-0x1d(%ebp) 80103405: 0f b6 4d e3 movzbl -0x1d(%ebp),%ecx 80103409: 89 c2 mov %eax,%edx 8010340b: 81 e2 ff 01 00 00 and $0x1ff,%edx 80103411: 83 c0 01 add $0x1,%eax 80103414: 88 4c 13 34 mov %cl,0x34(%ebx,%edx,1) pipewrite(struct pipe *p, char *addr, int n) { int i; acquire(&p->lock); for(i = 0; i < n; i++){ 80103418: 8b 55 10 mov 0x10(%ebp),%edx 8010341b: 39 55 e4 cmp %edx,-0x1c(%ebp) return -1; } wakeup(&p->nread); sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep } p->data[p->nwrite++ % PIPESIZE] = addr[i]; 8010341e: 89 83 38 02 00 00 mov %eax,0x238(%ebx) pipewrite(struct pipe *p, char *addr, int n) { int i; acquire(&p->lock); for(i = 0; i < n; i++){ 80103424: 75 be jne 801033e4 <pipewrite+0x74> wakeup(&p->nread); sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep } p->data[p->nwrite++ % PIPESIZE] = addr[i]; } wakeup(&p->nread); //DOC: pipewrite-wakeup1 80103426: 8d 83 34 02 00 00 lea 0x234(%ebx),%eax 8010342c: 89 04 24 mov %eax,(%esp) 8010342f: e8 fc 09 00 00 call 80103e30 <wakeup> release(&p->lock); 80103434: 89 1c 24 mov %ebx,(%esp) 80103437: e8 b4 0e 00 00 call 801042f0 <release> return n; 8010343c: eb 11 jmp 8010344f <pipewrite+0xdf> 8010343e: 66 90 xchg %ax,%ax acquire(&p->lock); for(i = 0; i < n; i++){ while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full if(p->readopen == 0 || myproc()->killed){ release(&p->lock); 80103440: 89 1c 24 mov %ebx,(%esp) 80103443: e8 a8 0e 00 00 call 801042f0 <release> return -1; 80103448: c7 45 10 ff ff ff ff movl $0xffffffff,0x10(%ebp) p->data[p->nwrite++ % PIPESIZE] = addr[i]; } wakeup(&p->nread); //DOC: pipewrite-wakeup1 release(&p->lock); return n; } 8010344f: 8b 45 10 mov 0x10(%ebp),%eax 80103452: 83 c4 2c add $0x2c,%esp 80103455: 5b pop %ebx 80103456: 5e pop %esi 80103457: 5f pop %edi 80103458: 5d pop %ebp 80103459: c3 ret 8010345a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80103460 <piperead>: int piperead(struct pipe *p, char *addr, int n) { 80103460: 55 push %ebp 80103461: 89 e5 mov %esp,%ebp 80103463: 57 push %edi 80103464: 56 push %esi 80103465: 53 push %ebx 80103466: 83 ec 1c sub $0x1c,%esp 80103469: 8b 5d 08 mov 0x8(%ebp),%ebx 8010346c: 8b 7d 10 mov 0x10(%ebp),%edi int i; acquire(&p->lock); 8010346f: 89 1c 24 mov %ebx,(%esp) 80103472: e8 09 0e 00 00 call 80104280 <acquire> while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty 80103477: 8b 93 34 02 00 00 mov 0x234(%ebx),%edx 8010347d: 3b 93 38 02 00 00 cmp 0x238(%ebx),%edx 80103483: 75 5b jne 801034e0 <piperead+0x80> 80103485: 8b 83 40 02 00 00 mov 0x240(%ebx),%eax 8010348b: 85 c0 test %eax,%eax 8010348d: 74 51 je 801034e0 <piperead+0x80> if(myproc()->killed){ release(&p->lock); return -1; } sleep(&p->nread, &p->lock); //DOC: piperead-sleep 8010348f: 8d b3 34 02 00 00 lea 0x234(%ebx),%esi 80103495: eb 25 jmp 801034bc <piperead+0x5c> 80103497: 90 nop 80103498: 89 5c 24 04 mov %ebx,0x4(%esp) 8010349c: 89 34 24 mov %esi,(%esp) 8010349f: e8 ec 07 00 00 call 80103c90 <sleep> piperead(struct pipe *p, char *addr, int n) { int i; acquire(&p->lock); while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty 801034a4: 8b 93 34 02 00 00 mov 0x234(%ebx),%edx 801034aa: 3b 93 38 02 00 00 cmp 0x238(%ebx),%edx 801034b0: 75 2e jne 801034e0 <piperead+0x80> 801034b2: 8b 83 40 02 00 00 mov 0x240(%ebx),%eax 801034b8: 85 c0 test %eax,%eax 801034ba: 74 24 je 801034e0 <piperead+0x80> if(myproc()->killed){ 801034bc: e8 6f 02 00 00 call 80103730 <myproc> 801034c1: 8b 40 24 mov 0x24(%eax),%eax 801034c4: 85 c0 test %eax,%eax 801034c6: 74 d0 je 80103498 <piperead+0x38> release(&p->lock); 801034c8: 89 1c 24 mov %ebx,(%esp) return -1; 801034cb: be ff ff ff ff mov $0xffffffff,%esi int i; acquire(&p->lock); while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty if(myproc()->killed){ release(&p->lock); 801034d0: e8 1b 0e 00 00 call 801042f0 <release> addr[i] = p->data[p->nread++ % PIPESIZE]; } wakeup(&p->nwrite); //DOC: piperead-wakeup release(&p->lock); return i; } 801034d5: 83 c4 1c add $0x1c,%esp 801034d8: 89 f0 mov %esi,%eax 801034da: 5b pop %ebx 801034db: 5e pop %esi 801034dc: 5f pop %edi 801034dd: 5d pop %ebp 801034de: c3 ret 801034df: 90 nop release(&p->lock); return -1; } sleep(&p->nread, &p->lock); //DOC: piperead-sleep } for(i = 0; i < n; i++){ //DOC: piperead-copy 801034e0: 31 f6 xor %esi,%esi 801034e2: 85 ff test %edi,%edi 801034e4: 7e 39 jle 8010351f <piperead+0xbf> if(p->nread == p->nwrite) 801034e6: 3b 93 38 02 00 00 cmp 0x238(%ebx),%edx 801034ec: 74 31 je 8010351f <piperead+0xbf> release(&p->lock); return n; } int piperead(struct pipe *p, char *addr, int n) 801034ee: 8b 4d 0c mov 0xc(%ebp),%ecx 801034f1: 29 d1 sub %edx,%ecx 801034f3: eb 0b jmp 80103500 <piperead+0xa0> 801034f5: 8d 76 00 lea 0x0(%esi),%esi return -1; } sleep(&p->nread, &p->lock); //DOC: piperead-sleep } for(i = 0; i < n; i++){ //DOC: piperead-copy if(p->nread == p->nwrite) 801034f8: 39 93 38 02 00 00 cmp %edx,0x238(%ebx) 801034fe: 74 1f je 8010351f <piperead+0xbf> break; addr[i] = p->data[p->nread++ % PIPESIZE]; 80103500: 89 d0 mov %edx,%eax release(&p->lock); return -1; } sleep(&p->nread, &p->lock); //DOC: piperead-sleep } for(i = 0; i < n; i++){ //DOC: piperead-copy 80103502: 83 c6 01 add $0x1,%esi if(p->nread == p->nwrite) break; addr[i] = p->data[p->nread++ % PIPESIZE]; 80103505: 25 ff 01 00 00 and $0x1ff,%eax 8010350a: 0f b6 44 03 34 movzbl 0x34(%ebx,%eax,1),%eax 8010350f: 88 04 11 mov %al,(%ecx,%edx,1) 80103512: 83 c2 01 add $0x1,%edx release(&p->lock); return -1; } sleep(&p->nread, &p->lock); //DOC: piperead-sleep } for(i = 0; i < n; i++){ //DOC: piperead-copy 80103515: 39 fe cmp %edi,%esi if(p->nread == p->nwrite) break; addr[i] = p->data[p->nread++ % PIPESIZE]; 80103517: 89 93 34 02 00 00 mov %edx,0x234(%ebx) release(&p->lock); return -1; } sleep(&p->nread, &p->lock); //DOC: piperead-sleep } for(i = 0; i < n; i++){ //DOC: piperead-copy 8010351d: 75 d9 jne 801034f8 <piperead+0x98> if(p->nread == p->nwrite) break; addr[i] = p->data[p->nread++ % PIPESIZE]; } wakeup(&p->nwrite); //DOC: piperead-wakeup 8010351f: 8d 83 38 02 00 00 lea 0x238(%ebx),%eax 80103525: 89 04 24 mov %eax,(%esp) 80103528: e8 03 09 00 00 call 80103e30 <wakeup> release(&p->lock); 8010352d: 89 1c 24 mov %ebx,(%esp) 80103530: e8 bb 0d 00 00 call 801042f0 <release> return i; } 80103535: 83 c4 1c add $0x1c,%esp 80103538: 89 f0 mov %esi,%eax 8010353a: 5b pop %ebx 8010353b: 5e pop %esi 8010353c: 5f pop %edi 8010353d: 5d pop %ebp 8010353e: c3 ret ... 80103540 <allocproc>: // If found, change state to EMBRYO and initialize // state required to run in the kernel. // Otherwise return 0. static struct proc* allocproc(void) { 80103540: 55 push %ebp 80103541: 89 e5 mov %esp,%ebp 80103543: 53 push %ebx struct proc *p; char *sp; acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80103544: bb 54 2d 11 80 mov $0x80112d54,%ebx // If found, change state to EMBRYO and initialize // state required to run in the kernel. // Otherwise return 0. static struct proc* allocproc(void) { 80103549: 83 ec 14 sub $0x14,%esp struct proc *p; char *sp; acquire(&ptable.lock); 8010354c: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 80103553: e8 28 0d 00 00 call 80104280 <acquire> for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) if(p->state == UNUSED) 80103558: 8b 15 60 2d 11 80 mov 0x80112d60,%edx 8010355e: 85 d2 test %edx,%edx 80103560: 74 18 je 8010357a <allocproc+0x3a> 80103562: 8d b6 00 00 00 00 lea 0x0(%esi),%esi struct proc *p; char *sp; acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80103568: 83 c3 7c add $0x7c,%ebx 8010356b: 81 fb 54 4c 11 80 cmp $0x80114c54,%ebx 80103571: 73 7d jae 801035f0 <allocproc+0xb0> if(p->state == UNUSED) 80103573: 8b 43 0c mov 0xc(%ebx),%eax 80103576: 85 c0 test %eax,%eax 80103578: 75 ee jne 80103568 <allocproc+0x28> release(&ptable.lock); return 0; found: p->state = EMBRYO; p->pid = nextpid++; 8010357a: a1 00 a0 10 80 mov 0x8010a000,%eax release(&ptable.lock); return 0; found: p->state = EMBRYO; 8010357f: c7 43 0c 01 00 00 00 movl $0x1,0xc(%ebx) p->pid = nextpid++; 80103586: 89 43 10 mov %eax,0x10(%ebx) 80103589: 83 c0 01 add $0x1,%eax 8010358c: a3 00 a0 10 80 mov %eax,0x8010a000 release(&ptable.lock); 80103591: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 80103598: e8 53 0d 00 00 call 801042f0 <release> // Allocate kernel stack. if((p->kstack = kalloc()) == 0){ 8010359d: e8 0e ef ff ff call 801024b0 <kalloc> 801035a2: 85 c0 test %eax,%eax 801035a4: 89 43 08 mov %eax,0x8(%ebx) 801035a7: 74 5d je 80103606 <allocproc+0xc6> return 0; } sp = p->kstack + KSTACKSIZE; // Leave room for trap frame. sp -= sizeof *p->tf; 801035a9: 8d 90 b4 0f 00 00 lea 0xfb4(%eax),%edx 801035af: 89 53 18 mov %edx,0x18(%ebx) p->tf = (struct trapframe*)sp; // Set up new context to start executing at forkret, // which returns to trapret. sp -= 4; *(uint*)sp = (uint)trapret; 801035b2: c7 80 b0 0f 00 00 08 movl $0x80105508,0xfb0(%eax) 801035b9: 55 10 80 sp -= sizeof *p->context; 801035bc: 05 9c 0f 00 00 add $0xf9c,%eax p->context = (struct context*)sp; 801035c1: 89 43 1c mov %eax,0x1c(%ebx) memset(p->context, 0, sizeof *p->context); 801035c4: c7 44 24 08 14 00 00 movl $0x14,0x8(%esp) 801035cb: 00 801035cc: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 801035d3: 00 801035d4: 89 04 24 mov %eax,(%esp) 801035d7: e8 64 0d 00 00 call 80104340 <memset> p->context->eip = (uint)forkret; 801035dc: 8b 43 1c mov 0x1c(%ebx),%eax 801035df: c7 40 10 20 36 10 80 movl $0x80103620,0x10(%eax) return p; } 801035e6: 83 c4 14 add $0x14,%esp 801035e9: 89 d8 mov %ebx,%eax 801035eb: 5b pop %ebx 801035ec: 5d pop %ebp 801035ed: c3 ret 801035ee: 66 90 xchg %ax,%ax for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) if(p->state == UNUSED) goto found; release(&ptable.lock); 801035f0: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) return 0; 801035f7: 31 db xor %ebx,%ebx for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) if(p->state == UNUSED) goto found; release(&ptable.lock); 801035f9: e8 f2 0c 00 00 call 801042f0 <release> p->context = (struct context*)sp; memset(p->context, 0, sizeof *p->context); p->context->eip = (uint)forkret; return p; } 801035fe: 83 c4 14 add $0x14,%esp 80103601: 89 d8 mov %ebx,%eax 80103603: 5b pop %ebx 80103604: 5d pop %ebp 80103605: c3 ret release(&ptable.lock); // Allocate kernel stack. if((p->kstack = kalloc()) == 0){ p->state = UNUSED; 80103606: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) return 0; 8010360d: 31 db xor %ebx,%ebx 8010360f: eb d5 jmp 801035e6 <allocproc+0xa6> 80103611: eb 0d jmp 80103620 <forkret> 80103613: 90 nop 80103614: 90 nop 80103615: 90 nop 80103616: 90 nop 80103617: 90 nop 80103618: 90 nop 80103619: 90 nop 8010361a: 90 nop 8010361b: 90 nop 8010361c: 90 nop 8010361d: 90 nop 8010361e: 90 nop 8010361f: 90 nop 80103620 <forkret>: // A fork child's very first scheduling by scheduler() // will swtch here. "Return" to user space. void forkret(void) { 80103620: 55 push %ebp 80103621: 89 e5 mov %esp,%ebp 80103623: 83 ec 18 sub $0x18,%esp static int first = 1; // Still holding ptable.lock from scheduler. release(&ptable.lock); 80103626: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 8010362d: e8 be 0c 00 00 call 801042f0 <release> if (first) { 80103632: 8b 0d 04 a0 10 80 mov 0x8010a004,%ecx 80103638: 85 c9 test %ecx,%ecx 8010363a: 75 04 jne 80103640 <forkret+0x20> iinit(ROOTDEV); initlog(ROOTDEV); } // Return to "caller", actually trapret (see allocproc). } 8010363c: c9 leave 8010363d: c3 ret 8010363e: 66 90 xchg %ax,%ax if (first) { // Some initialization functions must be run in the context // of a regular process (e.g., they call sleep), and thus cannot // be run from main(). first = 0; iinit(ROOTDEV); 80103640: c7 04 24 01 00 00 00 movl $0x1,(%esp) if (first) { // Some initialization functions must be run in the context // of a regular process (e.g., they call sleep), and thus cannot // be run from main(). first = 0; 80103647: c7 05 04 a0 10 80 00 movl $0x0,0x8010a004 8010364e: 00 00 00 iinit(ROOTDEV); 80103651: e8 0a de ff ff call 80101460 <iinit> initlog(ROOTDEV); 80103656: c7 04 24 01 00 00 00 movl $0x1,(%esp) 8010365d: e8 6e f4 ff ff call 80102ad0 <initlog> } // Return to "caller", actually trapret (see allocproc). } 80103662: c9 leave 80103663: c3 ret 80103664: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 8010366a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 80103670 <pinit>: static void wakeup1(void *chan); void pinit(void) { 80103670: 55 push %ebp 80103671: 89 e5 mov %esp,%ebp 80103673: 83 ec 18 sub $0x18,%esp initlock(&ptable.lock, "ptable"); 80103676: c7 44 24 04 85 72 10 movl $0x80107285,0x4(%esp) 8010367d: 80 8010367e: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 80103685: e8 86 0a 00 00 call 80104110 <initlock> } 8010368a: c9 leave 8010368b: c3 ret 8010368c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80103690 <mycpu>: // Must be called with interrupts disabled to avoid the caller being // rescheduled between reading lapicid and running through the loop. struct cpu* mycpu(void) { 80103690: 55 push %ebp 80103691: 89 e5 mov %esp,%ebp 80103693: 56 push %esi 80103694: 53 push %ebx 80103695: 83 ec 10 sub $0x10,%esp static inline uint readeflags(void) { uint eflags; asm volatile("pushfl; popl %0" : "=r" (eflags)); 80103698: 9c pushf 80103699: 58 pop %eax int apicid, i; if(readeflags()&FL_IF) 8010369a: f6 c4 02 test $0x2,%ah 8010369d: 75 57 jne 801036f6 <mycpu+0x66> panic("mycpu called with interrupts enabled\n"); apicid = lapicid(); 8010369f: e8 4c f0 ff ff call 801026f0 <lapicid> // APIC IDs are not guaranteed to be contiguous. Maybe we should have // a reverse map, or reserve a register to store &cpus[i]. for (i = 0; i < ncpu; ++i) { 801036a4: 8b 35 00 2d 11 80 mov 0x80112d00,%esi 801036aa: 85 f6 test %esi,%esi 801036ac: 7e 3c jle 801036ea <mycpu+0x5a> if (cpus[i].apicid == apicid) 801036ae: 0f b6 15 80 27 11 80 movzbl 0x80112780,%edx 801036b5: 39 c2 cmp %eax,%edx 801036b7: 74 2d je 801036e6 <mycpu+0x56> return &cpus[i]; 801036b9: b9 30 28 11 80 mov $0x80112830,%ecx panic("mycpu called with interrupts enabled\n"); apicid = lapicid(); // APIC IDs are not guaranteed to be contiguous. Maybe we should have // a reverse map, or reserve a register to store &cpus[i]. for (i = 0; i < ncpu; ++i) { 801036be: 31 d2 xor %edx,%edx 801036c0: 83 c2 01 add $0x1,%edx 801036c3: 39 f2 cmp %esi,%edx 801036c5: 74 23 je 801036ea <mycpu+0x5a> if (cpus[i].apicid == apicid) 801036c7: 0f b6 19 movzbl (%ecx),%ebx 801036ca: 81 c1 b0 00 00 00 add $0xb0,%ecx 801036d0: 39 c3 cmp %eax,%ebx 801036d2: 75 ec jne 801036c0 <mycpu+0x30> return &cpus[i]; 801036d4: 69 c2 b0 00 00 00 imul $0xb0,%edx,%eax } panic("unknown apicid\n"); } 801036da: 83 c4 10 add $0x10,%esp 801036dd: 5b pop %ebx 801036de: 5e pop %esi 801036df: 5d pop %ebp apicid = lapicid(); // APIC IDs are not guaranteed to be contiguous. Maybe we should have // a reverse map, or reserve a register to store &cpus[i]. for (i = 0; i < ncpu; ++i) { if (cpus[i].apicid == apicid) return &cpus[i]; 801036e0: 05 80 27 11 80 add $0x80112780,%eax } panic("unknown apicid\n"); } 801036e5: c3 ret apicid = lapicid(); // APIC IDs are not guaranteed to be contiguous. Maybe we should have // a reverse map, or reserve a register to store &cpus[i]. for (i = 0; i < ncpu; ++i) { if (cpus[i].apicid == apicid) 801036e6: 31 d2 xor %edx,%edx 801036e8: eb ea jmp 801036d4 <mycpu+0x44> return &cpus[i]; } panic("unknown apicid\n"); 801036ea: c7 04 24 8c 72 10 80 movl $0x8010728c,(%esp) 801036f1: e8 7a cc ff ff call 80100370 <panic> mycpu(void) { int apicid, i; if(readeflags()&FL_IF) panic("mycpu called with interrupts enabled\n"); 801036f6: c7 04 24 68 73 10 80 movl $0x80107368,(%esp) 801036fd: e8 6e cc ff ff call 80100370 <panic> 80103702: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103709: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80103710 <cpuid>: initlock(&ptable.lock, "ptable"); } // Must be called with interrupts disabled int cpuid() { 80103710: 55 push %ebp 80103711: 89 e5 mov %esp,%ebp 80103713: 83 ec 08 sub $0x8,%esp return mycpu()-cpus; 80103716: e8 75 ff ff ff call 80103690 <mycpu> } 8010371b: c9 leave } // Must be called with interrupts disabled int cpuid() { return mycpu()-cpus; 8010371c: 2d 80 27 11 80 sub $0x80112780,%eax 80103721: c1 f8 04 sar $0x4,%eax 80103724: 69 c0 a3 8b 2e ba imul $0xba2e8ba3,%eax,%eax } 8010372a: c3 ret 8010372b: 90 nop 8010372c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80103730 <myproc>: } // Disable interrupts so that we are not rescheduled // while reading proc from the cpu structure struct proc* myproc(void) { 80103730: 55 push %ebp 80103731: 89 e5 mov %esp,%ebp 80103733: 53 push %ebx 80103734: 83 ec 04 sub $0x4,%esp struct cpu *c; struct proc *p; pushcli(); 80103737: e8 54 0a 00 00 call 80104190 <pushcli> c = mycpu(); 8010373c: e8 4f ff ff ff call 80103690 <mycpu> p = c->proc; 80103741: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 80103747: e8 84 0a 00 00 call 801041d0 <popcli> return p; } 8010374c: 83 c4 04 add $0x4,%esp 8010374f: 89 d8 mov %ebx,%eax 80103751: 5b pop %ebx 80103752: 5d pop %ebp 80103753: c3 ret 80103754: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 8010375a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 80103760 <userinit>: //PAGEBREAK: 32 // Set up first user process. void userinit(void) { 80103760: 55 push %ebp 80103761: 89 e5 mov %esp,%ebp 80103763: 53 push %ebx 80103764: 83 ec 14 sub $0x14,%esp struct proc *p; extern char _binary_initcode_start[], _binary_initcode_size[]; p = allocproc(); 80103767: e8 d4 fd ff ff call 80103540 <allocproc> 8010376c: 89 c3 mov %eax,%ebx initproc = p; 8010376e: a3 a0 a5 10 80 mov %eax,0x8010a5a0 if((p->pgdir = setupkvm()) == 0) 80103773: e8 48 33 00 00 call 80106ac0 <setupkvm> 80103778: 85 c0 test %eax,%eax 8010377a: 89 43 04 mov %eax,0x4(%ebx) 8010377d: 0f 84 ce 00 00 00 je 80103851 <userinit+0xf1> panic("userinit: out of memory?"); inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size); 80103783: 89 04 24 mov %eax,(%esp) 80103786: c7 44 24 08 2c 00 00 movl $0x2c,0x8(%esp) 8010378d: 00 8010378e: c7 44 24 04 60 a4 10 movl $0x8010a460,0x4(%esp) 80103795: 80 80103796: e8 85 2f 00 00 call 80106720 <inituvm> p->sz = PGSIZE; 8010379b: c7 03 00 10 00 00 movl $0x1000,(%ebx) memset(p->tf, 0, sizeof(*p->tf)); 801037a1: c7 44 24 08 4c 00 00 movl $0x4c,0x8(%esp) 801037a8: 00 801037a9: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 801037b0: 00 801037b1: 8b 43 18 mov 0x18(%ebx),%eax 801037b4: 89 04 24 mov %eax,(%esp) 801037b7: e8 84 0b 00 00 call 80104340 <memset> p->tf->cs = (SEG_UCODE << 3) | DPL_USER; 801037bc: 8b 43 18 mov 0x18(%ebx),%eax 801037bf: 66 c7 40 3c 1b 00 movw $0x1b,0x3c(%eax) p->tf->ds = (SEG_UDATA << 3) | DPL_USER; 801037c5: 8b 43 18 mov 0x18(%ebx),%eax 801037c8: 66 c7 40 2c 23 00 movw $0x23,0x2c(%eax) p->tf->es = p->tf->ds; 801037ce: 8b 43 18 mov 0x18(%ebx),%eax 801037d1: 0f b7 50 2c movzwl 0x2c(%eax),%edx 801037d5: 66 89 50 28 mov %dx,0x28(%eax) p->tf->ss = p->tf->ds; 801037d9: 8b 43 18 mov 0x18(%ebx),%eax 801037dc: 0f b7 50 2c movzwl 0x2c(%eax),%edx 801037e0: 66 89 50 48 mov %dx,0x48(%eax) p->tf->eflags = FL_IF; 801037e4: 8b 43 18 mov 0x18(%ebx),%eax 801037e7: c7 40 40 00 02 00 00 movl $0x200,0x40(%eax) p->tf->esp = PGSIZE; 801037ee: 8b 43 18 mov 0x18(%ebx),%eax 801037f1: c7 40 44 00 10 00 00 movl $0x1000,0x44(%eax) p->tf->eip = 0; // beginning of initcode.S 801037f8: 8b 43 18 mov 0x18(%ebx),%eax 801037fb: c7 40 38 00 00 00 00 movl $0x0,0x38(%eax) safestrcpy(p->name, "initcode", sizeof(p->name)); 80103802: 8d 43 6c lea 0x6c(%ebx),%eax 80103805: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) 8010380c: 00 8010380d: c7 44 24 04 b5 72 10 movl $0x801072b5,0x4(%esp) 80103814: 80 80103815: 89 04 24 mov %eax,(%esp) 80103818: e8 13 0d 00 00 call 80104530 <safestrcpy> p->cwd = namei("/"); 8010381d: c7 04 24 be 72 10 80 movl $0x801072be,(%esp) 80103824: e8 47 e7 ff ff call 80101f70 <namei> 80103829: 89 43 68 mov %eax,0x68(%ebx) // this assignment to p->state lets other cores // run this process. the acquire forces the above // writes to be visible, and the lock is also needed // because the assignment might not be atomic. acquire(&ptable.lock); 8010382c: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 80103833: e8 48 0a 00 00 call 80104280 <acquire> p->state = RUNNABLE; 80103838: c7 43 0c 03 00 00 00 movl $0x3,0xc(%ebx) release(&ptable.lock); 8010383f: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 80103846: e8 a5 0a 00 00 call 801042f0 <release> } 8010384b: 83 c4 14 add $0x14,%esp 8010384e: 5b pop %ebx 8010384f: 5d pop %ebp 80103850: c3 ret p = allocproc(); initproc = p; if((p->pgdir = setupkvm()) == 0) panic("userinit: out of memory?"); 80103851: c7 04 24 9c 72 10 80 movl $0x8010729c,(%esp) 80103858: e8 13 cb ff ff call 80100370 <panic> 8010385d: 8d 76 00 lea 0x0(%esi),%esi 80103860 <growproc>: // Grow current process's memory by n bytes. // Return 0 on success, -1 on failure. int growproc(int n) { 80103860: 55 push %ebp 80103861: 89 e5 mov %esp,%ebp 80103863: 83 ec 18 sub $0x18,%esp 80103866: 89 5d f8 mov %ebx,-0x8(%ebp) 80103869: 89 75 fc mov %esi,-0x4(%ebp) 8010386c: 8b 75 08 mov 0x8(%ebp),%esi uint sz; struct proc *curproc = myproc(); 8010386f: e8 bc fe ff ff call 80103730 <myproc> sz = curproc->sz; if(n > 0){ 80103874: 83 fe 00 cmp $0x0,%esi // Return 0 on success, -1 on failure. int growproc(int n) { uint sz; struct proc *curproc = myproc(); 80103877: 89 c3 mov %eax,%ebx sz = curproc->sz; 80103879: 8b 10 mov (%eax),%edx if(n > 0){ 8010387b: 7e 3b jle 801038b8 <growproc+0x58> if((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0) 8010387d: 01 d6 add %edx,%esi 8010387f: 89 54 24 04 mov %edx,0x4(%esp) 80103883: 89 74 24 08 mov %esi,0x8(%esp) 80103887: 8b 40 04 mov 0x4(%eax),%eax 8010388a: 89 04 24 mov %eax,(%esp) 8010388d: e8 7e 30 00 00 call 80106910 <allocuvm> 80103892: 89 c2 mov %eax,%edx return -1; 80103894: b8 ff ff ff ff mov $0xffffffff,%eax uint sz; struct proc *curproc = myproc(); sz = curproc->sz; if(n > 0){ if((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0) 80103899: 85 d2 test %edx,%edx 8010389b: 74 0c je 801038a9 <growproc+0x49> return -1; } else if(n < 0){ if((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0) return -1; } curproc->sz = sz; 8010389d: 89 13 mov %edx,(%ebx) switchuvm(curproc); 8010389f: 89 1c 24 mov %ebx,(%esp) 801038a2: e8 79 2d 00 00 call 80106620 <switchuvm> return 0; 801038a7: 31 c0 xor %eax,%eax } 801038a9: 8b 5d f8 mov -0x8(%ebp),%ebx 801038ac: 8b 75 fc mov -0x4(%ebp),%esi 801038af: 89 ec mov %ebp,%esp 801038b1: 5d pop %ebp 801038b2: c3 ret 801038b3: 90 nop 801038b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi sz = curproc->sz; if(n > 0){ if((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0) return -1; } else if(n < 0){ 801038b8: 74 e3 je 8010389d <growproc+0x3d> if((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0) 801038ba: 01 d6 add %edx,%esi 801038bc: 89 54 24 04 mov %edx,0x4(%esp) 801038c0: 89 74 24 08 mov %esi,0x8(%esp) 801038c4: 8b 40 04 mov 0x4(%eax),%eax 801038c7: 89 04 24 mov %eax,(%esp) 801038ca: e8 a1 2f 00 00 call 80106870 <deallocuvm> 801038cf: 89 c2 mov %eax,%edx return -1; 801038d1: b8 ff ff ff ff mov $0xffffffff,%eax sz = curproc->sz; if(n > 0){ if((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0) return -1; } else if(n < 0){ if((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0) 801038d6: 85 d2 test %edx,%edx 801038d8: 75 c3 jne 8010389d <growproc+0x3d> 801038da: eb cd jmp 801038a9 <growproc+0x49> 801038dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801038e0 <fork>: // Create a new process copying p as the parent. // Sets up stack to return as if from system call. // Caller must set state of returned proc to RUNNABLE. int fork(void) { 801038e0: 55 push %ebp 801038e1: 89 e5 mov %esp,%ebp 801038e3: 57 push %edi 801038e4: 56 push %esi 801038e5: 53 push %ebx 801038e6: 83 ec 2c sub $0x2c,%esp int i, pid; struct proc *np; struct proc *curproc = myproc(); 801038e9: e8 42 fe ff ff call 80103730 <myproc> 801038ee: 89 c3 mov %eax,%ebx // Allocate process. if((np = allocproc()) == 0){ 801038f0: e8 4b fc ff ff call 80103540 <allocproc> 801038f5: 85 c0 test %eax,%eax 801038f7: 89 45 e4 mov %eax,-0x1c(%ebp) 801038fa: 0f 84 c6 00 00 00 je 801039c6 <fork+0xe6> return -1; } // Copy process state from proc. if((np->pgdir = copyuvm(curproc->pgdir, curproc->sz)) == 0){ 80103900: 8b 03 mov (%ebx),%eax 80103902: 89 44 24 04 mov %eax,0x4(%esp) 80103906: 8b 43 04 mov 0x4(%ebx),%eax 80103909: 89 04 24 mov %eax,(%esp) 8010390c: e8 7f 32 00 00 call 80106b90 <copyuvm> 80103911: 8b 55 e4 mov -0x1c(%ebp),%edx 80103914: 85 c0 test %eax,%eax 80103916: 89 42 04 mov %eax,0x4(%edx) 80103919: 0f 84 ae 00 00 00 je 801039cd <fork+0xed> kfree(np->kstack); np->kstack = 0; np->state = UNUSED; return -1; } np->sz = curproc->sz; 8010391f: 8b 03 mov (%ebx),%eax np->parent = curproc; *np->tf = *curproc->tf; 80103921: b9 13 00 00 00 mov $0x13,%ecx kfree(np->kstack); np->kstack = 0; np->state = UNUSED; return -1; } np->sz = curproc->sz; 80103926: 8b 55 e4 mov -0x1c(%ebp),%edx 80103929: 89 02 mov %eax,(%edx) np->parent = curproc; *np->tf = *curproc->tf; 8010392b: 8b 42 18 mov 0x18(%edx),%eax np->kstack = 0; np->state = UNUSED; return -1; } np->sz = curproc->sz; np->parent = curproc; 8010392e: 89 5a 14 mov %ebx,0x14(%edx) *np->tf = *curproc->tf; 80103931: 8b 73 18 mov 0x18(%ebx),%esi 80103934: 89 c7 mov %eax,%edi 80103936: f3 a5 rep movsl %ds:(%esi),%es:(%edi) // Clear %eax so that fork returns 0 in the child. np->tf->eax = 0; for(i = 0; i < NOFILE; i++) 80103938: 31 f6 xor %esi,%esi np->sz = curproc->sz; np->parent = curproc; *np->tf = *curproc->tf; // Clear %eax so that fork returns 0 in the child. np->tf->eax = 0; 8010393a: 8b 42 18 mov 0x18(%edx),%eax 8010393d: c7 40 1c 00 00 00 00 movl $0x0,0x1c(%eax) 80103944: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for(i = 0; i < NOFILE; i++) if(curproc->ofile[i]) 80103948: 8b 44 b3 28 mov 0x28(%ebx,%esi,4),%eax 8010394c: 85 c0 test %eax,%eax 8010394e: 74 0f je 8010395f <fork+0x7f> np->ofile[i] = filedup(curproc->ofile[i]); 80103950: 89 04 24 mov %eax,(%esp) 80103953: e8 78 d4 ff ff call 80100dd0 <filedup> 80103958: 8b 55 e4 mov -0x1c(%ebp),%edx 8010395b: 89 44 b2 28 mov %eax,0x28(%edx,%esi,4) *np->tf = *curproc->tf; // Clear %eax so that fork returns 0 in the child. np->tf->eax = 0; for(i = 0; i < NOFILE; i++) 8010395f: 83 c6 01 add $0x1,%esi 80103962: 83 fe 10 cmp $0x10,%esi 80103965: 75 e1 jne 80103948 <fork+0x68> if(curproc->ofile[i]) np->ofile[i] = filedup(curproc->ofile[i]); np->cwd = idup(curproc->cwd); 80103967: 8b 43 68 mov 0x68(%ebx),%eax safestrcpy(np->name, curproc->name, sizeof(curproc->name)); 8010396a: 83 c3 6c add $0x6c,%ebx np->tf->eax = 0; for(i = 0; i < NOFILE; i++) if(curproc->ofile[i]) np->ofile[i] = filedup(curproc->ofile[i]); np->cwd = idup(curproc->cwd); 8010396d: 89 04 24 mov %eax,(%esp) 80103970: e8 fb dc ff ff call 80101670 <idup> 80103975: 8b 55 e4 mov -0x1c(%ebp),%edx 80103978: 89 42 68 mov %eax,0x68(%edx) safestrcpy(np->name, curproc->name, sizeof(curproc->name)); 8010397b: 89 d0 mov %edx,%eax 8010397d: 83 c0 6c add $0x6c,%eax 80103980: 89 5c 24 04 mov %ebx,0x4(%esp) 80103984: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) 8010398b: 00 8010398c: 89 04 24 mov %eax,(%esp) 8010398f: e8 9c 0b 00 00 call 80104530 <safestrcpy> pid = np->pid; 80103994: 8b 45 e4 mov -0x1c(%ebp),%eax 80103997: 8b 58 10 mov 0x10(%eax),%ebx acquire(&ptable.lock); 8010399a: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 801039a1: e8 da 08 00 00 call 80104280 <acquire> np->state = RUNNABLE; 801039a6: 8b 45 e4 mov -0x1c(%ebp),%eax 801039a9: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) release(&ptable.lock); 801039b0: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 801039b7: e8 34 09 00 00 call 801042f0 <release> return pid; } 801039bc: 83 c4 2c add $0x2c,%esp 801039bf: 89 d8 mov %ebx,%eax 801039c1: 5b pop %ebx 801039c2: 5e pop %esi 801039c3: 5f pop %edi 801039c4: 5d pop %ebp 801039c5: c3 ret struct proc *np; struct proc *curproc = myproc(); // Allocate process. if((np = allocproc()) == 0){ return -1; 801039c6: bb ff ff ff ff mov $0xffffffff,%ebx 801039cb: eb ef jmp 801039bc <fork+0xdc> } // Copy process state from proc. if((np->pgdir = copyuvm(curproc->pgdir, curproc->sz)) == 0){ kfree(np->kstack); 801039cd: 8b 42 08 mov 0x8(%edx),%eax np->kstack = 0; np->state = UNUSED; return -1; 801039d0: bb ff ff ff ff mov $0xffffffff,%ebx return -1; } // Copy process state from proc. if((np->pgdir = copyuvm(curproc->pgdir, curproc->sz)) == 0){ kfree(np->kstack); 801039d5: 89 04 24 mov %eax,(%esp) 801039d8: e8 63 e9 ff ff call 80102340 <kfree> np->kstack = 0; 801039dd: 8b 45 e4 mov -0x1c(%ebp),%eax 801039e0: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) np->state = UNUSED; 801039e7: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax) return -1; 801039ee: eb cc jmp 801039bc <fork+0xdc> 801039f0 <scheduler>: // - swtch to start running that process // - eventually that process transfers control // via swtch back to the scheduler. void scheduler(void) { 801039f0: 55 push %ebp 801039f1: 89 e5 mov %esp,%ebp 801039f3: 57 push %edi 801039f4: 56 push %esi 801039f5: 53 push %ebx 801039f6: 83 ec 1c sub $0x1c,%esp struct proc *p; struct cpu *c = mycpu(); 801039f9: e8 92 fc ff ff call 80103690 <mycpu> 801039fe: 89 c6 mov %eax,%esi c->proc = 0; 80103a00: c7 80 ac 00 00 00 00 movl $0x0,0xac(%eax) 80103a07: 00 00 00 80103a0a: 8d 78 04 lea 0x4(%eax),%edi 80103a0d: 8d 76 00 lea 0x0(%esi),%esi } static inline void sti(void) { asm volatile("sti"); 80103a10: fb sti // Enable interrupts on this processor. sti(); // Loop over process table looking for process to run. acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103a11: bb 54 2d 11 80 mov $0x80112d54,%ebx for(;;){ // Enable interrupts on this processor. sti(); // Loop over process table looking for process to run. acquire(&ptable.lock); 80103a16: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 80103a1d: e8 5e 08 00 00 call 80104280 <acquire> 80103a22: eb 0f jmp 80103a33 <scheduler+0x43> 80103a24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103a28: 83 c3 7c add $0x7c,%ebx 80103a2b: 81 fb 54 4c 11 80 cmp $0x80114c54,%ebx 80103a31: 73 45 jae 80103a78 <scheduler+0x88> if(p->state != RUNNABLE) 80103a33: 83 7b 0c 03 cmpl $0x3,0xc(%ebx) 80103a37: 75 ef jne 80103a28 <scheduler+0x38> continue; // Switch to chosen process. It is the process's job // to release ptable.lock and then reacquire it // before jumping back to us. c->proc = p; 80103a39: 89 9e ac 00 00 00 mov %ebx,0xac(%esi) switchuvm(p); 80103a3f: 89 1c 24 mov %ebx,(%esp) 80103a42: e8 d9 2b 00 00 call 80106620 <switchuvm> p->state = RUNNING; swtch(&(c->scheduler), p->context); 80103a47: 8b 43 1c mov 0x1c(%ebx),%eax // Switch to chosen process. It is the process's job // to release ptable.lock and then reacquire it // before jumping back to us. c->proc = p; switchuvm(p); p->state = RUNNING; 80103a4a: c7 43 0c 04 00 00 00 movl $0x4,0xc(%ebx) // Enable interrupts on this processor. sti(); // Loop over process table looking for process to run. acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103a51: 83 c3 7c add $0x7c,%ebx // before jumping back to us. c->proc = p; switchuvm(p); p->state = RUNNING; swtch(&(c->scheduler), p->context); 80103a54: 89 3c 24 mov %edi,(%esp) 80103a57: 89 44 24 04 mov %eax,0x4(%esp) 80103a5b: e8 2c 0b 00 00 call 8010458c <swtch> switchkvm(); 80103a60: e8 9b 2b 00 00 call 80106600 <switchkvm> // Enable interrupts on this processor. sti(); // Loop over process table looking for process to run. acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103a65: 81 fb 54 4c 11 80 cmp $0x80114c54,%ebx swtch(&(c->scheduler), p->context); switchkvm(); // Process is done running for now. // It should have changed its p->state before coming back. c->proc = 0; 80103a6b: c7 86 ac 00 00 00 00 movl $0x0,0xac(%esi) 80103a72: 00 00 00 // Enable interrupts on this processor. sti(); // Loop over process table looking for process to run. acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103a75: 72 bc jb 80103a33 <scheduler+0x43> 80103a77: 90 nop // Process is done running for now. // It should have changed its p->state before coming back. c->proc = 0; } release(&ptable.lock); 80103a78: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 80103a7f: e8 6c 08 00 00 call 801042f0 <release> } 80103a84: eb 8a jmp 80103a10 <scheduler+0x20> 80103a86: 8d 76 00 lea 0x0(%esi),%esi 80103a89: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80103a90 <sched>: // be proc->intena and proc->ncli, but that would // break in the few places where a lock is held but // there's no process. void sched(void) { 80103a90: 55 push %ebp 80103a91: 89 e5 mov %esp,%ebp 80103a93: 56 push %esi 80103a94: 53 push %ebx 80103a95: 83 ec 10 sub $0x10,%esp int intena; struct proc *p = myproc(); 80103a98: e8 93 fc ff ff call 80103730 <myproc> if(!holding(&ptable.lock)) 80103a9d: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) // there's no process. void sched(void) { int intena; struct proc *p = myproc(); 80103aa4: 89 c3 mov %eax,%ebx if(!holding(&ptable.lock)) 80103aa6: e8 95 07 00 00 call 80104240 <holding> 80103aab: 85 c0 test %eax,%eax 80103aad: 74 4f je 80103afe <sched+0x6e> panic("sched ptable.lock"); if(mycpu()->ncli != 1) 80103aaf: e8 dc fb ff ff call 80103690 <mycpu> 80103ab4: 83 b8 a4 00 00 00 01 cmpl $0x1,0xa4(%eax) 80103abb: 75 65 jne 80103b22 <sched+0x92> panic("sched locks"); if(p->state == RUNNING) 80103abd: 83 7b 0c 04 cmpl $0x4,0xc(%ebx) 80103ac1: 74 53 je 80103b16 <sched+0x86> static inline uint readeflags(void) { uint eflags; asm volatile("pushfl; popl %0" : "=r" (eflags)); 80103ac3: 9c pushf 80103ac4: 58 pop %eax panic("sched running"); if(readeflags()&FL_IF) 80103ac5: f6 c4 02 test $0x2,%ah 80103ac8: 75 40 jne 80103b0a <sched+0x7a> panic("sched interruptible"); intena = mycpu()->intena; 80103aca: e8 c1 fb ff ff call 80103690 <mycpu> swtch(&p->context, mycpu()->scheduler); 80103acf: 83 c3 1c add $0x1c,%ebx panic("sched locks"); if(p->state == RUNNING) panic("sched running"); if(readeflags()&FL_IF) panic("sched interruptible"); intena = mycpu()->intena; 80103ad2: 8b b0 a8 00 00 00 mov 0xa8(%eax),%esi swtch(&p->context, mycpu()->scheduler); 80103ad8: e8 b3 fb ff ff call 80103690 <mycpu> 80103add: 8b 40 04 mov 0x4(%eax),%eax 80103ae0: 89 1c 24 mov %ebx,(%esp) 80103ae3: 89 44 24 04 mov %eax,0x4(%esp) 80103ae7: e8 a0 0a 00 00 call 8010458c <swtch> mycpu()->intena = intena; 80103aec: e8 9f fb ff ff call 80103690 <mycpu> 80103af1: 89 b0 a8 00 00 00 mov %esi,0xa8(%eax) } 80103af7: 83 c4 10 add $0x10,%esp 80103afa: 5b pop %ebx 80103afb: 5e pop %esi 80103afc: 5d pop %ebp 80103afd: c3 ret { int intena; struct proc *p = myproc(); if(!holding(&ptable.lock)) panic("sched ptable.lock"); 80103afe: c7 04 24 c0 72 10 80 movl $0x801072c0,(%esp) 80103b05: e8 66 c8 ff ff call 80100370 <panic> if(mycpu()->ncli != 1) panic("sched locks"); if(p->state == RUNNING) panic("sched running"); if(readeflags()&FL_IF) panic("sched interruptible"); 80103b0a: c7 04 24 ec 72 10 80 movl $0x801072ec,(%esp) 80103b11: e8 5a c8 ff ff call 80100370 <panic> if(!holding(&ptable.lock)) panic("sched ptable.lock"); if(mycpu()->ncli != 1) panic("sched locks"); if(p->state == RUNNING) panic("sched running"); 80103b16: c7 04 24 de 72 10 80 movl $0x801072de,(%esp) 80103b1d: e8 4e c8 ff ff call 80100370 <panic> struct proc *p = myproc(); if(!holding(&ptable.lock)) panic("sched ptable.lock"); if(mycpu()->ncli != 1) panic("sched locks"); 80103b22: c7 04 24 d2 72 10 80 movl $0x801072d2,(%esp) 80103b29: e8 42 c8 ff ff call 80100370 <panic> 80103b2e: 66 90 xchg %ax,%ax 80103b30 <exit>: // Exit the current process. Does not return. // An exited process remains in the zombie state // until its parent calls wait() to find out it exited. void exit(void) { 80103b30: 55 push %ebp 80103b31: 89 e5 mov %esp,%ebp 80103b33: 56 push %esi struct proc *curproc = myproc(); struct proc *p; int fd; if(curproc == initproc) 80103b34: 31 f6 xor %esi,%esi // Exit the current process. Does not return. // An exited process remains in the zombie state // until its parent calls wait() to find out it exited. void exit(void) { 80103b36: 53 push %ebx 80103b37: 83 ec 10 sub $0x10,%esp struct proc *curproc = myproc(); 80103b3a: e8 f1 fb ff ff call 80103730 <myproc> struct proc *p; int fd; if(curproc == initproc) 80103b3f: 3b 05 a0 a5 10 80 cmp 0x8010a5a0,%eax // An exited process remains in the zombie state // until its parent calls wait() to find out it exited. void exit(void) { struct proc *curproc = myproc(); 80103b45: 89 c3 mov %eax,%ebx struct proc *p; int fd; if(curproc == initproc) 80103b47: 0f 84 ea 00 00 00 je 80103c37 <exit+0x107> 80103b4d: 8d 76 00 lea 0x0(%esi),%esi panic("init exiting"); // Close all open files. for(fd = 0; fd < NOFILE; fd++){ if(curproc->ofile[fd]){ 80103b50: 8b 44 b3 28 mov 0x28(%ebx,%esi,4),%eax 80103b54: 85 c0 test %eax,%eax 80103b56: 74 10 je 80103b68 <exit+0x38> fileclose(curproc->ofile[fd]); 80103b58: 89 04 24 mov %eax,(%esp) 80103b5b: e8 c0 d2 ff ff call 80100e20 <fileclose> curproc->ofile[fd] = 0; 80103b60: c7 44 b3 28 00 00 00 movl $0x0,0x28(%ebx,%esi,4) 80103b67: 00 if(curproc == initproc) panic("init exiting"); // Close all open files. for(fd = 0; fd < NOFILE; fd++){ 80103b68: 83 c6 01 add $0x1,%esi 80103b6b: 83 fe 10 cmp $0x10,%esi 80103b6e: 75 e0 jne 80103b50 <exit+0x20> fileclose(curproc->ofile[fd]); curproc->ofile[fd] = 0; } } begin_op(); 80103b70: e8 fb ef ff ff call 80102b70 <begin_op> iput(curproc->cwd); 80103b75: 8b 43 68 mov 0x68(%ebx),%eax 80103b78: 89 04 24 mov %eax,(%esp) 80103b7b: e8 50 dc ff ff call 801017d0 <iput> end_op(); 80103b80: e8 5b f0 ff ff call 80102be0 <end_op> curproc->cwd = 0; 80103b85: c7 43 68 00 00 00 00 movl $0x0,0x68(%ebx) acquire(&ptable.lock); 80103b8c: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 80103b93: e8 e8 06 00 00 call 80104280 <acquire> // Parent might be sleeping in wait(). wakeup1(curproc->parent); 80103b98: 8b 43 14 mov 0x14(%ebx),%eax static void wakeup1(void *chan) { struct proc *p; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80103b9b: ba 54 2d 11 80 mov $0x80112d54,%edx 80103ba0: eb 11 jmp 80103bb3 <exit+0x83> 80103ba2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80103ba8: 83 c2 7c add $0x7c,%edx 80103bab: 81 fa 54 4c 11 80 cmp $0x80114c54,%edx 80103bb1: 73 1d jae 80103bd0 <exit+0xa0> if(p->state == SLEEPING && p->chan == chan) 80103bb3: 83 7a 0c 02 cmpl $0x2,0xc(%edx) 80103bb7: 75 ef jne 80103ba8 <exit+0x78> 80103bb9: 3b 42 20 cmp 0x20(%edx),%eax 80103bbc: 75 ea jne 80103ba8 <exit+0x78> p->state = RUNNABLE; 80103bbe: c7 42 0c 03 00 00 00 movl $0x3,0xc(%edx) static void wakeup1(void *chan) { struct proc *p; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80103bc5: 83 c2 7c add $0x7c,%edx 80103bc8: 81 fa 54 4c 11 80 cmp $0x80114c54,%edx 80103bce: 72 e3 jb 80103bb3 <exit+0x83> wakeup1(curproc->parent); // Pass abandoned children to init. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->parent == curproc){ p->parent = initproc; 80103bd0: a1 a0 a5 10 80 mov 0x8010a5a0,%eax 80103bd5: b9 54 2d 11 80 mov $0x80112d54,%ecx 80103bda: eb 0f jmp 80103beb <exit+0xbb> 80103bdc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi // Parent might be sleeping in wait(). wakeup1(curproc->parent); // Pass abandoned children to init. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103be0: 83 c1 7c add $0x7c,%ecx 80103be3: 81 f9 54 4c 11 80 cmp $0x80114c54,%ecx 80103be9: 73 34 jae 80103c1f <exit+0xef> if(p->parent == curproc){ 80103beb: 39 59 14 cmp %ebx,0x14(%ecx) 80103bee: 75 f0 jne 80103be0 <exit+0xb0> p->parent = initproc; if(p->state == ZOMBIE) 80103bf0: 83 79 0c 05 cmpl $0x5,0xc(%ecx) wakeup1(curproc->parent); // Pass abandoned children to init. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->parent == curproc){ p->parent = initproc; 80103bf4: 89 41 14 mov %eax,0x14(%ecx) if(p->state == ZOMBIE) 80103bf7: 75 e7 jne 80103be0 <exit+0xb0> 80103bf9: ba 54 2d 11 80 mov $0x80112d54,%edx 80103bfe: eb 0b jmp 80103c0b <exit+0xdb> static void wakeup1(void *chan) { struct proc *p; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80103c00: 83 c2 7c add $0x7c,%edx 80103c03: 81 fa 54 4c 11 80 cmp $0x80114c54,%edx 80103c09: 73 d5 jae 80103be0 <exit+0xb0> if(p->state == SLEEPING && p->chan == chan) 80103c0b: 83 7a 0c 02 cmpl $0x2,0xc(%edx) 80103c0f: 75 ef jne 80103c00 <exit+0xd0> 80103c11: 3b 42 20 cmp 0x20(%edx),%eax 80103c14: 75 ea jne 80103c00 <exit+0xd0> p->state = RUNNABLE; 80103c16: c7 42 0c 03 00 00 00 movl $0x3,0xc(%edx) 80103c1d: eb e1 jmp 80103c00 <exit+0xd0> wakeup1(initproc); } } // Jump into the scheduler, never to return. curproc->state = ZOMBIE; 80103c1f: c7 43 0c 05 00 00 00 movl $0x5,0xc(%ebx) sched(); 80103c26: e8 65 fe ff ff call 80103a90 <sched> panic("zombie exit"); 80103c2b: c7 04 24 0d 73 10 80 movl $0x8010730d,(%esp) 80103c32: e8 39 c7 ff ff call 80100370 <panic> struct proc *curproc = myproc(); struct proc *p; int fd; if(curproc == initproc) panic("init exiting"); 80103c37: c7 04 24 00 73 10 80 movl $0x80107300,(%esp) 80103c3e: e8 2d c7 ff ff call 80100370 <panic> 80103c43: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80103c49: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80103c50 <yield>: } // Give up the CPU for one scheduling round. void yield(void) { 80103c50: 55 push %ebp 80103c51: 89 e5 mov %esp,%ebp 80103c53: 83 ec 18 sub $0x18,%esp acquire(&ptable.lock); //DOC: yieldlock 80103c56: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 80103c5d: e8 1e 06 00 00 call 80104280 <acquire> myproc()->state = RUNNABLE; 80103c62: e8 c9 fa ff ff call 80103730 <myproc> 80103c67: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) sched(); 80103c6e: e8 1d fe ff ff call 80103a90 <sched> release(&ptable.lock); 80103c73: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 80103c7a: e8 71 06 00 00 call 801042f0 <release> } 80103c7f: c9 leave 80103c80: c3 ret 80103c81: eb 0d jmp 80103c90 <sleep> 80103c83: 90 nop 80103c84: 90 nop 80103c85: 90 nop 80103c86: 90 nop 80103c87: 90 nop 80103c88: 90 nop 80103c89: 90 nop 80103c8a: 90 nop 80103c8b: 90 nop 80103c8c: 90 nop 80103c8d: 90 nop 80103c8e: 90 nop 80103c8f: 90 nop 80103c90 <sleep>: // Atomically release lock and sleep on chan. // Reacquires lock when awakened. void sleep(void *chan, struct spinlock *lk) { 80103c90: 55 push %ebp 80103c91: 89 e5 mov %esp,%ebp 80103c93: 83 ec 28 sub $0x28,%esp 80103c96: 89 5d f4 mov %ebx,-0xc(%ebp) 80103c99: 8b 5d 0c mov 0xc(%ebp),%ebx 80103c9c: 89 75 f8 mov %esi,-0x8(%ebp) 80103c9f: 8b 75 08 mov 0x8(%ebp),%esi 80103ca2: 89 7d fc mov %edi,-0x4(%ebp) struct proc *p = myproc(); 80103ca5: e8 86 fa ff ff call 80103730 <myproc> if(p == 0) 80103caa: 85 c0 test %eax,%eax // Atomically release lock and sleep on chan. // Reacquires lock when awakened. void sleep(void *chan, struct spinlock *lk) { struct proc *p = myproc(); 80103cac: 89 c7 mov %eax,%edi if(p == 0) 80103cae: 0f 84 8b 00 00 00 je 80103d3f <sleep+0xaf> panic("sleep"); if(lk == 0) 80103cb4: 85 db test %ebx,%ebx 80103cb6: 74 7b je 80103d33 <sleep+0xa3> // change p->state and then call sched. // Once we hold ptable.lock, we can be // guaranteed that we won't miss any wakeup // (wakeup runs with ptable.lock locked), // so it's okay to release lk. if(lk != &ptable.lock){ //DOC: sleeplock0 80103cb8: 81 fb 20 2d 11 80 cmp $0x80112d20,%ebx 80103cbe: 74 50 je 80103d10 <sleep+0x80> acquire(&ptable.lock); //DOC: sleeplock1 80103cc0: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 80103cc7: e8 b4 05 00 00 call 80104280 <acquire> release(lk); 80103ccc: 89 1c 24 mov %ebx,(%esp) 80103ccf: e8 1c 06 00 00 call 801042f0 <release> } // Go to sleep. p->chan = chan; 80103cd4: 89 77 20 mov %esi,0x20(%edi) p->state = SLEEPING; 80103cd7: c7 47 0c 02 00 00 00 movl $0x2,0xc(%edi) sched(); 80103cde: e8 ad fd ff ff call 80103a90 <sched> // Tidy up. p->chan = 0; 80103ce3: c7 47 20 00 00 00 00 movl $0x0,0x20(%edi) // Reacquire original lock. if(lk != &ptable.lock){ //DOC: sleeplock2 release(&ptable.lock); 80103cea: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 80103cf1: e8 fa 05 00 00 call 801042f0 <release> acquire(lk); } } 80103cf6: 8b 75 f8 mov -0x8(%ebp),%esi p->chan = 0; // Reacquire original lock. if(lk != &ptable.lock){ //DOC: sleeplock2 release(&ptable.lock); acquire(lk); 80103cf9: 89 5d 08 mov %ebx,0x8(%ebp) } } 80103cfc: 8b 7d fc mov -0x4(%ebp),%edi 80103cff: 8b 5d f4 mov -0xc(%ebp),%ebx 80103d02: 89 ec mov %ebp,%esp 80103d04: 5d pop %ebp p->chan = 0; // Reacquire original lock. if(lk != &ptable.lock){ //DOC: sleeplock2 release(&ptable.lock); acquire(lk); 80103d05: e9 76 05 00 00 jmp 80104280 <acquire> 80103d0a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if(lk != &ptable.lock){ //DOC: sleeplock0 acquire(&ptable.lock); //DOC: sleeplock1 release(lk); } // Go to sleep. p->chan = chan; 80103d10: 89 70 20 mov %esi,0x20(%eax) p->state = SLEEPING; 80103d13: c7 40 0c 02 00 00 00 movl $0x2,0xc(%eax) sched(); 80103d1a: e8 71 fd ff ff call 80103a90 <sched> // Tidy up. p->chan = 0; 80103d1f: c7 47 20 00 00 00 00 movl $0x0,0x20(%edi) // Reacquire original lock. if(lk != &ptable.lock){ //DOC: sleeplock2 release(&ptable.lock); acquire(lk); } } 80103d26: 8b 5d f4 mov -0xc(%ebp),%ebx 80103d29: 8b 75 f8 mov -0x8(%ebp),%esi 80103d2c: 8b 7d fc mov -0x4(%ebp),%edi 80103d2f: 89 ec mov %ebp,%esp 80103d31: 5d pop %ebp 80103d32: c3 ret if(p == 0) panic("sleep"); if(lk == 0) panic("sleep without lk"); 80103d33: c7 04 24 1f 73 10 80 movl $0x8010731f,(%esp) 80103d3a: e8 31 c6 ff ff call 80100370 <panic> sleep(void *chan, struct spinlock *lk) { struct proc *p = myproc(); if(p == 0) panic("sleep"); 80103d3f: c7 04 24 19 73 10 80 movl $0x80107319,(%esp) 80103d46: e8 25 c6 ff ff call 80100370 <panic> 80103d4b: 90 nop 80103d4c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80103d50 <wait>: // Wait for a child process to exit and return its pid. // Return -1 if this process has no children. int wait(void) { 80103d50: 55 push %ebp 80103d51: 89 e5 mov %esp,%ebp 80103d53: 56 push %esi 80103d54: 53 push %ebx 80103d55: 83 ec 10 sub $0x10,%esp struct proc *p; int havekids, pid; struct proc *curproc = myproc(); 80103d58: e8 d3 f9 ff ff call 80103730 <myproc> acquire(&ptable.lock); 80103d5d: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) int wait(void) { struct proc *p; int havekids, pid; struct proc *curproc = myproc(); 80103d64: 89 c6 mov %eax,%esi acquire(&ptable.lock); 80103d66: e8 15 05 00 00 call 80104280 <acquire> for(;;){ // Scan through table looking for exited children. havekids = 0; 80103d6b: 31 c0 xor %eax,%eax for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103d6d: bb 54 2d 11 80 mov $0x80112d54,%ebx 80103d72: eb 0f jmp 80103d83 <wait+0x33> 80103d74: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80103d78: 83 c3 7c add $0x7c,%ebx 80103d7b: 81 fb 54 4c 11 80 cmp $0x80114c54,%ebx 80103d81: 73 1d jae 80103da0 <wait+0x50> if(p->parent != curproc) 80103d83: 39 73 14 cmp %esi,0x14(%ebx) 80103d86: 75 f0 jne 80103d78 <wait+0x28> continue; havekids = 1; if(p->state == ZOMBIE){ 80103d88: 83 7b 0c 05 cmpl $0x5,0xc(%ebx) 80103d8c: 74 2f je 80103dbd <wait+0x6d> acquire(&ptable.lock); for(;;){ // Scan through table looking for exited children. havekids = 0; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103d8e: 83 c3 7c add $0x7c,%ebx if(p->parent != curproc) continue; havekids = 1; 80103d91: b8 01 00 00 00 mov $0x1,%eax acquire(&ptable.lock); for(;;){ // Scan through table looking for exited children. havekids = 0; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103d96: 81 fb 54 4c 11 80 cmp $0x80114c54,%ebx 80103d9c: 72 e5 jb 80103d83 <wait+0x33> 80103d9e: 66 90 xchg %ax,%ax return pid; } } // No point waiting if we don't have any children. if(!havekids || curproc->killed){ 80103da0: 85 c0 test %eax,%eax 80103da2: 74 6e je 80103e12 <wait+0xc2> 80103da4: 8b 5e 24 mov 0x24(%esi),%ebx 80103da7: 85 db test %ebx,%ebx 80103da9: 75 67 jne 80103e12 <wait+0xc2> release(&ptable.lock); return -1; } // Wait for children to exit. (See wakeup1 call in proc_exit.) sleep(curproc, &ptable.lock); //DOC: wait-sleep 80103dab: c7 44 24 04 20 2d 11 movl $0x80112d20,0x4(%esp) 80103db2: 80 80103db3: 89 34 24 mov %esi,(%esp) 80103db6: e8 d5 fe ff ff call 80103c90 <sleep> } 80103dbb: eb ae jmp 80103d6b <wait+0x1b> continue; havekids = 1; if(p->state == ZOMBIE){ // Found one. pid = p->pid; kfree(p->kstack); 80103dbd: 8b 43 08 mov 0x8(%ebx),%eax if(p->parent != curproc) continue; havekids = 1; if(p->state == ZOMBIE){ // Found one. pid = p->pid; 80103dc0: 8b 73 10 mov 0x10(%ebx),%esi kfree(p->kstack); 80103dc3: 89 04 24 mov %eax,(%esp) 80103dc6: e8 75 e5 ff ff call 80102340 <kfree> p->kstack = 0; freevm(p->pgdir); 80103dcb: 8b 43 04 mov 0x4(%ebx),%eax havekids = 1; if(p->state == ZOMBIE){ // Found one. pid = p->pid; kfree(p->kstack); p->kstack = 0; 80103dce: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) freevm(p->pgdir); 80103dd5: 89 04 24 mov %eax,(%esp) 80103dd8: e8 63 2c 00 00 call 80106a40 <freevm> p->pid = 0; 80103ddd: c7 43 10 00 00 00 00 movl $0x0,0x10(%ebx) p->parent = 0; 80103de4: c7 43 14 00 00 00 00 movl $0x0,0x14(%ebx) p->name[0] = 0; 80103deb: c6 43 6c 00 movb $0x0,0x6c(%ebx) p->killed = 0; 80103def: c7 43 24 00 00 00 00 movl $0x0,0x24(%ebx) p->state = UNUSED; 80103df6: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) release(&ptable.lock); 80103dfd: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 80103e04: e8 e7 04 00 00 call 801042f0 <release> } // Wait for children to exit. (See wakeup1 call in proc_exit.) sleep(curproc, &ptable.lock); //DOC: wait-sleep } } 80103e09: 83 c4 10 add $0x10,%esp 80103e0c: 89 f0 mov %esi,%eax 80103e0e: 5b pop %ebx 80103e0f: 5e pop %esi 80103e10: 5d pop %ebp 80103e11: c3 ret } } // No point waiting if we don't have any children. if(!havekids || curproc->killed){ release(&ptable.lock); 80103e12: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) return -1; 80103e19: be ff ff ff ff mov $0xffffffff,%esi } } // No point waiting if we don't have any children. if(!havekids || curproc->killed){ release(&ptable.lock); 80103e1e: e8 cd 04 00 00 call 801042f0 <release> } // Wait for children to exit. (See wakeup1 call in proc_exit.) sleep(curproc, &ptable.lock); //DOC: wait-sleep } } 80103e23: 83 c4 10 add $0x10,%esp 80103e26: 89 f0 mov %esi,%eax 80103e28: 5b pop %ebx 80103e29: 5e pop %esi 80103e2a: 5d pop %ebp 80103e2b: c3 ret 80103e2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80103e30 <wakeup>: } // Wake up all processes sleeping on chan. void wakeup(void *chan) { 80103e30: 55 push %ebp 80103e31: 89 e5 mov %esp,%ebp 80103e33: 53 push %ebx 80103e34: 83 ec 14 sub $0x14,%esp 80103e37: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&ptable.lock); 80103e3a: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 80103e41: e8 3a 04 00 00 call 80104280 <acquire> static void wakeup1(void *chan) { struct proc *p; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80103e46: b8 54 2d 11 80 mov $0x80112d54,%eax 80103e4b: eb 0d jmp 80103e5a <wakeup+0x2a> 80103e4d: 8d 76 00 lea 0x0(%esi),%esi 80103e50: 83 c0 7c add $0x7c,%eax 80103e53: 3d 54 4c 11 80 cmp $0x80114c54,%eax 80103e58: 73 1e jae 80103e78 <wakeup+0x48> if(p->state == SLEEPING && p->chan == chan) 80103e5a: 83 78 0c 02 cmpl $0x2,0xc(%eax) 80103e5e: 75 f0 jne 80103e50 <wakeup+0x20> 80103e60: 3b 58 20 cmp 0x20(%eax),%ebx 80103e63: 75 eb jne 80103e50 <wakeup+0x20> p->state = RUNNABLE; 80103e65: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) static void wakeup1(void *chan) { struct proc *p; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80103e6c: 83 c0 7c add $0x7c,%eax 80103e6f: 3d 54 4c 11 80 cmp $0x80114c54,%eax 80103e74: 72 e4 jb 80103e5a <wakeup+0x2a> 80103e76: 66 90 xchg %ax,%ax void wakeup(void *chan) { acquire(&ptable.lock); wakeup1(chan); release(&ptable.lock); 80103e78: c7 45 08 20 2d 11 80 movl $0x80112d20,0x8(%ebp) } 80103e7f: 83 c4 14 add $0x14,%esp 80103e82: 5b pop %ebx 80103e83: 5d pop %ebp void wakeup(void *chan) { acquire(&ptable.lock); wakeup1(chan); release(&ptable.lock); 80103e84: e9 67 04 00 00 jmp 801042f0 <release> 80103e89: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103e90 <kill>: // Kill the process with the given pid. // Process won't exit until it returns // to user space (see trap in trap.c). int kill(int pid) { 80103e90: 55 push %ebp 80103e91: 89 e5 mov %esp,%ebp 80103e93: 53 push %ebx 80103e94: 83 ec 14 sub $0x14,%esp 80103e97: 8b 5d 08 mov 0x8(%ebp),%ebx struct proc *p; acquire(&ptable.lock); 80103e9a: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 80103ea1: e8 da 03 00 00 call 80104280 <acquire> for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103ea6: b8 54 2d 11 80 mov $0x80112d54,%eax if(p->pid == pid){ 80103eab: 39 1d 64 2d 11 80 cmp %ebx,0x80112d64 80103eb1: 74 14 je 80103ec7 <kill+0x37> 80103eb3: 90 nop 80103eb4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi kill(int pid) { struct proc *p; acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103eb8: 83 c0 7c add $0x7c,%eax 80103ebb: 3d 54 4c 11 80 cmp $0x80114c54,%eax 80103ec0: 73 36 jae 80103ef8 <kill+0x68> if(p->pid == pid){ 80103ec2: 39 58 10 cmp %ebx,0x10(%eax) 80103ec5: 75 f1 jne 80103eb8 <kill+0x28> p->killed = 1; // Wake process from sleep if necessary. if(p->state == SLEEPING) 80103ec7: 83 78 0c 02 cmpl $0x2,0xc(%eax) struct proc *p; acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->pid == pid){ p->killed = 1; 80103ecb: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) // Wake process from sleep if necessary. if(p->state == SLEEPING) 80103ed2: 74 14 je 80103ee8 <kill+0x58> p->state = RUNNABLE; release(&ptable.lock); 80103ed4: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 80103edb: e8 10 04 00 00 call 801042f0 <release> return 0; } } release(&ptable.lock); return -1; } 80103ee0: 83 c4 14 add $0x14,%esp p->killed = 1; // Wake process from sleep if necessary. if(p->state == SLEEPING) p->state = RUNNABLE; release(&ptable.lock); return 0; 80103ee3: 31 c0 xor %eax,%eax } } release(&ptable.lock); return -1; } 80103ee5: 5b pop %ebx 80103ee6: 5d pop %ebp 80103ee7: c3 ret for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->pid == pid){ p->killed = 1; // Wake process from sleep if necessary. if(p->state == SLEEPING) p->state = RUNNABLE; 80103ee8: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) 80103eef: eb e3 jmp 80103ed4 <kill+0x44> 80103ef1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi release(&ptable.lock); return 0; } } release(&ptable.lock); 80103ef8: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 80103eff: e8 ec 03 00 00 call 801042f0 <release> return -1; } 80103f04: 83 c4 14 add $0x14,%esp release(&ptable.lock); return 0; } } release(&ptable.lock); return -1; 80103f07: b8 ff ff ff ff mov $0xffffffff,%eax } 80103f0c: 5b pop %ebx 80103f0d: 5d pop %ebp 80103f0e: c3 ret 80103f0f: 90 nop 80103f10 <procdump>: // Print a process listing to console. For debugging. // Runs when user types ^P on console. // No lock to avoid wedging a stuck machine further. void procdump(void) { 80103f10: 55 push %ebp 80103f11: 89 e5 mov %esp,%ebp 80103f13: 57 push %edi 80103f14: 56 push %esi 80103f15: 53 push %ebx int i; struct proc *p; char *state; uint pc[10]; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103f16: bb 54 2d 11 80 mov $0x80112d54,%ebx // Print a process listing to console. For debugging. // Runs when user types ^P on console. // No lock to avoid wedging a stuck machine further. void procdump(void) { 80103f1b: 83 ec 4c sub $0x4c,%esp //PAGEBREAK: 36 // Print a process listing to console. For debugging. // Runs when user types ^P on console. // No lock to avoid wedging a stuck machine further. void procdump(void) 80103f1e: 8d 7d e8 lea -0x18(%ebp),%edi 80103f21: eb 20 jmp 80103f43 <procdump+0x33> 80103f23: 90 nop 80103f24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if(p->state == SLEEPING){ getcallerpcs((uint*)p->context->ebp+2, pc); for(i=0; i<10 && pc[i] != 0; i++) cprintf(" %p", pc[i]); } cprintf("\n"); 80103f28: c7 04 24 97 76 10 80 movl $0x80107697,(%esp) 80103f2f: e8 1c c7 ff ff call 80100650 <cprintf> int i; struct proc *p; char *state; uint pc[10]; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103f34: 83 c3 7c add $0x7c,%ebx 80103f37: 81 fb 54 4c 11 80 cmp $0x80114c54,%ebx 80103f3d: 0f 83 8d 00 00 00 jae 80103fd0 <procdump+0xc0> if(p->state == UNUSED) 80103f43: 8b 43 0c mov 0xc(%ebx),%eax 80103f46: 85 c0 test %eax,%eax 80103f48: 74 ea je 80103f34 <procdump+0x24> continue; if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) 80103f4a: 83 f8 05 cmp $0x5,%eax state = states[p->state]; else state = "???"; 80103f4d: ba 30 73 10 80 mov $0x80107330,%edx uint pc[10]; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->state == UNUSED) continue; if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) 80103f52: 77 11 ja 80103f65 <procdump+0x55> 80103f54: 8b 14 85 90 73 10 80 mov -0x7fef8c70(,%eax,4),%edx state = states[p->state]; else state = "???"; 80103f5b: b8 30 73 10 80 mov $0x80107330,%eax 80103f60: 85 d2 test %edx,%edx 80103f62: 0f 44 d0 cmove %eax,%edx cprintf("%d %s %s", p->pid, state, p->name); 80103f65: 8d 43 6c lea 0x6c(%ebx),%eax 80103f68: 89 44 24 0c mov %eax,0xc(%esp) 80103f6c: 8b 43 10 mov 0x10(%ebx),%eax 80103f6f: 89 54 24 08 mov %edx,0x8(%esp) 80103f73: c7 04 24 34 73 10 80 movl $0x80107334,(%esp) 80103f7a: 89 44 24 04 mov %eax,0x4(%esp) 80103f7e: e8 cd c6 ff ff call 80100650 <cprintf> if(p->state == SLEEPING){ 80103f83: 83 7b 0c 02 cmpl $0x2,0xc(%ebx) 80103f87: 75 9f jne 80103f28 <procdump+0x18> getcallerpcs((uint*)p->context->ebp+2, pc); 80103f89: 8d 45 c0 lea -0x40(%ebp),%eax 80103f8c: 89 44 24 04 mov %eax,0x4(%esp) 80103f90: 8b 43 1c mov 0x1c(%ebx),%eax 80103f93: 8d 75 c0 lea -0x40(%ebp),%esi 80103f96: 8b 40 0c mov 0xc(%eax),%eax 80103f99: 83 c0 08 add $0x8,%eax 80103f9c: 89 04 24 mov %eax,(%esp) 80103f9f: e8 8c 01 00 00 call 80104130 <getcallerpcs> 80103fa4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for(i=0; i<10 && pc[i] != 0; i++) 80103fa8: 8b 06 mov (%esi),%eax 80103faa: 85 c0 test %eax,%eax 80103fac: 0f 84 76 ff ff ff je 80103f28 <procdump+0x18> cprintf(" %p", pc[i]); 80103fb2: 83 c6 04 add $0x4,%esi 80103fb5: 89 44 24 04 mov %eax,0x4(%esp) 80103fb9: c7 04 24 81 6d 10 80 movl $0x80106d81,(%esp) 80103fc0: e8 8b c6 ff ff call 80100650 <cprintf> else state = "???"; cprintf("%d %s %s", p->pid, state, p->name); if(p->state == SLEEPING){ getcallerpcs((uint*)p->context->ebp+2, pc); for(i=0; i<10 && pc[i] != 0; i++) 80103fc5: 39 fe cmp %edi,%esi 80103fc7: 75 df jne 80103fa8 <procdump+0x98> 80103fc9: e9 5a ff ff ff jmp 80103f28 <procdump+0x18> 80103fce: 66 90 xchg %ax,%ax cprintf(" %p", pc[i]); } cprintf("\n"); } } 80103fd0: 83 c4 4c add $0x4c,%esp 80103fd3: 5b pop %ebx 80103fd4: 5e pop %esi 80103fd5: 5f pop %edi 80103fd6: 5d pop %ebp 80103fd7: c3 ret ... 80103fe0 <initsleeplock>: #include "spinlock.h" #include "sleeplock.h" void initsleeplock(struct sleeplock *lk, char *name) { 80103fe0: 55 push %ebp 80103fe1: 89 e5 mov %esp,%ebp 80103fe3: 53 push %ebx 80103fe4: 83 ec 14 sub $0x14,%esp 80103fe7: 8b 5d 08 mov 0x8(%ebp),%ebx initlock(&lk->lk, "sleep lock"); 80103fea: c7 44 24 04 a8 73 10 movl $0x801073a8,0x4(%esp) 80103ff1: 80 80103ff2: 8d 43 04 lea 0x4(%ebx),%eax 80103ff5: 89 04 24 mov %eax,(%esp) 80103ff8: e8 13 01 00 00 call 80104110 <initlock> lk->name = name; 80103ffd: 8b 45 0c mov 0xc(%ebp),%eax lk->locked = 0; 80104000: c7 03 00 00 00 00 movl $0x0,(%ebx) lk->pid = 0; 80104006: c7 43 3c 00 00 00 00 movl $0x0,0x3c(%ebx) void initsleeplock(struct sleeplock *lk, char *name) { initlock(&lk->lk, "sleep lock"); lk->name = name; 8010400d: 89 43 38 mov %eax,0x38(%ebx) lk->locked = 0; lk->pid = 0; } 80104010: 83 c4 14 add $0x14,%esp 80104013: 5b pop %ebx 80104014: 5d pop %ebp 80104015: c3 ret 80104016: 8d 76 00 lea 0x0(%esi),%esi 80104019: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104020 <acquiresleep>: void acquiresleep(struct sleeplock *lk) { 80104020: 55 push %ebp 80104021: 89 e5 mov %esp,%ebp 80104023: 56 push %esi 80104024: 53 push %ebx 80104025: 83 ec 10 sub $0x10,%esp 80104028: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&lk->lk); 8010402b: 8d 73 04 lea 0x4(%ebx),%esi 8010402e: 89 34 24 mov %esi,(%esp) 80104031: e8 4a 02 00 00 call 80104280 <acquire> while (lk->locked) { 80104036: 8b 13 mov (%ebx),%edx 80104038: 85 d2 test %edx,%edx 8010403a: 74 16 je 80104052 <acquiresleep+0x32> 8010403c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi sleep(lk, &lk->lk); 80104040: 89 74 24 04 mov %esi,0x4(%esp) 80104044: 89 1c 24 mov %ebx,(%esp) 80104047: e8 44 fc ff ff call 80103c90 <sleep> void acquiresleep(struct sleeplock *lk) { acquire(&lk->lk); while (lk->locked) { 8010404c: 8b 03 mov (%ebx),%eax 8010404e: 85 c0 test %eax,%eax 80104050: 75 ee jne 80104040 <acquiresleep+0x20> sleep(lk, &lk->lk); } lk->locked = 1; 80104052: c7 03 01 00 00 00 movl $0x1,(%ebx) lk->pid = myproc()->pid; 80104058: e8 d3 f6 ff ff call 80103730 <myproc> 8010405d: 8b 40 10 mov 0x10(%eax),%eax 80104060: 89 43 3c mov %eax,0x3c(%ebx) release(&lk->lk); 80104063: 89 75 08 mov %esi,0x8(%ebp) } 80104066: 83 c4 10 add $0x10,%esp 80104069: 5b pop %ebx 8010406a: 5e pop %esi 8010406b: 5d pop %ebp while (lk->locked) { sleep(lk, &lk->lk); } lk->locked = 1; lk->pid = myproc()->pid; release(&lk->lk); 8010406c: e9 7f 02 00 00 jmp 801042f0 <release> 80104071: eb 0d jmp 80104080 <releasesleep> 80104073: 90 nop 80104074: 90 nop 80104075: 90 nop 80104076: 90 nop 80104077: 90 nop 80104078: 90 nop 80104079: 90 nop 8010407a: 90 nop 8010407b: 90 nop 8010407c: 90 nop 8010407d: 90 nop 8010407e: 90 nop 8010407f: 90 nop 80104080 <releasesleep>: } void releasesleep(struct sleeplock *lk) { 80104080: 55 push %ebp 80104081: 89 e5 mov %esp,%ebp 80104083: 83 ec 18 sub $0x18,%esp 80104086: 89 5d f8 mov %ebx,-0x8(%ebp) 80104089: 8b 5d 08 mov 0x8(%ebp),%ebx 8010408c: 89 75 fc mov %esi,-0x4(%ebp) acquire(&lk->lk); 8010408f: 8d 73 04 lea 0x4(%ebx),%esi 80104092: 89 34 24 mov %esi,(%esp) 80104095: e8 e6 01 00 00 call 80104280 <acquire> lk->locked = 0; 8010409a: c7 03 00 00 00 00 movl $0x0,(%ebx) lk->pid = 0; 801040a0: c7 43 3c 00 00 00 00 movl $0x0,0x3c(%ebx) wakeup(lk); 801040a7: 89 1c 24 mov %ebx,(%esp) 801040aa: e8 81 fd ff ff call 80103e30 <wakeup> release(&lk->lk); } 801040af: 8b 5d f8 mov -0x8(%ebp),%ebx { acquire(&lk->lk); lk->locked = 0; lk->pid = 0; wakeup(lk); release(&lk->lk); 801040b2: 89 75 08 mov %esi,0x8(%ebp) } 801040b5: 8b 75 fc mov -0x4(%ebp),%esi 801040b8: 89 ec mov %ebp,%esp 801040ba: 5d pop %ebp { acquire(&lk->lk); lk->locked = 0; lk->pid = 0; wakeup(lk); release(&lk->lk); 801040bb: e9 30 02 00 00 jmp 801042f0 <release> 801040c0 <holdingsleep>: } int holdingsleep(struct sleeplock *lk) { 801040c0: 55 push %ebp 801040c1: 89 e5 mov %esp,%ebp 801040c3: 83 ec 28 sub $0x28,%esp 801040c6: 89 75 f8 mov %esi,-0x8(%ebp) 801040c9: 8b 75 08 mov 0x8(%ebp),%esi 801040cc: 89 5d f4 mov %ebx,-0xc(%ebp) 801040cf: 89 7d fc mov %edi,-0x4(%ebp) int r; acquire(&lk->lk); r = lk->locked && (lk->pid == myproc()->pid); 801040d2: 31 ff xor %edi,%edi int holdingsleep(struct sleeplock *lk) { int r; acquire(&lk->lk); 801040d4: 8d 5e 04 lea 0x4(%esi),%ebx 801040d7: 89 1c 24 mov %ebx,(%esp) 801040da: e8 a1 01 00 00 call 80104280 <acquire> r = lk->locked && (lk->pid == myproc()->pid); 801040df: 8b 0e mov (%esi),%ecx 801040e1: 85 c9 test %ecx,%ecx 801040e3: 74 13 je 801040f8 <holdingsleep+0x38> 801040e5: 8b 76 3c mov 0x3c(%esi),%esi 801040e8: e8 43 f6 ff ff call 80103730 <myproc> 801040ed: 3b 70 10 cmp 0x10(%eax),%esi 801040f0: 0f 94 c0 sete %al 801040f3: 0f b6 c0 movzbl %al,%eax 801040f6: 89 c7 mov %eax,%edi release(&lk->lk); 801040f8: 89 1c 24 mov %ebx,(%esp) 801040fb: e8 f0 01 00 00 call 801042f0 <release> return r; } 80104100: 89 f8 mov %edi,%eax 80104102: 8b 5d f4 mov -0xc(%ebp),%ebx 80104105: 8b 75 f8 mov -0x8(%ebp),%esi 80104108: 8b 7d fc mov -0x4(%ebp),%edi 8010410b: 89 ec mov %ebp,%esp 8010410d: 5d pop %ebp 8010410e: c3 ret ... 80104110 <initlock>: #include "proc.h" #include "spinlock.h" void initlock(struct spinlock *lk, char *name) { 80104110: 55 push %ebp 80104111: 89 e5 mov %esp,%ebp 80104113: 8b 45 08 mov 0x8(%ebp),%eax lk->name = name; 80104116: 8b 55 0c mov 0xc(%ebp),%edx lk->locked = 0; 80104119: c7 00 00 00 00 00 movl $0x0,(%eax) #include "spinlock.h" void initlock(struct spinlock *lk, char *name) { lk->name = name; 8010411f: 89 50 04 mov %edx,0x4(%eax) lk->locked = 0; lk->cpu = 0; 80104122: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) } 80104129: 5d pop %ebp 8010412a: c3 ret 8010412b: 90 nop 8010412c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104130 <getcallerpcs>: } // Record the current call stack in pcs[] by following the %ebp chain. void getcallerpcs(void *v, uint pcs[]) { 80104130: 55 push %ebp uint *ebp; int i; ebp = (uint*)v - 2; for(i = 0; i < 10; i++){ 80104131: 31 c0 xor %eax,%eax } // Record the current call stack in pcs[] by following the %ebp chain. void getcallerpcs(void *v, uint pcs[]) { 80104133: 89 e5 mov %esp,%ebp uint *ebp; int i; ebp = (uint*)v - 2; 80104135: 8b 55 08 mov 0x8(%ebp),%edx } // Record the current call stack in pcs[] by following the %ebp chain. void getcallerpcs(void *v, uint pcs[]) { 80104138: 8b 4d 0c mov 0xc(%ebp),%ecx 8010413b: 53 push %ebx uint *ebp; int i; ebp = (uint*)v - 2; 8010413c: 83 ea 08 sub $0x8,%edx 8010413f: 90 nop for(i = 0; i < 10; i++){ if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) 80104140: 8d 9a 00 00 00 80 lea -0x80000000(%edx),%ebx 80104146: 81 fb fe ff ff 7f cmp $0x7ffffffe,%ebx 8010414c: 77 1a ja 80104168 <getcallerpcs+0x38> break; pcs[i] = ebp[1]; // saved %eip 8010414e: 8b 5a 04 mov 0x4(%edx),%ebx 80104151: 89 1c 81 mov %ebx,(%ecx,%eax,4) { uint *ebp; int i; ebp = (uint*)v - 2; for(i = 0; i < 10; i++){ 80104154: 83 c0 01 add $0x1,%eax if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) break; pcs[i] = ebp[1]; // saved %eip ebp = (uint*)ebp[0]; // saved %ebp 80104157: 8b 12 mov (%edx),%edx { uint *ebp; int i; ebp = (uint*)v - 2; for(i = 0; i < 10; i++){ 80104159: 83 f8 0a cmp $0xa,%eax 8010415c: 75 e2 jne 80104140 <getcallerpcs+0x10> pcs[i] = ebp[1]; // saved %eip ebp = (uint*)ebp[0]; // saved %ebp } for(; i < 10; i++) pcs[i] = 0; } 8010415e: 5b pop %ebx 8010415f: 5d pop %ebp 80104160: c3 ret 80104161: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi break; pcs[i] = ebp[1]; // saved %eip ebp = (uint*)ebp[0]; // saved %ebp } for(; i < 10; i++) pcs[i] = 0; 80104168: c7 04 81 00 00 00 00 movl $0x0,(%ecx,%eax,4) if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) break; pcs[i] = ebp[1]; // saved %eip ebp = (uint*)ebp[0]; // saved %ebp } for(; i < 10; i++) 8010416f: 83 c0 01 add $0x1,%eax 80104172: 83 f8 0a cmp $0xa,%eax 80104175: 74 e7 je 8010415e <getcallerpcs+0x2e> pcs[i] = 0; 80104177: c7 04 81 00 00 00 00 movl $0x0,(%ecx,%eax,4) if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) break; pcs[i] = ebp[1]; // saved %eip ebp = (uint*)ebp[0]; // saved %ebp } for(; i < 10; i++) 8010417e: 83 c0 01 add $0x1,%eax 80104181: 83 f8 0a cmp $0xa,%eax 80104184: 75 e2 jne 80104168 <getcallerpcs+0x38> 80104186: eb d6 jmp 8010415e <getcallerpcs+0x2e> 80104188: 90 nop 80104189: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104190 <pushcli>: // it takes two popcli to undo two pushcli. Also, if interrupts // are off, then pushcli, popcli leaves them off. void pushcli(void) { 80104190: 55 push %ebp 80104191: 89 e5 mov %esp,%ebp 80104193: 53 push %ebx 80104194: 83 ec 04 sub $0x4,%esp 80104197: 9c pushf 80104198: 5b pop %ebx } static inline void cli(void) { asm volatile("cli"); 80104199: fa cli int eflags; eflags = readeflags(); cli(); if(mycpu()->ncli == 0) 8010419a: e8 f1 f4 ff ff call 80103690 <mycpu> 8010419f: 8b 80 a4 00 00 00 mov 0xa4(%eax),%eax 801041a5: 85 c0 test %eax,%eax 801041a7: 75 11 jne 801041ba <pushcli+0x2a> mycpu()->intena = eflags & FL_IF; 801041a9: e8 e2 f4 ff ff call 80103690 <mycpu> 801041ae: 81 e3 00 02 00 00 and $0x200,%ebx 801041b4: 89 98 a8 00 00 00 mov %ebx,0xa8(%eax) mycpu()->ncli += 1; 801041ba: e8 d1 f4 ff ff call 80103690 <mycpu> 801041bf: 83 80 a4 00 00 00 01 addl $0x1,0xa4(%eax) } 801041c6: 83 c4 04 add $0x4,%esp 801041c9: 5b pop %ebx 801041ca: 5d pop %ebp 801041cb: c3 ret 801041cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801041d0 <popcli>: void popcli(void) { 801041d0: 55 push %ebp 801041d1: 89 e5 mov %esp,%ebp 801041d3: 83 ec 18 sub $0x18,%esp static inline uint readeflags(void) { uint eflags; asm volatile("pushfl; popl %0" : "=r" (eflags)); 801041d6: 9c pushf 801041d7: 58 pop %eax if(readeflags()&FL_IF) 801041d8: f6 c4 02 test $0x2,%ah 801041db: 75 49 jne 80104226 <popcli+0x56> panic("popcli - interruptible"); if(--mycpu()->ncli < 0) 801041dd: e8 ae f4 ff ff call 80103690 <mycpu> 801041e2: 8b 90 a4 00 00 00 mov 0xa4(%eax),%edx 801041e8: 83 ea 01 sub $0x1,%edx 801041eb: 85 d2 test %edx,%edx 801041ed: 89 90 a4 00 00 00 mov %edx,0xa4(%eax) 801041f3: 78 25 js 8010421a <popcli+0x4a> panic("popcli"); if(mycpu()->ncli == 0 && mycpu()->intena) 801041f5: e8 96 f4 ff ff call 80103690 <mycpu> 801041fa: 8b 88 a4 00 00 00 mov 0xa4(%eax),%ecx 80104200: 85 c9 test %ecx,%ecx 80104202: 74 04 je 80104208 <popcli+0x38> sti(); } 80104204: c9 leave 80104205: c3 ret 80104206: 66 90 xchg %ax,%ax { if(readeflags()&FL_IF) panic("popcli - interruptible"); if(--mycpu()->ncli < 0) panic("popcli"); if(mycpu()->ncli == 0 && mycpu()->intena) 80104208: e8 83 f4 ff ff call 80103690 <mycpu> 8010420d: 8b 90 a8 00 00 00 mov 0xa8(%eax),%edx 80104213: 85 d2 test %edx,%edx 80104215: 74 ed je 80104204 <popcli+0x34> } static inline void sti(void) { asm volatile("sti"); 80104217: fb sti sti(); } 80104218: c9 leave 80104219: c3 ret popcli(void) { if(readeflags()&FL_IF) panic("popcli - interruptible"); if(--mycpu()->ncli < 0) panic("popcli"); 8010421a: c7 04 24 ca 73 10 80 movl $0x801073ca,(%esp) 80104221: e8 4a c1 ff ff call 80100370 <panic> void popcli(void) { if(readeflags()&FL_IF) panic("popcli - interruptible"); 80104226: c7 04 24 b3 73 10 80 movl $0x801073b3,(%esp) 8010422d: e8 3e c1 ff ff call 80100370 <panic> 80104232: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104239: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104240 <holding>: } // Check whether this cpu is holding the lock. int holding(struct spinlock *lock) { 80104240: 55 push %ebp 80104241: 89 e5 mov %esp,%ebp 80104243: 83 ec 08 sub $0x8,%esp 80104246: 89 75 fc mov %esi,-0x4(%ebp) 80104249: 8b 75 08 mov 0x8(%ebp),%esi 8010424c: 89 5d f8 mov %ebx,-0x8(%ebp) int r; pushcli(); r = lock->locked && lock->cpu == mycpu(); 8010424f: 31 db xor %ebx,%ebx // Check whether this cpu is holding the lock. int holding(struct spinlock *lock) { int r; pushcli(); 80104251: e8 3a ff ff ff call 80104190 <pushcli> r = lock->locked && lock->cpu == mycpu(); 80104256: 8b 06 mov (%esi),%eax 80104258: 85 c0 test %eax,%eax 8010425a: 74 10 je 8010426c <holding+0x2c> 8010425c: 8b 5e 08 mov 0x8(%esi),%ebx 8010425f: e8 2c f4 ff ff call 80103690 <mycpu> 80104264: 39 c3 cmp %eax,%ebx 80104266: 0f 94 c3 sete %bl 80104269: 0f b6 db movzbl %bl,%ebx popcli(); 8010426c: e8 5f ff ff ff call 801041d0 <popcli> return r; } 80104271: 89 d8 mov %ebx,%eax 80104273: 8b 75 fc mov -0x4(%ebp),%esi 80104276: 8b 5d f8 mov -0x8(%ebp),%ebx 80104279: 89 ec mov %ebp,%esp 8010427b: 5d pop %ebp 8010427c: c3 ret 8010427d: 8d 76 00 lea 0x0(%esi),%esi 80104280 <acquire>: // Loops (spins) until the lock is acquired. // Holding a lock for a long time may cause // other CPUs to waste time spinning to acquire it. void acquire(struct spinlock *lk) { 80104280: 55 push %ebp 80104281: 89 e5 mov %esp,%ebp 80104283: 53 push %ebx 80104284: 83 ec 14 sub $0x14,%esp pushcli(); // disable interrupts to avoid deadlock. 80104287: e8 04 ff ff ff call 80104190 <pushcli> if(holding(lk)) 8010428c: 8b 45 08 mov 0x8(%ebp),%eax 8010428f: 89 04 24 mov %eax,(%esp) 80104292: e8 a9 ff ff ff call 80104240 <holding> 80104297: 85 c0 test %eax,%eax 80104299: 75 3c jne 801042d7 <acquire+0x57> xchg(volatile uint *addr, uint newval) { uint result; // The + in "+m" denotes a read-modify-write operand. asm volatile("lock; xchgl %0, %1" : 8010429b: b9 01 00 00 00 mov $0x1,%ecx panic("acquire"); // The xchg is atomic. while(xchg(&lk->locked, 1) != 0) 801042a0: 8b 55 08 mov 0x8(%ebp),%edx 801042a3: 89 c8 mov %ecx,%eax 801042a5: f0 87 02 lock xchg %eax,(%edx) 801042a8: 85 c0 test %eax,%eax 801042aa: 75 f4 jne 801042a0 <acquire+0x20> ; // Tell the C compiler and the processor to not move loads or stores // past this point, to ensure that the critical section's memory // references happen after the lock is acquired. __sync_synchronize(); 801042ac: f0 83 0c 24 00 lock orl $0x0,(%esp) // Record info about lock acquisition for debugging. lk->cpu = mycpu(); 801042b1: 8b 5d 08 mov 0x8(%ebp),%ebx 801042b4: e8 d7 f3 ff ff call 80103690 <mycpu> 801042b9: 89 43 08 mov %eax,0x8(%ebx) getcallerpcs(&lk, lk->pcs); 801042bc: 8b 45 08 mov 0x8(%ebp),%eax 801042bf: 83 c0 0c add $0xc,%eax 801042c2: 89 44 24 04 mov %eax,0x4(%esp) 801042c6: 8d 45 08 lea 0x8(%ebp),%eax 801042c9: 89 04 24 mov %eax,(%esp) 801042cc: e8 5f fe ff ff call 80104130 <getcallerpcs> } 801042d1: 83 c4 14 add $0x14,%esp 801042d4: 5b pop %ebx 801042d5: 5d pop %ebp 801042d6: c3 ret void acquire(struct spinlock *lk) { pushcli(); // disable interrupts to avoid deadlock. if(holding(lk)) panic("acquire"); 801042d7: c7 04 24 d1 73 10 80 movl $0x801073d1,(%esp) 801042de: e8 8d c0 ff ff call 80100370 <panic> 801042e3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801042e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801042f0 <release>: } // Release the lock. void release(struct spinlock *lk) { 801042f0: 55 push %ebp 801042f1: 89 e5 mov %esp,%ebp 801042f3: 53 push %ebx 801042f4: 83 ec 14 sub $0x14,%esp 801042f7: 8b 5d 08 mov 0x8(%ebp),%ebx if(!holding(lk)) 801042fa: 89 1c 24 mov %ebx,(%esp) 801042fd: e8 3e ff ff ff call 80104240 <holding> 80104302: 85 c0 test %eax,%eax 80104304: 74 23 je 80104329 <release+0x39> panic("release"); lk->pcs[0] = 0; 80104306: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) lk->cpu = 0; 8010430d: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) // Tell the C compiler and the processor to not move loads or stores // past this point, to ensure that all the stores in the critical // section are visible to other cores before the lock is released. // Both the C compiler and the hardware may re-order loads and // stores; __sync_synchronize() tells them both not to. __sync_synchronize(); 80104314: f0 83 0c 24 00 lock orl $0x0,(%esp) // Release the lock, equivalent to lk->locked = 0. // This code can't use a C assignment, since it might // not be atomic. A real OS would use C atomics here. asm volatile("movl $0, %0" : "+m" (lk->locked) : ); 80104319: c7 03 00 00 00 00 movl $0x0,(%ebx) popcli(); } 8010431f: 83 c4 14 add $0x14,%esp 80104322: 5b pop %ebx 80104323: 5d pop %ebp // Release the lock, equivalent to lk->locked = 0. // This code can't use a C assignment, since it might // not be atomic. A real OS would use C atomics here. asm volatile("movl $0, %0" : "+m" (lk->locked) : ); popcli(); 80104324: e9 a7 fe ff ff jmp 801041d0 <popcli> // Release the lock. void release(struct spinlock *lk) { if(!holding(lk)) panic("release"); 80104329: c7 04 24 d9 73 10 80 movl $0x801073d9,(%esp) 80104330: e8 3b c0 ff ff call 80100370 <panic> ... 80104340 <memset>: #include "types.h" #include "x86.h" void* memset(void *dst, int c, uint n) { 80104340: 55 push %ebp 80104341: 89 e5 mov %esp,%ebp 80104343: 83 ec 08 sub $0x8,%esp 80104346: 8b 55 08 mov 0x8(%ebp),%edx 80104349: 89 5d f8 mov %ebx,-0x8(%ebp) 8010434c: 8b 45 0c mov 0xc(%ebp),%eax 8010434f: 89 7d fc mov %edi,-0x4(%ebp) 80104352: 8b 4d 10 mov 0x10(%ebp),%ecx if ((int)dst%4 == 0 && n%4 == 0){ 80104355: f6 c2 03 test $0x3,%dl 80104358: 75 05 jne 8010435f <memset+0x1f> 8010435a: f6 c1 03 test $0x3,%cl 8010435d: 74 11 je 80104370 <memset+0x30> } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 8010435f: 89 d7 mov %edx,%edi 80104361: fc cld 80104362: f3 aa rep stos %al,%es:(%edi) c &= 0xFF; stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4); } else stosb(dst, c, n); return dst; } 80104364: 8b 5d f8 mov -0x8(%ebp),%ebx 80104367: 89 d0 mov %edx,%eax 80104369: 8b 7d fc mov -0x4(%ebp),%edi 8010436c: 89 ec mov %ebp,%esp 8010436e: 5d pop %ebp 8010436f: c3 ret void* memset(void *dst, int c, uint n) { if ((int)dst%4 == 0 && n%4 == 0){ c &= 0xFF; 80104370: 0f b6 f8 movzbl %al,%edi stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4); 80104373: 89 f8 mov %edi,%eax 80104375: 89 fb mov %edi,%ebx 80104377: c1 e0 18 shl $0x18,%eax 8010437a: c1 e3 10 shl $0x10,%ebx 8010437d: 09 d8 or %ebx,%eax 8010437f: 09 f8 or %edi,%eax 80104381: c1 e7 08 shl $0x8,%edi 80104384: 09 f8 or %edi,%eax } static inline void stosl(void *addr, int data, int cnt) { asm volatile("cld; rep stosl" : 80104386: 89 d7 mov %edx,%edi 80104388: c1 e9 02 shr $0x2,%ecx 8010438b: fc cld 8010438c: f3 ab rep stos %eax,%es:(%edi) } else stosb(dst, c, n); return dst; } 8010438e: 8b 5d f8 mov -0x8(%ebp),%ebx 80104391: 89 d0 mov %edx,%eax 80104393: 8b 7d fc mov -0x4(%ebp),%edi 80104396: 89 ec mov %ebp,%esp 80104398: 5d pop %ebp 80104399: c3 ret 8010439a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801043a0 <memcmp>: int memcmp(const void *v1, const void *v2, uint n) { 801043a0: 55 push %ebp if(*s1 != *s2) return *s1 - *s2; s1++, s2++; } return 0; 801043a1: 31 c0 xor %eax,%eax return dst; } int memcmp(const void *v1, const void *v2, uint n) { 801043a3: 89 e5 mov %esp,%ebp 801043a5: 57 push %edi 801043a6: 8b 7d 10 mov 0x10(%ebp),%edi 801043a9: 56 push %esi 801043aa: 8b 75 0c mov 0xc(%ebp),%esi 801043ad: 53 push %ebx 801043ae: 8b 5d 08 mov 0x8(%ebp),%ebx const uchar *s1, *s2; s1 = v1; s2 = v2; while(n-- > 0){ 801043b1: 85 ff test %edi,%edi 801043b3: 74 29 je 801043de <memcmp+0x3e> if(*s1 != *s2) 801043b5: 0f b6 03 movzbl (%ebx),%eax { const uchar *s1, *s2; s1 = v1; s2 = v2; while(n-- > 0){ 801043b8: 83 ef 01 sub $0x1,%edi 801043bb: 31 d2 xor %edx,%edx if(*s1 != *s2) 801043bd: 0f b6 0e movzbl (%esi),%ecx 801043c0: 38 c8 cmp %cl,%al 801043c2: 74 14 je 801043d8 <memcmp+0x38> 801043c4: eb 22 jmp 801043e8 <memcmp+0x48> 801043c6: 66 90 xchg %ax,%ax 801043c8: 0f b6 44 13 01 movzbl 0x1(%ebx,%edx,1),%eax 801043cd: 83 c2 01 add $0x1,%edx 801043d0: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 801043d4: 38 c8 cmp %cl,%al 801043d6: 75 10 jne 801043e8 <memcmp+0x48> { const uchar *s1, *s2; s1 = v1; s2 = v2; while(n-- > 0){ 801043d8: 39 d7 cmp %edx,%edi 801043da: 75 ec jne 801043c8 <memcmp+0x28> if(*s1 != *s2) return *s1 - *s2; s1++, s2++; } return 0; 801043dc: 31 c0 xor %eax,%eax } 801043de: 5b pop %ebx 801043df: 5e pop %esi 801043e0: 5f pop %edi 801043e1: 5d pop %ebp 801043e2: c3 ret 801043e3: 90 nop 801043e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi s1 = v1; s2 = v2; while(n-- > 0){ if(*s1 != *s2) return *s1 - *s2; 801043e8: 0f b6 c0 movzbl %al,%eax 801043eb: 0f b6 c9 movzbl %cl,%ecx s1++, s2++; } return 0; } 801043ee: 5b pop %ebx s1 = v1; s2 = v2; while(n-- > 0){ if(*s1 != *s2) return *s1 - *s2; 801043ef: 29 c8 sub %ecx,%eax s1++, s2++; } return 0; } 801043f1: 5e pop %esi 801043f2: 5f pop %edi 801043f3: 5d pop %ebp 801043f4: c3 ret 801043f5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801043f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104400 <memmove>: void* memmove(void *dst, const void *src, uint n) { 80104400: 55 push %ebp 80104401: 89 e5 mov %esp,%ebp 80104403: 57 push %edi 80104404: 8b 45 08 mov 0x8(%ebp),%eax 80104407: 56 push %esi 80104408: 8b 75 0c mov 0xc(%ebp),%esi 8010440b: 53 push %ebx 8010440c: 8b 5d 10 mov 0x10(%ebp),%ebx const char *s; char *d; s = src; d = dst; if(s < d && s + n > d){ 8010440f: 39 c6 cmp %eax,%esi 80104411: 73 35 jae 80104448 <memmove+0x48> 80104413: 8d 0c 1e lea (%esi,%ebx,1),%ecx 80104416: 39 c8 cmp %ecx,%eax 80104418: 73 2e jae 80104448 <memmove+0x48> s += n; d += n; while(n-- > 0) 8010441a: 85 db test %ebx,%ebx 8010441c: 74 20 je 8010443e <memmove+0x3e> s = src; d = dst; if(s < d && s + n > d){ s += n; d += n; 8010441e: 8d 3c 18 lea (%eax,%ebx,1),%edi 80104421: 89 da mov %ebx,%edx return 0; } void* memmove(void *dst, const void *src, uint n) 80104423: f7 db neg %ebx 80104425: 8d 34 19 lea (%ecx,%ebx,1),%esi 80104428: 01 fb add %edi,%ebx 8010442a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi d = dst; if(s < d && s + n > d){ s += n; d += n; while(n-- > 0) *--d = *--s; 80104430: 0f b6 4c 16 ff movzbl -0x1(%esi,%edx,1),%ecx 80104435: 88 4c 13 ff mov %cl,-0x1(%ebx,%edx,1) s = src; d = dst; if(s < d && s + n > d){ s += n; d += n; while(n-- > 0) 80104439: 83 ea 01 sub $0x1,%edx 8010443c: 75 f2 jne 80104430 <memmove+0x30> } else while(n-- > 0) *d++ = *s++; return dst; } 8010443e: 5b pop %ebx 8010443f: 5e pop %esi 80104440: 5f pop %edi 80104441: 5d pop %ebp 80104442: c3 ret 80104443: 90 nop 80104444: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi s += n; d += n; while(n-- > 0) *--d = *--s; } else while(n-- > 0) 80104448: 31 d2 xor %edx,%edx 8010444a: 85 db test %ebx,%ebx 8010444c: 74 f0 je 8010443e <memmove+0x3e> 8010444e: 66 90 xchg %ax,%ax *d++ = *s++; 80104450: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 80104454: 88 0c 10 mov %cl,(%eax,%edx,1) 80104457: 83 c2 01 add $0x1,%edx s += n; d += n; while(n-- > 0) *--d = *--s; } else while(n-- > 0) 8010445a: 39 d3 cmp %edx,%ebx 8010445c: 75 f2 jne 80104450 <memmove+0x50> *d++ = *s++; return dst; } 8010445e: 5b pop %ebx 8010445f: 5e pop %esi 80104460: 5f pop %edi 80104461: 5d pop %ebp 80104462: c3 ret 80104463: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104469: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104470 <memcpy>: // memcpy exists to placate GCC. Use memmove. void* memcpy(void *dst, const void *src, uint n) { 80104470: 55 push %ebp 80104471: 89 e5 mov %esp,%ebp return memmove(dst, src, n); } 80104473: 5d pop %ebp // memcpy exists to placate GCC. Use memmove. void* memcpy(void *dst, const void *src, uint n) { return memmove(dst, src, n); 80104474: e9 87 ff ff ff jmp 80104400 <memmove> 80104479: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104480 <strncmp>: } int strncmp(const char *p, const char *q, uint n) { 80104480: 55 push %ebp while(n > 0 && *p && *p == *q) n--, p++, q++; if(n == 0) return 0; 80104481: 31 c0 xor %eax,%eax return memmove(dst, src, n); } int strncmp(const char *p, const char *q, uint n) { 80104483: 89 e5 mov %esp,%ebp while(n > 0 && *p && *p == *q) 80104485: 8b 55 10 mov 0x10(%ebp),%edx return memmove(dst, src, n); } int strncmp(const char *p, const char *q, uint n) { 80104488: 57 push %edi 80104489: 8b 4d 08 mov 0x8(%ebp),%ecx 8010448c: 56 push %esi 8010448d: 53 push %ebx 8010448e: 8b 5d 0c mov 0xc(%ebp),%ebx while(n > 0 && *p && *p == *q) 80104491: 85 d2 test %edx,%edx 80104493: 74 34 je 801044c9 <strncmp+0x49> 80104495: 0f b6 01 movzbl (%ecx),%eax 80104498: 0f b6 33 movzbl (%ebx),%esi 8010449b: 84 c0 test %al,%al 8010449d: 74 31 je 801044d0 <strncmp+0x50> 8010449f: 89 f2 mov %esi,%edx 801044a1: 38 d0 cmp %dl,%al 801044a3: 74 1c je 801044c1 <strncmp+0x41> 801044a5: eb 29 jmp 801044d0 <strncmp+0x50> 801044a7: 90 nop n--, p++, q++; 801044a8: 83 c1 01 add $0x1,%ecx } int strncmp(const char *p, const char *q, uint n) { while(n > 0 && *p && *p == *q) 801044ab: 0f b6 73 01 movzbl 0x1(%ebx),%esi 801044af: 0f b6 01 movzbl (%ecx),%eax n--, p++, q++; 801044b2: 8d 7b 01 lea 0x1(%ebx),%edi } int strncmp(const char *p, const char *q, uint n) { while(n > 0 && *p && *p == *q) 801044b5: 84 c0 test %al,%al 801044b7: 74 17 je 801044d0 <strncmp+0x50> 801044b9: 89 f2 mov %esi,%edx 801044bb: 38 d0 cmp %dl,%al 801044bd: 75 11 jne 801044d0 <strncmp+0x50> n--, p++, q++; 801044bf: 89 fb mov %edi,%ebx } int strncmp(const char *p, const char *q, uint n) { while(n > 0 && *p && *p == *q) 801044c1: 83 6d 10 01 subl $0x1,0x10(%ebp) 801044c5: 75 e1 jne 801044a8 <strncmp+0x28> n--, p++, q++; if(n == 0) return 0; 801044c7: 31 c0 xor %eax,%eax return (uchar)*p - (uchar)*q; } 801044c9: 5b pop %ebx 801044ca: 5e pop %esi 801044cb: 5f pop %edi 801044cc: 5d pop %ebp 801044cd: c3 ret 801044ce: 66 90 xchg %ax,%ax { while(n > 0 && *p && *p == *q) n--, p++, q++; if(n == 0) return 0; return (uchar)*p - (uchar)*q; 801044d0: 81 e6 ff 00 00 00 and $0xff,%esi 801044d6: 0f b6 c0 movzbl %al,%eax } 801044d9: 5b pop %ebx { while(n > 0 && *p && *p == *q) n--, p++, q++; if(n == 0) return 0; return (uchar)*p - (uchar)*q; 801044da: 29 f0 sub %esi,%eax } 801044dc: 5e pop %esi 801044dd: 5f pop %edi 801044de: 5d pop %ebp 801044df: c3 ret 801044e0 <strncpy>: char* strncpy(char *s, const char *t, int n) { 801044e0: 55 push %ebp 801044e1: 89 e5 mov %esp,%ebp 801044e3: 57 push %edi 801044e4: 8b 7d 08 mov 0x8(%ebp),%edi 801044e7: 56 push %esi 801044e8: 8b 4d 10 mov 0x10(%ebp),%ecx 801044eb: 53 push %ebx 801044ec: 8b 5d 0c mov 0xc(%ebp),%ebx char *os; os = s; while(n-- > 0 && (*s++ = *t++) != 0) 801044ef: 89 fa mov %edi,%edx 801044f1: eb 14 jmp 80104507 <strncpy+0x27> 801044f3: 90 nop 801044f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801044f8: 0f b6 03 movzbl (%ebx),%eax 801044fb: 83 c3 01 add $0x1,%ebx 801044fe: 88 02 mov %al,(%edx) 80104500: 83 c2 01 add $0x1,%edx 80104503: 84 c0 test %al,%al 80104505: 74 0a je 80104511 <strncpy+0x31> 80104507: 83 e9 01 sub $0x1,%ecx return 0; return (uchar)*p - (uchar)*q; } char* strncpy(char *s, const char *t, int n) 8010450a: 8d 71 01 lea 0x1(%ecx),%esi { char *os; os = s; while(n-- > 0 && (*s++ = *t++) != 0) 8010450d: 85 f6 test %esi,%esi 8010450f: 7f e7 jg 801044f8 <strncpy+0x18> ; while(n-- > 0) 80104511: 85 c9 test %ecx,%ecx return 0; return (uchar)*p - (uchar)*q; } char* strncpy(char *s, const char *t, int n) 80104513: 8d 04 0a lea (%edx,%ecx,1),%eax char *os; os = s; while(n-- > 0 && (*s++ = *t++) != 0) ; while(n-- > 0) 80104516: 7e 0a jle 80104522 <strncpy+0x42> *s++ = 0; 80104518: c6 02 00 movb $0x0,(%edx) 8010451b: 83 c2 01 add $0x1,%edx char *os; os = s; while(n-- > 0 && (*s++ = *t++) != 0) ; while(n-- > 0) 8010451e: 39 c2 cmp %eax,%edx 80104520: 75 f6 jne 80104518 <strncpy+0x38> *s++ = 0; return os; } 80104522: 5b pop %ebx 80104523: 89 f8 mov %edi,%eax 80104525: 5e pop %esi 80104526: 5f pop %edi 80104527: 5d pop %ebp 80104528: c3 ret 80104529: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104530 <safestrcpy>: // Like strncpy but guaranteed to NUL-terminate. char* safestrcpy(char *s, const char *t, int n) { 80104530: 55 push %ebp 80104531: 89 e5 mov %esp,%ebp 80104533: 8b 55 10 mov 0x10(%ebp),%edx 80104536: 56 push %esi 80104537: 8b 75 08 mov 0x8(%ebp),%esi 8010453a: 53 push %ebx 8010453b: 8b 5d 0c mov 0xc(%ebp),%ebx char *os; os = s; if(n <= 0) 8010453e: 85 d2 test %edx,%edx 80104540: 7e 1d jle 8010455f <safestrcpy+0x2f> 80104542: 89 f1 mov %esi,%ecx 80104544: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi return os; while(--n > 0 && (*s++ = *t++) != 0) 80104548: 83 ea 01 sub $0x1,%edx 8010454b: 74 0f je 8010455c <safestrcpy+0x2c> 8010454d: 0f b6 03 movzbl (%ebx),%eax 80104550: 83 c3 01 add $0x1,%ebx 80104553: 88 01 mov %al,(%ecx) 80104555: 83 c1 01 add $0x1,%ecx 80104558: 84 c0 test %al,%al 8010455a: 75 ec jne 80104548 <safestrcpy+0x18> ; *s = 0; 8010455c: c6 01 00 movb $0x0,(%ecx) return os; } 8010455f: 89 f0 mov %esi,%eax 80104561: 5b pop %ebx 80104562: 5e pop %esi 80104563: 5d pop %ebp 80104564: c3 ret 80104565: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104569: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104570 <strlen>: int strlen(const char *s) { 80104570: 55 push %ebp int n; for(n = 0; s[n]; n++) 80104571: 31 c0 xor %eax,%eax return os; } int strlen(const char *s) { 80104573: 89 e5 mov %esp,%ebp 80104575: 8b 55 08 mov 0x8(%ebp),%edx int n; for(n = 0; s[n]; n++) 80104578: 80 3a 00 cmpb $0x0,(%edx) 8010457b: 74 0c je 80104589 <strlen+0x19> 8010457d: 8d 76 00 lea 0x0(%esi),%esi 80104580: 83 c0 01 add $0x1,%eax 80104583: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) 80104587: 75 f7 jne 80104580 <strlen+0x10> ; return n; } 80104589: 5d pop %ebp 8010458a: c3 ret ... 8010458c <swtch>: # a struct context, and save its address in *old. # Switch stacks to new and pop previously-saved registers. .globl swtch swtch: movl 4(%esp), %eax 8010458c: 8b 44 24 04 mov 0x4(%esp),%eax movl 8(%esp), %edx 80104590: 8b 54 24 08 mov 0x8(%esp),%edx # Save old callee-saved registers pushl %ebp 80104594: 55 push %ebp pushl %ebx 80104595: 53 push %ebx pushl %esi 80104596: 56 push %esi pushl %edi 80104597: 57 push %edi # Switch stacks movl %esp, (%eax) 80104598: 89 20 mov %esp,(%eax) movl %edx, %esp 8010459a: 89 d4 mov %edx,%esp # Load new callee-saved registers popl %edi 8010459c: 5f pop %edi popl %esi 8010459d: 5e pop %esi popl %ebx 8010459e: 5b pop %ebx popl %ebp 8010459f: 5d pop %ebp ret 801045a0: c3 ret ... 801045b0 <fetchint>: // to a saved program counter, and then the first argument. // Fetch the int at addr from the current process. int fetchint(uint addr, int *ip) { 801045b0: 55 push %ebp 801045b1: 89 e5 mov %esp,%ebp 801045b3: 53 push %ebx 801045b4: 83 ec 04 sub $0x4,%esp 801045b7: 8b 5d 08 mov 0x8(%ebp),%ebx struct proc *curproc = myproc(); 801045ba: e8 71 f1 ff ff call 80103730 <myproc> if(addr >= curproc->sz || addr+4 > curproc->sz) 801045bf: 8b 10 mov (%eax),%edx return -1; 801045c1: b8 ff ff ff ff mov $0xffffffff,%eax int fetchint(uint addr, int *ip) { struct proc *curproc = myproc(); if(addr >= curproc->sz || addr+4 > curproc->sz) 801045c6: 39 da cmp %ebx,%edx 801045c8: 76 10 jbe 801045da <fetchint+0x2a> 801045ca: 8d 4b 04 lea 0x4(%ebx),%ecx 801045cd: 39 ca cmp %ecx,%edx 801045cf: 72 09 jb 801045da <fetchint+0x2a> return -1; *ip = *(int*)(addr); 801045d1: 8b 45 0c mov 0xc(%ebp),%eax 801045d4: 8b 13 mov (%ebx),%edx 801045d6: 89 10 mov %edx,(%eax) return 0; 801045d8: 31 c0 xor %eax,%eax } 801045da: 83 c4 04 add $0x4,%esp 801045dd: 5b pop %ebx 801045de: 5d pop %ebp 801045df: c3 ret 801045e0 <fetchstr>: // Fetch the nul-terminated string at addr from the current process. // Doesn't actually copy the string - just sets *pp to point at it. // Returns length of string, not including nul. int fetchstr(uint addr, char **pp) { 801045e0: 55 push %ebp 801045e1: 89 e5 mov %esp,%ebp 801045e3: 53 push %ebx 801045e4: 83 ec 04 sub $0x4,%esp 801045e7: 8b 5d 08 mov 0x8(%ebp),%ebx char *s, *ep; struct proc *curproc = myproc(); 801045ea: e8 41 f1 ff ff call 80103730 <myproc> if(addr >= curproc->sz) return -1; 801045ef: b9 ff ff ff ff mov $0xffffffff,%ecx fetchstr(uint addr, char **pp) { char *s, *ep; struct proc *curproc = myproc(); if(addr >= curproc->sz) 801045f4: 39 18 cmp %ebx,(%eax) 801045f6: 76 29 jbe 80104621 <fetchstr+0x41> return -1; *pp = (char*)addr; 801045f8: 8b 55 0c mov 0xc(%ebp),%edx 801045fb: 89 1a mov %ebx,(%edx) ep = (char*)curproc->sz; 801045fd: 8b 10 mov (%eax),%edx for(s = *pp; s < ep; s++){ 801045ff: 39 d3 cmp %edx,%ebx 80104601: 73 1e jae 80104621 <fetchstr+0x41> if(*s == 0) 80104603: 31 c9 xor %ecx,%ecx 80104605: 89 d8 mov %ebx,%eax 80104607: 80 3b 00 cmpb $0x0,(%ebx) 8010460a: 75 09 jne 80104615 <fetchstr+0x35> 8010460c: eb 13 jmp 80104621 <fetchstr+0x41> 8010460e: 66 90 xchg %ax,%ax 80104610: 80 38 00 cmpb $0x0,(%eax) 80104613: 74 1b je 80104630 <fetchstr+0x50> if(addr >= curproc->sz) return -1; *pp = (char*)addr; ep = (char*)curproc->sz; for(s = *pp; s < ep; s++){ 80104615: 83 c0 01 add $0x1,%eax 80104618: 39 c2 cmp %eax,%edx 8010461a: 77 f4 ja 80104610 <fetchstr+0x30> if(*s == 0) return s - *pp; } return -1; 8010461c: b9 ff ff ff ff mov $0xffffffff,%ecx } 80104621: 83 c4 04 add $0x4,%esp 80104624: 89 c8 mov %ecx,%eax 80104626: 5b pop %ebx 80104627: 5d pop %ebp 80104628: c3 ret 80104629: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(addr >= curproc->sz) return -1; *pp = (char*)addr; ep = (char*)curproc->sz; for(s = *pp; s < ep; s++){ if(*s == 0) 80104630: 89 c1 mov %eax,%ecx return s - *pp; } return -1; } 80104632: 83 c4 04 add $0x4,%esp if(addr >= curproc->sz) return -1; *pp = (char*)addr; ep = (char*)curproc->sz; for(s = *pp; s < ep; s++){ if(*s == 0) 80104635: 29 d9 sub %ebx,%ecx return s - *pp; } return -1; } 80104637: 89 c8 mov %ecx,%eax 80104639: 5b pop %ebx 8010463a: 5d pop %ebp 8010463b: c3 ret 8010463c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104640 <argint>: // Fetch the nth 32-bit system call argument. int argint(int n, int *ip) { 80104640: 55 push %ebp 80104641: 89 e5 mov %esp,%ebp 80104643: 83 ec 08 sub $0x8,%esp 80104646: 89 5d f8 mov %ebx,-0x8(%ebp) 80104649: 8b 5d 08 mov 0x8(%ebp),%ebx 8010464c: 89 75 fc mov %esi,-0x4(%ebp) 8010464f: 8b 75 0c mov 0xc(%ebp),%esi return fetchint((myproc()->tf->esp) + 4 + 4*n, ip); 80104652: e8 d9 f0 ff ff call 80103730 <myproc> 80104657: 89 75 0c mov %esi,0xc(%ebp) } 8010465a: 8b 75 fc mov -0x4(%ebp),%esi // Fetch the nth 32-bit system call argument. int argint(int n, int *ip) { return fetchint((myproc()->tf->esp) + 4 + 4*n, ip); 8010465d: 8b 40 18 mov 0x18(%eax),%eax 80104660: 8b 40 44 mov 0x44(%eax),%eax 80104663: 8d 44 98 04 lea 0x4(%eax,%ebx,4),%eax } 80104667: 8b 5d f8 mov -0x8(%ebp),%ebx // Fetch the nth 32-bit system call argument. int argint(int n, int *ip) { return fetchint((myproc()->tf->esp) + 4 + 4*n, ip); 8010466a: 89 45 08 mov %eax,0x8(%ebp) } 8010466d: 89 ec mov %ebp,%esp 8010466f: 5d pop %ebp // Fetch the nth 32-bit system call argument. int argint(int n, int *ip) { return fetchint((myproc()->tf->esp) + 4 + 4*n, ip); 80104670: e9 3b ff ff ff jmp 801045b0 <fetchint> 80104675: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104679: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104680 <argptr>: // Fetch the nth word-sized system call argument as a pointer // to a block of memory of size bytes. Check that the pointer // lies within the process address space. int argptr(int n, char **pp, int size) { 80104680: 55 push %ebp 80104681: 89 e5 mov %esp,%ebp 80104683: 56 push %esi 80104684: 53 push %ebx 80104685: 83 ec 20 sub $0x20,%esp 80104688: 8b 5d 10 mov 0x10(%ebp),%ebx int i; struct proc *curproc = myproc(); 8010468b: e8 a0 f0 ff ff call 80103730 <myproc> 80104690: 89 c6 mov %eax,%esi if(argint(n, &i) < 0) 80104692: 8d 45 f4 lea -0xc(%ebp),%eax 80104695: 89 44 24 04 mov %eax,0x4(%esp) 80104699: 8b 45 08 mov 0x8(%ebp),%eax 8010469c: 89 04 24 mov %eax,(%esp) 8010469f: e8 9c ff ff ff call 80104640 <argint> 801046a4: 85 c0 test %eax,%eax 801046a6: 78 28 js 801046d0 <argptr+0x50> return -1; if(size < 0 || (uint)i >= curproc->sz || (uint)i+size > curproc->sz) 801046a8: 85 db test %ebx,%ebx 801046aa: 78 24 js 801046d0 <argptr+0x50> 801046ac: 8b 55 f4 mov -0xc(%ebp),%edx return -1; 801046af: b8 ff ff ff ff mov $0xffffffff,%eax int i; struct proc *curproc = myproc(); if(argint(n, &i) < 0) return -1; if(size < 0 || (uint)i >= curproc->sz || (uint)i+size > curproc->sz) 801046b4: 8b 0e mov (%esi),%ecx 801046b6: 39 ca cmp %ecx,%edx 801046b8: 73 0d jae 801046c7 <argptr+0x47> 801046ba: 01 d3 add %edx,%ebx 801046bc: 39 d9 cmp %ebx,%ecx 801046be: 72 07 jb 801046c7 <argptr+0x47> return -1; *pp = (char*)i; 801046c0: 8b 45 0c mov 0xc(%ebp),%eax 801046c3: 89 10 mov %edx,(%eax) return 0; 801046c5: 31 c0 xor %eax,%eax } 801046c7: 83 c4 20 add $0x20,%esp 801046ca: 5b pop %ebx 801046cb: 5e pop %esi 801046cc: 5d pop %ebp 801046cd: c3 ret 801046ce: 66 90 xchg %ax,%ax struct proc *curproc = myproc(); if(argint(n, &i) < 0) return -1; if(size < 0 || (uint)i >= curproc->sz || (uint)i+size > curproc->sz) return -1; 801046d0: b8 ff ff ff ff mov $0xffffffff,%eax 801046d5: eb f0 jmp 801046c7 <argptr+0x47> 801046d7: 89 f6 mov %esi,%esi 801046d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801046e0 <argstr>: // Check that the pointer is valid and the string is nul-terminated. // (There is no shared writable memory, so the string can't change // between this check and being used by the kernel.) int argstr(int n, char **pp) { 801046e0: 55 push %ebp 801046e1: 89 e5 mov %esp,%ebp 801046e3: 83 ec 28 sub $0x28,%esp int addr; if(argint(n, &addr) < 0) 801046e6: 8d 45 f4 lea -0xc(%ebp),%eax 801046e9: 89 44 24 04 mov %eax,0x4(%esp) 801046ed: 8b 45 08 mov 0x8(%ebp),%eax 801046f0: 89 04 24 mov %eax,(%esp) 801046f3: e8 48 ff ff ff call 80104640 <argint> 801046f8: 89 c2 mov %eax,%edx return -1; 801046fa: b8 ff ff ff ff mov $0xffffffff,%eax // between this check and being used by the kernel.) int argstr(int n, char **pp) { int addr; if(argint(n, &addr) < 0) 801046ff: 85 d2 test %edx,%edx 80104701: 78 12 js 80104715 <argstr+0x35> return -1; return fetchstr(addr, pp); 80104703: 8b 45 0c mov 0xc(%ebp),%eax 80104706: 89 44 24 04 mov %eax,0x4(%esp) 8010470a: 8b 45 f4 mov -0xc(%ebp),%eax 8010470d: 89 04 24 mov %eax,(%esp) 80104710: e8 cb fe ff ff call 801045e0 <fetchstr> } 80104715: c9 leave 80104716: c3 ret 80104717: 89 f6 mov %esi,%esi 80104719: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104720 <syscall>: [SYS_close] sys_close, }; void syscall(void) { 80104720: 55 push %ebp 80104721: 89 e5 mov %esp,%ebp 80104723: 83 ec 18 sub $0x18,%esp 80104726: 89 5d f8 mov %ebx,-0x8(%ebp) 80104729: 89 75 fc mov %esi,-0x4(%ebp) int num; struct proc *curproc = myproc(); 8010472c: e8 ff ef ff ff call 80103730 <myproc> num = curproc->tf->eax; 80104731: 8b 58 18 mov 0x18(%eax),%ebx void syscall(void) { int num; struct proc *curproc = myproc(); 80104734: 89 c6 mov %eax,%esi num = curproc->tf->eax; 80104736: 8b 43 1c mov 0x1c(%ebx),%eax if(num > 0 && num < NELEM(syscalls) && syscalls[num]) { 80104739: 8d 50 ff lea -0x1(%eax),%edx 8010473c: 83 fa 14 cmp $0x14,%edx 8010473f: 77 1f ja 80104760 <syscall+0x40> 80104741: 8b 14 85 00 74 10 80 mov -0x7fef8c00(,%eax,4),%edx 80104748: 85 d2 test %edx,%edx 8010474a: 74 14 je 80104760 <syscall+0x40> curproc->tf->eax = syscalls[num](); 8010474c: ff d2 call *%edx 8010474e: 89 43 1c mov %eax,0x1c(%ebx) } else { cprintf("%d %s: unknown sys call %d\n", curproc->pid, curproc->name, num); curproc->tf->eax = -1; } } 80104751: 8b 5d f8 mov -0x8(%ebp),%ebx 80104754: 8b 75 fc mov -0x4(%ebp),%esi 80104757: 89 ec mov %ebp,%esp 80104759: 5d pop %ebp 8010475a: c3 ret 8010475b: 90 nop 8010475c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi num = curproc->tf->eax; if(num > 0 && num < NELEM(syscalls) && syscalls[num]) { curproc->tf->eax = syscalls[num](); } else { cprintf("%d %s: unknown sys call %d\n", 80104760: 89 44 24 0c mov %eax,0xc(%esp) curproc->pid, curproc->name, num); 80104764: 8d 46 6c lea 0x6c(%esi),%eax 80104767: 89 44 24 08 mov %eax,0x8(%esp) num = curproc->tf->eax; if(num > 0 && num < NELEM(syscalls) && syscalls[num]) { curproc->tf->eax = syscalls[num](); } else { cprintf("%d %s: unknown sys call %d\n", 8010476b: 8b 46 10 mov 0x10(%esi),%eax 8010476e: c7 04 24 e1 73 10 80 movl $0x801073e1,(%esp) 80104775: 89 44 24 04 mov %eax,0x4(%esp) 80104779: e8 d2 be ff ff call 80100650 <cprintf> curproc->pid, curproc->name, num); curproc->tf->eax = -1; 8010477e: 8b 46 18 mov 0x18(%esi),%eax 80104781: c7 40 1c ff ff ff ff movl $0xffffffff,0x1c(%eax) } } 80104788: 8b 5d f8 mov -0x8(%ebp),%ebx 8010478b: 8b 75 fc mov -0x4(%ebp),%esi 8010478e: 89 ec mov %ebp,%esp 80104790: 5d pop %ebp 80104791: c3 ret ... 801047a0 <fdalloc>: // Allocate a file descriptor for the given file. // Takes over file reference from caller on success. static int fdalloc(struct file *f) { 801047a0: 55 push %ebp 801047a1: 89 e5 mov %esp,%ebp 801047a3: 53 push %ebx 801047a4: 89 c3 mov %eax,%ebx 801047a6: 83 ec 04 sub $0x4,%esp int fd; struct proc *curproc = myproc(); 801047a9: e8 82 ef ff ff call 80103730 <myproc> for(fd = 0; fd < NOFILE; fd++){ 801047ae: 31 d2 xor %edx,%edx if(curproc->ofile[fd] == 0){ 801047b0: 8b 4c 90 28 mov 0x28(%eax,%edx,4),%ecx 801047b4: 85 c9 test %ecx,%ecx 801047b6: 74 18 je 801047d0 <fdalloc+0x30> fdalloc(struct file *f) { int fd; struct proc *curproc = myproc(); for(fd = 0; fd < NOFILE; fd++){ 801047b8: 83 c2 01 add $0x1,%edx 801047bb: 83 fa 10 cmp $0x10,%edx 801047be: 75 f0 jne 801047b0 <fdalloc+0x10> curproc->ofile[fd] = f; return fd; } } return -1; } 801047c0: 83 c4 04 add $0x4,%esp if(curproc->ofile[fd] == 0){ curproc->ofile[fd] = f; return fd; } } return -1; 801047c3: ba ff ff ff ff mov $0xffffffff,%edx } 801047c8: 89 d0 mov %edx,%eax 801047ca: 5b pop %ebx 801047cb: 5d pop %ebp 801047cc: c3 ret 801047cd: 8d 76 00 lea 0x0(%esi),%esi int fd; struct proc *curproc = myproc(); for(fd = 0; fd < NOFILE; fd++){ if(curproc->ofile[fd] == 0){ curproc->ofile[fd] = f; 801047d0: 89 5c 90 28 mov %ebx,0x28(%eax,%edx,4) return fd; } } return -1; } 801047d4: 83 c4 04 add $0x4,%esp 801047d7: 89 d0 mov %edx,%eax 801047d9: 5b pop %ebx 801047da: 5d pop %ebp 801047db: c3 ret 801047dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801047e0 <create>: return -1; } static struct inode* create(char *path, short type, short major, short minor) { 801047e0: 55 push %ebp 801047e1: 89 e5 mov %esp,%ebp 801047e3: 83 ec 48 sub $0x48,%esp 801047e6: 89 4d d4 mov %ecx,-0x2c(%ebp) 801047e9: 8b 4d 08 mov 0x8(%ebp),%ecx 801047ec: 89 75 f8 mov %esi,-0x8(%ebp) struct inode *ip, *dp; char name[DIRSIZ]; if((dp = nameiparent(path, name)) == 0) 801047ef: 8d 75 da lea -0x26(%ebp),%esi return -1; } static struct inode* create(char *path, short type, short major, short minor) { 801047f2: 89 7d fc mov %edi,-0x4(%ebp) 801047f5: 89 d7 mov %edx,%edi 801047f7: 89 5d f4 mov %ebx,-0xc(%ebp) 801047fa: 89 4d d0 mov %ecx,-0x30(%ebp) struct inode *ip, *dp; char name[DIRSIZ]; if((dp = nameiparent(path, name)) == 0) 801047fd: 89 74 24 04 mov %esi,0x4(%esp) 80104801: 89 04 24 mov %eax,(%esp) 80104804: e8 87 d7 ff ff call 80101f90 <nameiparent> 80104809: 85 c0 test %eax,%eax 8010480b: 0f 84 ff 00 00 00 je 80104910 <create+0x130> return 0; ilock(dp); 80104811: 89 04 24 mov %eax,(%esp) 80104814: 89 45 cc mov %eax,-0x34(%ebp) 80104817: e8 84 ce ff ff call 801016a0 <ilock> if((ip = dirlookup(dp, name, 0)) != 0){ 8010481c: 8b 55 cc mov -0x34(%ebp),%edx 8010481f: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 80104826: 00 80104827: 89 74 24 04 mov %esi,0x4(%esp) 8010482b: 89 14 24 mov %edx,(%esp) 8010482e: e8 fd d3 ff ff call 80101c30 <dirlookup> 80104833: 8b 55 cc mov -0x34(%ebp),%edx 80104836: 85 c0 test %eax,%eax 80104838: 89 c3 mov %eax,%ebx 8010483a: 74 4c je 80104888 <create+0xa8> iunlockput(dp); 8010483c: 89 14 24 mov %edx,(%esp) 8010483f: e8 ec d0 ff ff call 80101930 <iunlockput> ilock(ip); 80104844: 89 1c 24 mov %ebx,(%esp) 80104847: e8 54 ce ff ff call 801016a0 <ilock> if(type == T_FILE && ip->type == T_FILE) 8010484c: 66 83 ff 02 cmp $0x2,%di 80104850: 75 16 jne 80104868 <create+0x88> 80104852: 66 83 7b 50 02 cmpw $0x2,0x50(%ebx) 80104857: 75 0f jne 80104868 <create+0x88> panic("create: dirlink"); iunlockput(dp); return ip; } 80104859: 89 d8 mov %ebx,%eax 8010485b: 8b 75 f8 mov -0x8(%ebp),%esi 8010485e: 8b 5d f4 mov -0xc(%ebp),%ebx 80104861: 8b 7d fc mov -0x4(%ebp),%edi 80104864: 89 ec mov %ebp,%esp 80104866: 5d pop %ebp 80104867: c3 ret if((ip = dirlookup(dp, name, 0)) != 0){ iunlockput(dp); ilock(ip); if(type == T_FILE && ip->type == T_FILE) return ip; iunlockput(ip); 80104868: 89 1c 24 mov %ebx,(%esp) return 0; 8010486b: 31 db xor %ebx,%ebx if((ip = dirlookup(dp, name, 0)) != 0){ iunlockput(dp); ilock(ip); if(type == T_FILE && ip->type == T_FILE) return ip; iunlockput(ip); 8010486d: e8 be d0 ff ff call 80101930 <iunlockput> panic("create: dirlink"); iunlockput(dp); return ip; } 80104872: 89 d8 mov %ebx,%eax 80104874: 8b 75 f8 mov -0x8(%ebp),%esi 80104877: 8b 5d f4 mov -0xc(%ebp),%ebx 8010487a: 8b 7d fc mov -0x4(%ebp),%edi 8010487d: 89 ec mov %ebp,%esp 8010487f: 5d pop %ebp 80104880: c3 ret 80104881: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi return ip; iunlockput(ip); return 0; } if((ip = ialloc(dp->dev, type)) == 0) 80104888: 0f bf c7 movswl %di,%eax 8010488b: 89 44 24 04 mov %eax,0x4(%esp) 8010488f: 8b 02 mov (%edx),%eax 80104891: 89 55 cc mov %edx,-0x34(%ebp) 80104894: 89 04 24 mov %eax,(%esp) 80104897: e8 74 cc ff ff call 80101510 <ialloc> 8010489c: 8b 55 cc mov -0x34(%ebp),%edx 8010489f: 85 c0 test %eax,%eax 801048a1: 89 c3 mov %eax,%ebx 801048a3: 0f 84 d7 00 00 00 je 80104980 <create+0x1a0> panic("create: ialloc"); ilock(ip); 801048a9: 89 55 cc mov %edx,-0x34(%ebp) 801048ac: 89 04 24 mov %eax,(%esp) 801048af: e8 ec cd ff ff call 801016a0 <ilock> ip->major = major; 801048b4: 0f b7 45 d4 movzwl -0x2c(%ebp),%eax ip->minor = minor; 801048b8: 0f b7 4d d0 movzwl -0x30(%ebp),%ecx ip->nlink = 1; 801048bc: 66 c7 43 56 01 00 movw $0x1,0x56(%ebx) if((ip = ialloc(dp->dev, type)) == 0) panic("create: ialloc"); ilock(ip); ip->major = major; 801048c2: 66 89 43 52 mov %ax,0x52(%ebx) ip->minor = minor; 801048c6: 66 89 4b 54 mov %cx,0x54(%ebx) ip->nlink = 1; iupdate(ip); 801048ca: 89 1c 24 mov %ebx,(%esp) 801048cd: e8 0e cd ff ff call 801015e0 <iupdate> if(type == T_DIR){ // Create . and .. entries. 801048d2: 66 83 ff 01 cmp $0x1,%di 801048d6: 8b 55 cc mov -0x34(%ebp),%edx 801048d9: 74 3d je 80104918 <create+0x138> // No ip->nlink++ for ".": avoid cyclic ref count. if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0) panic("create dots"); } if(dirlink(dp, name, ip->inum) < 0) 801048db: 8b 43 04 mov 0x4(%ebx),%eax 801048de: 89 14 24 mov %edx,(%esp) 801048e1: 89 55 cc mov %edx,-0x34(%ebp) 801048e4: 89 74 24 04 mov %esi,0x4(%esp) 801048e8: 89 44 24 08 mov %eax,0x8(%esp) 801048ec: e8 9f d5 ff ff call 80101e90 <dirlink> 801048f1: 8b 55 cc mov -0x34(%ebp),%edx 801048f4: 85 c0 test %eax,%eax 801048f6: 78 7c js 80104974 <create+0x194> panic("create: dirlink"); iunlockput(dp); 801048f8: 89 14 24 mov %edx,(%esp) 801048fb: e8 30 d0 ff ff call 80101930 <iunlockput> return ip; } 80104900: 89 d8 mov %ebx,%eax 80104902: 8b 75 f8 mov -0x8(%ebp),%esi 80104905: 8b 5d f4 mov -0xc(%ebp),%ebx 80104908: 8b 7d fc mov -0x4(%ebp),%edi 8010490b: 89 ec mov %ebp,%esp 8010490d: 5d pop %ebp 8010490e: c3 ret 8010490f: 90 nop { struct inode *ip, *dp; char name[DIRSIZ]; if((dp = nameiparent(path, name)) == 0) return 0; 80104910: 31 db xor %ebx,%ebx 80104912: e9 42 ff ff ff jmp 80104859 <create+0x79> 80104917: 90 nop ip->minor = minor; ip->nlink = 1; iupdate(ip); if(type == T_DIR){ // Create . and .. entries. dp->nlink++; // for ".." 80104918: 66 83 42 56 01 addw $0x1,0x56(%edx) iupdate(dp); 8010491d: 89 14 24 mov %edx,(%esp) 80104920: 89 55 cc mov %edx,-0x34(%ebp) 80104923: e8 b8 cc ff ff call 801015e0 <iupdate> // No ip->nlink++ for ".": avoid cyclic ref count. if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0) 80104928: 8b 43 04 mov 0x4(%ebx),%eax 8010492b: c7 44 24 04 68 74 10 movl $0x80107468,0x4(%esp) 80104932: 80 80104933: 89 1c 24 mov %ebx,(%esp) 80104936: 89 44 24 08 mov %eax,0x8(%esp) 8010493a: e8 51 d5 ff ff call 80101e90 <dirlink> 8010493f: 8b 55 cc mov -0x34(%ebp),%edx 80104942: 85 c0 test %eax,%eax 80104944: 78 22 js 80104968 <create+0x188> 80104946: 8b 42 04 mov 0x4(%edx),%eax 80104949: c7 44 24 04 67 74 10 movl $0x80107467,0x4(%esp) 80104950: 80 80104951: 89 1c 24 mov %ebx,(%esp) 80104954: 89 44 24 08 mov %eax,0x8(%esp) 80104958: e8 33 d5 ff ff call 80101e90 <dirlink> 8010495d: 8b 55 cc mov -0x34(%ebp),%edx 80104960: 85 c0 test %eax,%eax 80104962: 0f 89 73 ff ff ff jns 801048db <create+0xfb> panic("create dots"); 80104968: c7 04 24 6a 74 10 80 movl $0x8010746a,(%esp) 8010496f: e8 fc b9 ff ff call 80100370 <panic> } if(dirlink(dp, name, ip->inum) < 0) panic("create: dirlink"); 80104974: c7 04 24 76 74 10 80 movl $0x80107476,(%esp) 8010497b: e8 f0 b9 ff ff call 80100370 <panic> iunlockput(ip); return 0; } if((ip = ialloc(dp->dev, type)) == 0) panic("create: ialloc"); 80104980: c7 04 24 58 74 10 80 movl $0x80107458,(%esp) 80104987: e8 e4 b9 ff ff call 80100370 <panic> 8010498c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104990 <argfd.constprop.0>: #include "fcntl.h" // Fetch the nth word-sized system call argument as a file descriptor // and return both the descriptor and the corresponding struct file. static int argfd(int n, int *pfd, struct file **pf) 80104990: 55 push %ebp 80104991: 89 e5 mov %esp,%ebp 80104993: 83 ec 38 sub $0x38,%esp 80104996: 89 5d f4 mov %ebx,-0xc(%ebp) 80104999: 89 c3 mov %eax,%ebx { int fd; struct file *f; if(argint(n, &fd) < 0) 8010499b: 8d 45 e4 lea -0x1c(%ebp),%eax #include "fcntl.h" // Fetch the nth word-sized system call argument as a file descriptor // and return both the descriptor and the corresponding struct file. static int argfd(int n, int *pfd, struct file **pf) 8010499e: 89 75 f8 mov %esi,-0x8(%ebp) { int fd; struct file *f; if(argint(n, &fd) < 0) return -1; 801049a1: be ff ff ff ff mov $0xffffffff,%esi #include "fcntl.h" // Fetch the nth word-sized system call argument as a file descriptor // and return both the descriptor and the corresponding struct file. static int argfd(int n, int *pfd, struct file **pf) 801049a6: 89 7d fc mov %edi,-0x4(%ebp) 801049a9: 89 d7 mov %edx,%edi { int fd; struct file *f; if(argint(n, &fd) < 0) 801049ab: 89 44 24 04 mov %eax,0x4(%esp) 801049af: c7 04 24 00 00 00 00 movl $0x0,(%esp) 801049b6: e8 85 fc ff ff call 80104640 <argint> 801049bb: 85 c0 test %eax,%eax 801049bd: 78 24 js 801049e3 <argfd.constprop.0+0x53> return -1; if(fd < 0 || fd >= NOFILE || (f=myproc()->ofile[fd]) == 0) 801049bf: 83 7d e4 0f cmpl $0xf,-0x1c(%ebp) 801049c3: 77 1e ja 801049e3 <argfd.constprop.0+0x53> 801049c5: e8 66 ed ff ff call 80103730 <myproc> 801049ca: 8b 55 e4 mov -0x1c(%ebp),%edx 801049cd: 8b 44 90 28 mov 0x28(%eax,%edx,4),%eax 801049d1: 85 c0 test %eax,%eax 801049d3: 74 0e je 801049e3 <argfd.constprop.0+0x53> return -1; if(pfd) 801049d5: 85 db test %ebx,%ebx 801049d7: 74 02 je 801049db <argfd.constprop.0+0x4b> *pfd = fd; 801049d9: 89 13 mov %edx,(%ebx) if(pf) *pf = f; return 0; 801049db: 31 f6 xor %esi,%esi return -1; if(fd < 0 || fd >= NOFILE || (f=myproc()->ofile[fd]) == 0) return -1; if(pfd) *pfd = fd; if(pf) 801049dd: 85 ff test %edi,%edi 801049df: 74 02 je 801049e3 <argfd.constprop.0+0x53> *pf = f; 801049e1: 89 07 mov %eax,(%edi) return 0; } 801049e3: 89 f0 mov %esi,%eax 801049e5: 8b 5d f4 mov -0xc(%ebp),%ebx 801049e8: 8b 75 f8 mov -0x8(%ebp),%esi 801049eb: 8b 7d fc mov -0x4(%ebp),%edi 801049ee: 89 ec mov %ebp,%esp 801049f0: 5d pop %ebp 801049f1: c3 ret 801049f2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801049f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104a00 <sys_dup>: return -1; } int sys_dup(void) { 80104a00: 55 push %ebp struct file *f; int fd; if(argfd(0, 0, &f) < 0) 80104a01: 31 c0 xor %eax,%eax return -1; } int sys_dup(void) { 80104a03: 89 e5 mov %esp,%ebp 80104a05: 53 push %ebx struct file *f; int fd; if(argfd(0, 0, &f) < 0) return -1; 80104a06: bb ff ff ff ff mov $0xffffffff,%ebx return -1; } int sys_dup(void) { 80104a0b: 83 ec 24 sub $0x24,%esp struct file *f; int fd; if(argfd(0, 0, &f) < 0) 80104a0e: 8d 55 f4 lea -0xc(%ebp),%edx 80104a11: e8 7a ff ff ff call 80104990 <argfd.constprop.0> 80104a16: 85 c0 test %eax,%eax 80104a18: 78 19 js 80104a33 <sys_dup+0x33> return -1; if((fd=fdalloc(f)) < 0) 80104a1a: 8b 45 f4 mov -0xc(%ebp),%eax 80104a1d: e8 7e fd ff ff call 801047a0 <fdalloc> 80104a22: 85 c0 test %eax,%eax 80104a24: 89 c3 mov %eax,%ebx 80104a26: 78 18 js 80104a40 <sys_dup+0x40> return -1; filedup(f); 80104a28: 8b 45 f4 mov -0xc(%ebp),%eax 80104a2b: 89 04 24 mov %eax,(%esp) 80104a2e: e8 9d c3 ff ff call 80100dd0 <filedup> return fd; } 80104a33: 83 c4 24 add $0x24,%esp 80104a36: 89 d8 mov %ebx,%eax 80104a38: 5b pop %ebx 80104a39: 5d pop %ebp 80104a3a: c3 ret 80104a3b: 90 nop 80104a3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi int fd; if(argfd(0, 0, &f) < 0) return -1; if((fd=fdalloc(f)) < 0) return -1; 80104a40: bb ff ff ff ff mov $0xffffffff,%ebx 80104a45: eb ec jmp 80104a33 <sys_dup+0x33> 80104a47: 89 f6 mov %esi,%esi 80104a49: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104a50 <sys_read>: return fd; } int sys_read(void) { 80104a50: 55 push %ebp struct file *f; int n; char *p; if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) 80104a51: 31 c0 xor %eax,%eax return fd; } int sys_read(void) { 80104a53: 89 e5 mov %esp,%ebp 80104a55: 53 push %ebx struct file *f; int n; char *p; if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) return -1; 80104a56: bb ff ff ff ff mov $0xffffffff,%ebx return fd; } int sys_read(void) { 80104a5b: 83 ec 24 sub $0x24,%esp struct file *f; int n; char *p; if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) 80104a5e: 8d 55 ec lea -0x14(%ebp),%edx 80104a61: e8 2a ff ff ff call 80104990 <argfd.constprop.0> 80104a66: 85 c0 test %eax,%eax 80104a68: 78 50 js 80104aba <sys_read+0x6a> 80104a6a: 8d 45 f0 lea -0x10(%ebp),%eax 80104a6d: 89 44 24 04 mov %eax,0x4(%esp) 80104a71: c7 04 24 02 00 00 00 movl $0x2,(%esp) 80104a78: e8 c3 fb ff ff call 80104640 <argint> 80104a7d: 85 c0 test %eax,%eax 80104a7f: 78 39 js 80104aba <sys_read+0x6a> 80104a81: 8b 45 f0 mov -0x10(%ebp),%eax 80104a84: c7 04 24 01 00 00 00 movl $0x1,(%esp) 80104a8b: 89 44 24 08 mov %eax,0x8(%esp) 80104a8f: 8d 45 f4 lea -0xc(%ebp),%eax 80104a92: 89 44 24 04 mov %eax,0x4(%esp) 80104a96: e8 e5 fb ff ff call 80104680 <argptr> 80104a9b: 85 c0 test %eax,%eax 80104a9d: 78 1b js 80104aba <sys_read+0x6a> return -1; return fileread(f, p, n); 80104a9f: 8b 45 f0 mov -0x10(%ebp),%eax 80104aa2: 89 44 24 08 mov %eax,0x8(%esp) 80104aa6: 8b 45 f4 mov -0xc(%ebp),%eax 80104aa9: 89 44 24 04 mov %eax,0x4(%esp) 80104aad: 8b 45 ec mov -0x14(%ebp),%eax 80104ab0: 89 04 24 mov %eax,(%esp) 80104ab3: e8 98 c4 ff ff call 80100f50 <fileread> 80104ab8: 89 c3 mov %eax,%ebx } 80104aba: 83 c4 24 add $0x24,%esp 80104abd: 89 d8 mov %ebx,%eax 80104abf: 5b pop %ebx 80104ac0: 5d pop %ebp 80104ac1: c3 ret 80104ac2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104ac9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104ad0 <sys_write>: int sys_write(void) { 80104ad0: 55 push %ebp struct file *f; int n; char *p; if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) 80104ad1: 31 c0 xor %eax,%eax return fileread(f, p, n); } int sys_write(void) { 80104ad3: 89 e5 mov %esp,%ebp 80104ad5: 53 push %ebx struct file *f; int n; char *p; if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) return -1; 80104ad6: bb ff ff ff ff mov $0xffffffff,%ebx return fileread(f, p, n); } int sys_write(void) { 80104adb: 83 ec 24 sub $0x24,%esp struct file *f; int n; char *p; if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) 80104ade: 8d 55 ec lea -0x14(%ebp),%edx 80104ae1: e8 aa fe ff ff call 80104990 <argfd.constprop.0> 80104ae6: 85 c0 test %eax,%eax 80104ae8: 78 50 js 80104b3a <sys_write+0x6a> 80104aea: 8d 45 f0 lea -0x10(%ebp),%eax 80104aed: 89 44 24 04 mov %eax,0x4(%esp) 80104af1: c7 04 24 02 00 00 00 movl $0x2,(%esp) 80104af8: e8 43 fb ff ff call 80104640 <argint> 80104afd: 85 c0 test %eax,%eax 80104aff: 78 39 js 80104b3a <sys_write+0x6a> 80104b01: 8b 45 f0 mov -0x10(%ebp),%eax 80104b04: c7 04 24 01 00 00 00 movl $0x1,(%esp) 80104b0b: 89 44 24 08 mov %eax,0x8(%esp) 80104b0f: 8d 45 f4 lea -0xc(%ebp),%eax 80104b12: 89 44 24 04 mov %eax,0x4(%esp) 80104b16: e8 65 fb ff ff call 80104680 <argptr> 80104b1b: 85 c0 test %eax,%eax 80104b1d: 78 1b js 80104b3a <sys_write+0x6a> return -1; return filewrite(f, p, n); 80104b1f: 8b 45 f0 mov -0x10(%ebp),%eax 80104b22: 89 44 24 08 mov %eax,0x8(%esp) 80104b26: 8b 45 f4 mov -0xc(%ebp),%eax 80104b29: 89 44 24 04 mov %eax,0x4(%esp) 80104b2d: 8b 45 ec mov -0x14(%ebp),%eax 80104b30: 89 04 24 mov %eax,(%esp) 80104b33: e8 c8 c4 ff ff call 80101000 <filewrite> 80104b38: 89 c3 mov %eax,%ebx } 80104b3a: 83 c4 24 add $0x24,%esp 80104b3d: 89 d8 mov %ebx,%eax 80104b3f: 5b pop %ebx 80104b40: 5d pop %ebp 80104b41: c3 ret 80104b42: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104b49: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104b50 <sys_close>: int sys_close(void) { 80104b50: 55 push %ebp 80104b51: 89 e5 mov %esp,%ebp 80104b53: 83 ec 28 sub $0x28,%esp int fd; struct file *f; if(argfd(0, &fd, &f) < 0) 80104b56: 8d 55 f4 lea -0xc(%ebp),%edx 80104b59: 8d 45 f0 lea -0x10(%ebp),%eax 80104b5c: e8 2f fe ff ff call 80104990 <argfd.constprop.0> return -1; 80104b61: ba ff ff ff ff mov $0xffffffff,%edx sys_close(void) { int fd; struct file *f; if(argfd(0, &fd, &f) < 0) 80104b66: 85 c0 test %eax,%eax 80104b68: 78 1d js 80104b87 <sys_close+0x37> return -1; myproc()->ofile[fd] = 0; 80104b6a: e8 c1 eb ff ff call 80103730 <myproc> 80104b6f: 8b 55 f0 mov -0x10(%ebp),%edx 80104b72: c7 44 90 28 00 00 00 movl $0x0,0x28(%eax,%edx,4) 80104b79: 00 fileclose(f); 80104b7a: 8b 45 f4 mov -0xc(%ebp),%eax 80104b7d: 89 04 24 mov %eax,(%esp) 80104b80: e8 9b c2 ff ff call 80100e20 <fileclose> return 0; 80104b85: 31 d2 xor %edx,%edx } 80104b87: 89 d0 mov %edx,%eax 80104b89: c9 leave 80104b8a: c3 ret 80104b8b: 90 nop 80104b8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104b90 <sys_fstat>: int sys_fstat(void) { 80104b90: 55 push %ebp struct file *f; struct stat *st; if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0) 80104b91: 31 c0 xor %eax,%eax return 0; } int sys_fstat(void) { 80104b93: 89 e5 mov %esp,%ebp 80104b95: 53 push %ebx struct file *f; struct stat *st; if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0) return -1; 80104b96: bb ff ff ff ff mov $0xffffffff,%ebx return 0; } int sys_fstat(void) { 80104b9b: 83 ec 24 sub $0x24,%esp struct file *f; struct stat *st; if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0) 80104b9e: 8d 55 f0 lea -0x10(%ebp),%edx 80104ba1: e8 ea fd ff ff call 80104990 <argfd.constprop.0> 80104ba6: 85 c0 test %eax,%eax 80104ba8: 78 33 js 80104bdd <sys_fstat+0x4d> 80104baa: 8d 45 f4 lea -0xc(%ebp),%eax 80104bad: c7 44 24 08 14 00 00 movl $0x14,0x8(%esp) 80104bb4: 00 80104bb5: 89 44 24 04 mov %eax,0x4(%esp) 80104bb9: c7 04 24 01 00 00 00 movl $0x1,(%esp) 80104bc0: e8 bb fa ff ff call 80104680 <argptr> 80104bc5: 85 c0 test %eax,%eax 80104bc7: 78 14 js 80104bdd <sys_fstat+0x4d> return -1; return filestat(f, st); 80104bc9: 8b 45 f4 mov -0xc(%ebp),%eax 80104bcc: 89 44 24 04 mov %eax,0x4(%esp) 80104bd0: 8b 45 f0 mov -0x10(%ebp),%eax 80104bd3: 89 04 24 mov %eax,(%esp) 80104bd6: e8 25 c3 ff ff call 80100f00 <filestat> 80104bdb: 89 c3 mov %eax,%ebx } 80104bdd: 83 c4 24 add $0x24,%esp 80104be0: 89 d8 mov %ebx,%eax 80104be2: 5b pop %ebx 80104be3: 5d pop %ebp 80104be4: c3 ret 80104be5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104be9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104bf0 <sys_link>: // Create the path new as a link to the same inode as old. int sys_link(void) { 80104bf0: 55 push %ebp 80104bf1: 89 e5 mov %esp,%ebp 80104bf3: 57 push %edi 80104bf4: 56 push %esi char name[DIRSIZ], *new, *old; struct inode *dp, *ip; if(argstr(0, &old) < 0 || argstr(1, &new) < 0) return -1; 80104bf5: be ff ff ff ff mov $0xffffffff,%esi } // Create the path new as a link to the same inode as old. int sys_link(void) { 80104bfa: 53 push %ebx 80104bfb: 83 ec 3c sub $0x3c,%esp char name[DIRSIZ], *new, *old; struct inode *dp, *ip; if(argstr(0, &old) < 0 || argstr(1, &new) < 0) 80104bfe: 8d 45 e4 lea -0x1c(%ebp),%eax 80104c01: 89 44 24 04 mov %eax,0x4(%esp) 80104c05: c7 04 24 00 00 00 00 movl $0x0,(%esp) 80104c0c: e8 cf fa ff ff call 801046e0 <argstr> 80104c11: 85 c0 test %eax,%eax 80104c13: 0f 88 b1 00 00 00 js 80104cca <sys_link+0xda> 80104c19: 8d 45 e0 lea -0x20(%ebp),%eax 80104c1c: 89 44 24 04 mov %eax,0x4(%esp) 80104c20: c7 04 24 01 00 00 00 movl $0x1,(%esp) 80104c27: e8 b4 fa ff ff call 801046e0 <argstr> 80104c2c: 85 c0 test %eax,%eax 80104c2e: 0f 88 96 00 00 00 js 80104cca <sys_link+0xda> return -1; begin_op(); 80104c34: e8 37 df ff ff call 80102b70 <begin_op> if((ip = namei(old)) == 0){ 80104c39: 8b 45 e4 mov -0x1c(%ebp),%eax 80104c3c: 89 04 24 mov %eax,(%esp) 80104c3f: e8 2c d3 ff ff call 80101f70 <namei> 80104c44: 85 c0 test %eax,%eax 80104c46: 89 c3 mov %eax,%ebx 80104c48: 0f 84 d2 00 00 00 je 80104d20 <sys_link+0x130> end_op(); return -1; } ilock(ip); 80104c4e: 89 04 24 mov %eax,(%esp) 80104c51: e8 4a ca ff ff call 801016a0 <ilock> if(ip->type == T_DIR){ 80104c56: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) 80104c5b: 0f 84 b7 00 00 00 je 80104d18 <sys_link+0x128> iunlockput(ip); end_op(); return -1; } ip->nlink++; 80104c61: 66 83 43 56 01 addw $0x1,0x56(%ebx) iupdate(ip); iunlock(ip); if((dp = nameiparent(new, name)) == 0) 80104c66: 8d 7d d2 lea -0x2e(%ebp),%edi end_op(); return -1; } ip->nlink++; iupdate(ip); 80104c69: 89 1c 24 mov %ebx,(%esp) 80104c6c: e8 6f c9 ff ff call 801015e0 <iupdate> iunlock(ip); 80104c71: 89 1c 24 mov %ebx,(%esp) 80104c74: e8 07 cb ff ff call 80101780 <iunlock> if((dp = nameiparent(new, name)) == 0) 80104c79: 8b 45 e0 mov -0x20(%ebp),%eax 80104c7c: 89 7c 24 04 mov %edi,0x4(%esp) 80104c80: 89 04 24 mov %eax,(%esp) 80104c83: e8 08 d3 ff ff call 80101f90 <nameiparent> 80104c88: 85 c0 test %eax,%eax 80104c8a: 89 c6 mov %eax,%esi 80104c8c: 74 52 je 80104ce0 <sys_link+0xf0> goto bad; ilock(dp); 80104c8e: 89 04 24 mov %eax,(%esp) 80104c91: e8 0a ca ff ff call 801016a0 <ilock> if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){ 80104c96: 8b 03 mov (%ebx),%eax 80104c98: 39 06 cmp %eax,(%esi) 80104c9a: 75 3c jne 80104cd8 <sys_link+0xe8> 80104c9c: 8b 43 04 mov 0x4(%ebx),%eax 80104c9f: 89 7c 24 04 mov %edi,0x4(%esp) 80104ca3: 89 34 24 mov %esi,(%esp) 80104ca6: 89 44 24 08 mov %eax,0x8(%esp) 80104caa: e8 e1 d1 ff ff call 80101e90 <dirlink> 80104caf: 85 c0 test %eax,%eax 80104cb1: 78 25 js 80104cd8 <sys_link+0xe8> iunlockput(dp); goto bad; } iunlockput(dp); 80104cb3: 89 34 24 mov %esi,(%esp) iput(ip); end_op(); return 0; 80104cb6: 31 f6 xor %esi,%esi ilock(dp); if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){ iunlockput(dp); goto bad; } iunlockput(dp); 80104cb8: e8 73 cc ff ff call 80101930 <iunlockput> iput(ip); 80104cbd: 89 1c 24 mov %ebx,(%esp) 80104cc0: e8 0b cb ff ff call 801017d0 <iput> end_op(); 80104cc5: e8 16 df ff ff call 80102be0 <end_op> ip->nlink--; iupdate(ip); iunlockput(ip); end_op(); return -1; } 80104cca: 83 c4 3c add $0x3c,%esp 80104ccd: 89 f0 mov %esi,%eax 80104ccf: 5b pop %ebx 80104cd0: 5e pop %esi 80104cd1: 5f pop %edi 80104cd2: 5d pop %ebp 80104cd3: c3 ret 80104cd4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if((dp = nameiparent(new, name)) == 0) goto bad; ilock(dp); if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){ iunlockput(dp); 80104cd8: 89 34 24 mov %esi,(%esp) 80104cdb: e8 50 cc ff ff call 80101930 <iunlockput> end_op(); return 0; bad: ilock(ip); 80104ce0: 89 1c 24 mov %ebx,(%esp) ip->nlink--; iupdate(ip); iunlockput(ip); end_op(); return -1; 80104ce3: be ff ff ff ff mov $0xffffffff,%esi end_op(); return 0; bad: ilock(ip); 80104ce8: e8 b3 c9 ff ff call 801016a0 <ilock> ip->nlink--; 80104ced: 66 83 6b 56 01 subw $0x1,0x56(%ebx) iupdate(ip); 80104cf2: 89 1c 24 mov %ebx,(%esp) 80104cf5: e8 e6 c8 ff ff call 801015e0 <iupdate> iunlockput(ip); 80104cfa: 89 1c 24 mov %ebx,(%esp) 80104cfd: e8 2e cc ff ff call 80101930 <iunlockput> end_op(); 80104d02: e8 d9 de ff ff call 80102be0 <end_op> return -1; } 80104d07: 83 c4 3c add $0x3c,%esp 80104d0a: 89 f0 mov %esi,%eax 80104d0c: 5b pop %ebx 80104d0d: 5e pop %esi 80104d0e: 5f pop %edi 80104d0f: 5d pop %ebp 80104d10: c3 ret 80104d11: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi return -1; } ilock(ip); if(ip->type == T_DIR){ iunlockput(ip); 80104d18: 89 1c 24 mov %ebx,(%esp) 80104d1b: e8 10 cc ff ff call 80101930 <iunlockput> end_op(); 80104d20: e8 bb de ff ff call 80102be0 <end_op> return -1; 80104d25: eb a3 jmp 80104cca <sys_link+0xda> 80104d27: 89 f6 mov %esi,%esi 80104d29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104d30 <sys_unlink>: } //PAGEBREAK! int sys_unlink(void) { 80104d30: 55 push %ebp 80104d31: 89 e5 mov %esp,%ebp 80104d33: 57 push %edi 80104d34: 56 push %esi 80104d35: 53 push %ebx 80104d36: 83 ec 6c sub $0x6c,%esp struct inode *ip, *dp; struct dirent de; char name[DIRSIZ], *path; uint off; if(argstr(0, &path) < 0) 80104d39: 8d 45 e0 lea -0x20(%ebp),%eax 80104d3c: 89 44 24 04 mov %eax,0x4(%esp) 80104d40: c7 04 24 00 00 00 00 movl $0x0,(%esp) 80104d47: e8 94 f9 ff ff call 801046e0 <argstr> 80104d4c: 85 c0 test %eax,%eax 80104d4e: 0f 88 99 01 00 00 js 80104eed <sys_unlink+0x1bd> return -1; begin_op(); 80104d54: e8 17 de ff ff call 80102b70 <begin_op> if((dp = nameiparent(path, name)) == 0){ 80104d59: 8b 45 e0 mov -0x20(%ebp),%eax 80104d5c: 8d 5d d2 lea -0x2e(%ebp),%ebx 80104d5f: 89 5c 24 04 mov %ebx,0x4(%esp) 80104d63: 89 04 24 mov %eax,(%esp) 80104d66: e8 25 d2 ff ff call 80101f90 <nameiparent> 80104d6b: 85 c0 test %eax,%eax 80104d6d: 89 45 a4 mov %eax,-0x5c(%ebp) 80104d70: 0f 84 4d 01 00 00 je 80104ec3 <sys_unlink+0x193> end_op(); return -1; } ilock(dp); 80104d76: 8b 45 a4 mov -0x5c(%ebp),%eax 80104d79: 89 04 24 mov %eax,(%esp) 80104d7c: e8 1f c9 ff ff call 801016a0 <ilock> // Cannot unlink "." or "..". if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0) 80104d81: c7 44 24 04 68 74 10 movl $0x80107468,0x4(%esp) 80104d88: 80 80104d89: 89 1c 24 mov %ebx,(%esp) 80104d8c: e8 6f ce ff ff call 80101c00 <namecmp> 80104d91: 85 c0 test %eax,%eax 80104d93: 0f 84 1f 01 00 00 je 80104eb8 <sys_unlink+0x188> 80104d99: c7 44 24 04 67 74 10 movl $0x80107467,0x4(%esp) 80104da0: 80 80104da1: 89 1c 24 mov %ebx,(%esp) 80104da4: e8 57 ce ff ff call 80101c00 <namecmp> 80104da9: 85 c0 test %eax,%eax 80104dab: 0f 84 07 01 00 00 je 80104eb8 <sys_unlink+0x188> goto bad; if((ip = dirlookup(dp, name, &off)) == 0) 80104db1: 8d 45 e4 lea -0x1c(%ebp),%eax 80104db4: 89 44 24 08 mov %eax,0x8(%esp) 80104db8: 8b 45 a4 mov -0x5c(%ebp),%eax 80104dbb: 89 5c 24 04 mov %ebx,0x4(%esp) 80104dbf: 89 04 24 mov %eax,(%esp) 80104dc2: e8 69 ce ff ff call 80101c30 <dirlookup> 80104dc7: 85 c0 test %eax,%eax 80104dc9: 89 c6 mov %eax,%esi 80104dcb: 0f 84 e7 00 00 00 je 80104eb8 <sys_unlink+0x188> goto bad; ilock(ip); 80104dd1: 89 04 24 mov %eax,(%esp) 80104dd4: e8 c7 c8 ff ff call 801016a0 <ilock> if(ip->nlink < 1) 80104dd9: 66 83 7e 56 00 cmpw $0x0,0x56(%esi) 80104dde: 0f 8e 1f 01 00 00 jle 80104f03 <sys_unlink+0x1d3> panic("unlink: nlink < 1"); if(ip->type == T_DIR && !isdirempty(ip)){ 80104de4: 66 83 7e 50 01 cmpw $0x1,0x50(%esi) 80104de9: 74 7d je 80104e68 <sys_unlink+0x138> iunlockput(ip); goto bad; } memset(&de, 0, sizeof(de)); 80104deb: 8d 5d b2 lea -0x4e(%ebp),%ebx 80104dee: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) 80104df5: 00 80104df6: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80104dfd: 00 80104dfe: 89 1c 24 mov %ebx,(%esp) 80104e01: e8 3a f5 ff ff call 80104340 <memset> if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80104e06: 8b 45 e4 mov -0x1c(%ebp),%eax 80104e09: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp) 80104e10: 00 80104e11: 89 5c 24 04 mov %ebx,0x4(%esp) 80104e15: 89 44 24 08 mov %eax,0x8(%esp) 80104e19: 8b 45 a4 mov -0x5c(%ebp),%eax 80104e1c: 89 04 24 mov %eax,(%esp) 80104e1f: e8 8c cc ff ff call 80101ab0 <writei> 80104e24: 83 f8 10 cmp $0x10,%eax 80104e27: 0f 85 e2 00 00 00 jne 80104f0f <sys_unlink+0x1df> panic("unlink: writei"); if(ip->type == T_DIR){ 80104e2d: 66 83 7e 50 01 cmpw $0x1,0x50(%esi) 80104e32: 0f 84 a0 00 00 00 je 80104ed8 <sys_unlink+0x1a8> dp->nlink--; iupdate(dp); } iunlockput(dp); 80104e38: 8b 45 a4 mov -0x5c(%ebp),%eax 80104e3b: 89 04 24 mov %eax,(%esp) 80104e3e: e8 ed ca ff ff call 80101930 <iunlockput> ip->nlink--; 80104e43: 66 83 6e 56 01 subw $0x1,0x56(%esi) iupdate(ip); 80104e48: 89 34 24 mov %esi,(%esp) 80104e4b: e8 90 c7 ff ff call 801015e0 <iupdate> iunlockput(ip); 80104e50: 89 34 24 mov %esi,(%esp) 80104e53: e8 d8 ca ff ff call 80101930 <iunlockput> end_op(); 80104e58: e8 83 dd ff ff call 80102be0 <end_op> return 0; 80104e5d: 31 c0 xor %eax,%eax bad: iunlockput(dp); end_op(); return -1; } 80104e5f: 83 c4 6c add $0x6c,%esp 80104e62: 5b pop %ebx 80104e63: 5e pop %esi 80104e64: 5f pop %edi 80104e65: 5d pop %ebp 80104e66: c3 ret 80104e67: 90 nop isdirempty(struct inode *dp) { int off; struct dirent de; for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){ 80104e68: 83 7e 58 20 cmpl $0x20,0x58(%esi) 80104e6c: 0f 86 79 ff ff ff jbe 80104deb <sys_unlink+0xbb> 80104e72: bb 20 00 00 00 mov $0x20,%ebx 80104e77: 8d 7d c2 lea -0x3e(%ebp),%edi 80104e7a: eb 10 jmp 80104e8c <sys_unlink+0x15c> 80104e7c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104e80: 83 c3 10 add $0x10,%ebx 80104e83: 3b 5e 58 cmp 0x58(%esi),%ebx 80104e86: 0f 83 5f ff ff ff jae 80104deb <sys_unlink+0xbb> if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80104e8c: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp) 80104e93: 00 80104e94: 89 5c 24 08 mov %ebx,0x8(%esp) 80104e98: 89 7c 24 04 mov %edi,0x4(%esp) 80104e9c: 89 34 24 mov %esi,(%esp) 80104e9f: e8 dc ca ff ff call 80101980 <readi> 80104ea4: 83 f8 10 cmp $0x10,%eax 80104ea7: 75 4e jne 80104ef7 <sys_unlink+0x1c7> panic("isdirempty: readi"); if(de.inum != 0) 80104ea9: 66 83 7d c2 00 cmpw $0x0,-0x3e(%ebp) 80104eae: 74 d0 je 80104e80 <sys_unlink+0x150> ilock(ip); if(ip->nlink < 1) panic("unlink: nlink < 1"); if(ip->type == T_DIR && !isdirempty(ip)){ iunlockput(ip); 80104eb0: 89 34 24 mov %esi,(%esp) 80104eb3: e8 78 ca ff ff call 80101930 <iunlockput> end_op(); return 0; bad: iunlockput(dp); 80104eb8: 8b 45 a4 mov -0x5c(%ebp),%eax 80104ebb: 89 04 24 mov %eax,(%esp) 80104ebe: e8 6d ca ff ff call 80101930 <iunlockput> end_op(); 80104ec3: e8 18 dd ff ff call 80102be0 <end_op> return -1; } 80104ec8: 83 c4 6c add $0x6c,%esp return 0; bad: iunlockput(dp); end_op(); return -1; 80104ecb: b8 ff ff ff ff mov $0xffffffff,%eax } 80104ed0: 5b pop %ebx 80104ed1: 5e pop %esi 80104ed2: 5f pop %edi 80104ed3: 5d pop %ebp 80104ed4: c3 ret 80104ed5: 8d 76 00 lea 0x0(%esi),%esi memset(&de, 0, sizeof(de)); if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) panic("unlink: writei"); if(ip->type == T_DIR){ dp->nlink--; 80104ed8: 8b 45 a4 mov -0x5c(%ebp),%eax 80104edb: 66 83 68 56 01 subw $0x1,0x56(%eax) iupdate(dp); 80104ee0: 89 04 24 mov %eax,(%esp) 80104ee3: e8 f8 c6 ff ff call 801015e0 <iupdate> 80104ee8: e9 4b ff ff ff jmp 80104e38 <sys_unlink+0x108> struct dirent de; char name[DIRSIZ], *path; uint off; if(argstr(0, &path) < 0) return -1; 80104eed: b8 ff ff ff ff mov $0xffffffff,%eax 80104ef2: e9 68 ff ff ff jmp 80104e5f <sys_unlink+0x12f> int off; struct dirent de; for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){ if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) panic("isdirempty: readi"); 80104ef7: c7 04 24 98 74 10 80 movl $0x80107498,(%esp) 80104efe: e8 6d b4 ff ff call 80100370 <panic> if((ip = dirlookup(dp, name, &off)) == 0) goto bad; ilock(ip); if(ip->nlink < 1) panic("unlink: nlink < 1"); 80104f03: c7 04 24 86 74 10 80 movl $0x80107486,(%esp) 80104f0a: e8 61 b4 ff ff call 80100370 <panic> goto bad; } memset(&de, 0, sizeof(de)); if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) panic("unlink: writei"); 80104f0f: c7 04 24 aa 74 10 80 movl $0x801074aa,(%esp) 80104f16: e8 55 b4 ff ff call 80100370 <panic> 80104f1b: 90 nop 80104f1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104f20 <sys_open>: return ip; } int sys_open(void) { 80104f20: 55 push %ebp 80104f21: 89 e5 mov %esp,%ebp 80104f23: 57 push %edi 80104f24: 56 push %esi 80104f25: 53 push %ebx int fd, omode; struct file *f; struct inode *ip; if(argstr(0, &path) < 0 || argint(1, &omode) < 0) return -1; 80104f26: bb ff ff ff ff mov $0xffffffff,%ebx return ip; } int sys_open(void) { 80104f2b: 83 ec 2c sub $0x2c,%esp char *path; int fd, omode; struct file *f; struct inode *ip; if(argstr(0, &path) < 0 || argint(1, &omode) < 0) 80104f2e: 8d 45 e0 lea -0x20(%ebp),%eax 80104f31: 89 44 24 04 mov %eax,0x4(%esp) 80104f35: c7 04 24 00 00 00 00 movl $0x0,(%esp) 80104f3c: e8 9f f7 ff ff call 801046e0 <argstr> 80104f41: 85 c0 test %eax,%eax 80104f43: 0f 88 8c 00 00 00 js 80104fd5 <sys_open+0xb5> 80104f49: 8d 45 e4 lea -0x1c(%ebp),%eax 80104f4c: 89 44 24 04 mov %eax,0x4(%esp) 80104f50: c7 04 24 01 00 00 00 movl $0x1,(%esp) 80104f57: e8 e4 f6 ff ff call 80104640 <argint> 80104f5c: 85 c0 test %eax,%eax 80104f5e: 78 75 js 80104fd5 <sys_open+0xb5> return -1; begin_op(); 80104f60: e8 0b dc ff ff call 80102b70 <begin_op> if(omode & O_CREATE){ 80104f65: f6 45 e5 02 testb $0x2,-0x1b(%ebp) 80104f69: 75 75 jne 80104fe0 <sys_open+0xc0> if(ip == 0){ end_op(); return -1; } } else { if((ip = namei(path)) == 0){ 80104f6b: 8b 45 e0 mov -0x20(%ebp),%eax 80104f6e: 89 04 24 mov %eax,(%esp) 80104f71: e8 fa cf ff ff call 80101f70 <namei> 80104f76: 85 c0 test %eax,%eax 80104f78: 89 c7 mov %eax,%edi 80104f7a: 0f 84 8f 00 00 00 je 8010500f <sys_open+0xef> end_op(); return -1; } ilock(ip); 80104f80: 89 04 24 mov %eax,(%esp) 80104f83: e8 18 c7 ff ff call 801016a0 <ilock> if(ip->type == T_DIR && omode != O_RDONLY){ 80104f88: 66 83 7f 50 01 cmpw $0x1,0x50(%edi) 80104f8d: 74 71 je 80105000 <sys_open+0xe0> end_op(); return -1; } } if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){ 80104f8f: e8 cc bd ff ff call 80100d60 <filealloc> 80104f94: 85 c0 test %eax,%eax 80104f96: 89 c6 mov %eax,%esi 80104f98: 0f 84 87 00 00 00 je 80105025 <sys_open+0x105> 80104f9e: e8 fd f7 ff ff call 801047a0 <fdalloc> 80104fa3: 85 c0 test %eax,%eax 80104fa5: 89 c3 mov %eax,%ebx 80104fa7: 78 6f js 80105018 <sys_open+0xf8> fileclose(f); iunlockput(ip); end_op(); return -1; } iunlock(ip); 80104fa9: 89 3c 24 mov %edi,(%esp) 80104fac: e8 cf c7 ff ff call 80101780 <iunlock> end_op(); 80104fb1: e8 2a dc ff ff call 80102be0 <end_op> f->type = FD_INODE; 80104fb6: c7 06 02 00 00 00 movl $0x2,(%esi) f->ip = ip; f->off = 0; f->readable = !(omode & O_WRONLY); 80104fbc: 8b 45 e4 mov -0x1c(%ebp),%eax } iunlock(ip); end_op(); f->type = FD_INODE; f->ip = ip; 80104fbf: 89 7e 10 mov %edi,0x10(%esi) f->off = 0; 80104fc2: c7 46 14 00 00 00 00 movl $0x0,0x14(%esi) f->readable = !(omode & O_WRONLY); 80104fc9: a8 01 test $0x1,%al 80104fcb: 0f 94 46 08 sete 0x8(%esi) f->writable = (omode & O_WRONLY) || (omode & O_RDWR); 80104fcf: a8 03 test $0x3,%al 80104fd1: 0f 95 46 09 setne 0x9(%esi) return fd; } 80104fd5: 83 c4 2c add $0x2c,%esp 80104fd8: 89 d8 mov %ebx,%eax 80104fda: 5b pop %ebx 80104fdb: 5e pop %esi 80104fdc: 5f pop %edi 80104fdd: 5d pop %ebp 80104fde: c3 ret 80104fdf: 90 nop return -1; begin_op(); if(omode & O_CREATE){ ip = create(path, T_FILE, 0, 0); 80104fe0: 8b 45 e0 mov -0x20(%ebp),%eax 80104fe3: 31 c9 xor %ecx,%ecx 80104fe5: ba 02 00 00 00 mov $0x2,%edx 80104fea: c7 04 24 00 00 00 00 movl $0x0,(%esp) 80104ff1: e8 ea f7 ff ff call 801047e0 <create> if(ip == 0){ 80104ff6: 85 c0 test %eax,%eax return -1; begin_op(); if(omode & O_CREATE){ ip = create(path, T_FILE, 0, 0); 80104ff8: 89 c7 mov %eax,%edi if(ip == 0){ 80104ffa: 75 93 jne 80104f8f <sys_open+0x6f> 80104ffc: eb 11 jmp 8010500f <sys_open+0xef> 80104ffe: 66 90 xchg %ax,%ax if((ip = namei(path)) == 0){ end_op(); return -1; } ilock(ip); if(ip->type == T_DIR && omode != O_RDONLY){ 80105000: 8b 75 e4 mov -0x1c(%ebp),%esi 80105003: 85 f6 test %esi,%esi 80105005: 74 88 je 80104f8f <sys_open+0x6f> iunlockput(ip); 80105007: 89 3c 24 mov %edi,(%esp) 8010500a: e8 21 c9 ff ff call 80101930 <iunlockput> end_op(); 8010500f: e8 cc db ff ff call 80102be0 <end_op> return -1; 80105014: eb bf jmp 80104fd5 <sys_open+0xb5> 80105016: 66 90 xchg %ax,%ax } } if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){ if(f) fileclose(f); 80105018: 89 34 24 mov %esi,(%esp) 8010501b: 90 nop 8010501c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105020: e8 fb bd ff ff call 80100e20 <fileclose> iunlockput(ip); 80105025: 89 3c 24 mov %edi,(%esp) end_op(); return -1; 80105028: bb ff ff ff ff mov $0xffffffff,%ebx } if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){ if(f) fileclose(f); iunlockput(ip); 8010502d: e8 fe c8 ff ff call 80101930 <iunlockput> end_op(); 80105032: e8 a9 db ff ff call 80102be0 <end_op> return -1; 80105037: eb 9c jmp 80104fd5 <sys_open+0xb5> 80105039: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105040 <sys_mkdir>: return fd; } int sys_mkdir(void) { 80105040: 55 push %ebp 80105041: 89 e5 mov %esp,%ebp 80105043: 83 ec 28 sub $0x28,%esp char *path; struct inode *ip; begin_op(); 80105046: e8 25 db ff ff call 80102b70 <begin_op> if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){ 8010504b: 8d 45 f4 lea -0xc(%ebp),%eax 8010504e: 89 44 24 04 mov %eax,0x4(%esp) 80105052: c7 04 24 00 00 00 00 movl $0x0,(%esp) 80105059: e8 82 f6 ff ff call 801046e0 <argstr> 8010505e: 85 c0 test %eax,%eax 80105060: 78 2e js 80105090 <sys_mkdir+0x50> 80105062: 8b 45 f4 mov -0xc(%ebp),%eax 80105065: 31 c9 xor %ecx,%ecx 80105067: ba 01 00 00 00 mov $0x1,%edx 8010506c: c7 04 24 00 00 00 00 movl $0x0,(%esp) 80105073: e8 68 f7 ff ff call 801047e0 <create> 80105078: 85 c0 test %eax,%eax 8010507a: 74 14 je 80105090 <sys_mkdir+0x50> end_op(); return -1; } iunlockput(ip); 8010507c: 89 04 24 mov %eax,(%esp) 8010507f: e8 ac c8 ff ff call 80101930 <iunlockput> end_op(); 80105084: e8 57 db ff ff call 80102be0 <end_op> return 0; 80105089: 31 c0 xor %eax,%eax } 8010508b: c9 leave 8010508c: c3 ret 8010508d: 8d 76 00 lea 0x0(%esi),%esi char *path; struct inode *ip; begin_op(); if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){ end_op(); 80105090: e8 4b db ff ff call 80102be0 <end_op> return -1; 80105095: b8 ff ff ff ff mov $0xffffffff,%eax } iunlockput(ip); end_op(); return 0; } 8010509a: c9 leave 8010509b: c3 ret 8010509c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801050a0 <sys_mknod>: int sys_mknod(void) { 801050a0: 55 push %ebp 801050a1: 89 e5 mov %esp,%ebp 801050a3: 83 ec 28 sub $0x28,%esp struct inode *ip; char *path; int major, minor; begin_op(); 801050a6: e8 c5 da ff ff call 80102b70 <begin_op> if((argstr(0, &path)) < 0 || 801050ab: 8d 45 ec lea -0x14(%ebp),%eax 801050ae: 89 44 24 04 mov %eax,0x4(%esp) 801050b2: c7 04 24 00 00 00 00 movl $0x0,(%esp) 801050b9: e8 22 f6 ff ff call 801046e0 <argstr> 801050be: 85 c0 test %eax,%eax 801050c0: 78 5e js 80105120 <sys_mknod+0x80> argint(1, &major) < 0 || 801050c2: 8d 45 f0 lea -0x10(%ebp),%eax 801050c5: 89 44 24 04 mov %eax,0x4(%esp) 801050c9: c7 04 24 01 00 00 00 movl $0x1,(%esp) 801050d0: e8 6b f5 ff ff call 80104640 <argint> struct inode *ip; char *path; int major, minor; begin_op(); if((argstr(0, &path)) < 0 || 801050d5: 85 c0 test %eax,%eax 801050d7: 78 47 js 80105120 <sys_mknod+0x80> argint(1, &major) < 0 || argint(2, &minor) < 0 || 801050d9: 8d 45 f4 lea -0xc(%ebp),%eax 801050dc: 89 44 24 04 mov %eax,0x4(%esp) 801050e0: c7 04 24 02 00 00 00 movl $0x2,(%esp) 801050e7: e8 54 f5 ff ff call 80104640 <argint> char *path; int major, minor; begin_op(); if((argstr(0, &path)) < 0 || argint(1, &major) < 0 || 801050ec: 85 c0 test %eax,%eax 801050ee: 78 30 js 80105120 <sys_mknod+0x80> argint(2, &minor) < 0 || (ip = create(path, T_DEV, major, minor)) == 0){ 801050f0: 0f bf 45 f4 movswl -0xc(%ebp),%eax int major, minor; begin_op(); if((argstr(0, &path)) < 0 || argint(1, &major) < 0 || argint(2, &minor) < 0 || 801050f4: ba 03 00 00 00 mov $0x3,%edx (ip = create(path, T_DEV, major, minor)) == 0){ 801050f9: 0f bf 4d f0 movswl -0x10(%ebp),%ecx 801050fd: 89 04 24 mov %eax,(%esp) int major, minor; begin_op(); if((argstr(0, &path)) < 0 || argint(1, &major) < 0 || argint(2, &minor) < 0 || 80105100: 8b 45 ec mov -0x14(%ebp),%eax 80105103: e8 d8 f6 ff ff call 801047e0 <create> 80105108: 85 c0 test %eax,%eax 8010510a: 74 14 je 80105120 <sys_mknod+0x80> (ip = create(path, T_DEV, major, minor)) == 0){ end_op(); return -1; } iunlockput(ip); 8010510c: 89 04 24 mov %eax,(%esp) 8010510f: e8 1c c8 ff ff call 80101930 <iunlockput> end_op(); 80105114: e8 c7 da ff ff call 80102be0 <end_op> return 0; 80105119: 31 c0 xor %eax,%eax } 8010511b: c9 leave 8010511c: c3 ret 8010511d: 8d 76 00 lea 0x0(%esi),%esi begin_op(); if((argstr(0, &path)) < 0 || argint(1, &major) < 0 || argint(2, &minor) < 0 || (ip = create(path, T_DEV, major, minor)) == 0){ end_op(); 80105120: e8 bb da ff ff call 80102be0 <end_op> return -1; 80105125: b8 ff ff ff ff mov $0xffffffff,%eax } iunlockput(ip); end_op(); return 0; } 8010512a: c9 leave 8010512b: c3 ret 8010512c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105130 <sys_chdir>: int sys_chdir(void) { 80105130: 55 push %ebp 80105131: 89 e5 mov %esp,%ebp 80105133: 56 push %esi 80105134: 53 push %ebx 80105135: 83 ec 20 sub $0x20,%esp char *path; struct inode *ip; struct proc *curproc = myproc(); 80105138: e8 f3 e5 ff ff call 80103730 <myproc> 8010513d: 89 c3 mov %eax,%ebx begin_op(); 8010513f: e8 2c da ff ff call 80102b70 <begin_op> if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){ 80105144: 8d 45 f4 lea -0xc(%ebp),%eax 80105147: 89 44 24 04 mov %eax,0x4(%esp) 8010514b: c7 04 24 00 00 00 00 movl $0x0,(%esp) 80105152: e8 89 f5 ff ff call 801046e0 <argstr> 80105157: 85 c0 test %eax,%eax 80105159: 78 4a js 801051a5 <sys_chdir+0x75> 8010515b: 8b 45 f4 mov -0xc(%ebp),%eax 8010515e: 89 04 24 mov %eax,(%esp) 80105161: e8 0a ce ff ff call 80101f70 <namei> 80105166: 85 c0 test %eax,%eax 80105168: 89 c6 mov %eax,%esi 8010516a: 74 39 je 801051a5 <sys_chdir+0x75> end_op(); return -1; } ilock(ip); 8010516c: 89 04 24 mov %eax,(%esp) 8010516f: e8 2c c5 ff ff call 801016a0 <ilock> if(ip->type != T_DIR){ 80105174: 66 83 7e 50 01 cmpw $0x1,0x50(%esi) iunlockput(ip); 80105179: 89 34 24 mov %esi,(%esp) if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){ end_op(); return -1; } ilock(ip); if(ip->type != T_DIR){ 8010517c: 75 22 jne 801051a0 <sys_chdir+0x70> iunlockput(ip); end_op(); return -1; } iunlock(ip); 8010517e: e8 fd c5 ff ff call 80101780 <iunlock> iput(curproc->cwd); 80105183: 8b 43 68 mov 0x68(%ebx),%eax 80105186: 89 04 24 mov %eax,(%esp) 80105189: e8 42 c6 ff ff call 801017d0 <iput> end_op(); 8010518e: e8 4d da ff ff call 80102be0 <end_op> curproc->cwd = ip; return 0; 80105193: 31 c0 xor %eax,%eax return -1; } iunlock(ip); iput(curproc->cwd); end_op(); curproc->cwd = ip; 80105195: 89 73 68 mov %esi,0x68(%ebx) return 0; } 80105198: 83 c4 20 add $0x20,%esp 8010519b: 5b pop %ebx 8010519c: 5e pop %esi 8010519d: 5d pop %ebp 8010519e: c3 ret 8010519f: 90 nop end_op(); return -1; } ilock(ip); if(ip->type != T_DIR){ iunlockput(ip); 801051a0: e8 8b c7 ff ff call 80101930 <iunlockput> end_op(); 801051a5: e8 36 da ff ff call 80102be0 <end_op> iunlock(ip); iput(curproc->cwd); end_op(); curproc->cwd = ip; return 0; } 801051aa: 83 c4 20 add $0x20,%esp } ilock(ip); if(ip->type != T_DIR){ iunlockput(ip); end_op(); return -1; 801051ad: b8 ff ff ff ff mov $0xffffffff,%eax iunlock(ip); iput(curproc->cwd); end_op(); curproc->cwd = ip; return 0; } 801051b2: 5b pop %ebx 801051b3: 5e pop %esi 801051b4: 5d pop %ebp 801051b5: c3 ret 801051b6: 8d 76 00 lea 0x0(%esi),%esi 801051b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801051c0 <sys_exec>: int sys_exec(void) { 801051c0: 55 push %ebp 801051c1: 89 e5 mov %esp,%ebp 801051c3: 57 push %edi 801051c4: 56 push %esi 801051c5: 53 push %ebx char *path, *argv[MAXARG]; int i; uint uargv, uarg; if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){ return -1; 801051c6: bb ff ff ff ff mov $0xffffffff,%ebx return 0; } int sys_exec(void) { 801051cb: 81 ec ac 00 00 00 sub $0xac,%esp char *path, *argv[MAXARG]; int i; uint uargv, uarg; if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){ 801051d1: 8d 45 dc lea -0x24(%ebp),%eax 801051d4: 89 44 24 04 mov %eax,0x4(%esp) 801051d8: c7 04 24 00 00 00 00 movl $0x0,(%esp) 801051df: e8 fc f4 ff ff call 801046e0 <argstr> 801051e4: 85 c0 test %eax,%eax 801051e6: 0f 88 82 00 00 00 js 8010526e <sys_exec+0xae> 801051ec: 8d 45 e0 lea -0x20(%ebp),%eax 801051ef: 89 44 24 04 mov %eax,0x4(%esp) 801051f3: c7 04 24 01 00 00 00 movl $0x1,(%esp) 801051fa: e8 41 f4 ff ff call 80104640 <argint> 801051ff: 85 c0 test %eax,%eax 80105201: 78 6b js 8010526e <sys_exec+0xae> return -1; } memset(argv, 0, sizeof(argv)); 80105203: 8d bd 5c ff ff ff lea -0xa4(%ebp),%edi for(i=0;; i++){ if(i >= NELEM(argv)) 80105209: 31 f6 xor %esi,%esi uint uargv, uarg; if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){ return -1; } memset(argv, 0, sizeof(argv)); 8010520b: c7 44 24 08 80 00 00 movl $0x80,0x8(%esp) 80105212: 00 for(i=0;; i++){ 80105213: 31 db xor %ebx,%ebx uint uargv, uarg; if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){ return -1; } memset(argv, 0, sizeof(argv)); 80105215: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 8010521c: 00 8010521d: 89 3c 24 mov %edi,(%esp) 80105220: e8 1b f1 ff ff call 80104340 <memset> 80105225: 8d 76 00 lea 0x0(%esi),%esi for(i=0;; i++){ if(i >= NELEM(argv)) return -1; if(fetchint(uargv+4*i, (int*)&uarg) < 0) 80105228: 8d 45 e4 lea -0x1c(%ebp),%eax 8010522b: 89 44 24 04 mov %eax,0x4(%esp) curproc->cwd = ip; return 0; } int sys_exec(void) 8010522f: 8d 04 9d 00 00 00 00 lea 0x0(,%ebx,4),%eax } memset(argv, 0, sizeof(argv)); for(i=0;; i++){ if(i >= NELEM(argv)) return -1; if(fetchint(uargv+4*i, (int*)&uarg) < 0) 80105236: 03 45 e0 add -0x20(%ebp),%eax 80105239: 89 04 24 mov %eax,(%esp) 8010523c: e8 6f f3 ff ff call 801045b0 <fetchint> 80105241: 85 c0 test %eax,%eax 80105243: 78 24 js 80105269 <sys_exec+0xa9> return -1; if(uarg == 0){ 80105245: 8b 45 e4 mov -0x1c(%ebp),%eax 80105248: 85 c0 test %eax,%eax 8010524a: 74 34 je 80105280 <sys_exec+0xc0> argv[i] = 0; break; } if(fetchstr(uarg, &argv[i]) < 0) 8010524c: 8d 14 b7 lea (%edi,%esi,4),%edx 8010524f: 89 54 24 04 mov %edx,0x4(%esp) 80105253: 89 04 24 mov %eax,(%esp) 80105256: e8 85 f3 ff ff call 801045e0 <fetchstr> 8010525b: 85 c0 test %eax,%eax 8010525d: 78 0a js 80105269 <sys_exec+0xa9> if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){ return -1; } memset(argv, 0, sizeof(argv)); for(i=0;; i++){ 8010525f: 83 c3 01 add $0x1,%ebx if(i >= NELEM(argv)) 80105262: 83 fb 20 cmp $0x20,%ebx 80105265: 89 de mov %ebx,%esi 80105267: 75 bf jne 80105228 <sys_exec+0x68> if(uarg == 0){ argv[i] = 0; break; } if(fetchstr(uarg, &argv[i]) < 0) return -1; 80105269: bb ff ff ff ff mov $0xffffffff,%ebx } return exec(path, argv); } 8010526e: 81 c4 ac 00 00 00 add $0xac,%esp 80105274: 89 d8 mov %ebx,%eax 80105276: 5b pop %ebx 80105277: 5e pop %esi 80105278: 5f pop %edi 80105279: 5d pop %ebp 8010527a: c3 ret 8010527b: 90 nop 8010527c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi break; } if(fetchstr(uarg, &argv[i]) < 0) return -1; } return exec(path, argv); 80105280: 8b 45 dc mov -0x24(%ebp),%eax if(i >= NELEM(argv)) return -1; if(fetchint(uargv+4*i, (int*)&uarg) < 0) return -1; if(uarg == 0){ argv[i] = 0; 80105283: c7 84 9d 5c ff ff ff movl $0x0,-0xa4(%ebp,%ebx,4) 8010528a: 00 00 00 00 break; } if(fetchstr(uarg, &argv[i]) < 0) return -1; } return exec(path, argv); 8010528e: 89 7c 24 04 mov %edi,0x4(%esp) 80105292: 89 04 24 mov %eax,(%esp) 80105295: e8 16 b7 ff ff call 801009b0 <exec> } 8010529a: 81 c4 ac 00 00 00 add $0xac,%esp break; } if(fetchstr(uarg, &argv[i]) < 0) return -1; } return exec(path, argv); 801052a0: 89 c3 mov %eax,%ebx } 801052a2: 89 d8 mov %ebx,%eax 801052a4: 5b pop %ebx 801052a5: 5e pop %esi 801052a6: 5f pop %edi 801052a7: 5d pop %ebp 801052a8: c3 ret 801052a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801052b0 <sys_pipe>: int sys_pipe(void) { 801052b0: 55 push %ebp 801052b1: 89 e5 mov %esp,%ebp 801052b3: 53 push %ebx int *fd; struct file *rf, *wf; int fd0, fd1; if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0) return -1; 801052b4: bb ff ff ff ff mov $0xffffffff,%ebx return exec(path, argv); } int sys_pipe(void) { 801052b9: 83 ec 24 sub $0x24,%esp int *fd; struct file *rf, *wf; int fd0, fd1; if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0) 801052bc: 8d 45 ec lea -0x14(%ebp),%eax 801052bf: c7 44 24 08 08 00 00 movl $0x8,0x8(%esp) 801052c6: 00 801052c7: 89 44 24 04 mov %eax,0x4(%esp) 801052cb: c7 04 24 00 00 00 00 movl $0x0,(%esp) 801052d2: e8 a9 f3 ff ff call 80104680 <argptr> 801052d7: 85 c0 test %eax,%eax 801052d9: 78 3d js 80105318 <sys_pipe+0x68> return -1; if(pipealloc(&rf, &wf) < 0) 801052db: 8d 45 f4 lea -0xc(%ebp),%eax 801052de: 89 44 24 04 mov %eax,0x4(%esp) 801052e2: 8d 45 f0 lea -0x10(%ebp),%eax 801052e5: 89 04 24 mov %eax,(%esp) 801052e8: e8 e3 de ff ff call 801031d0 <pipealloc> 801052ed: 85 c0 test %eax,%eax 801052ef: 78 27 js 80105318 <sys_pipe+0x68> return -1; fd0 = -1; if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){ 801052f1: 8b 45 f0 mov -0x10(%ebp),%eax 801052f4: e8 a7 f4 ff ff call 801047a0 <fdalloc> 801052f9: 85 c0 test %eax,%eax 801052fb: 89 c3 mov %eax,%ebx 801052fd: 78 2e js 8010532d <sys_pipe+0x7d> 801052ff: 8b 45 f4 mov -0xc(%ebp),%eax 80105302: e8 99 f4 ff ff call 801047a0 <fdalloc> 80105307: 85 c0 test %eax,%eax 80105309: 78 15 js 80105320 <sys_pipe+0x70> myproc()->ofile[fd0] = 0; fileclose(rf); fileclose(wf); return -1; } fd[0] = fd0; 8010530b: 8b 55 ec mov -0x14(%ebp),%edx 8010530e: 89 1a mov %ebx,(%edx) fd[1] = fd1; 80105310: 8b 55 ec mov -0x14(%ebp),%edx return 0; 80105313: 31 db xor %ebx,%ebx fileclose(rf); fileclose(wf); return -1; } fd[0] = fd0; fd[1] = fd1; 80105315: 89 42 04 mov %eax,0x4(%edx) return 0; } 80105318: 83 c4 24 add $0x24,%esp 8010531b: 89 d8 mov %ebx,%eax 8010531d: 5b pop %ebx 8010531e: 5d pop %ebp 8010531f: c3 ret if(pipealloc(&rf, &wf) < 0) return -1; fd0 = -1; if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){ if(fd0 >= 0) myproc()->ofile[fd0] = 0; 80105320: e8 0b e4 ff ff call 80103730 <myproc> 80105325: c7 44 98 28 00 00 00 movl $0x0,0x28(%eax,%ebx,4) 8010532c: 00 fileclose(rf); 8010532d: 8b 45 f0 mov -0x10(%ebp),%eax fileclose(wf); return -1; 80105330: bb ff ff ff ff mov $0xffffffff,%ebx return -1; fd0 = -1; if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){ if(fd0 >= 0) myproc()->ofile[fd0] = 0; fileclose(rf); 80105335: 89 04 24 mov %eax,(%esp) 80105338: e8 e3 ba ff ff call 80100e20 <fileclose> fileclose(wf); 8010533d: 8b 45 f4 mov -0xc(%ebp),%eax 80105340: 89 04 24 mov %eax,(%esp) 80105343: e8 d8 ba ff ff call 80100e20 <fileclose> return -1; 80105348: eb ce jmp 80105318 <sys_pipe+0x68> 8010534a: 00 00 add %al,(%eax) 8010534c: 00 00 add %al,(%eax) ... 80105350 <sys_fork>: #include "mmu.h" #include "proc.h" int sys_fork(void) { 80105350: 55 push %ebp 80105351: 89 e5 mov %esp,%ebp return fork(); } 80105353: 5d pop %ebp #include "proc.h" int sys_fork(void) { return fork(); 80105354: e9 87 e5 ff ff jmp 801038e0 <fork> 80105359: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105360 <sys_exit>: } int sys_exit(void) { 80105360: 55 push %ebp 80105361: 89 e5 mov %esp,%ebp 80105363: 83 ec 08 sub $0x8,%esp exit(); 80105366: e8 c5 e7 ff ff call 80103b30 <exit> return 0; // not reached } 8010536b: 31 c0 xor %eax,%eax 8010536d: c9 leave 8010536e: c3 ret 8010536f: 90 nop 80105370 <sys_wait>: int sys_wait(void) { 80105370: 55 push %ebp 80105371: 89 e5 mov %esp,%ebp return wait(); } 80105373: 5d pop %ebp } int sys_wait(void) { return wait(); 80105374: e9 d7 e9 ff ff jmp 80103d50 <wait> 80105379: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105380 <sys_kill>: } int sys_kill(void) { 80105380: 55 push %ebp 80105381: 89 e5 mov %esp,%ebp 80105383: 83 ec 28 sub $0x28,%esp int pid; if(argint(0, &pid) < 0) 80105386: 8d 45 f4 lea -0xc(%ebp),%eax 80105389: 89 44 24 04 mov %eax,0x4(%esp) 8010538d: c7 04 24 00 00 00 00 movl $0x0,(%esp) 80105394: e8 a7 f2 ff ff call 80104640 <argint> 80105399: 89 c2 mov %eax,%edx return -1; 8010539b: b8 ff ff ff ff mov $0xffffffff,%eax int sys_kill(void) { int pid; if(argint(0, &pid) < 0) 801053a0: 85 d2 test %edx,%edx 801053a2: 78 0b js 801053af <sys_kill+0x2f> return -1; return kill(pid); 801053a4: 8b 45 f4 mov -0xc(%ebp),%eax 801053a7: 89 04 24 mov %eax,(%esp) 801053aa: e8 e1 ea ff ff call 80103e90 <kill> } 801053af: c9 leave 801053b0: c3 ret 801053b1: eb 0d jmp 801053c0 <sys_getpid> 801053b3: 90 nop 801053b4: 90 nop 801053b5: 90 nop 801053b6: 90 nop 801053b7: 90 nop 801053b8: 90 nop 801053b9: 90 nop 801053ba: 90 nop 801053bb: 90 nop 801053bc: 90 nop 801053bd: 90 nop 801053be: 90 nop 801053bf: 90 nop 801053c0 <sys_getpid>: int sys_getpid(void) { 801053c0: 55 push %ebp 801053c1: 89 e5 mov %esp,%ebp 801053c3: 83 ec 08 sub $0x8,%esp return myproc()->pid; 801053c6: e8 65 e3 ff ff call 80103730 <myproc> 801053cb: 8b 40 10 mov 0x10(%eax),%eax } 801053ce: c9 leave 801053cf: c3 ret 801053d0 <sys_sbrk>: int sys_sbrk(void) { 801053d0: 55 push %ebp 801053d1: 89 e5 mov %esp,%ebp 801053d3: 83 ec 28 sub $0x28,%esp int addr; int n; if(argint(0, &n) < 0) 801053d6: 8d 45 f4 lea -0xc(%ebp),%eax return myproc()->pid; } int sys_sbrk(void) { 801053d9: 89 5d f8 mov %ebx,-0x8(%ebp) int addr; int n; if(argint(0, &n) < 0) return -1; 801053dc: bb ff ff ff ff mov $0xffffffff,%ebx return myproc()->pid; } int sys_sbrk(void) { 801053e1: 89 75 fc mov %esi,-0x4(%ebp) int addr; int n; if(argint(0, &n) < 0) 801053e4: 89 44 24 04 mov %eax,0x4(%esp) 801053e8: c7 04 24 00 00 00 00 movl $0x0,(%esp) 801053ef: e8 4c f2 ff ff call 80104640 <argint> 801053f4: 85 c0 test %eax,%eax 801053f6: 78 17 js 8010540f <sys_sbrk+0x3f> return -1; addr = myproc()->sz; 801053f8: e8 33 e3 ff ff call 80103730 <myproc> 801053fd: 8b 30 mov (%eax),%esi if(growproc(n) < 0) 801053ff: 8b 45 f4 mov -0xc(%ebp),%eax 80105402: 89 04 24 mov %eax,(%esp) 80105405: e8 56 e4 ff ff call 80103860 <growproc> int addr; int n; if(argint(0, &n) < 0) return -1; addr = myproc()->sz; 8010540a: 85 c0 test %eax,%eax 8010540c: 0f 49 de cmovns %esi,%ebx if(growproc(n) < 0) return -1; return addr; } 8010540f: 89 d8 mov %ebx,%eax 80105411: 8b 75 fc mov -0x4(%ebp),%esi 80105414: 8b 5d f8 mov -0x8(%ebp),%ebx 80105417: 89 ec mov %ebp,%esp 80105419: 5d pop %ebp 8010541a: c3 ret 8010541b: 90 nop 8010541c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105420 <sys_sleep>: int sys_sleep(void) { 80105420: 55 push %ebp 80105421: 89 e5 mov %esp,%ebp 80105423: 53 push %ebx 80105424: 83 ec 24 sub $0x24,%esp int n; uint ticks0; if(argint(0, &n) < 0) 80105427: 8d 45 f4 lea -0xc(%ebp),%eax 8010542a: 89 44 24 04 mov %eax,0x4(%esp) 8010542e: c7 04 24 00 00 00 00 movl $0x0,(%esp) 80105435: e8 06 f2 ff ff call 80104640 <argint> return -1; 8010543a: ba ff ff ff ff mov $0xffffffff,%edx sys_sleep(void) { int n; uint ticks0; if(argint(0, &n) < 0) 8010543f: 85 c0 test %eax,%eax 80105441: 78 5a js 8010549d <sys_sleep+0x7d> return -1; acquire(&tickslock); 80105443: c7 04 24 60 4c 11 80 movl $0x80114c60,(%esp) 8010544a: e8 31 ee ff ff call 80104280 <acquire> ticks0 = ticks; while(ticks - ticks0 < n){ 8010544f: 8b 55 f4 mov -0xc(%ebp),%edx uint ticks0; if(argint(0, &n) < 0) return -1; acquire(&tickslock); ticks0 = ticks; 80105452: 8b 1d a0 54 11 80 mov 0x801154a0,%ebx while(ticks - ticks0 < n){ 80105458: 85 d2 test %edx,%edx 8010545a: 75 24 jne 80105480 <sys_sleep+0x60> 8010545c: eb 4a jmp 801054a8 <sys_sleep+0x88> 8010545e: 66 90 xchg %ax,%ax if(myproc()->killed){ release(&tickslock); return -1; } sleep(&ticks, &tickslock); 80105460: c7 44 24 04 60 4c 11 movl $0x80114c60,0x4(%esp) 80105467: 80 80105468: c7 04 24 a0 54 11 80 movl $0x801154a0,(%esp) 8010546f: e8 1c e8 ff ff call 80103c90 <sleep> if(argint(0, &n) < 0) return -1; acquire(&tickslock); ticks0 = ticks; while(ticks - ticks0 < n){ 80105474: a1 a0 54 11 80 mov 0x801154a0,%eax 80105479: 29 d8 sub %ebx,%eax 8010547b: 3b 45 f4 cmp -0xc(%ebp),%eax 8010547e: 73 28 jae 801054a8 <sys_sleep+0x88> if(myproc()->killed){ 80105480: e8 ab e2 ff ff call 80103730 <myproc> 80105485: 8b 40 24 mov 0x24(%eax),%eax 80105488: 85 c0 test %eax,%eax 8010548a: 74 d4 je 80105460 <sys_sleep+0x40> release(&tickslock); 8010548c: c7 04 24 60 4c 11 80 movl $0x80114c60,(%esp) 80105493: e8 58 ee ff ff call 801042f0 <release> return -1; 80105498: ba ff ff ff ff mov $0xffffffff,%edx } sleep(&ticks, &tickslock); } release(&tickslock); return 0; } 8010549d: 83 c4 24 add $0x24,%esp 801054a0: 89 d0 mov %edx,%eax 801054a2: 5b pop %ebx 801054a3: 5d pop %ebp 801054a4: c3 ret 801054a5: 8d 76 00 lea 0x0(%esi),%esi release(&tickslock); return -1; } sleep(&ticks, &tickslock); } release(&tickslock); 801054a8: c7 04 24 60 4c 11 80 movl $0x80114c60,(%esp) 801054af: e8 3c ee ff ff call 801042f0 <release> return 0; } 801054b4: 83 c4 24 add $0x24,%esp return -1; } sleep(&ticks, &tickslock); } release(&tickslock); return 0; 801054b7: 31 d2 xor %edx,%edx } 801054b9: 89 d0 mov %edx,%eax 801054bb: 5b pop %ebx 801054bc: 5d pop %ebp 801054bd: c3 ret 801054be: 66 90 xchg %ax,%ax 801054c0 <sys_uptime>: // return how many clock tick interrupts have occurred // since start. int sys_uptime(void) { 801054c0: 55 push %ebp 801054c1: 89 e5 mov %esp,%ebp 801054c3: 53 push %ebx 801054c4: 83 ec 14 sub $0x14,%esp uint xticks; acquire(&tickslock); 801054c7: c7 04 24 60 4c 11 80 movl $0x80114c60,(%esp) 801054ce: e8 ad ed ff ff call 80104280 <acquire> xticks = ticks; 801054d3: 8b 1d a0 54 11 80 mov 0x801154a0,%ebx release(&tickslock); 801054d9: c7 04 24 60 4c 11 80 movl $0x80114c60,(%esp) 801054e0: e8 0b ee ff ff call 801042f0 <release> return xticks; } 801054e5: 83 c4 14 add $0x14,%esp 801054e8: 89 d8 mov %ebx,%eax 801054ea: 5b pop %ebx 801054eb: 5d pop %ebp 801054ec: c3 ret 801054ed: 00 00 add %al,(%eax) ... 801054f0 <alltraps>: # vectors.S sends all traps here. .globl alltraps alltraps: # Build trap frame. pushl %ds 801054f0: 1e push %ds pushl %es 801054f1: 06 push %es pushl %fs 801054f2: 0f a0 push %fs pushl %gs 801054f4: 0f a8 push %gs pushal 801054f6: 60 pusha # Set up data segments. movw $(SEG_KDATA<<3), %ax 801054f7: 66 b8 10 00 mov $0x10,%ax movw %ax, %ds 801054fb: 8e d8 mov %eax,%ds movw %ax, %es 801054fd: 8e c0 mov %eax,%es # Call trap(tf), where tf=%esp pushl %esp 801054ff: 54 push %esp call trap 80105500: e8 db 00 00 00 call 801055e0 <trap> addl $4, %esp 80105505: 83 c4 04 add $0x4,%esp 80105508 <trapret>: # Return falls through to trapret... .globl trapret trapret: popal 80105508: 61 popa popl %gs 80105509: 0f a9 pop %gs popl %fs 8010550b: 0f a1 pop %fs popl %es 8010550d: 07 pop %es popl %ds 8010550e: 1f pop %ds addl $0x8, %esp # trapno and errcode 8010550f: 83 c4 08 add $0x8,%esp iret 80105512: cf iret ... 80105520 <tvinit>: struct spinlock tickslock; uint ticks; void tvinit(void) { 80105520: 55 push %ebp int i; for(i = 0; i < 256; i++) 80105521: 31 c0 xor %eax,%eax struct spinlock tickslock; uint ticks; void tvinit(void) { 80105523: 89 e5 mov %esp,%ebp 80105525: ba a0 4c 11 80 mov $0x80114ca0,%edx 8010552a: 83 ec 18 sub $0x18,%esp 8010552d: 8d 76 00 lea 0x0(%esi),%esi int i; for(i = 0; i < 256; i++) SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0); 80105530: 8b 0c 85 08 a0 10 80 mov -0x7fef5ff8(,%eax,4),%ecx 80105537: 66 89 0c c5 a0 4c 11 mov %cx,-0x7feeb360(,%eax,8) 8010553e: 80 8010553f: c1 e9 10 shr $0x10,%ecx 80105542: 66 c7 44 c2 02 08 00 movw $0x8,0x2(%edx,%eax,8) 80105549: c6 44 c2 04 00 movb $0x0,0x4(%edx,%eax,8) 8010554e: c6 44 c2 05 8e movb $0x8e,0x5(%edx,%eax,8) 80105553: 66 89 4c c2 06 mov %cx,0x6(%edx,%eax,8) void tvinit(void) { int i; for(i = 0; i < 256; i++) 80105558: 83 c0 01 add $0x1,%eax 8010555b: 3d 00 01 00 00 cmp $0x100,%eax 80105560: 75 ce jne 80105530 <tvinit+0x10> SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0); SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER); 80105562: a1 08 a1 10 80 mov 0x8010a108,%eax initlock(&tickslock, "time"); 80105567: c7 44 24 04 b9 74 10 movl $0x801074b9,0x4(%esp) 8010556e: 80 8010556f: c7 04 24 60 4c 11 80 movl $0x80114c60,(%esp) { int i; for(i = 0; i < 256; i++) SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0); SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER); 80105576: 66 c7 05 a2 4e 11 80 movw $0x8,0x80114ea2 8010557d: 08 00 8010557f: 66 a3 a0 4e 11 80 mov %ax,0x80114ea0 80105585: c1 e8 10 shr $0x10,%eax 80105588: c6 05 a4 4e 11 80 00 movb $0x0,0x80114ea4 8010558f: c6 05 a5 4e 11 80 ef movb $0xef,0x80114ea5 80105596: 66 a3 a6 4e 11 80 mov %ax,0x80114ea6 initlock(&tickslock, "time"); 8010559c: e8 6f eb ff ff call 80104110 <initlock> } 801055a1: c9 leave 801055a2: c3 ret 801055a3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801055a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801055b0 <idtinit>: void idtinit(void) { 801055b0: 55 push %ebp lidt(struct gatedesc *p, int size) { volatile ushort pd[3]; pd[0] = size-1; pd[1] = (uint)p; 801055b1: b8 a0 4c 11 80 mov $0x80114ca0,%eax 801055b6: 89 e5 mov %esp,%ebp 801055b8: 83 ec 10 sub $0x10,%esp static inline void lidt(struct gatedesc *p, int size) { volatile ushort pd[3]; pd[0] = size-1; 801055bb: 66 c7 45 fa ff 07 movw $0x7ff,-0x6(%ebp) pd[1] = (uint)p; 801055c1: 66 89 45 fc mov %ax,-0x4(%ebp) pd[2] = (uint)p >> 16; 801055c5: c1 e8 10 shr $0x10,%eax 801055c8: 66 89 45 fe mov %ax,-0x2(%ebp) asm volatile("lidt (%0)" : : "r" (pd)); 801055cc: 8d 45 fa lea -0x6(%ebp),%eax 801055cf: 0f 01 18 lidtl (%eax) lidt(idt, sizeof(idt)); } 801055d2: c9 leave 801055d3: c3 ret 801055d4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801055da: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 801055e0 <trap>: //PAGEBREAK: 41 void trap(struct trapframe *tf) { 801055e0: 55 push %ebp 801055e1: 89 e5 mov %esp,%ebp 801055e3: 83 ec 48 sub $0x48,%esp 801055e6: 89 5d f4 mov %ebx,-0xc(%ebp) 801055e9: 8b 5d 08 mov 0x8(%ebp),%ebx 801055ec: 89 75 f8 mov %esi,-0x8(%ebp) 801055ef: 89 7d fc mov %edi,-0x4(%ebp) if(tf->trapno == T_SYSCALL){ 801055f2: 8b 43 30 mov 0x30(%ebx),%eax 801055f5: 83 f8 40 cmp $0x40,%eax 801055f8: 0f 84 d2 01 00 00 je 801057d0 <trap+0x1f0> if(myproc()->killed) exit(); return; } switch(tf->trapno){ 801055fe: 83 e8 20 sub $0x20,%eax 80105601: 83 f8 1f cmp $0x1f,%eax 80105604: 0f 86 fe 00 00 00 jbe 80105708 <trap+0x128> lapiceoi(); break; //PAGEBREAK: 13 default: if(myproc() == 0 || (tf->cs&3) == 0){ 8010560a: e8 21 e1 ff ff call 80103730 <myproc> 8010560f: 85 c0 test %eax,%eax 80105611: 0f 84 10 02 00 00 je 80105827 <trap+0x247> 80105617: f6 43 3c 03 testb $0x3,0x3c(%ebx) 8010561b: 0f 84 06 02 00 00 je 80105827 <trap+0x247> static inline uint rcr2(void) { uint val; asm volatile("movl %%cr2,%0" : "=r" (val)); 80105621: 0f 20 d2 mov %cr2,%edx cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", tf->trapno, cpuid(), tf->eip, rcr2()); panic("trap"); } // In user space, assume process misbehaved. cprintf("pid %d %s: trap %d err %d on cpu %d " 80105624: 8b 7b 38 mov 0x38(%ebx),%edi 80105627: 89 55 dc mov %edx,-0x24(%ebp) 8010562a: e8 e1 e0 ff ff call 80103710 <cpuid> 8010562f: 8b 4b 34 mov 0x34(%ebx),%ecx 80105632: 89 c6 mov %eax,%esi 80105634: 8b 43 30 mov 0x30(%ebx),%eax "eip 0x%x addr 0x%x--kill proc\n", myproc()->pid, myproc()->name, tf->trapno, 80105637: 89 4d d8 mov %ecx,-0x28(%ebp) cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", tf->trapno, cpuid(), tf->eip, rcr2()); panic("trap"); } // In user space, assume process misbehaved. cprintf("pid %d %s: trap %d err %d on cpu %d " 8010563a: 89 45 e4 mov %eax,-0x1c(%ebp) "eip 0x%x addr 0x%x--kill proc\n", myproc()->pid, myproc()->name, tf->trapno, 8010563d: e8 ee e0 ff ff call 80103730 <myproc> 80105642: 89 45 e0 mov %eax,-0x20(%ebp) 80105645: e8 e6 e0 ff ff call 80103730 <myproc> cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", tf->trapno, cpuid(), tf->eip, rcr2()); panic("trap"); } // In user space, assume process misbehaved. cprintf("pid %d %s: trap %d err %d on cpu %d " 8010564a: 8b 55 dc mov -0x24(%ebp),%edx 8010564d: 8b 4d d8 mov -0x28(%ebp),%ecx 80105650: 89 7c 24 18 mov %edi,0x18(%esp) 80105654: 89 74 24 14 mov %esi,0x14(%esp) 80105658: 89 54 24 1c mov %edx,0x1c(%esp) 8010565c: 8b 55 e4 mov -0x1c(%ebp),%edx 8010565f: 89 4c 24 10 mov %ecx,0x10(%esp) 80105663: 89 54 24 0c mov %edx,0xc(%esp) "eip 0x%x addr 0x%x--kill proc\n", myproc()->pid, myproc()->name, tf->trapno, 80105667: 8b 55 e0 mov -0x20(%ebp),%edx 8010566a: 83 c2 6c add $0x6c,%edx 8010566d: 89 54 24 08 mov %edx,0x8(%esp) cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", tf->trapno, cpuid(), tf->eip, rcr2()); panic("trap"); } // In user space, assume process misbehaved. cprintf("pid %d %s: trap %d err %d on cpu %d " 80105671: 8b 40 10 mov 0x10(%eax),%eax 80105674: c7 04 24 1c 75 10 80 movl $0x8010751c,(%esp) 8010567b: 89 44 24 04 mov %eax,0x4(%esp) 8010567f: e8 cc af ff ff call 80100650 <cprintf> "eip 0x%x addr 0x%x--kill proc\n", myproc()->pid, myproc()->name, tf->trapno, tf->err, cpuid(), tf->eip, rcr2()); myproc()->killed = 1; 80105684: e8 a7 e0 ff ff call 80103730 <myproc> 80105689: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) } // Force process exit if it has been killed and is in user space. // (If it is still executing in the kernel, let it keep running // until it gets to the regular system call return.) if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) 80105690: e8 9b e0 ff ff call 80103730 <myproc> 80105695: 85 c0 test %eax,%eax 80105697: 74 1c je 801056b5 <trap+0xd5> 80105699: e8 92 e0 ff ff call 80103730 <myproc> 8010569e: 8b 50 24 mov 0x24(%eax),%edx 801056a1: 85 d2 test %edx,%edx 801056a3: 74 10 je 801056b5 <trap+0xd5> 801056a5: 0f b7 43 3c movzwl 0x3c(%ebx),%eax 801056a9: 83 e0 03 and $0x3,%eax 801056ac: 83 f8 03 cmp $0x3,%eax 801056af: 0f 84 5b 01 00 00 je 80105810 <trap+0x230> exit(); // Force process to give up CPU on clock tick. // If interrupts were on while locks held, would need to check nlock. if(myproc() && myproc()->state == RUNNING && 801056b5: e8 76 e0 ff ff call 80103730 <myproc> 801056ba: 85 c0 test %eax,%eax 801056bc: 74 11 je 801056cf <trap+0xef> 801056be: 66 90 xchg %ax,%ax 801056c0: e8 6b e0 ff ff call 80103730 <myproc> 801056c5: 83 78 0c 04 cmpl $0x4,0xc(%eax) 801056c9: 0f 84 e1 00 00 00 je 801057b0 <trap+0x1d0> tf->trapno == T_IRQ0+IRQ_TIMER) yield(); // Check if the process has been killed since we yielded if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) 801056cf: e8 5c e0 ff ff call 80103730 <myproc> 801056d4: 85 c0 test %eax,%eax 801056d6: 74 1c je 801056f4 <trap+0x114> 801056d8: e8 53 e0 ff ff call 80103730 <myproc> 801056dd: 8b 40 24 mov 0x24(%eax),%eax 801056e0: 85 c0 test %eax,%eax 801056e2: 74 10 je 801056f4 <trap+0x114> 801056e4: 0f b7 43 3c movzwl 0x3c(%ebx),%eax 801056e8: 83 e0 03 and $0x3,%eax 801056eb: 83 f8 03 cmp $0x3,%eax 801056ee: 0f 84 05 01 00 00 je 801057f9 <trap+0x219> exit(); } 801056f4: 8b 5d f4 mov -0xc(%ebp),%ebx 801056f7: 8b 75 f8 mov -0x8(%ebp),%esi 801056fa: 8b 7d fc mov -0x4(%ebp),%edi 801056fd: 89 ec mov %ebp,%esp 801056ff: 5d pop %ebp 80105700: c3 ret 80105701: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(myproc()->killed) exit(); return; } switch(tf->trapno){ 80105708: ff 24 85 60 75 10 80 jmp *-0x7fef8aa0(,%eax,4) 8010570f: 90 nop release(&tickslock); } lapiceoi(); break; case T_IRQ0 + IRQ_IDE: ideintr(); 80105710: e8 db c9 ff ff call 801020f0 <ideintr> lapiceoi(); 80105715: e8 f6 cf ff ff call 80102710 <lapiceoi> break; 8010571a: e9 71 ff ff ff jmp 80105690 <trap+0xb0> 8010571f: 90 nop uartintr(); lapiceoi(); break; case T_IRQ0 + 7: case T_IRQ0 + IRQ_SPURIOUS: cprintf("cpu%d: spurious interrupt at %x:%x\n", 80105720: 8b 7b 38 mov 0x38(%ebx),%edi 80105723: 0f b7 73 3c movzwl 0x3c(%ebx),%esi 80105727: e8 e4 df ff ff call 80103710 <cpuid> 8010572c: c7 04 24 c4 74 10 80 movl $0x801074c4,(%esp) 80105733: 89 7c 24 0c mov %edi,0xc(%esp) 80105737: 89 74 24 08 mov %esi,0x8(%esp) 8010573b: 89 44 24 04 mov %eax,0x4(%esp) 8010573f: e8 0c af ff ff call 80100650 <cprintf> cpuid(), tf->cs, tf->eip); lapiceoi(); 80105744: e8 c7 cf ff ff call 80102710 <lapiceoi> break; 80105749: e9 42 ff ff ff jmp 80105690 <trap+0xb0> 8010574e: 66 90 xchg %ax,%ax case T_IRQ0 + IRQ_KBD: kbdintr(); lapiceoi(); break; case T_IRQ0 + IRQ_COM1: uartintr(); 80105750: e8 2b 02 00 00 call 80105980 <uartintr> lapiceoi(); 80105755: e8 b6 cf ff ff call 80102710 <lapiceoi> break; 8010575a: e9 31 ff ff ff jmp 80105690 <trap+0xb0> 8010575f: 90 nop break; case T_IRQ0 + IRQ_IDE+1: // Bochs generates spurious IDE1 interrupts. break; case T_IRQ0 + IRQ_KBD: kbdintr(); 80105760: e8 7b ce ff ff call 801025e0 <kbdintr> lapiceoi(); 80105765: e8 a6 cf ff ff call 80102710 <lapiceoi> break; 8010576a: e9 21 ff ff ff jmp 80105690 <trap+0xb0> 8010576f: 90 nop return; } switch(tf->trapno){ case T_IRQ0 + IRQ_TIMER: if(cpuid() == 0){ 80105770: e8 9b df ff ff call 80103710 <cpuid> 80105775: 85 c0 test %eax,%eax 80105777: 75 9c jne 80105715 <trap+0x135> acquire(&tickslock); 80105779: c7 04 24 60 4c 11 80 movl $0x80114c60,(%esp) 80105780: e8 fb ea ff ff call 80104280 <acquire> ticks++; 80105785: 83 05 a0 54 11 80 01 addl $0x1,0x801154a0 wakeup(&ticks); 8010578c: c7 04 24 a0 54 11 80 movl $0x801154a0,(%esp) 80105793: e8 98 e6 ff ff call 80103e30 <wakeup> release(&tickslock); 80105798: c7 04 24 60 4c 11 80 movl $0x80114c60,(%esp) 8010579f: e8 4c eb ff ff call 801042f0 <release> 801057a4: e9 6c ff ff ff jmp 80105715 <trap+0x135> 801057a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) exit(); // Force process to give up CPU on clock tick. // If interrupts were on while locks held, would need to check nlock. if(myproc() && myproc()->state == RUNNING && 801057b0: 83 7b 30 20 cmpl $0x20,0x30(%ebx) 801057b4: 0f 85 15 ff ff ff jne 801056cf <trap+0xef> 801057ba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi tf->trapno == T_IRQ0+IRQ_TIMER) yield(); 801057c0: e8 8b e4 ff ff call 80103c50 <yield> 801057c5: e9 05 ff ff ff jmp 801056cf <trap+0xef> 801057ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi //PAGEBREAK: 41 void trap(struct trapframe *tf) { if(tf->trapno == T_SYSCALL){ if(myproc()->killed) 801057d0: e8 5b df ff ff call 80103730 <myproc> 801057d5: 8b 70 24 mov 0x24(%eax),%esi 801057d8: 85 f6 test %esi,%esi 801057da: 75 44 jne 80105820 <trap+0x240> exit(); myproc()->tf = tf; 801057dc: e8 4f df ff ff call 80103730 <myproc> 801057e1: 89 58 18 mov %ebx,0x18(%eax) syscall(); 801057e4: e8 37 ef ff ff call 80104720 <syscall> if(myproc()->killed) 801057e9: e8 42 df ff ff call 80103730 <myproc> 801057ee: 8b 48 24 mov 0x24(%eax),%ecx 801057f1: 85 c9 test %ecx,%ecx 801057f3: 0f 84 fb fe ff ff je 801056f4 <trap+0x114> yield(); // Check if the process has been killed since we yielded if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) exit(); } 801057f9: 8b 5d f4 mov -0xc(%ebp),%ebx 801057fc: 8b 75 f8 mov -0x8(%ebp),%esi 801057ff: 8b 7d fc mov -0x4(%ebp),%edi 80105802: 89 ec mov %ebp,%esp 80105804: 5d pop %ebp tf->trapno == T_IRQ0+IRQ_TIMER) yield(); // Check if the process has been killed since we yielded if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) exit(); 80105805: e9 26 e3 ff ff jmp 80103b30 <exit> 8010580a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi // Force process exit if it has been killed and is in user space. // (If it is still executing in the kernel, let it keep running // until it gets to the regular system call return.) if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) exit(); 80105810: e8 1b e3 ff ff call 80103b30 <exit> 80105815: e9 9b fe ff ff jmp 801056b5 <trap+0xd5> 8010581a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi void trap(struct trapframe *tf) { if(tf->trapno == T_SYSCALL){ if(myproc()->killed) exit(); 80105820: e8 0b e3 ff ff call 80103b30 <exit> 80105825: eb b5 jmp 801057dc <trap+0x1fc> 80105827: 0f 20 d7 mov %cr2,%edi //PAGEBREAK: 13 default: if(myproc() == 0 || (tf->cs&3) == 0){ // In kernel, it must be our mistake. cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", 8010582a: 8b 73 38 mov 0x38(%ebx),%esi 8010582d: 8d 76 00 lea 0x0(%esi),%esi 80105830: e8 db de ff ff call 80103710 <cpuid> 80105835: 89 7c 24 10 mov %edi,0x10(%esp) 80105839: 89 74 24 0c mov %esi,0xc(%esp) 8010583d: 89 44 24 08 mov %eax,0x8(%esp) 80105841: 8b 43 30 mov 0x30(%ebx),%eax 80105844: c7 04 24 e8 74 10 80 movl $0x801074e8,(%esp) 8010584b: 89 44 24 04 mov %eax,0x4(%esp) 8010584f: e8 fc ad ff ff call 80100650 <cprintf> tf->trapno, cpuid(), tf->eip, rcr2()); panic("trap"); 80105854: c7 04 24 be 74 10 80 movl $0x801074be,(%esp) 8010585b: e8 10 ab ff ff call 80100370 <panic> 80105860 <uartgetc>: } static int uartgetc(void) { if(!uart) 80105860: a1 a4 a5 10 80 mov 0x8010a5a4,%eax return -1; 80105865: b9 ff ff ff ff mov $0xffffffff,%ecx outb(COM1+0, c); } static int uartgetc(void) { 8010586a: 55 push %ebp 8010586b: 89 e5 mov %esp,%ebp if(!uart) 8010586d: 85 c0 test %eax,%eax 8010586f: 74 10 je 80105881 <uartgetc+0x21> static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80105871: ba fd 03 00 00 mov $0x3fd,%edx 80105876: ec in (%dx),%al return -1; if(!(inb(COM1+5) & 0x01)) 80105877: a8 01 test $0x1,%al 80105879: 74 06 je 80105881 <uartgetc+0x21> 8010587b: b2 f8 mov $0xf8,%dl 8010587d: ec in (%dx),%al return -1; return inb(COM1+0); 8010587e: 0f b6 c8 movzbl %al,%ecx } 80105881: 89 c8 mov %ecx,%eax 80105883: 5d pop %ebp 80105884: c3 ret 80105885: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105889: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80105890 <uartputc>: uartputc(*p); } void uartputc(int c) { 80105890: 55 push %ebp 80105891: 89 e5 mov %esp,%ebp 80105893: 56 push %esi 80105894: be fd 03 00 00 mov $0x3fd,%esi 80105899: 53 push %ebx int i; if(!uart) 8010589a: bb 80 00 00 00 mov $0x80,%ebx uartputc(*p); } void uartputc(int c) { 8010589f: 83 ec 10 sub $0x10,%esp int i; if(!uart) 801058a2: 8b 15 a4 a5 10 80 mov 0x8010a5a4,%edx 801058a8: 85 d2 test %edx,%edx 801058aa: 75 15 jne 801058c1 <uartputc+0x31> 801058ac: eb 23 jmp 801058d1 <uartputc+0x41> 801058ae: 66 90 xchg %ax,%ax return; for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++) microdelay(10); 801058b0: c7 04 24 0a 00 00 00 movl $0xa,(%esp) 801058b7: e8 74 ce ff ff call 80102730 <microdelay> { int i; if(!uart) return; for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++) 801058bc: 83 eb 01 sub $0x1,%ebx 801058bf: 74 07 je 801058c8 <uartputc+0x38> 801058c1: 89 f2 mov %esi,%edx 801058c3: ec in (%dx),%al 801058c4: a8 20 test $0x20,%al 801058c6: 74 e8 je 801058b0 <uartputc+0x20> } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801058c8: ba f8 03 00 00 mov $0x3f8,%edx 801058cd: 8b 45 08 mov 0x8(%ebp),%eax 801058d0: ee out %al,(%dx) microdelay(10); outb(COM1+0, c); } 801058d1: 83 c4 10 add $0x10,%esp 801058d4: 5b pop %ebx 801058d5: 5e pop %esi 801058d6: 5d pop %ebp 801058d7: c3 ret 801058d8: 90 nop 801058d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801058e0 <uartinit>: static int uart; // is there a uart? void uartinit(void) { 801058e0: 55 push %ebp 801058e1: 31 c9 xor %ecx,%ecx 801058e3: 89 e5 mov %esp,%ebp 801058e5: 89 c8 mov %ecx,%eax 801058e7: 57 push %edi 801058e8: bf fa 03 00 00 mov $0x3fa,%edi 801058ed: 56 push %esi 801058ee: 89 fa mov %edi,%edx 801058f0: 53 push %ebx 801058f1: 83 ec 1c sub $0x1c,%esp 801058f4: ee out %al,(%dx) 801058f5: bb fb 03 00 00 mov $0x3fb,%ebx 801058fa: b8 80 ff ff ff mov $0xffffff80,%eax 801058ff: 89 da mov %ebx,%edx 80105901: ee out %al,(%dx) 80105902: b8 0c 00 00 00 mov $0xc,%eax 80105907: b2 f8 mov $0xf8,%dl 80105909: ee out %al,(%dx) 8010590a: be f9 03 00 00 mov $0x3f9,%esi 8010590f: 89 c8 mov %ecx,%eax 80105911: 89 f2 mov %esi,%edx 80105913: ee out %al,(%dx) 80105914: b8 03 00 00 00 mov $0x3,%eax 80105919: 89 da mov %ebx,%edx 8010591b: ee out %al,(%dx) 8010591c: b2 fc mov $0xfc,%dl 8010591e: 89 c8 mov %ecx,%eax 80105920: ee out %al,(%dx) 80105921: b8 01 00 00 00 mov $0x1,%eax 80105926: 89 f2 mov %esi,%edx 80105928: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80105929: b2 fd mov $0xfd,%dl 8010592b: ec in (%dx),%al outb(COM1+3, 0x03); // Lock divisor, 8 data bits. outb(COM1+4, 0); outb(COM1+1, 0x01); // Enable receive interrupts. // If status is 0xFF, no serial port. if(inb(COM1+5) == 0xFF) 8010592c: 3c ff cmp $0xff,%al 8010592e: 74 45 je 80105975 <uartinit+0x95> return; uart = 1; 80105930: c7 05 a4 a5 10 80 01 movl $0x1,0x8010a5a4 80105937: 00 00 00 8010593a: 89 fa mov %edi,%edx 8010593c: ec in (%dx),%al 8010593d: b2 f8 mov $0xf8,%dl 8010593f: ec in (%dx),%al inb(COM1+2); inb(COM1+0); ioapicenable(IRQ_COM1, 0); // Announce that we're here. for(p="xv6...\n"; *p; p++) 80105940: bb e0 75 10 80 mov $0x801075e0,%ebx // Acknowledge pre-existing interrupt conditions; // enable interrupts. inb(COM1+2); inb(COM1+0); ioapicenable(IRQ_COM1, 0); 80105945: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 8010594c: 00 8010594d: c7 04 24 04 00 00 00 movl $0x4,(%esp) 80105954: e8 a7 c9 ff ff call 80102300 <ioapicenable> // Announce that we're here. for(p="xv6...\n"; *p; p++) 80105959: b8 78 00 00 00 mov $0x78,%eax 8010595e: 66 90 xchg %ax,%ax uartputc(*p); 80105960: 0f be c0 movsbl %al,%eax inb(COM1+2); inb(COM1+0); ioapicenable(IRQ_COM1, 0); // Announce that we're here. for(p="xv6...\n"; *p; p++) 80105963: 83 c3 01 add $0x1,%ebx uartputc(*p); 80105966: 89 04 24 mov %eax,(%esp) 80105969: e8 22 ff ff ff call 80105890 <uartputc> inb(COM1+2); inb(COM1+0); ioapicenable(IRQ_COM1, 0); // Announce that we're here. for(p="xv6...\n"; *p; p++) 8010596e: 0f b6 03 movzbl (%ebx),%eax 80105971: 84 c0 test %al,%al 80105973: 75 eb jne 80105960 <uartinit+0x80> uartputc(*p); } 80105975: 83 c4 1c add $0x1c,%esp 80105978: 5b pop %ebx 80105979: 5e pop %esi 8010597a: 5f pop %edi 8010597b: 5d pop %ebp 8010597c: c3 ret 8010597d: 8d 76 00 lea 0x0(%esi),%esi 80105980 <uartintr>: return inb(COM1+0); } void uartintr(void) { 80105980: 55 push %ebp 80105981: 89 e5 mov %esp,%ebp 80105983: 83 ec 18 sub $0x18,%esp consoleintr(uartgetc); 80105986: c7 04 24 60 58 10 80 movl $0x80105860,(%esp) 8010598d: e8 2e ae ff ff call 801007c0 <consoleintr> } 80105992: c9 leave 80105993: c3 ret 80105994 <vector0>: # generated by vectors.pl - do not edit # handlers .globl alltraps .globl vector0 vector0: pushl $0 80105994: 6a 00 push $0x0 pushl $0 80105996: 6a 00 push $0x0 jmp alltraps 80105998: e9 53 fb ff ff jmp 801054f0 <alltraps> 8010599d <vector1>: .globl vector1 vector1: pushl $0 8010599d: 6a 00 push $0x0 pushl $1 8010599f: 6a 01 push $0x1 jmp alltraps 801059a1: e9 4a fb ff ff jmp 801054f0 <alltraps> 801059a6 <vector2>: .globl vector2 vector2: pushl $0 801059a6: 6a 00 push $0x0 pushl $2 801059a8: 6a 02 push $0x2 jmp alltraps 801059aa: e9 41 fb ff ff jmp 801054f0 <alltraps> 801059af <vector3>: .globl vector3 vector3: pushl $0 801059af: 6a 00 push $0x0 pushl $3 801059b1: 6a 03 push $0x3 jmp alltraps 801059b3: e9 38 fb ff ff jmp 801054f0 <alltraps> 801059b8 <vector4>: .globl vector4 vector4: pushl $0 801059b8: 6a 00 push $0x0 pushl $4 801059ba: 6a 04 push $0x4 jmp alltraps 801059bc: e9 2f fb ff ff jmp 801054f0 <alltraps> 801059c1 <vector5>: .globl vector5 vector5: pushl $0 801059c1: 6a 00 push $0x0 pushl $5 801059c3: 6a 05 push $0x5 jmp alltraps 801059c5: e9 26 fb ff ff jmp 801054f0 <alltraps> 801059ca <vector6>: .globl vector6 vector6: pushl $0 801059ca: 6a 00 push $0x0 pushl $6 801059cc: 6a 06 push $0x6 jmp alltraps 801059ce: e9 1d fb ff ff jmp 801054f0 <alltraps> 801059d3 <vector7>: .globl vector7 vector7: pushl $0 801059d3: 6a 00 push $0x0 pushl $7 801059d5: 6a 07 push $0x7 jmp alltraps 801059d7: e9 14 fb ff ff jmp 801054f0 <alltraps> 801059dc <vector8>: .globl vector8 vector8: pushl $8 801059dc: 6a 08 push $0x8 jmp alltraps 801059de: e9 0d fb ff ff jmp 801054f0 <alltraps> 801059e3 <vector9>: .globl vector9 vector9: pushl $0 801059e3: 6a 00 push $0x0 pushl $9 801059e5: 6a 09 push $0x9 jmp alltraps 801059e7: e9 04 fb ff ff jmp 801054f0 <alltraps> 801059ec <vector10>: .globl vector10 vector10: pushl $10 801059ec: 6a 0a push $0xa jmp alltraps 801059ee: e9 fd fa ff ff jmp 801054f0 <alltraps> 801059f3 <vector11>: .globl vector11 vector11: pushl $11 801059f3: 6a 0b push $0xb jmp alltraps 801059f5: e9 f6 fa ff ff jmp 801054f0 <alltraps> 801059fa <vector12>: .globl vector12 vector12: pushl $12 801059fa: 6a 0c push $0xc jmp alltraps 801059fc: e9 ef fa ff ff jmp 801054f0 <alltraps> 80105a01 <vector13>: .globl vector13 vector13: pushl $13 80105a01: 6a 0d push $0xd jmp alltraps 80105a03: e9 e8 fa ff ff jmp 801054f0 <alltraps> 80105a08 <vector14>: .globl vector14 vector14: pushl $14 80105a08: 6a 0e push $0xe jmp alltraps 80105a0a: e9 e1 fa ff ff jmp 801054f0 <alltraps> 80105a0f <vector15>: .globl vector15 vector15: pushl $0 80105a0f: 6a 00 push $0x0 pushl $15 80105a11: 6a 0f push $0xf jmp alltraps 80105a13: e9 d8 fa ff ff jmp 801054f0 <alltraps> 80105a18 <vector16>: .globl vector16 vector16: pushl $0 80105a18: 6a 00 push $0x0 pushl $16 80105a1a: 6a 10 push $0x10 jmp alltraps 80105a1c: e9 cf fa ff ff jmp 801054f0 <alltraps> 80105a21 <vector17>: .globl vector17 vector17: pushl $17 80105a21: 6a 11 push $0x11 jmp alltraps 80105a23: e9 c8 fa ff ff jmp 801054f0 <alltraps> 80105a28 <vector18>: .globl vector18 vector18: pushl $0 80105a28: 6a 00 push $0x0 pushl $18 80105a2a: 6a 12 push $0x12 jmp alltraps 80105a2c: e9 bf fa ff ff jmp 801054f0 <alltraps> 80105a31 <vector19>: .globl vector19 vector19: pushl $0 80105a31: 6a 00 push $0x0 pushl $19 80105a33: 6a 13 push $0x13 jmp alltraps 80105a35: e9 b6 fa ff ff jmp 801054f0 <alltraps> 80105a3a <vector20>: .globl vector20 vector20: pushl $0 80105a3a: 6a 00 push $0x0 pushl $20 80105a3c: 6a 14 push $0x14 jmp alltraps 80105a3e: e9 ad fa ff ff jmp 801054f0 <alltraps> 80105a43 <vector21>: .globl vector21 vector21: pushl $0 80105a43: 6a 00 push $0x0 pushl $21 80105a45: 6a 15 push $0x15 jmp alltraps 80105a47: e9 a4 fa ff ff jmp 801054f0 <alltraps> 80105a4c <vector22>: .globl vector22 vector22: pushl $0 80105a4c: 6a 00 push $0x0 pushl $22 80105a4e: 6a 16 push $0x16 jmp alltraps 80105a50: e9 9b fa ff ff jmp 801054f0 <alltraps> 80105a55 <vector23>: .globl vector23 vector23: pushl $0 80105a55: 6a 00 push $0x0 pushl $23 80105a57: 6a 17 push $0x17 jmp alltraps 80105a59: e9 92 fa ff ff jmp 801054f0 <alltraps> 80105a5e <vector24>: .globl vector24 vector24: pushl $0 80105a5e: 6a 00 push $0x0 pushl $24 80105a60: 6a 18 push $0x18 jmp alltraps 80105a62: e9 89 fa ff ff jmp 801054f0 <alltraps> 80105a67 <vector25>: .globl vector25 vector25: pushl $0 80105a67: 6a 00 push $0x0 pushl $25 80105a69: 6a 19 push $0x19 jmp alltraps 80105a6b: e9 80 fa ff ff jmp 801054f0 <alltraps> 80105a70 <vector26>: .globl vector26 vector26: pushl $0 80105a70: 6a 00 push $0x0 pushl $26 80105a72: 6a 1a push $0x1a jmp alltraps 80105a74: e9 77 fa ff ff jmp 801054f0 <alltraps> 80105a79 <vector27>: .globl vector27 vector27: pushl $0 80105a79: 6a 00 push $0x0 pushl $27 80105a7b: 6a 1b push $0x1b jmp alltraps 80105a7d: e9 6e fa ff ff jmp 801054f0 <alltraps> 80105a82 <vector28>: .globl vector28 vector28: pushl $0 80105a82: 6a 00 push $0x0 pushl $28 80105a84: 6a 1c push $0x1c jmp alltraps 80105a86: e9 65 fa ff ff jmp 801054f0 <alltraps> 80105a8b <vector29>: .globl vector29 vector29: pushl $0 80105a8b: 6a 00 push $0x0 pushl $29 80105a8d: 6a 1d push $0x1d jmp alltraps 80105a8f: e9 5c fa ff ff jmp 801054f0 <alltraps> 80105a94 <vector30>: .globl vector30 vector30: pushl $0 80105a94: 6a 00 push $0x0 pushl $30 80105a96: 6a 1e push $0x1e jmp alltraps 80105a98: e9 53 fa ff ff jmp 801054f0 <alltraps> 80105a9d <vector31>: .globl vector31 vector31: pushl $0 80105a9d: 6a 00 push $0x0 pushl $31 80105a9f: 6a 1f push $0x1f jmp alltraps 80105aa1: e9 4a fa ff ff jmp 801054f0 <alltraps> 80105aa6 <vector32>: .globl vector32 vector32: pushl $0 80105aa6: 6a 00 push $0x0 pushl $32 80105aa8: 6a 20 push $0x20 jmp alltraps 80105aaa: e9 41 fa ff ff jmp 801054f0 <alltraps> 80105aaf <vector33>: .globl vector33 vector33: pushl $0 80105aaf: 6a 00 push $0x0 pushl $33 80105ab1: 6a 21 push $0x21 jmp alltraps 80105ab3: e9 38 fa ff ff jmp 801054f0 <alltraps> 80105ab8 <vector34>: .globl vector34 vector34: pushl $0 80105ab8: 6a 00 push $0x0 pushl $34 80105aba: 6a 22 push $0x22 jmp alltraps 80105abc: e9 2f fa ff ff jmp 801054f0 <alltraps> 80105ac1 <vector35>: .globl vector35 vector35: pushl $0 80105ac1: 6a 00 push $0x0 pushl $35 80105ac3: 6a 23 push $0x23 jmp alltraps 80105ac5: e9 26 fa ff ff jmp 801054f0 <alltraps> 80105aca <vector36>: .globl vector36 vector36: pushl $0 80105aca: 6a 00 push $0x0 pushl $36 80105acc: 6a 24 push $0x24 jmp alltraps 80105ace: e9 1d fa ff ff jmp 801054f0 <alltraps> 80105ad3 <vector37>: .globl vector37 vector37: pushl $0 80105ad3: 6a 00 push $0x0 pushl $37 80105ad5: 6a 25 push $0x25 jmp alltraps 80105ad7: e9 14 fa ff ff jmp 801054f0 <alltraps> 80105adc <vector38>: .globl vector38 vector38: pushl $0 80105adc: 6a 00 push $0x0 pushl $38 80105ade: 6a 26 push $0x26 jmp alltraps 80105ae0: e9 0b fa ff ff jmp 801054f0 <alltraps> 80105ae5 <vector39>: .globl vector39 vector39: pushl $0 80105ae5: 6a 00 push $0x0 pushl $39 80105ae7: 6a 27 push $0x27 jmp alltraps 80105ae9: e9 02 fa ff ff jmp 801054f0 <alltraps> 80105aee <vector40>: .globl vector40 vector40: pushl $0 80105aee: 6a 00 push $0x0 pushl $40 80105af0: 6a 28 push $0x28 jmp alltraps 80105af2: e9 f9 f9 ff ff jmp 801054f0 <alltraps> 80105af7 <vector41>: .globl vector41 vector41: pushl $0 80105af7: 6a 00 push $0x0 pushl $41 80105af9: 6a 29 push $0x29 jmp alltraps 80105afb: e9 f0 f9 ff ff jmp 801054f0 <alltraps> 80105b00 <vector42>: .globl vector42 vector42: pushl $0 80105b00: 6a 00 push $0x0 pushl $42 80105b02: 6a 2a push $0x2a jmp alltraps 80105b04: e9 e7 f9 ff ff jmp 801054f0 <alltraps> 80105b09 <vector43>: .globl vector43 vector43: pushl $0 80105b09: 6a 00 push $0x0 pushl $43 80105b0b: 6a 2b push $0x2b jmp alltraps 80105b0d: e9 de f9 ff ff jmp 801054f0 <alltraps> 80105b12 <vector44>: .globl vector44 vector44: pushl $0 80105b12: 6a 00 push $0x0 pushl $44 80105b14: 6a 2c push $0x2c jmp alltraps 80105b16: e9 d5 f9 ff ff jmp 801054f0 <alltraps> 80105b1b <vector45>: .globl vector45 vector45: pushl $0 80105b1b: 6a 00 push $0x0 pushl $45 80105b1d: 6a 2d push $0x2d jmp alltraps 80105b1f: e9 cc f9 ff ff jmp 801054f0 <alltraps> 80105b24 <vector46>: .globl vector46 vector46: pushl $0 80105b24: 6a 00 push $0x0 pushl $46 80105b26: 6a 2e push $0x2e jmp alltraps 80105b28: e9 c3 f9 ff ff jmp 801054f0 <alltraps> 80105b2d <vector47>: .globl vector47 vector47: pushl $0 80105b2d: 6a 00 push $0x0 pushl $47 80105b2f: 6a 2f push $0x2f jmp alltraps 80105b31: e9 ba f9 ff ff jmp 801054f0 <alltraps> 80105b36 <vector48>: .globl vector48 vector48: pushl $0 80105b36: 6a 00 push $0x0 pushl $48 80105b38: 6a 30 push $0x30 jmp alltraps 80105b3a: e9 b1 f9 ff ff jmp 801054f0 <alltraps> 80105b3f <vector49>: .globl vector49 vector49: pushl $0 80105b3f: 6a 00 push $0x0 pushl $49 80105b41: 6a 31 push $0x31 jmp alltraps 80105b43: e9 a8 f9 ff ff jmp 801054f0 <alltraps> 80105b48 <vector50>: .globl vector50 vector50: pushl $0 80105b48: 6a 00 push $0x0 pushl $50 80105b4a: 6a 32 push $0x32 jmp alltraps 80105b4c: e9 9f f9 ff ff jmp 801054f0 <alltraps> 80105b51 <vector51>: .globl vector51 vector51: pushl $0 80105b51: 6a 00 push $0x0 pushl $51 80105b53: 6a 33 push $0x33 jmp alltraps 80105b55: e9 96 f9 ff ff jmp 801054f0 <alltraps> 80105b5a <vector52>: .globl vector52 vector52: pushl $0 80105b5a: 6a 00 push $0x0 pushl $52 80105b5c: 6a 34 push $0x34 jmp alltraps 80105b5e: e9 8d f9 ff ff jmp 801054f0 <alltraps> 80105b63 <vector53>: .globl vector53 vector53: pushl $0 80105b63: 6a 00 push $0x0 pushl $53 80105b65: 6a 35 push $0x35 jmp alltraps 80105b67: e9 84 f9 ff ff jmp 801054f0 <alltraps> 80105b6c <vector54>: .globl vector54 vector54: pushl $0 80105b6c: 6a 00 push $0x0 pushl $54 80105b6e: 6a 36 push $0x36 jmp alltraps 80105b70: e9 7b f9 ff ff jmp 801054f0 <alltraps> 80105b75 <vector55>: .globl vector55 vector55: pushl $0 80105b75: 6a 00 push $0x0 pushl $55 80105b77: 6a 37 push $0x37 jmp alltraps 80105b79: e9 72 f9 ff ff jmp 801054f0 <alltraps> 80105b7e <vector56>: .globl vector56 vector56: pushl $0 80105b7e: 6a 00 push $0x0 pushl $56 80105b80: 6a 38 push $0x38 jmp alltraps 80105b82: e9 69 f9 ff ff jmp 801054f0 <alltraps> 80105b87 <vector57>: .globl vector57 vector57: pushl $0 80105b87: 6a 00 push $0x0 pushl $57 80105b89: 6a 39 push $0x39 jmp alltraps 80105b8b: e9 60 f9 ff ff jmp 801054f0 <alltraps> 80105b90 <vector58>: .globl vector58 vector58: pushl $0 80105b90: 6a 00 push $0x0 pushl $58 80105b92: 6a 3a push $0x3a jmp alltraps 80105b94: e9 57 f9 ff ff jmp 801054f0 <alltraps> 80105b99 <vector59>: .globl vector59 vector59: pushl $0 80105b99: 6a 00 push $0x0 pushl $59 80105b9b: 6a 3b push $0x3b jmp alltraps 80105b9d: e9 4e f9 ff ff jmp 801054f0 <alltraps> 80105ba2 <vector60>: .globl vector60 vector60: pushl $0 80105ba2: 6a 00 push $0x0 pushl $60 80105ba4: 6a 3c push $0x3c jmp alltraps 80105ba6: e9 45 f9 ff ff jmp 801054f0 <alltraps> 80105bab <vector61>: .globl vector61 vector61: pushl $0 80105bab: 6a 00 push $0x0 pushl $61 80105bad: 6a 3d push $0x3d jmp alltraps 80105baf: e9 3c f9 ff ff jmp 801054f0 <alltraps> 80105bb4 <vector62>: .globl vector62 vector62: pushl $0 80105bb4: 6a 00 push $0x0 pushl $62 80105bb6: 6a 3e push $0x3e jmp alltraps 80105bb8: e9 33 f9 ff ff jmp 801054f0 <alltraps> 80105bbd <vector63>: .globl vector63 vector63: pushl $0 80105bbd: 6a 00 push $0x0 pushl $63 80105bbf: 6a 3f push $0x3f jmp alltraps 80105bc1: e9 2a f9 ff ff jmp 801054f0 <alltraps> 80105bc6 <vector64>: .globl vector64 vector64: pushl $0 80105bc6: 6a 00 push $0x0 pushl $64 80105bc8: 6a 40 push $0x40 jmp alltraps 80105bca: e9 21 f9 ff ff jmp 801054f0 <alltraps> 80105bcf <vector65>: .globl vector65 vector65: pushl $0 80105bcf: 6a 00 push $0x0 pushl $65 80105bd1: 6a 41 push $0x41 jmp alltraps 80105bd3: e9 18 f9 ff ff jmp 801054f0 <alltraps> 80105bd8 <vector66>: .globl vector66 vector66: pushl $0 80105bd8: 6a 00 push $0x0 pushl $66 80105bda: 6a 42 push $0x42 jmp alltraps 80105bdc: e9 0f f9 ff ff jmp 801054f0 <alltraps> 80105be1 <vector67>: .globl vector67 vector67: pushl $0 80105be1: 6a 00 push $0x0 pushl $67 80105be3: 6a 43 push $0x43 jmp alltraps 80105be5: e9 06 f9 ff ff jmp 801054f0 <alltraps> 80105bea <vector68>: .globl vector68 vector68: pushl $0 80105bea: 6a 00 push $0x0 pushl $68 80105bec: 6a 44 push $0x44 jmp alltraps 80105bee: e9 fd f8 ff ff jmp 801054f0 <alltraps> 80105bf3 <vector69>: .globl vector69 vector69: pushl $0 80105bf3: 6a 00 push $0x0 pushl $69 80105bf5: 6a 45 push $0x45 jmp alltraps 80105bf7: e9 f4 f8 ff ff jmp 801054f0 <alltraps> 80105bfc <vector70>: .globl vector70 vector70: pushl $0 80105bfc: 6a 00 push $0x0 pushl $70 80105bfe: 6a 46 push $0x46 jmp alltraps 80105c00: e9 eb f8 ff ff jmp 801054f0 <alltraps> 80105c05 <vector71>: .globl vector71 vector71: pushl $0 80105c05: 6a 00 push $0x0 pushl $71 80105c07: 6a 47 push $0x47 jmp alltraps 80105c09: e9 e2 f8 ff ff jmp 801054f0 <alltraps> 80105c0e <vector72>: .globl vector72 vector72: pushl $0 80105c0e: 6a 00 push $0x0 pushl $72 80105c10: 6a 48 push $0x48 jmp alltraps 80105c12: e9 d9 f8 ff ff jmp 801054f0 <alltraps> 80105c17 <vector73>: .globl vector73 vector73: pushl $0 80105c17: 6a 00 push $0x0 pushl $73 80105c19: 6a 49 push $0x49 jmp alltraps 80105c1b: e9 d0 f8 ff ff jmp 801054f0 <alltraps> 80105c20 <vector74>: .globl vector74 vector74: pushl $0 80105c20: 6a 00 push $0x0 pushl $74 80105c22: 6a 4a push $0x4a jmp alltraps 80105c24: e9 c7 f8 ff ff jmp 801054f0 <alltraps> 80105c29 <vector75>: .globl vector75 vector75: pushl $0 80105c29: 6a 00 push $0x0 pushl $75 80105c2b: 6a 4b push $0x4b jmp alltraps 80105c2d: e9 be f8 ff ff jmp 801054f0 <alltraps> 80105c32 <vector76>: .globl vector76 vector76: pushl $0 80105c32: 6a 00 push $0x0 pushl $76 80105c34: 6a 4c push $0x4c jmp alltraps 80105c36: e9 b5 f8 ff ff jmp 801054f0 <alltraps> 80105c3b <vector77>: .globl vector77 vector77: pushl $0 80105c3b: 6a 00 push $0x0 pushl $77 80105c3d: 6a 4d push $0x4d jmp alltraps 80105c3f: e9 ac f8 ff ff jmp 801054f0 <alltraps> 80105c44 <vector78>: .globl vector78 vector78: pushl $0 80105c44: 6a 00 push $0x0 pushl $78 80105c46: 6a 4e push $0x4e jmp alltraps 80105c48: e9 a3 f8 ff ff jmp 801054f0 <alltraps> 80105c4d <vector79>: .globl vector79 vector79: pushl $0 80105c4d: 6a 00 push $0x0 pushl $79 80105c4f: 6a 4f push $0x4f jmp alltraps 80105c51: e9 9a f8 ff ff jmp 801054f0 <alltraps> 80105c56 <vector80>: .globl vector80 vector80: pushl $0 80105c56: 6a 00 push $0x0 pushl $80 80105c58: 6a 50 push $0x50 jmp alltraps 80105c5a: e9 91 f8 ff ff jmp 801054f0 <alltraps> 80105c5f <vector81>: .globl vector81 vector81: pushl $0 80105c5f: 6a 00 push $0x0 pushl $81 80105c61: 6a 51 push $0x51 jmp alltraps 80105c63: e9 88 f8 ff ff jmp 801054f0 <alltraps> 80105c68 <vector82>: .globl vector82 vector82: pushl $0 80105c68: 6a 00 push $0x0 pushl $82 80105c6a: 6a 52 push $0x52 jmp alltraps 80105c6c: e9 7f f8 ff ff jmp 801054f0 <alltraps> 80105c71 <vector83>: .globl vector83 vector83: pushl $0 80105c71: 6a 00 push $0x0 pushl $83 80105c73: 6a 53 push $0x53 jmp alltraps 80105c75: e9 76 f8 ff ff jmp 801054f0 <alltraps> 80105c7a <vector84>: .globl vector84 vector84: pushl $0 80105c7a: 6a 00 push $0x0 pushl $84 80105c7c: 6a 54 push $0x54 jmp alltraps 80105c7e: e9 6d f8 ff ff jmp 801054f0 <alltraps> 80105c83 <vector85>: .globl vector85 vector85: pushl $0 80105c83: 6a 00 push $0x0 pushl $85 80105c85: 6a 55 push $0x55 jmp alltraps 80105c87: e9 64 f8 ff ff jmp 801054f0 <alltraps> 80105c8c <vector86>: .globl vector86 vector86: pushl $0 80105c8c: 6a 00 push $0x0 pushl $86 80105c8e: 6a 56 push $0x56 jmp alltraps 80105c90: e9 5b f8 ff ff jmp 801054f0 <alltraps> 80105c95 <vector87>: .globl vector87 vector87: pushl $0 80105c95: 6a 00 push $0x0 pushl $87 80105c97: 6a 57 push $0x57 jmp alltraps 80105c99: e9 52 f8 ff ff jmp 801054f0 <alltraps> 80105c9e <vector88>: .globl vector88 vector88: pushl $0 80105c9e: 6a 00 push $0x0 pushl $88 80105ca0: 6a 58 push $0x58 jmp alltraps 80105ca2: e9 49 f8 ff ff jmp 801054f0 <alltraps> 80105ca7 <vector89>: .globl vector89 vector89: pushl $0 80105ca7: 6a 00 push $0x0 pushl $89 80105ca9: 6a 59 push $0x59 jmp alltraps 80105cab: e9 40 f8 ff ff jmp 801054f0 <alltraps> 80105cb0 <vector90>: .globl vector90 vector90: pushl $0 80105cb0: 6a 00 push $0x0 pushl $90 80105cb2: 6a 5a push $0x5a jmp alltraps 80105cb4: e9 37 f8 ff ff jmp 801054f0 <alltraps> 80105cb9 <vector91>: .globl vector91 vector91: pushl $0 80105cb9: 6a 00 push $0x0 pushl $91 80105cbb: 6a 5b push $0x5b jmp alltraps 80105cbd: e9 2e f8 ff ff jmp 801054f0 <alltraps> 80105cc2 <vector92>: .globl vector92 vector92: pushl $0 80105cc2: 6a 00 push $0x0 pushl $92 80105cc4: 6a 5c push $0x5c jmp alltraps 80105cc6: e9 25 f8 ff ff jmp 801054f0 <alltraps> 80105ccb <vector93>: .globl vector93 vector93: pushl $0 80105ccb: 6a 00 push $0x0 pushl $93 80105ccd: 6a 5d push $0x5d jmp alltraps 80105ccf: e9 1c f8 ff ff jmp 801054f0 <alltraps> 80105cd4 <vector94>: .globl vector94 vector94: pushl $0 80105cd4: 6a 00 push $0x0 pushl $94 80105cd6: 6a 5e push $0x5e jmp alltraps 80105cd8: e9 13 f8 ff ff jmp 801054f0 <alltraps> 80105cdd <vector95>: .globl vector95 vector95: pushl $0 80105cdd: 6a 00 push $0x0 pushl $95 80105cdf: 6a 5f push $0x5f jmp alltraps 80105ce1: e9 0a f8 ff ff jmp 801054f0 <alltraps> 80105ce6 <vector96>: .globl vector96 vector96: pushl $0 80105ce6: 6a 00 push $0x0 pushl $96 80105ce8: 6a 60 push $0x60 jmp alltraps 80105cea: e9 01 f8 ff ff jmp 801054f0 <alltraps> 80105cef <vector97>: .globl vector97 vector97: pushl $0 80105cef: 6a 00 push $0x0 pushl $97 80105cf1: 6a 61 push $0x61 jmp alltraps 80105cf3: e9 f8 f7 ff ff jmp 801054f0 <alltraps> 80105cf8 <vector98>: .globl vector98 vector98: pushl $0 80105cf8: 6a 00 push $0x0 pushl $98 80105cfa: 6a 62 push $0x62 jmp alltraps 80105cfc: e9 ef f7 ff ff jmp 801054f0 <alltraps> 80105d01 <vector99>: .globl vector99 vector99: pushl $0 80105d01: 6a 00 push $0x0 pushl $99 80105d03: 6a 63 push $0x63 jmp alltraps 80105d05: e9 e6 f7 ff ff jmp 801054f0 <alltraps> 80105d0a <vector100>: .globl vector100 vector100: pushl $0 80105d0a: 6a 00 push $0x0 pushl $100 80105d0c: 6a 64 push $0x64 jmp alltraps 80105d0e: e9 dd f7 ff ff jmp 801054f0 <alltraps> 80105d13 <vector101>: .globl vector101 vector101: pushl $0 80105d13: 6a 00 push $0x0 pushl $101 80105d15: 6a 65 push $0x65 jmp alltraps 80105d17: e9 d4 f7 ff ff jmp 801054f0 <alltraps> 80105d1c <vector102>: .globl vector102 vector102: pushl $0 80105d1c: 6a 00 push $0x0 pushl $102 80105d1e: 6a 66 push $0x66 jmp alltraps 80105d20: e9 cb f7 ff ff jmp 801054f0 <alltraps> 80105d25 <vector103>: .globl vector103 vector103: pushl $0 80105d25: 6a 00 push $0x0 pushl $103 80105d27: 6a 67 push $0x67 jmp alltraps 80105d29: e9 c2 f7 ff ff jmp 801054f0 <alltraps> 80105d2e <vector104>: .globl vector104 vector104: pushl $0 80105d2e: 6a 00 push $0x0 pushl $104 80105d30: 6a 68 push $0x68 jmp alltraps 80105d32: e9 b9 f7 ff ff jmp 801054f0 <alltraps> 80105d37 <vector105>: .globl vector105 vector105: pushl $0 80105d37: 6a 00 push $0x0 pushl $105 80105d39: 6a 69 push $0x69 jmp alltraps 80105d3b: e9 b0 f7 ff ff jmp 801054f0 <alltraps> 80105d40 <vector106>: .globl vector106 vector106: pushl $0 80105d40: 6a 00 push $0x0 pushl $106 80105d42: 6a 6a push $0x6a jmp alltraps 80105d44: e9 a7 f7 ff ff jmp 801054f0 <alltraps> 80105d49 <vector107>: .globl vector107 vector107: pushl $0 80105d49: 6a 00 push $0x0 pushl $107 80105d4b: 6a 6b push $0x6b jmp alltraps 80105d4d: e9 9e f7 ff ff jmp 801054f0 <alltraps> 80105d52 <vector108>: .globl vector108 vector108: pushl $0 80105d52: 6a 00 push $0x0 pushl $108 80105d54: 6a 6c push $0x6c jmp alltraps 80105d56: e9 95 f7 ff ff jmp 801054f0 <alltraps> 80105d5b <vector109>: .globl vector109 vector109: pushl $0 80105d5b: 6a 00 push $0x0 pushl $109 80105d5d: 6a 6d push $0x6d jmp alltraps 80105d5f: e9 8c f7 ff ff jmp 801054f0 <alltraps> 80105d64 <vector110>: .globl vector110 vector110: pushl $0 80105d64: 6a 00 push $0x0 pushl $110 80105d66: 6a 6e push $0x6e jmp alltraps 80105d68: e9 83 f7 ff ff jmp 801054f0 <alltraps> 80105d6d <vector111>: .globl vector111 vector111: pushl $0 80105d6d: 6a 00 push $0x0 pushl $111 80105d6f: 6a 6f push $0x6f jmp alltraps 80105d71: e9 7a f7 ff ff jmp 801054f0 <alltraps> 80105d76 <vector112>: .globl vector112 vector112: pushl $0 80105d76: 6a 00 push $0x0 pushl $112 80105d78: 6a 70 push $0x70 jmp alltraps 80105d7a: e9 71 f7 ff ff jmp 801054f0 <alltraps> 80105d7f <vector113>: .globl vector113 vector113: pushl $0 80105d7f: 6a 00 push $0x0 pushl $113 80105d81: 6a 71 push $0x71 jmp alltraps 80105d83: e9 68 f7 ff ff jmp 801054f0 <alltraps> 80105d88 <vector114>: .globl vector114 vector114: pushl $0 80105d88: 6a 00 push $0x0 pushl $114 80105d8a: 6a 72 push $0x72 jmp alltraps 80105d8c: e9 5f f7 ff ff jmp 801054f0 <alltraps> 80105d91 <vector115>: .globl vector115 vector115: pushl $0 80105d91: 6a 00 push $0x0 pushl $115 80105d93: 6a 73 push $0x73 jmp alltraps 80105d95: e9 56 f7 ff ff jmp 801054f0 <alltraps> 80105d9a <vector116>: .globl vector116 vector116: pushl $0 80105d9a: 6a 00 push $0x0 pushl $116 80105d9c: 6a 74 push $0x74 jmp alltraps 80105d9e: e9 4d f7 ff ff jmp 801054f0 <alltraps> 80105da3 <vector117>: .globl vector117 vector117: pushl $0 80105da3: 6a 00 push $0x0 pushl $117 80105da5: 6a 75 push $0x75 jmp alltraps 80105da7: e9 44 f7 ff ff jmp 801054f0 <alltraps> 80105dac <vector118>: .globl vector118 vector118: pushl $0 80105dac: 6a 00 push $0x0 pushl $118 80105dae: 6a 76 push $0x76 jmp alltraps 80105db0: e9 3b f7 ff ff jmp 801054f0 <alltraps> 80105db5 <vector119>: .globl vector119 vector119: pushl $0 80105db5: 6a 00 push $0x0 pushl $119 80105db7: 6a 77 push $0x77 jmp alltraps 80105db9: e9 32 f7 ff ff jmp 801054f0 <alltraps> 80105dbe <vector120>: .globl vector120 vector120: pushl $0 80105dbe: 6a 00 push $0x0 pushl $120 80105dc0: 6a 78 push $0x78 jmp alltraps 80105dc2: e9 29 f7 ff ff jmp 801054f0 <alltraps> 80105dc7 <vector121>: .globl vector121 vector121: pushl $0 80105dc7: 6a 00 push $0x0 pushl $121 80105dc9: 6a 79 push $0x79 jmp alltraps 80105dcb: e9 20 f7 ff ff jmp 801054f0 <alltraps> 80105dd0 <vector122>: .globl vector122 vector122: pushl $0 80105dd0: 6a 00 push $0x0 pushl $122 80105dd2: 6a 7a push $0x7a jmp alltraps 80105dd4: e9 17 f7 ff ff jmp 801054f0 <alltraps> 80105dd9 <vector123>: .globl vector123 vector123: pushl $0 80105dd9: 6a 00 push $0x0 pushl $123 80105ddb: 6a 7b push $0x7b jmp alltraps 80105ddd: e9 0e f7 ff ff jmp 801054f0 <alltraps> 80105de2 <vector124>: .globl vector124 vector124: pushl $0 80105de2: 6a 00 push $0x0 pushl $124 80105de4: 6a 7c push $0x7c jmp alltraps 80105de6: e9 05 f7 ff ff jmp 801054f0 <alltraps> 80105deb <vector125>: .globl vector125 vector125: pushl $0 80105deb: 6a 00 push $0x0 pushl $125 80105ded: 6a 7d push $0x7d jmp alltraps 80105def: e9 fc f6 ff ff jmp 801054f0 <alltraps> 80105df4 <vector126>: .globl vector126 vector126: pushl $0 80105df4: 6a 00 push $0x0 pushl $126 80105df6: 6a 7e push $0x7e jmp alltraps 80105df8: e9 f3 f6 ff ff jmp 801054f0 <alltraps> 80105dfd <vector127>: .globl vector127 vector127: pushl $0 80105dfd: 6a 00 push $0x0 pushl $127 80105dff: 6a 7f push $0x7f jmp alltraps 80105e01: e9 ea f6 ff ff jmp 801054f0 <alltraps> 80105e06 <vector128>: .globl vector128 vector128: pushl $0 80105e06: 6a 00 push $0x0 pushl $128 80105e08: 68 80 00 00 00 push $0x80 jmp alltraps 80105e0d: e9 de f6 ff ff jmp 801054f0 <alltraps> 80105e12 <vector129>: .globl vector129 vector129: pushl $0 80105e12: 6a 00 push $0x0 pushl $129 80105e14: 68 81 00 00 00 push $0x81 jmp alltraps 80105e19: e9 d2 f6 ff ff jmp 801054f0 <alltraps> 80105e1e <vector130>: .globl vector130 vector130: pushl $0 80105e1e: 6a 00 push $0x0 pushl $130 80105e20: 68 82 00 00 00 push $0x82 jmp alltraps 80105e25: e9 c6 f6 ff ff jmp 801054f0 <alltraps> 80105e2a <vector131>: .globl vector131 vector131: pushl $0 80105e2a: 6a 00 push $0x0 pushl $131 80105e2c: 68 83 00 00 00 push $0x83 jmp alltraps 80105e31: e9 ba f6 ff ff jmp 801054f0 <alltraps> 80105e36 <vector132>: .globl vector132 vector132: pushl $0 80105e36: 6a 00 push $0x0 pushl $132 80105e38: 68 84 00 00 00 push $0x84 jmp alltraps 80105e3d: e9 ae f6 ff ff jmp 801054f0 <alltraps> 80105e42 <vector133>: .globl vector133 vector133: pushl $0 80105e42: 6a 00 push $0x0 pushl $133 80105e44: 68 85 00 00 00 push $0x85 jmp alltraps 80105e49: e9 a2 f6 ff ff jmp 801054f0 <alltraps> 80105e4e <vector134>: .globl vector134 vector134: pushl $0 80105e4e: 6a 00 push $0x0 pushl $134 80105e50: 68 86 00 00 00 push $0x86 jmp alltraps 80105e55: e9 96 f6 ff ff jmp 801054f0 <alltraps> 80105e5a <vector135>: .globl vector135 vector135: pushl $0 80105e5a: 6a 00 push $0x0 pushl $135 80105e5c: 68 87 00 00 00 push $0x87 jmp alltraps 80105e61: e9 8a f6 ff ff jmp 801054f0 <alltraps> 80105e66 <vector136>: .globl vector136 vector136: pushl $0 80105e66: 6a 00 push $0x0 pushl $136 80105e68: 68 88 00 00 00 push $0x88 jmp alltraps 80105e6d: e9 7e f6 ff ff jmp 801054f0 <alltraps> 80105e72 <vector137>: .globl vector137 vector137: pushl $0 80105e72: 6a 00 push $0x0 pushl $137 80105e74: 68 89 00 00 00 push $0x89 jmp alltraps 80105e79: e9 72 f6 ff ff jmp 801054f0 <alltraps> 80105e7e <vector138>: .globl vector138 vector138: pushl $0 80105e7e: 6a 00 push $0x0 pushl $138 80105e80: 68 8a 00 00 00 push $0x8a jmp alltraps 80105e85: e9 66 f6 ff ff jmp 801054f0 <alltraps> 80105e8a <vector139>: .globl vector139 vector139: pushl $0 80105e8a: 6a 00 push $0x0 pushl $139 80105e8c: 68 8b 00 00 00 push $0x8b jmp alltraps 80105e91: e9 5a f6 ff ff jmp 801054f0 <alltraps> 80105e96 <vector140>: .globl vector140 vector140: pushl $0 80105e96: 6a 00 push $0x0 pushl $140 80105e98: 68 8c 00 00 00 push $0x8c jmp alltraps 80105e9d: e9 4e f6 ff ff jmp 801054f0 <alltraps> 80105ea2 <vector141>: .globl vector141 vector141: pushl $0 80105ea2: 6a 00 push $0x0 pushl $141 80105ea4: 68 8d 00 00 00 push $0x8d jmp alltraps 80105ea9: e9 42 f6 ff ff jmp 801054f0 <alltraps> 80105eae <vector142>: .globl vector142 vector142: pushl $0 80105eae: 6a 00 push $0x0 pushl $142 80105eb0: 68 8e 00 00 00 push $0x8e jmp alltraps 80105eb5: e9 36 f6 ff ff jmp 801054f0 <alltraps> 80105eba <vector143>: .globl vector143 vector143: pushl $0 80105eba: 6a 00 push $0x0 pushl $143 80105ebc: 68 8f 00 00 00 push $0x8f jmp alltraps 80105ec1: e9 2a f6 ff ff jmp 801054f0 <alltraps> 80105ec6 <vector144>: .globl vector144 vector144: pushl $0 80105ec6: 6a 00 push $0x0 pushl $144 80105ec8: 68 90 00 00 00 push $0x90 jmp alltraps 80105ecd: e9 1e f6 ff ff jmp 801054f0 <alltraps> 80105ed2 <vector145>: .globl vector145 vector145: pushl $0 80105ed2: 6a 00 push $0x0 pushl $145 80105ed4: 68 91 00 00 00 push $0x91 jmp alltraps 80105ed9: e9 12 f6 ff ff jmp 801054f0 <alltraps> 80105ede <vector146>: .globl vector146 vector146: pushl $0 80105ede: 6a 00 push $0x0 pushl $146 80105ee0: 68 92 00 00 00 push $0x92 jmp alltraps 80105ee5: e9 06 f6 ff ff jmp 801054f0 <alltraps> 80105eea <vector147>: .globl vector147 vector147: pushl $0 80105eea: 6a 00 push $0x0 pushl $147 80105eec: 68 93 00 00 00 push $0x93 jmp alltraps 80105ef1: e9 fa f5 ff ff jmp 801054f0 <alltraps> 80105ef6 <vector148>: .globl vector148 vector148: pushl $0 80105ef6: 6a 00 push $0x0 pushl $148 80105ef8: 68 94 00 00 00 push $0x94 jmp alltraps 80105efd: e9 ee f5 ff ff jmp 801054f0 <alltraps> 80105f02 <vector149>: .globl vector149 vector149: pushl $0 80105f02: 6a 00 push $0x0 pushl $149 80105f04: 68 95 00 00 00 push $0x95 jmp alltraps 80105f09: e9 e2 f5 ff ff jmp 801054f0 <alltraps> 80105f0e <vector150>: .globl vector150 vector150: pushl $0 80105f0e: 6a 00 push $0x0 pushl $150 80105f10: 68 96 00 00 00 push $0x96 jmp alltraps 80105f15: e9 d6 f5 ff ff jmp 801054f0 <alltraps> 80105f1a <vector151>: .globl vector151 vector151: pushl $0 80105f1a: 6a 00 push $0x0 pushl $151 80105f1c: 68 97 00 00 00 push $0x97 jmp alltraps 80105f21: e9 ca f5 ff ff jmp 801054f0 <alltraps> 80105f26 <vector152>: .globl vector152 vector152: pushl $0 80105f26: 6a 00 push $0x0 pushl $152 80105f28: 68 98 00 00 00 push $0x98 jmp alltraps 80105f2d: e9 be f5 ff ff jmp 801054f0 <alltraps> 80105f32 <vector153>: .globl vector153 vector153: pushl $0 80105f32: 6a 00 push $0x0 pushl $153 80105f34: 68 99 00 00 00 push $0x99 jmp alltraps 80105f39: e9 b2 f5 ff ff jmp 801054f0 <alltraps> 80105f3e <vector154>: .globl vector154 vector154: pushl $0 80105f3e: 6a 00 push $0x0 pushl $154 80105f40: 68 9a 00 00 00 push $0x9a jmp alltraps 80105f45: e9 a6 f5 ff ff jmp 801054f0 <alltraps> 80105f4a <vector155>: .globl vector155 vector155: pushl $0 80105f4a: 6a 00 push $0x0 pushl $155 80105f4c: 68 9b 00 00 00 push $0x9b jmp alltraps 80105f51: e9 9a f5 ff ff jmp 801054f0 <alltraps> 80105f56 <vector156>: .globl vector156 vector156: pushl $0 80105f56: 6a 00 push $0x0 pushl $156 80105f58: 68 9c 00 00 00 push $0x9c jmp alltraps 80105f5d: e9 8e f5 ff ff jmp 801054f0 <alltraps> 80105f62 <vector157>: .globl vector157 vector157: pushl $0 80105f62: 6a 00 push $0x0 pushl $157 80105f64: 68 9d 00 00 00 push $0x9d jmp alltraps 80105f69: e9 82 f5 ff ff jmp 801054f0 <alltraps> 80105f6e <vector158>: .globl vector158 vector158: pushl $0 80105f6e: 6a 00 push $0x0 pushl $158 80105f70: 68 9e 00 00 00 push $0x9e jmp alltraps 80105f75: e9 76 f5 ff ff jmp 801054f0 <alltraps> 80105f7a <vector159>: .globl vector159 vector159: pushl $0 80105f7a: 6a 00 push $0x0 pushl $159 80105f7c: 68 9f 00 00 00 push $0x9f jmp alltraps 80105f81: e9 6a f5 ff ff jmp 801054f0 <alltraps> 80105f86 <vector160>: .globl vector160 vector160: pushl $0 80105f86: 6a 00 push $0x0 pushl $160 80105f88: 68 a0 00 00 00 push $0xa0 jmp alltraps 80105f8d: e9 5e f5 ff ff jmp 801054f0 <alltraps> 80105f92 <vector161>: .globl vector161 vector161: pushl $0 80105f92: 6a 00 push $0x0 pushl $161 80105f94: 68 a1 00 00 00 push $0xa1 jmp alltraps 80105f99: e9 52 f5 ff ff jmp 801054f0 <alltraps> 80105f9e <vector162>: .globl vector162 vector162: pushl $0 80105f9e: 6a 00 push $0x0 pushl $162 80105fa0: 68 a2 00 00 00 push $0xa2 jmp alltraps 80105fa5: e9 46 f5 ff ff jmp 801054f0 <alltraps> 80105faa <vector163>: .globl vector163 vector163: pushl $0 80105faa: 6a 00 push $0x0 pushl $163 80105fac: 68 a3 00 00 00 push $0xa3 jmp alltraps 80105fb1: e9 3a f5 ff ff jmp 801054f0 <alltraps> 80105fb6 <vector164>: .globl vector164 vector164: pushl $0 80105fb6: 6a 00 push $0x0 pushl $164 80105fb8: 68 a4 00 00 00 push $0xa4 jmp alltraps 80105fbd: e9 2e f5 ff ff jmp 801054f0 <alltraps> 80105fc2 <vector165>: .globl vector165 vector165: pushl $0 80105fc2: 6a 00 push $0x0 pushl $165 80105fc4: 68 a5 00 00 00 push $0xa5 jmp alltraps 80105fc9: e9 22 f5 ff ff jmp 801054f0 <alltraps> 80105fce <vector166>: .globl vector166 vector166: pushl $0 80105fce: 6a 00 push $0x0 pushl $166 80105fd0: 68 a6 00 00 00 push $0xa6 jmp alltraps 80105fd5: e9 16 f5 ff ff jmp 801054f0 <alltraps> 80105fda <vector167>: .globl vector167 vector167: pushl $0 80105fda: 6a 00 push $0x0 pushl $167 80105fdc: 68 a7 00 00 00 push $0xa7 jmp alltraps 80105fe1: e9 0a f5 ff ff jmp 801054f0 <alltraps> 80105fe6 <vector168>: .globl vector168 vector168: pushl $0 80105fe6: 6a 00 push $0x0 pushl $168 80105fe8: 68 a8 00 00 00 push $0xa8 jmp alltraps 80105fed: e9 fe f4 ff ff jmp 801054f0 <alltraps> 80105ff2 <vector169>: .globl vector169 vector169: pushl $0 80105ff2: 6a 00 push $0x0 pushl $169 80105ff4: 68 a9 00 00 00 push $0xa9 jmp alltraps 80105ff9: e9 f2 f4 ff ff jmp 801054f0 <alltraps> 80105ffe <vector170>: .globl vector170 vector170: pushl $0 80105ffe: 6a 00 push $0x0 pushl $170 80106000: 68 aa 00 00 00 push $0xaa jmp alltraps 80106005: e9 e6 f4 ff ff jmp 801054f0 <alltraps> 8010600a <vector171>: .globl vector171 vector171: pushl $0 8010600a: 6a 00 push $0x0 pushl $171 8010600c: 68 ab 00 00 00 push $0xab jmp alltraps 80106011: e9 da f4 ff ff jmp 801054f0 <alltraps> 80106016 <vector172>: .globl vector172 vector172: pushl $0 80106016: 6a 00 push $0x0 pushl $172 80106018: 68 ac 00 00 00 push $0xac jmp alltraps 8010601d: e9 ce f4 ff ff jmp 801054f0 <alltraps> 80106022 <vector173>: .globl vector173 vector173: pushl $0 80106022: 6a 00 push $0x0 pushl $173 80106024: 68 ad 00 00 00 push $0xad jmp alltraps 80106029: e9 c2 f4 ff ff jmp 801054f0 <alltraps> 8010602e <vector174>: .globl vector174 vector174: pushl $0 8010602e: 6a 00 push $0x0 pushl $174 80106030: 68 ae 00 00 00 push $0xae jmp alltraps 80106035: e9 b6 f4 ff ff jmp 801054f0 <alltraps> 8010603a <vector175>: .globl vector175 vector175: pushl $0 8010603a: 6a 00 push $0x0 pushl $175 8010603c: 68 af 00 00 00 push $0xaf jmp alltraps 80106041: e9 aa f4 ff ff jmp 801054f0 <alltraps> 80106046 <vector176>: .globl vector176 vector176: pushl $0 80106046: 6a 00 push $0x0 pushl $176 80106048: 68 b0 00 00 00 push $0xb0 jmp alltraps 8010604d: e9 9e f4 ff ff jmp 801054f0 <alltraps> 80106052 <vector177>: .globl vector177 vector177: pushl $0 80106052: 6a 00 push $0x0 pushl $177 80106054: 68 b1 00 00 00 push $0xb1 jmp alltraps 80106059: e9 92 f4 ff ff jmp 801054f0 <alltraps> 8010605e <vector178>: .globl vector178 vector178: pushl $0 8010605e: 6a 00 push $0x0 pushl $178 80106060: 68 b2 00 00 00 push $0xb2 jmp alltraps 80106065: e9 86 f4 ff ff jmp 801054f0 <alltraps> 8010606a <vector179>: .globl vector179 vector179: pushl $0 8010606a: 6a 00 push $0x0 pushl $179 8010606c: 68 b3 00 00 00 push $0xb3 jmp alltraps 80106071: e9 7a f4 ff ff jmp 801054f0 <alltraps> 80106076 <vector180>: .globl vector180 vector180: pushl $0 80106076: 6a 00 push $0x0 pushl $180 80106078: 68 b4 00 00 00 push $0xb4 jmp alltraps 8010607d: e9 6e f4 ff ff jmp 801054f0 <alltraps> 80106082 <vector181>: .globl vector181 vector181: pushl $0 80106082: 6a 00 push $0x0 pushl $181 80106084: 68 b5 00 00 00 push $0xb5 jmp alltraps 80106089: e9 62 f4 ff ff jmp 801054f0 <alltraps> 8010608e <vector182>: .globl vector182 vector182: pushl $0 8010608e: 6a 00 push $0x0 pushl $182 80106090: 68 b6 00 00 00 push $0xb6 jmp alltraps 80106095: e9 56 f4 ff ff jmp 801054f0 <alltraps> 8010609a <vector183>: .globl vector183 vector183: pushl $0 8010609a: 6a 00 push $0x0 pushl $183 8010609c: 68 b7 00 00 00 push $0xb7 jmp alltraps 801060a1: e9 4a f4 ff ff jmp 801054f0 <alltraps> 801060a6 <vector184>: .globl vector184 vector184: pushl $0 801060a6: 6a 00 push $0x0 pushl $184 801060a8: 68 b8 00 00 00 push $0xb8 jmp alltraps 801060ad: e9 3e f4 ff ff jmp 801054f0 <alltraps> 801060b2 <vector185>: .globl vector185 vector185: pushl $0 801060b2: 6a 00 push $0x0 pushl $185 801060b4: 68 b9 00 00 00 push $0xb9 jmp alltraps 801060b9: e9 32 f4 ff ff jmp 801054f0 <alltraps> 801060be <vector186>: .globl vector186 vector186: pushl $0 801060be: 6a 00 push $0x0 pushl $186 801060c0: 68 ba 00 00 00 push $0xba jmp alltraps 801060c5: e9 26 f4 ff ff jmp 801054f0 <alltraps> 801060ca <vector187>: .globl vector187 vector187: pushl $0 801060ca: 6a 00 push $0x0 pushl $187 801060cc: 68 bb 00 00 00 push $0xbb jmp alltraps 801060d1: e9 1a f4 ff ff jmp 801054f0 <alltraps> 801060d6 <vector188>: .globl vector188 vector188: pushl $0 801060d6: 6a 00 push $0x0 pushl $188 801060d8: 68 bc 00 00 00 push $0xbc jmp alltraps 801060dd: e9 0e f4 ff ff jmp 801054f0 <alltraps> 801060e2 <vector189>: .globl vector189 vector189: pushl $0 801060e2: 6a 00 push $0x0 pushl $189 801060e4: 68 bd 00 00 00 push $0xbd jmp alltraps 801060e9: e9 02 f4 ff ff jmp 801054f0 <alltraps> 801060ee <vector190>: .globl vector190 vector190: pushl $0 801060ee: 6a 00 push $0x0 pushl $190 801060f0: 68 be 00 00 00 push $0xbe jmp alltraps 801060f5: e9 f6 f3 ff ff jmp 801054f0 <alltraps> 801060fa <vector191>: .globl vector191 vector191: pushl $0 801060fa: 6a 00 push $0x0 pushl $191 801060fc: 68 bf 00 00 00 push $0xbf jmp alltraps 80106101: e9 ea f3 ff ff jmp 801054f0 <alltraps> 80106106 <vector192>: .globl vector192 vector192: pushl $0 80106106: 6a 00 push $0x0 pushl $192 80106108: 68 c0 00 00 00 push $0xc0 jmp alltraps 8010610d: e9 de f3 ff ff jmp 801054f0 <alltraps> 80106112 <vector193>: .globl vector193 vector193: pushl $0 80106112: 6a 00 push $0x0 pushl $193 80106114: 68 c1 00 00 00 push $0xc1 jmp alltraps 80106119: e9 d2 f3 ff ff jmp 801054f0 <alltraps> 8010611e <vector194>: .globl vector194 vector194: pushl $0 8010611e: 6a 00 push $0x0 pushl $194 80106120: 68 c2 00 00 00 push $0xc2 jmp alltraps 80106125: e9 c6 f3 ff ff jmp 801054f0 <alltraps> 8010612a <vector195>: .globl vector195 vector195: pushl $0 8010612a: 6a 00 push $0x0 pushl $195 8010612c: 68 c3 00 00 00 push $0xc3 jmp alltraps 80106131: e9 ba f3 ff ff jmp 801054f0 <alltraps> 80106136 <vector196>: .globl vector196 vector196: pushl $0 80106136: 6a 00 push $0x0 pushl $196 80106138: 68 c4 00 00 00 push $0xc4 jmp alltraps 8010613d: e9 ae f3 ff ff jmp 801054f0 <alltraps> 80106142 <vector197>: .globl vector197 vector197: pushl $0 80106142: 6a 00 push $0x0 pushl $197 80106144: 68 c5 00 00 00 push $0xc5 jmp alltraps 80106149: e9 a2 f3 ff ff jmp 801054f0 <alltraps> 8010614e <vector198>: .globl vector198 vector198: pushl $0 8010614e: 6a 00 push $0x0 pushl $198 80106150: 68 c6 00 00 00 push $0xc6 jmp alltraps 80106155: e9 96 f3 ff ff jmp 801054f0 <alltraps> 8010615a <vector199>: .globl vector199 vector199: pushl $0 8010615a: 6a 00 push $0x0 pushl $199 8010615c: 68 c7 00 00 00 push $0xc7 jmp alltraps 80106161: e9 8a f3 ff ff jmp 801054f0 <alltraps> 80106166 <vector200>: .globl vector200 vector200: pushl $0 80106166: 6a 00 push $0x0 pushl $200 80106168: 68 c8 00 00 00 push $0xc8 jmp alltraps 8010616d: e9 7e f3 ff ff jmp 801054f0 <alltraps> 80106172 <vector201>: .globl vector201 vector201: pushl $0 80106172: 6a 00 push $0x0 pushl $201 80106174: 68 c9 00 00 00 push $0xc9 jmp alltraps 80106179: e9 72 f3 ff ff jmp 801054f0 <alltraps> 8010617e <vector202>: .globl vector202 vector202: pushl $0 8010617e: 6a 00 push $0x0 pushl $202 80106180: 68 ca 00 00 00 push $0xca jmp alltraps 80106185: e9 66 f3 ff ff jmp 801054f0 <alltraps> 8010618a <vector203>: .globl vector203 vector203: pushl $0 8010618a: 6a 00 push $0x0 pushl $203 8010618c: 68 cb 00 00 00 push $0xcb jmp alltraps 80106191: e9 5a f3 ff ff jmp 801054f0 <alltraps> 80106196 <vector204>: .globl vector204 vector204: pushl $0 80106196: 6a 00 push $0x0 pushl $204 80106198: 68 cc 00 00 00 push $0xcc jmp alltraps 8010619d: e9 4e f3 ff ff jmp 801054f0 <alltraps> 801061a2 <vector205>: .globl vector205 vector205: pushl $0 801061a2: 6a 00 push $0x0 pushl $205 801061a4: 68 cd 00 00 00 push $0xcd jmp alltraps 801061a9: e9 42 f3 ff ff jmp 801054f0 <alltraps> 801061ae <vector206>: .globl vector206 vector206: pushl $0 801061ae: 6a 00 push $0x0 pushl $206 801061b0: 68 ce 00 00 00 push $0xce jmp alltraps 801061b5: e9 36 f3 ff ff jmp 801054f0 <alltraps> 801061ba <vector207>: .globl vector207 vector207: pushl $0 801061ba: 6a 00 push $0x0 pushl $207 801061bc: 68 cf 00 00 00 push $0xcf jmp alltraps 801061c1: e9 2a f3 ff ff jmp 801054f0 <alltraps> 801061c6 <vector208>: .globl vector208 vector208: pushl $0 801061c6: 6a 00 push $0x0 pushl $208 801061c8: 68 d0 00 00 00 push $0xd0 jmp alltraps 801061cd: e9 1e f3 ff ff jmp 801054f0 <alltraps> 801061d2 <vector209>: .globl vector209 vector209: pushl $0 801061d2: 6a 00 push $0x0 pushl $209 801061d4: 68 d1 00 00 00 push $0xd1 jmp alltraps 801061d9: e9 12 f3 ff ff jmp 801054f0 <alltraps> 801061de <vector210>: .globl vector210 vector210: pushl $0 801061de: 6a 00 push $0x0 pushl $210 801061e0: 68 d2 00 00 00 push $0xd2 jmp alltraps 801061e5: e9 06 f3 ff ff jmp 801054f0 <alltraps> 801061ea <vector211>: .globl vector211 vector211: pushl $0 801061ea: 6a 00 push $0x0 pushl $211 801061ec: 68 d3 00 00 00 push $0xd3 jmp alltraps 801061f1: e9 fa f2 ff ff jmp 801054f0 <alltraps> 801061f6 <vector212>: .globl vector212 vector212: pushl $0 801061f6: 6a 00 push $0x0 pushl $212 801061f8: 68 d4 00 00 00 push $0xd4 jmp alltraps 801061fd: e9 ee f2 ff ff jmp 801054f0 <alltraps> 80106202 <vector213>: .globl vector213 vector213: pushl $0 80106202: 6a 00 push $0x0 pushl $213 80106204: 68 d5 00 00 00 push $0xd5 jmp alltraps 80106209: e9 e2 f2 ff ff jmp 801054f0 <alltraps> 8010620e <vector214>: .globl vector214 vector214: pushl $0 8010620e: 6a 00 push $0x0 pushl $214 80106210: 68 d6 00 00 00 push $0xd6 jmp alltraps 80106215: e9 d6 f2 ff ff jmp 801054f0 <alltraps> 8010621a <vector215>: .globl vector215 vector215: pushl $0 8010621a: 6a 00 push $0x0 pushl $215 8010621c: 68 d7 00 00 00 push $0xd7 jmp alltraps 80106221: e9 ca f2 ff ff jmp 801054f0 <alltraps> 80106226 <vector216>: .globl vector216 vector216: pushl $0 80106226: 6a 00 push $0x0 pushl $216 80106228: 68 d8 00 00 00 push $0xd8 jmp alltraps 8010622d: e9 be f2 ff ff jmp 801054f0 <alltraps> 80106232 <vector217>: .globl vector217 vector217: pushl $0 80106232: 6a 00 push $0x0 pushl $217 80106234: 68 d9 00 00 00 push $0xd9 jmp alltraps 80106239: e9 b2 f2 ff ff jmp 801054f0 <alltraps> 8010623e <vector218>: .globl vector218 vector218: pushl $0 8010623e: 6a 00 push $0x0 pushl $218 80106240: 68 da 00 00 00 push $0xda jmp alltraps 80106245: e9 a6 f2 ff ff jmp 801054f0 <alltraps> 8010624a <vector219>: .globl vector219 vector219: pushl $0 8010624a: 6a 00 push $0x0 pushl $219 8010624c: 68 db 00 00 00 push $0xdb jmp alltraps 80106251: e9 9a f2 ff ff jmp 801054f0 <alltraps> 80106256 <vector220>: .globl vector220 vector220: pushl $0 80106256: 6a 00 push $0x0 pushl $220 80106258: 68 dc 00 00 00 push $0xdc jmp alltraps 8010625d: e9 8e f2 ff ff jmp 801054f0 <alltraps> 80106262 <vector221>: .globl vector221 vector221: pushl $0 80106262: 6a 00 push $0x0 pushl $221 80106264: 68 dd 00 00 00 push $0xdd jmp alltraps 80106269: e9 82 f2 ff ff jmp 801054f0 <alltraps> 8010626e <vector222>: .globl vector222 vector222: pushl $0 8010626e: 6a 00 push $0x0 pushl $222 80106270: 68 de 00 00 00 push $0xde jmp alltraps 80106275: e9 76 f2 ff ff jmp 801054f0 <alltraps> 8010627a <vector223>: .globl vector223 vector223: pushl $0 8010627a: 6a 00 push $0x0 pushl $223 8010627c: 68 df 00 00 00 push $0xdf jmp alltraps 80106281: e9 6a f2 ff ff jmp 801054f0 <alltraps> 80106286 <vector224>: .globl vector224 vector224: pushl $0 80106286: 6a 00 push $0x0 pushl $224 80106288: 68 e0 00 00 00 push $0xe0 jmp alltraps 8010628d: e9 5e f2 ff ff jmp 801054f0 <alltraps> 80106292 <vector225>: .globl vector225 vector225: pushl $0 80106292: 6a 00 push $0x0 pushl $225 80106294: 68 e1 00 00 00 push $0xe1 jmp alltraps 80106299: e9 52 f2 ff ff jmp 801054f0 <alltraps> 8010629e <vector226>: .globl vector226 vector226: pushl $0 8010629e: 6a 00 push $0x0 pushl $226 801062a0: 68 e2 00 00 00 push $0xe2 jmp alltraps 801062a5: e9 46 f2 ff ff jmp 801054f0 <alltraps> 801062aa <vector227>: .globl vector227 vector227: pushl $0 801062aa: 6a 00 push $0x0 pushl $227 801062ac: 68 e3 00 00 00 push $0xe3 jmp alltraps 801062b1: e9 3a f2 ff ff jmp 801054f0 <alltraps> 801062b6 <vector228>: .globl vector228 vector228: pushl $0 801062b6: 6a 00 push $0x0 pushl $228 801062b8: 68 e4 00 00 00 push $0xe4 jmp alltraps 801062bd: e9 2e f2 ff ff jmp 801054f0 <alltraps> 801062c2 <vector229>: .globl vector229 vector229: pushl $0 801062c2: 6a 00 push $0x0 pushl $229 801062c4: 68 e5 00 00 00 push $0xe5 jmp alltraps 801062c9: e9 22 f2 ff ff jmp 801054f0 <alltraps> 801062ce <vector230>: .globl vector230 vector230: pushl $0 801062ce: 6a 00 push $0x0 pushl $230 801062d0: 68 e6 00 00 00 push $0xe6 jmp alltraps 801062d5: e9 16 f2 ff ff jmp 801054f0 <alltraps> 801062da <vector231>: .globl vector231 vector231: pushl $0 801062da: 6a 00 push $0x0 pushl $231 801062dc: 68 e7 00 00 00 push $0xe7 jmp alltraps 801062e1: e9 0a f2 ff ff jmp 801054f0 <alltraps> 801062e6 <vector232>: .globl vector232 vector232: pushl $0 801062e6: 6a 00 push $0x0 pushl $232 801062e8: 68 e8 00 00 00 push $0xe8 jmp alltraps 801062ed: e9 fe f1 ff ff jmp 801054f0 <alltraps> 801062f2 <vector233>: .globl vector233 vector233: pushl $0 801062f2: 6a 00 push $0x0 pushl $233 801062f4: 68 e9 00 00 00 push $0xe9 jmp alltraps 801062f9: e9 f2 f1 ff ff jmp 801054f0 <alltraps> 801062fe <vector234>: .globl vector234 vector234: pushl $0 801062fe: 6a 00 push $0x0 pushl $234 80106300: 68 ea 00 00 00 push $0xea jmp alltraps 80106305: e9 e6 f1 ff ff jmp 801054f0 <alltraps> 8010630a <vector235>: .globl vector235 vector235: pushl $0 8010630a: 6a 00 push $0x0 pushl $235 8010630c: 68 eb 00 00 00 push $0xeb jmp alltraps 80106311: e9 da f1 ff ff jmp 801054f0 <alltraps> 80106316 <vector236>: .globl vector236 vector236: pushl $0 80106316: 6a 00 push $0x0 pushl $236 80106318: 68 ec 00 00 00 push $0xec jmp alltraps 8010631d: e9 ce f1 ff ff jmp 801054f0 <alltraps> 80106322 <vector237>: .globl vector237 vector237: pushl $0 80106322: 6a 00 push $0x0 pushl $237 80106324: 68 ed 00 00 00 push $0xed jmp alltraps 80106329: e9 c2 f1 ff ff jmp 801054f0 <alltraps> 8010632e <vector238>: .globl vector238 vector238: pushl $0 8010632e: 6a 00 push $0x0 pushl $238 80106330: 68 ee 00 00 00 push $0xee jmp alltraps 80106335: e9 b6 f1 ff ff jmp 801054f0 <alltraps> 8010633a <vector239>: .globl vector239 vector239: pushl $0 8010633a: 6a 00 push $0x0 pushl $239 8010633c: 68 ef 00 00 00 push $0xef jmp alltraps 80106341: e9 aa f1 ff ff jmp 801054f0 <alltraps> 80106346 <vector240>: .globl vector240 vector240: pushl $0 80106346: 6a 00 push $0x0 pushl $240 80106348: 68 f0 00 00 00 push $0xf0 jmp alltraps 8010634d: e9 9e f1 ff ff jmp 801054f0 <alltraps> 80106352 <vector241>: .globl vector241 vector241: pushl $0 80106352: 6a 00 push $0x0 pushl $241 80106354: 68 f1 00 00 00 push $0xf1 jmp alltraps 80106359: e9 92 f1 ff ff jmp 801054f0 <alltraps> 8010635e <vector242>: .globl vector242 vector242: pushl $0 8010635e: 6a 00 push $0x0 pushl $242 80106360: 68 f2 00 00 00 push $0xf2 jmp alltraps 80106365: e9 86 f1 ff ff jmp 801054f0 <alltraps> 8010636a <vector243>: .globl vector243 vector243: pushl $0 8010636a: 6a 00 push $0x0 pushl $243 8010636c: 68 f3 00 00 00 push $0xf3 jmp alltraps 80106371: e9 7a f1 ff ff jmp 801054f0 <alltraps> 80106376 <vector244>: .globl vector244 vector244: pushl $0 80106376: 6a 00 push $0x0 pushl $244 80106378: 68 f4 00 00 00 push $0xf4 jmp alltraps 8010637d: e9 6e f1 ff ff jmp 801054f0 <alltraps> 80106382 <vector245>: .globl vector245 vector245: pushl $0 80106382: 6a 00 push $0x0 pushl $245 80106384: 68 f5 00 00 00 push $0xf5 jmp alltraps 80106389: e9 62 f1 ff ff jmp 801054f0 <alltraps> 8010638e <vector246>: .globl vector246 vector246: pushl $0 8010638e: 6a 00 push $0x0 pushl $246 80106390: 68 f6 00 00 00 push $0xf6 jmp alltraps 80106395: e9 56 f1 ff ff jmp 801054f0 <alltraps> 8010639a <vector247>: .globl vector247 vector247: pushl $0 8010639a: 6a 00 push $0x0 pushl $247 8010639c: 68 f7 00 00 00 push $0xf7 jmp alltraps 801063a1: e9 4a f1 ff ff jmp 801054f0 <alltraps> 801063a6 <vector248>: .globl vector248 vector248: pushl $0 801063a6: 6a 00 push $0x0 pushl $248 801063a8: 68 f8 00 00 00 push $0xf8 jmp alltraps 801063ad: e9 3e f1 ff ff jmp 801054f0 <alltraps> 801063b2 <vector249>: .globl vector249 vector249: pushl $0 801063b2: 6a 00 push $0x0 pushl $249 801063b4: 68 f9 00 00 00 push $0xf9 jmp alltraps 801063b9: e9 32 f1 ff ff jmp 801054f0 <alltraps> 801063be <vector250>: .globl vector250 vector250: pushl $0 801063be: 6a 00 push $0x0 pushl $250 801063c0: 68 fa 00 00 00 push $0xfa jmp alltraps 801063c5: e9 26 f1 ff ff jmp 801054f0 <alltraps> 801063ca <vector251>: .globl vector251 vector251: pushl $0 801063ca: 6a 00 push $0x0 pushl $251 801063cc: 68 fb 00 00 00 push $0xfb jmp alltraps 801063d1: e9 1a f1 ff ff jmp 801054f0 <alltraps> 801063d6 <vector252>: .globl vector252 vector252: pushl $0 801063d6: 6a 00 push $0x0 pushl $252 801063d8: 68 fc 00 00 00 push $0xfc jmp alltraps 801063dd: e9 0e f1 ff ff jmp 801054f0 <alltraps> 801063e2 <vector253>: .globl vector253 vector253: pushl $0 801063e2: 6a 00 push $0x0 pushl $253 801063e4: 68 fd 00 00 00 push $0xfd jmp alltraps 801063e9: e9 02 f1 ff ff jmp 801054f0 <alltraps> 801063ee <vector254>: .globl vector254 vector254: pushl $0 801063ee: 6a 00 push $0x0 pushl $254 801063f0: 68 fe 00 00 00 push $0xfe jmp alltraps 801063f5: e9 f6 f0 ff ff jmp 801054f0 <alltraps> 801063fa <vector255>: .globl vector255 vector255: pushl $0 801063fa: 6a 00 push $0x0 pushl $255 801063fc: 68 ff 00 00 00 push $0xff jmp alltraps 80106401: e9 ea f0 ff ff jmp 801054f0 <alltraps> ... 80106410 <walkpgdir>: // Return the address of the PTE in page table pgdir // that corresponds to virtual address va. If alloc!=0, // create any required page table pages. static pte_t * walkpgdir(pde_t *pgdir, const void *va, int alloc) { 80106410: 55 push %ebp 80106411: 89 e5 mov %esp,%ebp 80106413: 83 ec 38 sub $0x38,%esp 80106416: 89 5d f4 mov %ebx,-0xc(%ebp) 80106419: 89 d3 mov %edx,%ebx pde_t *pde; pte_t *pgtab; pde = &pgdir[PDX(va)]; 8010641b: c1 ea 16 shr $0x16,%edx // Return the address of the PTE in page table pgdir // that corresponds to virtual address va. If alloc!=0, // create any required page table pages. static pte_t * walkpgdir(pde_t *pgdir, const void *va, int alloc) { 8010641e: 89 7d fc mov %edi,-0x4(%ebp) pde_t *pde; pte_t *pgtab; pde = &pgdir[PDX(va)]; 80106421: 8d 3c 90 lea (%eax,%edx,4),%edi // Return the address of the PTE in page table pgdir // that corresponds to virtual address va. If alloc!=0, // create any required page table pages. static pte_t * walkpgdir(pde_t *pgdir, const void *va, int alloc) { 80106424: 89 75 f8 mov %esi,-0x8(%ebp) pde_t *pde; pte_t *pgtab; pde = &pgdir[PDX(va)]; if(*pde & PTE_P){ 80106427: 8b 37 mov (%edi),%esi 80106429: 89 f2 mov %esi,%edx 8010642b: 83 e2 01 and $0x1,%edx 8010642e: 74 28 je 80106458 <walkpgdir+0x48> pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); 80106430: 81 e6 00 f0 ff ff and $0xfffff000,%esi 80106436: 81 c6 00 00 00 80 add $0x80000000,%esi // The permissions here are overly generous, but they can // be further restricted by the permissions in the page table // entries, if necessary. *pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U; } return &pgtab[PTX(va)]; 8010643c: c1 eb 0a shr $0xa,%ebx 8010643f: 81 e3 fc 0f 00 00 and $0xffc,%ebx 80106445: 8d 04 1e lea (%esi,%ebx,1),%eax } 80106448: 8b 5d f4 mov -0xc(%ebp),%ebx 8010644b: 8b 75 f8 mov -0x8(%ebp),%esi 8010644e: 8b 7d fc mov -0x4(%ebp),%edi 80106451: 89 ec mov %ebp,%esp 80106453: 5d pop %ebp 80106454: c3 ret 80106455: 8d 76 00 lea 0x0(%esi),%esi pde = &pgdir[PDX(va)]; if(*pde & PTE_P){ pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); } else { if(!alloc || (pgtab = (pte_t*)kalloc()) == 0) return 0; 80106458: 31 c0 xor %eax,%eax pde = &pgdir[PDX(va)]; if(*pde & PTE_P){ pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); } else { if(!alloc || (pgtab = (pte_t*)kalloc()) == 0) 8010645a: 85 c9 test %ecx,%ecx 8010645c: 74 ea je 80106448 <walkpgdir+0x38> 8010645e: 89 55 e4 mov %edx,-0x1c(%ebp) 80106461: e8 4a c0 ff ff call 801024b0 <kalloc> return 0; 80106466: 8b 55 e4 mov -0x1c(%ebp),%edx pde = &pgdir[PDX(va)]; if(*pde & PTE_P){ pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); } else { if(!alloc || (pgtab = (pte_t*)kalloc()) == 0) 80106469: 89 c6 mov %eax,%esi return 0; 8010646b: 89 d0 mov %edx,%eax pde = &pgdir[PDX(va)]; if(*pde & PTE_P){ pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); } else { if(!alloc || (pgtab = (pte_t*)kalloc()) == 0) 8010646d: 85 f6 test %esi,%esi 8010646f: 74 d7 je 80106448 <walkpgdir+0x38> return 0; // Make sure all those PTE_P bits are zero. memset(pgtab, 0, PGSIZE); 80106471: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) 80106478: 00 80106479: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80106480: 00 80106481: 89 34 24 mov %esi,(%esp) 80106484: e8 b7 de ff ff call 80104340 <memset> // The permissions here are overly generous, but they can // be further restricted by the permissions in the page table // entries, if necessary. *pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U; 80106489: 8d 86 00 00 00 80 lea -0x80000000(%esi),%eax 8010648f: 83 c8 07 or $0x7,%eax 80106492: 89 07 mov %eax,(%edi) 80106494: eb a6 jmp 8010643c <walkpgdir+0x2c> 80106496: 8d 76 00 lea 0x0(%esi),%esi 80106499: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801064a0 <mappages>: // Create PTEs for virtual addresses starting at va that refer to // physical addresses starting at pa. va and size might not // be page-aligned. static int mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm) { 801064a0: 55 push %ebp 801064a1: 89 e5 mov %esp,%ebp 801064a3: 57 push %edi 801064a4: 56 push %esi 801064a5: 53 push %ebx char *a, *last; pte_t *pte; a = (char*)PGROUNDDOWN((uint)va); 801064a6: 89 d3 mov %edx,%ebx last = (char*)PGROUNDDOWN(((uint)va) + size - 1); 801064a8: 8d 7c 0a ff lea -0x1(%edx,%ecx,1),%edi // Create PTEs for virtual addresses starting at va that refer to // physical addresses starting at pa. va and size might not // be page-aligned. static int mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm) { 801064ac: 83 ec 2c sub $0x2c,%esp 801064af: 8b 75 08 mov 0x8(%ebp),%esi 801064b2: 89 45 e4 mov %eax,-0x1c(%ebp) char *a, *last; pte_t *pte; a = (char*)PGROUNDDOWN((uint)va); 801064b5: 81 e3 00 f0 ff ff and $0xfffff000,%ebx last = (char*)PGROUNDDOWN(((uint)va) + size - 1); 801064bb: 81 e7 00 f0 ff ff and $0xfffff000,%edi for(;;){ if((pte = walkpgdir(pgdir, a, 1)) == 0) return -1; if(*pte & PTE_P) panic("remap"); *pte = pa | perm | PTE_P; 801064c1: 83 4d 0c 01 orl $0x1,0xc(%ebp) 801064c5: eb 1d jmp 801064e4 <mappages+0x44> 801064c7: 90 nop a = (char*)PGROUNDDOWN((uint)va); last = (char*)PGROUNDDOWN(((uint)va) + size - 1); for(;;){ if((pte = walkpgdir(pgdir, a, 1)) == 0) return -1; if(*pte & PTE_P) 801064c8: f6 00 01 testb $0x1,(%eax) 801064cb: 75 45 jne 80106512 <mappages+0x72> panic("remap"); *pte = pa | perm | PTE_P; 801064cd: 8b 55 0c mov 0xc(%ebp),%edx 801064d0: 09 f2 or %esi,%edx if(a == last) 801064d2: 39 fb cmp %edi,%ebx for(;;){ if((pte = walkpgdir(pgdir, a, 1)) == 0) return -1; if(*pte & PTE_P) panic("remap"); *pte = pa | perm | PTE_P; 801064d4: 89 10 mov %edx,(%eax) if(a == last) 801064d6: 74 30 je 80106508 <mappages+0x68> break; a += PGSIZE; 801064d8: 81 c3 00 10 00 00 add $0x1000,%ebx pa += PGSIZE; 801064de: 81 c6 00 10 00 00 add $0x1000,%esi pte_t *pte; a = (char*)PGROUNDDOWN((uint)va); last = (char*)PGROUNDDOWN(((uint)va) + size - 1); for(;;){ if((pte = walkpgdir(pgdir, a, 1)) == 0) 801064e4: 8b 45 e4 mov -0x1c(%ebp),%eax 801064e7: b9 01 00 00 00 mov $0x1,%ecx 801064ec: 89 da mov %ebx,%edx 801064ee: e8 1d ff ff ff call 80106410 <walkpgdir> 801064f3: 85 c0 test %eax,%eax 801064f5: 75 d1 jne 801064c8 <mappages+0x28> break; a += PGSIZE; pa += PGSIZE; } return 0; } 801064f7: 83 c4 2c add $0x2c,%esp a = (char*)PGROUNDDOWN((uint)va); last = (char*)PGROUNDDOWN(((uint)va) + size - 1); for(;;){ if((pte = walkpgdir(pgdir, a, 1)) == 0) return -1; 801064fa: b8 ff ff ff ff mov $0xffffffff,%eax break; a += PGSIZE; pa += PGSIZE; } return 0; } 801064ff: 5b pop %ebx 80106500: 5e pop %esi 80106501: 5f pop %edi 80106502: 5d pop %ebp 80106503: c3 ret 80106504: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80106508: 83 c4 2c add $0x2c,%esp if(a == last) break; a += PGSIZE; pa += PGSIZE; } return 0; 8010650b: 31 c0 xor %eax,%eax } 8010650d: 5b pop %ebx 8010650e: 5e pop %esi 8010650f: 5f pop %edi 80106510: 5d pop %ebp 80106511: c3 ret last = (char*)PGROUNDDOWN(((uint)va) + size - 1); for(;;){ if((pte = walkpgdir(pgdir, a, 1)) == 0) return -1; if(*pte & PTE_P) panic("remap"); 80106512: c7 04 24 e8 75 10 80 movl $0x801075e8,(%esp) 80106519: e8 52 9e ff ff call 80100370 <panic> 8010651e: 66 90 xchg %ax,%ax 80106520 <seginit>: // Set up CPU's kernel segment descriptors. // Run once on entry on each CPU. void seginit(void) { 80106520: 55 push %ebp 80106521: 89 e5 mov %esp,%ebp 80106523: 83 ec 18 sub $0x18,%esp // Map "logical" addresses to virtual addresses using identity map. // Cannot share a CODE descriptor for both kernel and user // because it would have to have DPL_USR, but the CPU forbids // an interrupt from CPL=0 to DPL=3. c = &cpus[cpuid()]; 80106526: e8 e5 d1 ff ff call 80103710 <cpuid> 8010652b: 69 c0 b0 00 00 00 imul $0xb0,%eax,%eax 80106531: 05 80 27 11 80 add $0x80112780,%eax c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0); 80106536: c6 40 7d 9a movb $0x9a,0x7d(%eax) 8010653a: c6 40 7e cf movb $0xcf,0x7e(%eax) c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0); 8010653e: c6 80 85 00 00 00 92 movb $0x92,0x85(%eax) 80106545: c6 80 86 00 00 00 cf movb $0xcf,0x86(%eax) c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER); 8010654c: c6 80 8d 00 00 00 fa movb $0xfa,0x8d(%eax) 80106553: c6 80 8e 00 00 00 cf movb $0xcf,0x8e(%eax) c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER); 8010655a: c6 80 95 00 00 00 f2 movb $0xf2,0x95(%eax) 80106561: c6 80 96 00 00 00 cf movb $0xcf,0x96(%eax) // Map "logical" addresses to virtual addresses using identity map. // Cannot share a CODE descriptor for both kernel and user // because it would have to have DPL_USR, but the CPU forbids // an interrupt from CPL=0 to DPL=3. c = &cpus[cpuid()]; c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0); 80106568: 66 c7 40 78 ff ff movw $0xffff,0x78(%eax) 8010656e: 66 c7 40 7a 00 00 movw $0x0,0x7a(%eax) 80106574: c6 40 7c 00 movb $0x0,0x7c(%eax) 80106578: c6 40 7f 00 movb $0x0,0x7f(%eax) c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0); 8010657c: 66 c7 80 80 00 00 00 movw $0xffff,0x80(%eax) 80106583: ff ff 80106585: 66 c7 80 82 00 00 00 movw $0x0,0x82(%eax) 8010658c: 00 00 8010658e: c6 80 84 00 00 00 00 movb $0x0,0x84(%eax) 80106595: c6 80 87 00 00 00 00 movb $0x0,0x87(%eax) c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER); 8010659c: 66 c7 80 88 00 00 00 movw $0xffff,0x88(%eax) 801065a3: ff ff 801065a5: 66 c7 80 8a 00 00 00 movw $0x0,0x8a(%eax) 801065ac: 00 00 801065ae: c6 80 8c 00 00 00 00 movb $0x0,0x8c(%eax) 801065b5: c6 80 8f 00 00 00 00 movb $0x0,0x8f(%eax) c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER); 801065bc: 66 c7 80 90 00 00 00 movw $0xffff,0x90(%eax) 801065c3: ff ff 801065c5: 66 c7 80 92 00 00 00 movw $0x0,0x92(%eax) 801065cc: 00 00 801065ce: c6 80 94 00 00 00 00 movb $0x0,0x94(%eax) 801065d5: c6 80 97 00 00 00 00 movb $0x0,0x97(%eax) lgdt(c->gdt, sizeof(c->gdt)); 801065dc: 83 c0 70 add $0x70,%eax static inline void lgdt(struct segdesc *p, int size) { volatile ushort pd[3]; pd[0] = size-1; 801065df: 66 c7 45 f2 2f 00 movw $0x2f,-0xe(%ebp) pd[1] = (uint)p; 801065e5: 66 89 45 f4 mov %ax,-0xc(%ebp) pd[2] = (uint)p >> 16; 801065e9: c1 e8 10 shr $0x10,%eax 801065ec: 66 89 45 f6 mov %ax,-0xa(%ebp) asm volatile("lgdt (%0)" : : "r" (pd)); 801065f0: 8d 45 f2 lea -0xe(%ebp),%eax 801065f3: 0f 01 10 lgdtl (%eax) } 801065f6: c9 leave 801065f7: c3 ret 801065f8: 90 nop 801065f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106600 <switchkvm>: // Switch h/w page table register to the kernel-only page table, // for when no process is running. void switchkvm(void) { lcr3(V2P(kpgdir)); // switch to the kernel page table 80106600: a1 a4 54 11 80 mov 0x801154a4,%eax // Switch h/w page table register to the kernel-only page table, // for when no process is running. void switchkvm(void) { 80106605: 55 push %ebp 80106606: 89 e5 mov %esp,%ebp lcr3(V2P(kpgdir)); // switch to the kernel page table 80106608: 05 00 00 00 80 add $0x80000000,%eax } static inline void lcr3(uint val) { asm volatile("movl %0,%%cr3" : : "r" (val)); 8010660d: 0f 22 d8 mov %eax,%cr3 } 80106610: 5d pop %ebp 80106611: c3 ret 80106612: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106619: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80106620 <switchuvm>: // Switch TSS and h/w page table to correspond to process p. void switchuvm(struct proc *p) { 80106620: 55 push %ebp 80106621: 89 e5 mov %esp,%ebp 80106623: 57 push %edi 80106624: 56 push %esi 80106625: 53 push %ebx 80106626: 83 ec 2c sub $0x2c,%esp 80106629: 8b 75 08 mov 0x8(%ebp),%esi if(p == 0) 8010662c: 85 f6 test %esi,%esi 8010662e: 0f 84 c4 00 00 00 je 801066f8 <switchuvm+0xd8> panic("switchuvm: no process"); if(p->kstack == 0) 80106634: 8b 56 08 mov 0x8(%esi),%edx 80106637: 85 d2 test %edx,%edx 80106639: 0f 84 d1 00 00 00 je 80106710 <switchuvm+0xf0> panic("switchuvm: no kstack"); if(p->pgdir == 0) 8010663f: 8b 46 04 mov 0x4(%esi),%eax 80106642: 85 c0 test %eax,%eax 80106644: 0f 84 ba 00 00 00 je 80106704 <switchuvm+0xe4> panic("switchuvm: no pgdir"); pushcli(); 8010664a: e8 41 db ff ff call 80104190 <pushcli> mycpu()->gdt[SEG_TSS] = SEG16(STS_T32A, &mycpu()->ts, 8010664f: e8 3c d0 ff ff call 80103690 <mycpu> 80106654: 89 c3 mov %eax,%ebx 80106656: e8 35 d0 ff ff call 80103690 <mycpu> 8010665b: 89 45 e4 mov %eax,-0x1c(%ebp) 8010665e: e8 2d d0 ff ff call 80103690 <mycpu> 80106663: 89 c7 mov %eax,%edi 80106665: e8 26 d0 ff ff call 80103690 <mycpu> 8010666a: 8b 55 e4 mov -0x1c(%ebp),%edx 8010666d: 66 c7 83 98 00 00 00 movw $0x67,0x98(%ebx) 80106674: 67 00 80106676: c6 83 9d 00 00 00 99 movb $0x99,0x9d(%ebx) 8010667d: c6 83 9e 00 00 00 40 movb $0x40,0x9e(%ebx) 80106684: 83 c2 08 add $0x8,%edx 80106687: 66 89 93 9a 00 00 00 mov %dx,0x9a(%ebx) 8010668e: 8d 57 08 lea 0x8(%edi),%edx 80106691: 83 c0 08 add $0x8,%eax 80106694: c1 ea 10 shr $0x10,%edx 80106697: c1 e8 18 shr $0x18,%eax 8010669a: 88 93 9c 00 00 00 mov %dl,0x9c(%ebx) 801066a0: 88 83 9f 00 00 00 mov %al,0x9f(%ebx) sizeof(mycpu()->ts)-1, 0); mycpu()->gdt[SEG_TSS].s = 0; 801066a6: e8 e5 cf ff ff call 80103690 <mycpu> 801066ab: 80 a0 9d 00 00 00 ef andb $0xef,0x9d(%eax) mycpu()->ts.ss0 = SEG_KDATA << 3; 801066b2: e8 d9 cf ff ff call 80103690 <mycpu> 801066b7: 66 c7 40 10 10 00 movw $0x10,0x10(%eax) mycpu()->ts.esp0 = (uint)p->kstack + KSTACKSIZE; 801066bd: e8 ce cf ff ff call 80103690 <mycpu> 801066c2: 8b 56 08 mov 0x8(%esi),%edx 801066c5: 81 c2 00 10 00 00 add $0x1000,%edx 801066cb: 89 50 0c mov %edx,0xc(%eax) // setting IOPL=0 in eflags *and* iomb beyond the tss segment limit // forbids I/O instructions (e.g., inb and outb) from user space mycpu()->ts.iomb = (ushort) 0xFFFF; 801066ce: e8 bd cf ff ff call 80103690 <mycpu> 801066d3: 66 c7 40 6e ff ff movw $0xffff,0x6e(%eax) } static inline void ltr(ushort sel) { asm volatile("ltr %0" : : "r" (sel)); 801066d9: b8 28 00 00 00 mov $0x28,%eax 801066de: 0f 00 d8 ltr %ax ltr(SEG_TSS << 3); lcr3(V2P(p->pgdir)); // switch to process's address space 801066e1: 8b 46 04 mov 0x4(%esi),%eax 801066e4: 05 00 00 00 80 add $0x80000000,%eax } static inline void lcr3(uint val) { asm volatile("movl %0,%%cr3" : : "r" (val)); 801066e9: 0f 22 d8 mov %eax,%cr3 popcli(); } 801066ec: 83 c4 2c add $0x2c,%esp 801066ef: 5b pop %ebx 801066f0: 5e pop %esi 801066f1: 5f pop %edi 801066f2: 5d pop %ebp // setting IOPL=0 in eflags *and* iomb beyond the tss segment limit // forbids I/O instructions (e.g., inb and outb) from user space mycpu()->ts.iomb = (ushort) 0xFFFF; ltr(SEG_TSS << 3); lcr3(V2P(p->pgdir)); // switch to process's address space popcli(); 801066f3: e9 d8 da ff ff jmp 801041d0 <popcli> // Switch TSS and h/w page table to correspond to process p. void switchuvm(struct proc *p) { if(p == 0) panic("switchuvm: no process"); 801066f8: c7 04 24 ee 75 10 80 movl $0x801075ee,(%esp) 801066ff: e8 6c 9c ff ff call 80100370 <panic> if(p->kstack == 0) panic("switchuvm: no kstack"); if(p->pgdir == 0) panic("switchuvm: no pgdir"); 80106704: c7 04 24 19 76 10 80 movl $0x80107619,(%esp) 8010670b: e8 60 9c ff ff call 80100370 <panic> switchuvm(struct proc *p) { if(p == 0) panic("switchuvm: no process"); if(p->kstack == 0) panic("switchuvm: no kstack"); 80106710: c7 04 24 04 76 10 80 movl $0x80107604,(%esp) 80106717: e8 54 9c ff ff call 80100370 <panic> 8010671c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80106720 <inituvm>: // Load the initcode into address 0 of pgdir. // sz must be less than a page. void inituvm(pde_t *pgdir, char *init, uint sz) { 80106720: 55 push %ebp 80106721: 89 e5 mov %esp,%ebp 80106723: 83 ec 38 sub $0x38,%esp 80106726: 89 75 f8 mov %esi,-0x8(%ebp) 80106729: 8b 75 10 mov 0x10(%ebp),%esi 8010672c: 8b 45 08 mov 0x8(%ebp),%eax 8010672f: 89 7d fc mov %edi,-0x4(%ebp) 80106732: 8b 7d 0c mov 0xc(%ebp),%edi 80106735: 89 5d f4 mov %ebx,-0xc(%ebp) char *mem; if(sz >= PGSIZE) 80106738: 81 fe ff 0f 00 00 cmp $0xfff,%esi // Load the initcode into address 0 of pgdir. // sz must be less than a page. void inituvm(pde_t *pgdir, char *init, uint sz) { 8010673e: 89 45 e4 mov %eax,-0x1c(%ebp) char *mem; if(sz >= PGSIZE) 80106741: 77 59 ja 8010679c <inituvm+0x7c> panic("inituvm: more than a page"); mem = kalloc(); 80106743: e8 68 bd ff ff call 801024b0 <kalloc> memset(mem, 0, PGSIZE); 80106748: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) 8010674f: 00 80106750: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80106757: 00 { char *mem; if(sz >= PGSIZE) panic("inituvm: more than a page"); mem = kalloc(); 80106758: 89 c3 mov %eax,%ebx memset(mem, 0, PGSIZE); 8010675a: 89 04 24 mov %eax,(%esp) 8010675d: e8 de db ff ff call 80104340 <memset> mappages(pgdir, 0, PGSIZE, V2P(mem), PTE_W|PTE_U); 80106762: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax 80106768: b9 00 10 00 00 mov $0x1000,%ecx 8010676d: 89 04 24 mov %eax,(%esp) 80106770: 8b 45 e4 mov -0x1c(%ebp),%eax 80106773: 31 d2 xor %edx,%edx 80106775: c7 44 24 04 06 00 00 movl $0x6,0x4(%esp) 8010677c: 00 8010677d: e8 1e fd ff ff call 801064a0 <mappages> memmove(mem, init, sz); 80106782: 89 75 10 mov %esi,0x10(%ebp) } 80106785: 8b 75 f8 mov -0x8(%ebp),%esi if(sz >= PGSIZE) panic("inituvm: more than a page"); mem = kalloc(); memset(mem, 0, PGSIZE); mappages(pgdir, 0, PGSIZE, V2P(mem), PTE_W|PTE_U); memmove(mem, init, sz); 80106788: 89 7d 0c mov %edi,0xc(%ebp) } 8010678b: 8b 7d fc mov -0x4(%ebp),%edi if(sz >= PGSIZE) panic("inituvm: more than a page"); mem = kalloc(); memset(mem, 0, PGSIZE); mappages(pgdir, 0, PGSIZE, V2P(mem), PTE_W|PTE_U); memmove(mem, init, sz); 8010678e: 89 5d 08 mov %ebx,0x8(%ebp) } 80106791: 8b 5d f4 mov -0xc(%ebp),%ebx 80106794: 89 ec mov %ebp,%esp 80106796: 5d pop %ebp if(sz >= PGSIZE) panic("inituvm: more than a page"); mem = kalloc(); memset(mem, 0, PGSIZE); mappages(pgdir, 0, PGSIZE, V2P(mem), PTE_W|PTE_U); memmove(mem, init, sz); 80106797: e9 64 dc ff ff jmp 80104400 <memmove> inituvm(pde_t *pgdir, char *init, uint sz) { char *mem; if(sz >= PGSIZE) panic("inituvm: more than a page"); 8010679c: c7 04 24 2d 76 10 80 movl $0x8010762d,(%esp) 801067a3: e8 c8 9b ff ff call 80100370 <panic> 801067a8: 90 nop 801067a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801067b0 <loaduvm>: // Load a program segment into pgdir. addr must be page-aligned // and the pages from addr to addr+sz must already be mapped. int loaduvm(pde_t *pgdir, char *addr, struct inode *ip, uint offset, uint sz) { 801067b0: 55 push %ebp 801067b1: 89 e5 mov %esp,%ebp 801067b3: 57 push %edi 801067b4: 56 push %esi 801067b5: 53 push %ebx 801067b6: 83 ec 2c sub $0x2c,%esp 801067b9: 8b 7d 0c mov 0xc(%ebp),%edi uint i, pa, n; pte_t *pte; if((uint) addr % PGSIZE != 0) 801067bc: f7 c7 ff 0f 00 00 test $0xfff,%edi 801067c2: 0f 85 96 00 00 00 jne 8010685e <loaduvm+0xae> panic("loaduvm: addr must be page aligned"); for(i = 0; i < sz; i += PGSIZE){ 801067c8: 8b 75 18 mov 0x18(%ebp),%esi 801067cb: 31 db xor %ebx,%ebx 801067cd: 85 f6 test %esi,%esi 801067cf: 75 18 jne 801067e9 <loaduvm+0x39> 801067d1: eb 75 jmp 80106848 <loaduvm+0x98> 801067d3: 90 nop 801067d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801067d8: 81 c3 00 10 00 00 add $0x1000,%ebx 801067de: 81 ee 00 10 00 00 sub $0x1000,%esi 801067e4: 39 5d 18 cmp %ebx,0x18(%ebp) 801067e7: 76 5f jbe 80106848 <loaduvm+0x98> if((pte = walkpgdir(pgdir, addr+i, 0)) == 0) 801067e9: 8b 45 08 mov 0x8(%ebp),%eax 801067ec: 31 c9 xor %ecx,%ecx } // Load a program segment into pgdir. addr must be page-aligned // and the pages from addr to addr+sz must already be mapped. int loaduvm(pde_t *pgdir, char *addr, struct inode *ip, uint offset, uint sz) 801067ee: 8d 14 1f lea (%edi,%ebx,1),%edx pte_t *pte; if((uint) addr % PGSIZE != 0) panic("loaduvm: addr must be page aligned"); for(i = 0; i < sz; i += PGSIZE){ if((pte = walkpgdir(pgdir, addr+i, 0)) == 0) 801067f1: e8 1a fc ff ff call 80106410 <walkpgdir> 801067f6: 85 c0 test %eax,%eax 801067f8: 74 58 je 80106852 <loaduvm+0xa2> panic("loaduvm: address should exist"); pa = PTE_ADDR(*pte); 801067fa: 8b 00 mov (%eax),%eax if(sz - i < PGSIZE) 801067fc: ba 00 10 00 00 mov $0x1000,%edx n = sz - i; else n = PGSIZE; if(readi(ip, P2V(pa), offset+i, n) != n) 80106801: 8b 4d 14 mov 0x14(%ebp),%ecx if((uint) addr % PGSIZE != 0) panic("loaduvm: addr must be page aligned"); for(i = 0; i < sz; i += PGSIZE){ if((pte = walkpgdir(pgdir, addr+i, 0)) == 0) panic("loaduvm: address should exist"); pa = PTE_ADDR(*pte); 80106804: 25 00 f0 ff ff and $0xfffff000,%eax if(sz - i < PGSIZE) 80106809: 81 fe ff 0f 00 00 cmp $0xfff,%esi 8010680f: 0f 46 d6 cmovbe %esi,%edx n = sz - i; else n = PGSIZE; if(readi(ip, P2V(pa), offset+i, n) != n) 80106812: 05 00 00 00 80 add $0x80000000,%eax 80106817: 89 44 24 04 mov %eax,0x4(%esp) 8010681b: 8b 45 10 mov 0x10(%ebp),%eax 8010681e: 01 d9 add %ebx,%ecx 80106820: 89 54 24 0c mov %edx,0xc(%esp) 80106824: 89 55 e4 mov %edx,-0x1c(%ebp) 80106827: 89 4c 24 08 mov %ecx,0x8(%esp) 8010682b: 89 04 24 mov %eax,(%esp) 8010682e: e8 4d b1 ff ff call 80101980 <readi> 80106833: 8b 55 e4 mov -0x1c(%ebp),%edx 80106836: 39 d0 cmp %edx,%eax 80106838: 74 9e je 801067d8 <loaduvm+0x28> return -1; } return 0; } 8010683a: 83 c4 2c add $0x2c,%esp if(sz - i < PGSIZE) n = sz - i; else n = PGSIZE; if(readi(ip, P2V(pa), offset+i, n) != n) return -1; 8010683d: b8 ff ff ff ff mov $0xffffffff,%eax } return 0; } 80106842: 5b pop %ebx 80106843: 5e pop %esi 80106844: 5f pop %edi 80106845: 5d pop %ebp 80106846: c3 ret 80106847: 90 nop 80106848: 83 c4 2c add $0x2c,%esp else n = PGSIZE; if(readi(ip, P2V(pa), offset+i, n) != n) return -1; } return 0; 8010684b: 31 c0 xor %eax,%eax } 8010684d: 5b pop %ebx 8010684e: 5e pop %esi 8010684f: 5f pop %edi 80106850: 5d pop %ebp 80106851: c3 ret if((uint) addr % PGSIZE != 0) panic("loaduvm: addr must be page aligned"); for(i = 0; i < sz; i += PGSIZE){ if((pte = walkpgdir(pgdir, addr+i, 0)) == 0) panic("loaduvm: address should exist"); 80106852: c7 04 24 47 76 10 80 movl $0x80107647,(%esp) 80106859: e8 12 9b ff ff call 80100370 <panic> { uint i, pa, n; pte_t *pte; if((uint) addr % PGSIZE != 0) panic("loaduvm: addr must be page aligned"); 8010685e: c7 04 24 e8 76 10 80 movl $0x801076e8,(%esp) 80106865: e8 06 9b ff ff call 80100370 <panic> 8010686a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80106870 <deallocuvm>: // newsz. oldsz and newsz need not be page-aligned, nor does newsz // need to be less than oldsz. oldsz can be larger than the actual // process size. Returns the new process size. int deallocuvm(pde_t *pgdir, uint oldsz, uint newsz) { 80106870: 55 push %ebp 80106871: 89 e5 mov %esp,%ebp 80106873: 57 push %edi 80106874: 56 push %esi 80106875: 53 push %ebx 80106876: 83 ec 2c sub $0x2c,%esp 80106879: 8b 75 0c mov 0xc(%ebp),%esi pte_t *pte; uint a, pa; if(newsz >= oldsz) 8010687c: 39 75 10 cmp %esi,0x10(%ebp) // newsz. oldsz and newsz need not be page-aligned, nor does newsz // need to be less than oldsz. oldsz can be larger than the actual // process size. Returns the new process size. int deallocuvm(pde_t *pgdir, uint oldsz, uint newsz) { 8010687f: 8b 7d 08 mov 0x8(%ebp),%edi pte_t *pte; uint a, pa; if(newsz >= oldsz) return oldsz; 80106882: 89 f0 mov %esi,%eax deallocuvm(pde_t *pgdir, uint oldsz, uint newsz) { pte_t *pte; uint a, pa; if(newsz >= oldsz) 80106884: 73 75 jae 801068fb <deallocuvm+0x8b> return oldsz; a = PGROUNDUP(newsz); 80106886: 8b 5d 10 mov 0x10(%ebp),%ebx 80106889: 81 c3 ff 0f 00 00 add $0xfff,%ebx 8010688f: 81 e3 00 f0 ff ff and $0xfffff000,%ebx for(; a < oldsz; a += PGSIZE){ 80106895: 39 de cmp %ebx,%esi 80106897: 77 3a ja 801068d3 <deallocuvm+0x63> 80106899: eb 5d jmp 801068f8 <deallocuvm+0x88> 8010689b: 90 nop 8010689c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi pte = walkpgdir(pgdir, (char*)a, 0); if(!pte) a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE; else if((*pte & PTE_P) != 0){ 801068a0: 8b 10 mov (%eax),%edx 801068a2: f6 c2 01 test $0x1,%dl 801068a5: 74 22 je 801068c9 <deallocuvm+0x59> pa = PTE_ADDR(*pte); if(pa == 0) 801068a7: 81 e2 00 f0 ff ff and $0xfffff000,%edx 801068ad: 74 54 je 80106903 <deallocuvm+0x93> panic("kfree"); char *v = P2V(pa); 801068af: 81 c2 00 00 00 80 add $0x80000000,%edx kfree(v); 801068b5: 89 45 e4 mov %eax,-0x1c(%ebp) 801068b8: 89 14 24 mov %edx,(%esp) 801068bb: e8 80 ba ff ff call 80102340 <kfree> *pte = 0; 801068c0: 8b 45 e4 mov -0x1c(%ebp),%eax 801068c3: c7 00 00 00 00 00 movl $0x0,(%eax) if(newsz >= oldsz) return oldsz; a = PGROUNDUP(newsz); for(; a < oldsz; a += PGSIZE){ 801068c9: 81 c3 00 10 00 00 add $0x1000,%ebx 801068cf: 39 de cmp %ebx,%esi 801068d1: 76 25 jbe 801068f8 <deallocuvm+0x88> pte = walkpgdir(pgdir, (char*)a, 0); 801068d3: 31 c9 xor %ecx,%ecx 801068d5: 89 da mov %ebx,%edx 801068d7: 89 f8 mov %edi,%eax 801068d9: e8 32 fb ff ff call 80106410 <walkpgdir> if(!pte) 801068de: 85 c0 test %eax,%eax 801068e0: 75 be jne 801068a0 <deallocuvm+0x30> a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE; 801068e2: 81 e3 00 00 c0 ff and $0xffc00000,%ebx 801068e8: 81 c3 00 f0 3f 00 add $0x3ff000,%ebx if(newsz >= oldsz) return oldsz; a = PGROUNDUP(newsz); for(; a < oldsz; a += PGSIZE){ 801068ee: 81 c3 00 10 00 00 add $0x1000,%ebx 801068f4: 39 de cmp %ebx,%esi 801068f6: 77 db ja 801068d3 <deallocuvm+0x63> char *v = P2V(pa); kfree(v); *pte = 0; } } return newsz; 801068f8: 8b 45 10 mov 0x10(%ebp),%eax } 801068fb: 83 c4 2c add $0x2c,%esp 801068fe: 5b pop %ebx 801068ff: 5e pop %esi 80106900: 5f pop %edi 80106901: 5d pop %ebp 80106902: c3 ret if(!pte) a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE; else if((*pte & PTE_P) != 0){ pa = PTE_ADDR(*pte); if(pa == 0) panic("kfree"); 80106903: c7 04 24 a6 6f 10 80 movl $0x80106fa6,(%esp) 8010690a: e8 61 9a ff ff call 80100370 <panic> 8010690f: 90 nop 80106910 <allocuvm>: // Allocate page tables and physical memory to grow process from oldsz to // newsz, which need not be page aligned. Returns new size or 0 on error. int allocuvm(pde_t *pgdir, uint oldsz, uint newsz) { 80106910: 55 push %ebp 80106911: 89 e5 mov %esp,%ebp 80106913: 57 push %edi 80106914: 56 push %esi 80106915: 53 push %ebx 80106916: 83 ec 2c sub $0x2c,%esp 80106919: 8b 7d 10 mov 0x10(%ebp),%edi char *mem; uint a; if(newsz >= KERNBASE) 8010691c: 85 ff test %edi,%edi 8010691e: 89 7d e4 mov %edi,-0x1c(%ebp) 80106921: 0f 88 c1 00 00 00 js 801069e8 <allocuvm+0xd8> return 0; if(newsz < oldsz) 80106927: 8b 45 0c mov 0xc(%ebp),%eax 8010692a: 39 c7 cmp %eax,%edi 8010692c: 0f 82 a6 00 00 00 jb 801069d8 <allocuvm+0xc8> return oldsz; a = PGROUNDUP(oldsz); 80106932: 8b 75 0c mov 0xc(%ebp),%esi 80106935: 81 c6 ff 0f 00 00 add $0xfff,%esi 8010693b: 81 e6 00 f0 ff ff and $0xfffff000,%esi for(; a < newsz; a += PGSIZE){ 80106941: 39 f7 cmp %esi,%edi 80106943: 77 51 ja 80106996 <allocuvm+0x86> 80106945: e9 91 00 00 00 jmp 801069db <allocuvm+0xcb> 8010694a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if(mem == 0){ cprintf("allocuvm out of memory\n"); deallocuvm(pgdir, newsz, oldsz); return 0; } memset(mem, 0, PGSIZE); 80106950: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) 80106957: 00 80106958: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 8010695f: 00 80106960: 89 04 24 mov %eax,(%esp) 80106963: e8 d8 d9 ff ff call 80104340 <memset> if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){ 80106968: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax 8010696e: b9 00 10 00 00 mov $0x1000,%ecx 80106973: 89 04 24 mov %eax,(%esp) 80106976: 8b 45 08 mov 0x8(%ebp),%eax 80106979: 89 f2 mov %esi,%edx 8010697b: c7 44 24 04 06 00 00 movl $0x6,0x4(%esp) 80106982: 00 80106983: e8 18 fb ff ff call 801064a0 <mappages> 80106988: 85 c0 test %eax,%eax 8010698a: 78 74 js 80106a00 <allocuvm+0xf0> return 0; if(newsz < oldsz) return oldsz; a = PGROUNDUP(oldsz); for(; a < newsz; a += PGSIZE){ 8010698c: 81 c6 00 10 00 00 add $0x1000,%esi 80106992: 39 f7 cmp %esi,%edi 80106994: 76 45 jbe 801069db <allocuvm+0xcb> mem = kalloc(); 80106996: e8 15 bb ff ff call 801024b0 <kalloc> if(mem == 0){ 8010699b: 85 c0 test %eax,%eax if(newsz < oldsz) return oldsz; a = PGROUNDUP(oldsz); for(; a < newsz; a += PGSIZE){ mem = kalloc(); 8010699d: 89 c3 mov %eax,%ebx if(mem == 0){ 8010699f: 75 af jne 80106950 <allocuvm+0x40> cprintf("allocuvm out of memory\n"); 801069a1: c7 04 24 65 76 10 80 movl $0x80107665,(%esp) 801069a8: e8 a3 9c ff ff call 80100650 <cprintf> deallocuvm(pgdir, newsz, oldsz); 801069ad: 8b 45 0c mov 0xc(%ebp),%eax 801069b0: 89 7c 24 04 mov %edi,0x4(%esp) 801069b4: 89 44 24 08 mov %eax,0x8(%esp) 801069b8: 8b 45 08 mov 0x8(%ebp),%eax 801069bb: 89 04 24 mov %eax,(%esp) 801069be: e8 ad fe ff ff call 80106870 <deallocuvm> return 0; 801069c3: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) kfree(mem); return 0; } } return newsz; } 801069ca: 8b 45 e4 mov -0x1c(%ebp),%eax 801069cd: 83 c4 2c add $0x2c,%esp 801069d0: 5b pop %ebx 801069d1: 5e pop %esi 801069d2: 5f pop %edi 801069d3: 5d pop %ebp 801069d4: c3 ret 801069d5: 8d 76 00 lea 0x0(%esi),%esi uint a; if(newsz >= KERNBASE) return 0; if(newsz < oldsz) return oldsz; 801069d8: 89 45 e4 mov %eax,-0x1c(%ebp) kfree(mem); return 0; } } return newsz; } 801069db: 8b 45 e4 mov -0x1c(%ebp),%eax 801069de: 83 c4 2c add $0x2c,%esp 801069e1: 5b pop %ebx 801069e2: 5e pop %esi 801069e3: 5f pop %edi 801069e4: 5d pop %ebp 801069e5: c3 ret 801069e6: 66 90 xchg %ax,%ax { char *mem; uint a; if(newsz >= KERNBASE) return 0; 801069e8: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) kfree(mem); return 0; } } return newsz; } 801069ef: 8b 45 e4 mov -0x1c(%ebp),%eax 801069f2: 83 c4 2c add $0x2c,%esp 801069f5: 5b pop %ebx 801069f6: 5e pop %esi 801069f7: 5f pop %edi 801069f8: 5d pop %ebp 801069f9: c3 ret 801069fa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi deallocuvm(pgdir, newsz, oldsz); return 0; } memset(mem, 0, PGSIZE); if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){ cprintf("allocuvm out of memory (2)\n"); 80106a00: c7 04 24 7d 76 10 80 movl $0x8010767d,(%esp) 80106a07: e8 44 9c ff ff call 80100650 <cprintf> deallocuvm(pgdir, newsz, oldsz); 80106a0c: 8b 45 0c mov 0xc(%ebp),%eax 80106a0f: 89 7c 24 04 mov %edi,0x4(%esp) 80106a13: 89 44 24 08 mov %eax,0x8(%esp) 80106a17: 8b 45 08 mov 0x8(%ebp),%eax 80106a1a: 89 04 24 mov %eax,(%esp) 80106a1d: e8 4e fe ff ff call 80106870 <deallocuvm> kfree(mem); 80106a22: 89 1c 24 mov %ebx,(%esp) 80106a25: e8 16 b9 ff ff call 80102340 <kfree> return 0; 80106a2a: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) } } return newsz; } 80106a31: 8b 45 e4 mov -0x1c(%ebp),%eax 80106a34: 83 c4 2c add $0x2c,%esp 80106a37: 5b pop %ebx 80106a38: 5e pop %esi 80106a39: 5f pop %edi 80106a3a: 5d pop %ebp 80106a3b: c3 ret 80106a3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80106a40 <freevm>: // Free a page table and all the physical memory pages // in the user part. void freevm(pde_t *pgdir) { 80106a40: 55 push %ebp 80106a41: 89 e5 mov %esp,%ebp 80106a43: 56 push %esi 80106a44: 53 push %ebx 80106a45: 83 ec 10 sub $0x10,%esp 80106a48: 8b 5d 08 mov 0x8(%ebp),%ebx uint i; if(pgdir == 0) 80106a4b: 85 db test %ebx,%ebx 80106a4d: 74 5e je 80106aad <freevm+0x6d> panic("freevm: no pgdir"); deallocuvm(pgdir, KERNBASE, 0); 80106a4f: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp) 80106a56: 00 for(i = 0; i < NPDENTRIES; i++){ 80106a57: 31 f6 xor %esi,%esi { uint i; if(pgdir == 0) panic("freevm: no pgdir"); deallocuvm(pgdir, KERNBASE, 0); 80106a59: c7 44 24 04 00 00 00 movl $0x80000000,0x4(%esp) 80106a60: 80 80106a61: 89 1c 24 mov %ebx,(%esp) 80106a64: e8 07 fe ff ff call 80106870 <deallocuvm> 80106a69: eb 10 jmp 80106a7b <freevm+0x3b> 80106a6b: 90 nop 80106a6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for(i = 0; i < NPDENTRIES; i++){ 80106a70: 83 c6 01 add $0x1,%esi 80106a73: 81 fe 00 04 00 00 cmp $0x400,%esi 80106a79: 74 24 je 80106a9f <freevm+0x5f> if(pgdir[i] & PTE_P){ 80106a7b: 8b 04 b3 mov (%ebx,%esi,4),%eax 80106a7e: a8 01 test $0x1,%al 80106a80: 74 ee je 80106a70 <freevm+0x30> char * v = P2V(PTE_ADDR(pgdir[i])); 80106a82: 25 00 f0 ff ff and $0xfffff000,%eax uint i; if(pgdir == 0) panic("freevm: no pgdir"); deallocuvm(pgdir, KERNBASE, 0); for(i = 0; i < NPDENTRIES; i++){ 80106a87: 83 c6 01 add $0x1,%esi if(pgdir[i] & PTE_P){ char * v = P2V(PTE_ADDR(pgdir[i])); 80106a8a: 05 00 00 00 80 add $0x80000000,%eax kfree(v); 80106a8f: 89 04 24 mov %eax,(%esp) 80106a92: e8 a9 b8 ff ff call 80102340 <kfree> uint i; if(pgdir == 0) panic("freevm: no pgdir"); deallocuvm(pgdir, KERNBASE, 0); for(i = 0; i < NPDENTRIES; i++){ 80106a97: 81 fe 00 04 00 00 cmp $0x400,%esi 80106a9d: 75 dc jne 80106a7b <freevm+0x3b> if(pgdir[i] & PTE_P){ char * v = P2V(PTE_ADDR(pgdir[i])); kfree(v); } } kfree((char*)pgdir); 80106a9f: 89 5d 08 mov %ebx,0x8(%ebp) } 80106aa2: 83 c4 10 add $0x10,%esp 80106aa5: 5b pop %ebx 80106aa6: 5e pop %esi 80106aa7: 5d pop %ebp if(pgdir[i] & PTE_P){ char * v = P2V(PTE_ADDR(pgdir[i])); kfree(v); } } kfree((char*)pgdir); 80106aa8: e9 93 b8 ff ff jmp 80102340 <kfree> freevm(pde_t *pgdir) { uint i; if(pgdir == 0) panic("freevm: no pgdir"); 80106aad: c7 04 24 99 76 10 80 movl $0x80107699,(%esp) 80106ab4: e8 b7 98 ff ff call 80100370 <panic> 80106ab9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106ac0 <setupkvm>: }; // Set up kernel part of a page table. pde_t* setupkvm(void) { 80106ac0: 55 push %ebp 80106ac1: 89 e5 mov %esp,%ebp 80106ac3: 56 push %esi 80106ac4: 53 push %ebx 80106ac5: 83 ec 10 sub $0x10,%esp pde_t *pgdir; struct kmap *k; if((pgdir = (pde_t*)kalloc()) == 0) 80106ac8: e8 e3 b9 ff ff call 801024b0 <kalloc> 80106acd: 85 c0 test %eax,%eax 80106acf: 89 c6 mov %eax,%esi 80106ad1: 74 47 je 80106b1a <setupkvm+0x5a> return 0; memset(pgdir, 0, PGSIZE); 80106ad3: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) 80106ada: 00 if (P2V(PHYSTOP) > (void*)DEVSPACE) panic("PHYSTOP too high"); for(k = kmap; k < &kmap[NELEM(kmap)]; k++) 80106adb: bb 20 a4 10 80 mov $0x8010a420,%ebx pde_t *pgdir; struct kmap *k; if((pgdir = (pde_t*)kalloc()) == 0) return 0; memset(pgdir, 0, PGSIZE); 80106ae0: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 80106ae7: 00 80106ae8: 89 04 24 mov %eax,(%esp) 80106aeb: e8 50 d8 ff ff call 80104340 <memset> if (P2V(PHYSTOP) > (void*)DEVSPACE) panic("PHYSTOP too high"); for(k = kmap; k < &kmap[NELEM(kmap)]; k++) if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, 80106af0: 8b 53 0c mov 0xc(%ebx),%edx 80106af3: 8b 43 04 mov 0x4(%ebx),%eax 80106af6: 8b 4b 08 mov 0x8(%ebx),%ecx 80106af9: 89 54 24 04 mov %edx,0x4(%esp) 80106afd: 8b 13 mov (%ebx),%edx 80106aff: 89 04 24 mov %eax,(%esp) 80106b02: 29 c1 sub %eax,%ecx 80106b04: 89 f0 mov %esi,%eax 80106b06: e8 95 f9 ff ff call 801064a0 <mappages> 80106b0b: 85 c0 test %eax,%eax 80106b0d: 78 19 js 80106b28 <setupkvm+0x68> if((pgdir = (pde_t*)kalloc()) == 0) return 0; memset(pgdir, 0, PGSIZE); if (P2V(PHYSTOP) > (void*)DEVSPACE) panic("PHYSTOP too high"); for(k = kmap; k < &kmap[NELEM(kmap)]; k++) 80106b0f: 83 c3 10 add $0x10,%ebx 80106b12: 81 fb 60 a4 10 80 cmp $0x8010a460,%ebx 80106b18: 72 d6 jb 80106af0 <setupkvm+0x30> (uint)k->phys_start, k->perm) < 0) { freevm(pgdir); return 0; } return pgdir; } 80106b1a: 83 c4 10 add $0x10,%esp 80106b1d: 89 f0 mov %esi,%eax 80106b1f: 5b pop %ebx 80106b20: 5e pop %esi 80106b21: 5d pop %ebp 80106b22: c3 ret 80106b23: 90 nop 80106b24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if (P2V(PHYSTOP) > (void*)DEVSPACE) panic("PHYSTOP too high"); for(k = kmap; k < &kmap[NELEM(kmap)]; k++) if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, (uint)k->phys_start, k->perm) < 0) { freevm(pgdir); 80106b28: 89 34 24 mov %esi,(%esp) return 0; 80106b2b: 31 f6 xor %esi,%esi if (P2V(PHYSTOP) > (void*)DEVSPACE) panic("PHYSTOP too high"); for(k = kmap; k < &kmap[NELEM(kmap)]; k++) if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, (uint)k->phys_start, k->perm) < 0) { freevm(pgdir); 80106b2d: e8 0e ff ff ff call 80106a40 <freevm> return 0; } return pgdir; } 80106b32: 83 c4 10 add $0x10,%esp 80106b35: 89 f0 mov %esi,%eax 80106b37: 5b pop %ebx 80106b38: 5e pop %esi 80106b39: 5d pop %ebp 80106b3a: c3 ret 80106b3b: 90 nop 80106b3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80106b40 <kvmalloc>: // Allocate one page table for the machine for the kernel address // space for scheduler processes. void kvmalloc(void) { 80106b40: 55 push %ebp 80106b41: 89 e5 mov %esp,%ebp 80106b43: 83 ec 08 sub $0x8,%esp kpgdir = setupkvm(); 80106b46: e8 75 ff ff ff call 80106ac0 <setupkvm> 80106b4b: a3 a4 54 11 80 mov %eax,0x801154a4 // Switch h/w page table register to the kernel-only page table, // for when no process is running. void switchkvm(void) { lcr3(V2P(kpgdir)); // switch to the kernel page table 80106b50: 05 00 00 00 80 add $0x80000000,%eax 80106b55: 0f 22 d8 mov %eax,%cr3 void kvmalloc(void) { kpgdir = setupkvm(); switchkvm(); } 80106b58: c9 leave 80106b59: c3 ret 80106b5a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80106b60 <clearpteu>: // Clear PTE_U on a page. Used to create an inaccessible // page beneath the user stack. void clearpteu(pde_t *pgdir, char *uva) { 80106b60: 55 push %ebp pte_t *pte; pte = walkpgdir(pgdir, uva, 0); 80106b61: 31 c9 xor %ecx,%ecx // Clear PTE_U on a page. Used to create an inaccessible // page beneath the user stack. void clearpteu(pde_t *pgdir, char *uva) { 80106b63: 89 e5 mov %esp,%ebp 80106b65: 83 ec 18 sub $0x18,%esp pte_t *pte; pte = walkpgdir(pgdir, uva, 0); 80106b68: 8b 55 0c mov 0xc(%ebp),%edx 80106b6b: 8b 45 08 mov 0x8(%ebp),%eax 80106b6e: e8 9d f8 ff ff call 80106410 <walkpgdir> if(pte == 0) 80106b73: 85 c0 test %eax,%eax 80106b75: 74 05 je 80106b7c <clearpteu+0x1c> panic("clearpteu"); *pte &= ~PTE_U; 80106b77: 83 20 fb andl $0xfffffffb,(%eax) } 80106b7a: c9 leave 80106b7b: c3 ret { pte_t *pte; pte = walkpgdir(pgdir, uva, 0); if(pte == 0) panic("clearpteu"); 80106b7c: c7 04 24 aa 76 10 80 movl $0x801076aa,(%esp) 80106b83: e8 e8 97 ff ff call 80100370 <panic> 80106b88: 90 nop 80106b89: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106b90 <copyuvm>: // Given a parent process's page table, create a copy // of it for a child. pde_t* copyuvm(pde_t *pgdir, uint sz) { 80106b90: 55 push %ebp 80106b91: 89 e5 mov %esp,%ebp 80106b93: 57 push %edi 80106b94: 56 push %esi 80106b95: 53 push %ebx 80106b96: 83 ec 2c sub $0x2c,%esp pde_t *d; pte_t *pte; uint pa, i, flags; char *mem; if((d = setupkvm()) == 0) 80106b99: e8 22 ff ff ff call 80106ac0 <setupkvm> 80106b9e: 85 c0 test %eax,%eax 80106ba0: 89 c7 mov %eax,%edi 80106ba2: 0f 84 91 00 00 00 je 80106c39 <copyuvm+0xa9> return 0; for(i = 0; i < sz; i += PGSIZE){ 80106ba8: 8b 4d 0c mov 0xc(%ebp),%ecx 80106bab: 85 c9 test %ecx,%ecx 80106bad: 0f 84 86 00 00 00 je 80106c39 <copyuvm+0xa9> 80106bb3: 31 f6 xor %esi,%esi 80106bb5: eb 54 jmp 80106c0b <copyuvm+0x7b> 80106bb7: 90 nop if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0) panic("copyuvm: pte should exist"); if(!(*pte & PTE_P)) panic("copyuvm: page not present"); pa = PTE_ADDR(*pte); 80106bb8: 8b 45 e4 mov -0x1c(%ebp),%eax flags = PTE_FLAGS(*pte); if((mem = kalloc()) == 0) goto bad; memmove(mem, (char*)P2V(pa), PGSIZE); 80106bbb: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp) 80106bc2: 00 80106bc3: 89 1c 24 mov %ebx,(%esp) for(i = 0; i < sz; i += PGSIZE){ if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0) panic("copyuvm: pte should exist"); if(!(*pte & PTE_P)) panic("copyuvm: page not present"); pa = PTE_ADDR(*pte); 80106bc6: 25 00 f0 ff ff and $0xfffff000,%eax flags = PTE_FLAGS(*pte); if((mem = kalloc()) == 0) goto bad; memmove(mem, (char*)P2V(pa), PGSIZE); 80106bcb: 05 00 00 00 80 add $0x80000000,%eax 80106bd0: 89 44 24 04 mov %eax,0x4(%esp) 80106bd4: e8 27 d8 ff ff call 80104400 <memmove> if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0) panic("copyuvm: pte should exist"); if(!(*pte & PTE_P)) panic("copyuvm: page not present"); pa = PTE_ADDR(*pte); flags = PTE_FLAGS(*pte); 80106bd9: 8b 45 e4 mov -0x1c(%ebp),%eax if((mem = kalloc()) == 0) goto bad; memmove(mem, (char*)P2V(pa), PGSIZE); if(mappages(d, (void*)i, PGSIZE, V2P(mem), flags) < 0) { 80106bdc: b9 00 10 00 00 mov $0x1000,%ecx 80106be1: 89 f2 mov %esi,%edx if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0) panic("copyuvm: pte should exist"); if(!(*pte & PTE_P)) panic("copyuvm: page not present"); pa = PTE_ADDR(*pte); flags = PTE_FLAGS(*pte); 80106be3: 25 ff 0f 00 00 and $0xfff,%eax if((mem = kalloc()) == 0) goto bad; memmove(mem, (char*)P2V(pa), PGSIZE); if(mappages(d, (void*)i, PGSIZE, V2P(mem), flags) < 0) { 80106be8: 89 44 24 04 mov %eax,0x4(%esp) 80106bec: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax 80106bf2: 89 04 24 mov %eax,(%esp) 80106bf5: 89 f8 mov %edi,%eax 80106bf7: e8 a4 f8 ff ff call 801064a0 <mappages> 80106bfc: 85 c0 test %eax,%eax 80106bfe: 78 48 js 80106c48 <copyuvm+0xb8> uint pa, i, flags; char *mem; if((d = setupkvm()) == 0) return 0; for(i = 0; i < sz; i += PGSIZE){ 80106c00: 81 c6 00 10 00 00 add $0x1000,%esi 80106c06: 39 75 0c cmp %esi,0xc(%ebp) 80106c09: 76 2e jbe 80106c39 <copyuvm+0xa9> if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0) 80106c0b: 8b 45 08 mov 0x8(%ebp),%eax 80106c0e: 31 c9 xor %ecx,%ecx 80106c10: 89 f2 mov %esi,%edx 80106c12: e8 f9 f7 ff ff call 80106410 <walkpgdir> 80106c17: 85 c0 test %eax,%eax 80106c19: 74 43 je 80106c5e <copyuvm+0xce> panic("copyuvm: pte should exist"); if(!(*pte & PTE_P)) 80106c1b: 8b 00 mov (%eax),%eax 80106c1d: a8 01 test $0x1,%al 80106c1f: 89 45 e4 mov %eax,-0x1c(%ebp) 80106c22: 74 2e je 80106c52 <copyuvm+0xc2> panic("copyuvm: page not present"); pa = PTE_ADDR(*pte); flags = PTE_FLAGS(*pte); if((mem = kalloc()) == 0) 80106c24: e8 87 b8 ff ff call 801024b0 <kalloc> 80106c29: 85 c0 test %eax,%eax 80106c2b: 89 c3 mov %eax,%ebx 80106c2d: 75 89 jne 80106bb8 <copyuvm+0x28> } } return d; bad: freevm(d); 80106c2f: 89 3c 24 mov %edi,(%esp) return 0; 80106c32: 31 ff xor %edi,%edi } } return d; bad: freevm(d); 80106c34: e8 07 fe ff ff call 80106a40 <freevm> return 0; } 80106c39: 83 c4 2c add $0x2c,%esp 80106c3c: 89 f8 mov %edi,%eax 80106c3e: 5b pop %ebx 80106c3f: 5e pop %esi 80106c40: 5f pop %edi 80106c41: 5d pop %ebp 80106c42: c3 ret 80106c43: 90 nop 80106c44: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi flags = PTE_FLAGS(*pte); if((mem = kalloc()) == 0) goto bad; memmove(mem, (char*)P2V(pa), PGSIZE); if(mappages(d, (void*)i, PGSIZE, V2P(mem), flags) < 0) { kfree(mem); 80106c48: 89 1c 24 mov %ebx,(%esp) 80106c4b: e8 f0 b6 ff ff call 80102340 <kfree> goto bad; 80106c50: eb dd jmp 80106c2f <copyuvm+0x9f> return 0; for(i = 0; i < sz; i += PGSIZE){ if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0) panic("copyuvm: pte should exist"); if(!(*pte & PTE_P)) panic("copyuvm: page not present"); 80106c52: c7 04 24 ce 76 10 80 movl $0x801076ce,(%esp) 80106c59: e8 12 97 ff ff call 80100370 <panic> if((d = setupkvm()) == 0) return 0; for(i = 0; i < sz; i += PGSIZE){ if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0) panic("copyuvm: pte should exist"); 80106c5e: c7 04 24 b4 76 10 80 movl $0x801076b4,(%esp) 80106c65: e8 06 97 ff ff call 80100370 <panic> 80106c6a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80106c70 <uva2ka>: //PAGEBREAK! // Map user virtual address to kernel address. char* uva2ka(pde_t *pgdir, char *uva) { 80106c70: 55 push %ebp pte_t *pte; pte = walkpgdir(pgdir, uva, 0); 80106c71: 31 c9 xor %ecx,%ecx //PAGEBREAK! // Map user virtual address to kernel address. char* uva2ka(pde_t *pgdir, char *uva) { 80106c73: 89 e5 mov %esp,%ebp 80106c75: 83 ec 08 sub $0x8,%esp pte_t *pte; pte = walkpgdir(pgdir, uva, 0); 80106c78: 8b 55 0c mov 0xc(%ebp),%edx 80106c7b: 8b 45 08 mov 0x8(%ebp),%eax 80106c7e: e8 8d f7 ff ff call 80106410 <walkpgdir> if((*pte & PTE_P) == 0) 80106c83: 8b 10 mov (%eax),%edx return 0; 80106c85: 31 c0 xor %eax,%eax uva2ka(pde_t *pgdir, char *uva) { pte_t *pte; pte = walkpgdir(pgdir, uva, 0); if((*pte & PTE_P) == 0) 80106c87: f6 c2 01 test $0x1,%dl 80106c8a: 74 11 je 80106c9d <uva2ka+0x2d> return 0; if((*pte & PTE_U) == 0) 80106c8c: f6 c2 04 test $0x4,%dl 80106c8f: 74 0c je 80106c9d <uva2ka+0x2d> return 0; return (char*)P2V(PTE_ADDR(*pte)); 80106c91: 81 e2 00 f0 ff ff and $0xfffff000,%edx 80106c97: 8d 82 00 00 00 80 lea -0x80000000(%edx),%eax } 80106c9d: c9 leave 80106c9e: c3 ret 80106c9f: 90 nop 80106ca0 <copyout>: // Copy len bytes from p to user address va in page table pgdir. // Most useful when pgdir is not the current page table. // uva2ka ensures this only works for PTE_U pages. int copyout(pde_t *pgdir, uint va, void *p, uint len) { 80106ca0: 55 push %ebp memmove(pa0 + (va - va0), buf, n); len -= n; buf += n; va = va0 + PGSIZE; } return 0; 80106ca1: 31 c0 xor %eax,%eax // Copy len bytes from p to user address va in page table pgdir. // Most useful when pgdir is not the current page table. // uva2ka ensures this only works for PTE_U pages. int copyout(pde_t *pgdir, uint va, void *p, uint len) { 80106ca3: 89 e5 mov %esp,%ebp 80106ca5: 57 push %edi 80106ca6: 56 push %esi 80106ca7: 53 push %ebx 80106ca8: 83 ec 2c sub $0x2c,%esp 80106cab: 8b 5d 14 mov 0x14(%ebp),%ebx 80106cae: 8b 55 0c mov 0xc(%ebp),%edx char *buf, *pa0; uint n, va0; buf = (char*)p; while(len > 0){ 80106cb1: 85 db test %ebx,%ebx 80106cb3: 74 64 je 80106d19 <copyout+0x79> 80106cb5: 8b 4d 10 mov 0x10(%ebp),%ecx 80106cb8: 89 4d e4 mov %ecx,-0x1c(%ebp) 80106cbb: eb 36 jmp 80106cf3 <copyout+0x53> 80106cbd: 8d 76 00 lea 0x0(%esi),%esi va0 = (uint)PGROUNDDOWN(va); pa0 = uva2ka(pgdir, (char*)va0); if(pa0 == 0) return -1; n = PGSIZE - (va - va0); 80106cc0: 89 f7 mov %esi,%edi if(n > len) n = len; memmove(pa0 + (va - va0), buf, n); 80106cc2: 8b 4d e4 mov -0x1c(%ebp),%ecx while(len > 0){ va0 = (uint)PGROUNDDOWN(va); pa0 = uva2ka(pgdir, (char*)va0); if(pa0 == 0) return -1; n = PGSIZE - (va - va0); 80106cc5: 29 d7 sub %edx,%edi 80106cc7: 81 c7 00 10 00 00 add $0x1000,%edi 80106ccd: 39 df cmp %ebx,%edi 80106ccf: 0f 47 fb cmova %ebx,%edi if(n > len) n = len; memmove(pa0 + (va - va0), buf, n); 80106cd2: 29 f2 sub %esi,%edx 80106cd4: 01 c2 add %eax,%edx 80106cd6: 89 14 24 mov %edx,(%esp) 80106cd9: 89 7c 24 08 mov %edi,0x8(%esp) 80106cdd: 89 4c 24 04 mov %ecx,0x4(%esp) 80106ce1: e8 1a d7 ff ff call 80104400 <memmove> len -= n; buf += n; va = va0 + PGSIZE; 80106ce6: 8d 96 00 10 00 00 lea 0x1000(%esi),%edx n = PGSIZE - (va - va0); if(n > len) n = len; memmove(pa0 + (va - va0), buf, n); len -= n; buf += n; 80106cec: 01 7d e4 add %edi,-0x1c(%ebp) { char *buf, *pa0; uint n, va0; buf = (char*)p; while(len > 0){ 80106cef: 29 fb sub %edi,%ebx 80106cf1: 74 35 je 80106d28 <copyout+0x88> va0 = (uint)PGROUNDDOWN(va); pa0 = uva2ka(pgdir, (char*)va0); 80106cf3: 8b 4d 08 mov 0x8(%ebp),%ecx char *buf, *pa0; uint n, va0; buf = (char*)p; while(len > 0){ va0 = (uint)PGROUNDDOWN(va); 80106cf6: 89 d6 mov %edx,%esi 80106cf8: 81 e6 00 f0 ff ff and $0xfffff000,%esi pa0 = uva2ka(pgdir, (char*)va0); 80106cfe: 89 55 e0 mov %edx,-0x20(%ebp) 80106d01: 89 74 24 04 mov %esi,0x4(%esp) 80106d05: 89 0c 24 mov %ecx,(%esp) 80106d08: e8 63 ff ff ff call 80106c70 <uva2ka> if(pa0 == 0) 80106d0d: 8b 55 e0 mov -0x20(%ebp),%edx 80106d10: 85 c0 test %eax,%eax 80106d12: 75 ac jne 80106cc0 <copyout+0x20> return -1; 80106d14: b8 ff ff ff ff mov $0xffffffff,%eax len -= n; buf += n; va = va0 + PGSIZE; } return 0; } 80106d19: 83 c4 2c add $0x2c,%esp 80106d1c: 5b pop %ebx 80106d1d: 5e pop %esi 80106d1e: 5f pop %edi 80106d1f: 5d pop %ebp 80106d20: c3 ret 80106d21: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106d28: 83 c4 2c add $0x2c,%esp memmove(pa0 + (va - va0), buf, n); len -= n; buf += n; va = va0 + PGSIZE; } return 0; 80106d2b: 31 c0 xor %eax,%eax } 80106d2d: 5b pop %ebx 80106d2e: 5e pop %esi 80106d2f: 5f pop %edi 80106d30: 5d pop %ebp 80106d31: c3 ret
32.790298
74
0.537584
116a47d3637754570280b071e399ad6b112ba6d9
39,470
asm
Assembly
Library/SpecUI/CommonUI/CMain/cmainCode.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
504
2018-11-18T03:35:53.000Z
2022-03-29T01:02:51.000Z
Library/SpecUI/CommonUI/CMain/cmainCode.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
96
2018-11-19T21:06:50.000Z
2022-03-06T10:26:48.000Z
Library/SpecUI/CommonUI/CMain/cmainCode.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/Main FILE: mainCode.asm ROUTINES: Name Description ---- ----------- GLB LibraryEntry Entry point for this library. INT SpecInitWindowPreferences Fetches WindowOptions .ini settings, interprets, & stores results in olWindowOptions. INT GetDefaultWindowPreferences Returns default window option preferences, as determined by the specific UI (before user overrides) INT SpecGetWindowOptions Get the window options INT SpecGetExpressOptions Get the express options INT SpecInitExpressPreferences Fetches Express menu .ini settings, interprets INT SpecInitHelpPreferences Initialize help preferences for a field INT SpecInitDefaultDisplayScheme If the first UI screen has been set up yet, fetch its displayType, initialize DisplayScheme DisplayType, Font & PointSize. NOTE: Current implementation is limited to supporting the first video screen only. INT GetFontFromInitFile Returns the FontID and integer part of the FontSize from the init file from given key strings. INT CalcSystemAttrs Calculates system attributes. INT SetLightColors Sets a bunch of color variables to the user-chosen light color. INT SetDarkColors Sets a bunch of color variables to the user-chosen dark color. INT AdjustForDisplayType Set specific UI variables having to do with the color scheme to be used, based on whether on B&W display, or CGA. This allows the code to work quicker by just using the colors & info stored in these tables. INT SpecInitGadgetPreferences If there is a default video driver, init the variable defaultDisplayScheme REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 2/89 Initial version Doug 9/26/89 Documentation update JimG 3/8/94 Added support for editable text size. DESCRIPTION: This file contains misc code for the Open Look library $Id: cmainCode.asm,v 1.8 98/07/10 10:57:54 joon Exp $ ------------------------------------------------------------------------------@ Init segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LibraryEntry %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Entry point for this library. CALLED BY: GLOBAL PASS: di = LibraryCallType RETURN: carry set on error DESTROYED: everything SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- JS 2/28/93 Initial version dlitwin 4/14/94 Now this is defined for all SPUI's, not just WizardBA %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ LibraryEntry proc far cmp di, LCT_ATTACH jne done IKBD< call InitFloatingKbd > done: ret LibraryEntry endp COMMENT @---------------------------------------------------------------------- FUNCTION: SpecInitWindowPreferences DESCRIPTION: Fetches WindowOptions .ini settings, interprets, & stores results in olWindowOptions. CALLED BY: INTERNAL OLFieldAttach PASS: ds:si - field specific category string RETURN: Boolean Variable olWindowOptions set appropriately DESTROYED: ax, bx, cx, dx, bp ------------------------------------------------------------------------------@ SpecInitWindowPreferences proc near uses ds .enter call GetDefaultWindowPreferences ;Returns defaults in bl ; ; Check to see if keyboards are required ; mov cx, cs mov dx, offset windowOptionsString call InitFileReadInteger jc haveDecision push ax and al, ah ; get "1's" to set or bl, al ; or in "1's" pop ax not ah ; get "0's" to set or al, ah and bl, al ; and in "0's" haveDecision: mov cx, segment olWindowOptions mov ds, cx mov ds:[olWindowOptions], bl .leave ret SpecInitWindowPreferences endp windowOptionsString char "windowOptions", 0 COMMENT @---------------------------------------------------------------------- FUNCTION: GetDefaultWindowPreferences DESCRIPTION: Returns default window option preferences, as determined by the specific UI (before user overrides) UIWO_MAXIMIZE_ON_STARTUP:1 Default TRUE if: running on a tiny display screen OR running in Keyboard-only mode OR InterfaceLevel < UIIL_INTERMEDIATE OR LaunchMode = UILM_TRANSPARENT This should be fine for the 2/92 demo disk set. An interesting note regarding Eric's implementation of this for the V1.2 Intermediate room: he decided to maximize EVERYTHING, even things not maximizable, such as the calculator, as it is a pain to lose these little apps when the larger, maximized app behind them is clicked on. Because this was the Intermediate room, he at the same time disable the ability to restore or minimize. I don't think we want to go that far in the professional room, though not doing so is awkard (you start maximized, but can restore, then not maximize again !?). Some thoughts to pursue are: -> having non-maximizable apps always float on top (like dialog boxes) - Doug 2/11/92 UIWO_COMBINE_HEADER_AND_MENU_IN_MAXIMIZED_WINDOWS:1 Default true if running on tiny display screen (temporary turned off - brianc 9/28/92) UIWO_PRIMARY_MIN_MAX_RESTORE_CONTROLS:1 Default false if LaunchMode = UILM_TRANSPARENT else true if UIInterfaceLevel >= UIIL_INTERMEDIATE UIWO_DISPLAY_MIN_MAX_RESTORE_CONTROLS:1 Default true if UIInterfaceLevel >= UIIL_INTERMEDIATE UIWO_WINDOW_MENU:1 ; Default TRUE if keyboardOnly = TRUE. ; ; new thinking: Default TRUE except if penBased = TRUE - brianc 3/23/93 UIWO_PINNABLE_MENUS Default TRUE if UIInterfaceLevel >= UIIL_INTERMEDIATE UIWO_KBD_NAVIGATION Default TRUE if keyboard only or UIInterfaceLevel >= UIIL_INTERMEDIATE UIWO_POPOUT_MENU_BAR Default TRUE if running on tiny display screen CALLED BY: INTERNAL PASS: nothing RETURN: bl - default UIWindowOptions DESTROYED: ax, cx, dx, bp, di REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 8/92 Initial version ------------------------------------------------------------------------------@ GetDefaultWindowPreferences proc near clr bl ; start blank -- no preferences call UserGetDisplayType ; Get display type in ah ; Determine default for UIWO_COMBINE_HEADER_AND_MENU_IN_MAXIMIZED_WINDOWS:1 mov al, ah andnf al, mask DT_DISP_ASPECT_RATIO andnf ah, mask DT_DISP_SIZE ;temporarily turned off - brianc 9/28/92 ; cmp ah, DS_TINY shl offset DT_DISP_SIZE ; jne haveCombineHeaderAndMenu ; or bl, mask UIWO_COMBINE_HEADER_AND_MENU_IN_MAXIMIZED_WINDOWS ;haveCombineHeaderAndMenu: ; Determine default for UIWO_MAXIMIZE_ON_STARTUP:1 cmp ah, DS_TINY shl offset DT_DISP_SIZE je initMaximized cmp al, DAR_VERY_SQUISHED shl offset DT_DISP_ASPECT_RATIO je initMaximized push ax call FlowGetUIButtonFlags test al, mask UIBF_KEYBOARD_ONLY pop ax jnz initMaximized and bl, not mask UIWO_MAXIMIZE_ON_STARTUP jmp short haveMaximizeOnStartup initMaximized: or bl, mask UIWO_MAXIMIZE_ON_STARTUP haveMaximizeOnStartup: ; Determine default for UIWO_POPOUT_MENU_BAR:1 cmp al, DAR_VERY_SQUISHED shl offset DT_DISP_ASPECT_RATIO je popoutMenuBar cmp ah, DS_TINY shl offset DT_DISP_SIZE jne havePopoutMenuBar popoutMenuBar: or bl, mask UIWO_POPOUT_MENU_BAR havePopoutMenuBar: ; Determine default for UIWO_PRIMARY_MIN_MAX_RESTORE_CONTROLS:1, ; UIWO_DISPLAY_MIN_MAX_RESTORE_CONTROLS:1 and UIWO_PINNABLE_MENUS:1 ; Set UIWO_KBD_NAVIGATION true if advanced intermediate. call UserGetDefaultUILevel cmp al, UIIL_BEGINNING jae advancedIntermediate ; If novice or beginning intermediate, default to maximize on startup ; or bl, mask UIWO_MAXIMIZE_ON_STARTUP jmp short afterInterfaceLevel advancedIntermediate: or bl, mask UIWO_PRIMARY_MIN_MAX_RESTORE_CONTROLS or \ mask UIWO_PINNABLE_MENUS or \ mask UIWO_KBD_NAVIGATION afterInterfaceLevel: ; Set UIWO_KBD_NAVIGATION true if keyboard only call FlowGetUIButtonFlags test al, mask UIBF_KEYBOARD_ONLY jz haveKbdOnly or bl, mask UIWO_KBD_NAVIGATION haveKbdOnly: ; Clear UIWO_KBD_NAVIGATION if no keyboard test al, mask UIBF_NO_KEYBOARD jz haveKbdNav ; not no-keyboard, leave andnf bl, not mask UIWO_KBD_NAVIGATION ; else, clear haveKbdNav: ; ; new thinking - set UIWO_WINDOW_MENU except on penBased = TRUE - brianc 3/23/93 ; call SysGetPenMode ; ax = TRUE if penBased tst ax jnz haveWinMenu or bl, mask UIWO_WINDOW_MENU haveWinMenu: ISU < or bl, mask UIWO_WINDOW_MENU ; default on for ISUI > ret GetDefaultWindowPreferences endp COMMENT @---------------------------------------------------------------------- FUNCTION: SpecGetWindowOptions DESCRIPTION: Get the window options CALLED BY: INTERNAL PASS: none RETURN: al - UIWindowOptions ah - 0 DESTROYED: REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 9/24/92 Initial version ------------------------------------------------------------------------------@ SpecGetWindowOptions proc far uses ds .enter mov ax, segment olWindowOptions mov ds, ax clr ax mov al, ds:olWindowOptions .leave ret SpecGetWindowOptions endp COMMENT @---------------------------------------------------------------------- FUNCTION: SpecGetExpressOptions DESCRIPTION: Get the express options CALLED BY: INTERNAL PASS: none RETURN: ax - UIExpressOptions DESTROYED: REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 9/24/92 Initial version ------------------------------------------------------------------------------@ SpecGetExpressOptions proc far uses ds .enter mov ax, segment olExpressOptions mov ds, ax mov ax, ds:olExpressOptions .leave ret SpecGetExpressOptions endp COMMENT @---------------------------------------------------------------------- FUNCTION: SpecInitExpressPreferences DESCRIPTION: Fetches Express menu .ini settings, interprets CALLED BY: INTERNAL OLFieldAttach PASS: ds:si - field specific category string RETURN: DESTROYED: ax, bx, cx, dx, bp ------------------------------------------------------------------------------@ SpecInitExpressPreferences proc near uses ds .enter ; ; default is based on user level ; call UserGetDefaultUILevel ; ax = UIInterfaceLevel mov bx, mask UIEO_DESK_ACCESSORY_LIST or \ mask UIEO_CONTROL_PANEL or \ mask UIEO_DOS_TASKS_LIST or \ mask UIEO_UTILITIES_PANEL or \ mask UIEO_EXIT_TO_DOS or \ mask UIEO_DOCUMENTS_LIST or \ UIEP_TOP_PRIMARY shl offset UIEO_POSITION cmp ax, UIIL_BEGINNING ; intro and beginning use this jbe haveDefaultExpressPrefs mov bx, mask UIEO_DESK_ACCESSORY_LIST or \ mask UIEO_MAIN_APPS_LIST or \ mask UIEO_OTHER_APPS_LIST or \ mask UIEO_CONTROL_PANEL or \ mask UIEO_DOS_TASKS_LIST or \ mask UIEO_UTILITIES_PANEL or \ mask UIEO_EXIT_TO_DOS or \ mask UIEO_DOCUMENTS_LIST or \ UIEP_TOP_PRIMARY shl offset UIEO_POSITION haveDefaultExpressPrefs: mov cx, cs mov dx, offset expressOptionsString call InitFileReadInteger jc haveDecision ; ; require some things for ISUI, don't allow others ; if _ISUI ornf ax, mask UIEO_DOCUMENTS_LIST or \ mask UIEO_EXIT_TO_DOS or \ mask UIEO_CONTROL_PANEL or \ mask UIEO_UTILITIES_PANEL andnf ax, not (mask UIEO_GEOS_TASKS_LIST) endif mov bx, ax ; just copy from .ini file haveDecision: mov cx, segment olExpressOptions mov ds, cx mov ds:[olExpressOptions], bx .leave ret SpecInitExpressPreferences endp expressOptionsString char "expressOptions", 0 COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SpecInitHelpPreferences %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Initialize help preferences for a field CALLED BY: OLFieldLoadOptions() PASS: ds:si - field specific category string RETURN: none DESTROYED: ax, bx, cx, dx, bp PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- gene 11/19/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SpecInitHelpPreferences proc far uses ds .enter if BUBBLE_HELP push ds endif clr ax ;ax <- default UIHelpOptions mov cx, cs mov dx, offset helpOptionsString ;cx:dx <- ptr to key call InitFileReadInteger mov cx, segment olHelpOptions mov ds, cx mov ds:[olHelpOptions], ax if BUBBLE_HELP pop ds ; ; get bubble options ; mov bl, mask BO_HELP or mask BO_DISPLAY ; defaults mov cx, cs mov dx, offset bubbleHelpString call InitFileReadBoolean jc noBubbleHelpOption tst ax ; false? jnz noBubbleHelpOption ; nope andnf bl, not mask BO_HELP ; false, turn if off noBubbleHelpOption: mov dx, offset bubbleDisplayString call InitFileReadBoolean jc noBubbleDisplayOption tst ax ; false? jnz noBubbleDisplayOption ; nope andnf bl, not mask BO_DISPLAY ; false, turn it off noBubbleDisplayOption: push ds mov cx, segment olBubbleOptions mov ds, cx mov ds:[olBubbleOptions], bl ; store options pop ds ; ; set bubble help and bubble display times ; push bp, di mov bx, BUBBLE_HELP_DEFAULT_TIME mov cx, cs mov dx, offset bubbleHelpTimeString call InitFileReadInteger jc noHelpTime mov bx, ax ; bx = bubble help time noHelpTime: mov dx, offset bubbleHelpDelayString call InitFileReadInteger mov bp, ax jnc haveDelayTime mov bp, BUBBLE_HELP_DEFAULT_DELAY_TIME haveDelayTime: mov dx, offset bubbleHelpMinTimeString call InitFileReadInteger mov di, ax jnc haveMinTime mov di, BUBBLE_HELP_DEFAULT_MIN_TIME haveMinTime: mov dx, offset bubbleDisplayTimeString call InitFileReadInteger jnc haveDisplayTime mov ax, BUBBLE_DISPLAY_DEFAULT_TIME haveDisplayTime: mov cx, segment olBubbleHelpTime mov ds, cx mov ds:[olBubbleHelpTime], bx mov ds:[olBubbleHelpDelayTime], bp mov ds:[olBubbleDisplayTime], ax mov ds:[olBubbleHelpMinTime], di pop bp, di endif .leave ret SpecInitHelpPreferences endp helpOptionsString char "helpOptions", 0 if BUBBLE_HELP bubbleHelpString char "bubbleHelp", 0 bubbleHelpDelayString char "bubbleHelpDelay", 0 bubbleDisplayString char "bubbleDisplay", 0 bubbleHelpTimeString char "bubbleHelpTime", 0 bubbleDisplayTimeString char "bubbleDisplayTime", 0 bubbleHelpMinTimeString char "bubbleHelpMinTime",0 endif COMMENT @---------------------------------------------------------------------- FUNCTION: SpecInitDefaultDisplayScheme DESCRIPTION: If the first UI screen has been set up yet, fetch its displayType, initialize DisplayScheme DisplayType, Font & PointSize. NOTE: Current implementation is limited to supporting the first video screen only. CALLED BY: INTERNAL OLFieldAttach OLFieldInitialize PASS: none RETURN: Set: specDisplayScheme DESTROYED: ax, bx, cx, dx, bp REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version Doug 10/90 Revamp for "No ziphod" changes JimG 3/1/94 Uses GetFontFromInitFile. does EditableText fonts also. ------------------------------------------------------------------------------@ SpecInitDefaultDisplayScheme proc near uses si, di, ds .enter clr si ; Pass null object (in case EC) call UserGetDisplayType ; Get display type for 1st ; video screen tst al ; see if initialized yet jz done ; if not, skip out if _ASSUME_BW_ONLY ; Force B/W andnf ah, not mask DT_DISP_CLASS ornf ah, DC_GRAY_1 shl offset DT_DISP_CLASS endif mov bp, ax ; save DisplayType call GrGetDefFontID ; returns: cx = default FontID ; dx.ah = default pointsize ; bx = default data handle mov ax, offset fontidString mov bx, offset fontsizeString call GetFontFromInitFile ; destroys ax, bx mov ax, segment specDisplayScheme mov ds, ax ;setup ds to be dgroup ;store font & point size info mov ds:[specDisplayScheme].DS_fontID, cx mov ds:[specDisplayScheme].DS_pointSize, dx push cx, dx ; preserve font info mov ax, bp ;restore DisplayType in ah call AdjustForDisplayType call CalcSystemAttrs ;calculate system attributes ; FINALLY, let the generic UI know what font we're going to be using, ; so that it can cache it away & use it later in VisGetMonikerSize. ; pop cx, dx call UserSetDefaultMonikerFont ; Get font info for editableText push cx, dx ; save font & ; size for later mov ax, offset editableTextFontIDString mov bx, offset editableTextFontsizeString ; cx, dx = fontid, fontsize of defaults call GetFontFromInitFile ; destroy ax, bx pop ax, bx ; UI font and size ; Only bother to store the font & size if they are different than the ; default font & size for the UI. mov ds:[editableTextFontID], FID_INVALID cmp ax, cx jne storeEditableText cmp bx, dx je done storeEditableText: ; Store editableText font information in dgroup. ; ds = dgroup, still mov ds:[editableTextFontID], cx mov ds:[editableTextFontsize], dx done: .leave ret SpecInitDefaultDisplayScheme endp fontidString char "fontid", 0 fontsizeString char "fontsize", 0 editableTextFontIDString char "editableTextFontID",0 editableTextFontsizeString char "editableTextFontsize",0 COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GetFontFromInitFile %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Returns the FontID and integer part of the FontSize from the init file from given key strings. CALLED BY: SpecInitDefaultDisplayScheme PASS: cs:ax - fontID key string ptr cs:bx - font size key string ptr cx - default FontID dx - default point size RETURN: cx - FontID dx - point size DESTROYED: ax, bx SIDE EFFECTS: nothing PSEUDO CODE/STRATEGY: Uses fixed category string, categoryString, defined below. REVISION HISTORY: Name Date Description ---- ---- ----------- JimG 3/ 1/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GetFontFromInitFile proc near fontSizeOffset local word push bx defaultFontID local FontID push cx defaultPointSize local word push dx uses si,di,ds ; returns cx, dx .enter ; ; get font id ; push bp ; preserve bp for local vars mov cx, cs mov ds, cx mov si, offset categoryString ; ds:si = category mov dx, ax ; cx:dx = key clr bp ; return memory block call InitFileReadString pop bp ; restore bp for locals LONG jc fontNotFound ; ; found string -- bx = handle ; call MemLock mov ds, ax ; ds <- seg addr of string clr si ; ds:si <- ptr to string mov dl, mask FEF_BITMAPS \ or mask FEF_OUTLINES \ or mask FEF_DOWNCASE \ or mask FEF_STRING ; dl <- fonts to find call GrCheckFontAvail ; see if available ; Returns cx = FontID call MemFree ; dispose font name buffer jcxz fontNotFound ; jumps back to getPointSize ; ; get pointsize from .ini file ; getPointSize: push cx ; save font ID mov cx, cs mov ds, cx mov si, offset categoryString ; ds:si = category mov dx, ss:[fontSizeOffset] ; cx:dx = key call InitFileReadInteger mov_tr dx, ax ; dx <- pointsize pop cx ; cx <- font ID jc sizeNotFound ; branch if not in .ini file setPointSize: ; cx = fontID ; dx.ah = pointsize (WBFixed) clr ax ; al = FontStyle call GrFindNearestPointsize ; use nearest size jcxz sizeNotFound ; branch if size/style N/A done: .leave ret ; <-- RETURN ; ; Asking for a font or pointsize that is not availble is ; a bad thing. (in addition, the size check will fail if there ; is not a plaintext version of the font available, as with ; Eurostile Extended). If either of these things happen, we ; use the defaults as determined by the kernel at boot time. ; -eca ; fontNotFound: mov cx, ss:[defaultFontID] ; use passed default fontID jmp getPointSize sizeNotFound: mov cx, ss:[defaultFontID] ; use passed defaults mov dx, ss:[defaultPointSize] jmp done ; move on to next thing GetFontFromInitFile endp categoryString char "ui",0 COMMENT @---------------------------------------------------------------------- ROUTINE: CalcSystemAttrs SYNOPSIS: Calculates system attributes. CALLED BY: SpecInitDefaultDisplayScheme PASS: ds - dgroup RETURN: ax -- SystemAttrs DESTROYED: bx, cx, dx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: Right now a display has to be CSF_VERY_SQUISHED to be horizontally tiny. We need OLScreen sizes to do this right. REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 3/ 1/93 Initial version ------------------------------------------------------------------------------@ CalcSystemAttrs proc near call SysGetPenMode ;get pen mode tst ax jz 10$ ;no pen mode, branch mov ax, mask SA_PEN_BASED ;else set this 10$: mov dx, idata mov ds, dx mov bh, ds:[moCS_flags] test bh, mask CSF_BW jnz 20$ ORNF ax, mask SA_COLOR ;set the color flag if needed 20$: test bh, mask CSF_VERY_NARROW or mask CSF_VERY_SQUISHED or mask CSF_TINY jz 25$ ORNF ax, mask SA_TINY 25$: ; BX <- SystemAttrs ; (CSF_VERY_NARROW/SQUSHED map to the same positions as ; SA_HORIZONTALLY_TINY and SA_VERTICALLY_TINY) ; ANDNF bx, (mask CSF_VERY_NARROW or mask CSF_VERY_SQUISHED) shl 8 ORNF bx, ax call FlowGetUIButtonFlags test al, mask UIBF_KEYBOARD_ONLY jz 30$ ORNF bx, mask SA_KEYBOARD_ONLY 30$: test al, mask UIBF_NO_KEYBOARD jz 40$ ;noKeyboard set, branch, c=0 ORNF bx, mask SA_NO_KEYBOARD 40$: ; ; Set the orientation flags depending on the screen dimension. ; call GetFieldDimensions mov ax, mask SA_PORTRAIT cmp cx, dx jl setOrientationFlag ; width < height cmp dx, cx je setOrientationFlag ; width = height clr ax setOrientationFlag: ORNF bx, ax mov ds:olSystemAttrs, bx mov_tr ax, bx ; SystemAttrs flags ret CheckHack <((mask CSF_VERY_NARROW shl 8) eq mask SA_HORIZONTALLY_TINY)> CheckHack <((mask CSF_VERY_SQUISHED shl 8) eq mask SA_VERTICALLY_TINY)> CalcSystemAttrs endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GetFieldDimensions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Gets the field width and height. CALLED BY: CalcSystemAttrs PASS: nothing RETURN: cx - field width dx - field height DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PT 6/28/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if _DUI GetFieldDimensionsFar proc far call GetFieldDimensions ret GetFieldDimensionsFar endp endif GetFieldDimensions proc near uses ax,ds .enter segmov ds, idata, ax mov cx, ds:[fieldWidth] mov dx, ds:[fieldHeight] tst dx jnz done ; it's cached segmov ds, ss call OpenGetScreenDimensions ; cx=width, dx=height if FAKE_SIZE_OPTIONS call FakeFieldDimensions ; cx=newWidth, dx=newHeight endif segmov ds, idata, ax mov ds:[fieldWidth], cx mov ds:[fieldHeight], dx done: .leave ret GetFieldDimensions endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FakeFieldDimensions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Check .ini file for fake field sizes to use. If found, substitute here. If the continueSetup boolean equals true, we ignore any size. CALLED BY: (INTERNAL) GetFieldDimensions PASS: cx,dx - width,height of field so far RETURN: cx,dx - width,height of field (may have changed) DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- PT 6/28/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if FAKE_SIZE_OPTIONS FakeFieldDimensions proc near uses ax,bx,ds,si .enter mov_tr ax, cx ; old width mov bx, dx ; old height mov cx, cs mov ds, cx mov si, offset screenSizeCategoryString ; ds:si = category str mov dx, offset xFieldSizeString ; cx:dx = key str call InitFileReadInteger ; ax = newHeight xchg ax, bx ; old height, ; new width mov dx, offset yFieldSizeString ; cx:dx = key str call InitFileReadInteger mov_tr dx, ax ; new height mov cx, bx ; new width .leave ret FakeFieldDimensions endp screenSizeCategoryString char "ui", 0 xFieldSizeString char "xFieldSize", 0 yFieldSizeString char "yFieldSize", 0 endif ; FAKE_SIZE_OPTIONS COMMENT @---------------------------------------------------------------------- ROUTINE: SetLightColors SYNOPSIS: Sets a bunch of color variables to the user-chosen light color. CALLED BY: SpecInitDefaultDisplayScheme PASS: al -- color RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 2/15/91 Initial version ------------------------------------------------------------------------------@ ifdef USER_CAN_CHOOSE_COLORS SetLightColors proc near EC < call ECCheckESDGroup > mov es:[moCS_dsLightColor], al ;else store a bunch of values mov es:[moCS_windowBG], al mov es:[moCS_menuBar], al mov es:[moCS_activeBorder], al mov es:[moCS_inactiveBorder], al ret SetLightColors endp endif COMMENT @---------------------------------------------------------------------- ROUTINE: SetDarkColors SYNOPSIS: Sets a bunch of color variables to the user-chosen dark color. CALLED BY: SpecInitDefaultDisplayScheme PASS: al -- color es -- dgroup RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 2/15/91 Initial version ------------------------------------------------------------------------------@ ifdef USER_CAN_CHOOSE_COLORS SetDarkColors proc near EC < call ECCheckESDGroup > mov es:[moCS_dsDarkColor], al ;else store a bunch of values mov es:[moCS_screenBG], al mov es:[moCS_appWorkspace], al ;; mov es:[moCS_activeTitleBar], al ;don't want this for any SPUI mov es:[moCS_windowFrame], al mov es:[moCS_scrollBars], al mov es:[moCS_menuSelection], al mov es:[moCS_inactiveTitleBar], al ret SetDarkColors endp endif COMMENT @---------------------------------------------------------------------- FUNCTION: AdjustForDisplayType DESCRIPTION: Set specific UI variables having to do with the color scheme to be used, based on whether on B&W display, or CGA. This allows the code to work quicker by just using the colors & info stored in these tables. CALLED BY: INTERNAL SpecInitDefaultDisplayScheme PASS: ah - DisplayType RETURN: moCS_flags - set moCS_displayType - set specDisplayScheme.DS_colorScheme - set specDisplayScheme.DS_displayType - set DESTROYED: cx, si, di REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 10/90 Initial version ------------------------------------------------------------------------------@ NARROW_WIDTH equ 300 ;Anything over 300 pixels wide is not ; narrow (or so we say). AdjustForDisplayType proc near uses ds, es .enter mov cx, segment idata ;get segment of core blk mov ds, cx ; in ds mov es, cx ; & in es mov ch, ah andnf ch, mask DF_DISPLAY_TYPE cmp ch, DC_GRAY_1 ;is this black and white? jnz afterBWAdjust ;no, branch ; if on a monochrome monitor, copy Monochrome color value ; table over Color Scheme vars push ax mov si, offset CUA_MonochromeColorTable mov di, offset CUA_ColorSchemeVars mov cl, ds:[moCS_numVars] ;cx = # of byte vars in table clr ch rep movsb pop ax or ds:[moCS_flags], mask CSF_BW afterBWAdjust: mov ds:[moCS_displayType], ah ;store display type push ax andnf ah, mask DT_DISP_SIZE ; But then check for tiny screen cmp ah, DS_TINY shl offset DT_DISP_SIZE pop ax jne afterTinyAdjustments ; skip if not or ds:[moCS_flags], mask CSF_TINY afterTinyAdjustments: push ax andnf ah, mask DT_DISP_ASPECT_RATIO cmp ah, DAR_TV shl offset DT_DISP_ASPECT_RATIO pop ax jne afterTV or ds:[moCS_flags], mask CSF_TV afterTV: push ax andnf ah, mask DT_DISP_ASPECT_RATIO cmp ah, DAR_VERY_SQUISHED shl offset DT_DISP_ASPECT_RATIO pop ax jne afterVerySquishedAdjustments or ds:[moCS_flags], mask CSF_VERY_SQUISHED MO < mov ds:[olArrowSize], 10 ;default to arrow size 10 in CGA> ; ; 1/26/98 ND-000319, et al: force CGA to 9 point, and editable ; text to match. -- eca ; mov ds:[specDisplayScheme].DS_pointSize, 9 mov ds:[editableTextFontsize], 9 afterVerySquishedAdjustments: push ax ; ; Check to see if the display is narrow - if so, set the "very narrow" ; flag... ; The way we get the screen size is via a total HACK - we get the ; size of the UI's application object... clr bx call GeodeGetAppObject mov ax, MSG_VIS_GET_SIZE mov di, mask MF_CALL call ObjMessage cmp cx, NARROW_WIDTH ja notNarrow ornf ds:[moCS_flags], mask CSF_VERY_NARROW notNarrow: pop ax ;Restore display type in AH ; Finally, get & store the default display type & color scheme ; mov al, ds:[moCS_dsDarkColor] mov ds:[specDisplayScheme.DS_darkColor], al mov al, ds:[moCS_dsLightColor] ;construct from light & dark mov ds:[specDisplayScheme.DS_lightColor], al mov cl, 4 shl al, cl or al, ds:[moCS_dsDarkColor] mov {word} ds:[specDisplayScheme.DS_colorScheme], ax .leave ret AdjustForDisplayType endp COMMENT @---------------------------------------------------------------------- FUNCTION: SpecInitGadgetPreferences DESCRIPTION: If there is a default video driver, init the variable defaultDisplayScheme CALLED BY: INTERNAL PASS: none RETURN: Set: gadgetRepeatDelayString DESTROYED: ax, bx, cx, dx, bp REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/90 Initial version Doug 10/90 Pulled out into separate routine ------------------------------------------------------------------------------@ SpecInitGadgetPreferences proc near uses si, di, ds, es .enter ; ; Set up some registers ; mov ax, segment dgroup mov es, ax mov cx, cs mov ds, cx mov si, offset inputCat mov dx, offset floatingKbdKey clr ax call InitFileReadBoolean mov es:[kbdRequired], al ; ; As long as we're pulling thinngs out of the .ini file, let's pull ; out the gadget repeat delay and store it. ; mov dx, offset gadgetRepeatDelayString ;cx:dx = key mov si, offset optionsCatString ;ds:si = category mov ax, DEFAULT_GADGET_REPEAT_DELAY ;in case not found call InitFileReadInteger mov es:[olGadgetRepeatDelay], ax ; Save gadget repeat delay ; ; Now find out if we want gadgets to accelerate. ; mov dx, offset gadgetAccelerateString ;cx:dx = key clr ax call InitFileReadBoolean mov es:[olGadgetAccelerate], al ; Save gadget accelerate flag. ; ; Setup custom gadget colors, if desired. ; ifdef USER_CAN_CHOOSE_COLORS call OpenCheckIfBW ;No special colors in B/W jc afterActiveTitleBarColor mov si, offset optionsCatString ;ds:si = category mov dx, offset lightColorString ;cx:dx = key call InitFileReadInteger jc tryDarkColor ;branch if not in .ini file call SetLightColors tryDarkColor: mov dx, offset darkColorString call InitFileReadInteger jc afterDarkColor call SetDarkColors afterDarkColor: mov dx, offset activeTitleBarColorString call InitFileReadInteger jc afterActiveTitleBarColor mov es:[moCS_activeTitleBar], al mov es:[moCS_titleBar2], al afterActiveTitleBarColor: mov dx, offset titleBar2String call InitFileReadInteger jc afterTitleBar2Color mov es:[moCS_titleBar2], al afterTitleBar2Color: mov dx, offset selectColorString call InitFileReadInteger jc afterSelectColor mov es:[moCS_selBkgdColor], al afterSelectColor: endif if _MOTIF ; ; Set up scroller arrow widths and heights. ; mov dx, offset scrollerSizeString ;cx:dx = key mov si, offset optionsCatString ;ds:si = category call InitFileReadInteger jc noSize ;branch if not in .in file test ax, 1 ;make size is even jz sizeEven inc ax sizeEven: cmp ax, MIN_ARROW_SIZE ;make sure arrow not too small jae 20$ mov ax, MIN_ARROW_SIZE 20$: cmp ax, MAX_ARROW_SIZE ;make sure arrow not too big jbe 30$ mov ax, MAX_ARROW_SIZE 30$: mov es:[olArrowSize], ax ; Save arrow size noSize: endif if _MOTIF ; ; Set up resize border thicknesses. ; mov dx, offset tbResizeBorderThicknessString ;cx:dx = key mov si, offset optionsCatString ;ds:si = category call InitFileReadInteger jc noHeight ;branch if not in .in file mov es:[resizeBarHeight], ax ;Save resize bar height noHeight: mov dx, offset lrResizeBorderThicknessString ;cx:dx = key mov si, offset optionsCatString ;ds:si = category call InitFileReadInteger jc noWidth ;branch if not in .in file mov es:[resizeBarWidth], ax ;Save resize bar width noWidth: endif ; ; init olFileSelectorStaticDrivePopupMoniker ; mov dx, offset fsDriveMonikerString ;cx:dx = key mov si, offset optionsCatString ;ds:si = category mov ax, FALSE ;in case not found call InitFileReadBoolean ;ax = value mov es:[olFileSelectorStaticDrivePopupMoniker], al ; ; Now find out if we want single clicks to be treated as double ; clicks in single action file selectors. ; mov dx, offset fsSingleClickToOpenString ;cx:dx = key clr ax call InitFileReadBoolean mov es:[olFileSelectorSingleClickToOpen], al ; ; init olNoDefaultRing, only if penBased = true. ; call SysGetPenMode ;get pen mode tst ax jz afterNoDefaultRing ;no pen mode, branch mov dx, offset noDefaultRingString ;cx:dx = key mov si, offset optionsCatString ;ds:si = category mov ax, FALSE ;in case not found call InitFileReadBoolean ;ax = value mov es:[olNoDefaultRing], al afterNoDefaultRing: ; ; init specDoClickSound. ; mov dx, offset clickSoundsString ;cx:dx = key mov si, offset optionsCatString ;ds:si = category mov ax, FALSE ;in case not found call InitFileReadBoolean ;ax = value mov es:[specDoClickSound], al ; ; init button invert delay ; mov dx, offset buttonInvertDelayString ;cx:dx = key mov si, offset optionsCatString ;ds:si = category mov ax, DEFAULT_BUTTON_INVERT_DELAY ;in case not found call InitFileReadInteger mov es:[olButtonInvertDelay], ax ; Save button invert delay jc afterInvertDelay mov es:[olButtonActivateDelay], ax afterInvertDelay: ; ; init olPDA. ; mov dx, offset pdaKeyString ;cx:dx = key mov si, offset pdaCatString ;ds:si = category mov ax, FALSE ;in case not found call InitFileReadBoolean ;ax = value mov es:[olPDA], ax ; ; init olExtWinAttrs ; mov dx, offset extWinAttrsString mov si, offset optionsCatString mov ax, ExtWinAttrs<1, 1> call InitFileReadInteger mov es:[olExtWinAttrs], ax if TOOL_AREA_IS_TASK_BAR ; ; init taskBarPosition ; mov dx, offset taskBarPositionString mov si, offset optionsCatString mov ax, MAX_COORD ;positive = at bottom call InitFileReadInteger mov es:[taskBarPosition], ax ; ; init taskBarAutoHide ; mov dx, offset taskBarAutoHideString mov si, offset optionsCatString mov ax, FALSE ;default = no auto hide call InitFileReadBoolean mov es:[taskBarAutoHide], ax ; ; init taskBarMovable ; mov dx, offset taskBarMovableString mov si, offset optionsCatString mov ax, FALSE ;default = no moving call InitFileReadBoolean mov es:[taskBarMovable], ax endif if _ISUI mov si, offset optionsCatString mov dx, offset rightClickHelpString mov ax, TRUE call InitFileReadBoolean mov es:[olRightClickHelp], ax mov dx, offset rightClickTimeString mov ax, 15 ; 15 ticks = 1/4 second call InitFileReadInteger mov es:[olRightClickTime], ax endif .leave ret SpecInitGadgetPreferences endp if _STYLUS ;Stylus also defines Motif.. this avoids redefinition. optionsCatString char "stylus options",0 else MO <optionsCatString char "motif options",0 > ISU <optionsCatString char "motif options",0 > endif ;_STYLUS ifdef USER_CAN_CHOOSE_COLORS darkColorString char "darkColor",0 lightColorString char "lightColor",0 activeTitleBarColorString char "active title bar color",0 selectColorString char "selectColor",0 titleBar2String char "titleBarGradient",0 endif gadgetRepeatDelayString char "gadgetRepeatDelay",0 gadgetAccelerateString char "gadgetAccelerate",0 fsDriveMonikerString char "fsStaticDriveMoniker",0 fsSingleClickToOpenString char "fsSingleClickToOpen",0 noDefaultRingString char "noDefaultRing",0 clickSoundsString char "clickSounds",0 buttonInvertDelayString char "buttonInvertDelay",0 extWinAttrsString char "externalWinAttrs",0 if _MOTIF scrollerSizeString char "scroll arrow size",0 lrResizeBorderThicknessString char "lrResizeBorderThickness",0 tbResizeBorderThicknessString char "tbResizeBorderThickness",0 endif pdaCatString char "system",0 pdaKeyString char "pda",0 inputCat char "input",0 floatingKbdKey char "floatingKbd",0 if TOOL_AREA_IS_TASK_BAR taskBarPositionString char "taskBarPosition",0 taskBarAutoHideString char "taskBarAutoHide",0 taskBarMovableString char "taskBarMovable",0 endif if _ISUI rightClickHelpString char "rightClickHelp",0 rightClickTimeString char "rightClickHelpTime",0 endif Init ends
24.684178
81
0.664733
50ddd3e894eb94f948438a3da5d5ad1c78bc91b2
1,318
asm
Assembly
iBUS/USART_RX.asm
aryan-gupta/Quadrino
ffd7993e55cc95b37c44b1a517a25cfc3a065ba0
[ "MIT" ]
null
null
null
iBUS/USART_RX.asm
aryan-gupta/Quadrino
ffd7993e55cc95b37c44b1a517a25cfc3a065ba0
[ "MIT" ]
null
null
null
iBUS/USART_RX.asm
aryan-gupta/Quadrino
ffd7993e55cc95b37c44b1a517a25cfc3a065ba0
[ "MIT" ]
1
2018-08-06T09:08:20.000Z
2018-08-06T09:08:20.000Z
ISR(USART_RX_vect) { static uint8_t* loc = buffer_start; uint8_t data = UDR0; if (loc == buffer_start or loc == buffer2_start) { if (data != 0x20) return; } *loc = data; loc++; if (loc == buffer2_start) { // technically we only need to compare the LSB because its an array buff1_ready = true; buff2_ready = false; return; } if (loc == buffer_end) { buff2_ready = true; buff1_ready = false; loc = buffer_start; return; } } ; Use r31 as r4 until we upload the data ; then load _loc MSB into r31 in r2, __SREG__ push r30 push r31 lds r4, 0x00C6 ; address of UDR0 register lds r30, %B[_loc] ; load loc LSB, we are going to load MSB of loc later cpi r30, %B[_buf1s] ; Compare loc LSB with buffer_start breq SB ; TODO goto check for 0x20 (start bit) cpi r30, %B[_buf2s] brne MN ; TODO goto main SB: ldi r31, 0x20 cp r4, r31 brne EN ; TODO goto end MN: lds r31, %A[_loc] ; MSB st Z+, r4 cpi r30, %B[_buf2s] brne L2 ; branch to check buffer 2 sts %B[_loc], r30 sts %A[_loc], r31 ldi r30, 0x0 ldi r31, 0x1 sts %[buff1r], r31 sts %[buff2r], r30 rjmp EN L2: cpi r30, %B[_bufe] brne EN ldi r30, %B[_buf1s] ldi r31, %A[_buf1s] sts %B[_loc], r30 sts %A[_loc], r31 ldi r30, 0x0 ldi r31, 0x1 sts %[buff1r], r30 sts %[buff2r], r31 EN: pop r31 pop r30 out __SREG__, r2
20.59375
96
0.656297
44d714af660b60a35d370cae52e74031b63b75fe
1,178
asm
Assembly
ShitHead/Bits/udg.asm
simonlaszcz/ShitHead
53bf19ceaba458b9ce4cd3e9be75ab77f1778eee
[ "MIT" ]
null
null
null
ShitHead/Bits/udg.asm
simonlaszcz/ShitHead
53bf19ceaba458b9ce4cd3e9be75ab77f1778eee
[ "MIT" ]
null
null
null
ShitHead/Bits/udg.asm
simonlaszcz/ShitHead
53bf19ceaba458b9ce4cd3e9be75ab77f1778eee
[ "MIT" ]
null
null
null
CARDBACK_A defb %01111111 defb %10000000 defb %10000000 defb %10000000 defb %10001111 defb %10001101 defb %10001010 defb %10001101 CARDBACK_B defb %11111111 defb %00000000 defb %00000000 defb %00000000 defb %11111111 defb %01010101 defb %10101010 defb %01010101 CARDBACK_C defb %11111110 defb %00000001 defb %00000001 defb %00000001 defb %11110001 defb %01010001 defb %10110001 defb %01010001 CARDBACK_D defb %10001010 defb %10001101 defb %10001010 defb %10001101 defb %10001010 defb %10001101 defb %10001010 defb %10001101 CARDBACK_E defb %10101010 defb %01010101 defb %10101010 defb %01010101 defb %10101010 defb %01010101 defb %10101010 defb %01010101 CARDBACK_F defb %10110001 defb %01010001 defb %10110001 defb %01010001 defb %10110001 defb %01010001 defb %10110001 defb %01010001 CARDBACK_G defb %10001010 defb %10001101 defb %10001010 defb %10001111 defb %10000000 defb %10000000 defb %10000000 defb %01111111 CARDBACK_H defb %10101010 defb %01010101 defb %10101010 defb %11111111 defb %00000000 defb %00000000 defb %00000000 defb %11111111 CARDBACK_I defb %10110001 defb %01010001 defb %10110001 defb %11110001 defb %00000001 defb %00000001 defb %00000001 defb %11111110
14.54321
14
0.809847
6e6ed159cfcc55963125e64b31f06b580c40a897
949
asm
Assembly
libsrc/target/excali64/gencon/copy_font.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/target/excali64/gencon/copy_font.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/target/excali64/gencon/copy_font.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
SECTION code_graphics PUBLIC copy_font defc PCG_RAM = $4000 ; Copy a font into page 0 of the PCG memory ; Entry: bc =font ; l = start character ; h = number of characters copy_font: ld a,h push af ; Each character is 12 rows ld h,0 add hl,hl ;x2 add hl,hl ;x4 ld d,h ld e,l add hl,hl ;x8 ;add hl,de ;x12 add hl,hl ;x16 ld de,PCG_RAM add hl,de ;Now points to start of hires memory ld d,b ; ld e,c ex de,hl ;hl = font, de = distination pop af ;Number of characters ld c,a for_each_character: push bc xor a call wrbyte call wrbyte ld b,8 row_loop: ld a,(hl) call wrbyte inc hl djnz row_loop xor a ld b,6 fill_1: call wrbyte djnz fill_1 pop bc dec c jr nz,for_each_character ret wrbyte: ex af,af wait_sync: in a,($50) bit 4,a jr z,wait_sync push af res 1,a set 0,a out ($70),a ex af,af ld (de),a inc de ex af,af pop af out ($70),a ex af,af ret
12.012658
47
0.632244
3deea73cd5e7b9377a0c15f9a7fadada72896a99
10,555
asm
Assembly
kMouse.asm
satadriver/LiunuxOS_t
c6222f04b6e734002cbf1aa366eb62e51f0ebbe5
[ "Apache-2.0" ]
null
null
null
kMouse.asm
satadriver/LiunuxOS_t
c6222f04b6e734002cbf1aa366eb62e51f0ebbe5
[ "Apache-2.0" ]
null
null
null
kMouse.asm
satadriver/LiunuxOS_t
c6222f04b6e734002cbf1aa366eb62e51f0ebbe5
[ "Apache-2.0" ]
null
null
null
.386p ;include 8042_8048_info.asm Kernel Segment public para use32 assume cs:Kernel ;mouse direction is from left,top to right down,so the x delta is right,but y delta is negtive align 10h __kMouseProc proc pushad push ds push es push fs push gs push ss mov ax,rwData32Seg mov ds,ax mov es,ax mov ebx,kernelData shl ebx,4 cmp word ptr ds:[ebx + _videoMode],VIDEO_MODE_3 jz _mouseReturn cmp word ptr ds:[ebx + _kMouseProc],0 jz _mouseReturn call dword ptr ds:[ebx + _kMouseProc] jmp _mouseReturn mov esi,MOUSE_BUFFER mov ecx,0 mov edx,0 in al,60h mov dl,al movsx eax,al mov ds:[esi + MOUSEDATA._mintrData._mouseStatus + ecx ],eax add ecx,4 _checkMouseStatus: in al,64h test al,1 jz _MouseProcMain in al,60h shl edx,8 mov dl,al movsx eax,al mov ds:[esi + MOUSEDATA._mintrData._mouseStatus + ecx ],eax add ecx,4 cmp ecx,12 jz _MouseProcMain jmp _checkMouseStatus _MouseProcMain: cmp ecx,12 jb _mousetestErr mov eax,ds:[esi + MOUSEDATA._mintrData._mouseDeltaY] not eax mov ds:[esi + MOUSEDATA._mintrData._mouseDeltaY],eax cmp dword ptr ds:[esi + MOUSEDATA._bInvalid],0 jnz _mouseIntCalcPos cmp dword ptr ds:[esi + MOUSEDATA._mintrData._mouseDeltaY],0 jnz _mouseIntBackup cmp dword ptr ds:[esi + MOUSEDATA._mintrData._mouseDeltaX],0 jnz _mouseIntBackup jmp _mouseIntCalcPos _mouseIntBackup: call __restoreArray _mouseIntCalcPos: mov dword ptr ds:[esi + MOUSEDATA._bInvalid],0 mov eax,dword ptr ds:[esi + MOUSEDATA._mintrData._mouseDeltaX] add dword ptr ds:[esi + MOUSEDATA._mouseX],eax mov eax,dword ptr ds:[esi + MOUSEDATA._mouseX] cmp eax,dword ptr ds:[ebx + _videoWidth] jg _mouseXMax cmp eax,0 jl _mouseXMin jmp _checkMouseY _mouseXMax: mov eax,dword ptr ds:[ebx + _videoWidth] mov dword ptr ds:[esi + MOUSEDATA._mouseX],eax jmp _checkMouseY _mouseXMin: mov dword ptr ds:[esi + MOUSEDATA._mouseX],0 jmp _checkMouseY _checkMouseY: mov eax,dword ptr ds:[esi + MOUSEDATA._mintrData._mouseDeltaY] add dword ptr ds:[esi + MOUSEDATA._mouseY],eax mov eax,dword ptr ds:[esi + MOUSEDATA._mouseY] cmp eax,dword ptr ds:[ebx + _videoHeight] jg _mouseYMax cmp eax,0 jl _mouseYMin jmp _maekeArray _mouseYMax: mov eax,dword ptr ds:[ebx + _videoHeight] mov dword ptr ds:[esi + MOUSEDATA._mouseY],eax jmp _maekeArray _mouseYMin: mov dword ptr ds:[esi + MOUSEDATA._mouseY],0 jmp _maekeArray _maekeArray: cmp dword ptr ds:[esi + MOUSEDATA._mintrData._mouseDeltaY],0 jnz _mouseIntDraw cmp dword ptr ds:[esi + MOUSEDATA._mintrData._mouseDeltaX],0 jnz _mouseIntDraw jmp _mouseIntCheckClick _mouseIntDraw: call __drawArray _mouseIntCheckClick: test dword ptr ds:[esi + MOUSEDATA._mintrData._mouseStatus],7 jz _toShowMouse mov edi,ds:[esi+ MOUSEDATA._mouseBufHdr] shl edi,4 mov eax,ds:[esi+ MOUSEDATA._mintrData._mouseStatus] mov ds:[esi+ MOUSEDATA._mouseBuf._mouseStatus + edi],eax mov eax,ds:[esi+ MOUSEDATA._mouseX] mov ds:[esi+ MOUSEDATA._mouseBuf._mouseX + edi],eax mov eax,ds:[esi+ MOUSEDATA._mouseY] mov ds:[esi+ MOUSEDATA._mouseBuf._mouseY + edi],eax mov eax,ds:[esi+ MOUSEDATA._mouseZ] mov ds:[esi+ MOUSEDATA._mouseBuf._mouseZ + edi],eax ;add dword ptr ds:[esi+ MOUSEDATA._mouseBufHdr],sizeof MOUSEPOSDATA inc dword ptr ds:[esi+ MOUSEDATA._mouseBufHdr] ;cmp dword ptr ds:[esi+ MOUSEDATA._mouseBufHdr],MOUSE_BUF_LIMIT cmp dword ptr ds:[esi+ MOUSEDATA._mouseBufHdr],MOUSE_POS_TOTAL jb _toShowMouse mov dword ptr ds:[esi+ MOUSEDATA._mouseBufHdr],0 _toShowMouse: ;call __showGraphInfo _mouseReturn: mov dword ptr ds:[CMOS_SECONDS_TOTAL],0 mov eax,TURNONSCREEN int 80h mov al,20h out 20h,al out 0a0h,al pop ss pop gs pop fs pop es pop ds popad iretd _mousetestErr: mov ebp,esp add ebp,52 push dword ptr ICW2_SLAVE_INT_NO + 4 push dword ptr edx push dword ptr [ebp] push dword ptr ecx push dword ptr [ebp + 8] test dword ptr [ebp + 4],3 jz _kMouseKernelModeInt push dword ptr [ebp + 12] push dword ptr [ebp + 16] jmp _kMouseShowExpInfo _kMouseKernelModeInt: push dword ptr 0 push dword ptr 0 _kMouseShowExpInfo: call __exceptionInfo add esp,28 mov ebp,esp jmp _mouseReturn __kMouseProc endp ;ebp + 4 ret address ;ebp old ebp ;ebp - 4 ecx ;ebp - 8 edx ;ebp - 12 ebx ;ebp - 16 esi ;ebp - 20 edi ;ebp - 24 x ;ebp - 28 y ;ebp - 32 4x ;ebp - 36 6y ;ebp - 40 9x ;param:null __drawArray proc push ebp mov ebp,esp push ecx push edx push ebx push esi push edi sub esp,40h mov ebx,kernelData shl ebx,4 mov eax,dword ptr ds:[ebx + _bytesPerPixel] mov ss:[ebp - 44],eax mov eax,dword ptr ds:[ebx + _bytesPerLine] mov ss:[ebp - 48],eax mov eax,dword ptr ds:[ebx + _videoBase] mov ss:[ebp - 52],eax mov eax,dword ptr ds:[ebx + _mouseColor] ;MOV EAX,MOUSE_INIT_COLOR mov ss:[ebp - 56],eax ;mov eax,dword ptr ds:[ebx + _mouseBorderColor] MOV EAX,MOUSE_BORDER_COLOR mov ss:[ebp - 60],eax mov eax,dword ptr ds:[ebx + _mouseBorderSize] mov ss:[ebp - 64],eax mov ebx,MOUSE_BUFFER push dword ptr ds:[ebx + MOUSEDATA._mouseY] push dword ptr ds:[ebx + MOUSEDATA._mouseX] call __getPosition add esp,8 mov edi,eax add edi,ss:[ebp - 52] mov esi,MOUSE_BUFFER add esi,MOUSEDATA._mouseCoverData cld mov dword ptr ss:[ebp - 28],0 mov ecx,dword ptr ds:[ebx + MOUSEDATA._mouseHeight] _drawMousePixel: mov dword ptr ss:[ebp - 24],0 push ecx push edi mov ecx,dword ptr ds:[ebx + MOUSEDATA._mouseWidth] _drawMouseLine: push ecx mov eax,dword ptr ss:[ebp - 28] shl eax,2 mov dword ptr ss:[ebp - 32],eax mov eax,dword ptr ss:[ebp - 24] mov ecx,6 mul ecx mov dword ptr ss:[ebp - 36],eax mov eax,dword ptr ss:[ebp - 28] mov ecx,9 mul ecx mov dword ptr ss:[ebp - 40],eax mov eax,dword ptr ss:[ebp - 36] cmp eax,dword ptr ss:[ebp - 32] jb _mouseOverDraw cmp eax,dword ptr ss:[ebp - 40] ja _mouseOverDraw mov ecx,ss:[ebp - 44] _mouseBakColorPixel: mov dl,byte ptr ds:[edi] mov ds:[esi],dl inc edi inc esi loop _mouseBakColorPixel sub edi,ss:[ebp - 44] mov ecx,ss:[ebp - 44] mov eax,dword ptr ss:[ebp - 36] sub eax,dword ptr ss:[ebp - 32] cmp eax,ss:[ebp - 64] jbe _mouseBorderDraw mov eax,dword ptr ss:[ebp - 36] mov edx,dword ptr ss:[ebp - 40] sub edx,eax cmp edx,ss:[ebp - 64] jbe _mouseBorderDraw add dword ptr ss:[ebp - 56],00000fh mov eax,dword ptr ss:[ebp - 56] mov dword ptr ds:[ebx + _mouseColor],eax jmp _mouseDrawPoint _mouseBorderDraw: mov eax,dword ptr ss:[ebp - 60] _mouseDrawPoint: stosb shr eax,8 loop _mouseDrawPoint sub edi,dword ptr ss:[ebp - 44] _mouseOverDraw: add edi,dword ptr ss:[ebp - 44] inc dword ptr ss:[ebp - 24] pop ecx dec ecx jnz _drawMouseLine pop edi add edi,dword ptr ss:[ebp - 48] inc dword ptr ss:[ebp - 28] pop ecx dec ecx cmp ecx,0 ;loop,jne等条件跳转的距离不能超过127字节,jnz,ja,jg,jb,jl等可以 jnz _drawMousePixel add esp,40h pop edi pop esi pop ebx pop edx pop ecx mov esp,ebp pop ebp ret __drawArray endp ;ebp + 4 ret address ;ebp old ebp ;ebp - 4 ecx ;ebp - 8 edx ;ebp - 12 ebx ;ebp - 16 esi ;ebp - 20 edi ;ebp - 24 x ;ebp - 28 y ;ebp - 32 4x ;ebp - 36 6y ;ebp - 40 9x ;param:null __restoreArray proc push ebp mov ebp,esp push ecx push edx push ebx push esi push edi sub esp,40h mov ebx,kernelData shl ebx,4 mov eax,dword ptr ds:[ebx + _bytesPerPixel] mov ss:[ebp - 44],eax mov eax,dword ptr ds:[ebx + _bytesPerLine] mov ss:[ebp - 48],eax mov eax,dword ptr ds:[ebx + _videoBase] mov ss:[ebp - 52],eax mov ebx,MOUSE_BUFFER push ds:[ebx + MOUSEDATA._mouseY] push ds:[ebx + MOUSEDATA._mouseX] call __getPosition add esp,8 mov edi,eax add edi,ss:[ebp - 52] mov esi,MOUSE_BUFFER add esi,MOUSEDATA._mouseCoverData cld mov dword ptr ss:[ebp - 28],0 mov ecx,dword ptr ds:[ebx + MOUSEDATA._mouseHeight] _bdrawMousePixel: mov dword ptr ss:[ebp - 24],0 push ecx push edi mov ecx,dword ptr ds:[ebx + MOUSEDATA._mouseWidth] _bdrawMouseLine: push ecx mov eax,dword ptr ss:[ebp - 28] shl eax,2 mov dword ptr ss:[ebp - 32],eax mov eax,dword ptr ss:[ebp - 24] mov ecx,6 mul ecx mov dword ptr ss:[ebp - 36],eax mov eax,dword ptr ss:[ebp - 28] mov ecx,9 mul ecx mov dword ptr ss:[ebp - 40],eax mov eax,dword ptr ss:[ebp - 36] cmp eax,dword ptr ss:[ebp - 32] jb _bmouseOverDraw cmp eax,dword ptr ss:[ebp - 40] ja _bmouseOverDraw mov ecx,dword ptr ss:[ebp - 44] rep movsb sub edi,dword ptr ss:[ebp - 44] _bmouseOverDraw: add edi,dword ptr ss:[ebp - 44] inc dword ptr ss:[ebp - 24] pop ecx dec ecx cmp ecx,0 jnz _bdrawMouseLine pop edi add edi,dword ptr ss:[ebp - 48] inc dword ptr ss:[ebp - 28] pop ecx dec ecx cmp ecx,0 jnz _bdrawMousePixel add esp,40h pop edi pop esi pop ebx pop edx pop ecx mov esp,ebp pop ebp ret __restoreArray endp __mouseInit proc push ebp mov ebp,esp push ebx sub esp,40h mov ebx,kernelData shl ebx,4 push dword ptr ds:[ebx + _videoHeight] push dword ptr ds:[ebx + _videoWidth] call __initMouseParams add esp,8 call __drawArray add esp,40h pop ebx mov esp,ebp pop ebp ret __mouseInit endp ;parm: x,y __initMouseParams proc push ebp mov ebp,esp push ecx push edx push ebx push esi sub esp,40h mov ebx,kernelData shl ebx,4 mov esi,MOUSE_BUFFER mov eax,dword ptr ss:[ebp + 8] shr eax,1 mov ds:[esi + MOUSEDATA._MouseX],eax ;mov dword ptr ds:[esi + MOUSEDATA._MouseX],0 mov edx,dword ptr ss:[ebp + 12] shr edx,1 mov ds:[esi + MOUSEDATA._MouseY],edx ;mov dword ptr ds:[esi + MOUSEDATA._MouseY],0 mov eax,dword ptr ss:[ebp + 8] cmp eax,dword ptr ss:[ebp + 12] jae _makeMouseSquare mov eax,dword ptr ss:[ebp + 12] _makeMouseSquare: mov edx,0 mov ecx,ds:[ebx + _mouseRatioSize] div ecx mov ds:[esi + MOUSEDATA._mouseWidth],eax mov ds:[esi + MOUSEDATA._mouseHeight],eax ;mov eax,dword ptr ss:[ebp + 8] ;mov edx,0 ;mov ecx,ds:[ebx + _mouseRatioSize] ;div ecx ;mov ds:[ebx + _mouseHeight],eax add esp,40h pop esi pop ebx pop edx pop ecx mov esp,ebp pop ebp ret __initMouseParams endp __mouseService proc push ebp mov ebp,esp push ebx push esi push edi mov ebx,MOUSE_BUFFER mov eax,0 mov esi,ds:[ebx + MOUSEDATA._mouseBufTail] cmp esi,dword ptr [ebx + MOUSEDATA._mouseBufHdr] jz _mouseServiceEnd shl esi,4 mov eax,ds:[ebx + MOUSEDATA._mouseBuf._mouseStatus + esi] mov dword ptr ds:[edi],eax mov eax,ds:[ebx + MOUSEDATA._mouseBuf._mouseX + esi] mov dword ptr ds:[edi + 4],eax mov eax,ds:[ebx + MOUSEDATA._mouseBuf._mouseY + esi] mov dword ptr ds:[edi + 8],eax mov eax,ds:[ebx + MOUSEDATA._mouseBuf._mouseZ + esi] mov dword ptr ds:[edi + 12],eax mov eax,4 ;add dword ptr ds:[ebx+ MOUSEDATA._mouseBufTail],sizeof MOUSEPOSDATA inc dword ptr ds:[ebx+ MOUSEDATA._mouseBufTail] ;cmp dword ptr ds:[ebx+ MOUSEDATA._mouseBufTail],MOUSE_BUF_LIMIT cmp dword ptr ds:[ebx+ MOUSEDATA._mouseBufTail],MOUSE_POS_TOTAL jb _mouseServiceEnd mov dword ptr ds:[ebx+ MOUSEDATA._mouseBufTail],0 _mouseServiceEnd: pop edi pop esi pop ebx mov esp,ebp pop ebp ret __mouseService endp Kernel ends
17.76936
94
0.744766
ae4a11286169a8bf5e60bbb8db387ed073432061
13,622
asm
Assembly
Data/ShipModels.asm
ped7g/EliteNext
6e930f9b9924b295d7281ee6acb879600d7e597f
[ "Unlicense" ]
null
null
null
Data/ShipModels.asm
ped7g/EliteNext
6e930f9b9924b295d7281ee6acb879600d7e597f
[ "Unlicense" ]
null
null
null
Data/ShipModels.asm
ped7g/EliteNext
6e930f9b9924b295d7281ee6acb879600d7e597f
[ "Unlicense" ]
null
null
null
; For ship number A fetch the adjusted ship number in B and bank number in A for the respective ship based on the ship table IFDEF SHIPBANKA GetShipModelId: GetShipModelIdA: ld c,a ld hl,ShipModelBankA ; Ship Model BankA, B and C are all the same value ENDIF IFDEF SHIPBANKB GetShipModelIdB: ld c,a ld hl,ShipModelBankB ENDIF IFDEF SHIPBANKC GetShipModelIdC: ld c,a ld hl,ShipModelBankC ENDIF JumpIfALTNusng ShipTableALast+1, .ShipBankA JumpIfALTNusng ShipTableBLast+1, .ShipBankB JumpIfALTNusng ShipTableCLast+1, .ShipBankC .Failed: SetCarryFlag ; if its over current bank max then a failure ret .ShipBankA: ld b,a ld a,BankShipModelsA jp .Done .ShipBankB: sub a,ShipTableALast+1 ld a,BankShipModelsB jp .Done .ShipBankC: sub a,ShipTableBLast+1 ld a,BankShipModelsC .Done: ld a,BankShipModelsA ClearCarryFlag ret ;GINF: IFDEF SHIPBANKA GetInfo: ; gets pointer to ship data for ship type in a GetInfoA: ; gets pointer to ship data for ship type in a ENDIF IFDEF SHIPBANKB GetInfoB: ENDIF IFDEF SHIPBANKC GetInfoC: ENDIF ld c,a sra a sra a sra a sra a ; Divide by 16 to get bank table offset ld b,a ; save it as this is the number of x16 we need to subtract ld hl,ShipModelBankA add hl,a ld a,(hl) ;MMUSelectShipModelA ld a,c ld d,b ld e,16 mul sub a,e ld hl,ShipModelTable add hl,a add hl,a ld e,(hl) inc hl ld d,(hl) ret ; memcopy_dma, hl = target address de = source address to copy, bc = length" IFDEF SHIPBANKA CopyVerticesDataToUBnk: CopyVerticesDataToUBnkA: ENDIF IFDEF SHIPBANKB CopyVerticesDataToUBnkB: ENDIF IFDEF SHIPBANKC CopyVerticesDataToUBnkC: ENDIF ld hl,(VerticesAddyAddr) ; now the pointers are in Ubnk its easy to read ld de,UBnkHullVerticies ld b,0 ld a,(VertexCtX6Addr) ld c,a ex de,hl ; dma transfer goes de -> hl i.e. opposite of ldir call memcopy_dma ret IFDEF SHIPBANKA CopyEdgeDataToUBnk: CopyEdgeDataToUBnkA: ENDIF IFDEF SHIPBANKB CopyEdgeDataToUBnkB: ENDIF IFDEF SHIPBANKC CopyEdgeDataToUBnkC: ENDIF ld hl,(EdgeAddyAddr) ; now the pointers are in Ubnk its easy to read ld de,UBnkHullEdges ld b,0 ld a,(LineX4Addr) ld c,a ex de,hl ; dma transfer goes de -> hl i.e. opposite of ldir call memcopy_dma ret IFDEF SHIPBANKA CopyNormalDataToUBnk: CopyNormalDataToUBnkA: ENDIF IFDEF SHIPBANKB CopyNormalDataToUBnkB: ENDIF IFDEF SHIPBANKC CopyNormalDataToUBnkC: ENDIF ld hl,(FaceAddyAddr) ; now the pointers are in Ubnk its easy to read ld de,UBnkHullNormals ld b,0 ld a,(FaceCtX4Addr) ld c,a ex de,hl ; dma transfer goes de -> hl i.e. opposite of ldir call memcopy_dma ret ;CopyShipIdToUbnk: ld IFDEF SHIPBANKA CopyShipDataToUBnk: CopyShipDataToUBnkA: push af ld a,BankShipModelsA ENDIF IFDEF SHIPBANKB CopyShipDataToUBnkB: push af ld a,BankShipModelsB ENDIF IFDEF SHIPBANKC CopyShipDataToUBnkC: push af ld a,BankShipModelsC ENDIF ld (UBnkShipModelBank),a pop af ; save the current ship number and bank in case we need it later, say for a space station ld (UBnkShipModelNbr),a ; mark ship type in bank .GetHullDataLength: ld hl,ShipModelSizeTable add hl,a add hl,a ; we won't multiply by 2 as GetInfo is a general purpose routines so would end up x 4 ld c,(hl) inc hl ld b,(hl) ; bc now equals length of data set .GetHullDataAddress: call GetInfo ; de = address of Ship Data ex de,hl ; hl = address of Ship Data ld de,UBnkHullCopy ; Universe bank ld bc,ShipDataLength ldir call CopyVerticesDataToUBnk call CopyEdgeDataToUBnk call CopyNormalDataToUBnk ret ; change to there are two banks ; the master table in both has the bank and ship replicated in boht banks to simplify quick bank switch ; ; Ships in Bank A IFDEF SHIPBANKA ShipModelBank1 DB BankShipModelsA DB BankShipModelsB DB BankShipModelsC ENDIF IFDEF SHIPBANKB ShipModelBank2 DB BankShipModelsA DB BankShipModelsB DB BankShipModelsC ENDIF IFDEF SHIPBANKC ShipModelBank3 DB BankShipModelsA DB BankShipModelsB DB BankShipModelsC ENDIF IFDEF SHIPBANKA ENDIF IFDEF SHIPBANKB ENDIF IFDEF SHIPBANKC ENDIF IFNDEF SHIPMODELTABLES DEFINE SHIPMODELTABLES ShipModelSizeTable: EQU ShipModelSizeTableA ShipModelBank: EQU ShipModelBankA ShipModelTable: EQU ShipModelTableA ShipVertexTable: EQU ShipVertexTableA ShipEdgeTable: EQU ShipEdgeTableA ShipNormalTable: EQU ShipNormalTableA ENDIF IFDEF SHIPBANKA ENDIF IFDEF SHIPBANKB ENDIF IFDEF SHIPBANKC ENDIF ; TODO Later reorg these offsets for better 16 bit read - Done ; TODO Add in roll max rates and data to allow ship replacement, reference to custom console ; -> &565D \ Start Hull Data. For each hull, first 20 bytes give header info. ; hull byte#0 high nibble is scoop info, lower nibble is debris spin info ; Scoop: 0 = no scoop 1= scoop , anything more? ; hull byte#1-2 area for missile lock, lo, hi ; hull byte#3 edges data info offset lo ; hull byte#4 faces data info offset lo ; hull byte#5 4*maxlines+1 for ship lines stack ; hull byte#6 gun vertex*4 ; hull byte#7 explosion count e.g. &2A = 4*n+6 ; hull byte#8 vertices*6 ; hull byte#9 edge Count ; hull bytes#10-11 bounty lo hi ; hull byte#12 faces*4 ; hull byte#13 dot beyond distance ; hull byte#14 energy ; hull byte#15 speed (end of 4th row) ; hull byte#16 edges offset hi (goes -ve to use other's edge net). ; hull byte#17 faces offset hi ; hull byte#18 Q% scaling of normals to make large objects' normals flare out further away ; hull byte#19 laser|missile(=lower 3 bits) ; hull byte#20 Added Vertices for 20,21 ; Optimised version to be applied to add data brought in to here: ; hull byte#0 high nibble is scoop info, lower nibble is debris spin info ; hull byte#1-2 area for missile lock, lo, hi ; hull byte#3 edges data info offset lo ; hull byte#4 edges offset hi (goes -ve to use other's edge net). (was 16) ; hull byte#5 4*maxlines+1 for ship lines stack ; hull byte#6 gun vertex*4 ; hull byte#7 explosion count e.g. &2A = 4*n+6 ; hull byte#8 vertices*6 ; hull byte#9 edge Count ; hull bytes#10-11 bounty lo hi ; hull byte#12 faces*4 ; hull byte#13 dot beyond distance ; hull byte#14 energy ; hull byte#15 speed (end of 4th row) ; hull byte#16 faces data info offset lo (was 4) ; hull byte#17 faces offset hi ; hull byte#18 Q% scaling of normals to make large objects' normals flare out further away ; hull bute#19 laser|missile(=lower 3 bits) ; hull byte#20 Added Vertices for 20,21 ; ; Vertex Data Structure ; Byte 0 X1Lo ; Byte 1 X1Hi ; Byte 2 Y1Lo ; Byte 3 Y1Hi ; Byte 4 High 4 bits Face 2 Index Low 4 bits = Face 1 Index ; Byte 5 High 4 bits Face 4 Index Low 4 bits = Face 3 Index ; ; ; Edge Data Structure ; Byte 0 ; Byte 1 - Face 1 Index (uppernibble), Face 2 Index (lowernibble) ; Byte 2 - Index to Vertex 1 ; Byte 3 - Index to Vertex 2 ; ; Normal/Faces Data Structure ; ; ; ; Original Data: ; \ -> &565D \ Start Hull Data. For each hull, first 20 bytes give header info. ; \ hull byte#0 high nibble is scoop info, lower nibble is debris spin info ; \ hull byte#1-2 area for missile lock, lo, hi ; \ hull byte#3 edges data info offset lo ; \ hull byte#4 faces data info offset lo ; \ hull byte#5 4*maxlines+1 for ship lines stack ; \ hull byte#6 gun vertex*4 ; \ hull byte#7 explosion count e.g. &2A = 4*n+6 ; \ hull byte#8 vertices*6 ; \ hull bytes#10-11 bounty lo hi ; \ hull byte#12 faces*4 ; \ hull byte#13 dot beyond distance ; \ hull byte#14 energy ; \ hull byte#15 speed (end of 4th row) ; \ hull byte#16 edges offset hi (goes -ve to use other's edge net). ; \ hull byte#17 faces offset hi ; \ hull byte#18 Q% scaling of normals to make large objects' normals flare out further away ; \ hull bute#19 laser|missile(=lower 3 bits) ; Corrected pointers ; &565D \ Cargo cannister = Type 5 ; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ; Scp Missile Edg Edg Lin Gun Exp Vtx Edg Bounty Face Edg Face Vertices ; Deb Lock Lo Hi x4 Vtx Cnt x6 X1 lo hi x4 Dot Erg Spd hi Hi Q Laser Lo hi ; Mapping Orginal to new ; 0 => 0 ; 1-2 => 1-2 ; 3 => EQU Edges ; 4 => EQU Normals ; 5 => EQU EdgesCnt ; 6 => 6 ; 7 => 7 ; 8 => EQU VertSize ; 9 => EQU EdgesCnt ; 10-11=> 10-11 ; 12 => EQU NormalsSize ; 13 => 13 ; 14 => 14 ; 15 => 15 ; 16 => EQU Edges ; 17 => EQU Normals ; 18 => 18 ; 19 => 19
41.913846
216
0.443914
7eeb26d2ae3eee73327468f2b6a72f473743093c
1,468
asm
Assembly
iod/con2/ptr/sptr.asm
olifink/smsqe
c546d882b26566a46d71820d1539bed9ea8af108
[ "BSD-2-Clause" ]
null
null
null
iod/con2/ptr/sptr.asm
olifink/smsqe
c546d882b26566a46d71820d1539bed9ea8af108
[ "BSD-2-Clause" ]
null
null
null
iod/con2/ptr/sptr.asm
olifink/smsqe
c546d882b26566a46d71820d1539bed9ea8af108
[ "BSD-2-Clause" ]
null
null
null
* Set pointer position V1.01  1986 Tony Tebby QJUMP * section driver * xdef pt_sptr xdef pt_cptr * xref pt_fwind * include 'dev8_keys_con' include 'dev8_keys_err' include 'dev8_mac_assert' * pt_cptr move.l sd_sewll(a0),d0 ; any secondary? beq.s ptcp_set ; ... no move.l a0,-(sp) ptcp_scloop move.l d0,a0 ; ... yes assert sd_sewll,0 btst #sd..well,sd_behav(a0) ; well behaved? bne.s ptcp_sec ; ... yes move.l sd_sewll(a0),d0 bne.s ptcp_scloop bra.s ptcp_prim ; no suitable secondary, do primary ptcp_sec bsr.s ptcp_set move.l (sp)+,a0 rts ptcp_prim move.l (sp)+,a0 ; restore primary ptcp_set move.l sd_xhits(a0),d1 ; hit size lsr.l #1,d1 ; /2 gives centre of window bclr #15,d1 ; in case X was odd bra.s ptsp_hit ; add origin and set pointer * pt_sptr tst.b d2 window relative? beq.s ptsp_do ... no bgt.s ptsp_hit ... hit relative add.l sd_xmin(a0),d1 set position in screen coordinates bra.s ptsp_do ptsp_hit add.l sd_xhito(a0),d1 set position ptsp_do move.l pt_ssize(a3),d0 cmp.w d0,d1 y out of range? bhs.s pt_or ... yes cmp.l d0,d1 x out of range? bhs.s pt_or move.l d1,pt_npos(a3) set new position * ;; move.b #pt.freez,pt_freez(a3) freeze the pointer for a bit clr.b pt_schfg(a3) scheduler busy clr.b pt_offscr(a3) cannot SET offscreen move.l a1,-(sp) jsr pt_fwind ... but find window anyway move.l (sp)+,a1 moveq #0,d0 rts pt_or moveq #err.orng,d0 out of range rts end
20.971429
61
0.68733
dda71583504f410dc146b63a146f6b65e3a5f115
6,709
asm
Assembly
Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0.log_21829_1817.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0.log_21829_1817.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0.log_21829_1817.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 %r13 push %r15 push %r8 push %rbx push %rcx push %rdi push %rsi lea addresses_normal_ht+0x1793f, %rcx nop nop nop nop and $50084, %rbx movl $0x61626364, (%rcx) cmp $33983, %r13 lea addresses_A_ht+0x713f, %r12 clflush (%r12) nop inc %r13 mov (%r12), %esi inc %rcx lea addresses_WT_ht+0x6216, %rsi lea addresses_normal_ht+0x9c11, %rdi nop nop nop nop nop cmp %r15, %r15 mov $38, %rcx rep movsl nop dec %rdi lea addresses_normal_ht+0xaa3f, %rsi lea addresses_UC_ht+0x1323f, %rdi nop nop xor %rbx, %rbx mov $71, %rcx rep movsw nop nop nop xor $2745, %rcx lea addresses_A_ht+0xc03f, %rsi lea addresses_normal_ht+0x18d2c, %rdi nop sub %r13, %r13 mov $98, %rcx rep movsb nop nop nop and $42399, %r15 lea addresses_WC_ht+0x135bf, %r12 nop nop nop nop nop and %rsi, %rsi movl $0x61626364, (%r12) nop nop nop nop nop add %rdi, %rdi lea addresses_WC_ht+0x17a3f, %rsi lea addresses_UC_ht+0xaed7, %rdi nop nop add $40941, %r13 mov $61, %rcx rep movsl nop nop nop inc %rcx lea addresses_D_ht+0x7c3f, %rsi nop nop nop nop sub %rcx, %rcx mov $0x6162636465666768, %rdi movq %rdi, %xmm5 vmovups %ymm5, (%rsi) nop nop nop nop sub %rbx, %rbx lea addresses_UC_ht+0x169bf, %rcx nop nop and %r8, %r8 mov (%rcx), %r12w nop nop nop sub $49088, %rdi lea addresses_A_ht+0x623f, %rdi nop nop nop nop nop xor $35484, %rsi movb $0x61, (%rdi) nop nop nop dec %rdi pop %rsi pop %rdi pop %rcx pop %rbx pop %r8 pop %r15 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r14 push %r8 push %rax push %rdi push %rsi // Store lea addresses_US+0xac53, %r8 nop nop nop cmp %r14, %r14 movb $0x51, (%r8) nop cmp $11428, %rax // Faulty Load mov $0x767b4b000000023f, %r12 and $62070, %rsi mov (%r12), %eax lea oracles, %rdi and $0xff, %rax shlq $12, %rax mov (%rdi,%rax,1), %rax pop %rsi pop %rdi pop %rax pop %r8 pop %r14 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': True, 'size': 16}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_US', 'AVXalign': False, 'size': 1}} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4}} {'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 0, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 1, 'type': 'addresses_normal_ht'}} {'src': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_UC_ht'}} {'src': {'same': False, 'congruent': 9, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_normal_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4}} {'src': {'same': False, 'congruent': 11, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_UC_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32}} {'src': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 1}} {'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 */
36.069892
2,999
0.659264
1031c5cc1c11fdfb2c48095cf9e23d8db868d9b1
437
asm
Assembly
util/gut/smul.asm
olifink/smsqe
c546d882b26566a46d71820d1539bed9ea8af108
[ "BSD-2-Clause" ]
null
null
null
util/gut/smul.asm
olifink/smsqe
c546d882b26566a46d71820d1539bed9ea8af108
[ "BSD-2-Clause" ]
null
null
null
util/gut/smul.asm
olifink/smsqe
c546d882b26566a46d71820d1539bed9ea8af108
[ "BSD-2-Clause" ]
null
null
null
; General IO utility: send multiple bytes V2.00  1988 Tony Tebby section gen_util xdef gu_smul xref gu_iowp include 'dev8_keys_qdos_io' ;+++ ; This routine sends multiple bytes ; ; d2 c p number of bytes to send ; a0 c p channel ID ; a1 c p pointer to bytes ; error returns standard ;--- gu_smul moveq #iob.smul,d0 bra.s gu_iowp end
18.208333
69
0.569794
3ca6aa96bf8f87618755e8610fb682eec034c82d
452
asm
Assembly
libsrc/stdio/sprinter/puts_cons.asm
grancier/z180
e83f35e36c9b4d1457e40585019430e901c86ed9
[ "ClArtistic" ]
null
null
null
libsrc/stdio/sprinter/puts_cons.asm
grancier/z180
e83f35e36c9b4d1457e40585019430e901c86ed9
[ "ClArtistic" ]
null
null
null
libsrc/stdio/sprinter/puts_cons.asm
grancier/z180
e83f35e36c9b4d1457e40585019430e901c86ed9
[ "ClArtistic" ]
1
2019-12-03T23:57:48.000Z
2019-12-03T23:57:48.000Z
; ; Small C+ Z88 Internal Routine ; Puts a string to the console - mapping \n to \n\l as we ; go and appending \n\l to the end of the line ; ; Non standard (for short programs) ; ; djm 2/4/99 ; ; ; $Id: puts_cons.asm,v 1.5 2016/05/15 20:15:46 dom Exp $ ; SECTION code_clib PUBLIC puts_cons_native .puts_cons_native pop bc pop hl push hl push bc push ix ld c,$5c ;PCHARS rst $10 pop ix ret
14.580645
63
0.603982
8d37a07c78a1394967c86cf620a5701f4f7caf05
267
asm
Assembly
libsrc/_DEVELOPMENT/stdio/c/sdcc_ix/clearerr_unlocked_fastcall.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/_DEVELOPMENT/stdio/c/sdcc_ix/clearerr_unlocked_fastcall.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/clearerr_unlocked_fastcall.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
; void clearerr_unlocked_fastcall(FILE *stream) SECTION code_clib SECTION code_stdio PUBLIC _clearerr_unlocked_fastcall EXTERN asm_clearerr_unlocked _clearerr_unlocked_fastcall: push hl ex (sp),ix call asm_clearerr_unlocked pop ix ret
13.35
47
0.76779
8d641dc242419d2f235b1235150a2d9881b3661c
345
asm
Assembly
programs/oeis/292/A292543.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/292/A292543.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/292/A292543.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A292543: Number of 5-cycles in the n-Sierpinski tetrahedron graph. ; 0,96,384,1536,6144,24576,98304,393216,1572864,6291456,25165824,100663296,402653184,1610612736,6442450944,25769803776,103079215104,412316860416,1649267441664,6597069766656,26388279066624,105553116266496,422212465065984,1688849860263936 mov $1,4 pow $1,$0 div $1,4 mul $1,96
43.125
236
0.828986
0f1f7f711a48aa0770feb9292cfd790c1c6b95eb
12
asm
Assembly
src/test/resources/data/searchtests/test4-expected.asm
cpcitor/mdlz80optimizer
75070d984e1f08474e6d397c7e0eb66d8be0c432
[ "Apache-2.0" ]
36
2020-06-29T06:52:26.000Z
2022-02-10T19:41:58.000Z
src/test/resources/data/searchtests/test4-expected.asm
cpcitor/mdlz80optimizer
75070d984e1f08474e6d397c7e0eb66d8be0c432
[ "Apache-2.0" ]
39
2020-07-02T18:19:34.000Z
2022-03-27T18:08:54.000Z
src/test/resources/data/searchtests/test4-expected.asm
cpcitor/mdlz80optimizer
75070d984e1f08474e6d397c7e0eb66d8be0c432
[ "Apache-2.0" ]
7
2020-07-02T06:00:05.000Z
2021-11-28T17:31:13.000Z
ld b, c
6
11
0.333333
98300ff766b9a68691756c9a61f9a9f270dbf352
440
asm
Assembly
oeis/270/A270715.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/270/A270715.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/270/A270715.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A270715: a(n) = ((n+2)/2)*Sum_{k=0..n/2}(Sum_{i=0..n-2*k}(binomial(k+1,n-2*k-i)*binomial(k+i,k))/(k+1). ; Submitted by Simon Strandgaard ; 1,3,5,10,19,35,65,120,221,407,749,1378,2535,4663,8577,15776,29017,53371,98165,180554,332091,610811,1123457,2066360,3800629,6990447,12857437,23648514,43496399,80002351,147147265 mov $1,1 mov $2,1 lpb $0 sub $0,1 mov $4,$2 mov $2,$3 add $2,$1 mov $3,$1 add $1,1 add $1,$4 lpe mov $0,$1
25.882353
178
0.65
82ab03b1f6bc9f7ac3726d4d1fe39ca593d70ff6
401
asm
Assembly
programs/oeis/266/A266300.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/266/A266300.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/266/A266300.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A266300: Triangle read by rows giving successive states of cellular automaton generated by "Rule 15" initiated with a single ON (black) cell. ; 1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,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,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 add $0,1 seq $0,48760 ; Largest square <= n. mod $0,2
57.285714
201
0.61596
83b18d0b7a16b8d541d2cca783113a9af180c508
5,557
asm
Assembly
software/obsolete/new-rom/taskbar.asm
Noah1989/micro-21
f574c3dd089ee93737c8babc6f5eddf85e66987e
[ "MIT" ]
1
2019-05-17T14:43:17.000Z
2019-05-17T14:43:17.000Z
software/obsolete/new-rom/taskbar.asm
Noah1989/loopmicro
4d9a49b0aeee1d58aa712c7509cbb46d32477e16
[ "MIT" ]
null
null
null
software/obsolete/new-rom/taskbar.asm
Noah1989/loopmicro
4d9a49b0aeee1d58aa712c7509cbb46d32477e16
[ "MIT" ]
null
null
null
public taskbar_window extern ui_box_IX_fill_color_L_character_H extern ui_box_IX_calculate_absolute_position_DE extern ui_widget_IX_draw extern ui_label_IX_draw extern ui_panel_IX_draw extern ui_window_handle_input_propagate extern ui_window_handle_input_do_not_propagate extern ui_window_handle_vsync_noop extern app_IX_activate extern help_app extern memory_app extern files_app extern error include "ui.inc" include "video_io.inc" defc taskbar_button_state_normal = 0 defc taskbar_button_state_pressed = 1 defc taskbar_button_state_selected = 2 ; taskbar button defvars ui_widget { taskbar_button_label ds.w 1 taskbar_button_keycode ds.b 1 taskbar_button_state ds.b 1 taskbar_button_app ds.w 1 taskbar_button } defc taskbar_heartbeat_frames = 10 taskbar_handle_vsync: LD HL, taskbar_heartbeat DEC (HL) RET NZ LD A, taskbar_heartbeat_frames LD (HL), A LD IX, taskbar_heartbeat_icon LD A, (IX+ui_panel_background_color) XOR A, $07 LD (IX+ui_panel_background_color), A CALL ui_widget_IX_draw RET taskbar_window_IX_handle_input: ; params: E=scancode, D=flags LD BC, IX LD HL, ui_window_widgets ADD HL, BC taskbar_window_IX_handle_input_next_button: ; get pointer to button from widget list LD C, (HL) INC HL LD B, (HL) INC HL ; propagate event if none of the buttons matched LD A, B OR A, C JP Z, ui_window_handle_input_propagate ; check button scancode LD IX, BC LD A, (IX+taskbar_button_keycode) CP A, E JR NZ, taskbar_window_IX_handle_input_next_button ; handle event for found button BIT 0, D JR Z, taskbar_button_IX_press taskbar_button_IX_release: LD A, (IX+taskbar_button_state) CP taskbar_button_state_pressed JP NZ, ui_window_handle_input_do_not_propagate LD A, 0 LD (taskbar_button_is_pressed), A ; select and draw the button LD A, taskbar_button_state_selected LD (IX+taskbar_button_state), A PUSH IX CALL ui_widget_IX_draw POP DE ; check if this button was already selected before LD HL, (taskbar_selected_button) XOR A, A ; clears carry flag SBC HL, DE JP Z, ui_window_handle_input_do_not_propagate ; if not, deselect and draw the previously selected button LD IX, (taskbar_selected_button) LD (taskbar_selected_button), DE LD A, taskbar_button_state_normal LD (IX+taskbar_button_state), A CALL ui_widget_IX_draw ; activate the app for the now selected button LD IX, (taskbar_selected_button) LD E, (IX+taskbar_button_app) LD D, (IX+taskbar_button_app+1) LD IX, DE CALL app_IX_activate JP ui_window_handle_input_do_not_propagate taskbar_button_IX_press: LD A, (taskbar_button_is_pressed) AND A, A JP NZ, ui_window_handle_input_do_not_propagate LD A, taskbar_button_state_pressed CP A, (IX+taskbar_button_state) JP Z, ui_window_handle_input_do_not_propagate ;LD A, taskbar_button_state_pressed LD (IX+taskbar_button_state), A CALL ui_widget_IX_draw LD A, 1 LD (taskbar_button_is_pressed), A JP ui_window_handle_input_do_not_propagate taskbar_button_IX_draw: LD HL, taskbar_button_colors LD D, 0 LD E, (IX+taskbar_button_state) ADD HL, DE LD L, (HL) LD H, ' ' CALL ui_box_IX_fill_color_L_character_H CALL ui_box_IX_calculate_absolute_position_DE INC E LD A, E OUT (video_address_l), A LD A, D OUT (video_address_h), A LD HL, taskbar_button_colors_hotkey LD D, 0 LD E, (IX+taskbar_button_state) ADD HL, DE LD A, (HL) OUT (video_table_attribute_increment), A OUT (video_table_attribute_increment), A LD E, (IX+taskbar_button_label) LD D, (IX+taskbar_button_label+1) LD IX, DE CALL ui_label_IX_draw RET section ram_initialized taskbar_selected_button: defw taskbar_button_help taskbar_button_is_pressed: defb 0 taskbar_heartbeat: defb taskbar_heartbeat_frames section objects_mutable taskbar_button_help: defb ui_object_type_widget defb 0, 0 defb 9, 1 defw taskbar_window defw taskbar_button_IX_draw defw taskbar_button_help_label defb $05 ; F1 defb taskbar_button_state_selected defw help_app taskbar_button_memory: defb ui_object_type_widget defb 9, 0 defb 11, 1 defw taskbar_window defw taskbar_button_IX_draw defw taskbar_button_memory_label defb $06 ; F2 defb taskbar_button_state_normal defw memory_app taskbar_button_files: defb ui_object_type_widget defb 20, 0 defb 10, 1 defw taskbar_window defw taskbar_button_IX_draw defw taskbar_button_files_label defb $04 ; F3 defb taskbar_button_state_normal defw files_app taskbar_heartbeat_icon: defb ui_object_type_widget defb 79, 0 defb 1, 1 defw taskbar_window defw ui_panel_IX_draw defb $33, $03 section objects_immutable taskbar_window: defb ui_object_type_window defb 0, 29 defb 80, 1 defb $3F, ' ' defw taskbar_window_IX_handle_input defw taskbar_handle_vsync defw taskbar_button_help defw taskbar_button_memory defw taskbar_button_files defw taskbar_heartbeat_icon defw 0 taskbar_button_help_label: defb ui_object_type_widget defb 1, 0 defb 7, 1 defw taskbar_button_help defw ui_label_IX_draw defw taskbar_button_help_text taskbar_button_memory_label: defb ui_object_type_widget defb 1, 0 defb 9, 1 defw taskbar_button_memory defw ui_label_IX_draw defw taskbar_button_memory_text taskbar_button_files_label: defb ui_object_type_widget defb 1, 0 defb 8, 1 defw taskbar_button_files defw ui_label_IX_draw defw taskbar_button_files_text section strings taskbar_button_help_text: defb "F1-Help", 0 taskbar_button_memory_text: defb "F2-Memory", 0 taskbar_button_files_text: defb "F3-Files", 0 section constants taskbar_button_colors: defb $3F ; normal defb $4F ; pressed defb $1F ; selected taskbar_button_colors_hotkey: defb $3E ; normal defb $4E ; pressed defb $1E ; selected
22.77459
59
0.823646
66240d764cad3c487f3dcbab70933f9fc5dba444
6,412
asm
Assembly
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0.log_2987_1740.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_0xa0.log_2987_1740.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_0xa0.log_2987_1740.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 %r8 push %rax push %rbp push %rbx lea addresses_A_ht+0x13c99, %r11 nop and %rax, %rax vmovups (%r11), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $0, %xmm5, %r8 nop nop nop nop nop dec %rbp lea addresses_WC_ht+0x13521, %r10 sub %rbx, %rbx movw $0x6162, (%r10) nop nop nop nop dec %r10 lea addresses_normal_ht+0x14c21, %rbx nop nop add $34846, %r10 movups (%rbx), %xmm2 vpextrq $0, %xmm2, %rax nop nop sub $25292, %rbx pop %rbx pop %rbp pop %rax pop %r8 pop %r13 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r15 push %r8 push %r9 push %rbp push %rcx push %rdx // Store lea addresses_A+0x104c9, %r15 nop nop add %r8, %r8 mov $0x5152535455565758, %r9 movq %r9, %xmm2 movaps %xmm2, (%r15) nop nop nop nop nop and %r11, %r11 // Load lea addresses_normal+0xa1c1, %r8 nop nop nop nop cmp $35764, %rbp mov (%r8), %r15 nop nop nop nop inc %r15 // Load lea addresses_WC+0x14bd9, %r9 nop nop nop nop nop add $5569, %rbp mov (%r9), %rdx nop inc %r15 // Load lea addresses_D+0x1db21, %rbp nop nop nop nop nop cmp $13602, %r8 mov (%rbp), %r11 nop nop nop add %r15, %r15 // Store lea addresses_normal+0xcc21, %rbp nop cmp $60816, %r15 mov $0x5152535455565758, %r9 movq %r9, %xmm5 vmovups %ymm5, (%rbp) nop nop nop nop and %r11, %r11 // Load lea addresses_D+0x1f347, %rdx and %r11, %r11 mov (%rdx), %r9 nop dec %rbp // Store lea addresses_D+0x1cc91, %r15 clflush (%r15) nop nop cmp $4838, %r11 mov $0x5152535455565758, %r8 movq %r8, %xmm4 vmovntdq %ymm4, (%r15) nop nop nop nop and $12644, %r8 // Faulty Load lea addresses_A+0xec21, %r8 nop nop nop and %r9, %r9 movups (%r8), %xmm2 vpextrq $1, %xmm2, %r15 lea oracles, %rcx and $0xff, %r15 shlq $12, %r15 mov (%rcx,%r15,1), %r15 pop %rdx pop %rcx pop %rbp pop %r9 pop %r8 pop %r15 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_A', 'AVXalign': True, 'size': 16}} {'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_normal', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_WC', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_D', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_normal', 'AVXalign': False, 'size': 32}} {'src': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_D', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 4, 'type': 'addresses_D', 'AVXalign': False, 'size': 32}} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 2}} {'src': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'00': 2987} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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.925926
2,999
0.651747
98d47c391cd94a45964da901b427f898e23e9ce5
691
asm
Assembly
list_reverse.asm
danielzy95/MIPS-Random
d9f8f74bea71d88436a0bc89924ed2d93a1b3e23
[ "MIT" ]
null
null
null
list_reverse.asm
danielzy95/MIPS-Random
d9f8f74bea71d88436a0bc89924ed2d93a1b3e23
[ "MIT" ]
null
null
null
list_reverse.asm
danielzy95/MIPS-Random
d9f8f74bea71d88436a0bc89924ed2d93a1b3e23
[ "MIT" ]
null
null
null
.text main: list_reverse: # Prologue addi $sp, $sp, -12 sw $ra, 0($sp) sw $s0, 4($sp) sw $s1, 8($sp) move $s0, $a0 jal list_empty move $a0, $s0 beq $v0, $zero, end_funct jal list_begin move $a0, $s0 move $s0, $v0 for: jal list_end move $a0, $s0 beq $s1, $v0, post_for move $a0, $s1 addi $s1, $s1, 4 move $a1, $s1 jal swap lw $s1, 0($s0) j for post_for: addi $a0, $s0, 4 addi $a1, $s0, 12 jal swap lw $a0, 4($s0) lw $a1, 12($s0) addi $a1, $a1, 4 jal swap end_funct: lw $s1, 8($sp) lw $s0, 4($sp) lw $ra, 0($sp) addi $sp,$sp, 12 jr $ra list_begin: list_end: list_empty: swap:
9.732394
26
0.515195
04984199fae8c771a6de042cddbda7c1f96d1df7
8,376
asm
Assembly
Transynther/x86/_processed/NC/_ht_zr_/i7-7700_9_0xca_notsx.log_21829_1584.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NC/_ht_zr_/i7-7700_9_0xca_notsx.log_21829_1584.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NC/_ht_zr_/i7-7700_9_0xca_notsx.log_21829_1584.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 %rax push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0xf0ce, %rsi lea addresses_UC_ht+0xba4e, %rdi nop nop nop nop sub $28615, %rdx mov $81, %rcx rep movsb nop nop nop nop and $26201, %r10 lea addresses_WT_ht+0xc64e, %rbx nop and %rax, %rax movl $0x61626364, (%rbx) sub $14293, %rcx lea addresses_WT_ht+0xf64e, %rcx nop nop cmp $24809, %rbx movups (%rcx), %xmm4 vpextrq $1, %xmm4, %r10 nop nop and %rbx, %rbx lea addresses_D_ht+0x79b2, %rcx nop mfence mov (%rcx), %ax nop nop nop dec %rbx lea addresses_normal_ht+0x1a4e, %rbx nop nop nop nop sub %rcx, %rcx movb (%rbx), %r10b nop nop nop nop and %rdx, %rdx lea addresses_D_ht+0x1c69e, %rsi lea addresses_A_ht+0x73ee, %rdi nop nop nop nop sub $23283, %r10 mov $110, %rcx rep movsb nop nop nop cmp %rcx, %rcx lea addresses_D_ht+0x132, %rdi nop nop nop nop nop and %rbx, %rbx mov $0x6162636465666768, %rsi movq %rsi, (%rdi) nop nop sub %rsi, %rsi lea addresses_A_ht+0x1604e, %rsi nop nop cmp %rdx, %rdx mov (%rsi), %rax nop nop nop nop nop and $49931, %rdx lea addresses_WC_ht+0x13b66, %rbx nop nop nop nop sub $15890, %rdx movl $0x61626364, (%rbx) nop nop nop nop cmp $53364, %rbx lea addresses_A_ht+0x17b4e, %rax nop xor %r10, %r10 movb (%rax), %bl nop cmp $12368, %rax lea addresses_normal_ht+0x1964e, %r10 nop nop nop nop nop xor $51058, %rcx movb (%r10), %bl nop add %rsi, %rsi lea addresses_WT_ht+0x864e, %rsi clflush (%rsi) cmp %r10, %r10 movl $0x61626364, (%rsi) dec %rcx lea addresses_A_ht+0x127f8, %rbx sub %rax, %rax vmovups (%rbx), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $1, %xmm7, %rdi nop nop add %rsi, %rsi lea addresses_WT_ht+0x12b9a, %rcx nop nop nop nop nop lfence movl $0x61626364, (%rcx) nop nop nop and %rdi, %rdi lea addresses_A_ht+0x1064e, %rsi lea addresses_WT_ht+0x1444e, %rdi nop nop nop nop nop sub %r11, %r11 mov $112, %rcx rep movsq nop nop nop nop nop dec %r10 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rax pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r8 push %rbp push %rbx push %rdi push %rdx // Load lea addresses_A+0xbff6, %rdi nop nop xor $58415, %rbx mov (%rdi), %r8w nop nop nop nop cmp %rbp, %rbp // Load lea addresses_WC+0xda4e, %r13 sub $1749, %rdx movb (%r13), %r8b nop nop nop cmp $17344, %rdi // Load lea addresses_D+0x1564e, %rbp xor %r10, %r10 movups (%rbp), %xmm1 vpextrq $0, %xmm1, %r8 and %r13, %r13 // Faulty Load mov $0x68b81000000024e, %r8 add %rbx, %rbx vmovups (%r8), %ymm3 vextracti128 $1, %ymm3, %xmm3 vpextrq $1, %xmm3, %r13 lea oracles, %r8 and $0xff, %r13 shlq $12, %r13 mov (%r8,%r13,1), %r13 pop %rdx pop %rdi pop %rbx pop %rbp pop %r8 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': True, 'type': 'addresses_NC'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 3, 'same': False, 'type': 'addresses_A'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 10, 'same': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 10, 'same': False, 'type': 'addresses_D'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': True, 'type': 'addresses_NC'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 5, 'same': False, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 11, 'same': True, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'} {'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 6, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 10, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 2, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 11, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 3, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 3, 'same': True, 'type': 'addresses_A_ht'}, 'OP': 'REPM'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 2, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 7, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 2, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 8, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 10, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 8, 'same': True, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 1, 'same': True, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'} {'src': {'congruent': 7, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'} {'00': 28, '45': 21792, '46': 9} 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 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 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 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 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 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.339768
2,999
0.651146
ba511124a8acc43f516e640e7b310f483d4da3c3
1,017
asm
Assembly
sk/sfx/BE.asm
Cancer52/flamedriver
9ee6cf02c137dcd63e85a559907284283421e7ba
[ "0BSD" ]
9
2017-10-09T20:28:45.000Z
2021-06-29T21:19:20.000Z
sk/sfx/BE.asm
Cancer52/flamedriver
9ee6cf02c137dcd63e85a559907284283421e7ba
[ "0BSD" ]
12
2018-08-01T13:52:20.000Z
2022-02-21T02:19:37.000Z
sk/sfx/BE.asm
Cancer52/flamedriver
9ee6cf02c137dcd63e85a559907284283421e7ba
[ "0BSD" ]
2
2018-02-17T19:50:36.000Z
2019-10-30T19:28:06.000Z
Sound_BE_Header: smpsHeaderStartSong 3 smpsHeaderVoice Sound_BE_Voices smpsHeaderTempoSFX $01 smpsHeaderChanSFX $01 smpsHeaderSFXChannel cFM3, Sound_BE_FM3, $12, $10 ; FM3 Data Sound_BE_FM3: smpsSetvoice $00 smpsModSet $01, $01, $2B, $0B dc.b nA0, $29 Sound_BE_Loop00: dc.b smpsNoAttack, nA0, $16 smpsContinuousLoop Sound_BE_Loop00 smpsStop Sound_BE_Voices: ; Voice $00 ; $34 ; $0C, $0D, $0A, $1A, $1F, $1F, $1F, $1F, $00, $00, $00, $00 ; $00, $00, $00, $00, $0F, $0F, $0F, $0F, $11, $80, $10, $80 smpsVcAlgorithm $04 smpsVcFeedback $06 smpsVcUnusedBits $00 smpsVcDetune $01, $00, $00, $00 smpsVcCoarseFreq $0A, $0A, $0D, $0C smpsVcRateScale $00, $00, $00, $00 smpsVcAttackRate $1F, $1F, $1F, $1F smpsVcAmpMod $00, $00, $00, $00 smpsVcDecayRate1 $00, $00, $00, $00 smpsVcDecayRate2 $00, $00, $00, $00 smpsVcDecayLevel $00, $00, $00, $00 smpsVcReleaseRate $0F, $0F, $0F, $0F smpsVcTotalLevel $00, $10, $00, $11
26.076923
62
0.623402
3dbd68d356132d201435ce3d02922f5740ac61aa
6,501
asm
Assembly
Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0x48.log_21829_165.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0x48.log_21829_165.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0x48.log_21829_165.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
3
2020-07-14T17:07:07.000Z
2022-03-21T01:12:22.000Z
.global s_prepare_buffers s_prepare_buffers: push %r14 push %r15 push %r9 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_normal_ht+0x1a60a, %rbx clflush (%rbx) nop nop cmp %r15, %r15 mov (%rbx), %r9 sub %rsi, %rsi lea addresses_D_ht+0x12ef2, %rsi lea addresses_D_ht+0x1e862, %rdi nop nop cmp %r14, %r14 mov $84, %rcx rep movsl nop nop nop nop dec %r9 lea addresses_normal_ht+0x18862, %rbx nop nop nop add $10293, %rsi mov $0x6162636465666768, %rcx movq %rcx, %xmm4 movups %xmm4, (%rbx) nop nop nop nop nop and %rdi, %rdi lea addresses_A_ht+0x13fca, %rsi lea addresses_normal_ht+0x3a8a, %rdi nop nop nop cmp $18498, %rbp mov $86, %rcx rep movsb sub $51618, %r15 lea addresses_UC_ht+0x5862, %r14 nop nop nop nop cmp %rdi, %rdi movw $0x6162, (%r14) nop nop nop mfence lea addresses_A_ht+0x5862, %rbx nop nop nop nop inc %r15 movb $0x61, (%rbx) add $34640, %r15 lea addresses_normal_ht+0x8862, %rcx nop nop nop add %rsi, %rsi mov (%rcx), %rdi nop add %r15, %r15 lea addresses_WT_ht+0x14862, %rsi lea addresses_normal_ht+0x2f62, %rdi clflush (%rsi) nop add %rbx, %rbx mov $107, %rcx rep movsb nop nop sub %r15, %r15 lea addresses_A_ht+0x862, %rsi lea addresses_normal_ht+0x1ab62, %rdi nop nop nop inc %rbx mov $26, %rcx rep movsw and $52461, %rdi lea addresses_A_ht+0x145d4, %rsi lea addresses_A_ht+0x4022, %rdi clflush (%rdi) and %r9, %r9 mov $77, %rcx rep movsb nop nop nop nop nop inc %rcx pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r9 pop %r15 pop %r14 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r15 push %rbp push %rsi // Faulty Load lea addresses_D+0xa062, %rsi nop nop nop nop nop sub %r15, %r15 mov (%rsi), %r13w lea oracles, %r11 and $0xff, %r13 shlq $12, %r13 mov (%r11,%r13,1), %r13 pop %rsi pop %rbp pop %r15 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': True, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 2, 'size': 8, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 10, 'size': 16, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': True, 'congruent': 8, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': False, 'NT': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 10, 'size': 8, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': True}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': True}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}} {'36': 21829} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
38.467456
2,999
0.661283
78e461803ebd5f262756324c66c96655634789a1
235
asm
Assembly
programs/oeis/185/A185015.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/185/A185015.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/185/A185015.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A185015: Characteristic function of 5. ; 0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 mov $1,$0 cmp $1,5
39.166667
173
0.544681
436d2f55403c2f5183a54469554af3dc131a411c
301
asm
Assembly
programs/oeis/253/A253212.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/253/A253212.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/253/A253212.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A253212: a(n) = 9^n + 8. ; 9,17,89,737,6569,59057,531449,4782977,43046729,387420497,3486784409,31381059617,282429536489,2541865828337,22876792454969,205891132094657,1853020188851849,16677181699666577,150094635296999129,1350851717672992097,12157665459056928809 mov $1,9 pow $1,$0 add $1,8 mov $0,$1
37.625
234
0.810631
aeec3cb3016c726201e9ba9434044a8bbbe01d99
250
asm
Assembly
programs/oeis/070/A070712.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/070/A070712.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/070/A070712.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A070712: n^7 mod 31. ; 0,1,4,17,16,5,6,28,2,10,20,13,24,22,19,23,8,12,9,7,18,11,21,29,3,25,26,15,14,27,30,0,1,4,17,16,5,6,28,2,10,20,13,24,22,19,23,8,12,9,7,18,11,21,29,3,25,26,15,14,27,30,0,1,4,17,16,5,6,28,2,10,20,13,24,22,19 pow $0,7 mod $0,31
41.666667
206
0.612
7e72391e2c4071a74f0b83055525baf92f93a110
246
asm
Assembly
solutions/59 - Glory Hole/size-5_speed-39.asm
michaelgundlach/7billionhumans
02c6f3963364362c95cb516cbc6ef1efc073bb2e
[ "MIT" ]
45
2018-09-05T04:56:59.000Z
2021-11-22T08:57:26.000Z
solutions/59 - Glory Hole/size-5_speed-39.asm
michaelgundlach/7billionhumans
02c6f3963364362c95cb516cbc6ef1efc073bb2e
[ "MIT" ]
36
2018-09-01T11:34:26.000Z
2021-05-19T23:20:49.000Z
solutions/59 - Glory Hole/size-5_speed-39.asm
michaelgundlach/7billionhumans
02c6f3963364362c95cb516cbc6ef1efc073bb2e
[ "MIT" ]
36
2018-09-01T07:44:19.000Z
2021-09-10T19:07:35.000Z
-- 7 Billion Humans (2212:2214M) -- -- 59: Glory Hole -- -- Author: std4453 -- Size: 5 -- Speed: 39 mem1 = nearest datacube a: step mem1 mem1 = foreachdir nw,w,sw,n,s,ne,se: if c == 1 and mem1 == hole or c > mem1: jump a endif endfor
12.3
36
0.609756
37cb988ff4bc5be7296b62145bfb2c7a6cd827c9
164
asm
Assembly
libsrc/_DEVELOPMENT/adt/ba_stack/c/sccz80/ba_stack_pop.asm
teknoplop/z88dk
bb03fbfd6b2ab0f397a1358559089f9cd3706485
[ "ClArtistic" ]
8
2017-01-18T12:02:17.000Z
2021-06-12T09:40:28.000Z
libsrc/_DEVELOPMENT/adt/ba_stack/c/sccz80/ba_stack_pop.asm
teknoplop/z88dk
bb03fbfd6b2ab0f397a1358559089f9cd3706485
[ "ClArtistic" ]
1
2017-03-06T07:41:56.000Z
2017-03-06T07:41:56.000Z
libsrc/_DEVELOPMENT/adt/ba_stack/c/sccz80/ba_stack_pop.asm
teknoplop/z88dk
bb03fbfd6b2ab0f397a1358559089f9cd3706485
[ "ClArtistic" ]
3
2017-03-07T03:19:40.000Z
2021-09-15T17:59:19.000Z
; int ba_stack_pop(ba_stack_t *s) SECTION code_clib SECTION code_adt_ba_stack PUBLIC ba_stack_pop EXTERN asm_ba_stack_pop defc ba_stack_pop = asm_ba_stack_pop
13.666667
36
0.841463
d8f68e60a2edf640dbb4b11d29d3df7a9453b6e3
1,982
asm
Assembly
programs/oeis/004/A004188.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/004/A004188.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/004/A004188.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A004188: a(n) = n*(3*n^2 - 1)/2. ; 0,1,11,39,94,185,321,511,764,1089,1495,1991,2586,3289,4109,5055,6136,7361,8739,10279,11990,13881,15961,18239,20724,23425,26351,29511,32914,36569,40485,44671,49136,53889,58939,64295,69966,75961,82289,88959,95980,103361,111111,119239,127754,136665,145981,155711,165864,176449,187475,198951,210886,223289,236169,249535,263396,277761,292639,308039,323970,340441,357461,375039,393184,411905,431211,451111,471614,492729,514465,536831,559836,583489,607799,632775,658426,684761,711789,739519,767960,797121,827011,857639,889014,921145,954041,987711,1022164,1057409,1093455,1130311,1167986,1206489,1245829,1286015,1327056,1368961,1411739,1455399,1499950,1545401,1591761,1639039,1687244,1736385,1786471,1837511,1889514,1942489,1996445,2051391,2107336,2164289,2222259,2281255,2341286,2402361,2464489,2527679,2591940,2657281,2723711,2791239,2859874,2929625,3000501,3072511,3145664,3219969,3295435,3372071,3449886,3528889,3609089,3690495,3773116,3856961,3942039,4028359,4115930,4204761,4294861,4386239,4478904,4572865,4668131,4764711,4862614,4961849,5062425,5164351,5267636,5372289,5478319,5585735,5694546,5804761,5916389,6029439,6143920,6259841,6377211,6496039,6616334,6738105,6861361,6986111,7112364,7240129,7369415,7500231,7632586,7766489,7901949,8038975,8177576,8317761,8459539,8602919,8747910,8894521,9042761,9192639,9344164,9497345,9652191,9808711,9966914,10126809,10288405,10451711,10616736,10783489,10951979,11122215,11294206,11467961,11643489,11820799,11999900,12180801,12363511,12548039,12734394,12922585,13112621,13304511,13498264,13693889,13891395,14090791,14292086,14495289,14700409,14907455,15116436,15327361,15540239,15755079,15971890,16190681,16411461,16634239,16859024,17085825,17314651,17545511,17778414,18013369,18250385,18489471,18730636,18973889,19219239,19466695,19716266,19967961,20221789,20477759,20735880,20996161,21258611,21523239,21790054,22059065,22330281,22603711,22879364,23157249 mov $1,$0 pow $1,3 mul $1,3 sub $1,$0 div $1,2
220.222222
1,898
0.85116
92e530227d90c8ea6aaea4a8c508eaf6ce7190be
560
asm
Assembly
Student/examples/Correct/Arrays/Correct_301.asm
SoftMoore/CPRL-Kt
c2dfdbd5b30ed6175f419398071e2f98e582d23a
[ "Unlicense" ]
6
2021-02-02T10:08:02.000Z
2022-03-24T08:10:44.000Z
Student/examples/Correct/Arrays/Correct_301.asm
SoftMoore/CPRL-Kt
c2dfdbd5b30ed6175f419398071e2f98e582d23a
[ "Unlicense" ]
1
2021-02-27T21:55:26.000Z
2021-02-28T12:39:29.000Z
Student/examples/Correct/Arrays/Correct_301.asm
SoftMoore/CPRL-Kt
c2dfdbd5b30ed6175f419398071e2f98e582d23a
[ "Unlicense" ]
6
2020-02-24T13:51:32.000Z
2021-06-05T19:02:05.000Z
PROGRAM 44 LDGADDR 0 LDCINT 0 STOREW L0: LDGADDR 0 LOADW LDCINT 10 CMP BGE L1 LDGADDR 4 LDGADDR 0 LOADW LDCINT 4 MUL ADD LDCINT 2 LDGADDR 0 LOADW MUL STOREW LDGADDR 0 LDGADDR 0 LOADW LDCINT 1 ADD STOREW BR L0 L1: LDGADDR 0 LDCINT 0 STOREW L4: LDGADDR 0 LOADW LDCINT 10 CMP BGE L5 LDGADDR 4 LDGADDR 0 LOADW LDCINT 4 MUL ADD LOADW PUTINT PUTEOL LDGADDR 0 LDGADDR 0 LOADW LDCINT 1 ADD STOREW BR L4 L5: HALT
9.824561
13
0.566071
b06bf3187e79e1181773c1661e7e11b1756d2db9
4,231
asm
Assembly
code/audio/soundPlayer.asm
zxwanderer/A-World-of-One-way
9c5e3142f9f225bbfcca52a4d3c9de89c00753d9
[ "Apache-2.0" ]
7
2021-04-08T15:16:14.000Z
2021-12-05T00:36:30.000Z
code/audio/soundPlayer.asm
zxwanderer/A-World-of-One-way
9c5e3142f9f225bbfcca52a4d3c9de89c00753d9
[ "Apache-2.0" ]
null
null
null
code/audio/soundPlayer.asm
zxwanderer/A-World-of-One-way
9c5e3142f9f225bbfcca52a4d3c9de89c00753d9
[ "Apache-2.0" ]
1
2021-05-25T07:27:20.000Z
2021-05-25T07:27:20.000Z
; Beeper engine ; Copyright (C) 2021 by Juan J. Martinez <jjm@usebox.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. ; ; .globl beeper_init ; .globl beeper_queue ; .globl beeper_play ; TODO need test on real computer. On XPECCY emulator beeper is absent ! module SOUND_PLAYER module SET_SOUND mute: ld hl,SOUND_PLAYER.DATA.mute jr SOUND_PLAYER.init coin: ld hl,SOUND_PLAYER.DATA.coin jr SOUND_PLAYER.init explosion: ld hl,SOUND_PLAYER.DATA.explosion jr SOUND_PLAYER.init impact: ld hl,SOUND_PLAYER.DATA.impact jr SOUND_PLAYER.init eat: ld hl,SOUND_PLAYER.DATA.eat jr SOUND_PLAYER.init key: ld hl,SOUND_PLAYER.DATA.key jr SOUND_PLAYER.init ice: ld hl,SOUND_PLAYER.DATA.ice jr SOUND_PLAYER.init done: ld hl,SOUND_PLAYER.DATA.done jr SOUND_PLAYER.init dead: ld hl,SOUND_PLAYER.DATA.dead jr SOUND_PLAYER.init endmodule init: di ld (sfx_data), hl ld a,1 ld (sfx_type), a ld de,sfx_type ld bc,5 ldir ei ret ; beeper_queue:: ; di ; ld a, l ; call queue_next ; ei ; ret queue_next: ld (sfx_type), a or a ret z dec a ld hl, (sfx_data) ld c, l ld b, h ld h, #0 ld l, a ld d, h ld e, l add hl, hl add hl, hl add hl, de add hl, bc ld de, sfx_type ld bc, #5 ldir ret play: ld a, (sfx_type) or a ret z dec a jr z, tone dec a ; shouldn't happen! ret nz ; noise ld a, (sfx_freq) ld d, a ld b, #0 noise_loop: call rnd and 0x10 ; FIXME: border ? out (0xfe), a ld c, d noise_freq_loop: dec b jr z, noise_done dec c jr nz, noise_freq_loop jr noise_loop tone: ld a, (sfx_freq) ld d, a xor a ld b, a tone_loop: ; FIXME: border ? and 0x10 out (0xfe), a xor 0x10 ld c, d freq_loop: dec b jr z, tone_done dec c jr nz, freq_loop jr tone_loop tone_done: noise_done: ld a, (sfx_next) ld hl, sfx_frames dec (hl) jr z, queue_next ; freq change (slide) ld a, (sfx_freq_chg) add d ld (sfx_freq), a ret rnd: ld hl, 0xf3a1 ld a, h rra ld a, l rra xor h ld h, a ld a, l rra ld a, h rra xor l ld l, a xor h ld h, a ld (rnd + 1), hl ret sfx_type: db 0 sfx_frames: db 0 sfx_freq: db 0 sfx_freq_chg: db 0 sfx_next: db 0 sfx_data: block 2 module DATA mute: db 0,0,0,0,0 coin: db 1,6,32,-8,2, 1,6,48,-12,0 explosion: db 2,32,1,-1,0 impact: db 2,2,5,-33,0 eat: db 1,8,33,78,0 key: db 1,1,4,0,0 ice: db 2,6,22,66,0 done: db 1,32,99,-3,0 dead: db 1,32,1,-64,0 endmodule endmodule
19.231818
80
0.565824
8b3ebf7e363af4bd65b858cb913244d8306a6e87
4,198
asm
Assembly
MSDOS/Virus.MSDOS.Unknown.extasy.asm
fengjixuchui/Family
2abe167082817d70ff2fd6567104ce4bcf0fe304
[ "MIT" ]
3
2021-05-15T15:57:13.000Z
2022-03-16T09:11:05.000Z
MSDOS/Virus.MSDOS.Unknown.extasy.asm
fengjixuchui/Family
2abe167082817d70ff2fd6567104ce4bcf0fe304
[ "MIT" ]
null
null
null
MSDOS/Virus.MSDOS.Unknown.extasy.asm
fengjixuchui/Family
2abe167082817d70ff2fd6567104ce4bcf0fe304
[ "MIT" ]
3
2021-05-15T15:57:15.000Z
2022-01-08T20:51:04.000Z
; Virusname: Extasy ; Origin: Sweden ; Author: Metal Militia ; This virus can be found with any anti-virus program, since it's been ; around for a while now. (SCAN/TB-SCAN/F-PROT/SOLOMON that is..) ; ; It's a resident .COM infector, without any encryption or stealth ; capabilities. It infects when you execute (4bh) or closes (3eh). ; This virus looks pretty much like RAVAGE, since it's pretty much ; alike except for that RAVAGE infects .EXE files too. ; ; I stopped with this virus since it's so totally buggy that you'll find ; it almost at once. This is the reason why i give you the source code. ; In my later resident things, there will be such things as encryption, ; stealth etc. i think.. .model tiny .code .radix 16 .code viruslength = heap - _small startload = 90 * 4 _small: call relative oldheader dw 020cdh dw 0bh dup (0) relative: pop bp push ds push es xor ax,ax mov ds,ax mov es,ax mov di,startload cmp word ptr ds:[di+25],di jz exit_small lea si,[bp-3] mov cx,viruslength db 2Eh rep movsb mov di,offset old21 + startload mov si,21*4 push si movsw movsw pop di mov ax,offset int21 + startload stosw xchg ax,cx stosw exit_small: pop es pop ds or sp,sp jnp returnCOM returnGNU: returnCOM: mov di,100 push di mov si,bp movsw movsb ret infect: push ax push bx push cx push dx push si push di push ds push es mov ax,3d02 int 21 xchg ax,bx push cs pop ds push cs pop es mov ax,5700h int 21h push cx push dx mov si,offset oldheader+startload mov ah,3f mov cx,18 push cx mov dx,si int 21 cmp ax,cx jnz go_already_infected mov di,offset target + startload push di rep movsb pop di mov ax,4202 cwd int 21 cmp ds:[di],'ZM' jz infectNOT cmp ds:[di],'MZ' jz infectNOT sub ax,3 mov byte ptr ds:[di],0e9 mov ds:[di+1],ax sub ax,viruslength cmp ds:[si-17],ax jnz finishinfect go_already_infected: pop cx jmp short already_infected db "EXTASY!" db "(c) Metal Militia / Immortal Riot" int21: cmp ax,4b00 jz kewl cmp ax,3e00 jnz oops mov ah,45 int 21 jmp kewl oops: jmp chain infectNOT: jmp go_already_infected kewl: jmp infect finishinfect: mov cx,viruslength mov dx,startload mov ah,40 int 21 mov ax,4200 xor cx,cx cwd int 21 mov ah,40 mov dx,di pop cx int 21 already_infected: pop dx pop cx mov ax,5701h int 21h mov ah,3e int 21 exitinfect: pop es pop ds pop di pop si pop dx pop cx pop bx pop ax chain: db 0ea heap: old21 dw ?, ? target dw 0ch dup (?) endheap: end _small
21.309645
72
0.424011
db2c46a31b1e0fed7a77da23ebd3d191dc266f12
893
asm
Assembly
programs/oeis/129/A129792.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/129/A129792.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/129/A129792.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A129792: a(n) = ceiling(8^n/n). ; 8,32,171,1024,6554,43691,299594,2097152,14913081,107374183,780903145,5726623062,42288908761,314146179365,2345624805923,17592186044416,132458812569721,1000799917193444,7585009898729257,57646075230342349,439208192231179801,3353953467947191203,25665035232987202249,196765270119568550571,1511157274518286468383,11624286727063742064483,89550060712194753681939,690814754065502385546387,5335948445195604633185881,41264667976179342496637475,319468397234936845135257865,2475880078570760549798248448,19206827276185293962071260688,149135364732732870764318024162,1158994834494381167082700073487,9014404268289631299532111682674,70166173763984157142304004448921,546557564056297645108473297812642,4260346140336268823409638013719054,33230699894622896822595176507008615,259361560153154316664157475176652601 add $0,1 mov $1,8 pow $1,$0 sub $1,1 div $1,$0 add $1,1 mov $0,$1
81.181818
791
0.899216
863b9b33dcbf49d593e4262bf40ab2e7c5775678
70,136
asm
Assembly
programs/forth.asm
CH-Electronics/chos
4a5ac8b704242c60e4462a3ead7faf9ccc71229f
[ "BSD-3-Clause" ]
312
2015-01-05T03:14:47.000Z
2022-03-30T01:47:49.000Z
programs/forth.asm
ekoontz/mikeOS
691040e1c62298bf1322984cd85d497b573be395
[ "BSD-3-Clause" ]
8
2016-08-10T16:50:33.000Z
2021-01-26T09:37:06.000Z
programs/forth.asm
ekoontz/mikeOS
691040e1c62298bf1322984cd85d497b573be395
[ "BSD-3-Clause" ]
155
2015-01-16T10:58:42.000Z
2022-01-12T17:37:21.000Z
; ***************************************************************************** ; * ; * Forth operating system for an IBM Compatible PC ; * Copyright (C) 1993-2011 W Nagel ; * Copyright (C) 2014 MikeOS Developers -- see doc/LICENSE.TXT ; * ; * For the most part it follows the FIG model, Forth-79 standard ; * There are differences, however ; * ; ***************************************************************************** ; Some machines use subroutine threading (use SP for R stack) - this is ; considered Forth-like, and not true Forth. Also, the 8086 does not support ; [SP] and there are many more PUSH (1 byte) than RPUSH (4 bytes) instructions. ; This would be a poor choice for this processor. ; CFA = Compilation (or Code) Field Address. ; A Forth header = ; LFA address of previous word in chain, last one = 0 ; NFA count(b4-0)/flags(b7=immediate, b5=smudge) + name ; CFA points to executable code for this definition ; PFA may contain parameters or code ; converted to nasm's macro processor bits 16 ; nasm, 8086 %include "mikedev.inc" cr equ 13 ; carriage return lf equ 10 ; line feed bell equ 7 ; bell (sort of) spc equ 32 ; space bs equ 8 ; back space del equ 127 ; 'delete' character %macro NEXT 0 ; mov di,[si] + inc si (twice) => couple extra bytes & many cycles lodsw xchg ax,di ; less bytes than mov, just as fast jmp [di] ; 4 bytes %endmacro %macro RPUSH 1 dec bp dec bp mov word [bp+0],%1 %endmacro %macro RPOP 1 mov word %1,[bp+0] inc bp inc bp %endmacro ; A vocabulary is specified by a number between 1 and 15. See 'vocabulary' for a short ; discussion. A minimum of (2* highest vocabulary) dictionary threads are needed to ; prevent 'collisions' among the vocabularies. Initial compilation is entirely in the ; 'FORTH' vocabulary. VOC EQU 1 ; specify FORTH part of Dictionary for this build %assign IMM 0 ; next word is not IMMEDIATE %macro IMMEDIATE 0 ; the following word is immediate %assign IMM 080h %endmacro %assign defn 0 ; definition counter to create unique label %define @def0 0 ; no definitions yet, mark as end of chain %macro HEADING 1 %assign t1 defn ; unique label for chaining definitions %assign defn defn+1 ; increment label %strlen lenstrng %1 ; get length of name @def %+ defn: dw @def %+ t1 ; temporary LFA -- first startup rearranges into chains db IMM+lenstrng, %1 ; turn name into counted string with immediate indicator %assign IMM 0 ; next word is not immediate, by default %endmacro org 0x8000 ; Start 1/2 way through segment for MikeOS size EQU 65536 first EQU size & 0xffff ; 65536 or memory end for single segment 8086 stack0 EQU size - 128 ; R Stack & text input buffer jmp do_startup ; maximize use-once code that will be "forgotten" ; Nucleus / Core -- ground 0 ; Single precision (16-bit) Arithmetic operators ; CODE used extensively for speed HEADING '*' ; ( n1 n2 -- n ) mult: dw $ + 2 pop di pop ax mul di push ax NEXT HEADING '*/' ; ( n1 n2 n3 -- n ) dw $ + 2 pop di pop dx pop ax imul dx idiv di push ax NEXT HEADING '*/MOD' ; ( u1 u2 u3 -- r q ) dw $ + 2 pop di pop dx pop ax mul dx div di push dx push ax NEXT HEADING '+' ; ( n1 n2 -- n ) plus: dw $ + 2 pop dx pop ax add ax,dx push ax NEXT HEADING '-' ; ( n1 n2 -- n ) minus: dw $ + 2 pop dx pop ax sub ax,dx push ax NEXT HEADING '/' ; ( n1 n2 -- n ) divide: dw $ + 2 pop di pop ax CWD idiv di ; use di register for all divisions push ax ; so that div_0 interrupt will work NEXT HEADING '/MOD' ; ( u1 u2 -- r q ) dw $ + 2 pop di pop ax sub dx,dx div di push dx push ax NEXT HEADING '1+' ; ( n -- n+1 ) one_plus: dw $ + 2 pop ax inc ax push ax NEXT HEADING '1+!' ; ( a -- ) one_plus_store: dw $ + 2 pop di inc word [di] NEXT HEADING '1-' ; ( n -- n-1 ) one_minus: dw $ + 2 pop ax dec ax push ax NEXT HEADING '1-!' ; ( a -- ) dw $ + 2 pop di dec word [di] NEXT HEADING '2*' ; ( n -- 2n ) two_times: dw $ + 2 pop ax shl ax,1 push ax NEXT HEADING '2**' ; ( n -- 2**N ) dw $ + 2 mov ax,1 pop cx and cx,0Fh shl ax,cl push ax NEXT HEADING '2+' ; ( n -- n+2 ) two_plus: dw $ + 2 pop ax inc ax inc ax push ax NEXT HEADING '2-' ; ( n -- n-2 ) two_minus: dw $ + 2 pop ax dec ax dec ax push ax NEXT HEADING '2/' ; ( n -- n/2 ) dw $ + 2 pop ax sar ax,1 push ax NEXT HEADING '4*' ; ( n -- 4n ) dw $ + 2 pop ax shl ax,1 shl ax,1 push ax NEXT HEADING '4/' ; ( n -- n/4 ) dw $ + 2 pop ax sar ax,1 sar ax,1 push ax NEXT HEADING 'MOD' ; ( u1 u2 -- r ) dw $ + 2 pop di pop ax sub dx,dx div di push dx NEXT HEADING 'NEGATE' ; ( n -- -n ) dw $ + 2 pop ax negate1: neg ax push ax NEXT HEADING 'ABS' ; ( n -- |n| ) dw $ + 2 pop ax or ax,ax jl negate1 ; not alphabetical, allow short jump push ax NEXT ; Bit and Logical operators HEADING 'AND' ; ( n1 n2 -- n ) cfa_and: dw $ + 2 pop dx pop ax and ax,dx push ax NEXT HEADING 'COM' ; ( n -- !n >> ones complement ) dw $ + 2 pop ax not ax push ax NEXT HEADING 'LSHIFT' ; ( n c -- n<<c ) dw $ + 2 pop cx pop ax and cx,0Fh ; 16-bit word => max of 15 shifts shl ax,cl push ax NEXT HEADING 'NOT' ; ( f -- \f ) cfa_not: dw zero_eq + 2 ; similar to an alias HEADING 'OR' ; ( n1 n2 -- n ) cfa_or: dw $ + 2 pop dx pop ax or ax,dx push ax NEXT HEADING 'RSHIFT' ; ( n c -- n>>c ) dw $ + 2 pop cx pop ax and cx,0Fh sar ax,cl push ax NEXT HEADING 'XOR' ; ( n1 n2 -- n ) cfa_xor: dw $ + 2 pop dx pop ax xor ax,dx push ax NEXT ; Number comparison HEADING '0<' ; ( n -- f ) zero_less: dw $ + 2 pop cx or cx,cx do_less: mov ax,0 jge dl1 inc ax ; '79 true = 1 ; dec ax ; '83 true = -1 dl1: push ax NEXT HEADING '<' ; ( n1 n2 -- f ) less: dw $ + 2 pop dx pop cx cmp cx,dx JMP do_less HEADING '>' ; ( n1 n2 -- f ) greater: dw $ + 2 pop cx pop dx cmp cx,dx JMP do_less HEADING '0=' ; ( n -- f ) zero_eq: dw $ + 2 pop cx test0: mov ax,1 ; '79 true jcxz z2 dec ax ; 1-1 = 0 = FALSE z2: push ax NEXT HEADING '=' ; ( n1 n2 -- f ) cfa_eq: dw $ + 2 pop dx pop cx sub cx,dx JMP test0 HEADING 'MAX' ; ( n1 n2 -- n ) dw $ + 2 pop ax pop dx CMP dx,ax jge max1 xchg ax,dx max1: push dx NEXT HEADING 'MIN' ; ( n1 n2 -- n ) cfa_min: dw $ + 2 pop ax pop dx CMP ax,dx jge min1 xchg ax,dx min1: push dx NEXT HEADING 'U<' ; ( u1 u2 -- f ) u_less: dw $ + 2 sub cx,cx pop dx pop ax cmp ax,dx jnc ul1 inc cx ul1: push cx NEXT HEADING 'WITHIN' ; ( n nl nh -- f >> true if nl <= n < nh ) WITHIN: dw $ + 2 sub cx,cx ; flag, default is false pop dx ; high limit pop di ; low limit pop ax ; variable cmp ax,dx ; less than (lt) high, continue jge w1 cmp ax,di ; ge low jl w1 inc cx w1: push cx NEXT ; Memory reference, 16 bit HEADING '!' ; ( n a -- ) store: dw $ + 2 pop di pop ax stosw ; less bytes and just as fast as move NEXT HEADING '+!' ; ( n a -- ) plus_store: dw $ + 2 pop di pop ax add [di],ax NEXT HEADING '@' ; ( a -- n ) fetch: dw $ + 2 pop di push word [di] NEXT HEADING 'C!' ; ( c a -- ) c_store: dw $ + 2 pop di pop ax stosb ; less bytes and just as fast as move NEXT HEADING 'C+!' ; ( c a -- ) dw $ + 2 pop di pop ax add [di],al NEXT HEADING 'C@' ; ( a -- zxc >> zero extend ) c_fetch: dw $ + 2 pop di sub ax,ax mov al,[di] push ax NEXT HEADING 'FALSE!' ; ( a -- >> stores 0 in address ) false_store: dw $ + 2 sub ax,ax pop di stosw NEXT HEADING 'XFER' ; ( a1 a2 -- >> transfers contents of 1 to 2 ) XFER: dw $ + 2 pop dx pop di mov ax,[di] mov di,dx stosw NEXT ; 16-bit Parameter Stack operators HEADING '-ROT' ; ( n1 n2 n3 -- n3 n1 n2 ) m_ROT: dw $ + 2 pop di pop dx pop ax push di push ax push dx NEXT HEADING '?DUP' ; ( n -- 0, n n ) q_DUP: dw $ + 2 pop ax or ax,ax jz qdu1 push ax qdu1: push ax NEXT HEADING 'DROP' ; ( n -- ) DROP: dw $ + 2 pop ax NEXT HEADING 'DUP' ; ( n -- n n ) cfa_dup: dw $ + 2 pop ax push ax push ax NEXT HEADING 'OVER' ; ( n1 n2 -- n1 n2 n1 ) OVER: dw $ + 2 mov di,sp push word [di+2] NEXT HEADING 'PICK' ; ( ... n1 c -- ... nc ) PICK: dw $ + 2 pop di dec di shl di,1 add di,sp push word [di] NEXT HEADING 'ROT' ; ( n1 n2 n3 -- n2 n3 n1 ) ROT: dw $ + 2 pop di pop dx pop ax push dx push di push ax NEXT ; Note: 'push sp' results vary by processor HEADING 'SP@' ; ( -- a ) sp_fetch: dw $ + 2 mov ax,sp push ax NEXT HEADING 'SWAP' ; ( n1 n2 -- n2 n1 ) SWAP: dw $ + 2 pop dx pop ax push dx push ax NEXT ; Return stack manipulation HEADING 'I' ; ( -- n >> [RP] ) eye: dw $ + 2 mov ax,[bp+0] push ax NEXT HEADING "I'" ; ( -- n >> [RP+2] ) eye_prime: dw $ + 2 mov ax,[bp+2] push ax NEXT HEADING 'J' ; ( -- n >> [RP+4] ) dw $ + 2 mov ax,[bp+4] push ax NEXT HEADING "J'" ; ( -- n >> [RP+6] ) dw $ + 2 mov ax,[bp+6] push ax NEXT HEADING 'K' ; ( -- n >> [RP+8] ) dw $ + 2 mov ax,[bp+8] push ax NEXT HEADING '>R' ; ( n -- >> S stack to R stack ) to_r: dw $ + 2 pop ax RPUSH ax NEXT HEADING 'R>' ; ( -- n >> R stack to S stack ) r_from: dw $ + 2 RPOP ax push ax NEXT ; Constant replacements ; CONSTANT takes 66 cycles (8086) to execute HEADING '0' ; ( -- 0 ) zero: dw $ + 2 xor ax,ax push ax NEXT HEADING '1' ; ( -- 1 ) one: dw $ + 2 mov ax,1 push ax NEXT HEADING 'FALSE' ; ( -- 0 ) dw zero + 2 HEADING 'TRUE' ; ( -- t ) truu: dw $ + 2 mov ax,1 ; '79 value push ax NEXT ; 32-bit (double cell) - standard option HEADING '2!' ; ( d a -- ) two_store: dw $ + 2 pop di pop dx ; TOS = high word pop ax ; variable low address => low word stosw mov ax,dx stosw NEXT HEADING '2>R' ; ( n n -- >> transfer to R stack ) two_to_r: dw $ + 2 pop ax pop dx RPUSH dx RPUSH ax NEXT HEADING '2@' ; ( a -- d ) two_fetch: dw $ + 2 pop di push word [di] ; low variable address => low word push word [di+2] ; low param stack address (TOS) => high word NEXT HEADING '2DROP' ; ( d -- ) two_drop: dw $ + 2 pop ax pop ax NEXT HEADING '2DUP' ; ( d -- d d ) two_dup: dw $ + 2 pop dx pop ax push ax push dx push ax push dx NEXT HEADING '2OVER' ; ( d1 d2 -- d1 d2 d1 ) two_over: dw $ + 2 mov di,sp push word [di+6] push word [di+4] NEXT HEADING '2R>' ; ( -- n1 n2 ) two_r_from: dw $ + 2 RPOP ax RPOP dx push dx push ax NEXT HEADING '2SWAP' ; ( d1 d2 -- d2 d1 ) two_swap: dw $ + 2 pop dx pop di pop ax pop cx push di push dx push cx push ax NEXT HEADING 'D+' ; ( d1 d2 -- d ) d_plus: dw $ + 2 pop dx pop ax dplus: mov di,sp add [di+2],ax adc [di],dx NEXT HEADING 'D+!' ; ( d a -- ) dw $ + 2 pop di pop dx pop ax add [di+2],ax adc [di],dx NEXT HEADING 'D-' ; ( d1 d2 -- d ) d_minus: dw $ + 2 pop cx pop di pop ax pop dx sub dx,di sbb ax,cx push dx push ax NEXT HEADING 'D0=' ; ( d -- f ) d_zero_eq: dw $ + 2 pop ax pop dx sub cx,cx or ax,dx jnz dz1 inc cx ; 1, F79 ; dec cx ; -1, F83 dz1: push cx NEXT HEADING 'DNEGATE' ; ( d -- -d ) DNEGATE: dw $ + 2 pop dx pop ax neg ax adc dx,0 neg dx push ax push dx NEXT HEADING 'S>D' ; ( n -- d ) s_to_d: dw $ + 2 pop ax CWD push ax push dx NEXT HEADING 'M*' ; ( n1 n2 -- d ) dw $ + 2 pop ax pop dx imul dx push ax push dx NEXT HEADING 'M+' ; ( d1 n -- d ) dw $ + 2 pop ax CWD jmp dplus HEADING 'M/' ; ( d n1 -- n ) dw $ + 2 pop di pop dx pop ax idiv di push ax NEXT HEADING 'U*' ; ( u1 u2 -- d ) dw $ + 2 pop ax pop dx mul dx push ax push dx NEXT HEADING 'U/MOD' ; ( d u -- r q ) dw $ + 2 pop di pop dx pop ax div di push dx push ax NEXT ; Long Structures - more efficient code, but extra byte ; These use a stored address rather than a byte offset do_branch: dw $ + 2 branch: lodsw ; ax = goto address mov si,ax ; XP = goto NEXT ; jump on opposite condition, ie NE IF compiles JE q_branch: dw $ + 2 ; ( f -- ) pop ax or ax,ax je branch ; ignore conditional execution if flag false no_branch: inc si ; bypass jump address inc si NEXT ; and then execute conditional words do_loop: dw $ + 2 mov cx,1 ; normal increment lp1: add cx,[bp+0] ; update counter mov [bp+0],cx ; save for next round cmp cx,[bp+2] ; (signed, Forth-79) compare to limit jl branch ; not at end of loop count, go again lp2: add bp,4 ; at end, drop cntr & limit from R stack inc si ; skip jump/loop address & continue inc si NEXT plus_loop: dw $ + 2 ; ( n -- ) pop cx JMP lp1 slant_loop: dw $ + 2 ; ( n -- ) pop dx add [bp+0],dx ; (Forth-83) crossed boundary from below? mov ax,[bp+0] sub ax,[bp+2] xor ax,dx jge lp2 ; end of loop, exit jmp branch ; no, branch back to loop beginning c_switch: dw $ + 2 ; ( xx c.input -- xx | xx c.input ) pop dx RPUSH si ADD si,4 sub cx,cx c_s1: ; BEGIN lodsw ; inc si, get address of byte mov di,ax MOV cl,[di] ; byte to match lodsw ; inc si, get possible link CMP dl,cl je c_s3 ; input match this entry ? CMP ax,0 ; WHILE not last link = 0 jz c_s2 mov si,ax JMP c_s1 ; REPEAT, try next entry c_s2: push dx ; no matches c_s3: NEXT do_switch: dw $ + 2 ; ( xx n.input -- xx | xx n.input ) pop dx ; switch input RPUSH si ADD si,4 ; skip forth branch sw1: lodsw MOV cx,ax ; number to match lodsw ; increment I; get possible link CMP dx,cx je sw3 ; input match this entry CMP ax,0 je sw2 mov si,ax JMP sw1 ; try next entry sw2: push dx ; no matches sw3: NEXT ; Runtime for literals bite: dw $ + 2 lodsb ; get data byte cbw ; sign extend to word push ax NEXT cell: dw $ + 2 ; code def with no header/ only cfa. lodsw ; used by literal push ax ; push data word on param stack NEXT dclit: dw $ + 2 ; ( -- sxc1 sxc2 ) lodsb ; get first byte cbw push ax lodsb ; get second byte cbw push ax NEXT dblwd: dw $ + 2 ; ( -- d ) lodsw mov dx,ax ; low address => high word when inline lodsw push ax push dx ; lower stack address (TOS) => high word NEXT ; Program execution HEADING 'EXECUTE' EXECUTE: dw $ + 2 pop di ; ( cfa -- >> runtime ) exec1: or di,di jz e001 ; no address was given, cannot be 0 jmp [di] e001: NEXT HEADING '@EXECUTE' @EXECUTE: dw $ + 2 pop di ; ( a -- >> runtime ) mov di,[di] JMP exec1 HEADING 'EXIT' ; LFA + NFA EXIT: dw $ + 2 ; CFA exit1: ; R = BP, return stack pointer ( PFA ) RPOP si NEXT HEADING 'LEAVE-EXIT' leave_exit: dw $ + 2 add bp,4 ; 2RDROP - count & limit jmp exit1 HEADING '2LEAVE-EXIT' dw $ + 2 add bp,8 ; 4RDROP - both counts & limits jmp exit1 HEADING 'LEAVE' leave_lp: dw $ + 2 mov ax,[bp+0] ; next test will => done, count = limit mov [bp+2],ax NEXT HEADING 'STAY' ; ( f -- >> exit if false ) STAY: dw $ + 2 pop ax or ax,ax jz exit1 NEXT ; Defining words -- define & execution HEADING ':' dw colon dw cfa_create, r_bracket dw sem_cod ; sets CFA of daughter to 'colon' colon: inc di ; cfa -> pfa inc di RPUSH si ; rpush si = execute ptr => current pfa mov si,di ; exec ptr = new pfa NEXT ; Note - word copies input to here + 2, in case of a new definition HEADING 'CREATE' cfa_create dw colon ; ( -- ) dw blnk, cfa_word, cfa_dup ; word adr = string adr = na dw c_fetch, cfa_dup ; ( na count count ) dw zero_eq, abortq db ct001 - $ - 1 db 'No name' ct001: dw bite ; ( na count ) db 31 dw greater, abortq db ct002 - $ - 1 db 'Name too long!' ct002: dw CURRENT, c_fetch, HASH, FIND_WD ; ( na v -- na lfa,0 ) dw q_DUP, q_branch ; IF name exists in current vocab, dw ct005 ; print redefinition 'warning' dw CR, OVER, COUNT, cfa_type dw dotq db ct003 - $ - 1 db ' Redefinition of: ' ct003: dw cfa_dup, id_dot, dotq db ct004 - $ - 1 db 'at ' ct004: dw u_dot ct005: ; THEN dw CURRENT, c_fetch, HASH ; ( na link ) dw HEADS, plus, HERE ; ( nfa hdx lfa=here ) dw cfa_dup, LAST, store ; ( nfa hdx lfa ) dw OVER, fetch, comma ; set link field dw SWAP, store ; update heads dw c_fetch ; ( count ) dw one_plus, ALLOT ; allot name and count/flags dw SMUDGE dw zero, comma ; code field = 0, ;code will update dw sem_cod create: ; ( -- pfa ) inc di ; cfa -> pfa inc di push di ; standard def => leave pfa on stack NEXT does: RPUSH si ; rpush current (word uses parent) execute ptr pop si ; get new (parent) execute ptr inc di ; daughter cfa -> pfa inc di push di ; leave daughter pfa on stack NEXT HEADING 'CONSTANT' cfa_constant: dw colon ; ( n -- >> compile time ) dw cfa_create, comma dw UNSMUDGE, sem_cod constant: ; ( -- n >> run time ) push word [di+2] NEXT HEADING '2CONSTANT' dw colon ; ( d -- ) dw SWAP, cfa_constant dw comma, sem_cod two_con: ; ( -- d ) push word [di+2] push word [di+4] NEXT ; System-wide constants HEADING '0.' ; ( -- 0 0 >> code def is alternative ) zero_dot: dw two_con dw 0, 0 HEADING '1.' dw two_con dw 1, 0 HEADING '2' two: dw constant, 2 HEADING 'BL' blnk: dw constant, spc ; <space> B_HDR: dw constant ; bytes in header, ie, hash lists * 2 dw 32 ; see HEADS and FENCE L_WIDTH: dw constant dw 80 HEADING 'S0' SP0: dw constant, stack0 ; String, text operators HEADING '-TEXT' ; ( a1 n a2 -- f,t=different ) dw $ + 2 pop di pop cx pop ax xchg ax,si REP CMPSB je txt1 mov cx,1 jnc txt1 neg cx txt1: push cx mov si,ax NEXT HEADING '-TRAILING' ; ( a n -- a n' ) m_TRAILING: dw $ + 2 pop cx pop di push di jcxz trl1 mov al,' ' add di,cx dec di STD REP scasb cld je trl1 inc cx trl1: push cx NEXT HEADING '<CMOVE' ; ( s d n -- ) backwards_cmove: dw $ + 2 pop cx pop di pop ax jcxz bmv1 xchg ax,si add di,cx dec di add si,cx dec si STD REP movsb cld mov si,ax bmv1: NEXT HEADING 'CMOVE' ; ( s d n -- ) front_cmove: dw $ + 2 pop cx ; count pop di pop ax xchg ax,si rep movsb mov si,ax NEXT HEADING 'COUNT' ; ( a -- a+1 n ) COUNT: dw $ + 2 pop di sub ax,ax mov al,[di] inc di push di push ax NEXT ; Memory fills HEADING 'FILL' ; ( a n c -- ) dw $ + 2 pop ax mem_fill: pop cx pop di REP stosb NEXT HEADING 'BLANK' ; ( a n -- ) BLANK: dw $ + 2 mov al,' ' JMP mem_fill HEADING 'ERASE' ; ( a n -- ) ERASE: dw $ + 2 sub ax,ax JMP mem_fill ; Intersegment data moves HEADING 'L!' ; ( n seg off -- ) dw $ + 2 pop di pop ds pop ax mov [di],ax mov dx,cs mov ds,dx NEXT HEADING 'L@' ; ( seg off -- n ) dw $ + 2 pop di pop ds mov ax,[di] mov dx,cs mov ds,dx push ax NEXT HEADING 'LC!' ; ( c seg off -- ) dw $ + 2 pop di pop ds pop ax mov [di],al mov dx,cs mov ds,dx NEXT HEADING 'LC@' ; ( seg off -- c >> zero extended byte ) dw $ + 2 pop di pop ds sub ax,ax mov al,[di] mov dx,cs mov ds,dx push ax NEXT HEADING 'FORTHSEG' ; ( -- seg ) FORTHSEG: dw $ + 2 ; not a constant in a PC system push cs ; changes each time the program is run NEXT HEADING 'STACKSEG' ; ( -- seg ) dw $ + 2 mov ax,cs ; 64K (4K segs) above FORTHSEG add ax,4096 push ax NEXT HEADING 'FIRSTSEG' ; ( -- seg ) dw $ + 2 mov ax,cs ; 128K (8K segs) above FORTHSEG, 64k above stack/buffer seg add ax,8192 push ax NEXT HEADING 'SEGMOVE' ; ( fs fa ts ta #byte -- ) dw $ + 2 pop cx pop di pop es pop ax pop ds xchg ax,si shr cx,1 jcxz segmv1 REP MOVSw segmv1: jnc segmv2 movsb segmv2: mov dx,cs mov ds,dx mov es,dx mov si,ax NEXT ; Miscellaneous Stuff HEADING '><' ; ( n -- n' >> bytes interchanged ) dw $ + 2 pop ax xchg al,ah push ax NEXT HEADING '+@' ; ( a1 a2 -- n ) plus_fetch: dw $ + 2 pop ax pop di add di,ax push word [di] NEXT HEADING '@+' ; ( n1 a -- n ) fetch_plus: dw $ + 2 pop di pop ax add ax,[di] push ax NEXT HEADING '@-' ; ( n1 a -- n ) fetch_minus: dw $ + 2 pop di pop ax sub ax,[di] push ax NEXT HEADING 'CFA' ; ( pfa -- cfa ) CFA: dw two_minus + 2 ; similar to an alias HEADING '>BODY' ; ( cfa -- pfa ) to_body: dw two_plus + 2 ; similar to an alias HEADING 'L>CFA' ; ( lfa -- cfa ) l_to_cfa: dw $ + 2 pop di inc di inc di mov al,[di] AND ax,1Fh ; count only, no flags such as immediate add di,ax inc di push di NEXT HEADING 'L>NFA' ; ( lfa -- nfa ) l_to_nfa: dw two_plus + 2 HEADING 'L>PFA' ; ( lfa -- pfa ) dw colon dw l_to_cfa, to_body, EXIT ; 15-bit Square Root of a 31-bit integer HEADING 'SQRT' ; ( d -- n ) dw $ + 2 pop dx pop ax push si sub di,di mov si,di mov cx,16 lr1: shl ax,1 rcl dx,1 rcl si,1 shl ax,1 rcl dx,1 rcl si,1 shl di,1 shl di,1 inc di CMP si,di jc lr2 sub si,di inc di lr2: shr di,1 LOOP lr1 pop si push di NEXT ; Start Colon Definitions -- non-defining words ; Best for FORTH compiler to create defining words first -- minimizes forward references ; Most of these are used in the base dictionary HEADING 'D<' ; ( d1 d2 -- f ) d_less: dw colon ; CFA dw d_minus ; PFA dw zero_less, SWAP, DROP dw EXIT ; semicolon HEADING 'D=' ; ( d1 d2 -- f ) dw colon dw d_minus dw d_zero_eq dw EXIT HEADING 'DABS' ; ( d -- |d| ) DABS: dw colon dw cfa_dup, zero_less, q_branch ; IF <0 THEN NEGATE dw dab1 dw DNEGATE dab1: dw EXIT HEADING 'DMAX' ; ( d1 d2 -- d ) dw colon dw two_over, two_over, d_less dw q_branch ; IF 1st < THEN SWAP dw dmax1 dw two_swap dmax1: dw two_drop dw EXIT HEADING 'DMIN' ; ( d1 d2 -- d ) DMIN: dw colon dw two_over, two_over, d_less dw zero_eq, q_branch ; IF 1st >= THEN SWAP dw dmin1 dw two_swap dmin1: dw two_drop dw EXIT HEADING '-LEADING' ; ( addr cnt -- addr' cnt' ) m_LEADING: dw colon dw cfa_dup, zero, two_to_r mld1: dw OVER, c_fetch, blnk dw cfa_eq, q_branch ; IF leading = space dw mld2 dw SWAP, one_plus dw SWAP, one_minus, do_branch dw mld3 mld2: dw leave_lp mld3: dw do_loop dw mld1 dw EXIT HEADING '0>' ; ( n -- f ) zero_greater: dw colon dw zero, greater dw EXIT HEADING '3DUP' ; ( n1 n2 n3 -- n1 n2 n3 n1 n2 n3 ) three_dup: dw colon dw cfa_dup, two_over, ROT dw EXIT HEADING 'ROLL' ; ( ... c -- ... ) dw colon dw two_times, to_r, sp_fetch dw eye, two_minus, plus_fetch dw sp_fetch, cfa_dup, two_plus dw r_from, backwards_cmove, DROP dw EXIT HEADING 'T*' ; ( d n -- t ) tr_times: dw $ + 2 mov [bp-2],si ; save thread pointer above 'R' mov [bp-4],bx ; save user pointer - in case implemented pop bx ; n pop si ; d hi pop di ; d lo mov ax,di mul bx ; n * lo push ax ; bottom (lo) of tripple result mov cx,dx mov ax,si mul bx ; n * hi add cx,ax ; middle terms adc dx,0 or si,si jge tt1 ; correct unsigned mul by n sub dx,bx tt1: or bx,bx jge tt2 ; correct unsigned mul by d sub cx,di sbb dx,si tt2: push cx ; result mid push dx ; result hi mov bx,[bp-4] ; restore registers mov si,[bp-2] NEXT HEADING 'T/' ; ( t n -- d ) tr_div: dw $ + 2 pop di ; n pop dx ; hi pop ax ; med pop cx ; lo push si sub si,si or di,di jge td11 neg di ; |n| inc si td11: or dx,dx jge td12 dec si ; poor man's negate neg cx ; |t| adc ax,0 adc dx,0 neg ax adc dx,0 neg dx td12: div di xchg ax,cx div di or si,si ; sign of results jz td13 ; 0 or 2 negatives => positive neg ax ; dnegate adc cx,0 neg cx td13: pop si push ax push cx NEXT HEADING 'M*/' ; ( d1 n1 n2 -- d ) dw colon dw to_r, tr_times, r_from, tr_div dw EXIT ; No User variables -- all treated as normal variables for single user system HEADING 'SPAN' ; actual # chrs rcvd. SPAN: dw create ; Normal variable span1: dw 0 HEADING 'TIB' ; Text input starts at top of parameter stack TIB: dw create tib1: dw stack0 HEADING '#TIB' num_tib: dw create n_tib1: dw 0 HEADING 'T_FLG' ; serial transmit flags dw create ; cvariable tflg1: db 0 HEADING 'R_FLG' ; serial receive flags rcv_flg: dw create ; cvariable rflg1: db 0 ; User / System variables HEADING 'CONTEXT' ; ( -- a >> 2variable ) CONTEXT: dw create dw VOC, 0 HEADING 'CURRENT' ; ( -- a >> 2variable ) CURRENT: dw create dw VOC, 0 ; Kept variable storage together to make PROTECT and EMPTY easier HEADING 'HEADS' HEADS: dw create ; 'Links to remember' hds: times 16 dw 0 h1: dw very_end last1: dw 0 ; LFA of last word defined HEADING 'FENCE' FENCE: dw create ; GOLDEN (protected) links: times 16 dw 0 goldh: dw addr_end goldl: dw GOLDEN_LAST ; Now setup access to array elements as a variable HEADING 'H' H: dw constant dw h1 HEADING 'LAST' LAST: dw constant dw last1 HEADING 'BUF0' ; only disk buffer(s), for now BUF0: dw create buf0a: times 1024 db spc ; currently in FORTH seg HEADING 'BUF1' ; break buffer into 2 pieces for IBM dw constant dw BUF0 + 512 + 2 HEADING 'PATH' PATH: dw create path1: db 'a:\' ; drive path2: times 62 db spc ; path db 0 HEADING 'FNAME' FNAME: dw create fname1: times 64 db spc ; name db 0 HEADING "'ABORT" dw create abrt_ptr: dw QUT1 HEADING 'BASE' BASE: dw create base1: dw 10 ; decimal T_BASE: dw create ; headerless variable t_ba: dw 10 HEADING '>IN' tin: dw create tin1: dw 0 hndl1: dw 0 ; temporary store before transfer to handle ; used like BLK in normal systems ; minimum value should be 5, max = FILES - 1 qend1: dw 0 ; at end of file for loading HEADING 'STATE' STATE: dw create state1: dw 0 HEADING 'HLD' HLD: dw create hld1 dw 0 HEADING 'RMD' RMD: dw create dw 0 HEADING 'ROWS' dw create max_rows: dw 0 ; Include stored interrupt vector(s) for convenience HEADING 'LINES' dw create max_col: dw 0 _mode: dw 0 ; video setup information _page: dw 0 d_off: dw 0 ; save divide 0 vector here d_seg: dw 0 sp_save: dw 0 ; save original SP ss_save: dw 0 HEADING 'D_VER' ; DOS version for .com generate D_VER: dw create dver1: dw 0 HEADING 'ABORT' ABORT: dw $ + 2 ; ( x ... x -- ) abrt: MOV sp,stack0 ; clear parameter stack mov ax,[base1] ; reset temporary base to current mov [t_ba],ax sub ax,ax ; mark disk file as ended mov [qend1],ax push ax ; for parameter stack underflow MOV si,[abrt_ptr] ; goto 'quit' NEXT HEADING 'SYSTEM' SYSTEM: dw $ + 2 push es mov cx,[d_seg] ; restore div 0 vector mov dx,[d_off] xor ax,ax ; interrupt segment and address of vector 0 mov es,ax mov di,ax mov [es:di],dx mov [es:di+2],cx mov dx,[sp_save] mov ax,[ss_save] pop es cli ; restore original SP mov sp,dx mov ss,ax sti ret ; return to MikeOS HEADING '!CURSOR' ; ( row col -- ) dw $ + 2 pop dx pop ax mov dh,al call os_move_cursor NEXT HEADING '@CURSOR' ; ( -- row col ) get_cursor: dw $ + 2 call os_get_cursor_pos sub ax,ax mov al,dh push ax mov al,dl push ax NEXT HEADING 'CLS' ; ( -- ) CLS: dw $ + 2 call os_clear_screen NEXT ; Polled 'type' ; Bits 0-3 of T_FLG control transmission; Bit 0 => XON HEADING 'TYPE' ; ( a n -- ) cfa_type: dw $ + 2 pop cx ; character count pop di ; ds:di = data pointer push bx ; some BIOS destroy BX, DX and/or BP push bp or cx,cx ; normally 1 to 255 characters, always < 1025 jle short ty2 ; bad data or nothing to print ty1: test byte [tflg1],0Fh ; output allowed? XON-XOFF jne ty1 mov al,[di] ; get character inc di mov ah,0x0E ; print to screen, TTY mode mov bh,[_page] ; ignored on newer BIOSs mov bl,7 ; foreground, usually ignored int 10h loop ty1 ; do for input count ty2: pop bp pop bx NEXT HEADING 'EMIT' ; ( c -- ) EMIT: dw $ + 2 pop ax push bx ; some BIOS destroy BX, DX and/or BP push bp mov ah,0x0E mov bh,[_page] mov bl,7 ; foreground, usually ignored int 10h pop bp pop bx NEXT HEADING '/0' ; heading for generate dw $ + 2 div_0: ; divide zero interrupt sub ax,ax cwd mov di,1 ; 80286 will repeat division ! iret ; TERMINAL -- NON-VECTORED ; Note: buffer must be able to contain one more than expected characters. HEADING 'EXPECT' ; ( a n -- ) EXPECT: dw $ + 2 pop cx ; count pop di ; buffer address push bx ; some BIOS destroy BX, DX and/or BP push bp sub ax,ax MOV [span1],ax or cx,cx ; > 0, normally < 1025 jg exp_loop jmp exp_end exp_loop: and byte [rflg1],7Fh ; clear special, b7 xor ax,ax ; BIOS input, no echo int 16h cmp al,0 ; extended/special ? je exp1 ; yes cmp al,0xE0 jne exp2 exp1: or byte [rflg1],80h ; set special mov al,1 ; get extended scan code in al xchg al,ah jmp short exp_store ; special cannot be a control exp2: ; normal input, limited control processing TEST byte [rflg1],1 ; (b0=raw) skip test specials ? jnz exp_store CMP al,bs ; <back space> ? je exp5 CMP al,del ; <delete> ? jne exp7 exp5: TEST word [span1],7FFFh ; any chr in buffer ? jnz exp6 mov dl,bell ; echo (warning) bell jmp short exp_echo exp6: DEC word [span1] INC cx dec di test byte [rflg1],10h ; b4, echo allowed ? jnz exp10 mov bh,[_page] mov bl,7 ; foreground, usually ignored mov ax,0x0E08 ; BS int 10h mov ax,0x0E20 ; space int 10h mov ax,0x0E08 ; BS int 10h jmp short exp10 exp7: CMP al,cr ; <cr> ? jne exp9 sub cx,cx ; no more needed mov dl,' ' ; echo space jmp short exp_echo exp9: cmp al,lf ; <lf> ? jne exp_store mov al,' ' ; echo & store space exp_store: mov dl,al ; echo input stosb INC word [span1] DEC cx exp_echo: test byte [rflg1],10h ; b4, echo allowed ? jnz exp10 mov al,dl mov ah,0x0E ; send to monitor mov bh,[_page] mov bl,7 ; foreground, usually ignored int 10h exp10: jcxz exp_end jmp exp_loop exp_end: sub ax,ax ; end input marker stosb pop bp pop bx NEXT HEADING 'KEY' ; ( -- c >> high byte = end marker = 0 ) KEY: dw colon dw rcv_flg, c_fetch, cfa_dup, one, cfa_or, rcv_flg, c_store ; set special dw zero, sp_fetch, one, EXPECT ; ( rflg c ) dw rcv_flg, c_fetch, bite db 80h dw cfa_and, ROT, cfa_or ; extended receive & dw rcv_flg, c_store ; echo flag maintained dw EXIT cfa_msg: dw colon dw cfa_create, UNSMUDGE, sem_cod msg: db 232 ; call pushes execute PFA on parameter stack dw does - $ - 2 dw COUNT, cfa_type dw EXIT ; Generic CRT Terminal HEADING 'BELL' BELL: dw msg db 1, bell HEADING 'CR' CR: dw msg db 2, cr, lf HEADING 'OK' OK: dw msg db 2, 'ok' HEADING 'SPACE' SPACE: dw msg db 1, ' ' HEADING 'SPACES' ; ( n -- >> n=0 to 32767 ) SPACES: dw colon dw cfa_dup, zero_greater, q_branch ; IF number positive dw sp2 dw cfa_dup, zero, two_to_r sp1: dw SPACE, do_loop dw sp1 sp2: dw DROP dw EXIT HEADING 'HERE' ; ( -- h ) HERE: dw $ + 2 PUSH word [h1] NEXT h_p_2: dw colon ; ( -- h+2 ) dw HERE, two_plus dw EXIT HEADING 'PAD' ; ( -- a >> a=here+34, assumes full header ) PAD: dw $ + 2 mov ax,[h1] ADD ax,34 ; max NFA size + LFA push ax NEXT ; Pictured Number output HEADING 'HOLD' ; ( n -- ) HOLD: dw $ + 2 DEC word [hld1] MOV di,[hld1] pop ax stosb NEXT dgt1: dw $ + 2 ; ( d -- d' c ) pop ax pop cx sub dx,dx mov di,[base1] ; no overflow should be possible DIV di ; just in case base cleared xchg ax,cx DIV di push ax push cx CMP dl,10 ; dx = Rmd: 0 to Base jc dgt2 ; U< add dl,7 ; 'A' - '9' dgt2: add dl,'0' ; to ASCII push dx NEXT HEADING '<#' ; ( d -- d ) st_num: dw colon dw PAD, HLD, store dw EXIT HEADING '#' ; ( d -- d' ) add_num: dw colon dw dgt1, HOLD dw EXIT HEADING '#>' ; ( d -- a n ) nd_num: dw colon dw two_drop, HLD, fetch dw PAD, OVER, minus dw EXIT HEADING 'SIGN' ; ( n d -- d ) SIGN: dw colon dw ROT, zero_less, q_branch ; IF negative dw si1 dw bite db '-' dw HOLD si1: dw EXIT HEADING '#S' ; ( d -- 0 0 ) nums: dw colon nums1: dw add_num, two_dup, d_zero_eq dw q_branch ; UNTIL nothing left dw nums1 dw EXIT HEADING '(D.)' ; ( d -- a n ) paren_d: dw colon dw SWAP, OVER, DABS dw st_num, nums dw SIGN, nd_num dw EXIT HEADING 'D.R' ; ( d n -- ) d_dot_r: dw colon dw to_r, paren_d, r_from, OVER, minus, SPACES, cfa_type dw EXIT HEADING 'U.R' ; ( u n -- ) u_dot_r: dw colon dw zero, SWAP, d_dot_r dw EXIT HEADING '.R' ; ( n n -- ) dw colon dw to_r, s_to_d, r_from, d_dot_r dw EXIT HEADING 'D.' ; ( d -- ) d_dot: dw colon dw paren_d, cfa_type, SPACE dw EXIT HEADING 'U.' ; ( u -- ) u_dot: dw colon dw zero, d_dot dw EXIT HEADING '.' ; ( n -- ) dot: dw colon dw s_to_d, d_dot dw EXIT ; String output ; ( f -- a n >> return to caller if true ) ; ( f -- >> skip caller if false ) q_COUNT: dw $ + 2 MOV di,[bp+0] ; get pointer to forth stream sub ax,ax mov al,[di] inc ax ADD [bp+0],ax ; bump pointer past string pop dx or dx,dx jnz cnt_1 JMP exit1 cnt_1: dec ax ; restore count inc di ; get address push di push ax NEXT ; ( f -- >> return to caller if false ) abortq: dw colon dw q_COUNT, h_p_2, COUNT, cfa_type dw SPACE, cfa_type, CR dw ABORT dotq: dw colon dw one, q_COUNT, cfa_type dw EXIT ; 32-bit Number input q_DIGIT: dw $ + 2 ; ( d a -- d a' n f ) sub dx,dx pop di ; get addr inc di ; next chr push di ; save mov al,[di] ; get this chr cmp al,58 ; chr U< '9'+ 1 jc dgt4 cmp al,65 jc bad_dgt SUB al,7 ; 'A' - '9' dgt4: SUB al,'0' jc bad_dgt CMP al,[t_ba] jnc bad_dgt cbw push ax INC dx bad_dgt: push dx NEXT D_SUM: dw $ + 2 ; ( d a n -- d' a ) pop di pop dx pop ax pop cx push dx MUL word [t_ba] xchg ax,cx MUL word [t_ba] ADD ax,di ADC cx,dx pop dx push ax push cx push dx NEXT HEADING 'CONVERT' ; ( d a -- d' a' ) CONVERT: dw colon dgt8: dw q_DIGIT, q_branch ; IF dw dgt9 dw D_SUM, HLD, one_plus_store dw do_branch dw dgt8 dgt9: dw EXIT HEADING 'NUMBER' ; ( a -- n, d ) NUMBER: dw colon dw cell, -513, HLD, store ; max length * -1 dw cfa_dup, one_plus, c_fetch, bite ; 1st chr '-' ? db '-' dw cfa_eq, cfa_dup, to_r, q_branch ; IF, save sign & pass up dw num1 dw one_plus num1: dw zero, cfa_dup, ROT ; ( 0. a' ) num2: dw CONVERT, cfa_dup, c_fetch, cfa_dup ; ( d end chr[end] ) dw dclit db 43, 48 ; chr[end] '+' to '/' dw WITHIN, SWAP, bite db 58 ; or ':' ? dw cfa_eq, cfa_or, q_branch dw num3 dw HLD, false_store, do_branch ; yes = double dw num2 num3: dw c_fetch, abortq ; word ends zero db 1,'?' dw r_from, q_branch ; IF negative, NEGATE dw num4 dw DNEGATE num4: dw HLD, fetch, zero_less, q_branch dw num5 dw RMD, store ; single = store high cell num5: dw BASE, T_BASE, XFER dw EXIT ; Floppy variables ; Do NOT support DOS functions: Delete or Rename ; This construct turns a memory location into a "variable" that fits in other definitions HEADING 'HNDL' HNDL: dw constant dw hndl1 HEADING '?END' q_END: dw constant dw qend1 HEADING 'FDSTAT' FDSTAT: dw create fdst1: dw 0 ; error flag, may be extended later HEADING 'FDWORK' FDWORK: dw create fdwk1: dw 0 ; error, handle, or count low fdwk2: dw 0 ; high word of count when applicable HEADING ".AZ" ; ( a -- ) dot_az: dw colon dw dclit ; print ASCII zero terminated string db 64, 0 dw two_to_r ; DO dp1: dw cfa_dup, c_fetch, q_DUP dw q_branch, dp2 ; IF dw EMIT, one_plus dw do_branch, dp3 ; ELSE dp2: dw leave_lp dp3: ; THEN dw do_loop, dp1 ; LOOP dw DROP dw EXIT del_lf: dw $ + 2 ; ( a n -- ) pop cx pop di mov dx,di jcxz dlf3 inc cx ; results of last comparison not checked push cx mov ax,200Ah ; ah = replacement = space, al = search = LineFeed dl001: repne scasb jcxz dlf1 mov [di-1],ah jmp dl001 dlf1: pop cx mov di,dx mov al,09 ; remove tab characters dl002: repne scasb jcxz dlf2 mov [di-1],ah jmp dl002 dlf2: cmp byte [di-1],26 ; eof marker jne dlf3 mov [di-1],ah dlf3: NEXT GET_DISK: dw colon ; ( a n -- ) dw BLANK, SPACE, ABORT ; Interpreter do_wrd01: dw $ + 2 ; ( c a n -- a=here+2 ) pop cx pop di do_wrd02: ; Entry with just ( c -- ), DI & CX set pop ax ; chr push ax push si ; execute pointer ADD di,[tin1] SUB cx,[tin1] ; number of chrs left ADD [tin1],cx ; set pointer to end of input SUB si,si ; set z flag REP scasb ; del leading chrs mov si,di ; save beginning je wrd01 ; cx = 0 = no significant chrs dec si ; back up to 1st significant chr REPne scasb jne wrd01 ; input ended in significant chr dec di ; back up to last significant chr wrd01: SUB [tin1],cx ; back pointer to end this word cmp byte [di-1],cr ; ends in <cr> ? jne wrd02 ; yes = do not include in word dec di wrd02: SUB di,si ; number chr in this word MOV cx,di MOV di,[h1] inc di inc di mov dx,di ; adr = here + 2 push cx ; save count MOV ax,cx stosb ; counted string format REP movsb ; count = 0 = do not move anything sub ax,ax ; terminate with bytes 0, 0 stosw pop cx pop si ; retrieve Forth execute pointer or cx,cx ; any chrs ? jnz wrd03 ; yes = exit WORD mov cx,[n_tib1] ; may be empty disk line cmp cx,[tin1] ; any more ? jg strm2 ; yes = try next word wrd03: pop ax ; remove test chr push dx ; set here+2 JMP exit1 STREAM: dw $ + 2 ; ( c -- c ) MOV cx,[n_tib1] mov di,[hndl1] or di,di jnz strm2 ; disk is active source MOV di,[tib1] ; text input buffer [TIB] strm1: jmp do_wrd02 ; Skip GET DISK buffer & go directly to WORD strm2: mov di, buf0a ; disk buffer mov ax,[tin1] ; still in buf0 ? cmp ax,512 jl strm1 ; yes = get next word test byte [qend1],0xff ; at end of file ? jne strm1 mov dx,512 sub ax,dx ; fix pointers mov [tin1],ax ; >IN sub cx,dx mov [n_tib1],cx ; #TIB push di ; BUF0 for do_wrd01 push cx ; n=ctr, position mov ax,di add ax,512 ; buf1 = buf0 + 512 push ax ; BUF1 for get_disk push dx ; count = 512 xchg si,ax mov cx,256 rep movsw ; move 512 bytes from buf1 to buf0 mov si,ax ; restore FORTH exec pointer NEXT ; ( c a=buf0 n=#tib a=buf1 cnt=512 ) HEADING 'WORD' ; ( c -- a ) cfa_word: dw colon dw STREAM ; will go directly to do_wrd02 dw GET_DISK ; may abort ( c a0 n ) dw do_wrd01 ; EXIT not needed ; Dictionary search HASH: ; ( na v -- na offset ) dw $ + 2 pop ax AND ax,0Fh ; must have a vocabulary (1-15) to search, v <> 0 shl ax,1 ; 2* vocab, different chains for each pop di push di ; hash = 2 * vocab + 1st char of word ADD al,[di+1] ; 1st char (not count) AND al,1Eh ; (B_HDR - 2) even, mod 32 => 16 chains push ax NEXT ; Note - no address can be less than 0100h FIND_WD: ; ( na offset -- na lfa,0 ) dw $ + 2 mov [bp-2],si ; temporary save XP - below return pop di ; chain offset pop ax ; address of counted string to match push ax ADD di, hds ; address of beginning of hash chain push di fnd1: pop di ; mov di,[di] ; get next link push di ; last link in chain = 0 or di,di jz fnd2 ; end of chain, not found inc di ; goto count/flags byte inc di MOV cx,[di] AND cx,3Fh ; count (1F) + smudge (20) mov si,ax CMP cl,[si] jne fnd1 ; wrong count, try next word inc di ; to beginning of text inc si REP CMPSB ; compare the two strings jne fnd1 ; not matched, try next word fnd2: ; exit - found or chain exhausted mov si,[bp-2] ; restore execution pointer NEXT ; LFA > 0100h (current lowest value is 0103h), can be used as "found" flag ; HEADING 'FIND' ; ( na -- cfa lfa/f if found || na 0 if not ) FIND: dw colon dw CONTEXT, two_fetch ; ( na v.d ) find1: ; BEGIN dw two_dup, d_zero_eq, cfa_not, q_branch ; WHILE, still vocab to search dw find3 dw two_dup, zero, bite db 16 dw tr_div, two_to_r, DROP, HASH, FIND_WD dw two_r_from, ROT, q_DUP dw q_branch, find2 ; IF found dw m_ROT, two_drop, SWAP, DROP dw cfa_dup, l_to_cfa, SWAP, EXIT find2: ; THEN dw do_branch ; REPEAT, not found yet dw find1 find3: dw two_drop, zero, EXIT ; not found anywhere HEADING 'DEPTH' ; ( -- n ) DEPTH: dw $ + 2 mov ax,stack0 SUB ax,sp sar ax,1 dec ax ; 0 for underflow protection push ax NEXT q_STACK: dw colon dw DEPTH, zero_less, abortq db qsk2 - $ - 1 db 'Stack Empty' qsk2: dw EXIT ; Interpreter control - notice that this is not reentrant ; uses variables - #TIB, >IN & HNDL - to manipulate input (text or disk) HEADING 'INTERPRET' INTERPRET: dw colon ntrp1: ; BEGIN dw blnk, cfa_word dw cfa_dup, c_fetch, q_branch ; WHILE - text left in input buffer dw ntrp6 dw FIND, q_DUP, q_branch ; IF found in context vocabulary, process it dw ntrp3 dw one_plus, fetch, zero_less ; Immediate flag in high byte for test dw STATE, fetch, cfa_not, cfa_or dw q_branch, nrtp2 ; IF Immediate or not compiling ( cfa ) dw EXECUTE, q_STACK, do_branch dw ntrp5 ; ELSE compiling => put into current word nrtp2: dw comma, do_branch dw ntrp5 ; THEN ntrp3: ; ELSE try a number - may abort ( na ) dw NUMBER dw STATE, fetch, q_branch ; IF compiling => put into current word dw ntrp5 dw HLD, fetch, zero_less ; IF single precision (includes byte) dw q_branch dw ntrp4 dw LITERAL, do_branch ; ELSE double precision dw ntrp5 ntrp4: dw cell, dblwd, comma, comma, comma ; COMPILE dblwd ; THEN ; THEN ntrp5: ; THEN dw do_branch, ntrp1 ; REPEAT until stream exhausted ntrp6: dw DROP, EXIT ; Exit and get more input HEADING 'QUERY' QUERY: dw colon ; get input from keyboard or disk stream dw TIB, fetch, L_WIDTH, EXPECT dw SPAN, num_tib, XFER dw zero_dot, tin, two_store dw EXIT R_RESET: dw $ + 2 MOV bp,first NEXT HEADING 'QUIT' ; ( -- ) QUIT: dw colon QUT1: dw STATE, false_store ; start by interpreting user input qt02: ; BEGIN dw R_RESET, QUERY, INTERPRET dw OK, CR dw do_branch, qt02 ; AGAIN => Endless loop ; Note no Exit needed ; Vocabulary lists HEADING 'ID.' ; ( lfa -- >> prints name of word at link addr ) id_dot: dw colon dw l_to_nfa, cfa_dup, c_fetch, bite db 1Fh dw cfa_and, zero dw two_to_r ; DO for len of word (some versions do not store whole word) id1: dw one_plus, cfa_dup, c_fetch ; ( adr chr ) dw cfa_dup, blnk, less, q_branch ; IF control character, print caret dw id2 dw dotq db 1,'^' dw bite db 64 dw plus id2: ; THEN dw EMIT dw do_loop dw id1 ; LOOP dw DROP, SPACE, SPACE dw EXIT ; Compiler HEADING 'IMMEDIATE' dw colon dw LAST, fetch, l_to_nfa dw cfa_dup, c_fetch, cell, 80h ; set bit 7 of the count-flag byte dw cfa_or, SWAP, c_store dw EXIT HEADING 'ALLOT' ; ( n -- ) ALLOT: dw colon dw SP0, OVER, HERE, plus, bite db 178 ; full head(34) + pad(80) + min stack(64) dw plus, u_less, abortq db alt3 - $ - 1 db 'Dictionary full' alt3: dw H, plus_store, EXIT HEADING 'C,' ; ( uc -- ) c_comma: dw colon dw HERE, c_store, one, ALLOT dw EXIT HEADING ',' ; ( u -- ) comma: dw colon dw HERE, store, two, ALLOT dw EXIT HEADING '?CELL' ; ( n -- n f,t=word ) q_CELL: dw colon dw cfa_dup, bite db -128 dw cell, 128 dw WITHIN, zero_eq dw EXIT IMMEDIATE HEADING 'LITERAL' ; ( n -- ) LITERAL: dw colon dw q_CELL, q_branch, lit1 ; IF dw cell, cell, comma, comma ; COMPILE cell dw do_branch, lit2 ; ELSE lit1: dw cell, bite, comma, c_comma ; COMPILE byte lit2: ; THEN dw EXIT IMMEDIATE HEADING 'COMPILE' dw colon dw blnk, cfa_word, FIND ; (cfa t || na 0) dw cfa_not, abortq db cmp1 - $ - 1 db '?' cmp1: dw LITERAL, sem_cod COMPILE: db 232 ; call executes comma (below) dw does - $ - 2 dw comma ; puts CFA of next word into dictionary dw EXIT IMMEDIATE HEADING "'" ; ( return or compile CFA as literal ) tic: dw colon dw blnk, cfa_word, FIND ; ( na 0 || cfa lfa ) dw cfa_not, abortq db 1,'?' dw STATE, fetch, STAY dw LITERAL, EXIT ; ( compiling => put in-line ) HEADING ']' ; ( -- >> set STATE for compiling ) r_bracket: dw $ + 2 mov ax,1 mov [state1],ax ; compiling NEXT IMMEDIATE HEADING '[' ; ( -- ) l_bracket: dw $ + 2 sub ax,ax mov [state1],ax ; interpreting NEXT HEADING 'SMUDGE' SMUDGE: dw colon dw LAST, fetch, l_to_nfa, cfa_dup dw c_fetch, blnk ; set bit 5 dw cfa_or, SWAP, c_store dw EXIT HEADING 'UNSMUDGE' UNSMUDGE: dw colon dw LAST, fetch, l_to_nfa, cfa_dup dw c_fetch, bite ; clear bit 5 db 0DFh dw cfa_and, SWAP, c_store dw EXIT IMMEDIATE HEADING ';' dw colon dw cell, EXIT, comma ; COMPILE EXIT dw l_bracket, UNSMUDGE dw EXIT ; Chains increase speed of compilation and ; allow multiple vocabularies without special code. ; User vocabularies can also have separate chains to keep definitions separate. ; 4 chains would be sufficient for a minimum kernel, ; but vocabularies would be limited to max. of 4 ; 8 chains => maximum of 8 vocabularies, good for small systems ; 16 chains best choice for medium to large systems and for cross compiling ; 32 chains are marginally better for larger systems, but more is not always best ; Each vocabulary = nibble size => maximum number of 7 vocabularies, ; 15 (if pre-multiply*2) ; nibble in cell => maximum search path of 4 vocabularies ; dword => 8 nibbles => 8 search vocabularies ; Note: can "seal" portion of dictionary by eliminating FORTH from search string HEADING 'VOCABULARY' ; ( d -- ) dw colon dw cfa_create, SWAP, comma, comma, UNSMUDGE, sem_cod vocabulary: db 232 ; call dw does - $ - 2 dw two_fetch, CONTEXT, two_store dw EXIT HEADING 'ASSEMBLER' ASSEMBLER: dw vocabulary, 0012h, 0 ; search order is low adr lsb to high adr msb HEADING 'EDITOR' dw vocabulary, 0013h, 0 HEADING 'FORTH' dw vocabulary, VOC, 0 ; VOC = 00000001 HEADING 'DEFINITIONS' dw colon dw CONTEXT, two_fetch, CURRENT, two_store dw EXIT HEADING ';code' sem_cod: dw colon dw r_from dw LAST, fetch, l_to_cfa, store dw EXIT IMMEDIATE HEADING ';CODE' dw colon dw cell, sem_cod, comma ; COMPILE ;code dw r_from, DROP, ASSEMBLER dw l_bracket, UNSMUDGE dw EXIT HEADING 'CVARIABLE' dw colon dw cfa_create, zero, c_comma, UNSMUDGE dw EXIT HEADING 'VARIABLE' VARIABLE: dw colon dw cfa_create, zero, comma, UNSMUDGE dw EXIT HEADING '2VARIABLE' dw colon dw VARIABLE, zero, comma dw EXIT IMMEDIATE HEADING 'DCLIT' ; ( c1 c2 -- ) dw colon dw cell, dclit, comma ; COMPILE dclit dw SWAP, c_comma, c_comma ; reverse bytes here instead of dw EXIT ; execution time! HEADING 'ARRAY' ; ( #bytes -- ) dw colon dw cfa_create, HERE, OVER dw ERASE, ALLOT, UNSMUDGE dw EXIT ; Compiler directives - conditionals ; Absolute [long] structures ; Short structures did not save that much space, longer execution time ; Note: the code contains 47 Forth ?branch (IF) statements ; 19 do_branch -- other conditionals such as THEN and REPEAT ; 9 normal loops, 3 /loops and 1 +loop IMMEDIATE HEADING 'IF' ; ( -- a ) cfa_if: dw colon dw cell, q_branch, comma ; COMPILE ?branch dw HERE, zero, comma dw EXIT IMMEDIATE HEADING 'THEN' ; ( a -- ) THEN: dw colon dw HERE, SWAP, store dw EXIT IMMEDIATE HEADING 'ELSE' ; ( a1 -- a2 ) dw colon dw cell, do_branch, comma ; COMPILE branch dw HERE, zero, comma dw SWAP, THEN, EXIT IMMEDIATE HEADING 'BEGIN' ; ( -- a ) dw colon dw HERE dw EXIT IMMEDIATE HEADING 'UNTIL' ; ( a -- | f -- ) dw colon dw cell, q_branch, comma ; COMPILE ?branch dw comma, EXIT IMMEDIATE HEADING 'AGAIN' ; ( a -- ) AGAIN: dw colon dw cell, do_branch, comma ; COMPILE branch dw comma, EXIT IMMEDIATE HEADING 'WHILE' dw colon dw cfa_if, SWAP dw EXIT IMMEDIATE HEADING 'REPEAT' dw colon dw AGAIN, THEN dw EXIT ; Switch Support - part 2 (compiling) IMMEDIATE HEADING 'SWITCH' dw colon dw cell, do_switch, comma ; COMPILE switch dw cell, do_branch, comma ; COMPILE branch dw HERE, cfa_dup, zero, comma dw EXIT IMMEDIATE HEADING 'C@SWITCH' dw colon dw cell, c_switch, comma ; COMPILE c_switch dw cell, do_branch, comma ; COMPILE branch dw HERE, cfa_dup, zero, comma dw EXIT IMMEDIATE HEADING '{' ; ( a1 a2 n -- a1 h[0] ) dw colon dw comma, HERE, zero dw comma, cfa_dup, two_minus, ROT dw store, r_bracket dw EXIT IMMEDIATE HEADING '}' dw colon dw cell, EXIT, comma ; COMPILE EXIT dw EXIT IMMEDIATE HEADING 'ENDSWITCH' dw colon dw DROP, THEN dw EXIT ; Compiler directives - looping IMMEDIATE HEADING 'DO' ; ( -- a ) dw colon dw cell, two_to_r, comma ; COMPILE 2>R dw HERE, EXIT IMMEDIATE HEADING 'LOOP' ; ( a -- ) dw colon dw cell, do_loop, comma ; COMPILE loop dw comma, EXIT IMMEDIATE HEADING '+LOOP' ; ( a -- ) dw colon dw cell, plus_loop, comma ; COMPILE +loop dw comma, EXIT IMMEDIATE HEADING '/LOOP' ; ( a -- ) dw colon dw cell, slant_loop, comma ; COMPILE /loop dw comma, EXIT ; Miscellaneous IMMEDIATE HEADING 'DOES>' dw colon dw cell, sem_cod, comma ; COMPILE ;code dw cell, 232, c_comma ; CALL does - leaves PFA on stack dw cell, does - 2, HERE dw minus, comma dw EXIT HEADING 'EMPTY' ; ( -- ) EMPTY: dw colon dw FENCE, HEADS, bite db 36 dw front_cmove dw EXIT ; Updates HERE and HEADS, but not LAST HEADING 'FORGET' dw colon dw blnk, cfa_word, CURRENT, c_fetch, HASH, FIND_WD ; ( na v -- na lfa,0 ) dw q_DUP, cfa_not, abortq db 1,'?' dw SWAP, DROP, cfa_dup ; (lfa lfa) dw cell, goldh, fetch dw u_less ; ( protected from deletion ) dw abortq db 5,"Can't" dw H, store ; new HERE = LFA dw H, HEADS, two_to_r ; DO for 16 chains fgt1: dw eye, fetch fgt2: ; BEGIN dw cfa_dup, HERE, u_less dw cfa_not, q_branch, fgt3 ; WHILE defined after this word, go down chain dw fetch, do_branch, fgt2 ; REPEAT fgt3: dw eye, store, two, slant_loop, fgt1 ; /LOOP update top of chain, do next dw EXIT HEADING 'PROTECT' ; ( -- ) PROTECT: dw colon dw HEADS, FENCE, bite db 36 dw front_cmove dw EXIT HEADING 'STRING' ; ( -- ) STRING: dw colon dw bite db -2 dw ALLOT, bite db '"' dw cfa_word, c_fetch, two_plus dw one_plus, ALLOT dw EXIT HEADING 'MSG' dw colon dw cfa_msg, STRING dw EXIT IMMEDIATE HEADING 'ABORT"' dw colon dw STATE, fetch, q_branch, abtq1 ; IF ( -- ) compiling dw cell, abortq, comma ; COMPILE abort" and put string into dictionary dw STRING, do_branch, abtq3 abtq1: dw bite ; ELSE ( f -- ), interpret must have flag db '"' dw cfa_word, SWAP, q_branch, abtq2 ; IF flag is true, print string and abort dw COUNT, cfa_type, ABORT dw do_branch, abtq3 abtq2: ; ELSE drop string address dw DROP abtq3: ; THEN THEN dw EXIT IMMEDIATE HEADING '."' dw colon dw STATE, fetch, q_branch, dq1 ; IF compiling dw cell, dotq, comma ; COMPILE ." and put string into dictionary dw STRING, do_branch, dq2 dq1: ; ELSE print following string dw bite db '"' dw cfa_word, COUNT, cfa_type dq2: ; THEN dw EXIT HEADING '?' ; ( a -- ) question: dw colon dw fetch, dot dw EXIT ; Set operating bases HEADING 'BASE!' ; ( n -- ) base_store: dw colon dw cfa_dup, BASE, store dw T_BASE, store dw EXIT HEADING '.BASE' ; ( -- >> print current base in decimal ) dw colon dw BASE, fetch, cfa_dup, bite db 10 dw BASE, store, dot dw BASE, store dw EXIT HEADING 'DECIMAL' DECIMAL: dw colon dw bite db 10 dw base_store dw EXIT HEADING 'HEX' HEX: dw colon dw bite db 16 dw base_store dw EXIT HEADING 'OCTAL' dw colon dw bite db 8 dw base_store dw EXIT HEADING 'BINARY' dw colon dw bite db 2 dw base_store dw EXIT IMMEDIATE HEADING '$' dw colon dw bite db 16 dw T_BASE, store dw EXIT IMMEDIATE HEADING 'Q' dw colon dw bite db 8 dw T_BASE, store dw EXIT IMMEDIATE HEADING '%' dw colon dw bite db 2 dw T_BASE, store dw EXIT IMMEDIATE HEADING '(' dw colon dw bite db ')' dw cfa_word, DROP dw EXIT ; String operators, help with Screen Editor HEADING '-MATCH' ; ( a n s n -- a t ) dw $ + 2 pop dx pop ax pop cx pop di PUSH bx push si mov bx,ax MOV al,[bx] DEC dx SUB cx,dx jle mat3 INC bx mat1: REP scasb jne mat3 ; 1st match push cx push di MOV si,bx mov cx,dx REP CMPSB je mat2 pop di ; No match pop cx JMP mat1 mat2: pop ax ; Match pop ax sub ax,ax mat3: pop si pop bx push di push ax NEXT HEADING '?PRINTABLE' ; ( c -- f,t=printable ) q_PRINTABLE: dw colon dw dclit db spc, '~'+1 dw WITHIN dw EXIT IMMEDIATE HEADING '\' dw colon dw bite db cr dw cfa_word, DROP dw EXIT ; Vocabulary lists HEADING 'H-LIST' ; ( n -- ) hlist: dw colon dw two_times, HEADS, plus_fetch ; ( list head ) dw CR hlst1: ; BEGIN dw q_DUP, q_branch, hlst3 ; WHILE dw cfa_dup, id_dot, fetch dw get_cursor, bite ; test column db 64 dw greater, q_branch, hlst2 ; IF dw CR hlst2: ; THEN dw DROP ; drop row/line dw do_branch, hlst1 ; REPEAT hlst3: dw EXIT ; Headerless, only used by WORDS below ; returns highest lfa contained in copy of HEADS at PAD MAX_HEADER: dw colon ; ( -- index max.lfa ) dw zero_dot dw B_HDR, zero, two_to_r mh1: dw cfa_dup, PAD, eye, plus_fetch dw u_less, q_branch ; ( new max lfa ) dw mh2 dw two_drop, eye, PAD dw eye, plus_fetch mh2: dw two, slant_loop dw mh1 dw EXIT HEADING 'VLIST' ; ( -- >> lists the words in the context vocabulary ) dw colon dw HEADS, PAD, B_HDR ; copy HEADS to PAD dw front_cmove, CR wds1: ; BEGIN dw MAX_HEADER, cfa_dup, q_branch ; WHILE a valid lfa exists at PAD dw wds4 dw two_dup, two_plus ; ( index lfa index nfa ) dw CONTEXT, fetch, HASH ; just first vocab dw SWAP, DROP ; ( index lfa index index' ) dw cfa_eq, q_branch ; IF in this vocab, display name dw wds2 dw cfa_dup, id_dot wds2: ; THEN dw fetch, SWAP, PAD dw plus, store ; update PAD, working header dw get_cursor, bite db 64 dw greater, q_branch ; IF near end of line, send new line dw wds3 dw CR wds3: ; THEN dw DROP, do_branch dw wds1 wds4: ; REPEAT dw two_drop dw EXIT ; Miscellaneous extensions HEADING '.S' dot_s: dw colon dw q_STACK, DEPTH, CR, q_branch ; IF dw dots2 dw sp_fetch, cell, stack0 - 4, two_to_r dots1: dw eye, fetch, u_dot, bite db -2 dw slant_loop dw dots1 dots2: dw dotq db dots3 - $ - 1 db ' <--Top ' dots3: dw EXIT HEADING 'LOWER>UPPER' ; ( k -- k' ) dw colon dw cfa_dup, dclit db 'a', 'z'+1 dw WITHIN, q_branch dw l_u1 dw blnk, minus ; if lower case ASCII clear bit 5 l_u1: dw EXIT HEADING 'R-DEPTH' dw $ + 2 MOV ax,first SUB ax,bp SHR ax,1 push ax NEXT HEADING 'R>S' dw $ + 2 MOV cx,first SUB cx,bp shr cx,1 MOV ax,cx rs1: MOV di,cx shl di,1 NEG di ADD di,first push word [di] LOOP rs1 push ax NEXT HEADING 'DUMP' ; ( a n -- ) DUMP: dw colon dw zero, two_to_r ; DO du1: dw eye, bite db 15 dw cfa_and, cfa_not, q_branch ; IF, new line dw du2 dw CR, cfa_dup, eye, plus, bite db 5 dw u_dot_r, SPACE du2: ; THEN dw eye, bite db 7 dw cfa_and, cfa_not, q_branch ; IF, 3 more spaces dw du3 dw bite db 3 dw SPACES du3: ; THEN dw cfa_dup, eye dw plus, c_fetch, bite db 4 dw u_dot_r, do_loop dw du1 ; LOOP dw CR, DROP dw EXIT HEADING 'WDUMP' ; ( a n -- ) dw colon dw zero, two_to_r wdp1: dw eye, bite db 7 dw cfa_and, cfa_not, q_branch dw wdp2 dw CR, cfa_dup, eye, two_times, plus, bite db 5 dw u_dot_r, SPACE wdp2: dw cfa_dup, eye, two_times dw plus_fetch, bite db 7 dw u_dot_r, do_loop dw wdp1 dw CR, DROP dw EXIT HEADING '.LINE' ; ( adr n -- ) dot_line: dw colon dw to_r, PAD, eye, front_cmove dw PAD, eye, zero, two_to_r dln1: dw cfa_dup, eye, plus, c_fetch, q_PRINTABLE dw cfa_not, q_branch dw dln2 dw bite db 94 dw OVER, eye, plus, c_store dln2: dw do_loop dw dln1 dw r_from, cfa_type dw EXIT HEADING 'A-DUMP' ; ( a n -- ) a_dump: dw colon dw zero, two_to_r ad1: dw eye, bite db 63 dw cfa_and, cfa_not, q_branch dw ad2 dw CR, cfa_dup, eye, plus, bite db 5 dw u_dot_r, bite db 3 dw SPACES ad2: dw cfa_dup, eye, plus, bite db 64 dw eye_prime, cfa_min, dot_line, bite db 64 dw slant_loop dw ad1 dw CR, DROP dw EXIT IMMEDIATE HEADING 'ASCII' ; ( -- n ) dw colon dw blnk, cfa_word, one_plus dw c_fetch ; ( ASCII value of next word ) dw STATE, fetch dw STAY, LITERAL dw EXIT HEADING '?MEM' ; ( -- left ) dw colon dw sp_fetch, PAD dw two_plus, minus dw EXIT msec: dw $ + 2 mov al,06 ; latch counter 0 out 43h,al in al,40h mov dl,al in al,40h mov dh,al sub dx,2366 ; (1193.2 - 10 setup)*2/msec ms1: mov al,06 ; latch counter 0 out 43h,al in al,40h mov cl,al in al,40h mov ch,al sub cx,dx cmp cx,12 ; uncertainty ja ms1 ; U> HEADING 'MS' ; ( n -- ) dw colon dw zero, two_to_r ms01: dw msec, do_loop dw ms01 dw EXIT NEXT ; End of the dictionary (lfa) that will be retained (PROTECTED) GOLDEN_LAST: ; dictionary 'protected' below this definition addr_end: ; Used for EMPTY after startup ; Initial program entry and start up code ; If startup modified, modify the GEN.4th script do_startup: mov ax,cs ; init segments mov ds,ax mov es,ax cli mov dx,sp ; save original SP mov cx,ss mov ss,ax ; init stack mov sp,stack0 sti mov [ss_save],cx mov [sp_save],dx mov ah,0Fh ; get current display mode from BIOS int 10h sub dx,dx mov dl,ah mov [max_col],dx mov dl,al mov [_mode],dx mov dl,bh mov [_page],dx push ds mov ax,40h ; BIOS data segment, ah = 0 mov ds,ax mov si,84h ; rows - 1 lodsb inc ax mov [es:max_rows],ax mov si,17h ; caps lock on (most BIOS) mov al,[si] or al,40h mov [si],al pop ds call os_get_api_version mov ah,al xor al,al mov [dver1],ax mov al,'a' ; get/save current disk mov [path1],al xor ax,ax ; set current directory mov [path2],ax push es xor ax,ax ; get current, set new div 0 vector mov es,ax ; interrupt segment and offset = 0 mov di,ax mov bx,[es:di] mov dx,[es:di+2] mov [d_off],bx mov [d_seg],dx mov bx,div_0 mov dx,ds mov [es:di],bx mov [es:di+2],dx pop es mov bp,first ; R at end of mem - see r_reset sub ax,ax ; Top of parameter stack (for underflow) push ax MOV si, start_forth ; forward reference, may be modified when new GEN.4th NEXT ; goto FORTH start, begin following pointers ; When generating a new file, VERSION may be FORGOTTEN and new created ; Set address of new start_forth in above script LAST_HERE: ; Last definition that will be 'remembered' (with a header) HEADING 'VERSION' VERSION: dw colon dw dotq db vr01 - $ - 1 db 'V1.5.1, 2011/01/15 ' vr01: dw EXIT ; Break a long, single chain of definitions into separate hash lists ; Generate can save modified dictionary for faster startup N_HASH: dw colon ; create hash lists dw PAD, B_HDR, ERASE ; temporary buffer for pointers dw cell, LAST_HERE, cfa_dup ; set last link field to VERSION dw LAST, store nh1: ; BEGIN ( lfa ) dw q_DUP, q_branch, nh05 ; WHILE not start of dictionary dw cfa_dup, fetch, SWAP dw zero, OVER, store ; set chain end, just in case dw cfa_dup, l_to_nfa, bite db VOC ; ( lfa' lfa nfa v ) dw HASH, SWAP, DROP ; ( lfa' lfa lnk ) dw cfa_dup, HEADS, plus_fetch dw cfa_not, q_branch, nh2 ; set end of normal chain IF not already dw two_dup, HEADS, plus, store nh2: ; THEN dw two_dup, FENCE, plus_fetch, cfa_not dw SWAP, cell, GOLDEN_LAST + 1 dw u_less, cfa_and dw q_branch, nh03 ; set end of GOLDEN chain IF not already dw two_dup, FENCE, plus, store nh03: ; THEN dw PAD, plus, cfa_dup, fetch ; update individual chains dw q_branch, nh04 ; IF not first, update chain ; ( lfa' lfa padx ) dw two_dup, fetch, store nh04: ; THEN dw store ; update pad buffer dw do_branch, nh1 ; REPEAT nh05: dw EXIT ; High level Start-up ; Headerless. Will be FORGOTTEN. GEN.4th must create a replacement start_forth: dw CR, CR, dotq db sf01 - $ - 1 db 'Copyright (C) 2014 MikeOS Developers -- see doc/LICENSE.TXT' sf01: dw CR, dotq db sf02 - $ - 1 db 'FORTH version ' sf02: dw VERSION dw CR, dotq db sf03 - $ - 1 db 'DOS version ' sf03: dw D_VER, one_plus, c_fetch, zero, st_num dw add_num, add_num, cell, 46, HOLD, two_drop dw D_VER, c_fetch, zero, nums, nd_num, cfa_type dw CR, PATH, dot_az dw CR, OK, CR dw N_HASH dw ABORT ; no print on abort very_end: dw 0, 0
20.979958
91
0.541776
eb28bd21b1929d8647bf7b5521c2b9525255ea02
143
asm
Assembly
libsrc/_DEVELOPMENT/math/float/math16/lm16/c/sdcc/poly_callee.asm
ahjelm/z88dk
c4de367f39a76b41f6390ceeab77737e148178fa
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/_DEVELOPMENT/math/float/math16/lm16/c/sdcc/poly_callee.asm
C-Chads/z88dk
a4141a8e51205c6414b4ae3263b633c4265778e6
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/_DEVELOPMENT/math/float/math16/lm16/c/sdcc/poly_callee.asm
C-Chads/z88dk
a4141a8e51205c6414b4ae3263b633c4265778e6
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
SECTION code_fp_math16 PUBLIC _polyf16_callee EXTERN cm16_sdcc_poly_callee defc _polyf16_callee = cm16_sdcc_poly_callee
20.428571
51
0.762238
3cee55a6f66fb232261f18a3bded1dc431496104
7,040
asm
Assembly
Transynther/x86/_processed/NC/_st_zr_sm_/i7-7700_9_0x48.log_21829_1019.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NC/_st_zr_sm_/i7-7700_9_0x48.log_21829_1019.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NC/_st_zr_sm_/i7-7700_9_0x48.log_21829_1019.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 %r15 push %rax push %rbx push %rcx push %rdi push %rsi lea addresses_D_ht+0x13ba, %rsi lea addresses_UC_ht+0x1962a, %rdi inc %r12 mov $27, %rcx rep movsl nop nop nop nop nop and %rbx, %rbx lea addresses_WC_ht+0x1c99b, %rsi lea addresses_A_ht+0x12eba, %rdi nop nop nop nop xor $61497, %r15 mov $118, %rcx rep movsw nop nop nop nop and $64635, %r12 lea addresses_A_ht+0x16ffa, %r15 nop nop nop nop and %rdi, %rdi mov (%r15), %ebx nop and %rcx, %rcx lea addresses_D_ht+0x19e23, %rcx nop nop nop nop and %rdi, %rdi vmovups (%rcx), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $0, %xmm5, %r15 nop inc %rbx lea addresses_normal_ht+0xd9ba, %rcx nop add $8475, %rdi movl $0x61626364, (%rcx) inc %r15 lea addresses_UC_ht+0x19a82, %rsi nop nop xor %rax, %rax mov $0x6162636465666768, %r12 movq %r12, %xmm3 movups %xmm3, (%rsi) add %r15, %r15 pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r15 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %r8 push %r9 push %rbx push %rdi push %rdx // Store mov $0x639a3400000009ba, %rdx nop nop nop nop nop sub $56762, %r10 movw $0x5152, (%rdx) nop nop nop and %rdi, %rdi // Store mov $0x639a3400000009ba, %r9 nop nop nop nop nop sub %rbx, %rbx mov $0x5152535455565758, %r14 movq %r14, %xmm1 vmovntdq %ymm1, (%r9) nop nop nop and $36656, %rbx // Store lea addresses_normal+0x69ba, %rdx nop nop nop xor %r10, %r10 movb $0x51, (%rdx) nop xor $62719, %rbx // Store lea addresses_normal+0x14eba, %rbx cmp %r9, %r9 mov $0x5152535455565758, %rdi movq %rdi, %xmm1 vmovups %ymm1, (%rbx) nop nop nop nop and $25234, %rdi // Store lea addresses_PSE+0x1dc7a, %r14 nop nop nop nop sub $36416, %rbx movw $0x5152, (%r14) // Exception!!! nop nop nop nop nop mov (0), %r10 nop nop nop xor $2583, %rbx // Store lea addresses_RW+0x2604, %r14 clflush (%r14) nop nop nop nop nop cmp $22390, %r8 movw $0x5152, (%r14) cmp $47102, %rdi // Faulty Load mov $0x639a3400000009ba, %r10 nop nop nop nop nop inc %rdx movb (%r10), %r8b lea oracles, %rdi and $0xff, %r8 shlq $12, %r8 mov (%rdi,%r8,1), %r8 pop %rdx pop %rdi pop %rbx pop %r9 pop %r8 pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 10, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 7, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 6, 'size': 2, 'same': False, 'NT': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 1, 'size': 2, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 9, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 6, 'size': 4, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 8, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 3, 'size': 16, 'same': False, 'NT': False}} {'00': 380, '51': 21449} 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 */
32.592593
2,999
0.654261
d8c820a91d1556b43ade042ce7a626809abff9d0
373
asm
Assembly
test/test.Array.eachq.asm
richRemer/atlatl
169c0c9c29d277dc1295e6c37b0963af6e02741a
[ "MIT" ]
null
null
null
test/test.Array.eachq.asm
richRemer/atlatl
169c0c9c29d277dc1295e6c37b0963af6e02741a
[ "MIT" ]
null
null
null
test/test.Array.eachq.asm
richRemer/atlatl
169c0c9c29d277dc1295e6c37b0963af6e02741a
[ "MIT" ]
null
null
null
global test_case extern Array.eachq extern std.outqln %include "Array.inc" section .text test_case: mov rbx, std.outqln ; function to call lea rax, [test_arr] ; array call Array.eachq ret section .data test_arr_data: dq 0x0102030405060708 test_arr: istruc Array at Array.pdata, dq test_arr_data at Array.length, dq 1 iend
16.217391
46
0.686327
506bac570d08b94811201400427fa1109c821b19
4,616
asm
Assembly
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_715.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_notsx.log_21829_715.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_notsx.log_21829_715.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 %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_UC_ht+0x11ee4, %r10 xor $1370, %rdi movups (%r10), %xmm7 vpextrq $1, %xmm7, %r11 cmp $14380, %rbp lea addresses_normal_ht+0x19ae4, %rsi lea addresses_WT_ht+0x10164, %rdi nop nop and $26473, %rbx mov $90, %rcx rep movsl nop nop add %r11, %r11 lea addresses_A_ht+0x1720f, %rcx nop sub %rbp, %rbp mov (%rcx), %r10w nop dec %r11 pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %rbp push %rbx push %rsi // Faulty Load lea addresses_RW+0x14ee4, %rbx nop nop nop nop cmp %rbp, %rbp vmovups (%rbx), %ymm1 vextracti128 $0, %ymm1, %xmm1 vpextrq $0, %xmm1, %rsi lea oracles, %r11 and $0xff, %rsi shlq $12, %rsi mov (%r11,%rsi,1), %rsi pop %rsi pop %rbx pop %rbp pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': True, 'type': 'addresses_RW'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 10, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 5, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'} {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
56.292683
2,999
0.661828
ea10d7f65fd6bf5f3f7245e8ab885c8cec686c48
14,748
asm
Assembly
Library/User/IACP/iacpUtils.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
504
2018-11-18T03:35:53.000Z
2022-03-29T01:02:51.000Z
Library/User/IACP/iacpUtils.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
96
2018-11-19T21:06:50.000Z
2022-03-06T10:26:48.000Z
Library/User/IACP/iacpUtils.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
73
2018-11-19T20:46:53.000Z
2022-03-29T00:59:26.000Z
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1992 -- All Rights Reserved PROJECT: MODULE: FILE: iacpUtils.asm AUTHOR: Adam de Boor, Oct 12, 1992 ROUTINES: Name Description ---- ----------- INT IACPLockListBlockExcl Lock the IACPListBlock for exclusive access INT IACPLockListBlockShared Lock the IACPListBlock for shared access INT IACPUnlockListBlockExcl Unlock the IACPListBlock for exclusive access INT IACPUnlockListBlockShared Unlock the IACPListBlock for shared access INT IACPLocateDocument Find a document in the registry, given its 48-bit ID INT IACPLD_callback Callback function to locate a document given its 48-bit ID. INT IACPFindServer Locate a particular server in the server array for an IACP list INT IACPFindList Locate an IACPList structure given a GeodeToken EXT IACPDuplicateALB Make a copy of the given block of memory. INT IACPDeleteConnection Delete a connection that has no more optrs in it. INT IACPDC_unlinkCallback Look for a particular connection and unlink it from its IACPList, nuking the IACPList if it has neither connections nor servers. REVISION HISTORY: Name Date Description ---- ---- ----------- Adam 10/12/92 Initial revision DESCRIPTION: Utility functions used by iacpMain.asm $Id: iacpUtils.asm,v 1.1 97/04/07 11:47:20 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IACPCommon segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IACPLockListBlockExcl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Lock the IACPListBlock for exclusive access CALLED BY: (INTERNAL) PASS: nothing RETURN: ds = locked IACPListBlock DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 10/12/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IACPLockListBlockExcl proc near uses bx, ax .enter mov bx, handle IACPListBlock call MemLockExcl mov ds, ax .leave ret IACPLockListBlockExcl endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IACPLockListBlockShared %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Lock the IACPListBlock for shared access CALLED BY: (INTERNAL) PASS: nothing RETURN: ds = locked IACPListBlock DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 10/12/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IACPLockListBlockShared proc far uses bx, ax .enter mov bx, handle IACPListBlock call MemLockShared mov ds, ax .leave ret IACPLockListBlockShared endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IACPUnlockListBlockExcl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Unlock the IACPListBlock for exclusive access CALLED BY: (INTERNAL) PASS: nothing RETURN: nothing DESTROYED: nothing (flags preserved) SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 10/12/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IACPUnlockListBlockExcl proc near uses bx .enter mov bx, handle IACPListBlock call MemUnlockExcl .leave ret IACPUnlockListBlockExcl endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IACPUnlockListBlockShared %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Unlock the IACPListBlock for shared access CALLED BY: (INTERNAL) PASS: nothing RETURN: nothing DESTROYED: nothing (flags preserved) SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 10/12/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IACPUnlockListBlockShared proc far uses bx .enter mov bx, handle IACPListBlock call MemUnlockShared .leave ret IACPUnlockListBlockShared endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IACPLocateDocument %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Find a document in the registry, given its 48-bit ID CALLED BY: (INTERNAL) IACPCheckAndLocateDocument, IACPUnregisterDocument PASS: ax = disk handle cxdx = FileID ^lbx:si = server (bx == 0 if shouldn't check server) ds = IACPListBlock RETURN: carry set if found: ax = index of IACPDocument in iacpDocArray carry clear if no such doc registered DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: inline-expands ChunkArrayEnum as there aren't enough registers passed through to perform the requisite comparison. REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 3/ 8/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IACPLocateDocument proc near uses di, bp .enter mov di, ds:[iacpDocArray] mov bp, ds:[di].CAH_count tst bp jz done add di, ds:[di].CAH_offset searchLoop: cmp ds:[di].IACPD_disk, ax jne no cmp ds:[di].IACPD_id.high, cx jne no cmp ds:[di].IACPD_id.low, dx jne no tst bx jz yes cmp ds:[di].IACPD_server.handle, bx jne no cmp ds:[di].IACPD_server.chunk, si je yes no: add di, size IACPDocument dec bp jnz searchLoop clc done: .leave ret yes: mov di, ds:[iacpDocArray] mov ax, ds:[di].CAH_count sub ax, bp ; ax <- index stc jmp done IACPLocateDocument endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IACPLD_callback %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Callback function to locate a document given its 48-bit ID. CALLED BY: (INTERNAL) IACPLocateDocument via ChunkArrayEnum PASS: ds:di = IACPDocument to check ax = disk handle cxdx = FileID bp = element # RETURN: carry set if found (stop enumerating) bp = untouched carry clear if not found (keep going) bp = element # of next one DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 3/ 8/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if (0) IACPLD_callback proc far .enter no: inc bp clc done: .leave ret IACPLD_callback endp endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IACPFindServer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Locate a particular server in the server array for an IACP list CALLED BY: (INTERNAL) IACPUnregisterServer via ChunkArrayEnum PASS: *ds:si = server array ds:di = IACPServer to check ^lcx:dx = optr of server being sought ax = element # of this entry RETURN: carry set if this is the one: ax = element # of the entry carry clear if this isn't the one: ax = element # of the next entry DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 10/12/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IACPFindServer proc far .enter cmp ds:[di].IACPS_object.handle, cx jne no cmp ds:[di].IACPS_object.chunk, dx je done no: stc inc ax done: cmc .leave ret IACPFindServer endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IACPFindList %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Locate an IACPList structure given a GeodeToken CALLED BY: (INTERNAL) PASS: es:di = GeodeToken (es:di *cannot* be pointing to the movable XIP code resource.) ds = locked IACPListBlock RETURN: carry set if found: ax = element number carry clear if list not around DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 10/12/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IACPFindList proc near uses bx, cx, dx, bp, si, di .enter if FULL_EXECUTE_IN_PLACE ; ; Make sure the fptr (es:di) passed in is valid ; EC < pushdw bxsi > EC < movdw bxsi, esdi > EC < call ECAssertValidFarPointerXIP > EC < popdw bxsi > endif mov cx, {word}es:[di].GT_chars[0] mov dx, {word}es:[di].GT_chars[2] mov bp, es:[di].GT_manufID ; ; Inline expansion of ChunkArrayEnum so we can do this in more ; than one thread at a time. ; mov di, ds:[iacpListArray] mov si, ds:[di].CAH_count add di, size ChunkArrayHeader - size IACPList mov ax, -1 findLoop: inc ax ; advance elt # dec si ; reduce elt counter jl notFound add di, size IACPList ; advance to next elt ; ; See if this IACPList is the one we want. ; cmp {word}ds:[di].IACPL_token.GT_chars[0], cx jne findLoop cmp {word}ds:[di].IACPL_token.GT_chars[2], dx jne findLoop cmp ds:[di].IACPL_token.GT_manufID, bp jne findLoop ; ; Found it. AX = element number. Set carry to indicate our happiness. ; stc done: .leave ret notFound: clc jmp done IACPFindList endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IACPDuplicateALB %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Make a copy of the given block of memory. CALLED BY: (EXTERNAL) IACPConnect PASS: bx = handle of block to duplicate RETURN: dx = old handle bx = new handle DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 10/12/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IACPDuplicateALB proc far uses ax, ds, si, di, es, cx .enter ; ; Figure the size of the block. ; mov ax, MGIT_SIZE call MemGetInfo push ax ; save for copy ; ; Allocate another the same size, locked. (XXX: pass NO_ERR flag. ; Ought to be able to handle an error more gracefully, but I have ; no time to code it -- ardeb 11/23/92) ; mov dx, bx call MemOwner push bx mov cx, ALLOC_DYNAMIC_NO_ERR_LOCK or mask HF_SHARABLE call MemAlloc mov es, ax pop ax call HandleModifyOwner ; ; Lock down the source block. ; xchg bx, dx call MemLock mov ds, ax ; ; Copy the contents from the old to the new. ; clr si, di pop cx shr cx rep movsw ; ; Unlock the old. ; call MemUnlock ; ; Unlock the new. ; xchg bx, dx call MemUnlock .leave ret IACPDuplicateALB endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IACPDeleteConnection %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Delete a connection that has no more optrs in it. CALLED BY: (INTERNAL) IACPShutdown PASS: *ds:bp = IACPConnectionStruct IACPListBlock locked for exclusive access RETURN: nothing DESTROYED: ax, cx SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 10/12/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IACPDeleteConnection proc near uses bx, si, di .enter ; ; Unlink it from the list of connections... ; mov si, offset iacpListArray mov bx, cs mov di, offset IACPDC_unlinkCallback call ChunkArrayEnum ; ; ...and free the chunk. ; mov ax, bp call LMemFree .leave ret IACPDeleteConnection endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IACPDC_unlinkCallback %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Look for a particular connection and unlink it from its IACPList, nuking the IACPList if it has neither connections nor servers. CALLED BY: (INTERNAL) IACPDeleteConnection via ChunkArrayEnum PASS: *ds:si = iacpListArray ds:di = IACPList to check bp = IACPConnection chunk RETURN: carry set if found and unlinked connection DESTROYED: ax, bx SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 10/12/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IACPDC_unlinkCallback proc far .enter ; ; ds:bx = address of link to next connection. ; lea bx, ds:[di].IACPL_connections connectionLoop: mov ax, ds:[bx] ; ax <- next connection cmp ax, bp ; this the one we're nuking? je foundLink ; yes tst ax ; end of the line? jz done ; yes -- try the next list (carry clear) ; ; Point ds:bx to the IACPCS_next field of *ds:ax and loop. ; mov_tr bx, ax mov bx, ds:[bx] CheckHack <offset IACPCS_next eq 0> jmp connectionLoop foundLink: ; ; *ds:bx points to the handle of the connection we're nuking, so ; replace it with our connection's IACPCS_next field. ; mov si, ds:[bp] mov ax, ds:[si].IACPCS_next mov ds:[bx], ax ; ; Reduce the number of connections for this list by one. ; dec ds:[di].IACPL_numConnect jnz doneStop ; ; No more connections. See if there are any more servers for the list. ; mov si, ds:[di].IACPL_servers call ChunkArrayGetCount jcxz nukeList ; => no more servers, so no more ; need for the list doneStop: ; ; Tell caller to stop enumerating. ; stc done: .leave ret nukeList: ; ; Nothing left for the list, so nuke the array of servers, then the ; IACPList structure itself. ; mov_tr ax, si ; ax <- servers array call LMemFree mov si, offset iacpListArray call ChunkArrayDelete jmp doneStop IACPDC_unlinkCallback endp IACPCommon ends
23.672552
79
0.551465
44b05a34962d03dd57822b9bfb6ce5c4b78ac70d
197
asm
Assembly
libsrc/_DEVELOPMENT/math/float/math32/lm32/c/sccz80/modf.asm
Frodevan/z88dk
f27af9fe840ff995c63c80a73673ba7ee33fffac
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/_DEVELOPMENT/math/float/math32/lm32/c/sccz80/modf.asm
Frodevan/z88dk
f27af9fe840ff995c63c80a73673ba7ee33fffac
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/_DEVELOPMENT/math/float/math32/lm32/c/sccz80/modf.asm
Frodevan/z88dk
f27af9fe840ff995c63c80a73673ba7ee33fffac
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
SECTION code_fp_math32 PUBLIC modf EXTERN cm32_sccz80_modf defc modf = cm32_sccz80_modf ; SDCC bridge for Classic IF __CLASSIC PUBLIC _modf EXTERN _m32_modff defc _modf = _m32_modff ENDIF
12.3125
29
0.807107
66e24b354fe1494bc21735c3c0f11e425f477fe5
42,434
asm
Assembly
user/cat.asm
Grapefruitcc/xv6-riscv-fall19
6a3bb66142d1d946f8089b9cd4ebbd347c7c089a
[ "MIT-0" ]
1
2021-05-26T06:35:54.000Z
2021-05-26T06:35:54.000Z
user/cat.asm
Grapefruitcc/xv6-riscv-fall19
6a3bb66142d1d946f8089b9cd4ebbd347c7c089a
[ "MIT-0" ]
null
null
null
user/cat.asm
Grapefruitcc/xv6-riscv-fall19
6a3bb66142d1d946f8089b9cd4ebbd347c7c089a
[ "MIT-0" ]
null
null
null
user/_cat: file format elf64-littleriscv Disassembly of section .text: 0000000000000000 <cat>: char buf[512]; void cat(int fd) { 0: 7179 addi sp,sp,-48 2: f406 sd ra,40(sp) 4: f022 sd s0,32(sp) 6: ec26 sd s1,24(sp) 8: e84a sd s2,16(sp) a: e44e sd s3,8(sp) c: 1800 addi s0,sp,48 e: 89aa mv s3,a0 int n; while((n = read(fd, buf, sizeof(buf))) > 0) { 10: 00001917 auipc s2,0x1 14: 91090913 addi s2,s2,-1776 # 920 <buf> 18: 20000613 li a2,512 1c: 85ca mv a1,s2 1e: 854e mv a0,s3 20: 00000097 auipc ra,0x0 24: 37e080e7 jalr 894(ra) # 39e <read> 28: 84aa mv s1,a0 2a: 02a05863 blez a0,5a <cat+0x5a> if (write(1, buf, n) != n) { 2e: 8626 mv a2,s1 30: 85ca mv a1,s2 32: 4505 li a0,1 34: 00000097 auipc ra,0x0 38: 372080e7 jalr 882(ra) # 3a6 <write> 3c: fc950ee3 beq a0,s1,18 <cat+0x18> printf("cat: write error\n"); 40: 00001517 auipc a0,0x1 44: 87050513 addi a0,a0,-1936 # 8b0 <malloc+0xec> 48: 00000097 auipc ra,0x0 4c: 6be080e7 jalr 1726(ra) # 706 <printf> exit(1); 50: 4505 li a0,1 52: 00000097 auipc ra,0x0 56: 334080e7 jalr 820(ra) # 386 <exit> } } if(n < 0){ 5a: 00054963 bltz a0,6c <cat+0x6c> printf("cat: read error\n"); exit(1); } } 5e: 70a2 ld ra,40(sp) 60: 7402 ld s0,32(sp) 62: 64e2 ld s1,24(sp) 64: 6942 ld s2,16(sp) 66: 69a2 ld s3,8(sp) 68: 6145 addi sp,sp,48 6a: 8082 ret printf("cat: read error\n"); 6c: 00001517 auipc a0,0x1 70: 85c50513 addi a0,a0,-1956 # 8c8 <malloc+0x104> 74: 00000097 auipc ra,0x0 78: 692080e7 jalr 1682(ra) # 706 <printf> exit(1); 7c: 4505 li a0,1 7e: 00000097 auipc ra,0x0 82: 308080e7 jalr 776(ra) # 386 <exit> 0000000000000086 <main>: int main(int argc, char *argv[]) { 86: 7179 addi sp,sp,-48 88: f406 sd ra,40(sp) 8a: f022 sd s0,32(sp) 8c: ec26 sd s1,24(sp) 8e: e84a sd s2,16(sp) 90: e44e sd s3,8(sp) 92: e052 sd s4,0(sp) 94: 1800 addi s0,sp,48 int fd, i; if(argc <= 1){ 96: 4785 li a5,1 98: 04a7d763 bge a5,a0,e6 <main+0x60> 9c: 00858913 addi s2,a1,8 a0: ffe5099b addiw s3,a0,-2 a4: 02099793 slli a5,s3,0x20 a8: 01d7d993 srli s3,a5,0x1d ac: 05c1 addi a1,a1,16 ae: 99ae add s3,s3,a1 cat(0); exit(1); } for(i = 1; i < argc; i++){ if((fd = open(argv[i], 0)) < 0){ b0: 4581 li a1,0 b2: 00093503 ld a0,0(s2) b6: 00000097 auipc ra,0x0 ba: 310080e7 jalr 784(ra) # 3c6 <open> be: 84aa mv s1,a0 c0: 02054d63 bltz a0,fa <main+0x74> printf("cat: cannot open %s\n", argv[i]); exit(1); } cat(fd); c4: 00000097 auipc ra,0x0 c8: f3c080e7 jalr -196(ra) # 0 <cat> close(fd); cc: 8526 mv a0,s1 ce: 00000097 auipc ra,0x0 d2: 2e0080e7 jalr 736(ra) # 3ae <close> for(i = 1; i < argc; i++){ d6: 0921 addi s2,s2,8 d8: fd391ce3 bne s2,s3,b0 <main+0x2a> } exit(0); dc: 4501 li a0,0 de: 00000097 auipc ra,0x0 e2: 2a8080e7 jalr 680(ra) # 386 <exit> cat(0); e6: 4501 li a0,0 e8: 00000097 auipc ra,0x0 ec: f18080e7 jalr -232(ra) # 0 <cat> exit(1); f0: 4505 li a0,1 f2: 00000097 auipc ra,0x0 f6: 294080e7 jalr 660(ra) # 386 <exit> printf("cat: cannot open %s\n", argv[i]); fa: 00093583 ld a1,0(s2) fe: 00000517 auipc a0,0x0 102: 7e250513 addi a0,a0,2018 # 8e0 <malloc+0x11c> 106: 00000097 auipc ra,0x0 10a: 600080e7 jalr 1536(ra) # 706 <printf> exit(1); 10e: 4505 li a0,1 110: 00000097 auipc ra,0x0 114: 276080e7 jalr 630(ra) # 386 <exit> 0000000000000118 <strcpy>: #include "kernel/fcntl.h" #include "user/user.h" char* strcpy(char *s, const char *t) { 118: 1141 addi sp,sp,-16 11a: e422 sd s0,8(sp) 11c: 0800 addi s0,sp,16 char *os; os = s; while((*s++ = *t++) != 0) 11e: 87aa mv a5,a0 120: 0585 addi a1,a1,1 122: 0785 addi a5,a5,1 124: fff5c703 lbu a4,-1(a1) 128: fee78fa3 sb a4,-1(a5) 12c: fb75 bnez a4,120 <strcpy+0x8> ; return os; } 12e: 6422 ld s0,8(sp) 130: 0141 addi sp,sp,16 132: 8082 ret 0000000000000134 <strcmp>: int strcmp(const char *p, const char *q) { 134: 1141 addi sp,sp,-16 136: e422 sd s0,8(sp) 138: 0800 addi s0,sp,16 while(*p && *p == *q) 13a: 00054783 lbu a5,0(a0) 13e: cb91 beqz a5,152 <strcmp+0x1e> 140: 0005c703 lbu a4,0(a1) 144: 00f71763 bne a4,a5,152 <strcmp+0x1e> p++, q++; 148: 0505 addi a0,a0,1 14a: 0585 addi a1,a1,1 while(*p && *p == *q) 14c: 00054783 lbu a5,0(a0) 150: fbe5 bnez a5,140 <strcmp+0xc> return (uchar)*p - (uchar)*q; 152: 0005c503 lbu a0,0(a1) } 156: 40a7853b subw a0,a5,a0 15a: 6422 ld s0,8(sp) 15c: 0141 addi sp,sp,16 15e: 8082 ret 0000000000000160 <strlen>: uint strlen(const char *s) { 160: 1141 addi sp,sp,-16 162: e422 sd s0,8(sp) 164: 0800 addi s0,sp,16 int n; for(n = 0; s[n]; n++) 166: 00054783 lbu a5,0(a0) 16a: cf91 beqz a5,186 <strlen+0x26> 16c: 0505 addi a0,a0,1 16e: 87aa mv a5,a0 170: 4685 li a3,1 172: 9e89 subw a3,a3,a0 174: 00f6853b addw a0,a3,a5 178: 0785 addi a5,a5,1 17a: fff7c703 lbu a4,-1(a5) 17e: fb7d bnez a4,174 <strlen+0x14> ; return n; } 180: 6422 ld s0,8(sp) 182: 0141 addi sp,sp,16 184: 8082 ret for(n = 0; s[n]; n++) 186: 4501 li a0,0 188: bfe5 j 180 <strlen+0x20> 000000000000018a <memset>: void* memset(void *dst, int c, uint n) { 18a: 1141 addi sp,sp,-16 18c: e422 sd s0,8(sp) 18e: 0800 addi s0,sp,16 char *cdst = (char *) dst; int i; for(i = 0; i < n; i++){ 190: ca19 beqz a2,1a6 <memset+0x1c> 192: 87aa mv a5,a0 194: 1602 slli a2,a2,0x20 196: 9201 srli a2,a2,0x20 198: 00a60733 add a4,a2,a0 cdst[i] = c; 19c: 00b78023 sb a1,0(a5) for(i = 0; i < n; i++){ 1a0: 0785 addi a5,a5,1 1a2: fee79de3 bne a5,a4,19c <memset+0x12> } return dst; } 1a6: 6422 ld s0,8(sp) 1a8: 0141 addi sp,sp,16 1aa: 8082 ret 00000000000001ac <strchr>: char* strchr(const char *s, char c) { 1ac: 1141 addi sp,sp,-16 1ae: e422 sd s0,8(sp) 1b0: 0800 addi s0,sp,16 for(; *s; s++) 1b2: 00054783 lbu a5,0(a0) 1b6: cb99 beqz a5,1cc <strchr+0x20> if(*s == c) 1b8: 00f58763 beq a1,a5,1c6 <strchr+0x1a> for(; *s; s++) 1bc: 0505 addi a0,a0,1 1be: 00054783 lbu a5,0(a0) 1c2: fbfd bnez a5,1b8 <strchr+0xc> return (char*)s; return 0; 1c4: 4501 li a0,0 } 1c6: 6422 ld s0,8(sp) 1c8: 0141 addi sp,sp,16 1ca: 8082 ret return 0; 1cc: 4501 li a0,0 1ce: bfe5 j 1c6 <strchr+0x1a> 00000000000001d0 <gets>: char* gets(char *buf, int max) { 1d0: 711d addi sp,sp,-96 1d2: ec86 sd ra,88(sp) 1d4: e8a2 sd s0,80(sp) 1d6: e4a6 sd s1,72(sp) 1d8: e0ca sd s2,64(sp) 1da: fc4e sd s3,56(sp) 1dc: f852 sd s4,48(sp) 1de: f456 sd s5,40(sp) 1e0: f05a sd s6,32(sp) 1e2: ec5e sd s7,24(sp) 1e4: 1080 addi s0,sp,96 1e6: 8baa mv s7,a0 1e8: 8a2e mv s4,a1 int i, cc; char c; for(i=0; i+1 < max; ){ 1ea: 892a mv s2,a0 1ec: 4481 li s1,0 cc = read(0, &c, 1); if(cc < 1) break; buf[i++] = c; if(c == '\n' || c == '\r') 1ee: 4aa9 li s5,10 1f0: 4b35 li s6,13 for(i=0; i+1 < max; ){ 1f2: 89a6 mv s3,s1 1f4: 2485 addiw s1,s1,1 1f6: 0344d863 bge s1,s4,226 <gets+0x56> cc = read(0, &c, 1); 1fa: 4605 li a2,1 1fc: faf40593 addi a1,s0,-81 200: 4501 li a0,0 202: 00000097 auipc ra,0x0 206: 19c080e7 jalr 412(ra) # 39e <read> if(cc < 1) 20a: 00a05e63 blez a0,226 <gets+0x56> buf[i++] = c; 20e: faf44783 lbu a5,-81(s0) 212: 00f90023 sb a5,0(s2) if(c == '\n' || c == '\r') 216: 01578763 beq a5,s5,224 <gets+0x54> 21a: 0905 addi s2,s2,1 21c: fd679be3 bne a5,s6,1f2 <gets+0x22> for(i=0; i+1 < max; ){ 220: 89a6 mv s3,s1 222: a011 j 226 <gets+0x56> 224: 89a6 mv s3,s1 break; } buf[i] = '\0'; 226: 99de add s3,s3,s7 228: 00098023 sb zero,0(s3) return buf; } 22c: 855e mv a0,s7 22e: 60e6 ld ra,88(sp) 230: 6446 ld s0,80(sp) 232: 64a6 ld s1,72(sp) 234: 6906 ld s2,64(sp) 236: 79e2 ld s3,56(sp) 238: 7a42 ld s4,48(sp) 23a: 7aa2 ld s5,40(sp) 23c: 7b02 ld s6,32(sp) 23e: 6be2 ld s7,24(sp) 240: 6125 addi sp,sp,96 242: 8082 ret 0000000000000244 <stat>: int stat(const char *n, struct stat *st) { 244: 1101 addi sp,sp,-32 246: ec06 sd ra,24(sp) 248: e822 sd s0,16(sp) 24a: e426 sd s1,8(sp) 24c: e04a sd s2,0(sp) 24e: 1000 addi s0,sp,32 250: 892e mv s2,a1 int fd; int r; fd = open(n, O_RDONLY); 252: 4581 li a1,0 254: 00000097 auipc ra,0x0 258: 172080e7 jalr 370(ra) # 3c6 <open> if(fd < 0) 25c: 02054563 bltz a0,286 <stat+0x42> 260: 84aa mv s1,a0 return -1; r = fstat(fd, st); 262: 85ca mv a1,s2 264: 00000097 auipc ra,0x0 268: 17a080e7 jalr 378(ra) # 3de <fstat> 26c: 892a mv s2,a0 close(fd); 26e: 8526 mv a0,s1 270: 00000097 auipc ra,0x0 274: 13e080e7 jalr 318(ra) # 3ae <close> return r; } 278: 854a mv a0,s2 27a: 60e2 ld ra,24(sp) 27c: 6442 ld s0,16(sp) 27e: 64a2 ld s1,8(sp) 280: 6902 ld s2,0(sp) 282: 6105 addi sp,sp,32 284: 8082 ret return -1; 286: 597d li s2,-1 288: bfc5 j 278 <stat+0x34> 000000000000028a <atoi>: int atoi(const char *s) { 28a: 1141 addi sp,sp,-16 28c: e422 sd s0,8(sp) 28e: 0800 addi s0,sp,16 int n; n = 0; while('0' <= *s && *s <= '9') 290: 00054603 lbu a2,0(a0) 294: fd06079b addiw a5,a2,-48 298: 0ff7f793 andi a5,a5,255 29c: 4725 li a4,9 29e: 02f76963 bltu a4,a5,2d0 <atoi+0x46> 2a2: 86aa mv a3,a0 n = 0; 2a4: 4501 li a0,0 while('0' <= *s && *s <= '9') 2a6: 45a5 li a1,9 n = n*10 + *s++ - '0'; 2a8: 0685 addi a3,a3,1 2aa: 0025179b slliw a5,a0,0x2 2ae: 9fa9 addw a5,a5,a0 2b0: 0017979b slliw a5,a5,0x1 2b4: 9fb1 addw a5,a5,a2 2b6: fd07851b addiw a0,a5,-48 while('0' <= *s && *s <= '9') 2ba: 0006c603 lbu a2,0(a3) 2be: fd06071b addiw a4,a2,-48 2c2: 0ff77713 andi a4,a4,255 2c6: fee5f1e3 bgeu a1,a4,2a8 <atoi+0x1e> return n; } 2ca: 6422 ld s0,8(sp) 2cc: 0141 addi sp,sp,16 2ce: 8082 ret n = 0; 2d0: 4501 li a0,0 2d2: bfe5 j 2ca <atoi+0x40> 00000000000002d4 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 2d4: 1141 addi sp,sp,-16 2d6: e422 sd s0,8(sp) 2d8: 0800 addi s0,sp,16 char *dst; const char *src; dst = vdst; src = vsrc; if (src > dst) { 2da: 02b57463 bgeu a0,a1,302 <memmove+0x2e> while(n-- > 0) 2de: 00c05f63 blez a2,2fc <memmove+0x28> 2e2: 1602 slli a2,a2,0x20 2e4: 9201 srli a2,a2,0x20 2e6: 00c507b3 add a5,a0,a2 dst = vdst; 2ea: 872a mv a4,a0 *dst++ = *src++; 2ec: 0585 addi a1,a1,1 2ee: 0705 addi a4,a4,1 2f0: fff5c683 lbu a3,-1(a1) 2f4: fed70fa3 sb a3,-1(a4) while(n-- > 0) 2f8: fee79ae3 bne a5,a4,2ec <memmove+0x18> src += n; while(n-- > 0) *--dst = *--src; } return vdst; } 2fc: 6422 ld s0,8(sp) 2fe: 0141 addi sp,sp,16 300: 8082 ret dst += n; 302: 00c50733 add a4,a0,a2 src += n; 306: 95b2 add a1,a1,a2 while(n-- > 0) 308: fec05ae3 blez a2,2fc <memmove+0x28> 30c: fff6079b addiw a5,a2,-1 310: 1782 slli a5,a5,0x20 312: 9381 srli a5,a5,0x20 314: fff7c793 not a5,a5 318: 97ba add a5,a5,a4 *--dst = *--src; 31a: 15fd addi a1,a1,-1 31c: 177d addi a4,a4,-1 31e: 0005c683 lbu a3,0(a1) 322: 00d70023 sb a3,0(a4) while(n-- > 0) 326: fee79ae3 bne a5,a4,31a <memmove+0x46> 32a: bfc9 j 2fc <memmove+0x28> 000000000000032c <memcmp>: int memcmp(const void *s1, const void *s2, uint n) { 32c: 1141 addi sp,sp,-16 32e: e422 sd s0,8(sp) 330: 0800 addi s0,sp,16 const char *p1 = s1, *p2 = s2; while (n-- > 0) { 332: ca05 beqz a2,362 <memcmp+0x36> 334: fff6069b addiw a3,a2,-1 338: 1682 slli a3,a3,0x20 33a: 9281 srli a3,a3,0x20 33c: 0685 addi a3,a3,1 33e: 96aa add a3,a3,a0 if (*p1 != *p2) { 340: 00054783 lbu a5,0(a0) 344: 0005c703 lbu a4,0(a1) 348: 00e79863 bne a5,a4,358 <memcmp+0x2c> return *p1 - *p2; } p1++; 34c: 0505 addi a0,a0,1 p2++; 34e: 0585 addi a1,a1,1 while (n-- > 0) { 350: fed518e3 bne a0,a3,340 <memcmp+0x14> } return 0; 354: 4501 li a0,0 356: a019 j 35c <memcmp+0x30> return *p1 - *p2; 358: 40e7853b subw a0,a5,a4 } 35c: 6422 ld s0,8(sp) 35e: 0141 addi sp,sp,16 360: 8082 ret return 0; 362: 4501 li a0,0 364: bfe5 j 35c <memcmp+0x30> 0000000000000366 <memcpy>: void * memcpy(void *dst, const void *src, uint n) { 366: 1141 addi sp,sp,-16 368: e406 sd ra,8(sp) 36a: e022 sd s0,0(sp) 36c: 0800 addi s0,sp,16 return memmove(dst, src, n); 36e: 00000097 auipc ra,0x0 372: f66080e7 jalr -154(ra) # 2d4 <memmove> } 376: 60a2 ld ra,8(sp) 378: 6402 ld s0,0(sp) 37a: 0141 addi sp,sp,16 37c: 8082 ret 000000000000037e <fork>: # generated by usys.pl - do not edit #include "kernel/syscall.h" .global fork fork: li a7, SYS_fork 37e: 4885 li a7,1 ecall 380: 00000073 ecall ret 384: 8082 ret 0000000000000386 <exit>: .global exit exit: li a7, SYS_exit 386: 4889 li a7,2 ecall 388: 00000073 ecall ret 38c: 8082 ret 000000000000038e <wait>: .global wait wait: li a7, SYS_wait 38e: 488d li a7,3 ecall 390: 00000073 ecall ret 394: 8082 ret 0000000000000396 <pipe>: .global pipe pipe: li a7, SYS_pipe 396: 4891 li a7,4 ecall 398: 00000073 ecall ret 39c: 8082 ret 000000000000039e <read>: .global read read: li a7, SYS_read 39e: 4895 li a7,5 ecall 3a0: 00000073 ecall ret 3a4: 8082 ret 00000000000003a6 <write>: .global write write: li a7, SYS_write 3a6: 48c1 li a7,16 ecall 3a8: 00000073 ecall ret 3ac: 8082 ret 00000000000003ae <close>: .global close close: li a7, SYS_close 3ae: 48d5 li a7,21 ecall 3b0: 00000073 ecall ret 3b4: 8082 ret 00000000000003b6 <kill>: .global kill kill: li a7, SYS_kill 3b6: 4899 li a7,6 ecall 3b8: 00000073 ecall ret 3bc: 8082 ret 00000000000003be <exec>: .global exec exec: li a7, SYS_exec 3be: 489d li a7,7 ecall 3c0: 00000073 ecall ret 3c4: 8082 ret 00000000000003c6 <open>: .global open open: li a7, SYS_open 3c6: 48bd li a7,15 ecall 3c8: 00000073 ecall ret 3cc: 8082 ret 00000000000003ce <mknod>: .global mknod mknod: li a7, SYS_mknod 3ce: 48c5 li a7,17 ecall 3d0: 00000073 ecall ret 3d4: 8082 ret 00000000000003d6 <unlink>: .global unlink unlink: li a7, SYS_unlink 3d6: 48c9 li a7,18 ecall 3d8: 00000073 ecall ret 3dc: 8082 ret 00000000000003de <fstat>: .global fstat fstat: li a7, SYS_fstat 3de: 48a1 li a7,8 ecall 3e0: 00000073 ecall ret 3e4: 8082 ret 00000000000003e6 <link>: .global link link: li a7, SYS_link 3e6: 48cd li a7,19 ecall 3e8: 00000073 ecall ret 3ec: 8082 ret 00000000000003ee <mkdir>: .global mkdir mkdir: li a7, SYS_mkdir 3ee: 48d1 li a7,20 ecall 3f0: 00000073 ecall ret 3f4: 8082 ret 00000000000003f6 <chdir>: .global chdir chdir: li a7, SYS_chdir 3f6: 48a5 li a7,9 ecall 3f8: 00000073 ecall ret 3fc: 8082 ret 00000000000003fe <dup>: .global dup dup: li a7, SYS_dup 3fe: 48a9 li a7,10 ecall 400: 00000073 ecall ret 404: 8082 ret 0000000000000406 <getpid>: .global getpid getpid: li a7, SYS_getpid 406: 48ad li a7,11 ecall 408: 00000073 ecall ret 40c: 8082 ret 000000000000040e <sbrk>: .global sbrk sbrk: li a7, SYS_sbrk 40e: 48b1 li a7,12 ecall 410: 00000073 ecall ret 414: 8082 ret 0000000000000416 <sleep>: .global sleep sleep: li a7, SYS_sleep 416: 48b5 li a7,13 ecall 418: 00000073 ecall ret 41c: 8082 ret 000000000000041e <uptime>: .global uptime uptime: li a7, SYS_uptime 41e: 48b9 li a7,14 ecall 420: 00000073 ecall ret 424: 8082 ret 0000000000000426 <ntas>: .global ntas ntas: li a7, SYS_ntas 426: 48d9 li a7,22 ecall 428: 00000073 ecall ret 42c: 8082 ret 000000000000042e <putc>: static char digits[] = "0123456789ABCDEF"; static void putc(int fd, char c) { 42e: 1101 addi sp,sp,-32 430: ec06 sd ra,24(sp) 432: e822 sd s0,16(sp) 434: 1000 addi s0,sp,32 436: feb407a3 sb a1,-17(s0) write(fd, &c, 1); 43a: 4605 li a2,1 43c: fef40593 addi a1,s0,-17 440: 00000097 auipc ra,0x0 444: f66080e7 jalr -154(ra) # 3a6 <write> } 448: 60e2 ld ra,24(sp) 44a: 6442 ld s0,16(sp) 44c: 6105 addi sp,sp,32 44e: 8082 ret 0000000000000450 <printint>: static void printint(int fd, int xx, int base, int sgn) { 450: 7139 addi sp,sp,-64 452: fc06 sd ra,56(sp) 454: f822 sd s0,48(sp) 456: f426 sd s1,40(sp) 458: f04a sd s2,32(sp) 45a: ec4e sd s3,24(sp) 45c: 0080 addi s0,sp,64 45e: 84aa mv s1,a0 char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 460: c299 beqz a3,466 <printint+0x16> 462: 0805c863 bltz a1,4f2 <printint+0xa2> neg = 1; x = -xx; } else { x = xx; 466: 2581 sext.w a1,a1 neg = 0; 468: 4881 li a7,0 46a: fc040693 addi a3,s0,-64 } i = 0; 46e: 4701 li a4,0 do{ buf[i++] = digits[x % base]; 470: 2601 sext.w a2,a2 472: 00000517 auipc a0,0x0 476: 48e50513 addi a0,a0,1166 # 900 <digits> 47a: 883a mv a6,a4 47c: 2705 addiw a4,a4,1 47e: 02c5f7bb remuw a5,a1,a2 482: 1782 slli a5,a5,0x20 484: 9381 srli a5,a5,0x20 486: 97aa add a5,a5,a0 488: 0007c783 lbu a5,0(a5) 48c: 00f68023 sb a5,0(a3) }while((x /= base) != 0); 490: 0005879b sext.w a5,a1 494: 02c5d5bb divuw a1,a1,a2 498: 0685 addi a3,a3,1 49a: fec7f0e3 bgeu a5,a2,47a <printint+0x2a> if(neg) 49e: 00088b63 beqz a7,4b4 <printint+0x64> buf[i++] = '-'; 4a2: fd040793 addi a5,s0,-48 4a6: 973e add a4,a4,a5 4a8: 02d00793 li a5,45 4ac: fef70823 sb a5,-16(a4) 4b0: 0028071b addiw a4,a6,2 while(--i >= 0) 4b4: 02e05863 blez a4,4e4 <printint+0x94> 4b8: fc040793 addi a5,s0,-64 4bc: 00e78933 add s2,a5,a4 4c0: fff78993 addi s3,a5,-1 4c4: 99ba add s3,s3,a4 4c6: 377d addiw a4,a4,-1 4c8: 1702 slli a4,a4,0x20 4ca: 9301 srli a4,a4,0x20 4cc: 40e989b3 sub s3,s3,a4 putc(fd, buf[i]); 4d0: fff94583 lbu a1,-1(s2) 4d4: 8526 mv a0,s1 4d6: 00000097 auipc ra,0x0 4da: f58080e7 jalr -168(ra) # 42e <putc> while(--i >= 0) 4de: 197d addi s2,s2,-1 4e0: ff3918e3 bne s2,s3,4d0 <printint+0x80> } 4e4: 70e2 ld ra,56(sp) 4e6: 7442 ld s0,48(sp) 4e8: 74a2 ld s1,40(sp) 4ea: 7902 ld s2,32(sp) 4ec: 69e2 ld s3,24(sp) 4ee: 6121 addi sp,sp,64 4f0: 8082 ret x = -xx; 4f2: 40b005bb negw a1,a1 neg = 1; 4f6: 4885 li a7,1 x = -xx; 4f8: bf8d j 46a <printint+0x1a> 00000000000004fa <vprintf>: } // Print to the given fd. Only understands %d, %x, %p, %s. void vprintf(int fd, const char *fmt, va_list ap) { 4fa: 7119 addi sp,sp,-128 4fc: fc86 sd ra,120(sp) 4fe: f8a2 sd s0,112(sp) 500: f4a6 sd s1,104(sp) 502: f0ca sd s2,96(sp) 504: ecce sd s3,88(sp) 506: e8d2 sd s4,80(sp) 508: e4d6 sd s5,72(sp) 50a: e0da sd s6,64(sp) 50c: fc5e sd s7,56(sp) 50e: f862 sd s8,48(sp) 510: f466 sd s9,40(sp) 512: f06a sd s10,32(sp) 514: ec6e sd s11,24(sp) 516: 0100 addi s0,sp,128 char *s; int c, i, state; state = 0; for(i = 0; fmt[i]; i++){ 518: 0005c903 lbu s2,0(a1) 51c: 18090f63 beqz s2,6ba <vprintf+0x1c0> 520: 8aaa mv s5,a0 522: 8b32 mv s6,a2 524: 00158493 addi s1,a1,1 state = 0; 528: 4981 li s3,0 if(c == '%'){ state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 52a: 02500a13 li s4,37 if(c == 'd'){ 52e: 06400c13 li s8,100 printint(fd, va_arg(ap, int), 10, 1); } else if(c == 'l') { 532: 06c00c93 li s9,108 printint(fd, va_arg(ap, uint64), 10, 0); } else if(c == 'x') { 536: 07800d13 li s10,120 printint(fd, va_arg(ap, int), 16, 0); } else if(c == 'p') { 53a: 07000d93 li s11,112 putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]); 53e: 00000b97 auipc s7,0x0 542: 3c2b8b93 addi s7,s7,962 # 900 <digits> 546: a839 j 564 <vprintf+0x6a> putc(fd, c); 548: 85ca mv a1,s2 54a: 8556 mv a0,s5 54c: 00000097 auipc ra,0x0 550: ee2080e7 jalr -286(ra) # 42e <putc> 554: a019 j 55a <vprintf+0x60> } else if(state == '%'){ 556: 01498f63 beq s3,s4,574 <vprintf+0x7a> for(i = 0; fmt[i]; i++){ 55a: 0485 addi s1,s1,1 55c: fff4c903 lbu s2,-1(s1) 560: 14090d63 beqz s2,6ba <vprintf+0x1c0> c = fmt[i] & 0xff; 564: 0009079b sext.w a5,s2 if(state == 0){ 568: fe0997e3 bnez s3,556 <vprintf+0x5c> if(c == '%'){ 56c: fd479ee3 bne a5,s4,548 <vprintf+0x4e> state = '%'; 570: 89be mv s3,a5 572: b7e5 j 55a <vprintf+0x60> if(c == 'd'){ 574: 05878063 beq a5,s8,5b4 <vprintf+0xba> } else if(c == 'l') { 578: 05978c63 beq a5,s9,5d0 <vprintf+0xd6> } else if(c == 'x') { 57c: 07a78863 beq a5,s10,5ec <vprintf+0xf2> } else if(c == 'p') { 580: 09b78463 beq a5,s11,608 <vprintf+0x10e> printptr(fd, va_arg(ap, uint64)); } else if(c == 's'){ 584: 07300713 li a4,115 588: 0ce78663 beq a5,a4,654 <vprintf+0x15a> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 58c: 06300713 li a4,99 590: 0ee78e63 beq a5,a4,68c <vprintf+0x192> putc(fd, va_arg(ap, uint)); } else if(c == '%'){ 594: 11478863 beq a5,s4,6a4 <vprintf+0x1aa> putc(fd, c); } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 598: 85d2 mv a1,s4 59a: 8556 mv a0,s5 59c: 00000097 auipc ra,0x0 5a0: e92080e7 jalr -366(ra) # 42e <putc> putc(fd, c); 5a4: 85ca mv a1,s2 5a6: 8556 mv a0,s5 5a8: 00000097 auipc ra,0x0 5ac: e86080e7 jalr -378(ra) # 42e <putc> } state = 0; 5b0: 4981 li s3,0 5b2: b765 j 55a <vprintf+0x60> printint(fd, va_arg(ap, int), 10, 1); 5b4: 008b0913 addi s2,s6,8 5b8: 4685 li a3,1 5ba: 4629 li a2,10 5bc: 000b2583 lw a1,0(s6) 5c0: 8556 mv a0,s5 5c2: 00000097 auipc ra,0x0 5c6: e8e080e7 jalr -370(ra) # 450 <printint> 5ca: 8b4a mv s6,s2 state = 0; 5cc: 4981 li s3,0 5ce: b771 j 55a <vprintf+0x60> printint(fd, va_arg(ap, uint64), 10, 0); 5d0: 008b0913 addi s2,s6,8 5d4: 4681 li a3,0 5d6: 4629 li a2,10 5d8: 000b2583 lw a1,0(s6) 5dc: 8556 mv a0,s5 5de: 00000097 auipc ra,0x0 5e2: e72080e7 jalr -398(ra) # 450 <printint> 5e6: 8b4a mv s6,s2 state = 0; 5e8: 4981 li s3,0 5ea: bf85 j 55a <vprintf+0x60> printint(fd, va_arg(ap, int), 16, 0); 5ec: 008b0913 addi s2,s6,8 5f0: 4681 li a3,0 5f2: 4641 li a2,16 5f4: 000b2583 lw a1,0(s6) 5f8: 8556 mv a0,s5 5fa: 00000097 auipc ra,0x0 5fe: e56080e7 jalr -426(ra) # 450 <printint> 602: 8b4a mv s6,s2 state = 0; 604: 4981 li s3,0 606: bf91 j 55a <vprintf+0x60> printptr(fd, va_arg(ap, uint64)); 608: 008b0793 addi a5,s6,8 60c: f8f43423 sd a5,-120(s0) 610: 000b3983 ld s3,0(s6) putc(fd, '0'); 614: 03000593 li a1,48 618: 8556 mv a0,s5 61a: 00000097 auipc ra,0x0 61e: e14080e7 jalr -492(ra) # 42e <putc> putc(fd, 'x'); 622: 85ea mv a1,s10 624: 8556 mv a0,s5 626: 00000097 auipc ra,0x0 62a: e08080e7 jalr -504(ra) # 42e <putc> 62e: 4941 li s2,16 putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]); 630: 03c9d793 srli a5,s3,0x3c 634: 97de add a5,a5,s7 636: 0007c583 lbu a1,0(a5) 63a: 8556 mv a0,s5 63c: 00000097 auipc ra,0x0 640: df2080e7 jalr -526(ra) # 42e <putc> for (i = 0; i < (sizeof(uint64) * 2); i++, x <<= 4) 644: 0992 slli s3,s3,0x4 646: 397d addiw s2,s2,-1 648: fe0914e3 bnez s2,630 <vprintf+0x136> printptr(fd, va_arg(ap, uint64)); 64c: f8843b03 ld s6,-120(s0) state = 0; 650: 4981 li s3,0 652: b721 j 55a <vprintf+0x60> s = va_arg(ap, char*); 654: 008b0993 addi s3,s6,8 658: 000b3903 ld s2,0(s6) if(s == 0) 65c: 02090163 beqz s2,67e <vprintf+0x184> while(*s != 0){ 660: 00094583 lbu a1,0(s2) 664: c9a1 beqz a1,6b4 <vprintf+0x1ba> putc(fd, *s); 666: 8556 mv a0,s5 668: 00000097 auipc ra,0x0 66c: dc6080e7 jalr -570(ra) # 42e <putc> s++; 670: 0905 addi s2,s2,1 while(*s != 0){ 672: 00094583 lbu a1,0(s2) 676: f9e5 bnez a1,666 <vprintf+0x16c> s = va_arg(ap, char*); 678: 8b4e mv s6,s3 state = 0; 67a: 4981 li s3,0 67c: bdf9 j 55a <vprintf+0x60> s = "(null)"; 67e: 00000917 auipc s2,0x0 682: 27a90913 addi s2,s2,634 # 8f8 <malloc+0x134> while(*s != 0){ 686: 02800593 li a1,40 68a: bff1 j 666 <vprintf+0x16c> putc(fd, va_arg(ap, uint)); 68c: 008b0913 addi s2,s6,8 690: 000b4583 lbu a1,0(s6) 694: 8556 mv a0,s5 696: 00000097 auipc ra,0x0 69a: d98080e7 jalr -616(ra) # 42e <putc> 69e: 8b4a mv s6,s2 state = 0; 6a0: 4981 li s3,0 6a2: bd65 j 55a <vprintf+0x60> putc(fd, c); 6a4: 85d2 mv a1,s4 6a6: 8556 mv a0,s5 6a8: 00000097 auipc ra,0x0 6ac: d86080e7 jalr -634(ra) # 42e <putc> state = 0; 6b0: 4981 li s3,0 6b2: b565 j 55a <vprintf+0x60> s = va_arg(ap, char*); 6b4: 8b4e mv s6,s3 state = 0; 6b6: 4981 li s3,0 6b8: b54d j 55a <vprintf+0x60> } } } 6ba: 70e6 ld ra,120(sp) 6bc: 7446 ld s0,112(sp) 6be: 74a6 ld s1,104(sp) 6c0: 7906 ld s2,96(sp) 6c2: 69e6 ld s3,88(sp) 6c4: 6a46 ld s4,80(sp) 6c6: 6aa6 ld s5,72(sp) 6c8: 6b06 ld s6,64(sp) 6ca: 7be2 ld s7,56(sp) 6cc: 7c42 ld s8,48(sp) 6ce: 7ca2 ld s9,40(sp) 6d0: 7d02 ld s10,32(sp) 6d2: 6de2 ld s11,24(sp) 6d4: 6109 addi sp,sp,128 6d6: 8082 ret 00000000000006d8 <fprintf>: void fprintf(int fd, const char *fmt, ...) { 6d8: 715d addi sp,sp,-80 6da: ec06 sd ra,24(sp) 6dc: e822 sd s0,16(sp) 6de: 1000 addi s0,sp,32 6e0: e010 sd a2,0(s0) 6e2: e414 sd a3,8(s0) 6e4: e818 sd a4,16(s0) 6e6: ec1c sd a5,24(s0) 6e8: 03043023 sd a6,32(s0) 6ec: 03143423 sd a7,40(s0) va_list ap; va_start(ap, fmt); 6f0: fe843423 sd s0,-24(s0) vprintf(fd, fmt, ap); 6f4: 8622 mv a2,s0 6f6: 00000097 auipc ra,0x0 6fa: e04080e7 jalr -508(ra) # 4fa <vprintf> } 6fe: 60e2 ld ra,24(sp) 700: 6442 ld s0,16(sp) 702: 6161 addi sp,sp,80 704: 8082 ret 0000000000000706 <printf>: void printf(const char *fmt, ...) { 706: 711d addi sp,sp,-96 708: ec06 sd ra,24(sp) 70a: e822 sd s0,16(sp) 70c: 1000 addi s0,sp,32 70e: e40c sd a1,8(s0) 710: e810 sd a2,16(s0) 712: ec14 sd a3,24(s0) 714: f018 sd a4,32(s0) 716: f41c sd a5,40(s0) 718: 03043823 sd a6,48(s0) 71c: 03143c23 sd a7,56(s0) va_list ap; va_start(ap, fmt); 720: 00840613 addi a2,s0,8 724: fec43423 sd a2,-24(s0) vprintf(1, fmt, ap); 728: 85aa mv a1,a0 72a: 4505 li a0,1 72c: 00000097 auipc ra,0x0 730: dce080e7 jalr -562(ra) # 4fa <vprintf> } 734: 60e2 ld ra,24(sp) 736: 6442 ld s0,16(sp) 738: 6125 addi sp,sp,96 73a: 8082 ret 000000000000073c <free>: static Header base; static Header *freep; void free(void *ap) { 73c: 1141 addi sp,sp,-16 73e: e422 sd s0,8(sp) 740: 0800 addi s0,sp,16 Header *bp, *p; bp = (Header*)ap - 1; 742: ff050693 addi a3,a0,-16 for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 746: 00000797 auipc a5,0x0 74a: 1d27b783 ld a5,466(a5) # 918 <freep> 74e: a805 j 77e <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; 750: 4618 lw a4,8(a2) 752: 9db9 addw a1,a1,a4 754: feb52c23 sw a1,-8(a0) bp->s.ptr = p->s.ptr->s.ptr; 758: 6398 ld a4,0(a5) 75a: 6318 ld a4,0(a4) 75c: fee53823 sd a4,-16(a0) 760: a091 j 7a4 <free+0x68> } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ p->s.size += bp->s.size; 762: ff852703 lw a4,-8(a0) 766: 9e39 addw a2,a2,a4 768: c790 sw a2,8(a5) p->s.ptr = bp->s.ptr; 76a: ff053703 ld a4,-16(a0) 76e: e398 sd a4,0(a5) 770: a099 j 7b6 <free+0x7a> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 772: 6398 ld a4,0(a5) 774: 00e7e463 bltu a5,a4,77c <free+0x40> 778: 00e6ea63 bltu a3,a4,78c <free+0x50> { 77c: 87ba mv a5,a4 for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 77e: fed7fae3 bgeu a5,a3,772 <free+0x36> 782: 6398 ld a4,0(a5) 784: 00e6e463 bltu a3,a4,78c <free+0x50> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 788: fee7eae3 bltu a5,a4,77c <free+0x40> if(bp + bp->s.size == p->s.ptr){ 78c: ff852583 lw a1,-8(a0) 790: 6390 ld a2,0(a5) 792: 02059813 slli a6,a1,0x20 796: 01c85713 srli a4,a6,0x1c 79a: 9736 add a4,a4,a3 79c: fae60ae3 beq a2,a4,750 <free+0x14> bp->s.ptr = p->s.ptr; 7a0: fec53823 sd a2,-16(a0) if(p + p->s.size == bp){ 7a4: 4790 lw a2,8(a5) 7a6: 02061593 slli a1,a2,0x20 7aa: 01c5d713 srli a4,a1,0x1c 7ae: 973e add a4,a4,a5 7b0: fae689e3 beq a3,a4,762 <free+0x26> } else p->s.ptr = bp; 7b4: e394 sd a3,0(a5) freep = p; 7b6: 00000717 auipc a4,0x0 7ba: 16f73123 sd a5,354(a4) # 918 <freep> } 7be: 6422 ld s0,8(sp) 7c0: 0141 addi sp,sp,16 7c2: 8082 ret 00000000000007c4 <malloc>: return freep; } void* malloc(uint nbytes) { 7c4: 7139 addi sp,sp,-64 7c6: fc06 sd ra,56(sp) 7c8: f822 sd s0,48(sp) 7ca: f426 sd s1,40(sp) 7cc: f04a sd s2,32(sp) 7ce: ec4e sd s3,24(sp) 7d0: e852 sd s4,16(sp) 7d2: e456 sd s5,8(sp) 7d4: e05a sd s6,0(sp) 7d6: 0080 addi s0,sp,64 Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 7d8: 02051493 slli s1,a0,0x20 7dc: 9081 srli s1,s1,0x20 7de: 04bd addi s1,s1,15 7e0: 8091 srli s1,s1,0x4 7e2: 0014899b addiw s3,s1,1 7e6: 0485 addi s1,s1,1 if((prevp = freep) == 0){ 7e8: 00000517 auipc a0,0x0 7ec: 13053503 ld a0,304(a0) # 918 <freep> 7f0: c515 beqz a0,81c <malloc+0x58> base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 7f2: 611c ld a5,0(a0) if(p->s.size >= nunits){ 7f4: 4798 lw a4,8(a5) 7f6: 02977f63 bgeu a4,s1,834 <malloc+0x70> 7fa: 8a4e mv s4,s3 7fc: 0009871b sext.w a4,s3 800: 6685 lui a3,0x1 802: 00d77363 bgeu a4,a3,808 <malloc+0x44> 806: 6a05 lui s4,0x1 808: 000a0b1b sext.w s6,s4 p = sbrk(nu * sizeof(Header)); 80c: 004a1a1b slliw s4,s4,0x4 p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 810: 00000917 auipc s2,0x0 814: 10890913 addi s2,s2,264 # 918 <freep> if(p == (char*)-1) 818: 5afd li s5,-1 81a: a895 j 88e <malloc+0xca> base.s.ptr = freep = prevp = &base; 81c: 00000797 auipc a5,0x0 820: 30478793 addi a5,a5,772 # b20 <base> 824: 00000717 auipc a4,0x0 828: 0ef73a23 sd a5,244(a4) # 918 <freep> 82c: e39c sd a5,0(a5) base.s.size = 0; 82e: 0007a423 sw zero,8(a5) if(p->s.size >= nunits){ 832: b7e1 j 7fa <malloc+0x36> if(p->s.size == nunits) 834: 02e48c63 beq s1,a4,86c <malloc+0xa8> p->s.size -= nunits; 838: 4137073b subw a4,a4,s3 83c: c798 sw a4,8(a5) p += p->s.size; 83e: 02071693 slli a3,a4,0x20 842: 01c6d713 srli a4,a3,0x1c 846: 97ba add a5,a5,a4 p->s.size = nunits; 848: 0137a423 sw s3,8(a5) freep = prevp; 84c: 00000717 auipc a4,0x0 850: 0ca73623 sd a0,204(a4) # 918 <freep> return (void*)(p + 1); 854: 01078513 addi a0,a5,16 if((p = morecore(nunits)) == 0) return 0; } } 858: 70e2 ld ra,56(sp) 85a: 7442 ld s0,48(sp) 85c: 74a2 ld s1,40(sp) 85e: 7902 ld s2,32(sp) 860: 69e2 ld s3,24(sp) 862: 6a42 ld s4,16(sp) 864: 6aa2 ld s5,8(sp) 866: 6b02 ld s6,0(sp) 868: 6121 addi sp,sp,64 86a: 8082 ret prevp->s.ptr = p->s.ptr; 86c: 6398 ld a4,0(a5) 86e: e118 sd a4,0(a0) 870: bff1 j 84c <malloc+0x88> hp->s.size = nu; 872: 01652423 sw s6,8(a0) free((void*)(hp + 1)); 876: 0541 addi a0,a0,16 878: 00000097 auipc ra,0x0 87c: ec4080e7 jalr -316(ra) # 73c <free> return freep; 880: 00093503 ld a0,0(s2) if((p = morecore(nunits)) == 0) 884: d971 beqz a0,858 <malloc+0x94> for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 886: 611c ld a5,0(a0) if(p->s.size >= nunits){ 888: 4798 lw a4,8(a5) 88a: fa9775e3 bgeu a4,s1,834 <malloc+0x70> if(p == freep) 88e: 00093703 ld a4,0(s2) 892: 853e mv a0,a5 894: fef719e3 bne a4,a5,886 <malloc+0xc2> p = sbrk(nu * sizeof(Header)); 898: 8552 mv a0,s4 89a: 00000097 auipc ra,0x0 89e: b74080e7 jalr -1164(ra) # 40e <sbrk> if(p == (char*)-1) 8a2: fd5518e3 bne a0,s5,872 <malloc+0xae> return 0; 8a6: 4501 li a0,0 8a8: bf45 j 858 <malloc+0x94>
29.653389
62
0.460574
ea7b1d3a664f5976909ce68199e5079ceef05499
2,619
asm
Assembly
chap18/ex18/qword_avx512_ass.asm
JamesType/optimization-manual
61cdcebb16e0768a6ab7e85ed535e64e9d8cc31a
[ "0BSD" ]
374
2021-06-08T10:42:01.000Z
2022-03-29T14:21:45.000Z
chap18/ex18/qword_avx512_ass.asm
JamesType/optimization-manual
61cdcebb16e0768a6ab7e85ed535e64e9d8cc31a
[ "0BSD" ]
1
2021-06-11T20:24:02.000Z
2021-06-11T20:24:02.000Z
chap18/ex18/qword_avx512_ass.asm
JamesType/optimization-manual
61cdcebb16e0768a6ab7e85ed535e64e9d8cc31a
[ "0BSD" ]
39
2021-06-08T11:25:29.000Z
2022-03-05T05:14:17.000Z
; ; Copyright (C) 2021 by Intel Corporation ; ; Permission to use, copy, modify, and/or distribute this software for any ; purpose with or without fee is hereby granted. ; ; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH ; REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY ; AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, ; INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM ; LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR ; OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ; PERFORMANCE OF THIS SOFTWARE. ; ; .globl qword_avx512_ass ; void qword_avx512_ass(const int64_t *a, const int64_t *b, int64_t *c, uint64_t count); ; ; On entry: ; rcx = a ; rdx = b ; r8 = c ; r9 = count .code qword_avx512_ass PROC public sub rsp, 168 vmovaps xmmword ptr[rsp], xmm6 vmovaps xmmword ptr[rsp+16], xmm7 vmovaps xmmword ptr[rsp+32], xmm8 vmovaps xmmword ptr[rsp+48], xmm9 vmovaps xmmword ptr[rsp+64], xmm10 vmovaps xmmword ptr[rsp+80], xmm11 vmovaps xmmword ptr[rsp+96], xmm12 vmovaps xmmword ptr[rsp+112], xmm13 vmovaps xmmword ptr[rsp+128], xmm14 vmovaps xmmword ptr[rsp+144], xmm15 shr r9, 5 xor rax, rax xor r10d, r10d loop1: vmovups zmm0, zmmword ptr [rcx+rax*8] inc r10d vmovups zmm5, zmmword ptr [rcx+rax*8+40h] vmovups zmm10, zmmword ptr [rcx+rax*8+80h] vmovups zmm15, zmmword ptr [rcx+rax*8+0c0h] vmovups zmm1, zmmword ptr [rdx+rax*8] vmovups zmm6, zmmword ptr [rdx+rax*8+40h] vmovups zmm11, zmmword ptr [rdx+rax*8+80h] vmovups zmm16, zmmword ptr [rdx+rax*8+0c0h] vpaddq zmm2, zmm0, zmm1 vpmullq zmm3, zmm0, zmm1 vpaddq zmm7, zmm5, zmm6 vpmullq zmm8, zmm5, zmm6 vpaddq zmm12, zmm10, zmm11 vpmullq zmm13, zmm10, zmm11 vpaddq zmm17, zmm15, zmm16 vpmullq zmm18, zmm15, zmm16 vpmaxsq zmm4, zmm2, zmm3 vpmaxsq zmm9, zmm7, zmm8 vpmaxsq zmm14, zmm12, zmm13 vpmaxsq zmm19, zmm17, zmm18 vmovups zmmword ptr [r8], zmm4 vmovups zmmword ptr [r8+40h], zmm9 vmovups zmmword ptr [r8+80h], zmm14 vmovups zmmword ptr [r8+0c0h], zmm19 add rax, 20h add r8, 100h cmp r10d, r9d jb loop1 vzeroupper vmovaps xmm6, xmmword ptr[rsp] vmovaps xmm7, xmmword ptr[rsp+16] vmovaps xmm8, xmmword ptr[rsp+32] vmovaps xmm9, xmmword ptr[rsp+48] vmovaps xmm10, xmmword ptr[rsp+64] vmovaps xmm11, xmmword ptr[rsp+80] vmovaps xmm12, xmmword ptr[rsp+96] vmovaps xmm13, xmmword ptr[rsp+112] vmovaps xmm14, xmmword ptr[rsp+128] vmovaps xmm15, xmmword ptr[rsp+144] add rsp, 168 ret qword_avx512_ass ENDP end
27.568421
89
0.73425
062c8d72793ddaa2b19aa484964aa20ec450ea1f
3,812
asm
Assembly
main.asm
nesdoug/SNES_04
9cb5b5b5f7fcec98e272f0a9494f9031a30491c5
[ "MIT" ]
3
2020-05-22T22:57:33.000Z
2020-06-15T13:08:00.000Z
main.asm
nesdoug/SNES_04
9cb5b5b5f7fcec98e272f0a9494f9031a30491c5
[ "MIT" ]
null
null
null
main.asm
nesdoug/SNES_04
9cb5b5b5f7fcec98e272f0a9494f9031a30491c5
[ "MIT" ]
null
null
null
; example 4 SNES code .p816 .smart .include "regs.asm" .include "variables.asm" .include "macros.asm" .include "init.asm" .segment "CODE" ; enters here in forced blank Main: .a16 ; the setting from init code .i16 phk plb ; DMA from BG_Palette to CGRAM A8 stz CGADD ; $2121 cgram address = zero stz $4300 ; transfer mode 0 = 1 register write once lda #$22 ; $2122 sta $4301 ; destination, cgram data ldx #.loword(BG_Palette) stx $4302 ; source lda #^BG_Palette sta $4304 ; bank ldx #256 stx $4305 ; length lda #1 sta MDMAEN ; $420b start dma, channel 0 ; DMA from Tiles to VRAM lda #V_INC_1 ; the value $80 sta VMAIN ; $2115 = set the increment mode +1 ldx #$0000 stx VMADDL ; set an address in the vram of $0000 lda #1 sta $4300 ; transfer mode, 2 registers 1 write ; $2118 and $2119 are a pair Low/High lda #$18 ; $2118 sta $4301 ; destination, vram data ldx #.loword(Tiles) stx $4302 ; source lda #^Tiles sta $4304 ; bank ldx #(End_Tiles-Tiles) stx $4305 ; length lda #1 sta MDMAEN ; $420b start dma, channel 0 ; DMA from Tiles2 to VRAM ldx #$3000 stx VMADDL ; set an address in the vram of $3000 ; 4300 and 4301 still hold the correct values for transfers to vram ; and don't need to be rewritten here ldx #.loword(Tiles2) stx $4302 ; source lda #^Tiles2 sta $4304 ; bank ldx #(End_Tiles2-Tiles2) stx $4305 ; length lda #1 sta MDMAEN ; $420b start dma, channel 0 ; DMA from Tilemap to VRAM ldx #$6000 stx VMADDL ; set an address in the vram of $6000 ; removed duplicate writes to 4300 and 4301 ldx #.loword(Tilemap) stx $4302 ; source lda #^Tilemap sta $4304 ; bank ldx #$700 stx $4305 ; length lda #1 sta MDMAEN ; $420b start dma, channel 0 ; DMA from Tilemap2 to VRAM ldx #$6800 stx VMADDL ; set an address in the vram of $6800 ; removed duplicate writes to 4300 and 4301 ldx #.loword(Tilemap2) stx $4302 ; source lda #^Tilemap2 sta $4304 ; bank ldx #$700 stx $4305 ; length lda #1 sta MDMAEN ; $420b start dma, channel 0 ; DMA from Tilemap3 to VRAM ldx #$7000 stx VMADDL ; set an address in the vram of $7000 ; removed duplicate writes to 4300 and 4301 ldx #.loword(Tilemap3) stx $4302 ; source lda #^Tilemap3 sta $4304 ; bank ldx #$700 stx $4305 ; length lda #1 sta MDMAEN ; $420b start dma, channel 0 ; a is still 8 bit. lda #1 ; mode 1, tilesize 8x8 all sta BGMODE ; $2105 ; 210b = tilesets for bg 1 and bg 2 ; (210c for bg 3 and bg 4) ; steps of $1000 -321-321... bg2 bg1 stz BG12NBA ; $210b BG 1 and 2 TILES at VRAM address $0000 lda #$03 sta BG34NBA ; $210c BG3 TILES at VRAM address $3000 ; 2107 map address bg 1, steps of $400... -54321yx ; y/x = map size... 0,0 = 32x32 tiles ; $6000 / $100 = $60 lda #$60 ; bg1 map at VRAM address $6000 sta BG1SC ; $2107 lda #$68 ; bg1 map at VRAM address $6800 sta BG2SC ; $2108 lda #$70 ; bg3 map at VRAM address $7000 sta BG3SC ; $2109 lda #BG_ALL_ON sta TM ; $212c lda #FULL_BRIGHT ; $0f = turn the screen on (end forced blank) sta INIDISP ; $2100 Infinite_Loop: A8 XY16 jsr Wait_NMI ;code goes here jmp Infinite_Loop Wait_NMI: .a8 .i16 ;should work fine regardless of size of A lda in_nmi ;load A register with previous in_nmi @check_again: WAI ;wait for an interrupt cmp in_nmi ;compare A to current in_nmi ;wait for it to change ;make sure it was an nmi interrupt beq @check_again rts .include "header.asm" .segment "RODATA1" BG_Palette: ; 256 bytes .incbin "M1TE/allBG.pal" Tiles: ; 4bpp tileset .incbin "M1TE/moon.chr" End_Tiles: Tiles2: ; 2bpp tileset .incbin "M1TE/spacebar.chr" End_Tiles2: Tilemap: ; $700 bytes .incbin "M1TE/moon.map" Tilemap2: ; $700 bytes .incbin "M1TE/bluebar.map" Tilemap3: ; $700 bytes .incbin "M1TE/spacebar.map"
17.896714
67
0.674974
a8ea10471161a177bee98003579821ae4c373547
4,185
asm
Assembly
Library/Chart/Series/seriesSpider.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
504
2018-11-18T03:35:53.000Z
2022-03-29T01:02:51.000Z
Library/Chart/Series/seriesSpider.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
96
2018-11-19T21:06:50.000Z
2022-03-06T10:26:48.000Z
Library/Chart/Series/seriesSpider.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
73
2018-11-19T20:46:53.000Z
2022-03-29T00:59:26.000Z
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1993 -- All Rights Reserved PROJECT: PC/GEOS MODULE: Chart Library FILE: seriesSpider.asm AUTHOR: Vijay Menon, Aug 5, 1993 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- VM 8/ 5/93 Initial revision DESCRIPTION: SpiderClass $Id: seriesSpider.asm,v 1.1 97/04/04 17:47:05 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SpiderRealize %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Realize a series of data CALLED BY: MSG_CHART_OBJECT_REALIZE PASS: *ds:si = SpiderClass object ds:di = SpiderClass instance data ds:bx = SpiderClass object (same as *ds:si) es = segment of SpiderClass ax = message # RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- VM 8/ 5/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SpiderRealize method dynamic SpiderClass, MSG_CHART_OBJECT_REALIZE uses ax,cx,dx locals local SeriesDrawLocalVars .enter inherit mov cl, locals.SDLV_seriesNum mov ax, offset SetPointInDataBlock mov locals.SDLV_callback, ax clr locals.SDLV_pointer clr locals.SDLV_numPoints ; Compute the point for each category. call SeriesDrawEachCategory ; Add the first point again on the end, so a line is drawn ; from the last point to the first point. push si mov cl, locals.SDLV_seriesNum clr ch clr dx mov si, locals.SDLV_valueAxis mov ax, MSG_AXIS_GET_VALUE_POSITION call ObjCallInstanceNoLock pop si mov bx, ax mov ax, cx call SetPointCommon call LineOrScatterCreateOrUpdatePolyline inc locals.SDLV_seriesNum .leave mov di, offset SpiderClass GOTO ObjCallSuperNoLock SpiderRealize endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SpiderGetMaxTextBounds %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Determine the largest bounds of the text objects for the Spider chart CALLED BY: MSG_CHART_OBJECT_GET_MAX_TEXT_SIZE PASS: *ds:si = SpiderClass object ds:di = SpiderClass instance data ds:bx = SpiderClass object (same as *ds:si) es = segment of SpiderClass ax = message # cx, dx = current max bp = series # RETURN: cx, dx, bp updated DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- VM 8/18/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CALC_TEXT_BOUNDS_FUDGE_FACTOR equ 4 SpiderGetMaxTextBounds method dynamic SpiderClass, MSG_CHART_OBJECT_GET_MAX_TEXT_SIZE currentMax local Point push dx, cx .enter sub sp, CHART_TEXT_BUFFER_SIZE mov di, sp segmov es, ss call UtilGetChartAttributes test dx, mask CF_CATEGORY_TITLES jz nothing mov ax, MSG_CHART_GROUP_GET_CATEGORY_COUNT call UtilCallChartGroup dec cx ; Loop through each category to find the maximum height and ; width of any text. categoryLoop: push cx push bp mov dx, ss mov bp, di mov ax, MSG_CHART_GROUP_GET_CATEGORY_TITLE call UtilCallChartGroup pop bp ; ; If there's really no text there, then just return zero (XXX: ; Maybe UtilGetTextSize should do this). ; cmp {char} es:[di], 0 je continue call UtilGetTextSize ; cx, dx - width, height add cx, CALC_TEXT_BOUNDS_FUDGE_FACTOR add dx, CALC_TEXT_BOUNDS_FUDGE_FACTOR Max ss:[currentMax].P_x, cx Max ss:[currentMax].P_y, dx continue: pop cx dec cx jns categoryLoop mov cx, ss:[currentMax].P_x mov dx, ss:[currentMax].P_y done: add sp, CHART_TEXT_BUFFER_SIZE .leave ret nothing: clr cx, dx jmp done SpiderGetMaxTextBounds endm
21.461538
79
0.597372
2da46e0d3b0ec8ba954938c1bf69acce0ecf917d
1,030
asm
Assembly
Transynther/x86/_processed/US/_zr_/i7-7700_9_0xca_notsx.log_13_1251.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/US/_zr_/i7-7700_9_0xca_notsx.log_13_1251.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/US/_zr_/i7-7700_9_0xca_notsx.log_13_1251.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
3
2020-07-14T17:07:07.000Z
2022-03-21T01:12:22.000Z
.global s_prepare_buffers s_prepare_buffers: ret .global s_faulty_load s_faulty_load: push %r11 push %r14 push %r8 push %r9 push %rax push %rbp push %rdx // Store lea addresses_UC+0xbc35, %r8 clflush (%r8) cmp %rbp, %rbp mov $0x5152535455565758, %r11 movq %r11, %xmm7 movups %xmm7, (%r8) nop nop add $17016, %r9 // Faulty Load lea addresses_US+0x1c7c, %rbp nop nop nop nop cmp $55669, %rdx mov (%rbp), %r9w lea oracles, %r11 and $0xff, %r9 shlq $12, %r9 mov (%r11,%r9,1), %r9 pop %rdx pop %rbp pop %rax pop %r9 pop %r8 pop %r14 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': False, 'type': 'addresses_US'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_UC'}, 'OP': 'STOR'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': True, 'type': 'addresses_US'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'00': 13} 00 00 00 00 00 00 00 00 00 00 00 00 00 */
17.758621
122
0.64466
13d3f9989dad6f40c892c6cd5ac526f84de35703
642
asm
Assembly
oeis/314/A314903.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/314/A314903.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/314/A314903.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A314903: Coordination sequence Gal.6.339.2 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; Submitted by Jon Maiga ; 1,5,9,14,19,24,30,36,41,46,51,55,60,65,69,74,79,84,90,96,101,106,111,115,120,125,129,134,139,144,150,156,161,166,171,175,180,185,189,194,199,204,210,216,221,226,231,235,240,245 mov $1,$0 seq $1,314108 ; Coordination sequence Gal.6.198.6 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. mov $2,$0 mul $0,7 sub $0,1 mod $0,$1 mul $2,3 add $0,$2 add $0,1
45.857143
182
0.73053
f041335063acde9bf222c575ea7a95e291e31b6c
463
asm
Assembly
oeis/289/A289896.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/289/A289896.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/289/A289896.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A289896: Number of (undirected) cycles in the n-triangular honeycomb rook graph. ; 0,0,1,8,45,242,1414,9432,72246,628260,6116319,65856928,776628203,9950798214,137612550620,2042588039056,32384583304092,546155914771464,9761655297881037,184309987662192600,3665514979650544153,76586509823743735706,1677182881414143407490 lpb $0 mov $2,$0 sub $0,1 seq $2,119913 ; Number of directed simple cycles in the complete graph K_n. add $3,$2 lpe mov $0,$3 div $0,2
38.583333
235
0.792657
7f4e6ff070e2caec56c10fd92022bbf9f0f435d9
111,666
asm
Assembly
projects/Kirbys_Dream_Land_2.windfish/disassembly/bank_07.asm
jverkoey/awaken
743755248996deb7181ae92f6e60be5656439c44
[ "Apache-2.0" ]
68
2020-12-16T10:06:48.000Z
2022-03-29T19:54:01.000Z
projects/Kirbys_Dream_Land_2.windfish/disassembly/bank_07.asm
jverkoey/awaken
743755248996deb7181ae92f6e60be5656439c44
[ "Apache-2.0" ]
62
2020-12-19T04:28:41.000Z
2021-02-15T22:18:16.000Z
projects/Kirbys_Dream_Land_2.windfish/disassembly/bank_07.asm
jverkoey/awaken
743755248996deb7181ae92f6e60be5656439c44
[ "Apache-2.0" ]
4
2021-01-17T03:51:22.000Z
2021-01-21T16:26:53.000Z
SECTION "ROM Bank 07", ROMX[$4000], BANK[$07] toc_07_4000: assign [$DA3B], $01 assign [$DA3A], $02 ld hl, $DA3C ld bc, $BC00 ld [hl], c inc hl ld [hl], b xor a ld hl, $DA30 ldi [hl], a ld [hl], a ld [$DA0E], a ret toc_07_401D: ld hl, $D900 .loop_07_4020: ld b, $08 .loop_07_4022: rrc l rla dec b jr nz, .loop_07_4022 ldi [hl], a inc a jr nz, .loop_07_4020 ret db $3B, $3D, $FF, $02, $FF, $70, $98, $48 db $68, $B8, $BA, $3C, $3B, $FF, $02, $FF db $18, $60, $18, $38, $B9, $B8, $3B, $0C db $FF, $02, $07, $07, $07, $07, $05, $00 db $FF, $60, $F8, $68, $A0, $D0, $30, $30 db $B0, $F0, $00, $80, $D0, $A8, $F8, $30 db $60, $B8, $58, $B8, $E8, $28, $58, $88 db $18, $18, $B8, $B8, $80, $50, $50, $00 db $00, $44, $98, $44, $38, $50, $50, $60 db $50, $30, $70, $28, $70, $40, $60, $30 db $48, $60, $58, $30, $38, $30, $68, $50 db $50, $68, $50, $68, $38, $38, $68, $50 db $38, $68, $40, $60, $64, $68, $3C, $B8 db $BB, $BB, $BB, $BB, $BB, $BC, $BC, $BC db $BB, $BC, $BC, $BB, $BB, $BB, $BB, $BB db $BC, $BC, $BB, $BB, $BB, $BB, $BB, $BC db $BC, $BB, $BB, $BB, $BC, $BB, $BC, $BB db $BC, $BC, $3F, $3B, $FF, $02, $FF, $60 db $60, $28, $38, $CE, $B8, $40, $3B, $FF db $03, $00, $00, $00, $00, $00, $00, $00 db $FF, $98, $98, $60, $48, $58, $38, $CF db $D3, $B8, $41, $3B, $FF, $02, $FF, $88 db $60, $68, $38, $D0, $B8 toc_07_40E2: ld hl, $CC00 ld a, [$DB5F] inc a ld b, a jr .toc_07_40F3 .loop_07_40EC: ldi a, [hl] sub a, $BD cp $10 jr c, .else_07_40F9 .toc_07_40F3: dec b jr nz, .loop_07_40EC ld a, [$DB60] .else_07_40F9: add a, $24 ld e, a cbcallNoInterrupts $1E, $6002 ret toc_07_4105: ifEq [$DB61], $08, .return_07_4120 ld a, [$DB60] ld hl, $4121 add a, l ld l, a jr nc, .else_07_4117 inc h .else_07_4117: ld e, [hl] cbcallNoInterrupts $1E, $606D .return_07_4120: ret db $04, $00, $05, $08, $00, $00, $09 toc_07_4128: ld a, [$DEFF] or a ret nz ld hl, $CC00 ld a, [$DB5F] inc a ld b, a jr .toc_07_413C .loop_07_4137: ldi a, [hl] cp $B2 jr z, .else_07_4141 .toc_07_413C: dec b jr nz, .loop_07_4137 jr .else_07_4155 .else_07_4141: ld a, [$DB60] call toc_01_0663 ld hl, $DD63 and [hl] jr nz, .else_07_4155 assign [$DB6F], $12 ld e, a jr .else_07_41AD .else_07_4155: ld a, [$DB73] or a ld a, $FF jr nz, .else_07_417B ld a, [$DB60] ld hl, $41B6 add a, a add a, l ld l, a jr nc, .else_07_4169 inc h .else_07_4169: ldi a, [hl] ld h, [hl] ld l, a ld a, [$DB61] sub a, $08 jr nc, .else_07_4175 ld a, $02 .else_07_4175: add a, l ld l, a jr nc, .else_07_417A inc h .else_07_417A: ld a, [hl] .else_07_417B: ld [$DB6F], a __ifNotZero [$DB38], .else_07_418A clear [$DB38] jr .return_07_41B5 .else_07_418A: ld a, [$DB6F] ld e, a ifLt [$DB61], $08, .else_07_41AD ld a, [$A071] or a jr nz, .else_07_41A4 ld a, [$DDE4] inc a cp e jr z, .return_07_41B5 jr .else_07_41AD .else_07_41A4: ld hl, $41D8 add a, l ld l, a jr nc, .else_07_41AC inc h .else_07_41AC: ld e, [hl] .else_07_41AD: cbcallNoInterrupts $1F, $4232 .return_07_41B5: ret db $C4, $41, $C7, $41, $CA, $41, $CD, $41 db $D0, $41, $D3, $41, $D6, $41, $03, $13 db $05, $0A, $13, $08, $0C, $13, $1F, $22 db $13, $21, $23, $13, $01, $24, $13, $26 db $11, $FF, $10, $14, $09, $0B toc_07_41DC: ld hl, $DB51 ldi a, [hl] ld [$DA01], a sub a, $10 ld c, a ldi a, [hl] ld b, a jr nc, .else_07_41EB dec b .else_07_41EB: ldi a, [hl] ld [$DA00], a sub a, $10 ld e, a ld d, [hl] jr nc, .else_07_41F6 dec d .else_07_41F6: call toc_01_15E3 push hl call toc_01_15FC pop bc ld d, $0D ld e, $0B jr .else_07_421E .loop_07_4204: ld a, c add a, $10 ld c, a jr c, .else_07_4213 ld a, l add a, $40 ld l, a jr nc, .else_07_421E inc h jr .else_07_421E .else_07_4213: ld a, [$DB3D] add a, b ld b, a ld h, $98 ld a, l and %00011111 ld l, a .else_07_421E: push bc push hl push de jr .toc_07_4236 .loop_07_4223: inc c ld a, c and %00001111 jr z, .else_07_422D inc l inc l jr .toc_07_4236 .else_07_422D: ld a, c sub a, $10 ld c, a inc b ld a, l and %11100000 ld l, a .toc_07_4236: ld a, [bc] push bc ld c, a ld b, $C5 ld a, [bc] ldi [hl], a inc b ld a, [bc] ld [hl], a inc b ld a, l add a, $1F ld l, a ld a, [bc] ldi [hl], a inc b ld a, [bc] ld [hl], a ld a, l sub a, $21 ld l, a pop bc dec d jr nz, .loop_07_4223 pop de pop hl pop bc dec e jr nz, .loop_07_4204 ret toc_07_4259: ld hl, $DB51 ldi a, [hl] ld [$DA01], a sub a, $10 ld c, a ldi a, [hl] ld b, a jr nc, .else_07_4268 dec b .else_07_4268: ldi a, [hl] ld [$DA00], a sub a, $10 ld e, a ld d, [hl] jr nc, .else_07_4273 dec d .else_07_4273: ld a, e and %11110000 ld h, a ld a, [$DB56] sub a, h jr z, .else_07_4294 push bc push de rla jr nc, .else_07_4289 ld a, e add a, $A0 ld e, a jr nc, .else_07_4289 inc d .else_07_4289: ld a, h ld [$DB56], a ld a, $0D call toc_07_42BC pop de pop bc .else_07_4294: ld a, c and %11110000 ld h, a ld a, [$DB55] sub a, h jr z, .return_07_42BB rla jr nc, .else_07_42A8 ld a, c add a, $B0 ld c, a jr nc, .else_07_42A8 inc b .else_07_42A8: ld a, h ld [$DB55], a push bc ld bc, $0400 .loop_07_42B0: dec bc ld a, b or c jr nz, .loop_07_42B0 pop bc ld a, $0B call toc_07_4318 .return_07_42BB: ret toc_07_42BC: ld [$FF84], a ld [hDMARegion], a call toc_01_15FC push hl call toc_01_15E3 ld b, h ld c, l pop de ld a, [$DA22] ld l, a ld a, [$DA28] ld h, a jr .toc_07_42E9 .loop_07_42D4: ld [$FF84], a inc c ld a, c and %00001111 jr z, .else_07_42E0 inc e inc e jr .toc_07_42E9 .else_07_42E0: ld a, c sub a, $10 ld c, a inc b ld a, e and %11100000 ld e, a .toc_07_42E9: ld [hl], e inc l ld [hl], d inc l ld a, [bc] push bc ld c, a ld b, $C5 ld a, [bc] ldi [hl], a inc b ld a, [bc] ldi [hl], a inc b ld a, [bc] ldi [hl], a inc b ld a, [bc] ldi [hl], a pop bc ld a, [$FF84] dec a jr nz, .loop_07_42D4 ld a, l ld [$DA22], a ld a, [$DA28] ld hl, $DA23 rra jr nc, .else_07_4313 ld hl, $DA24 .else_07_4313: ld a, [hDMARegion] add a, [hl] ld [hl], a ret toc_07_4318: ld [$FF84], a ld [hDMARegion], a call toc_01_15FC push hl call toc_01_15E3 ld b, h ld c, l pop de ld a, [$DA22] ld l, a ld a, [$DA28] ld h, a jr .else_07_434C .loop_07_4330: ld [$FF84], a ld a, c add a, $10 ld c, a jr c, .else_07_4341 ld a, e add a, $40 ld e, a jr nc, .else_07_434C inc d jr .else_07_434C .else_07_4341: ld a, [$DB3D] add a, b ld b, a ld d, $98 ld a, e and %00011111 ld e, a .else_07_434C: ld [hl], e inc l ld [hl], d inc l ld a, [bc] push bc ld c, a ld b, $C5 ld a, [bc] ldi [hl], a inc b ld a, [bc] ldi [hl], a inc b ld a, [bc] ldi [hl], a inc b ld a, [bc] ldi [hl], a pop bc ld a, [$FF84] dec a jr nz, .loop_07_4330 ld a, l ld [$DA22], a ld a, [$DA28] ld hl, $DA23 rra jr nc, .else_07_4376 ld hl, $DA24 .else_07_4376: ld a, [hDMARegion] add a, [hl] ld [hl], a ret db $C5, $D5, $E5, $CD, $E3, $15, $44, $4D db $E1, $F0, $80, $5F, $18, $0B, $0C, $79 db $E6, $0F, $20, $05, $79, $D6, $10, $4F db $04, $2A, $02, $1D, $20, $F0, $F0, $80 db $D1, $C1, $C3, $BC, $42 toc_07_43A0: ld hl, $DB51 ldi a, [hl] sub a, $10 ld c, a ldi a, [hl] ld b, a jr nc, .else_07_43AC dec b .else_07_43AC: ldi a, [hl] sub a, $10 ld e, a ld d, [hl] jr nc, .else_07_43B4 dec d .else_07_43B4: ld a, $0B .loop_07_43B6: push af push bc push de ld a, $0D call toc_07_441E pop hl ld de, $0010 add hl, de ld d, h ld e, l pop bc pop af dec a jr nz, .loop_07_43B6 ret toc_07_43CB: ld hl, $DB51 ldi a, [hl] sub a, $10 ld c, a ldi a, [hl] ld b, a jr nc, .else_07_43D7 dec b .else_07_43D7: ldi a, [hl] sub a, $10 ld e, a ld d, [hl] jr nc, .else_07_43DF dec d .else_07_43DF: ld a, e and %11110000 ld h, a ld a, [$DB7E] sub a, h jr z, .else_07_4400 push bc push de rla jr nc, .else_07_43F5 ld a, e add a, $A0 ld e, a jr nc, .else_07_43F5 inc d .else_07_43F5: ld a, h ld [$DB7E], a ld a, $0D call toc_07_441E pop de pop bc .else_07_4400: ld a, c and %11110000 ld h, a ld a, [$DB7D] sub a, h jr z, .return_07_441D rla jr nc, .else_07_4414 ld a, c add a, $C0 ld c, a jr nc, .else_07_4414 inc b .else_07_4414: ld a, h ld [$DB7D], a ld a, $0B call toc_07_4493 .return_07_441D: ret toc_07_441E: swap a ld [hDMARegion], a ld a, [$DB3E] dec a cp d ret c ld a, d ld [$FF83], a ld a, e and %11110000 ld e, a ld a, c and %11110000 ld c, a .toc_07_4433: ld a, [$DB3D] dec a cp b jr nc, .else_07_4445 ld a, [hDMARegion] add a, c ret nc ld [hDMARegion], a inc b ld c, $00 jr .toc_07_4433 .else_07_4445: ld a, b ld [$FF82], a ld hl, $CD35 ld a, d add a, l ld l, a ld a, b rlca add a, [hl] ld l, a ld h, $CD ldi a, [hl] ld d, a ld l, [hl] ld a, [hDMARegion] add a, c ld b, $FF jr c, .else_07_4461 ld b, a dec b xor a .else_07_4461: ld [hDMARegion], a inc d jr .toc_07_4480 .loop_07_4466: ld h, $CB ld a, [hl] and %11110000 cp e jr nz, .else_07_447F ld h, $CA ld a, [hl] cp c jr c, .else_07_447F scf sbc b jr nc, .else_07_447F ld h, $BB ld a, [hl] or a call z, toc_07_4508 .else_07_447F: inc l .toc_07_4480: dec d jr nz, .loop_07_4466 ld a, [hDMARegion] or a ret z ld a, [$FF83] ld d, a ld a, [$FF82] ld b, a inc b ld c, $00 jp .toc_07_4433 toc_07_4493: swap a ld [hDMARegion], a ld a, [$DB3D] dec a cp b ret c ld a, b ld [$FF82], a ld a, c and %11110000 ld c, a ld a, e and %11110000 ld e, a .toc_07_44A8: ld a, [$DB3E] dec a cp d jr nc, .else_07_44BA ld a, [hDMARegion] add a, e ret nc ld [hDMARegion], a inc d ld e, $00 jr .toc_07_44A8 .else_07_44BA: ld a, d ld [$FF83], a ld hl, $CD35 ld a, d add a, l ld l, a ld a, b rlca add a, [hl] ld l, a ld h, $CD ldi a, [hl] ld b, a ld l, [hl] ld a, [hDMARegion] add a, e ld d, $FF jr c, .else_07_44D6 ld d, a dec d xor a .else_07_44D6: ld [hDMARegion], a inc b jr .toc_07_44F5 .loop_07_44DB: ld h, $CA ld a, [hl] and %11110000 cp c jr nz, .else_07_44F4 ld h, $CB ld a, [hl] cp e jr c, .else_07_44F4 scf sbc d jr nc, .else_07_44F4 ld h, $BB ld a, [hl] or a call z, toc_07_4508 .else_07_44F4: inc l .toc_07_44F5: dec b jr nz, .loop_07_44DB ld a, [hDMARegion] or a ret z ld a, [$FF82] ld b, a ld a, [$FF83] ld d, a inc d ld e, $00 jp .toc_07_44A8 toc_07_4508: push bc push de push hl ld h, $CA ld c, [hl] ld h, $CB ld e, [hl] ld a, [$FF82] ld b, a ld a, [$FF83] ld d, a ld h, $CC ld l, [hl] ld h, $7A push hl ld a, [hl] ld hl, $A8B2 call toc_01_07C4 ld d, h pop hl ld a, d or a jr z, .else_07_4580 inc h ld e, $5C ld a, [hl] swap a and %00001111 ld [de], a ld e, $5B ld a, [hl] and %00001111 ld [de], a inc h ld e, $4C ld a, [hl] ld [de], a inc h ld e, $4A ld a, [hl] ld [de], a inc h inc e ld a, [hl] ld [de], a ld e, $62 ld a, $FF ld [de], a inc h ld a, [hl] ld bc, $0005 ld hl, $DB7F jr .toc_07_4557 .loop_07_4556: add hl, bc .toc_07_4557: cp [hl] jr nz, .loop_07_4556 inc hl ld e, $46 ldi a, [hl] ld [de], a ld e, $18 ldi a, [hl] ld [de], a dec e ldi a, [hl] ld [de], a dec e ld a, [hl] ld [de], a ld e, $5E ld a, $08 ld [de], a inc e ld [de], a ld e, $60 xor a ld [de], a inc e ld [de], a pop hl ld [hl], $01 ld e, $49 ld a, l ld [de], a pop de pop bc ret .else_07_4580: pop hl pop de pop bc ret toc_07_4584: ld a, [$DB57] ld b, a ld hl, $DBCF ld d, $BB .loop_07_458D: inc hl .toc_07_458E: ldi a, [hl] or a ret z ldi a, [hl] cp b jr nz, .loop_07_458D ldi a, [hl] ld e, a ld a, $01 ld [de], a jr .toc_07_458E toc_07_459C: inc e ld hl, $DBD0 ld b, h ld c, l .toc_07_45A2: ldi a, [hl] or a jr z, .else_07_45B7 cp e jr nz, .else_07_45AD inc hl inc hl jr .toc_07_45A2 .else_07_45AD: ld [bc], a inc bc ldi a, [hl] ld [bc], a inc bc ldi a, [hl] ld [bc], a inc bc jr .toc_07_45A2 .else_07_45B7: xor a ld [bc], a ld a, c ld [$DCFD], a ld a, b ld [$DCFE], a ret db $0F, $4C, $00, $17, $F6, $0D, $10, $51 db $0E, $16, $F9, $45, $1A, $47, $42, $47 db $5C, $47, $86, $47, $B9, $47, $ED, $47 db $6F, $48, $9A, $47, $B4, $46, $BE, $49 db $28, $4A, $45, $4A, $DA, $4A, $11, $4B db $5C, $4B, $CA, $47, $92, $4B, $96, $4B db $A0, $4B, $CD, $4B, $D9, $4B, $16, $03 db $A4, $0D, $40, $04, $46, $72, $0B, $01 db $00, $0D, $11, $46, $05, $03, $0D, $62 db $46, $05, $03, $18, $05, $08, $16, $CD db $47, $06, $1E, $45, $12, $E6, $E0, $CB db $37, $1F, $1E, $3A, $12, $21, $58, $46 db $85, $6F, $30, $01, $24, $7E, $6F, $17 db $9F, $67, $1E, $07, $1A, $85, $12, $1C db $1A, $8C, $12, $1E, $3A, $1A, $21, $5A db $46, $85, $6F, $30, $01, $24, $7E, $6F db $17, $9F, $67, $1E, $04, $1A, $85, $12 db $1C, $1A, $8C, $12, $CD, $62, $46, $1E db $3A, $1A, $C6, $0A, $12, $C9, $FA, $FB db $00, $05, $06, $05, $00, $FB, $FA, $FB db $1E, $3A, $1A, $21, $89, $46, $87, $85 db $6F, $30, $01, $24, $1E, $0F, $2A, $12 db $1C, $7E, $12, $1E, $3A, $1A, $21, $8D db $46, $87, $85, $6F, $30, $01, $24, $1E db $0D, $2A, $12, $1C, $7E, $12, $C9, $00 db $FD, $00, $FE, $00, $00, $00, $02, $00 db $03, $00, $02, $00, $00, $00, $FE, $00 db $FD, $00, $FE, $00, $FE, $80, $FE, $00 db $00, $80, $01, $00, $02, $80, $01, $00 db $00, $80, $FE, $00, $FE, $80, $FE, $17 db $F6, $0D, $03, $A4, $0D, $40, $04, $46 db $72, $0B, $01, $00, $0D, $C7, $46, $05 db $0C, $18, $05, $04, $16, $CD, $47, $06 db $1E, $45, $12, $E6, $E0, $CB, $37, $1F db $21, $D8, $46, $C3, $EC, $46, $00, $FF db $4B, $FF, $00, $00, $B5, $00, $00, $01 db $B5, $00, $00, $00, $4B, $FF, $00, $FF db $4B, $FF, $87, $85, $6F, $30, $01, $24 db $1E, $0F, $2A, $12, $1C, $2A, $12, $23 db $23, $1E, $0D, $2A, $12, $1C, $2A, $12 db $C9, $87, $85, $6F, $30, $01, $24, $1E db $0F, $2A, $12, $1C, $2A, $12, $23, $23 db $1E, $0D, $2A, $12, $1C, $2A, $12, $C9 db $03, $A4, $0D, $40, $04, $89, $76, $0B db $19, $00, $02, $19, $01, $02, $19, $02 db $02, $0F, $47, $10, $05, $02, $0F, $47 db $00, $19, $03, $02, $19, $04, $02, $19 db $05, $02, $0F, $47, $10, $05, $02, $16 db $03, $A4, $0D, $40, $04, $89, $76, $0B db $19, $06, $02, $19, $07, $02, $19, $08 db $02, $19, $09, $02, $0F, $47, $10, $05 db $02, $16, $03, $80, $47, $47, $04, $52 db $6F, $0B, $26, $00, $FF, $08, $00, $00 db $2A, $F0, $0F, $47, $10, $19, $04, $02 db $0F, $47, $00, $05, $02, $19, $05, $02 db $0F, $47, $10, $05, $02, $16, $CD, $91 db $0C, $C3, $A4, $0D, $03, $A4, $0D, $40 db $04, $52, $6F, $0B, $19, $05, $04, $19 db $04, $02, $0F, $47, $10, $05, $02, $16 db $03, $A4, $0D, $40, $04, $52, $6F, $0B db $26, $00, $01, $08, $80, $FF, $09, $04 db $19, $04, $02, $19, $05, $02, $0A, $18 db $19, $04, $02, $19, $05, $02, $16, $04 db $52, $6F, $0B, $0F, $47, $10, $19, $06 db $04, $19, $05, $04, $19, $04, $04, $16 db $0F, $47, $10, $04, $83, $77, $0B, $09 db $02, $19, $00, $02, $19, $01, $02, $19 db $02, $02, $19, $03, $02, $19, $04, $02 db $19, $05, $02, $19, $06, $02, $19, $07 db $02, $0A, $16, $04, $86, $54, $08, $08 db $00, $FF, $0D, $04, $48, $03, $37, $48 db $47, $19, $13, $0A, $19, $14, $10, $01 db $15, $00, $1E, $04, $CD, $47, $06, $E6 db $0F, $D6, $08, $6F, $17, $9F, $67, $1A db $85, $12, $1C, $1A, $8C, $12, $1E, $07 db $1A, $D6, $04, $12, $1C, $1A, $DE, $00 db $12, $1E, $39, $CD, $47, $06, $E6, $03 db $12, $1E, $3A, $3E, $01, $12, $FA, $83 db $A0, $1E, $46, $12, $C9, $CD, $A4, $0D db $CD, $B3, $1A, $28, $04, $62, $C3, $BA db $0B, $1E, $3A, $1A, $3D, $12, $C0, $3E db $08, $12, $1E, $39, $1A, $3C, $E6, $03 db $12, $21, $67, $48, $87, $85, $6F, $30 db $01, $24, $2A, $66, $6F, $1E, $0D, $7D db $12, $1C, $7C, $12, $C9, $80, $00, $20 db $00, $80, $FF, $E0, $FF, $04, $86, $54 db $08, $0D, $8C, $48, $24, $1F, $03, $A4 db $0D, $40, $19, $16, $02, $19, $17, $04 db $19, $18, $04, $19, $19, $04, $19, $1A db $04, $16, $1E, $07, $1A, $E6, $F0, $12 db $FA, $83, $A0, $1E, $46, $12, $C9, $17 db $F6, $0D, $03, $A4, $0D, $40, $04, $52 db $6F, $0B, $0F, $3A, $00, $0D, $C9, $48 db $05, $03, $19, $07, $03, $0D, $C9, $48 db $19, $08, $03, $19, $09, $03, $0D, $C9 db $48, $19, $0A, $03, $19, $07, $03, $04 db $46, $72, $0B, $19, $00, $08, $16, $1E db $3A, $1A, $21, $E4, $48, $87, $85, $6F db $30, $01, $24, $2A, $66, $6F, $1E, $39 db $1A, $CD, $EC, $46, $1E, $3A, $1A, $3C db $12, $C9, $EA, $48, $FE, $48, $12, $49 db $00, $FA, $C2, $FB, $00, $00, $3E, $04 db $00, $06, $3E, $04, $00, $00, $C2, $FB db $00, $FA, $C2, $FB, $00, $FD, $E1, $FD db $00, $00, $1F, $02, $00, $03, $1F, $02 db $00, $00, $E1, $FD, $00, $FD, $E1, $FD db $80, $FE, $F1, $FE, $00, $00, $0F, $01 db $80, $01, $0F, $01, $00, $00, $F1, $FE db $80, $FE, $F1, $FE, $17, $F6, $0D, $03 db $B5, $49, $47, $04, $52, $6F, $0B, $22 db $9A, $49, $07, $10, $39, $0E, $03, $3F db $49, $68, $49, $75, $49, $07, $00, $00 db $08, $00, $FE, $29, $00, $2A, $3A, $05 db $0A, $07, $80, $00, $08, $80, $FF, $29 db $00, $2A, $00, $05, $04, $07, $00, $04 db $08, $00, $01, $29, $C0, $2A, $00, $05 db $14, $2A, $E0, $05, $28, $16, $07, $00 db $FE, $08, $00, $FE, $29, $10, $2A, $30 db $05, $28, $16, $07, $00, $04, $08, $00 db $FE, $29, $8E, $2A, $36, $05, $0A, $07 db $80, $00, $08, $80, $FF, $29, $00, $2A db $00, $05, $04, $07, $00, $FC, $08, $00 db $02, $29, $30, $2A, $D0, $05, $32, $16 db $19, $01, $03, $19, $02, $03, $19, $0B db $03, $19, $0C, $03, $19, $0D, $03, $19 db $0E, $03, $19, $0F, $03, $19, $10, $03 db $06, $9A, $49, $CD, $80, $0C, $CD, $91 db $0C, $C3, $A4, $0D, $0F, $4C, $01, $0D db $D3, $49, $03, $A4, $0D, $40, $04, $57 db $56, $0A, $19, $05, $02, $19, $06, $02 db $16, $C5, $62, $CD, $47, $06, $E6, $1F db $5F, $D6, $10, $4F, $17, $9F, $47, $2E db $07, $7E, $81, $22, $7E, $88, $77, $CD db $47, $06, $E6, $1F, $D6, $10, $4F, $17 db $9F, $47, $2E, $04, $7E, $81, $22, $7E db $88, $77, $7B, $1F, $1F, $1F, $E6, $03 db $04, $06, $00, $20, $04, $06, $04, $EE db $03, $80, $21, $14, $4A, $CD, $EC, $46 db $C1, $C9, $00, $FE, $96, $FE, $00, $00 db $6A, $01, $00, $02, $6A, $01, $00, $00 db $96, $FE, $00, $FE, $96, $FE, $0F, $4C db $01, $04, $B8, $5D, $0A, $0D, $35, $4A db $05, $02, $16, $1E, $48, $1A, $67, $2E db $39, $7E, $1E, $15, $12, $2E, $45, $5D db $7E, $12, $C9, $0F, $4C, $01, $04, $48 db $64, $0A, $0D, $52, $4A, $05, $02, $16 db $1E, $48, $1A, $67, $2E, $3A, $7E, $1E db $15, $12, $2E, $45, $5D, $7E, $12, $C9 db $0F, $4C, $00, $17, $F6, $0D, $03, $A4 db $0D, $40, $0D, $93, $4A, $11, $7D, $4A db $04, $46, $72, $0B, $05, $02, $01, $00 db $05, $24, $16, $04, $52, $6F, $0B, $05 db $02, $09, $03, $19, $07, $03, $19, $08 db $03, $19, $09, $03, $19, $0A, $03, $0A db $16, $C5, $1E, $48, $1A, $67, $2E, $3D db $4E, $2D, $46, $2D, $C5, $CD, $47, $06 db $E6, $1F, $5F, $7E, $D6, $40, $D6, $0F db $83, $E0, $84, $CD, $1C, $29, $CD, $E0 db $28, $F0, $9A, $57, $1E, $0D, $79, $12 db $1C, $78, $12, $C1, $F0, $84, $CD, $1E db $29, $CD, $E0, $28, $F0, $9A, $57, $1E db $0F, $79, $12, $1C, $78, $12, $CD, $47 db $06, $E6, $03, $1E, $27, $12, $C1, $C9 db $17, $42, $03, $20, $00, $00, $21, $00 db $00, $24, $40, $03, $84, $4B, $47, $09 db $02, $21, $FE, $FF, $05, $02, $21, $01 db $00, $05, $02, $0A, $09, $02, $21, $FF db $FF, $05, $02, $21, $01, $00, $05, $02 db $0A, $09, $02, $21, $FF, $FF, $05, $02 db $21, $00, $00, $05, $02, $0A, $16, $17 db $42, $03, $20, $00, $00, $21, $00, $00 db $24, $40, $03, $84, $4B, $47, $09, $02 db $20, $01, $00, $21, $01, $00, $05, $02 db $20, $FE, $FF, $21, $00, $00, $05, $02 db $20, $00, $00, $21, $FF, $FF, $05, $02 db $20, $02, $00, $21, $00, $00, $05, $02 db $20, $FF, $FF, $21, $01, $00, $05, $02 db $20, $FF, $FF, $21, $FF, $FF, $05, $02 db $20, $01, $00, $21, $FF, $FF, $05, $02 db $0A, $16, $17, $42, $03, $20, $00, $00 db $21, $00, $00, $03, $84, $4B, $47, $09 db $02, $21, $FF, $FF, $05, $02, $21, $01 db $00, $05, $02, $0A, $09, $02, $21, $FF db $FF, $05, $02, $21, $00, $00, $05, $02 db $0A, $16, $21, $06, $DA, $1E, $07, $1A db $86, $22, $1E, $04, $1A, $86, $77, $C9 db $1B, $40, $4E, $03, $26, $40, $FE, $0D db $32, $10, $18, $06, $A7, $4B, $26, $C0 db $01, $0D, $32, $10, $E8, $03, $C4, $4B db $47, $04, $52, $6F, $0B, $08, $00, $FD db $2A, $20, $19, $04, $04, $19, $05, $02 db $19, $04, $02, $19, $05, $02, $19, $04 db $06, $16, $CD, $80, $0C, $CD, $91, $0C db $C3, $A4, $0D, $0D, $D3, $4B, $06, $D9 db $4B, $1E, $45, $1A, $2F, $12, $C9, $03 db $1D, $4C, $47, $08, $00, $04, $05, $06 db $16, $18, $2A, $E0, $26, $40, $02, $0D db $32, $10, $EE, $03, $C4, $4B, $47, $0D db $A5, $1A, $12, $05, $4C, $04, $52, $6F db $0B, $19, $04, $02, $19, $05, $03, $19 db $04, $03, $16, $04, $86, $54, $08, $0D db $16, $4C, $19, $14, $02, $19, $15, $03 db $19, $14, $03, $16, $FA, $83, $A0, $1E db $46, $12, $C9, $CD, $A4, $0D, $21, $AF db $FF, $3E, $03, $22, $3E, $00, $22, $3E db $00, $22, $CD, $88, $1C, $30, $08, $1E db $07, $01, $E3, $4B, $C3, $46, $08, $C9 db $0F, $39, $07, $0F, $3A, $07, $17, $FF db $0D, $10, $5A, $0E, $1E, $51, $4D, $BB db $4D, $FA, $4E, $FA, $4E, $FA, $4E, $FA db $4E, $56, $4E, $FA, $4E, $A4, $4F, $21 db $50, $2B, $51, $4B, $52, $C7, $52, $2C db $53, $D4, $53, $09, $54, $29, $54, $9B db $54, $C6, $54, $FD, $51, $A9, $52, $B8 db $52, $8C, $55, $B5, $4D, $D2, $55, $DB db $55, $E1, $55, $FB, $55, $AF, $4D, $4D db $4E, $0F, $46, $00, $18, $0F, $4C, $00 db $10, $5A, $0E, $1E, $CA, $4C, $CA, $4C db $CA, $4C, $CA, $4C, $CA, $4C, $CA, $4C db $CA, $4C, $CA, $4C, $CA, $4C, $CA, $4C db $CA, $4C, $CA, $4C, $CA, $4C, $CA, $4C db $E5, $4C, $CA, $4C, $CA, $4C, $CA, $4C db $CA, $4C, $CA, $4C, $CA, $4C, $CA, $4C db $CA, $4C, $CA, $4C, $CA, $4C, $CA, $4C db $CA, $4C, $CA, $4C, $CA, $4C, $CA, $4C db $03, $A4, $0D, $40, $04, $52, $6F, $0B db $0F, $47, $10, $19, $06, $04, $19, $05 db $04, $19, $04, $04, $16, $18, $29, $00 db $06, $EC, $4C, $26, $00, $02, $0D, $32 db $10, $F0, $0F, $5A, $06, $0F, $4C, $02 db $0F, $39, $10, $0F, $3A, $10, $03, $39 db $4D, $47, $24, $11, $0F, $47, $00, $04 db $83, $77, $0B, $19, $00, $02, $19, $01 db $02, $19, $02, $02, $19, $03, $02, $19 db $04, $02, $19, $05, $02, $19, $06, $02 db $19, $07, $02, $19, $00, $02, $19, $01 db $02, $19, $02, $02, $19, $03, $02, $0F db $47, $10, $19, $04, $02, $19, $05, $02 db $19, $06, $02, $19, $07, $02, $16, $CD db $80, $0C, $CD, $A4, $0D, $CD, $97, $4D db $CD, $7F, $19, $30, $09, $1E, $0D, $AF db $12, $1C, $12, $1E, $11, $12, $C9, $0F db $4C, $01, $03, $76, $4D, $47, $04, $52 db $6F, $0B, $01, $03, $26, $00, $04, $05 db $08, $26, $00, $01, $05, $03, $26, $80 db $00, $05, $02, $26, $55, $00, $05, $02 db $18, $05, $08, $16, $CD, $A4, $0D, $CD db $90, $4D, $30, $04, $62, $C3, $BA, $0B db $CD, $7F, $19, $30, $08, $1E, $07, $01 db $83, $4C, $C3, $46, $08, $C9, $CD, $EA db $1A, $3E, $FF, $18, $06, $CD, $EA, $1A db $FA, $5B, $A0, $EA, $15, $DF, $CD, $8F db $3B, $38, $05, $F0, $9A, $57, $A7, $C9 db $F0, $9A, $57, $37, $C9, $0F, $4C, $0A db $06, $C4, $4D, $0F, $4C, $04, $06, $C4 db $4D, $0F, $4C, $0A, $0D, $A5, $1A, $12 db $05, $4E, $03, $DE, $4D, $47, $04, $52 db $6F, $0B, $26, $00, $04, $19, $07, $03 db $19, $08, $03, $19, $09, $03, $19, $0A db $03, $06, $CF, $4D, $CD, $A4, $0D, $CD db $90, $4D, $30, $04, $62, $C3, $BA, $0B db $CD, $7F, $19, $30, $15, $1E, $2E, $21 db $99, $42, $3E, $1E, $CD, $CF, $05, $F0 db $9A, $57, $1E, $07, $01, $83, $4C, $C3 db $46, $08, $C9, $18, $03, $1E, $4E, $47 db $04, $52, $6F, $0B, $09, $0A, $19, $07 db $03, $19, $08, $03, $19, $09, $03, $19 db $0A, $03, $0A, $16, $1E, $04, $01, $30 db $00, $CD, $35, $0D, $CD, $A4, $0D, $CD db $90, $4D, $30, $04, $62, $C3, $BA, $0B db $CD, $7F, $19, $30, $15, $1E, $2E, $21 db $99, $42, $3E, $1E, $CD, $CF, $05, $F0 db $9A, $57, $1E, $07, $01, $83, $4C, $C3 db $46, $08, $C9, $0F, $4C, $14, $0F, $5A db $06, $06, $5F, $4E, $0F, $4C, $14, $0D db $A5, $1A, $12, $A6, $4E, $03, $85, $4E db $47, $04, $52, $6F, $0B, $26, $00, $04 db $19, $01, $03, $19, $02, $03, $19, $0B db $03, $19, $0C, $03, $19, $0D, $03, $19 db $0E, $03, $19, $0F, $03, $19, $10, $03 db $06, $6A, $4E, $CD, $A4, $0D, $CD, $90 db $4D, $CD, $7F, $19, $30, $15, $1E, $26 db $21, $99, $42, $3E, $1E, $CD, $CF, $05 db $F0, $9A, $57, $1E, $07, $01, $83, $4C db $C3, $46, $08, $C9, $18, $03, $CB, $4E db $47, $04, $52, $6F, $0B, $09, $05, $19 db $01, $03, $19, $02, $03, $19, $0B, $03 db $19, $0C, $03, $19, $0D, $03, $19, $0E db $03, $19, $0F, $03, $19, $10, $03, $0A db $16, $1E, $04, $01, $30, $00, $CD, $35 db $0D, $CD, $A4, $0D, $CD, $90, $4D, $30 db $04, $62, $C3, $BA, $0B, $CD, $7F, $19 db $30, $15, $1E, $26, $21, $99, $42, $3E db $1E, $CD, $CF, $05, $F0, $9A, $57, $1E db $07, $01, $83, $4C, $C3, $46, $08, $C9 db $0F, $4C, $03, $03, $8A, $4F, $47, $04 db $68, $59, $0A, $24, $1E, $0D, $23, $4F db $19, $03, $02, $19, $04, $02, $19, $03 db $02, $19, $04, $02, $19, $05, $02, $19 db $06, $02, $19, $05, $02, $19, $06, $02 db $16, $C5, $FA, $70, $A0, $B7, $0E, $00 db $28, $02, $0E, $03, $1E, $48, $1A, $67 db $2E, $39, $7E, $81, $21, $66, $4F, $87 db $85, $6F, $30, $01, $24, $2A, $66, $6F db $2A, $4F, $2A, $47, $1E, $45, $1A, $17 db $30, $0A, $79, $2F, $C6, $01, $4F, $78 db $2F, $CE, $00, $47, $1E, $0D, $79, $12 db $1C, $78, $12, $1C, $2A, $12, $1C, $2A db $12, $1C, $C1, $C9, $72, $4F, $76, $4F db $7A, $4F, $7E, $4F, $82, $4F, $86, $4F db $D0, $01, $28, $FF, $00, $02, $00, $00 db $D0, $01, $D8, $00, $74, $00, $CA, $FF db $80, $00, $00, $00, $74, $00, $36, $00 db $CD, $A4, $0D, $CD, $97, $4D, $30, $04 db $62, $C3, $BA, $0B, $CD, $7F, $19, $30 db $08, $1E, $07, $01, $83, $4C, $C3, $46 db $08, $C9, $0F, $4C, $05, $03, $07, $50 db $47, $04, $1A, $61, $0A, $0D, $A5, $1A db $12, $C1, $4F, $26, $A0, $01, $19, $03 db $02, $19, $04, $02, $06, $B8, $4F, $26 db $80, $00, $19, $03, $02, $19, $04, $02 db $19, $03, $02, $19, $04, $02, $0F, $39 db $05, $0F, $3A, $05, $19, $05, $02, $19 db $06, $02, $19, $05, $02, $19, $06, $02 db $0F, $39, $03, $0F, $3A, $03, $19, $07 db $02, $19, $08, $02, $19, $07, $02, $19 db $08, $02, $0F, $39, $02, $0F, $3A, $02 db $19, $09, $02, $19, $0A, $02, $19, $09 db $02, $19, $0A, $02, $16, $CD, $A4, $0D db $CD, $97, $4D, $30, $04, $62, $C3, $BA db $0B, $CD, $7F, $19, $30, $08, $1E, $07 db $01, $83, $4C, $C3, $46, $08, $C9, $0F db $4C, $03, $03, $DB, $50, $47, $04, $B6 db $55, $0A, $0D, $A5, $1A, $12, $60, $50 db $0F, $3B, $00, $26, $00, $04, $05, $08 db $26, $00, $03, $05, $08, $26, $80, $01 db $05, $08, $26, $80, $00, $05, $08, $03 db $B0, $50, $47, $26, $80, $FF, $05, $08 db $26, $80, $FE, $05, $08, $26, $00, $FD db $05, $08, $26, $00, $FC, $00, $0F, $3B db $01, $26, $00, $02, $05, $10, $26, $80 db $01, $05, $10, $26, $C0, $00, $05, $10 db $26, $40, $00, $05, $10, $03, $B0, $50 db $47, $26, $C0, $FF, $05, $10, $26, $40 db $FF, $05, $10, $26, $80, $FE, $05, $10 db $26, $00, $FE, $00, $24, $41, $03, $0C db $51, $47, $0D, $A5, $1A, $12, $A5, $50 db $2A, $40, $26, $AB, $FE, $08, $00, $FE db $05, $14, $16, $2A, $10, $26, $56, $FF db $08, $00, $FF, $05, $28, $16, $CD, $A4 db $0D, $21, $09, $A0, $5D, $1A, $96, $C6 db $08, $FE, $10, $30, $1F, $2E, $0B, $5D db $1A, $96, $C6, $08, $FE, $10, $30, $14 db $1E, $0E, $21, $99, $42, $3E, $1E, $CD db $CF, $05, $F0, $9A, $57, $62, $C3, $BA db $0B, $CD, $A4, $0D, $1E, $3B, $1A, $B7 db $1E, $15, $FA, $0E, $DA, $20, $05, $E6 db $06, $0F, $18, $04, $E6, $0C, $0F, $0F db $C6, $03, $12, $CD, $97, $4D, $30, $04 db $62, $C3, $BA, $0B, $CD, $7F, $19, $30 db $08, $1E, $07, $01, $8E, $50, $C3, $46 db $08, $C9, $CD, $91, $0C, $CD, $94, $0C db $CD, $A4, $0D, $1E, $15, $FA, $0E, $DA db $E6, $0C, $0F, $0F, $C6, $03, $12, $CD db $97, $4D, $30, $04, $62, $C3, $BA, $0B db $C9, $17, $F6, $0D, $0F, $4C, $04, $03 db $94, $51, $47, $04, $4C, $5C, $0A, $26 db $00, $04, $0F, $09, $C0, $0D, $6C, $51 db $22, $61, $51, $07, $19, $03, $02, $19 db $04, $03, $19, $05, $02, $19, $06, $03 db $19, $07, $02, $19, $08, $03, $19, $09 db $02, $19, $0A, $03, $06, $46, $51, $2A db $10, $08, $00, $FF, $05, $20, $2A, $F0 db $00, $16, $C5, $62, $2E, $45, $7E, $17 db $3E, $E0, $01, $0A, $00, $30, $05, $3E db $20, $01, $F6, $FF, $2E, $11, $77, $2E db $3B, $3E, $80, $22, $71, $2C, $70, $2C db $3E, $80, $22, $3E, $F8, $22, $36, $FF db $C1, $C9, $CD, $C0, $51, $CD, $80, $0C db $CD, $91, $0C, $CD, $A4, $0D, $CD, $CE db $51, $CD, $97, $4D, $21, $09, $A0, $5D db $1A, $96, $C6, $08, $FE, $10, $30, $0D db $3E, $01, $EA, $7C, $A0, $1E, $07, $01 db $6B, $51, $C3, $46, $08, $C9, $1E, $03 db $62, $2E, $3B, $0E, $06, $2A, $12, $1C db $0D, $20, $FA, $C9, $21, $03, $A0, $1E db $3B, $42, $4D, $0A, $12, $86, $02, $1C db $2C, $0C, $0A, $12, $8E, $02, $1C, $2C db $0C, $0A, $12, $8E, $02, $1C, $2C, $0C db $0A, $12, $86, $02, $1C, $2C, $0C, $0A db $12, $8E, $02, $1C, $2C, $0C, $0A, $12 db $8E, $02, $C9, $17, $F6, $0D, $0F, $4C db $04, $03, $3C, $52, $47, $04, $4C, $5C db $0A, $26, $00, $02, $0D, $6C, $51, $22 db $21, $52, $07, $2A, $10, $08, $80, $FF db $05, $10, $2A, $F0, $05, $10, $16, $19 db $03, $02, $19, $04, $03, $19, $05, $02 db $19, $06, $03, $19, $07, $02, $19, $08 db $03, $19, $09, $02, $19, $0A, $03, $06 db $21, $52, $CD, $C0, $51, $CD, $80, $0C db $CD, $91, $0C, $CD, $A4, $0D, $C3, $CE db $51, $0F, $4C, $04, $03, $72, $52, $47 db $04, $C2, $62, $0A, $26, $33, $01, $19 db $03, $06, $19, $04, $06, $19, $05, $06 db $0F, $3A, $0C, $19, $06, $06, $0F, $3A db $10, $19, $07, $06, $19, $08, $23, $16 db $CD, $A4, $0D, $1E, $15, $1A, $FE, $07 db $30, $09, $CD, $97, $4D, $30, $27, $62 db $C3, $BA, $0B, $62, $01, $00, $00, $11 db $F9, $FF, $CD, $D9, $1A, $CD, $9A, $4D db $F5, $62, $01, $00, $00, $11, $07, $00 db $CD, $D9, $1A, $CD, $9A, $4D, $30, $03 db $F1, $18, $DC, $F1, $38, $D9, $C9, $26 db $80, $00, $08, $B7, $FF, $0D, $32, $10 db $14, $2A, $F2, $06, $CE, $52, $26, $80 db $00, $08, $49, $00, $0D, $32, $10, $14 db $2A, $0E, $06, $CE, $52, $26, $80, $00 db $0D, $32, $10, $19, $0F, $3C, $00, $0F db $4C, $02, $03, $F7, $52, $47, $04, $0C db $6A, $0A, $19, $03, $01, $19, $04, $02 db $19, $05, $03, $19, $06, $02, $19, $07 db $01, $19, $08, $02, $19, $09, $03, $19 db $0A, $02, $06, $DC, $52, $CD, $91, $0C db $CD, $80, $0C, $CD, $83, $0C, $CD, $A4 db $0D, $CD, $97, $4D, $30, $04, $62, $C3 db $BA, $0B, $CD, $7F, $19, $30, $08, $1E db $07, $01, $83, $4C, $C3, $46, $08, $CD db $B3, $1A, $20, $0D, $1E, $3C, $1A, $3C db $12, $FE, $10, $38, $04, $62, $C3, $BA db $0B, $C9, $0F, $4C, $02, $03, $C7, $53 db $47, $04, $74, $5D, $0A, $0D, $58, $53 db $0D, $51, $53, $12, $4D, $53, $09, $02 db $19, $02, $01, $19, $03, $01, $0A, $19 db $02, $01, $16, $19, $02, $01, $16, $FA db $70, $A0, $1E, $27, $12, $C9, $C5, $1E db $48, $1A, $67, $2E, $39, $46, $1E, $45 db $1A, $17, $21, $87, $53, $30, $03, $21 db $A7, $53, $78, $87, $85, $6F, $30, $01 db $24, $1E, $0F, $2A, $12, $1C, $2A, $12 db $01, $0E, $00, $09, $1E, $0D, $2A, $12 db $1C, $2A, $12, $C1, $C9, $00, $F8, $9C db $F8, $58, $FA, $F0, $FC, $00, $00, $10 db $03, $A8, $05, $64, $07, $00, $00, $10 db $03, $A8, $05, $64, $07, $00, $08, $64 db $07, $A8, $05, $10, $03, $00, $F8, $9C db $F8, $58, $FA, $F0, $FC, $00, $00, $10 db $03, $A8, $05, $64, $07, $00, $00, $F0 db $FC, $58, $FA, $9C, $F8, $00, $F8, $9C db $F8, $58, $FA, $F0, $FC, $CD, $A4, $0D db $CD, $97, $4D, $30, $04, $62, $C3, $BA db $0B, $C9, $0F, $4C, $04, $03, $E5, $53 db $47, $04, $B9, $63, $0A, $26, $00, $02 db $01, $04, $00, $CD, $A4, $0D, $CD, $97 db $4D, $30, $08, $1E, $07, $01, $83, $4C db $C3, $46, $08, $CD, $7F, $19, $30, $08 db $1E, $07, $01, $DF, $4C, $C3, $46, $08 db $F0, $A6, $CB, $4F, $20, $E5, $C9, $0F db $4C, $02, $03, $5C, $54, $47, $04, $ED db $6B, $0A, $08, $00, $04, $0F, $3B, $10 db $19, $07, $02, $19, $06, $02, $19, $09 db $02, $19, $08, $02, $06, $1A, $54, $0F db $4C, $02, $03, $5C, $54, $47, $04, $ED db $6B, $0A, $08, $00, $04, $0F, $3B, $10 db $19, $08, $02, $19, $09, $02, $19, $06 db $02, $19, $07, $02, $06, $3A, $54, $03 db $8E, $54, $47, $18, $19, $0A, $02, $19 db $0B, $02, $19, $0C, $02, $19, $0D, $02 db $16, $16, $CD, $A4, $0D, $CD, $97, $4D db $30, $04, $62, $C3, $BA, $0B, $CD, $7F db $19, $30, $08, $1E, $07, $01, $49, $54 db $C3, $46, $08, $1E, $3B, $1A, $3D, $20 db $04, $62, $C3, $BA, $0B, $12, $CD, $B3 db $1A, $20, $08, $1E, $07, $01, $5B, $54 db $C3, $46, $08, $C9, $CD, $A4, $0D, $CD db $97, $4D, $30, $04, $62, $C3, $BA, $0B db $C9, $0F, $4C, $08, $03, $AC, $54, $47 db $04, $2E, $70, $0A, $01, $00, $26, $00 db $04, $00, $CD, $A4, $0D, $CD, $97, $4D db $30, $04, $62, $C3, $BA, $0B, $CD, $7F db $19, $30, $08, $1E, $07, $01, $83, $4C db $C3, $46, $08, $C9, $0F, $4C, $02, $0D db $DF, $54, $03, $65, $55, $47, $04, $E7 db $6C, $0A, $19, $07, $04, $19, $08, $04 db $19, $09, $04, $16, $16, $C5, $1E, $48 db $1A, $67, $2E, $15, $7E, $3D, $2E, $45 db $CB, $7E, $28, $04, $D6, $05, $2F, $3C db $E0, $84, $21, $41, $55, $85, $6F, $30 db $01, $24, $7E, $4F, $17, $9F, $47, $1E db $04, $1A, $81, $12, $1C, $1A, $88, $12 db $F0, $84, $21, $47, $55, $85, $6F, $30 db $01, $24, $7E, $4F, $17, $9F, $47, $1E db $07, $1A, $81, $12, $1C, $1A, $88, $12 db $F0, $84, $21, $4D, $55, $87, $85, $6F db $30, $01, $24, $1E, $0F, $2A, $12, $1C db $2A, $12, $01, $0A, $00, $09, $1E, $0D db $2A, $12, $1C, $2A, $12, $C1, $C9, $08 db $03, $02, $FE, $FD, $F8, $08, $0A, $0F db $0F, $0A, $08, $00, $00, $2D, $01, $E7 db $01, $E7, $01, $2D, $01, $00, $00, $00 db $02, $9E, $01, $9E, $00, $62, $FF, $62 db $FE, $00, $FE, $CD, $A4, $0D, $CD, $97 db $4D, $30, $04, $62, $C3, $BA, $0B, $CD db $7F, $19, $30, $08, $1E, $07, $01, $83 db $4C, $C3, $46, $08, $CD, $B3, $1A, $20 db $08, $1E, $07, $01, $DE, $54, $C3, $46 db $08, $C9, $0F, $4C, $0A, $03, $B4, $55 db $47, $04, $86, $68, $0D, $18, $22, $A5 db $55, $07, $0D, $32, $10, $1C, $05, $10 db $29, $00, $00, $19, $0B, $03, $19, $0C db $03, $19, $0D, $03, $19, $0E, $03, $06 db $A5, $55, $1E, $3B, $1A, $3C, $12, $E6 db $02, $28, $02, $3E, $10, $1E, $47, $12 db $CD, $80, $0C, $CD, $A4, $0D, $CD, $90 db $4D, $30, $04, $62, $C3, $BA, $0B, $C9 db $26, $80, $02, $08, $80, $FE, $06, $E7 db $55, $26, $80, $03, $06, $E7, $55, $26 db $80, $02, $08, $80, $01, $0F, $4C, $0A db $03, $A4, $0D, $40, $04, $25, $47, $10 db $19, $12, $02, $19, $13, $02, $06, $F2 db $55, $0F, $4C, $14, $03, $23, $56, $47 db $04, $77, $4A, $10, $18, $22, $14, $56 db $07, $0D, $32, $10, $40, $05, $08, $29 db $00, $00, $19, $07, $03, $19, $08, $03 db $19, $07, $03, $19, $06, $03, $06, $14 db $56, $CD, $80, $0C, $C3, $A4, $0D, $5A db $6B, $0C, $00, $40, $0C, $70, $6B, $0C db $74, $40, $0C, $05, $6D, $0C, $65, $42 db $0C, $57, $6D, $0C, $4D, $43, $0C, $AC db $6F, $0C, $C8, $4A, $0C, $F1, $6E, $0C db $EF, $45, $0C, $6A, $6F, $0C, $FB, $46 db $0C, $CD, $6F, $0C, $18, $4B, $0C, $10 db $70, $0C, $DD, $4B, $0C, $86, $54, $08 db $D1, $47, $0C, $7C, $70, $0C, $2E, $49 db $0C, $CC, $70, $0C, $0F, $4A, $0C, $F8 db $70, $0C, $74, $4C, $0C, $0E, $71, $0C db $96, $4C, $0C, $45, $71, $0C, $6A, $4D db $0C, $92, $71, $0C, $22, $4E, $0C, $53 db $72, $0C, $CE, $4F, $0C, $D0, $74, $0C db $CC, $55, $0C, $45, $73, $0C, $CB, $52 db $0C, $21, $75, $0C, $BB, $57, $07, $42 db $75, $0C, $BB, $57, $07, $63, $75, $0C db $BB, $57, $07, $78, $75, $0C, $BB, $57 db $07, $99, $75, $0C, $8B, $56, $0C, $DE db $75, $0C, $84, $57, $0C, $8E, $77, $0C db $F3, $59, $0C, $CA, $78, $0C, $06, $5C db $0C, $0E, $7A, $0C, $63, $5F, $0C, $3F db $7B, $0C, $BB, $57, $07, $7B, $7B, $0C db $6D, $63, $0C, $DB, $7B, $0C, $31, $63 db $0C, $52, $6F, $0B, $BB, $57, $07, $EE db $7B, $0C, $F8, $63, $0C, $1A, $7D, $0C db $44, $67, $0C, $23, $7E, $0C, $F6, $69 db $0C, $4F, $7E, $0C, $A1, $6A, $0C, $9F db $72, $0D, $84, $4F, $0D, $E1, $72, $0D db $07, $50, $0D, $7A, $64, $0D, $00, $40 db $0D, $86, $68, $0D, $7C, $43, $0D, $E2 db $6A, $0D, $49, $47, $0D, $02, $70, $0D db $A7, $4C, $0D, $0D, $73, $0D, $AB, $50 db $0D, $7B, $73, $0D, $5A, $51, $0D, $25 db $47, $10, $58, $57, $0D, $B4, $51, $10 db $6D, $5B, $0D, $00, $52, $10, $49, $5C db $0D, $2C, $52, $10, $CC, $5C, $0D, $06 db $53, $10, $42, $5D, $0D, $74, $53, $10 db $34, $5E, $0D, $F4, $53, $10, $D9, $5E db $0D, $7B, $54, $10, $78, $5F, $0D, $2C db $55, $10, $42, $60, $0D, $5F, $55, $10 db $BB, $60, $0D, $54, $55, $10, $9D, $60 db $0D, $6A, $55, $10, $F5, $60, $0D, $79 db $77, $0D, $4C, $61, $0D, $E0, $58, $08 db $37, $64, $0D, $61, $57, $08, $4B, $64 db $0D, $EE, $75, $1A, $28, $70, $1A, $EC db $76, $1A, $D3, $71, $1A, $6D, $76, $1A db $4E, $71, $1A, $BB, $57, $07, $BB, $57 db $07, $0D, $77, $1A, $7C, $72, $1A, $18 db $77, $1A, $B6, $72, $1A, $33, $79, $1A db $FD, $74, $1A, $A3, $55, $10, $80, $46 db $10, $FF toc_07_57BC: ld de, $D700 ld hl, $0000 jr .toc_07_57CF .loop_07_57C4: ld a, e add a, a ld c, a ld a, $00 adc $00 ld b, a inc bc add hl, bc inc e .toc_07_57CF: ld a, h ld [de], a inc d ld a, l ld [de], a dec d ld a, e inc a jr nz, .loop_07_57C4 ret db $7F, $80, $FF, $FF, $FF, $C0, $FC, $83 db $F3, $8C, $E7, $98, $EA, $95, $EA, $95 db $DA, $A5, $DF, $A0, $DD, $A2, $CF, $B0 db $E3, $9C, $C0, $BF, $C1, $BE, $FF, $C0 db $FF, $FF, $FF, $FF, $FF, $03, $3F, $C1 db $CF, $31, $E7, $19, $F7, $09, $F3, $0D db $FB, $05, $FB, $05, $BB, $45, $B7, $49 db $C7, $39, $03, $FD, $83, $7D, $FF, $03 db $FF, $FF, $FF, $FF, $FF, $C0, $FE, $81 db $FC, $83, $F8, $87, $F8, $87, $F0, $8F db $F1, $8E, $E3, $9C, $E3, $9C, $E7, $98 db $E7, $98, $F3, $8C, $F9, $86, $FF, $C0 db $FF, $FF, $FF, $FF, $FF, $03, $7F, $81 db $3F, $C1, $1F, $E1, $1F, $E1, $0F, $F1 db $8F, $71, $C7, $39, $C7, $39, $E7, $19 db $E7, $19, $CF, $31, $9F, $61, $FF, $03 db $FF, $FF, $FF, $FF, $FF, $C0, $F8, $87 db $E0, $9F, $E0, $9F, $F9, $86, $FB, $84 db $FC, $83, $FC, $83, $F8, $87, $F1, $8E db $E3, $9C, $C7, $B8, $EF, $90, $FF, $C0 db $FF, $FF, $FF, $FF, $FF, $03, $3F, $C1 db $0F, $F1, $77, $89, $F7, $09, $F3, $0D db $E3, $1D, $63, $9D, $43, $BD, $83, $7D db $E7, $19, $E7, $19, $FF, $01, $FF, $03 db $FF, $FF, $FF, $FF, $FF, $C0, $FF, $80 db $F8, $87, $F0, $8F, $E0, $9F, $C0, $BF db $C0, $BF, $C0, $BF, $C0, $BF, $C0, $BF db $E0, $9F, $F0, $8F, $FF, $80, $FF, $C0 db $FF, $FF, $FF, $FF, $FF, $03, $FF, $01 db $1F, $E1, $0F, $F1, $07, $F9, $03, $FD db $03, $FD, $03, $FD, $03, $FD, $03, $FD db $07, $F9, $0F, $F1, $FF, $01, $FF, $03 db $FF, $FF, $FF, $FF, $FF, $C0, $FF, $80 db $F1, $8E, $F8, $87, $FC, $83, $FC, $83 db $FE, $81, $FE, $81, $FC, $83, $FC, $83 db $F8, $87, $F1, $8E, $FF, $80, $FF, $C0 db $FF, $FF, $FF, $FF, $FF, $03, $FF, $01 db $FF, $01, $7F, $81, $1F, $E1, $0F, $F1 db $07, $F9, $07, $F9, $0F, $F1, $1F, $E1 db $7F, $81, $FF, $01, $FF, $01, $FF, $03 db $FF, $FF, $FF, $FF, $FF, $C0, $FF, $80 db $FD, $82, $FD, $82, $FC, $83, $FC, $83 db $DC, $A3, $CC, $B3, $C4, $BB, $C0, $BF db $E0, $9F, $E0, $9F, $FF, $80, $FF, $C0 db $FF, $FF, $FF, $FF, $FF, $03, $FF, $01 db $FF, $01, $FB, $05, $FB, $05, $F3, $0D db $73, $8D, $63, $9D, $23, $DD, $03, $FD db $03, $FD, $03, $FD, $FF, $01, $FF, $03 db $FF, $FF, $FF, $FF, $FF, $C0, $FF, $80 db $FC, $83, $FC, $83, $F8, $87, $F8, $87 db $F0, $8F, $FE, $81, $FE, $81, $FC, $83 db $FC, $83, $F9, $86, $FB, $84, $FF, $C0 db $FF, $FF, $FF, $FF, $FF, $03, $FF, $01 db $0F, $F1, $1F, $E1, $3F, $C1, $7F, $81 db $0F, $F1, $1F, $E1, $3F, $C1, $7F, $81 db $FF, $01, $FF, $01, $FF, $01, $FF, $03 db $FF, $FF, $FF, $FF, $FF, $C0, $FF, $80 db $E0, $9F, $C8, $B7, $D1, $AE, $C2, $BD db $C5, $BA, $CB, $B4, $D7, $A8, $CE, $B1 db $CD, $B2, $E0, $9F, $FF, $80, $FF, $C0 db $FF, $FF, $FF, $FF, $FF, $03, $FF, $01 db $07, $F9, $B3, $4D, $73, $8D, $EB, $15 db $D3, $2D, $A3, $5D, $43, $BD, $8B, $75 db $13, $ED, $07, $F9, $FF, $01, $FF, $03 db $FF, $FF, $FF, $FF, $FF, $C0, $F1, $8E db $F4, $8B, $CE, $B1, $DF, $A0, $CE, $B1 db $EA, $95, $C1, $BE, $C0, $BF, $D0, $AF db $D8, $A7, $CC, $B3, $E0, $9F, $FF, $C0 db $FF, $FF, $FF, $FF, $FF, $03, $07, $F9 db $33, $CD, $1B, $E5, $0B, $F5, $03, $FD db $83, $7D, $C7, $39, $E3, $1D, $4B, $B5 db $13, $ED, $2F, $D1, $8F, $71, $FF, $03 db $FF, $FF, $D5, $21, $4D, $CD, $36, $00 db $2C, $FA, $30, $DD, $22, $FA, $31, $DD db $22, $36, $00, $2C, $36, $CF, $FA, $2F db $DD, $6F, $26, $00, $54, $5D, $29, $19 db $29, $11, $29, $56, $19, $23, $23, $23 db $2A, $EA, $52, $DD, $2A, $EA, $53, $DD db $7E, $EA, $37, $DD, $3E, $01, $EA, $58 db $DD, $21, $57, $DD, $3E, $2B, $32, $36 db $2C, $21, $35, $DD, $3E, $4E, $22, $36 db $DD, $21, $14, $DA, $3E, $51, $22, $36 db $2B, $21, $16, $DA, $3E, $51, $22, $36 db $2B, $3E, $50, $E0, $45, $EA, $29, $DA db $D1, $C9 toc_07_5A7C: ld hl, $DEDB xor a ldi [hl], a ldi [hl], a ld [hl], a ld hl, $DEE0 ld [hl], a ld hl, $DEE1 ld [hl], a ld hl, $DEE9 ld [hl], a ld hl, $DEEA ld [hl], a ld hl, $DEE3 ldi [hl], a ldi [hl], a ld [hl], a ld a, $05 ld hl, $DEEB ld [hl], a ld hl, $DEEC ld [hl], a ret db $21, $29, $DA, $78, $22, $E0, $45, $79 db $77, $21, $16, $DA, $3E, $E0, $22, $36 db $02, $3E, $01, $EA, $2B, $DA, $21, $41 db $FF, $CB, $F6, $21, $F0, $8F, $01, $10 db $00, $3E, $FF, $CD, $2F, $06, $21, $00 db $9C, $01, $00, $04, $3E, $FF, $CD, $2F db $06, $3E, $47, $E0, $40, $C9 toc_07_5ADA: clear [$DA2B] ld hl, $DA16 ld a, $AA ldi [hl], a ld [hl], $02 ld hl, $DA14 ld a, $AA ldi [hl], a ld [hl], $02 assign [gbLYC], 127 ld [wDesiredLYC], a xor a ld hl, gbSCY ldi [hl], a ld [hl], a ld [$DA01], a ld [$DA00], a assign [gbLCDC], LCDCF_BG_DISPLAY | LCDCF_OBJ_16_16 | LCDCF_OBJ_DISPLAY | LCDCF_TILEMAP_9C00 ret toc_07_5B06: ld hl, wDesiredLYC ld a, b ld [hl], a ld [gbLYC], a ld hl, $DA16 ld a, $0C ldi [hl], a ld [hl], $03 ld hl, gbSTAT set 6, [hl] ret db $3E, $67, $E0, $40, $3E, $58, $E0, $4A db $3E, $07, $E0, $4B, $C9 toc_07_5B28: ld hl, $DA14 ld a, $AA ldi [hl], a ld [hl], $02 ld hl, $DA16 ld a, $AA ldi [hl], a ld [hl], $02 assign [gbLYC], 127 ld [wDesiredLYC], a ld c, $14 ld de, $5B5D ld hl, gbBGDAT1 .loop_07_5B47: ld a, [de] inc de ldi [hl], a dec c jr nz, .loop_07_5B47 ld hl, $9C20 .loop_07_5B50: ld a, [de] inc de ldi [hl], a dec c jr nz, .loop_07_5B50 ld hl, $DEDE xor a ldi [hl], a ld [hl], a ret db $7F, $7B, $6F, $6F, $6F, $6F, $6F, $6F db $7F, $67, $67, $67, $67, $67, $67, $67 db $7F, $69, $6B, $7F, $7F, $70, $70, $70 db $70, $70, $70, $70, $7F, $7C, $70, $70 db $7F, $65, $66, $70, $7F, $6A, $6C, $7F toc_07_5B85: ld hl, $DEDE ld b, [hl] bit 7, b jp nz, .else_07_5BBA bit 1, b call nz, toc_07_5CC6 bit 2, b call nz, toc_07_5E92 bit 3, b call nz, toc_07_5EC8 bit 5, b call nz, toc_07_5E06 bit 6, b call nz, toc_07_5E6A ld hl, $DEDF bit 0, [hl] jr nz, .else_07_5BB4 bit 0, b call nz, toc_07_5C6D ret .else_07_5BB4: bit 4, b call nz, toc_07_5F13 ret .else_07_5BBA: ifNotZeroAtAddress $DEE9, .else_07_5BC4 dec a ld [hl], a ret .else_07_5BC4: ld de, $DEE6 ld a, [de] ld l, a inc e ld a, [de] ld h, a inc e ld a, [de] jp cbcallWithoutInterrupts db $C9 toc_07_5BD2: ld hl, $DEDF bit 0, [hl] call nz, toc_07_5C12 ld hl, $DEDF bit 1, [hl] jr nz, .else_07_5BE9 ld de, $A04C ld hl, $DEE3 jr .toc_07_5BEF .else_07_5BE9: ld de, $A072 ld hl, $DEE5 .toc_07_5BEF: ld a, [de] cp [hl] ret z jr nc, .else_07_5C01 ld a, [de] ld [hl], a ld hl, $DEEB xor a ld [hl], a ld hl, $DEDE set 1, [hl] ret .else_07_5C01: ifNotZeroAtAddress $DEEB, .else_07_5C0B dec a ld [hl], a ret .else_07_5C0B: ld a, $05 ld [hl], a call toc_07_5D36 ret toc_07_5C12: call toc_07_5C39 ld hl, $DEE4 cp [hl] ret z jr nc, .else_07_5C28 ld [hl], a ld hl, $DEEC xor a ld [hl], a ld hl, $DEDE set 4, [hl] ret .else_07_5C28: ifNotZeroAtAddress $DEEC, .else_07_5C32 dec a ld [hl], a ret .else_07_5C32: ld a, $05 ld [hl], a call toc_07_5DBB ret toc_07_5C39: push bc push hl xor a ld b, a ld d, a ld hl, $A085 ld a, [hl] add a, a jr nc, .else_07_5C46 inc b .else_07_5C46: add a, a rl b ld l, a ld h, b add a, a rl b add a, l ld c, a ld a, b adc h ld b, a ld hl, $A086 ld e, [hl] ld a, c .toc_07_5C58: ld c, a sub a, e jr nc, .else_07_5C61 dec b bit 7, b jr nz, .else_07_5C64 .else_07_5C61: inc d jr .toc_07_5C58 .else_07_5C64: ld a, c and a ld a, d jr z, .else_07_5C6A inc a .else_07_5C6A: pop hl pop bc ret toc_07_5C6D: ld a, $07 call toc_01_0675 ret c push bc ld de, $9C21 ld a, [$FF92] ld l, a ld h, $C4 ld [hl], e inc l ld [hl], d inc l ld [hl], $07 inc l ld c, $70 ld de, $DEDB ld a, [de] ld b, a inc de ld b, a swap a and %00001111 add a, c ld [hl], a inc l ld a, b and %00001111 add a, c ld [hl], a inc l ld a, [de] inc de ld b, a swap a and %00001111 add a, c ld [hl], a inc l ld a, b and %00001111 add a, c ld [hl], a inc l ld a, [de] ld b, a swap a and %00001111 add a, c ld [hl], a inc l ld a, b and %00001111 add a, c ld [hl], a inc l ld a, c ld [hl], a inc l ld a, l ld [$FF92], a pop bc ld hl, $DEDE res 0, b ld [hl], b ret toc_07_5CC6: ld a, $07 call toc_01_0675 ret c ld de, $9C01 ld a, [$FF92] ld l, a ld h, $C4 ld [hl], e inc l ld [hl], d inc l ld [hl], $07 inc l ld [hl], $7B inc l ld de, $DEDF ld a, [de] bit 1, a jr nz, .else_07_5D13 ld de, $A04C ld a, [de] ld d, $06 .loop_07_5CEC: and a jr z, .else_07_5CFF sub a, $02 jr c, .else_07_5CFB ld [hl], $64 inc l dec d jr nz, .loop_07_5CEC jr .else_07_5D09 .else_07_5CFB: dec d ld [hl], $6E inc l .else_07_5CFF: ld a, d and a jr z, .else_07_5D09 ld [hl], $63 inc l dec d jr nz, .else_07_5CFF .else_07_5D09: ld a, l ld [$FF92], a ld hl, $DEDE res 1, b ld [hl], b ret .else_07_5D13: ld a, [$A072] ld d, $06 and a jr z, .else_07_5D22 .loop_07_5D1B: ld [hl], $64 inc l dec d dec a jr nz, .loop_07_5D1B .else_07_5D22: ld a, d and a jr z, .else_07_5D2C .loop_07_5D26: ld [hl], $63 inc l dec d jr nz, .loop_07_5D26 .else_07_5D2C: ld a, l ld [$FF92], a ld hl, $DEDE res 1, b ld [hl], b ret toc_07_5D36: ld a, $07 call toc_01_0675 jr nc, .else_07_5D43 ld hl, $DEEB ld [hl], $00 ret .else_07_5D43: ld de, $9C01 ld a, [$FF92] ld l, a ld h, $C4 ld [hl], e inc l ld [hl], d inc l ld [hl], $07 inc l ld [hl], $7B inc l ld de, $DEDF ld a, [de] bit 1, a jr nz, .else_07_5D91 ld de, $DEE3 ld a, [de] inc a inc a ld [de], a ld d, $06 .loop_07_5D66: and a jr z, .else_07_5D79 sub a, $02 jr c, .else_07_5D75 ld [hl], $64 inc l dec d jr nz, .loop_07_5D66 jr .else_07_5D83 .else_07_5D75: dec d ld [hl], $6E inc l .else_07_5D79: ld a, d and a jr z, .else_07_5D83 ld [hl], $63 inc l dec d jr nz, .else_07_5D79 .else_07_5D83: ld a, l ld [$FF92], a ld e, $12 cbcallNoInterrupts $1E, $4299 ret .else_07_5D91: ld de, $DEE5 ld a, [de] inc a ld [de], a ld d, $06 .loop_07_5D99: and a jr z, .else_07_5DA3 ld [hl], $64 inc l dec a dec d jr nz, .loop_07_5D99 .else_07_5DA3: ld a, d and a jr z, .else_07_5DAD ld [hl], $63 inc l dec d jr nz, .else_07_5DA3 .else_07_5DAD: ld a, l ld [$FF92], a ld e, $12 cbcallNoInterrupts $1E, $4299 ret toc_07_5DBB: ld a, $07 call toc_01_0675 ret c ld de, $9C21 ld a, [$FF92] ld l, a ld h, $C4 ld [hl], e inc l ld [hl], d inc l ld [hl], $07 inc l ld [hl], $7A inc l ld de, $DEE4 ld a, [de] inc a ld [de], a ld d, $06 .loop_07_5DDB: and a jr z, .else_07_5DEE sub a, $02 jr c, .else_07_5DEA ld [hl], $6F inc l dec d jr nz, .loop_07_5DDB jr .else_07_5DF8 .else_07_5DEA: dec d ld [hl], $6E inc l .else_07_5DEE: ld a, d and a jr z, .else_07_5DF8 ld [hl], $6D inc l dec d jr nz, .else_07_5DEE .else_07_5DF8: ld a, l ld [$FF92], a ld e, $12 cbcallNoInterrupts $1E, $4299 ret toc_07_5E06: ld a, $07 call toc_01_0675 ret c ld de, $9C09 ld a, [$FF92] ld l, a ld h, $C4 ld [hl], e inc l ld [hl], d inc l ld [hl], $07 inc l ld de, $DEE1 ld a, [de] and a jr z, .else_07_5E4B ld [hl], $68 inc l dec a jr z, .else_07_5E4E ld [hl], $68 inc l dec a jr z, .else_07_5E51 ld [hl], $68 inc l dec a jr z, .else_07_5E54 ld [hl], $68 inc l dec a jr z, .else_07_5E57 ld [hl], $68 inc l dec a jr z, .else_07_5E5A ld [hl], $68 inc l dec a jr z, .else_07_5E5D ld [hl], $68 inc l jr .toc_07_5E60 .else_07_5E4B: ld [hl], $67 inc l .else_07_5E4E: ld [hl], $67 inc l .else_07_5E51: ld [hl], $67 inc l .else_07_5E54: ld [hl], $67 inc l .else_07_5E57: ld [hl], $67 inc l .else_07_5E5A: ld [hl], $67 inc l .else_07_5E5D: ld [hl], $67 inc l .toc_07_5E60: ld a, l ld [$FF92], a ld hl, $DEDE res 5, b ld [hl], b ret toc_07_5E6A: ld a, $01 call toc_01_0675 ret c ld de, $9C2F ld a, [$FF92] ld l, a ld h, $C4 ld [hl], e inc l ld [hl], d inc l ld [hl], $01 inc l ld a, [$DB60] inc a ld e, $70 add a, e ld [hl], a inc l ld a, l ld [$FF92], a ld hl, $DEDE res 6, b ld [hl], b ret toc_07_5E92: ld a, $03 call toc_01_0675 ret c ld de, $9C29 ld a, [$FF92] ld l, a ld h, $C4 ld [hl], e inc l ld [hl], d inc l ld [hl], $03 inc l ld [hl], $7C inc l ld de, $A084 ld a, [de] ld d, $70 ld e, a swap a and %00001111 add a, d ld [hl], a inc l ld a, e and %00001111 add a, d ld [hl], a inc l ld a, l ld [$FF92], a ld hl, $DEDE res 2, b ld [hl], b ret toc_07_5EC8: ld a, $40 call toc_01_0675 ret c push bc ld de, $9690 ld a, [$FF92] ld c, a ld b, $C4 ld a, e ld [bc], a inc c ld a, d ld [bc], a inc c ld a, $40 ld [bc], a inc c ld de, $DEE0 ld a, [de] swap a ld l, a and %00001111 ld h, a ld a, l and %11110000 ld l, a sla l rl h sla l rl h __changebank $07 ld de, $57DC add hl, de ld d, $40 .loop_07_5F02: ldi a, [hl] ld [bc], a inc c dec d jr nz, .loop_07_5F02 ld a, c ld [$FF92], a pop bc ld hl, $DEDE res 3, b ld [hl], b ret toc_07_5F13: ld a, $07 call toc_01_0675 ret c ld de, $9C21 ld a, [$FF92] ld l, a ld h, $C4 ld [hl], e inc l ld [hl], d inc l ld [hl], $07 inc l ld [hl], $7A inc l call toc_07_5C39 ld d, $06 .loop_07_5F30: and a jr z, .else_07_5F43 sub a, $02 jr c, .else_07_5F3F ld [hl], $6F inc l dec d jr nz, .loop_07_5F30 jr .else_07_5F4D .else_07_5F3F: dec d ld [hl], $6E inc l .else_07_5F43: ld a, d and a jr z, .else_07_5F4D ld [hl], $6D inc l dec d jr nz, .else_07_5F43 .else_07_5F4D: ld a, l ld [$FF92], a ld hl, $DEDE res 4, b ld [hl], b ret db $21, $EA, $DE, $36, $04, $3E, $07, $CD db $75, $06, $D8, $11, $09, $9C, $F0, $92 db $6F, $26, $C4, $73, $2C, $72, $2C, $36 db $07, $2C, $36, $68, $2C, $36, $68, $2C db $36, $68, $2C, $36, $68, $2C, $36, $68 db $2C, $36, $68, $2C, $36, $68, $2C, $7D db $E0, $92, $21, $E9, $DE, $36, $14, $21 db $E6, $DE, $36, $9A, $23, $36, $5F, $23 db $36, $07, $C9, $3E, $07, $CD, $75, $06 db $D8, $11, $09, $9C, $F0, $92, $6F, $26 db $C4, $73, $2C, $72, $2C, $36, $07, $2C db $36, $67, $2C, $36, $67, $2C, $36, $67 db $2C, $36, $67, $2C, $36, $67, $2C, $36 db $67, $2C, $36, $67, $2C, $7D, $E0, $92 db $21, $EA, $DE, $7E, $A7, $CA, $E2, $5F db $3D, $77, $21, $E9, $DE, $36, $0A, $21 db $E6, $DE, $36, $5C, $23, $36, $5F, $23 db $36, $07, $C9, $21, $DE, $DE, $CB, $BE db $AF, $21, $E9, $DE, $22, $77, $C9 toc_07_5FEE: ld hl, $DF00 ld a, $3E ldi [hl], a ld [hl], $06 plotFromTo $6107, $8000 memcpyFromTo gbVRAM, $9000, $0800 plotFromTo $697D, $9800 ld a, $0B ld hl, $68A0 ld de, $8000 call toc_01_060D ld a, $09 ld hl, $4000 ld de, $8100 ld bc, $0280 call toc_01_05BF ld a, $09 ld hl, $4280 ld de, $8380 ld bc, $0220 call toc_01_05BF cbcallNoInterrupts $08, $4000 ld a, $F8 ld hl, $A0B3 call toc_01_07C4 clear [$DF02] ld hl, $CD09 ld a, $E4 ldi [hl], a ld a, $D0 ldi [hl], a ld a, $E4 ld [hl], a ld e, $FF cbcallNoInterrupts $1E, $4299 ld e, $06 cbcallNoInterrupts $1F, $4232 call toc_01_1584 assign [gbLCDC], LCDCF_BG_DISPLAY | LCDCF_OBJ_16_16 | LCDCF_OBJ_DISPLAY | LCDCF_TILEMAP_9C00 call toc_01_046D ld e, $08 cbcallNoInterrupts $1E, $6011 ld de, $0004 cbcallNoInterrupts $1A, $4246 ld e, $06 cbcallNoInterrupts $1E, $606D ld a, $20 .loop_07_609A: push af call toc_01_0496 cbcallNoInterrupts $00, $086B call toc_01_04AE call toc_01_0343 call toc_01_0357 pop af dec a jr nz, .loop_07_609A .loop_07_60B3: call toc_01_0496 cbcallNoInterrupts $00, $086B call toc_01_0647 call toc_01_04AE call toc_01_0343 call toc_01_0357 ld a, [$DF02] or a jr nz, .else_07_60E8 ld hl, $DF00 ld a, [hl] sub a, $01 ldi [hl], a ld a, [hl] sbc $00 ldd [hl], a or [hl] jr nz, .loop_07_60B3 cbcallNoInterrupts $08, $5E92 jr .toc_07_60EF .else_07_60E8: clear [$DEFF] jp toc_01_0437 .toc_07_60EF: ld e, $00 cbcallNoInterrupts $1E, $606D ld de, $0004 cbcallNoInterrupts $1A, $427B jp toc_01_0437 db $32, $00, $41, $38, $00, $02, $F9, $00 db $39, $41, $00, $3B, $24, $00, $0A, $F8 db $00, $D8, $00, $DC, $00, $8C, $00, $FE db $00, $8E, $23, $00, $44, $00, $E0, $01 db $00, $FC, $24, $00, $41, $C0, $00, $00 db $C3, $41, $00, $C6, $01, $00, $F3, $24 db $00, $41, $0C, $00, $00, $EF, $41, $00 db $6C, $01, $00, $EF, $28, $00, $03, $8F db $00, $D9, $00, $CB, $00, $69, $06, $36 db $00, $B8, $00, $B0, $00, $30, $28, $00 db $00, $7D, $41, $00, $CC, $01, $00, $7C db $88, $00, $3E, $00, $E7, $84, $00, $88 db $00, $C7, $28, $00, $00, $9B, $C4, $00 db $28, $00, $98, $AA, $00, $6E, $06, $6C db $00, $39, $00, $19, $00, $31, $A4, $00 db $50, $83, $00, $75, $00, $37, $41, $00 db $B6, $CA, $00, $A6, $04, $EC, $00, $6C db $00, $67, $28, $00, $00, $80, $C5, $00 db $80, $AE, $00, $2E, $00, $07, $A3, $00 db $3E, $45, $00, $03, $24, $00, $0A, $1B db $00, $98, $00, $DB, $00, $7B, $00, $3B db $00, $1B, $88, $00, $B0, $00, $7E, $42 db $00, $66, $24, $00, $0A, $60, $00, $F3 db $00, $66, $00, $67, $00, $66, $00, $63 db $26, $00, $08, $CD, $00, $6F, $00, $EC db $00, $0C, $00, $CC, $A6, $00, $E2, $85 db $00, $67, $00, $D9, $A6, $00, $4C, $02 db $80, $00, $9E, $42, $00, $B3, $01, $00 db $9E, $86, $00, $FE, $03, $06, $00, $05 db $00, $C9, $01, $77, $02, $CF, $00, $27 db $41, $00, $E7, $01, $00, $27, $86, $00 db $9C, $00, $3E, $41, $00, $77, $05, $00 db $3F, $00, $07, $00, $06, $24, $00, $04 db $7F, $00, $70, $00, $7E, $84, $00, $F2 db $00, $7E, $C4, $00, $41, $00, $FC, $23 db $EE, $02, $FC, $FC, $E0, $A5, $00, $FD db $00, $00, $27, $EE, $00, $7C, $85, $00 db $8D, $0A, $00, $7E, $7E, $F0, $F0, $7C db $7C, $1E, $1E, $FC, $FC, $89, $01, $BC db $00, $FE, $CA, $01, $E6, $01, $FE, $FE db $27, $38, $CB, $01, $D1, $01, $FE, $FE db $C3, $01, $E3, $8B, $01, $AE, $01, $EE db $EE, $31, $00, $00, $01, $CA, $02, $2E db $01, $60, $60, $41, $F0, $90, $01, $01 db $01, $CD, $02, $2F, $22, $1C, $02, $14 db $1C, $1C, $35, $00, $03, $0F, $0F, $00 db $3F, $29, $00, $05, $07, $07, $0C, $0F db $88, $8F, $AB, $02, $24, $05, $40, $C0 db $20, $E0, $00, $00, $8D, $02, $70, $29 db $00, $00, $FF, $41, $FF, $00, $00, $FF db $89, $02, $26, $05, $82, $83, $67, $E6 db $16, $F7, $C5, $02, $3B, $09, $FC, $FC db $03, $FF, $00, $FF, $55, $AA, $AA, $55 db $A9, $02, $72, $05, $18, $F8, $54, $AC db $AD, $55, $AD, $02, $60, $01, $98, $F8 db $83, $02, $2C, $2B, $03, $83, $02, $EC db $03, $A8, $58, $58, $A8, $41, $F8, $08 db $03, $FC, $04, $FC, $84, $89, $02, $47 db $01, $0C, $13, $41, $07, $08, $A5, $00 db $4E, $03, $20, $50, $60, $90, $41, $E0 db $10, $01, $F0, $0C, $A6, $00, $E4, $00 db $00, $22, $70, $00, $50, $C3, $03, $39 db $0B, $34, $CF, $FD, $02, $7A, $85, $49 db $B6, $4B, $B4, $33, $FC, $41, $3F, $30 db $07, $58, $DF, $55, $DA, $FA, $75, $7F db $F0, $42, $FF, $60, $0B, $FF, $40, $21 db $E1, $62, $A3, $C6, $45, $CD, $4E, $CF db $4C, $41, $8F, $8C, $0B, $8F, $8E, $DD db $DA, $3A, $FD, $BF, $5C, $5F, $BF, $F7 db $17, $41, $F3, $13, $01, $FB, $0B, $C6 db $02, $CF, $00, $06, $41, $FF, $07, $0B db $FD, $05, $FF, $06, $57, $B6, $AF, $5F db $FB, $0B, $F9, $09, $41, $F8, $08, $41 db $F0, $10, $03, $FF, $00, $FF, $01, $43 db $FF, $C1, $07, $FF, $C0, $FF, $80, $FF db $03, $FF, $83, $41, $FF, $C3, $03, $7F db $43, $FF, $83, $41, $FD, $05, $1F, $08 db $F8, $AC, $54, $55, $AD, $FD, $05, $FF db $07, $FF, $83, $FF, $82, $FF, $80, $3F db $3F, $C7, $FF, $EB, $D7, $D7, $AB, $FE db $82, $FC, $04, $FD, $05, $F9, $09, $42 db $FC, $84, $08, $F8, $C8, $FF, $FF, $E0 db $FF, $AA, $D5, $D5, $AA, $02, $DF, $05 db $C0, $C0, $A0, $67, $51, $B2, $83, $00 db $C0, $41, $10, $28, $07, $18, $24, $3C db $C3, $FF, $00, $FE, $01, $41, $03, $04 db $05, $07, $08, $0E, $11, $08, $16, $C5 db $00, $14, $05, $F8, $06, $FE, $01, $E0 db $1E, $41, $60, $90, $41, $20, $50, $03 db $00, $20, $0C, $0C, $41, $1E, $12, $00 db $0C, $A7, $00, $7D, $02, $C0, $3F, $38 db $43, $1F, $18, $01, $1F, $1C, $41, $0F db $0C, $42, $FF, $01, $03, $FE, $02, $FF db $01, $42, $FF, $00, $44, $07, $06, $05 db $87, $87, $C3, $43, $E3, $23, $44, $FB db $0B, $42, $FF, $07, $43, $FF, $00, $41 db $FF, $04, $41, $FF, $06, $42, $E1, $21 db $41, $F1, $11, $01, $F9, $09, $84, $04 db $78, $00, $80, $A7, $03, $A2, $42, $FE db $02, $05, $F9, $09, $FD, $05, $FC, $84 db $43, $FE, $C2, $03, $FF, $C3, $FF, $80 db $43, $FF, $C0, $07, $FF, $C1, $FF, $81 db $FE, $82, $F1, $11, $41, $E3, $23, $03 db $C3, $43, $83, $83, $25, $03, $84, $02 db $AB, $04, $06, $FF, $0E, $FF, $0F, $83 db $03, $8A, $03, $FE, $82, $F0, $11, $42 db $F8, $08, $09, $F0, $10, $E0, $E0, $C0 db $C0, $01, $01, $7E, $81, $41, $3E, $41 db $05, $33, $4C, $20, $53, $00, $60, $AD db $02, $2C, $05, $0C, $0C, $1F, $13, $1F db $12, $A7, $02, $85, $83, $03, $32, $09 db $C0, $C0, $E0, $20, $40, $A0, $60, $9C db $78, $84, $41, $F0, $08, $05, $78, $84 db $40, $BC, $00, $C0, $41, $0F, $0C, $01 db $0F, $0E, $88, $04, $60, $83, $04, $7F db $04, $10, $FF, $08, $FF, $0C, $83, $04 db $E6, $05, $FB, $0B, $FD, $05, $F3, $13 db $84, $04, $78, $00, $03, $84, $04, $50 db $02, $81, $D5, $C1, $86, $04, $7A, $84 db $04, $A5, $03, $AB, $83, $D4, $C4, $85 db $03, $88, $09, $FD, $05, $54, $04, $A8 db $88, $F0, $F0, $E0, $E0, $84, $05, $64 db $0B, $83, $FF, $83, $D7, $C3, $EC, $E4 db $78, $78, $30, $30, $FF, $84, $04, $DF db $05, $AA, $80, $FD, $FC, $FF, $FF, $A3 db $01, $BA, $85, $03, $BA, $09, $AB, $0B db $7B, $3B, $E3, $E3, $83, $83, $01, $01 db $42, $FE, $82, $41, $FC, $04, $85, $05 db $88, $07, $1D, $1D, $3F, $23, $7E, $42 db $7F, $41, $84, $03, $AA, $04, $E0, $7F db $60, $FE, $82, $A6, $04, $A4, $02, $41 db $FF, $81, $83, $04, $54, $03, $03, $02 db $03, $02, $8B, $02, $2E, $A5, $05, $F0 db $A9, $02, $50, $01, $0F, $0C, $42, $0F db $08, $03, $E7, $E4, $E3, $A3, $83, $01 db $BA, $43, $F0, $10, $03, $E0, $20, $C0 db $C0, $91, $02, $1E, $01, $0E, $0F, $CB db $02, $FB, $83, $02, $D8, $89, $05, $C6 db $0B, $EF, $EF, $10, $1F, $20, $3F, $EB db $E3, $7C, $7C, $38, $38, $A7, $02, $76 db $03, $10, $F0, $F8, $F8, $C5, $02, $ED db $06, $38, $38, $44, $7C, $C4, $FC, $C4 db $86, $01, $DB, $03, $0E, $0E, $19, $1F db $41, $31, $3F, $01, $71, $7F, $87, $02 db $4A, $01, $26, $3E, $41, $62, $7E, $03 db $E2, $FE, $00, $00, $8D, $02, $F0, $84 db $02, $EA, $44, $F8, $08, $00, $F8, $C9 db $02, $D9, $0D, $1E, $1E, $33, $3F, $21 db $3F, $7F, $70, $3A, $38, $1F, $1E, $0F db $0F, $A5, $06, $2A, $07, $1E, $1E, $FE db $02, $AC, $04, $58, $18, $83, $05, $8C db $05, $00, $00, $3C, $3C, $66, $7E, $A9 db $02, $86, $41, $08, $0F, $01, $18, $1F db $85, $02, $76, $03, $38, $3F, $40, $7F db $42, $80, $FF, $85, $02, $D4, $01, $1D db $FD, $85, $04, $DF, $02, $40, $FF, $30 db $84, $07, $07, $41, $81, $FF, $00, $C0 db $41, $FF, $70, $00, $FF, $A3, $06, $5C db $01, $04, $FC, $C7, $03, $E5, $04, $0B db $FB, $60, $7F, $60, $42, $7F, $61, $00 db $7F, $A5, $04, $59, $05, $10, $F0, $31 db $F1, $E1, $E1, $23, $C1, $00, $63, $41 db $E3, $23, $00, $E3, $43, $82, $FE, $42 db $01, $FF, $04, $11, $FF, $71, $7F, $70 db $44, $7F, $60, $06, $7F, $62, $7F, $E2 db $FE, $C2, $FE, $C3, $03, $A7, $87, $07 db $68, $01, $02, $03, $43, $06, $07, $01 db $04, $07, $41, $0C, $0F, $44, $10, $F0 db $01, $20, $E0, $41, $21, $E1, $41, $61 db $7F, $02, $41, $7F, $C1, $A6, $05, $66 db $05, $88, $FF, $32, $3E, $21, $3F, $C3 db $07, $44, $43, $E0, $FF, $01, $42, $7E db $43, $C2, $FE, $05, $42, $FE, $43, $FF db $03, $FF, $A7, $01, $FC, $A7, $07, $66 db $C3, $04, $43, $06, $3C, $3F, $3E, $3F db $DF, $DF, $3F, $84, $07, $2F, $0C, $C0 db $FF, $F8, $FF, $FC, $FF, $1C, $1F, $0C db $0F, $0E, $0F, $06, $22, $07, $09, $70 db $FF, $78, $FF, $38, $FF, $3C, $FF, $2C db $EF, $41, $14, $F7, $04, $0C, $FF, $30 db $FF, $38, $42, $FF, $18, $42, $FF, $1C db $86, $05, $64, $02, $40, $FF, $60, $84 db $08, $1F, $0C, $3D, $FE, $80, $FF, $E1 db $FF, $61, $7F, $E1, $FF, $61, $FF, $21 db $A3, $04, $8A, $06, $BF, $4E, $CF, $D0 db $DF, $A0, $BF, $C3, $07, $74, $06, $FC db $FF, $1C, $FF, $0C, $FF, $10, $88, $04 db $80, $00, $10, $A4, $08, $29, $00, $E2 db $41, $FF, $C2, $0D, $FF, $C3, $FF, $43 db $FF, $6B, $D7, $74, $EC, $78, $F8, $11 db $FF, $10, $A4, $05, $54, $0D, $F0, $FF db $BA, $B5, $3D, $3B, $1E, $1E, $0C, $0F db $8C, $8F, $88, $8F, $42, $98, $9F, $07 db $10, $1F, $30, $3F, $27, $E7, $28, $EF db $41, $50, $DF, $08, $58, $DF, $4E, $CF db $3C, $FF, $06, $FF, $08, $8C, $08, $61 db $03, $B8, $7F, $E0, $FF, $41, $B0, $BF db $44, $70, $FF, $01, $01, $FF, $A5, $07 db $24, $41, $C1, $FF, $07, $E1, $FF, $F5 db $EB, $C0, $FF, $E1, $FF, $42, $61, $7F db $01, $41, $7F, $41, $C2, $FE, $02, $04 db $FC, $82, $86, $04, $B6, $41, $C3, $FF db $01, $82, $FF, $87, $06, $42, $87, $02 db $40, $02, $0C, $FF, $08, $A6, $07, $87 db $07, $C0, $FF, $EB, $D5, $F6, $EE, $1C db $FF, $41, $26, $E7, $05, $47, $C6, $47 db $C7, $81, $81, $23, $00, $09, $2E, $EF db $17, $F7, $B3, $53, $50, $B0, $E0, $E0 db $85, $06, $2A, $06, $EA, $75, $F5, $FA db $7F, $7F, $3F, $88, $02, $6F, $07, $AE db $5D, $5F, $BE, $E7, $E7, $C3, $C3, $87 db $02, $74, $07, $BD, $7A, $5E, $DD, $8F db $8F, $06, $06, $27, $00, $01, $70, $F0 db $AD, $02, $42, $01, $0C, $0C, $2D, $00 db $07, $30, $3F, $3D, $3A, $3F, $3F, $1F db $1F, $A7, $06, $C4, $07, $03, $FE, $57 db $AB, $A7, $DF, $FC, $FC, $C7, $02, $ED db $05, $5D, $DA, $DE, $DD, $8F, $8F, $A9 db $06, $C0, $05, $75, $FA, $FB, $FD, $9F db $9F, $C7, $06, $87, $07, $00, $00, $BB db $B7, $BF, $BF, $1D, $1D, $89, $09, $06 db $01, $C2, $FE, $A5, $07, $86, $08, $D5 db $AA, $EA, $D5, $FF, $FF, $7E, $7E, $82 db $84, $04, $88, $04, $08, $FF, $70, $BF db $E0, $84, $04, $C2, $03, $7C, $7C, $70 db $70, $91, $06, $2D, $01, $07, $08, $42 db $03, $04, $01, $06, $09, $83, $02, $89 db $0D, $80, $40, $C0, $38, $F0, $08, $C0 db $30, $C0, $22, $42, $AD, $07, $05, $CC db $02, $9D, $00, $80, $2D, $00, $01, $0E db $0E, $C3, $09, $0D, $89, $09, $06, $03 db $00, $00, $FC, $84, $42, $FE, $02, $07 db $FE, $06, $FF, $89, $7F, $79, $06, $06 db $A6, $0A, $20, $08, $04, $07, $38, $1F db $20, $07, $18, $03, $0C, $85, $02, $87 db $03, $80, $78, $F0, $08, $42, $E0, $10 db $85, $02, $F2, $03, $3F, $3F, $7F, $67 db $41, $7E, $42, $01, $7E, $66, $85, $09 db $16, $00, $FC, $24, $FF, $01, $3F, $3F db $AC, $06, $2A, $00, $C0, $84, $00, $E6 db $AE, $0A, $03, $07, $4F, $B0, $07, $68 db $05, $0A, $00, $05, $88, $00, $DF, $02 db $40, $00, $80, $8F, $0A, $3E, $22, $03 db $00, $02, $87, $0A, $AE, $A3, $03, $3A db $AB, $0A, $54, $41, $03, $04, $02, $02 db $05, $00, $88, $09, $67, $05, $F0, $08 db $10, $E8, $00, $18, $95, $0A, $EA, $23 db $00, $01, $BC, $BC, $A4, $02, $40, $D1 db $0A, $F3, $0E, $80, $00, $18, $18, $66 db $7E, $81, $0F, $0F, $7A, $75, $D5, $AA db $88, $77, $43, $00, $FF, $0A, $FF, $00 db $FF, $E0, $5F, $B8, $8F, $74, $03, $FE db $03, $84, $07, $67, $86, $0A, $E0, $84 db $0A, $21, $A3, $0B, $14, $01, $08, $0F db $83, $06, $5C, $02, $60, $7F, $C0, $A6 db $04, $58, $02, $02, $FE, $04, $C4, $03 db $0E, $83, $07, $A8, $C3, $06, $03, $43 db $00, $FF, $02, $E0, $FF, $FE, $22, $FF db $00, $FF, $45, $FF, $00, $C3, $03, $EB db $02, $FF, $80, $80, $44, $40, $C0, $83 db $05, $0E, $07, $3C, $C3, $3C, $42, $24 db $5A, $00, $76, $A8, $0A, $B4, $25, $00 db $07, $08, $08, $14, $0C, $12, $1E, $21 db $3F, $8D, $06, $2B, $02, $F0, $C0, $20 db $41, $00, $FF, $0B, $0E, $FF, $7F, $FF db $E7, $E7, $86, $87, $06, $07, $0C, $0F db $45, $01, $FF, $41, $02, $FE, $C5, $04 db $5B, $03, $04, $FC, $0C, $FC, $85, $04 db $7F, $89, $05, $0E, $05, $80, $80, $78 db $F8, $07, $FF, $CF, $02, $6D, $03, $FE db $FE, $78, $78, $2B, $00, $FF, $E4, $29 db $00, $00, $23, $37, $00, $6B, $25, $31 db $00, $6F, $31, $00, $AB, $2E, $00, $6F db $41, $00, $B5, $2E, $00, $6F, $51, $62 db $BE, $2C, $00, $6D, $61, $01, $00, $6F db $62, $B6, $2B, $00, $00, $22, $6F, $70 db $01, $C1, $C2, $2C, $00, $00, $24, $6F db $80, $01, $B9, $BA, $2D, $00, $6F, $90 db $00, $C3, $AF, $00, $2A, $01, $A0, $00 db $62, $A1, $00, $00, $64, $A4, $03, $00 db $00, $A9, $AA, $62, $BB, $2F, $00, $64 db $AC, $09, $00, $00, $B1, $B2, $00, $B3 db $B4, $00, $C5, $C6, $E4, $31, $00, $63 db $1B, $01, $00, $1D, $62, $1F, $00, $1F db $E4, $30, $00, $62, $17, $02, $19, $1A db $0F, $6D, $01, $94, $01, $D0, $66, $10 db $E4, $2F, $00, $FF, $21, $6A, $2A, $6A db $33, $6A, $3C, $6A, $45, $6A, $4E, $6A db $53, $6A, $5C, $6A, $65, $6A, $6E, $6A db $77, $6A, $80, $6A, $89, $6A, $92, $6A db $9B, $6A, $A4, $6A, $AD, $6A, $B6, $6A db $BF, $6A, $02, $F8, $00, $30, $00, $F8 db $F8, $46, $01, $02, $F8, $00, $12, $00 db $F8, $F8, $4C, $01, $02, $F8, $00, $32 db $00, $F8, $F8, $4A, $01, $02, $F8, $00 db $10, $00, $F8, $F8, $48, $01, $02, $F8 db $00, $0A, $00, $F8, $F8, $08, $01, $01 db $F8, $00, $16, $01, $02, $F8, $00, $04 db $20, $F8, $F8, $0C, $21, $02, $F8, $00 db $2E, $00, $F8, $F8, $28, $01, $02, $F8 db $00, $36, $00, $F8, $F8, $34, $01, $02 db $F8, $00, $0E, $00, $F8, $F8, $06, $01 db $02, $F8, $00, $02, $00, $F8, $F8, $00 db $01, $02, $F8, $F8, $12, $20, $F8, $00 db $4C, $21, $02, $F8, $F8, $32, $20, $F8 db $00, $4A, $21, $02, $F8, $F8, $10, $20 db $F8, $00, $48, $21, $02, $F8, $F8, $30 db $20, $F8, $00, $46, $21, $02, $F8, $F8 db $0E, $20, $F8, $00, $06, $21, $02, $F8 db $F8, $02, $20, $F8, $00, $00, $21, $02 db $F8, $F8, $0A, $20, $F8, $00, $08, $21 db $02, $F8, $F8, $04, $00, $F8, $00, $0C db $01, $04, $68, $59, $0A, $03, $0B, $6B db $47, $0F, $3A, $00, $19, $00, $06, $19 db $01, $04, $01, $02, $0F, $39, $01, $0F db $3A, $01, $0D, $AF, $0F, $07, $10, $04 db $05, $06, $0D, $00, $6B, $06, $E1, $6A db $03, $0B, $6B, $47, $0F, $3A, $00, $19 db $01, $04, $19, $00, $06, $1B, $0A, $40 db $02, $1E, $39, $1A, $3C, $FE, $03, $38 db $01, $AF, $12, $C9, $21, $A8, $7E, $3E db $02, $CD, $CF, $05, $CD, $8B, $37, $CD db $A8, $37, $1E, $3A, $1A, $B7, $28, $0E db $F0, $A5, $E6, $02, $20, $08, $1E, $07 db $01, $EF, $6A, $C3, $F4, $37, $C3, $F7 db $37, $03, $5D, $6B, $47, $0F, $3A, $00 db $04, $36, $5D, $0A, $24, $4D, $19, $00 db $06, $19, $01, $03, $19, $00, $03, $19 db $01, $08, $0F, $3A, $01, $19, $01, $16 db $03, $5D, $6B, $47, $0F, $3A, $00, $19 db $00, $05, $1B, $0A, $40, $02, $21, $A8 db $7E, $3E, $02, $CD, $CF, $05, $CD, $8B db $37, $CD, $A8, $37, $1E, $15, $1A, $FE db $01, $20, $0B, $3E, $08, $21, $94, $6B db $CD, $AA, $3A, $CD, $E4, $3A, $1E, $3A db $1A, $B7, $28, $0E, $F0, $A5, $E6, $02 db $20, $08, $1E, $07, $01, $4F, $6B, $C3 db $F4, $37, $C3, $F7, $37, $03, $F4, $00 db $0E, $09, $03, $C8, $6B, $47, $04, $74 db $5D, $0A, $0F, $39, $00, $09, $08, $24 db $1D, $0D, $AF, $0F, $0D, $0A, $05, $19 db $00, $02, $0D, $AF, $0F, $0D, $0A, $05 db $19, $01, $02, $0D, $C2, $6B, $0A, $1B db $0A, $40, $02, $1E, $39, $1A, $3C, $12 db $C9, $21, $A8, $7E, $3E, $02, $CD, $CF db $05, $CD, $8B, $37, $CD, $A8, $37, $C3 db $F7, $37, $03, $14, $6C, $47, $0F, $3A db $0F, $0F, $39, $02, $04, $B8, $5D, $0A db $24, $44, $19, $00, $06, $01, $01, $0D db $77, $0F, $0B, $0D, $FA, $6B, $05, $02 db $06, $EE, $6B, $1E, $39, $1A, $3C, $FE db $0B, $38, $02, $3E, $02, $12, $C9, $03 db $14, $6C, $47, $0F, $3A, $00, $19, $00 db $06, $1B, $0A, $40, $02, $21, $A8, $7E db $3E, $02, $CD, $CF, $05, $CD, $8B, $37 db $CD, $A8, $37, $1E, $15, $1A, $FE, $01 db $20, $0B, $3E, $02, $21, $52, $6C, $CD db $AA, $3A, $CD, $E4, $3A, $1E, $3A, $1A db $3D, $20, $14, $FA, $70, $A0, $B7, $20 db $06, $F0, $A5, $E6, $02, $20, $09, $1E db $07, $01, $06, $6C, $C3, $F4, $37, $12 db $C3, $F7, $37, $05, $00, $00, $12, $13 db $04, $1A, $61, $0A, $03, $77, $6C, $47 db $19, $00, $04, $19, $01, $04, $0D, $AF db $0F, $08, $10, $00, $24, $1E, $19, $02 db $08, $19, $00, $04, $1B, $10, $53, $02 db $21, $E2, $7E, $3E, $02, $CD, $CF, $05 db $CD, $88, $6C, $CD, $A8, $37, $C3, $F7 db $37, $CD, $8B, $37, $D0, $1E, $3F, $AF db $12, $37, $C9, $03, $A6, $6C, $47, $0F db $3A, $00, $19, $02, $04, $19, $01, $04 db $19, $00, $04, $1B, $10, $53, $02, $21 db $E2, $7E, $3E, $02, $CD, $CF, $05, $21 db $1E, $58, $3E, $02, $CD, $CF, $05, $CD db $65, $37, $30, $08, $1E, $02, $01, $A3 db $60, $C3, $F4, $37, $CD, $7C, $37, $30 db $08, $1E, $02, $01, $9E, $61, $C3, $F4 db $37, $C3, $F7, $37, $04, $C2, $62, $0A db $03, $77, $6C, $47, $19, $00, $04, $19 db $01, $04, $24, $55, $0D, $AF, $0F, $0B db $10, $00, $19, $02, $0A, $19, $00, $04 db $1B, $10, $53, $02, $03, $20, $6D, $47 db $0F, $3A, $00, $04, $4D, $63, $0A, $24 db $4D, $19, $00, $04, $19, $01, $02, $19 db $00, $02, $19, $01, $08, $0F, $3A, $01 db $19, $01, $16, $03, $20, $6D, $47, $0F db $3A, $00, $19, $00, $04, $1B, $10, $53 db $02, $21, $E2, $7E, $3E, $02, $CD, $CF db $05, $CD, $88, $6C, $CD, $A8, $37, $1E db $15, $1A, $FE, $01, $20, $0B, $3E, $06 db $21, $57, $6D, $CD, $AA, $3A, $CD, $E4 db $3A, $1E, $3A, $1A, $B7, $28, $0E, $F0 db $A5, $E6, $02, $20, $08, $1E, $07, $01 db $12, $6D, $C3, $F4, $37, $C3, $F7, $37 db $03, $00, $00, $0C, $0D, $03, $8D, $6D db $47, $0F, $3A, $00, $0D, $AF, $0F, $0E db $10, $00, $0D, $73, $6D, $19, $01, $04 db $1B, $10, $53, $02, $FA, $76, $DB, $B7 db $C8, $FA, $36, $DA, $B7, $C0, $21, $78 db $DB, $2A, $EA, $00, $CD, $2A, $EA, $01 db $CD, $7E, $EA, $02, $CD, $C9, $21, $E2 db $7E, $3E, $02, $CD, $CF, $05, $CD, $65 db $37, $30, $08, $1E, $02, $01, $A3, $60 db $C3, $F4, $37, $CD, $7C, $37, $30, $08 db $1E, $02, $01, $9E, $61, $C3, $F4, $37 db $C3, $F7, $37, $04, $0C, $6A, $0A, $03 db $DE, $6D, $47, $24, $3F, $19, $00, $04 db $19, $01, $04, $0D, $AF, $0F, $0C, $10 db $FD, $0D, $AF, $0F, $14, $10, $F6, $0D db $AF, $0F, $15, $10, $04, $19, $02, $0A db $19, $01, $04, $1B, $40, $67, $02, $21 db $1C, $7F, $3E, $02, $CD, $CF, $05, $CD db $8B, $37, $CD, $A8, $37, $C3, $F7, $37 db $03, $13, $6E, $47, $04, $29, $65, $0A db $19, $00, $06, $24, $4D, $04, $B5, $6A db $0A, $19, $07, $06, $19, $06, $02, $19 db $07, $02, $0F, $3E, $1E, $19, $00, $08 db $1B, $40, $67, $02, $21, $1C, $7F, $3E db $02, $CD, $CF, $05, $21, $18, $6D, $3E db $02, $CD, $CF, $05, $CD, $8B, $37, $CD db $A8, $37, $C3, $F7, $37, $0F, $3E, $00 db $03, $13, $6E, $47, $04, $B5, $6A, $0A db $19, $07, $06, $04, $29, $65, $0A, $19 db $00, $06, $1B, $40, $67, $02, $03, $80 db $6E, $47, $0F, $39, $0A, $22, $69, $6E db $07, $04, $ED, $6B, $0A, $19, $00, $02 db $19, $01, $02, $19, $04, $02, $19, $05 db $02, $19, $02, $02, $19, $03, $02, $06 db $54, $6E, $24, $1D, $0D, $AF, $0F, $0F db $03, $10, $05, $04, $24, $1D, $0D, $AF db $0F, $10, $03, $10, $05, $04, $06, $69 db $6E, $21, $1C, $7F, $3E, $02, $CD, $CF db $05, $3E, $03, $21, $A9, $6E, $CD, $AA db $3A, $CD, $E4, $3A, $CD, $8B, $37, $CD db $A8, $37, $CD, $AE, $6E, $30, $08, $1E db $02, $01, $40, $67, $C3, $F4, $37, $C3 db $F7, $37, $03, $04, $08, $08, $08, $1E db $39, $1A, $B7, $28, $04, $3D, $12, $A7 db $C9, $F0, $A5, $E6, $02, $20, $F8, $37 db $C9, $10, $50, $0E, $01, $C7, $6E, $16 db $04, $46, $72, $0B, $01, $01, $0F, $4A db $01, $0F, $4B, $00, $1B, $9B, $4D, $03 db $0F, $47, $00, $10, $71, $0E, $04, $E6 db $6E, $8F, $70, $AF, $71, $C0, $72, $0F db $51, $02, $10, $5B, $0E, $07, $FB, $6E db $AD, $6F, $CB, $6F, $E3, $6F, $FD, $6F db $1E, $70, $4C, $70, $01, $20, $09, $04 db $0F, $47, $00, $05, $02, $0F, $47, $10 db $05, $02, $0A, $24, $3E, $0F, $47, $00 db $19, $20, $01, $04, $14, $52, $0A, $19 db $01, $01, $04, $40, $4F, $0A, $0F, $47 db $10, $19, $20, $01, $04, $14, $52, $0A db $0F, $47, $00, $19, $00, $01, $04, $40 db $4F, $0A, $19, $20, $01, $04, $14, $52 db $0A, $19, $03, $01, $04, $40, $4F, $0A db $0F, $47, $10, $19, $20, $01, $04, $14 db $52, $0A, $0F, $47, $00, $19, $02, $01 db $19, $01, $01, $19, $00, $01, $19, $03 db $01, $19, $02, $01, $19, $01, $01, $04 db $40, $4F, $0A, $0F, $47, $10, $19, $20 db $01, $04, $14, $52, $0A, $0F, $47, $00 db $19, $00, $01, $04, $40, $4F, $0A, $19 db $20, $01, $04, $14, $52, $0A, $19, $03 db $01, $22, $70, $70, $07, $04, $40, $4F db $0A, $0F, $47, $10, $19, $20, $02, $04 db $14, $52, $0A, $0F, $47, $00, $19, $02 db $01, $04, $40, $4F, $0A, $19, $20, $04 db $19, $04, $10, $19, $1E, $01, $0D, $77 db $0F, $02, $19, $1E, $17, $1D, $04, $78 db $52, $0A, $19, $0E, $02, $19, $0F, $02 db $19, $10, $02, $19, $11, $02, $19, $12 db $06, $19, $13, $02, $0D, $77, $0F, $02 db $19, $14, $0A, $1D, $09, $04, $04, $40 db $4F, $0A, $19, $00, $04, $04, $48, $55 db $0A, $19, $00, $04, $0A, $0D, $77, $0F db $02, $05, $14, $1D, $04, $B6, $55, $0A db $19, $00, $0A, $19, $01, $02, $0D, $AF db $0F, $09, $06, $00, $19, $02, $0A, $0D db $77, $0F, $02, $05, $14, $1D, $04, $03 db $56, $0A, $19, $00, $06, $19, $01, $04 db $19, $02, $04, $19, $03, $02, $19, $02 db $02, $0D, $77, $0F, $02, $19, $03, $10 db $19, $02, $04, $19, $01, $04, $1D, $04 db $57, $56, $0A, $19, $00, $0A, $09, $03 db $0D, $77, $0F, $0A, $19, $01, $02, $0D db $77, $0F, $0A, $19, $02, $02, $0D, $77 db $0F, $0A, $19, $03, $02, $0D, $77, $0F db $0A, $19, $04, $02, $0A, $0D, $77, $0F db $02, $19, $00, $14, $1D, $04, $A4, $56 db $0A, $19, $00, $05, $09, $03, $19, $01 db $02, $19, $02, $02, $19, $03, $02, $19 db $04, $02, $19, $05, $02, $19, $06, $02 db $0A, $0D, $77, $0F, $02, $19, $00, $0A db $1D, $0D, $92, $0F, $03, $FA, $00, $05 db $04, $0D, $92, $0F, $03, $FA, $FC, $05 db $04, $0D, $92, $0F, $03, $FA, $04, $05 db $04, $0D, $92, $0F, $03, $FA, $00, $00 db $10, $5B, $0E, $07, $A1, $70, $D9, $70 db $FD, $70, $15, $71, $32, $71, $4C, $71 db $7E, $71, $04, $68, $59, $0A, $19, $00 db $06, $19, $01, $04, $01, $02, $0F, $39 db $01, $0D, $AF, $0F, $07, $10, $04, $05 db $06, $0F, $39, $02, $0D, $AF, $0F, $07 db $10, $04, $05, $06, $0F, $39, $00, $0D db $AF, $0F, $07, $10, $04, $0D, $77, $0F db $02, $05, $06, $19, $01, $04, $19, $00 db $06, $1D, $04, $E5, $59, $0A, $19, $00 db $06, $19, $01, $06, $0D, $77, $0F, $02 db $09, $02, $19, $02, $04, $19, $03, $04 db $19, $04, $04, $19, $05, $04, $0A, $19 db $01, $06, $19, $00, $06, $1D, $09, $04 db $04, $2C, $57, $0A, $19, $02, $04, $04 db $CB, $5A, $0A, $19, $00, $04, $0A, $0D db $77, $0F, $02, $05, $14, $1D, $04, $4C db $5C, $0A, $19, $00, $08, $01, $01, $0D db $AF, $0F, $13, $00, $00, $0D, $77, $0F db $02, $19, $02, $20, $19, $01, $04, $19 db $00, $08, $1D, $04, $36, $5D, $0A, $19 db $00, $06, $19, $01, $03, $19, $00, $03 db $19, $01, $08, $0D, $77, $0F, $02, $05 db $14, $19, $00, $05, $1D, $04, $74, $5D db $0A, $0F, $39, $00, $09, $08, $0D, $AF db $0F, $0D, $0A, $05, $19, $00, $02, $0D db $AF, $0F, $0D, $0A, $05, $19, $01, $02 db $0D, $78, $71, $0A, $04, $2C, $57, $0A db $01, $02, $0D, $77, $0F, $02, $05, $14 db $1D, $1E, $39, $1A, $3C, $12, $C9, $0F db $39, $02, $04, $B8, $5D, $0A, $19, $00 db $06, $01, $01, $09, $05, $0D, $77, $0F db $0B, $0D, $A3, $71, $05, $02, $0A, $04 db $2C, $57, $0A, $01, $02, $0D, $77, $0F db $02, $05, $14, $1D, $1E, $39, $1A, $3C db $FE, $0B, $38, $02, $3E, $02, $12, $C9 db $10, $5B, $0E, $07, $C1, $71, $DD, $71 db $FD, $71, $15, $72, $32, $72, $4A, $72 db $8B, $72, $04, $1A, $61, $0A, $19, $00 db $04, $19, $01, $04, $0D, $AF, $0F, $08 db $10, $00, $01, $02, $0D, $77, $0F, $02 db $05, $14, $19, $00, $04, $1D, $04, $BB db $61, $0A, $19, $00, $06, $19, $01, $04 db $19, $02, $04, $19, $03, $08, $0D, $77 db $0F, $02, $05, $14, $19, $02, $04, $19 db $01, $04, $19, $00, $04, $1D, $09, $04 db $04, $99, $5E, $0A, $19, $02, $04, $04 db $3B, $62, $0A, $19, $01, $04, $0A, $0D db $77, $0F, $02, $05, $14, $1D, $04, $C2 db $62, $0A, $19, $00, $04, $19, $01, $04 db $24, $55, $0D, $AF, $0F, $0B, $10, $00 db $0D, $77, $0F, $02, $19, $02, $14, $19 db $00, $04, $1D, $04, $4D, $63, $0A, $19 db $00, $04, $19, $01, $02, $19, $00, $02 db $0D, $77, $0F, $02, $19, $01, $14, $19 db $00, $04, $1D, $04, $99, $5E, $0A, $19 db $02, $06, $04, $B9, $63, $0A, $19, $00 db $04, $0D, $77, $0F, $02, $03, $79, $72 db $47, $09, $05, $19, $02, $02, $19, $03 db $02, $0A, $0F, $1F, $80, $0D, $82, $72 db $0D, $AF, $0F, $0E, $10, $00, $19, $01 db $04, $1D, $21, $CF, $5C, $3E, $02, $CD db $CF, $05, $C9, $21, $73, $6D, $3E, $07 db $CD, $CF, $05, $C9, $04, $99, $5E, $0A db $01, $02, $0F, $3A, $02, $0D, $77, $0F db $02, $09, $05, $0F, $47, $10, $0D, $77 db $0F, $0C, $0D, $B4, $72, $05, $02, $0F db $47, $00, $0D, $77, $0F, $0C, $0D, $B4 db $72, $05, $02, $0A, $1D, $1E, $3A, $1A db $3C, $FE, $0B, $38, $02, $3E, $02, $12 db $C9, $10, $5B, $0E, $07, $D2, $72, $F6 db $72, $29, $73, $3F, $73, $66, $73, $85 db $73, $BD, $73, $04, $80, $67, $0A, $19 db $02, $06, $0D, $77, $0F, $02, $09, $05 db $19, $01, $02, $19, $00, $02, $0A, $19 db $02, $02, $19, $00, $02, $19, $02, $02 db $19, $01, $02, $19, $02, $06, $1D, $04 db $D1, $67, $0A, $19, $08, $04, $19, $09 db $02, $19, $08, $02, $0D, $77, $0F, $02 db $19, $09, $08, $19, $00, $02, $19, $01 db $01, $19, $02, $01, $19, $03, $02, $19 db $04, $01, $19, $05, $02, $19, $06, $02 db $19, $07, $01, $19, $09, $06, $19, $08 db $04, $1D, $04, $2F, $69, $0A, $19, $04 db $06, $19, $05, $04, $19, $06, $04, $01 db $00, $0D, $77, $0F, $02, $05, $14, $1D db $04, $0C, $6A, $0A, $19, $00, $04, $19 db $01, $04, $0D, $77, $0F, $02, $0D, $AF db $0F, $0C, $10, $FD, $0D, $AF, $0F, $14 db $10, $F6, $0D, $AF, $0F, $15, $10, $04 db $19, $02, $14, $19, $01, $04, $1D, $04 db $29, $65, $0A, $19, $00, $06, $04, $B5 db $6A, $0A, $19, $07, $06, $19, $06, $02 db $19, $07, $02, $0D, $77, $0F, $02, $19 db $00, $14, $19, $07, $06, $1D, $04, $ED db $6B, $0A, $0D, $77, $0F, $02, $22, $AA db $73, $07, $09, $02, $19, $00, $02, $19 db $01, $02, $19, $04, $02, $19, $05, $02 db $19, $02, $02, $19, $03, $02, $0A, $0F db $1C, $80, $1D, $0D, $AF, $0F, $0F, $03 db $10, $05, $04, $0D, $AF, $0F, $10, $03 db $10, $05, $04, $06, $AA, $73, $04, $E7 db $6C, $0A, $0D, $77, $0F, $02, $19, $00 db $04, $22, $E8, $73, $07, $19, $01, $0D db $19, $02, $0D, $19, $03, $0D, $19, $04 db $0D, $19, $05, $0D, $19, $06, $0D, $0F db $1C, $80, $0D, $F5, $73, $19, $00, $04 db $1D, $24, $1E, $0D, $AF, $0F, $12, $00 db $00, $05, $06, $06, $E8, $73, $1E, $15 db $1A, $FE, $04, $D8, $1E, $45, $1A, $EE db $80, $12, $C9, $01, $02, $00, $FE, $FF db $02, $00, $FE toc_07_740A: ld h, d ld a, [$A076] or a jr nz, .else_07_7420 ld l, $19 set 5, [hl] ld l, $1C set 5, [hl] ld l, $1F set 5, [hl] call toc_01_0E2C .else_07_7420: ld bc, $A076 ld a, [bc] ld hl, $7402 add a, a add a, l ld l, a jr nc, .else_07_742D inc h .else_07_742D: ldi a, [hl] ld h, [hl] ld l, a ld e, $09 ld a, [de] add a, h ld [de], a ld e, $0B ld a, [de] add a, l ld [de], a ld a, [bc] inc a ld [bc], a cp $04 ret c ld h, d ld l, $19 res 5, [hl] ld l, $1C res 5, [hl] ld l, $1F res 5, [hl] ld l, $6C res 0, [hl] ret db $CD, $58, $74, $C3, $8B, $74 toc_07_7458: ld a, [$A071] ld hl, $7468 add a, l ld l, a jr nc, .else_07_7463 inc h .else_07_7463: ld a, [hl] ld [$DF11], a ret db $00, $09, $12, $1B, $CD, $72, $74, $C3 db $8B, $74 toc_07_7472: ld a, [$A071] ld hl, $7487 add a, l ld l, a jr nc, .else_07_747D inc h .else_07_747D: ld a, [hl] ld hl, $A05B add a, [hl] inc a ld [$DF11], a ret db $01, $0A, $13, $1C, $FA, $11, $DF, $C5 db $26, $00, $6F, $44, $4D, $29, $09, $29 db $09, $01, $BB, $74, $09, $1E, $65, $2A db $12, $1C, $2A, $12, $1E, $67, $2A, $12 db $1C, $2A, $12, $1C, $2A, $12, $1E, $6A db $2A, $12, $1C, $7E, $12, $3E, $01, $1E db $64, $12, $C1, $C9, $00, $81, $00, $40 db $09, $80, $02, $80, $83, $80, $42, $09 db $20, $02, $80, $83, $A0, $44, $09, $E0 db $01, $80, $83, $80, $46, $09, $80, $02 db $80, $83, $00, $49, $09, $60, $01, $80 db $83, $60, $4A, $09, $A0, $01, $80, $83 db $00, $4C, $09, $60, $02, $80, $83, $60 db $4E, $09, $60, $01, $80, $83, $C0, $4F db $09, $A0, $01, $00, $81, $60, $51, $09 db $C0, $02, $C0, $83, $20, $54, $09, $40 db $02, $C0, $83, $60, $56, $09, $00, $02 db $C0, $83, $60, $58, $09, $40, $02, $C0 db $83, $A0, $5A, $09, $00, $02, $C0, $83 db $E0, $5C, $09, $40, $02, $C0, $83, $20 db $5F, $09, $C0, $01, $C0, $83, $60, $61 db $09, $A0, $01, $C0, $83, $00, $63, $09 db $E0, $01, $00, $81, $E0, $64, $09, $C0 db $02, $C0, $83, $A0, $67, $09, $40, $02 db $C0, $83, $E0, $69, $09, $20, $02, $C0 db $83, $00, $6C, $09, $20, $02, $C0, $83 db $40, $6E, $09, $40, $02, $C0, $83, $80 db $70, $09, $40, $02, $C0, $83, $C0, $72 db $09, $80, $01, $C0, $83, $40, $74, $09 db $40, $02, $C0, $83, $80, $76, $09, $E0 db $01, $00, $81, $60, $78, $09, $00, $03 db $00, $84, $00, $40, $0A, $00, $02, $00 db $84, $00, $42, $0A, $E0, $01, $00, $84 db $00, $44, $0A, $00, $02, $00, $84, $00 db $46, $0A, $E0, $01, $00, $84, $00, $48 db $0A, $C0, $01, $00, $84, $C0, $49, $0A db $80, $01, $00, $84, $C0, $4B, $0A, $80 db $01, $00, $84, $40, $4D, $0A, $00, $02 db $00, $81, $00, $40, $0B, $A0, $03, $60 db $88, $A0, $43, $0B, $00, $05, $60, $88 db $A0, $48, $0B, $80, $05, $60, $88, $20 db $4E, $0B, $40, $05, $40, $8A, $A0, $43 db $0B, $00, $05, $40, $8A, $A0, $48, $0B db $80, $05, $40, $8A, $20, $4E, $0B, $40 db $05, $00, $81, $A0, $43, $0B, $00, $05 db $00, $81, $A0, $48, $0B, $80, $05, $00 db $81, $20, $4E, $0B, $40, $05, $00, $80 db $71, $65, $10, $00, $06, $60, $88, $71 db $6B, $10, $A0, $06, $00, $80, $FD, $79 db $1A, $C0, $00, $00, $80, $CD, $7A, $1A db $00, $01, $00, $80, $CD, $7B, $1A, $C0 db $00, $80, $83, $11, $72, $10, $C0, $00 db $C0, $83, $80, $76, $09, $E0, $01, $00 db $81, $60, $78, $09, $00, $03, $00, $84 db $00, $40, $0A, $00, $02, $00, $84, $00 db $42, $0A, $E0, $01, $00, $84, $00, $44 db $0A, $00, $02, $00, $84, $00, $46, $0A db $E0, $01, $00, $84, $00, $48, $0A, $C0 db $01, $00, $84, $C0, $49, $0A, $80, $01 db $00, $84, $C0, $4B, $0A, $80, $01, $00 db $84, $40, $4D, $0A, $00, $02, $00, $81 db $00, $40, $0B, $A0, $03, $60, $88, $A0 db $43, $0B, $00, $05, $60, $88, $A0, $48 db $0B, $80, $05, $60, $88, $20, $4E, $0B db $40, $05, $40, $8A, $A0, $43, $0B, $00 db $05, $40, $8A, $A0, $48, $0B, $80, $05 db $40, $8A, $20, $4E, $0B, $40, $05, $00 db $81, $A0, $43, $0B, $00, $05, $00, $81 db $A0, $48, $0B, $80, $05, $00, $81, $20 db $4E, $0B, $40, $05, $00, $80, $71, $65 db $10, $00, $06, $60, $88, $71, $6B, $10 db $A0, $06, $00, $80, $FD, $79, $1A, $C0 db $00, $00, $80, $CD, $7A, $1A, $00, $01 db $00, $80, $CD, $7B, $1A, $C0, $00, $80 db $83, $11, $72, $10, $C0, $00, $40, $74 db $09, $40, $02, $C0, $83, $80, $76, $09 db $E0, $01, $00, $81, $60, $78, $09, $00 db $03, $00, $84, $00, $40, $0A, $00, $02 db $00, $84, $00, $42, $0A, $E0, $01, $00 db $84, $01, $40, $01, $C2, $45, $07, $3A db $4C, $07, $C0, $6E, $07, $09, $54, $03 db $37, $54, $03, $E3, $55, $03, $00, $40 db $03, $34, $40, $03, $28, $63, $03, $9F db $65, $03, $09, $66, $03, $F1, $44, $03 db $0A, $48, $03, $E5, $5B, $03, $CA, $40 db $04, $39, $42, $04, $00, $40, $01, $1B db $5F, $03, $EF, $5F, $03, $78, $61, $0E db $00, $68, $03, $7D, $68, $03, $12, $70 db $03, $91, $71, $03, $2D, $4B, $05, $8F db $4B, $05, $3C, $4D, $05, $F1, $73, $03 db $66, $79, $03, $2C, $43, $1A, $AC, $45 db $1A, $BF, $45, $1A, $C8, $45, $1A, $05 db $46, $1A, $99, $48, $07, $B1, $46, $07 db $26, $49, $07, $2D, $7C, $04, $83, $7D db $04, $DD, $7A, $03, $31, $7D, $03, $2B db $7D, $03, $2C, $7D, $03, $33, $53, $08 db $03, $56, $08, $82, $57, $08, $1F, $46 db $1A, $1C, $58, $03, $B1, $58, $03, $9F db $40, $05, $C2, $42, $05, $83, $50, $05 db $53, $57, $05, $88, $5B, $05, $8F, $5D db $05, $E5, $5D, $05, $8E, $60, $05, $BC db $63, $05, $0D, $65, $05, $8E, $66, $05 db $94, $66, $05, $E9, $6A, $05, $21, $6C db $05, $19, $6E, $05, $41, $6F, $05, $F6 db $72, $05, $09, $79, $05, $86, $6C, $03 db $1E, $63, $0E, $99, $63, $0E, $2E, $6E db $03, $54, $75, $05, $2B, $77, $05, $73 db $77, $05, $CD, $77, $05, $26, $78, $05 db $98, $67, $1C, $40, $68, $1C, $9C, $68 db $1C, $F9, $68, $1C, $F7, $69, $1C, $1E db $6A, $1C, $4A, $6A, $1C, $67, $6A, $1C db $C5, $6A, $1C, $D2, $6B, $1C, $EB, $6B db $1C, $50, $6C, $1C, $6B, $6C, $1C, $90 db $6C, $1C, $AB, $6C, $1C, $C6, $6C, $1C db $69, $6D, $1C, $CE, $6D, $1C, $24, $6E db $1C, $5B, $6E, $1C, $B2, $6E, $1C, $23 db $6F, $1C, $68, $6F, $1C, $83, $6F, $1C db $A1, $6F, $1C, $15, $71, $1C, $86, $71 db $1C, $AB, $71, $1C, $0D, $72, $1C, $2E db $72, $1C, $4F, $72, $1C, $79, $72, $1C db $96, $72, $1C, $2B, $74, $1C, $63, $74 db $1C, $94, $74, $1C, $C5, $74, $1C, $30 db $75, $1C, $55, $75, $1C, $B6, $75, $1C db $2D, $76, $1C, $B4, $76, $1C, $CA, $5B db $0E, $11, $5C, $0E, $3D, $5C, $0E, $69 db $5C, $0E, $DE, $5F, $0E, $95, $5C, $0E db $DA, $5C, $0E, $F8, $5C, $0E, $16, $5D db $0E, $6F, $5D, $0E, $99, $5D, $0E, $BD db $5D, $0E, $E1, $5D, $0E, $05, $5E, $0E db $0C, $61, $0E, $29, $5E, $0E, $94, $5E db $0E, $DF, $5E, $0E, $28, $5F, $0E, $A9 db $5F, $0E, $04, $6E, $18, $F7, $74, $18 db $1F, $75, $18, $43, $75, $18, $6B, $75 db $18, $93, $75, $18, $E1, $75, $18, $8B db $76, $18, $87, $6E, $18, $F6, $72, $18 db $E3, $70, $18, $E6, $73, $18, $12, $74 db $18, $63, $73, $18, $D6, $71, $18, $E6 db $44, $0F, $E3, $47, $0F, $1D, $45, $0F db $54, $45, $0F, $93, $6C, $08, $BE, $6C db $08, $84, $5F, $08, $74, $47, $1A, $E0 db $5E, $08, $B5, $60, $08, $62, $4A, $07 db $89, $47, $1A, $07, $48, $1A, $6B, $67 db $0F, $20, $69, $0F, $16, $6C, $0F, $47 db $6C, $0F, $EE, $4E, $1A, $08, $4F, $1A db $1D, $4F, $1A, $37, $4F, $1A, $4C, $4F db $1A, $66, $4F, $1A, $7B, $4F, $1A, $95 db $4F, $1A, $B4, $4F, $1A, $21, $51, $1A db $7E, $51, $1A, $DB, $51, $1A, $38, $52 db $1A, $95, $52, $1A, $EC, $52, $1A, $43 db $53, $1A, $5D, $53, $1A, $77, $53, $1A db $91, $53, $1A, $AB, $53, $1A, $2B, $60 db $1A, $5C, $62, $1A, $F6, $69, $1A, $EB db $6E, $1A, $67, $62, $1A, $71, $63, $1A db $AF, $63, $1A, $EC, $64, $1A, $E8, $68 db $1A, $40, $69, $1A, $4E, $69, $1A, $87 db $41, $06, $C1, $46, $06, $24, $41, $0E db $2C, $49, $0E, $19, $5D, $0F, $44, $5D db $0F, $BE, $5D, $0F, $D0, $5B, $06, $11 db $5C, $06, $30, $72, $06, $C8, $40, $1D db $21, $49, $1D, $39, $4D, $1D, $45, $5C db $1D, $C5, $63, $1D, $BF, $74, $1D, $79 db $43, $19, $09, $44, $19, $0D, $44, $19 db $7F, $44, $19, $37, $44, $19, $13, $45 db $19, $48, $45, $19, $50, $4C, $19, $71 db $45, $19, $9D, $4C, $19, $B9, $4C, $19 db $D5, $4C, $19, $F1, $4C, $19, $0D, $4D db $19, $29, $4D, $19, $45, $4D, $19, $61 db $4D, $19, $7D, $4D, $19, $99, $4D, $19 db $B5, $4D, $19, $D1, $4D, $19, $ED, $4D db $19, $09, $4E, $19, $25, $4E, $19, $41 db $4E, $19, $5D, $4E, $19, $8B, $4E, $19 db $ED, $7A, $19, $2C, $66, $0E, $03, $6D db $0E, $E7, $58, $08, $00, $00, $00, $00 db $00, $00, $00, $00, $88, $00, $00, $02 db $00, $00, $02, $00, $01, $00, $00, $00 db $00, $04, $06, $06, $06, $06, $05, $05 db $05, $05, $04, $08, $08, $0C, $0E, $0E db $0F, $0F, $11, $12, $12, $12, $12, $09 db $09, $0A, $0A, $14, $14, $15, $15, $15 db $15, $17, $17, $17, $17, $17, $17, $17 db $17, $17, $17, $17, $17, $18, $18, $18 db $18, $18, $18, $18, $18, $18, $18, $1C db $1C, $1C, $1C, $1C, $1C, $1E, $1E, $1E db $19, $19, $19, $19, $1B, $1B, $26, $26 db $1B, $1B, $26, $26, $17, $28, $28, $28 db $28, $30, $30, $26, $26, $26, $26, $26 db $26, $32, $A1, $A2, $A5, $A5, $A5, $A5 db $A5, $A5, $A5, $A5, $A6, $26, $26, $26 db $26, $28, $28, $28, $28, $34, $34, $35 db $35, $35, $35, $CA, $CC, $17, $D1, $D4 db $36, $36, $36, $36, $37, $37, $39, $39 db $D6, $D8, $22, $1E, $1E, $3A, $3A, $3B db $3B, $3D, $3D, $40, $40, $40, $40, $40 db $40, $42, $42, $42, $42, $42, $42, $45 db $45, $45, $45, $3E, $3E, $3E, $3E, $3F db $3F, $2C, $29, $2E, $2E, $05, $05, $05 db $05, $1C, $1C, $1C, $1C, $1C, $1C, $44 db $44, $44, $44, $2A, $47, $47, $47, $47 db $2D, $BF, $C0, $C3, $C4, $C1, $11, $11 db $11, $11, $11, $11, $11, $11, $11, $11 db $11, $11, $11, $11, $11, $11, $2B, $C0 db $C5, $C0, $09, $08, $C6, $2E, $15, $15 db $15, $15, $15, $FF, $FF, $FF, $FF, $FF db $FF, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $02, $00, $80, $00, $00 db $00, $00, $00, $10, $01, $11, $00, $10 db $01, $11, $00, $00, $00, $00, $00, $10 db $00, $00, $00, $00, $10, $01, $11, $00 db $10, $00, $01, $00, $10, $00, $10, $00 db $10, $00, $10, $01, $11, $02, $12, $03 db $13, $04, $14, $05, $15, $00, $10, $01 db $11, $02, $12, $03, $13, $04, $14, $00 db $10, $01, $01, $02, $12, $01, $02, $03 db $00, $10, $01, $11, $00, $10, $00, $10 db $01, $11, $01, $11, $06, $00, $10, $20 db $31, $00, $10, $02, $12, $03, $13, $04 db $14, $00, $00, $00, $00, $01, $02, $03 db $04, $05, $06, $07, $00, $05, $15, $06 db $16, $01, $11, $21, $31, $00, $10, $00 db $10, $01, $11, $00, $00, $FF, $00, $00 db $00, $10, $01, $11, $00, $10, $00, $10 db $00, $00, $00, $00, $04, $00, $01, $00 db $10, $00, $10, $00, $00, $01, $01, $10 db $10, $00, $10, $01, $11, $02, $12, $00 db $10, $01, $11, $00, $10, $01, $11, $00 db $10, $00, $00, $00, $00, $02, $12, $03 db $13, $03, $13, $04, $14, $05, $15, $00 db $10, $01, $11, $00, $00, $10, $01, $11 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $11, $01, $00, $01, $01, $11 db $21, $31, $41, $FF, $FF, $FF, $FF, $FF db $FF, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $20, $00, $02, $00, $80, $00, $88 db $00, $01, $00, $10, $04, $08, $00, $08 db $00, $01, $01, $01, $01, $01, $01, $01 db $01, $01, $01, $01, $01, $3C, $01, $01 db $01, $01, $01, $01, $01, $01, $01, $01 db $01, $01, $01, $01, $01, $FF, $FF, $FF db $FF, $01, $01, $01, $01, $01, $01, $01 db $01, $01, $01, $01, $01, $01, $01, $01 db $01, $01, $01, $01, $01, $01, $01, $01 db $01, $01, $01, $01, $01, $01, $01, $01 db $01, $01, $01, $01, $01, $01, $1E, $1E db $01, $01, $1E, $1E, $01, $00, $00, $00 db $00, $01, $01, $1E, $1E, $1E, $1E, $1E db $1E, $3C, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $1E, $1E, $1E db $1E, $01, $01, $01, $01, $01, $01, $01 db $01, $01, $01, $23, $3C, $01, $28, $3C db $01, $01, $01, $01, $01, $01, $01, $01 db $78, $78, $00, $01, $01, $01, $01, $01 db $01, $01, $01, $01, $01, $01, $01, $01 db $01, $01, $01, $01, $01, $01, $01, $01 db $01, $01, $01, $01, $01, $01, $01, $01 db $01, $00, $00, $40, $C0, $01, $01, $01 db $01, $01, $01, $01, $01, $01, $01, $01 db $01, $01, $01, $00, $01, $01, $01, $01 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $01, $01, $00, $40, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $80, $00, $00, $00, $00, $80, $00 db $20, $00, $00, $00, $00, $80, $00, $10 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $10, $10, $10, $10, $10, $10 db $10, $10, $00, $20, $20, $00, $20, $20 db $20, $20, $00, $20, $20, $20, $20, $20 db $20, $10, $10, $20, $20, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $20 db $20, $20, $20, $20, $20, $00, $00, $00 db $10, $10, $10, $10, $20, $20, $50, $50 db $20, $20, $50, $50, $00, $00, $00, $00 db $00, $20, $20, $50, $50, $50, $50, $50 db $50, $50, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $50, $50, $50 db $50, $00, $00, $00, $00, $20, $20, $20 db $20, $20, $20, $00, $00, $00, $50, $50 db $20, $20, $20, $20, $10, $10, $50, $50 db $00, $00, $00, $00, $00, $15, $15, $10 db $10, $75, $75, $10, $10, $10, $10, $10 db $10, $00, $00, $00, $00, $00, $00, $20 db $20, $20, $20, $05, $05, $10, $10, $20 db $20, $00, $00, $00, $00, $10, $10, $10 db $10, $20, $20, $20, $20, $20, $20, $10 db $10, $10, $10, $00, $20, $20, $20, $20 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $20, $20, $00, $00, $00, $00 db $00, $00, $00, $FF, $FF, $FF, $FF, $FF db $FF, $80, $10, $00, $00, $00, $08, $00 db $34, $00, $00, $88, $00, $20, $00, $00 db $40, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $05, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $01, $01 db $00, $00, $01, $01, $00, $00, $00, $00 db $00, $00, $00, $01, $01, $01, $01, $01 db $01, $07, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $01, $01, $01 db $01, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $05, $10, $00, $02, $12 db $00, $00, $00, $00, $00, $00, $00, $00 db $50, $25, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $01, $01, $01, $01, $01, $01, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $FF, $FF, $FF, $FF, $FF db $FF, $84, $00, $C0, $40, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $0B, $00, $00, $00, $00, $01, $01 db $01, $01, $0B, $02, $02, $03, $05, $05 db $06, $06, $13, $0A, $0A, $0A, $0A, $04 db $04, $00, $00, $07, $07, $08, $08, $08 db $08, $0C, $0C, $0C, $0C, $0C, $0C, $0C db $0C, $0C, $0C, $0C, $0C, $0C, $0C, $0C db $0C, $0C, $0C, $0C, $0C, $0C, $0C, $0F db $0F, $0F, $0F, $0F, $0F, $11, $11, $11 db $0D, $0D, $0D, $0D, $0E, $0E, $10, $10 db $0E, $0E, $12, $12, $0C, $13, $14, $15 db $16, $17, $17, $18, $18, $19, $19, $1A db $1A, $1B, $1C, $1F, $1D, $1D, $1D, $1D db $1D, $1D, $1D, $1D, $1D, $20, $20, $21 db $21, $13, $14, $15, $16, $22, $22, $23 db $23, $23, $23, $26, $27, $0C, $28, $29 db $24, $24, $24, $24, $25, $25, $2A, $2A db $2B, $2C, $1F, $11, $11, $2D, $2D, $2E db $2E, $2F, $2F, $30, $30, $30, $30, $30 db $30, $31, $31, $32, $32, $33, $33, $34 db $34, $34, $34, $35, $35, $36, $36, $37 db $37, $1F, $38, $39, $39, $01, $01, $01 db $01, $0F, $0F, $0F, $0F, $0F, $0F, $00 db $00, $00, $00, $1F, $37, $37, $37, $37 db $3A, $3B, $3C, $3D, $0C, $0C, $3E, $3E db $3E, $3E, $3E, $3E, $3E, $3E, $3E, $3E db $3E, $3E, $3E, $3E, $3E, $3E, $1F, $3F db $40, $41, $04, $02, $40, $39, $08, $08 db $08, $08, $08, $FF, $FF, $FF, $FF, $FF db $FF, $00, $00, $00, $00, $80, $40, $80 db $00, $00, $00, $20, $00, $08, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00, $00, $00, $00, $00, $00, $00, $00 db $00
29.510042
96
0.394838
dc5dbe3591c346628b156df30662e9e64ef095aa
2,252
asm
Assembly
Palmtree.Math.Core.Sint/vs_build/x64_Debug/pmc_statistics.asm
rougemeilland/Palmtree.Math.Core.Sint
0895fd4988b146f01ec705e091ef3fd79a721b40
[ "MIT" ]
null
null
null
Palmtree.Math.Core.Sint/vs_build/x64_Debug/pmc_statistics.asm
rougemeilland/Palmtree.Math.Core.Sint
0895fd4988b146f01ec705e091ef3fd79a721b40
[ "MIT" ]
null
null
null
Palmtree.Math.Core.Sint/vs_build/x64_Debug/pmc_statistics.asm
rougemeilland/Palmtree.Math.Core.Sint
0895fd4988b146f01ec705e091ef3fd79a721b40
[ "MIT" ]
null
null
null
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.16.27026.1 include listing.inc INCLUDELIB MSVCRTD INCLUDELIB OLDNAMES _DATA SEGMENT COMM uint_number_zero:QWORD COMM uint_number_one:QWORD _DATA ENDS msvcjmc SEGMENT __7B7A869E_ctype@h DB 01H __457DD326_basetsd@h DB 01H __4384A2D9_corecrt_memcpy_s@h DB 01H __4E51A221_corecrt_wstring@h DB 01H __2140C079_string@h DB 01H __1887E595_winnt@h DB 01H __9FC7C64B_processthreadsapi@h DB 01H __FA470AEC_memoryapi@h DB 01H __F37DAFF1_winerror@h DB 01H __7A450CCC_winbase@h DB 01H __B4B40122_winioctl@h DB 01H __86261D59_stralign@h DB 01H __36F30452_pmc_statistics@c DB 01H msvcjmc ENDS PUBLIC PMC_GetStatisticsInfo PUBLIC __JustMyCode_Default EXTRN _RTC_InitBase:PROC EXTRN _RTC_Shutdown:PROC EXTRN __CheckForDebuggerJustMyCode:PROC EXTRN ep_uint:BYTE ; COMDAT pdata pdata SEGMENT $pdata$PMC_GetStatisticsInfo DD imagerel $LN3 DD imagerel $LN3+77 DD imagerel $unwind$PMC_GetStatisticsInfo pdata ENDS ; COMDAT rtc$TMZ rtc$TMZ SEGMENT _RTC_Shutdown.rtc$TMZ DQ FLAT:_RTC_Shutdown rtc$TMZ ENDS ; COMDAT rtc$IMZ rtc$IMZ SEGMENT _RTC_InitBase.rtc$IMZ DQ FLAT:_RTC_InitBase rtc$IMZ ENDS ; COMDAT xdata xdata SEGMENT $unwind$PMC_GetStatisticsInfo DD 025052a01H DD 010e2313H DD 07007001dH DD 05006H xdata ENDS ; Function compile flags: /Odt ; COMDAT __JustMyCode_Default _TEXT SEGMENT __JustMyCode_Default PROC ; COMDAT ret 0 __JustMyCode_Default ENDP _TEXT ENDS ; Function compile flags: /Odtp /RTCsu /ZI ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.sint\palmtree.math.core.sint\pmc_statistics.c ; COMDAT PMC_GetStatisticsInfo _TEXT SEGMENT statistics_info$ = 224 PMC_GetStatisticsInfo PROC ; COMDAT ; 31 : { $LN3: mov QWORD PTR [rsp+8], rcx push rbp push rdi sub rsp, 232 ; 000000e8H lea rbp, QWORD PTR [rsp+32] mov rdi, rsp mov ecx, 58 ; 0000003aH mov eax, -858993460 ; ccccccccH rep stosd mov rcx, QWORD PTR [rsp+264] lea rcx, OFFSET FLAT:__36F30452_pmc_statistics@c call __CheckForDebuggerJustMyCode ; 32 : ep_uint.GetStatisticsInfo(statistics_info); mov rcx, QWORD PTR statistics_info$[rbp] call QWORD PTR ep_uint+8 ; 33 : } lea rsp, QWORD PTR [rbp+200] pop rdi pop rbp ret 0 PMC_GetStatisticsInfo ENDP _TEXT ENDS END
22.979592
108
0.802842
98f4c10ab292131eb73c00fefc8a563a605564a4
94
asm
Assembly
public/wintab/wintabx/pktunhk.asm
DannyParker0001/Kisak-Strike
99ed85927336fe3aff2efd9b9382b2b32eb1d05d
[ "Unlicense" ]
252
2020-12-16T15:34:43.000Z
2022-03-31T23:21:37.000Z
cstrike15_src/public/wintab/wintabx/pktunhk.asm
bahadiraraz/Counter-Strike-Global-Offensive
9a0534100cb98ffa1cf0c32e138f0e7971e910d3
[ "MIT" ]
23
2020-12-20T18:02:54.000Z
2022-03-28T16:58:32.000Z
cstrike15_src/public/wintab/wintabx/pktunhk.asm
bahadiraraz/Counter-Strike-Global-Offensive
9a0534100cb98ffa1cf0c32e138f0e7971e910d3
[ "MIT" ]
42
2020-12-19T04:32:33.000Z
2022-03-30T06:00:28.000Z
include xlibproc.inc include Wintab.inc PROC_TEMPLATE WTMgrPacketUnhook, 1, Wintab, -, 204
23.5
51
0.787234
e3e527ca158913d22ca02baec131872c24cb2fec
819
asm
Assembly
oeis/142/A142033.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/142/A142033.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/142/A142033.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A142033: Primes congruent to 29 mod 31. ; Submitted by Jon Maiga ; 29,277,401,463,587,773,1021,1579,1889,1951,2137,2447,2633,2819,3067,3191,3253,4493,4679,5051,5113,5237,5857,5981,6043,6229,6353,6911,7159,7283,7717,7841,8089,8461,8647,9391,9887,9949,10259,10321,10631,11003,11251,11437,11933,12119,12491,12553,12739,13049,13297,13421,13669,14537,14723,15467,15901,16087,16273,16831,17203,17327,17389,17761,18133,18257,18443,18691,19001,19249,19373,19559,19993,20117,20551,21419,21481,21977,22039,22349,22721,22783,22907,23279,23899,24023,24767,24953,25759,26317 mov $2,$0 add $2,6 pow $2,2 lpb $2 mov $3,$4 add $3,28 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 mov $1,$0 max $1,0 cmp $1,$0 mul $2,$1 add $3,1 sub $2,$3 add $4,62 lpe mov $0,$4 add $0,29
35.608696
496
0.726496
777153fb0ceec9c6e66b56dd883c53a2f5677191
617
a51
Assembly
Tarefa 4/main44.a51
raphaelmoletta/CSW40
69912ae95f283a6a6e3de0d501195ef5118d5cce
[ "MIT" ]
null
null
null
Tarefa 4/main44.a51
raphaelmoletta/CSW40
69912ae95f283a6a6e3de0d501195ef5118d5cce
[ "MIT" ]
null
null
null
Tarefa 4/main44.a51
raphaelmoletta/CSW40
69912ae95f283a6a6e3de0d501195ef5118d5cce
[ "MIT" ]
null
null
null
; ----------------------------------------------------------------- ; Programa para deslocamento dos leds ; ------------------------------------------------------------------ org 0000h ACENDE: CLR P3.6 acall delay CLR P3.7 acall delay CLR P1.4 acall delay CPL P1.4 acall delay CPL P3.7 acall delay CPL P3.6 acall delay JMP ACENDE ;-----Rotina de delay--------- delay: mov r0,#8d loop1: mov r1,#250d loop: mov R2,#250d djnz r2,$ ; jump para a mesma linha djnz r1,loop djnz r0,loop1 ret ;----------------------------- end
16.675676
68
0.411669
0da6e1ba607c9918ed69215caf38327fd7af46c3
1,535
asm
Assembly
GDRS.asm
Gabidal/GDR
0786631f8789864431354637e298914ece0b7512
[ "MIT" ]
null
null
null
GDRS.asm
Gabidal/GDR
0786631f8789864431354637e298914ece0b7512
[ "MIT" ]
null
null
null
GDRS.asm
Gabidal/GDR
0786631f8789864431354637e298914ece0b7512
[ "MIT" ]
null
null
null
section .text [section .data] layer4 dd 0, 3h layer5 dd 0, 3h layer6 dd 0, 3h [section .code] copy: call Finish pop eax pop ecx pop esi pop edi repz movsb push eax ret put: call Finish pop eax mov [layer4], eax pop ecx pop ebx ;offset pop esi ;the array addition pop edi ;to add here add edi, ebx ;give the main array index to add the offset repz movsb mov eax, dword [layer4] push eax ret toChar: call Finish pop ebx pop edi pop esi ;source of the string FORCHAR: mov al, byte [esi] add al, 48 mov [esi], al add esi, 1b cmp ecx, edi inc ecx jbe FORCHAR push ebx ret ;LAYER 5 FUNCTIONS getByte: call Finish pop eax mov [layer5], eax pop ebx pop esi pop edi xchg ecx, ecx getbit: mov al, byte [esi] mov [edi], al add esi, 1b add edi, 1b add ecx, 1 cmp al, ";" je ENDOFSTRING cmp al, bl jne getbit ENDOFSTRING: push esi mov eax, dword [layer5] push eax ret DBgetByte: pop eax mov [layer6], eax pop ebx pop esi pop edi xchg ecx, ecx DBgetbit: mov al, byte [esi] mov [edi], al add esi, 1b add edi, 1b add ecx, 1 cmp al, ";" je DBENDOFSTRING cmp al, bl jne DBgetbit DBENDOFSTRING: push esi mov eax, dword [layer6] push eax ret
15.505051
61
0.530293
a6515d6d769a1f37e1ebcaae09d6cc297281a2b1
34,224
asm
Assembly
Palmtree.Math.Core.Implements/vs_build/x64_Release/pmc_compare.asm
rougemeilland/Palmtree.Math.Core.Implements
52f4f6c765d16c9b0baf1fd212c61a33daae138c
[ "MIT" ]
null
null
null
Palmtree.Math.Core.Implements/vs_build/x64_Release/pmc_compare.asm
rougemeilland/Palmtree.Math.Core.Implements
52f4f6c765d16c9b0baf1fd212c61a33daae138c
[ "MIT" ]
null
null
null
Palmtree.Math.Core.Implements/vs_build/x64_Release/pmc_compare.asm
rougemeilland/Palmtree.Math.Core.Implements
52f4f6c765d16c9b0baf1fd212c61a33daae138c
[ "MIT" ]
null
null
null
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.16.27026.1 include listing.inc INCLUDELIB MSVCRT INCLUDELIB OLDNAMES PUBLIC Compare_Imp PUBLIC Initialize_Compare PUBLIC PMC_Compare_I_X PUBLIC PMC_Compare_L_X PUBLIC PMC_Compare_X_I PUBLIC PMC_Compare_X_L PUBLIC PMC_Compare_X_X EXTRN CheckNumber:PROC ; COMDAT pdata pdata SEGMENT $pdata$PMC_Compare_I_X DD imagerel $LN29 DD imagerel $LN29+232 DD imagerel $unwind$PMC_Compare_I_X pdata ENDS ; COMDAT pdata pdata SEGMENT $pdata$PMC_Compare_L_X DD imagerel $LN61 DD imagerel $LN61+236 DD imagerel $unwind$PMC_Compare_L_X pdata ENDS ; COMDAT pdata pdata SEGMENT $pdata$PMC_Compare_X_I DD imagerel $LN29 DD imagerel $LN29+149 DD imagerel $unwind$PMC_Compare_X_I pdata ENDS ; COMDAT pdata pdata SEGMENT $pdata$PMC_Compare_X_L DD imagerel $LN61 DD imagerel $LN61+153 DD imagerel $unwind$PMC_Compare_X_L pdata ENDS ; COMDAT pdata pdata SEGMENT $pdata$PMC_Compare_X_X DD imagerel $LN31 DD imagerel $LN31+245 DD imagerel $unwind$PMC_Compare_X_X pdata ENDS ; COMDAT xdata xdata SEGMENT $unwind$PMC_Compare_X_X DD 060f01H DD 07640fH DD 06340fH DD 0700b320fH xdata ENDS ; COMDAT xdata xdata SEGMENT $unwind$PMC_Compare_X_L DD 060f01H DD 07640fH DD 06340fH DD 0700b320fH xdata ENDS ; COMDAT xdata xdata SEGMENT $unwind$PMC_Compare_X_I DD 060f01H DD 07640fH DD 06340fH DD 0700b320fH xdata ENDS ; COMDAT xdata xdata SEGMENT $unwind$PMC_Compare_L_X DD 060f01H DD 07640fH DD 06340fH DD 0700b320fH xdata ENDS ; COMDAT xdata xdata SEGMENT $unwind$PMC_Compare_I_X DD 060f01H DD 07640fH DD 06340fH DD 0700b320fH xdata ENDS ; Function compile flags: /Ogtpy ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_compare.c ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_inline_func.h ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_compare.c ; COMDAT PMC_Compare_X_L_Imp _TEXT SEGMENT u$ = 8 v$ = 16 w$ = 24 PMC_Compare_X_L_Imp PROC ; COMDAT ; 152 : if (u->IS_ZERO) test BYTE PTR [rcx+40], 2 mov r9, rcx je SHORT $LN2@PMC_Compar ; 153 : { ; 154 : // u が 0 である場合 ; 155 : if (v == 0) ; 156 : { ; 157 : // v が 0 である場合 ; 158 : *w = 0; ; 159 : } ; 160 : else ; 161 : { ; 162 : // v が 0 でない場合 ; 163 : *w = -1; ; 164 : } ; 165 : } neg rdx $LN36@PMC_Compar: ; 258 : *w = 1; ; 259 : else if (u->BLOCK[0] < v) ; 260 : *w = -1; ; 261 : else ; 262 : *w = 0; ; 263 : } ; 264 : } ; 265 : } ; 266 : } sbb eax, eax mov DWORD PTR [r8], eax ret 0 $LN2@PMC_Compar: ; 166 : else if (v == 0) test rdx, rdx je SHORT $LN52@PMC_Compar ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_inline_func.h ; 644 : _BitScanReverse64(&pos, x); bsr rax, rdx ; 645 : #elif defined(__GNUC__) ; 646 : _UINT64_T pos; ; 647 : __asm__("bsrq %1, %0" : "=r"(pos) : "rm"(x)); ; 648 : #else ; 649 : #error unknown compiler ; 650 : #endif ; 651 : #else ; 652 : #error unknown platform ; 653 : #endif ; 654 : return (sizeof(x) * 8 - 1 - pos); mov ecx, 63 ; 0000003fH sub ecx, eax ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_compare.c ; 242 : __UNIT_TYPE v_bit_count = sizeof(v) * 8 - _LZCNT_ALT_UNIT((__UNIT_TYPE)v); movsxd rax, ecx mov ecx, 64 ; 00000040H sub rcx, rax ; 243 : if (u_bit_count > v_bit_count) cmp QWORD PTR [r9+16], rcx ja SHORT $LN52@PMC_Compar ; 244 : { ; 245 : // 明らかに u > v である場合 ; 246 : *w = 1; ; 247 : } ; 248 : else if (u_bit_count < v_bit_count) jae SHORT $LN34@PMC_Compar ; 258 : *w = 1; ; 259 : else if (u->BLOCK[0] < v) ; 260 : *w = -1; ; 261 : else ; 262 : *w = 0; ; 263 : } ; 264 : } ; 265 : } ; 266 : } mov DWORD PTR [r8], -1 ret 0 $LN34@PMC_Compar: ; 249 : { ; 250 : // 明らかに u < v である場合 ; 251 : *w = -1; ; 252 : } ; 253 : else ; 254 : { ; 255 : // u > 0 && v > 0 かつ u のビット長と v のビット長が等しく、かつ v が 1 ワードで表現できる場合 ; 256 : // ⇒ u と v はともに 1 ワードで表現できる ; 257 : if (u->BLOCK[0] > v) mov rax, QWORD PTR [r9+56] cmp QWORD PTR [rax], rdx jbe SHORT $LN36@PMC_Compar $LN52@PMC_Compar: ; 258 : *w = 1; ; 259 : else if (u->BLOCK[0] < v) ; 260 : *w = -1; ; 261 : else ; 262 : *w = 0; ; 263 : } ; 264 : } ; 265 : } ; 266 : } mov DWORD PTR [r8], 1 ret 0 PMC_Compare_X_L_Imp ENDP _TEXT ENDS ; Function compile flags: /Ogtpy ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_compare.c ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_inline_func.h ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_compare.c ; COMDAT PMC_Compare_X_I_Imp _TEXT SEGMENT u$ = 8 v$ = 16 w$ = 24 PMC_Compare_X_I_Imp PROC ; COMDAT ; 62 : if (u->IS_ZERO) test BYTE PTR [rcx+40], 2 mov r9, rcx je SHORT $LN2@PMC_Compar ; 63 : { ; 64 : // u が 0 である場合 ; 65 : if (v == 0) ; 66 : { ; 67 : // v が 0 である場合 ; 68 : *w = 0; ; 69 : } ; 70 : else ; 71 : { ; 72 : // v が 0 でない場合 ; 73 : *w = -1; ; 74 : } ; 75 : } neg edx $LN12@PMC_Compar: ; 101 : *w = 1; ; 102 : else if (u->BLOCK[0] < v) ; 103 : *w = -1; ; 104 : else ; 105 : *w = 0; ; 106 : } ; 107 : } ; 108 : } sbb eax, eax mov DWORD PTR [r8], eax ret 0 $LN2@PMC_Compar: ; 76 : else if (v == 0) test edx, edx je SHORT $LN20@PMC_Compar ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_inline_func.h ; 601 : _BitScanReverse(&pos, x); bsr eax, edx ; 602 : #elif defined(__GNUC__) ; 603 : __asm__("bsrl %1, %0" : "=r"(pos) : "rm"(x)); ; 604 : #else ; 605 : #error unknown compiler ; 606 : #endif ; 607 : return (sizeof(x) * 8 - 1 - pos); mov ecx, 31 sub ecx, eax ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_compare.c ; 85 : __UNIT_TYPE v_bit_count = sizeof(v) * 8 - _LZCNT_ALT_32(v); movsxd rax, ecx mov ecx, 32 ; 00000020H sub rcx, rax ; 86 : if (u_bit_count > v_bit_count) cmp QWORD PTR [r9+16], rcx ja SHORT $LN20@PMC_Compar ; 87 : { ; 88 : // 明らかに u > v である場合 ; 89 : *w = 1; ; 90 : } ; 91 : else if (u_bit_count < v_bit_count) jae SHORT $LN10@PMC_Compar ; 101 : *w = 1; ; 102 : else if (u->BLOCK[0] < v) ; 103 : *w = -1; ; 104 : else ; 105 : *w = 0; ; 106 : } ; 107 : } ; 108 : } mov DWORD PTR [r8], -1 ret 0 $LN10@PMC_Compar: ; 92 : { ; 93 : // 明らかに u < v である場合 ; 94 : *w = -1; ; 95 : } ; 96 : else ; 97 : { ; 98 : // u > 0 && v > 0 かつ u のビット長と v のビット長が等しい場合 ; 99 : // ⇒ u と v はともに 1 ワードで表現できる ; 100 : if (u->BLOCK[0] > v) mov rax, QWORD PTR [r9+56] mov ecx, edx cmp QWORD PTR [rax], rcx jbe SHORT $LN12@PMC_Compar $LN20@PMC_Compar: ; 101 : *w = 1; ; 102 : else if (u->BLOCK[0] < v) ; 103 : *w = -1; ; 104 : else ; 105 : *w = 0; ; 106 : } ; 107 : } ; 108 : } mov DWORD PTR [r8], 1 ret 0 PMC_Compare_X_I_Imp ENDP _TEXT ENDS ; Function compile flags: /Ogtpy ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_inline_func.h ; COMDAT _LZCNT_ALT_UNIT _TEXT SEGMENT x$ = 8 _LZCNT_ALT_UNIT PROC ; COMDAT ; 630 : if (x == 0) test rcx, rcx jne SHORT $LN2@LZCNT_ALT_ ; 631 : return (sizeof(x) * 8); mov eax, 64 ; 00000040H ; 655 : } ret 0 $LN2@LZCNT_ALT_: ; 632 : #ifdef _M_IX86 ; 633 : _UINT32_T pos; ; 634 : #ifdef _MSC_VER ; 635 : _BitScanReverse(&pos, x); ; 636 : #elif defined(__GNUC__) ; 637 : __asm__("bsrl %1, %0" : "=r"(pos) : "rm"(x)); ; 638 : #else ; 639 : #error unknown compiler ; 640 : #endif ; 641 : #elif defined(_M_X64) ; 642 : #ifdef _MSC_VER ; 643 : _UINT32_T pos; ; 644 : _BitScanReverse64(&pos, x); bsr rcx, rcx ; 645 : #elif defined(__GNUC__) ; 646 : _UINT64_T pos; ; 647 : __asm__("bsrq %1, %0" : "=r"(pos) : "rm"(x)); ; 648 : #else ; 649 : #error unknown compiler ; 650 : #endif ; 651 : #else ; 652 : #error unknown platform ; 653 : #endif ; 654 : return (sizeof(x) * 8 - 1 - pos); mov eax, 63 ; 0000003fH sub eax, ecx ; 655 : } ret 0 _LZCNT_ALT_UNIT ENDP _TEXT ENDS ; Function compile flags: /Ogtpy ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_inline_func.h ; COMDAT _LZCNT_ALT_32 _TEXT SEGMENT x$ = 8 _LZCNT_ALT_32 PROC ; COMDAT ; 597 : if (x == 0) test ecx, ecx jne SHORT $LN2@LZCNT_ALT_ ; 598 : return (sizeof(x) * 8); mov eax, 32 ; 00000020H ; 608 : } ret 0 $LN2@LZCNT_ALT_: ; 599 : _UINT32_T pos; ; 600 : #ifdef _MSC_VER ; 601 : _BitScanReverse(&pos, x); bsr ecx, ecx ; 602 : #elif defined(__GNUC__) ; 603 : __asm__("bsrl %1, %0" : "=r"(pos) : "rm"(x)); ; 604 : #else ; 605 : #error unknown compiler ; 606 : #endif ; 607 : return (sizeof(x) * 8 - 1 - pos); mov eax, 31 sub eax, ecx ; 608 : } ret 0 _LZCNT_ALT_32 ENDP _TEXT ENDS ; Function compile flags: /Ogtpy ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_inline_func.h ; COMDAT _FROMDWORDTOWORD _TEXT SEGMENT value$ = 8 result_high$ = 16 _FROMDWORDTOWORD PROC ; COMDAT ; 183 : *result_high = (_UINT32_T)(value >> 32); mov rax, rcx shr rax, 32 ; 00000020H mov DWORD PTR [rdx], eax ; 184 : return ((_UINT32_T)value); mov eax, ecx ; 185 : } ret 0 _FROMDWORDTOWORD ENDP _TEXT ENDS ; Function compile flags: /Ogtpy ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_compare.c ; COMDAT PMC_Compare_X_X _TEXT SEGMENT u$ = 48 v$ = 56 w$ = 64 PMC_Compare_X_X PROC ; COMDAT ; 309 : { $LN31: mov QWORD PTR [rsp+8], rbx mov QWORD PTR [rsp+16], rsi push rdi sub rsp, 32 ; 00000020H mov rsi, r8 mov rdi, rdx mov rbx, rcx ; 310 : if (u == NULL) test rcx, rcx je $LN29@PMC_Compar ; 311 : return (PMC_STATUS_ARGUMENT_ERROR); ; 312 : if (v == NULL) test rdx, rdx je $LN29@PMC_Compar ; 313 : return (PMC_STATUS_ARGUMENT_ERROR); ; 314 : if (w == NULL) test r8, r8 je $LN29@PMC_Compar ; 316 : NUMBER_HEADER* nu = (NUMBER_HEADER*)u; ; 317 : NUMBER_HEADER* nv = (NUMBER_HEADER*)v; ; 318 : PMC_STATUS_CODE result; ; 319 : if ((result = CheckNumber(nu)) != PMC_STATUS_OK) call CheckNumber test eax, eax jne $LN1@PMC_Compar ; 320 : return (result); ; 321 : if ((result = CheckNumber(nv)) != PMC_STATUS_OK) mov rcx, rdi call CheckNumber test eax, eax jne $LN1@PMC_Compar ; 322 : return (result); ; 323 : if (nu->IS_ZERO) mov eax, DWORD PTR [rdi+40] and eax, 2 test BYTE PTR [rbx+40], 2 je SHORT $LN7@PMC_Compar ; 324 : { ; 325 : *w = nv->IS_ZERO ? 0 : -1; neg eax sbb eax, eax neg eax dec eax ; 349 : } ; 350 : } ; 351 : return (PMC_STATUS_OK); mov DWORD PTR [rsi], eax xor eax, eax ; 352 : } mov rbx, QWORD PTR [rsp+48] mov rsi, QWORD PTR [rsp+56] add rsp, 32 ; 00000020H pop rdi ret 0 $LN7@PMC_Compar: ; 326 : } ; 327 : else if (nv->IS_ZERO) test eax, eax jne SHORT $LN25@PMC_Compar ; 328 : { ; 329 : *w = 1; ; 330 : } ; 331 : else ; 332 : { ; 333 : __UNIT_TYPE u_bit_count = nu->UNIT_BIT_COUNT; mov rax, QWORD PTR [rbx+16] ; 334 : __UNIT_TYPE v_bit_count = nv->UNIT_BIT_COUNT; ; 335 : if (u_bit_count > v_bit_count) cmp rax, QWORD PTR [rdi+16] ja SHORT $LN25@PMC_Compar ; 336 : { ; 337 : // 明らかに u > v である場合 ; 338 : *w = 1; ; 339 : } ; 340 : else if (u_bit_count < v_bit_count) jb SHORT $LN26@PMC_Compar ; 341 : { ; 342 : // 明らかに u < v である場合 ; 343 : *w = -1; ; 344 : } ; 345 : else ; 346 : { ; 347 : // u > 0 && v > 0 かつ u のビット長と v のビット長が等しい場合 ; 348 : *w = Compare_Imp(nu->BLOCK, nv->BLOCK, nu->UNIT_WORD_COUNT); mov rcx, QWORD PTR [rbx+8] ; 40 : u += count; mov rax, QWORD PTR [rbx+56] lea r8, QWORD PTR [rax+rcx*8] ; 41 : v += count; mov rax, QWORD PTR [rdi+56] lea r9, QWORD PTR [rax+rcx*8] ; 42 : while (count > 0) test rcx, rcx je SHORT $LN18@PMC_Compar $LL17@PMC_Compar: ; 43 : { ; 44 : --u; ; 45 : --v; ; 46 : --count; ; 47 : ; 48 : if (*u > *v) mov rax, QWORD PTR [r8-8] lea r8, QWORD PTR [r8-8] lea r9, QWORD PTR [r9-8] dec rcx cmp rax, QWORD PTR [r9] ja SHORT $LN25@PMC_Compar ; 49 : return (1); ; 50 : else if (*u < *v) jb SHORT $LN26@PMC_Compar ; 42 : while (count > 0) test rcx, rcx jne SHORT $LL17@PMC_Compar $LN18@PMC_Compar: ; 51 : return (-1); ; 52 : else ; 53 : { ; 54 : } ; 55 : } ; 56 : return (0); xor eax, eax $LN16@PMC_Compar: ; 349 : } ; 350 : } ; 351 : return (PMC_STATUS_OK); mov DWORD PTR [rsi], eax xor eax, eax ; 352 : } mov rbx, QWORD PTR [rsp+48] mov rsi, QWORD PTR [rsp+56] add rsp, 32 ; 00000020H pop rdi ret 0 $LN26@PMC_Compar: ; 349 : } ; 350 : } ; 351 : return (PMC_STATUS_OK); mov eax, -1 jmp SHORT $LN16@PMC_Compar $LN25@PMC_Compar: mov eax, 1 jmp SHORT $LN16@PMC_Compar $LN29@PMC_Compar: ; 315 : return (PMC_STATUS_ARGUMENT_ERROR); mov eax, -1 $LN1@PMC_Compar: ; 352 : } mov rbx, QWORD PTR [rsp+48] mov rsi, QWORD PTR [rsp+56] add rsp, 32 ; 00000020H pop rdi ret 0 PMC_Compare_X_X ENDP _TEXT ENDS ; Function compile flags: /Ogtpy ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_compare.c ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_inline_func.h ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_compare.c ; COMDAT PMC_Compare_X_L _TEXT SEGMENT u$ = 48 v$ = 56 w$ = 64 PMC_Compare_X_L PROC ; COMDAT ; 289 : { $LN61: mov QWORD PTR [rsp+8], rbx mov QWORD PTR [rsp+16], rsi push rdi sub rsp, 32 ; 00000020H mov rsi, r8 mov rbx, rdx mov rdi, rcx ; 290 : if (__UNIT_TYPE_BIT_COUNT * 2 < sizeof(v) * 8) ; 291 : { ; 292 : // _UINT64_T が 2 ワードで表現しきれない処理系には対応しない ; 293 : return (PMC_STATUS_INTERNAL_ERROR); ; 294 : } ; 295 : if (u == NULL) test rcx, rcx je SHORT $LN58@PMC_Compar ; 296 : return (PMC_STATUS_ARGUMENT_ERROR); ; 297 : if (w == NULL) test r8, r8 je SHORT $LN58@PMC_Compar ; 299 : PMC_STATUS_CODE result; ; 300 : if ((result = CheckNumber((NUMBER_HEADER*)u)) != PMC_STATUS_OK) call CheckNumber test eax, eax jne SHORT $LN1@PMC_Compar ; 152 : if (u->IS_ZERO) test BYTE PTR [rdi+40], 2 je SHORT $LN8@PMC_Compar ; 153 : { ; 154 : // u が 0 である場合 ; 155 : if (v == 0) neg rbx $LN42@PMC_Compar: ; 301 : return (result); ; 302 : _INT32_T w_temp; ; 303 : PMC_Compare_X_L_Imp((NUMBER_HEADER*)u, v, &w_temp); ; 304 : *w = w_temp; sbb eax, eax $LN44@PMC_Compar: mov DWORD PTR [rsi], eax ; 305 : return (PMC_STATUS_OK); xor eax, eax ; 306 : } mov rbx, QWORD PTR [rsp+48] mov rsi, QWORD PTR [rsp+56] add rsp, 32 ; 00000020H pop rdi ret 0 $LN8@PMC_Compar: ; 166 : else if (v == 0) test rbx, rbx je SHORT $LN59@PMC_Compar ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_inline_func.h ; 644 : _BitScanReverse64(&pos, x); bsr rax, rbx ; 645 : #elif defined(__GNUC__) ; 646 : _UINT64_T pos; ; 647 : __asm__("bsrq %1, %0" : "=r"(pos) : "rm"(x)); ; 648 : #else ; 649 : #error unknown compiler ; 650 : #endif ; 651 : #else ; 652 : #error unknown platform ; 653 : #endif ; 654 : return (sizeof(x) * 8 - 1 - pos); mov ecx, 63 ; 0000003fH sub ecx, eax ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_compare.c ; 242 : __UNIT_TYPE v_bit_count = sizeof(v) * 8 - _LZCNT_ALT_UNIT((__UNIT_TYPE)v); movsxd rax, ecx mov ecx, 64 ; 00000040H sub rcx, rax ; 243 : if (u_bit_count > v_bit_count) cmp QWORD PTR [rdi+16], rcx ja SHORT $LN59@PMC_Compar ; 244 : { ; 245 : // 明らかに u > v である場合 ; 246 : *w = 1; ; 247 : } ; 248 : else if (u_bit_count < v_bit_count) jae SHORT $LN40@PMC_Compar ; 249 : { ; 250 : // 明らかに u < v である場合 ; 251 : *w = -1; mov eax, -1 ; 252 : } jmp SHORT $LN44@PMC_Compar $LN40@PMC_Compar: ; 253 : else ; 254 : { ; 255 : // u > 0 && v > 0 かつ u のビット長と v のビット長が等しく、かつ v が 1 ワードで表現できる場合 ; 256 : // ⇒ u と v はともに 1 ワードで表現できる ; 257 : if (u->BLOCK[0] > v) mov rax, QWORD PTR [rdi+56] cmp QWORD PTR [rax], rbx jbe SHORT $LN42@PMC_Compar $LN59@PMC_Compar: ; 301 : return (result); ; 302 : _INT32_T w_temp; ; 303 : PMC_Compare_X_L_Imp((NUMBER_HEADER*)u, v, &w_temp); ; 304 : *w = w_temp; mov eax, 1 jmp SHORT $LN44@PMC_Compar $LN58@PMC_Compar: ; 298 : return (PMC_STATUS_ARGUMENT_ERROR); mov eax, -1 $LN1@PMC_Compar: ; 306 : } mov rbx, QWORD PTR [rsp+48] mov rsi, QWORD PTR [rsp+56] add rsp, 32 ; 00000020H pop rdi ret 0 PMC_Compare_X_L ENDP _TEXT ENDS ; Function compile flags: /Ogtpy ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_compare.c ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_inline_func.h ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_compare.c ; COMDAT PMC_Compare_X_I _TEXT SEGMENT u$ = 48 v$ = 56 w$ = 64 PMC_Compare_X_I PROC ; COMDAT ; 131 : { $LN29: mov QWORD PTR [rsp+8], rbx mov QWORD PTR [rsp+16], rsi push rdi sub rsp, 32 ; 00000020H mov ebx, edx mov rsi, r8 mov rdi, rcx ; 132 : if (__UNIT_TYPE_BIT_COUNT < sizeof(v) * 8) ; 133 : { ; 134 : // _UINT32_T が 1 ワードで表現しきれない処理系には対応しない ; 135 : return (PMC_STATUS_INTERNAL_ERROR); ; 136 : } ; 137 : if (u == NULL) test rcx, rcx je SHORT $LN26@PMC_Compar ; 138 : return (PMC_STATUS_ARGUMENT_ERROR); ; 139 : if (w == NULL) test r8, r8 je SHORT $LN26@PMC_Compar ; 141 : PMC_STATUS_CODE result; ; 142 : if ((result = CheckNumber((NUMBER_HEADER*)u)) != PMC_STATUS_OK) call CheckNumber test eax, eax jne SHORT $LN1@PMC_Compar ; 62 : if (u->IS_ZERO) test BYTE PTR [rdi+40], 2 je SHORT $LN8@PMC_Compar ; 63 : { ; 64 : // u が 0 である場合 ; 65 : if (v == 0) ; 66 : { ; 67 : // v が 0 である場合 ; 68 : *w = 0; ; 69 : } ; 70 : else ; 71 : { ; 72 : // v が 0 でない場合 ; 73 : *w = -1; ; 74 : } ; 75 : } neg ebx $LN18@PMC_Compar: ; 143 : return (result); ; 144 : _INT32_T w_temp; ; 145 : PMC_Compare_X_I_Imp((NUMBER_HEADER*)u, v, &w_temp); ; 146 : *w = w_temp; sbb eax, eax $LN20@PMC_Compar: mov DWORD PTR [rsi], eax ; 147 : return (PMC_STATUS_OK); xor eax, eax ; 148 : } mov rbx, QWORD PTR [rsp+48] mov rsi, QWORD PTR [rsp+56] add rsp, 32 ; 00000020H pop rdi ret 0 $LN8@PMC_Compar: ; 76 : else if (v == 0) test ebx, ebx je SHORT $LN27@PMC_Compar ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_inline_func.h ; 601 : _BitScanReverse(&pos, x); bsr eax, ebx ; 602 : #elif defined(__GNUC__) ; 603 : __asm__("bsrl %1, %0" : "=r"(pos) : "rm"(x)); ; 604 : #else ; 605 : #error unknown compiler ; 606 : #endif ; 607 : return (sizeof(x) * 8 - 1 - pos); mov ecx, 31 sub ecx, eax ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_compare.c ; 85 : __UNIT_TYPE v_bit_count = sizeof(v) * 8 - _LZCNT_ALT_32(v); movsxd rax, ecx mov ecx, 32 ; 00000020H sub rcx, rax ; 86 : if (u_bit_count > v_bit_count) cmp QWORD PTR [rdi+16], rcx ja SHORT $LN27@PMC_Compar ; 87 : { ; 88 : // 明らかに u > v である場合 ; 89 : *w = 1; ; 90 : } ; 91 : else if (u_bit_count < v_bit_count) jae SHORT $LN16@PMC_Compar ; 92 : { ; 93 : // 明らかに u < v である場合 ; 94 : *w = -1; mov eax, -1 ; 95 : } jmp SHORT $LN20@PMC_Compar $LN16@PMC_Compar: ; 96 : else ; 97 : { ; 98 : // u > 0 && v > 0 かつ u のビット長と v のビット長が等しい場合 ; 99 : // ⇒ u と v はともに 1 ワードで表現できる ; 100 : if (u->BLOCK[0] > v) mov rax, QWORD PTR [rdi+56] cmp QWORD PTR [rax], rbx jbe SHORT $LN18@PMC_Compar $LN27@PMC_Compar: ; 143 : return (result); ; 144 : _INT32_T w_temp; ; 145 : PMC_Compare_X_I_Imp((NUMBER_HEADER*)u, v, &w_temp); ; 146 : *w = w_temp; mov eax, 1 jmp SHORT $LN20@PMC_Compar $LN26@PMC_Compar: ; 140 : return (PMC_STATUS_ARGUMENT_ERROR); mov eax, -1 $LN1@PMC_Compar: ; 148 : } mov rbx, QWORD PTR [rsp+48] mov rsi, QWORD PTR [rsp+56] add rsp, 32 ; 00000020H pop rdi ret 0 PMC_Compare_X_I ENDP _TEXT ENDS ; Function compile flags: /Ogtpy ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_compare.c ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_inline_func.h ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_compare.c ; COMDAT PMC_Compare_L_X _TEXT SEGMENT u$ = 48 v$ = 56 w$ = 64 PMC_Compare_L_X PROC ; COMDAT ; 269 : { $LN61: mov QWORD PTR [rsp+8], rbx mov QWORD PTR [rsp+16], rsi push rdi sub rsp, 32 ; 00000020H mov rsi, r8 mov rdi, rdx mov rbx, rcx ; 270 : if (__UNIT_TYPE_BIT_COUNT * 2 < sizeof(u) * 8) ; 271 : { ; 272 : // _UINT64_T が 2 ワードで表現しきれない処理系には対応しない ; 273 : return (PMC_STATUS_INTERNAL_ERROR); ; 274 : } ; 275 : if (v == NULL) test rdx, rdx je $LN58@PMC_Compar ; 276 : return (PMC_STATUS_ARGUMENT_ERROR); ; 277 : if (w == NULL) test r8, r8 je $LN58@PMC_Compar ; 279 : PMC_STATUS_CODE result; ; 280 : if ((result = CheckNumber((NUMBER_HEADER*)v)) != PMC_STATUS_OK) mov rcx, rdx call CheckNumber test eax, eax jne $LN1@PMC_Compar ; 152 : if (u->IS_ZERO) test BYTE PTR [rdi+40], 2 je SHORT $LN8@PMC_Compar ; 153 : { ; 154 : // u が 0 である場合 ; 155 : if (v == 0) test rbx, rbx setne al ; 281 : return (result); ; 282 : _INT32_T w_temp; ; 283 : PMC_Compare_X_L_Imp((NUMBER_HEADER*)v, u, &w_temp); ; 284 : *w = -w_temp; mov DWORD PTR [rsi], eax ; 285 : return (PMC_STATUS_OK); xor eax, eax ; 286 : } mov rbx, QWORD PTR [rsp+48] mov rsi, QWORD PTR [rsp+56] add rsp, 32 ; 00000020H pop rdi ret 0 $LN8@PMC_Compar: ; 166 : else if (v == 0) test rbx, rbx je SHORT $LN59@PMC_Compar ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_inline_func.h ; 644 : _BitScanReverse64(&pos, x); bsr rax, rbx ; 645 : #elif defined(__GNUC__) ; 646 : _UINT64_T pos; ; 647 : __asm__("bsrq %1, %0" : "=r"(pos) : "rm"(x)); ; 648 : #else ; 649 : #error unknown compiler ; 650 : #endif ; 651 : #else ; 652 : #error unknown platform ; 653 : #endif ; 654 : return (sizeof(x) * 8 - 1 - pos); mov ecx, 63 ; 0000003fH sub ecx, eax ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_compare.c ; 242 : __UNIT_TYPE v_bit_count = sizeof(v) * 8 - _LZCNT_ALT_UNIT((__UNIT_TYPE)v); movsxd rax, ecx mov ecx, 64 ; 00000040H sub rcx, rax ; 243 : if (u_bit_count > v_bit_count) cmp QWORD PTR [rdi+16], rcx ja SHORT $LN59@PMC_Compar ; 244 : { ; 245 : // 明らかに u > v である場合 ; 246 : *w = 1; ; 247 : } ; 248 : else if (u_bit_count < v_bit_count) jae SHORT $LN40@PMC_Compar ; 249 : { ; 250 : // 明らかに u < v である場合 ; 251 : *w = -1; mov eax, 1 ; 281 : return (result); ; 282 : _INT32_T w_temp; ; 283 : PMC_Compare_X_L_Imp((NUMBER_HEADER*)v, u, &w_temp); ; 284 : *w = -w_temp; mov DWORD PTR [rsi], eax ; 285 : return (PMC_STATUS_OK); xor eax, eax ; 286 : } mov rbx, QWORD PTR [rsp+48] mov rsi, QWORD PTR [rsp+56] add rsp, 32 ; 00000020H pop rdi ret 0 $LN40@PMC_Compar: ; 257 : if (u->BLOCK[0] > v) mov rax, QWORD PTR [rdi+56] mov rcx, QWORD PTR [rax] cmp rcx, rbx jbe SHORT $LN42@PMC_Compar $LN59@PMC_Compar: ; 281 : return (result); ; 282 : _INT32_T w_temp; ; 283 : PMC_Compare_X_L_Imp((NUMBER_HEADER*)v, u, &w_temp); ; 284 : *w = -w_temp; mov eax, -1 mov DWORD PTR [rsi], eax ; 285 : return (PMC_STATUS_OK); xor eax, eax ; 286 : } mov rbx, QWORD PTR [rsp+48] mov rsi, QWORD PTR [rsp+56] add rsp, 32 ; 00000020H pop rdi ret 0 $LN42@PMC_Compar: ; 259 : else if (u->BLOCK[0] < v) xor eax, eax cmp rcx, rbx setb al ; 281 : return (result); ; 282 : _INT32_T w_temp; ; 283 : PMC_Compare_X_L_Imp((NUMBER_HEADER*)v, u, &w_temp); ; 284 : *w = -w_temp; mov DWORD PTR [rsi], eax ; 285 : return (PMC_STATUS_OK); xor eax, eax ; 286 : } mov rbx, QWORD PTR [rsp+48] mov rsi, QWORD PTR [rsp+56] add rsp, 32 ; 00000020H pop rdi ret 0 $LN58@PMC_Compar: ; 278 : return (PMC_STATUS_ARGUMENT_ERROR); mov eax, -1 $LN1@PMC_Compar: ; 286 : } mov rbx, QWORD PTR [rsp+48] mov rsi, QWORD PTR [rsp+56] add rsp, 32 ; 00000020H pop rdi ret 0 PMC_Compare_L_X ENDP _TEXT ENDS ; Function compile flags: /Ogtpy ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_compare.c ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_inline_func.h ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_compare.c ; COMDAT PMC_Compare_I_X _TEXT SEGMENT u$ = 48 v$ = 56 w$ = 64 PMC_Compare_I_X PROC ; COMDAT ; 111 : { $LN29: mov QWORD PTR [rsp+8], rbx mov QWORD PTR [rsp+16], rsi push rdi sub rsp, 32 ; 00000020H mov edi, ecx mov rsi, r8 mov rbx, rdx ; 112 : if (__UNIT_TYPE_BIT_COUNT < sizeof(u) * 8) ; 113 : { ; 114 : // _UINT32_T が 1 ワードで表現しきれない処理系には対応しない ; 115 : return (PMC_STATUS_INTERNAL_ERROR); ; 116 : } ; 117 : if (v == NULL) test rdx, rdx je $LN26@PMC_Compar ; 118 : return (PMC_STATUS_ARGUMENT_ERROR); ; 119 : if (w == NULL) test r8, r8 je $LN26@PMC_Compar ; 121 : PMC_STATUS_CODE result; ; 122 : if ((result = CheckNumber((NUMBER_HEADER*)v)) != PMC_STATUS_OK) mov rcx, rdx call CheckNumber test eax, eax jne $LN1@PMC_Compar ; 62 : if (u->IS_ZERO) test BYTE PTR [rbx+40], 2 je SHORT $LN8@PMC_Compar ; 63 : { ; 64 : // u が 0 である場合 ; 65 : if (v == 0) ; 66 : { ; 67 : // v が 0 である場合 ; 68 : *w = 0; ; 69 : } ; 70 : else ; 71 : { ; 72 : // v が 0 でない場合 ; 73 : *w = -1; ; 74 : } ; 75 : } test edi, edi setne al ; 123 : return (result); ; 124 : _INT32_T w_temp; ; 125 : PMC_Compare_X_I_Imp((NUMBER_HEADER*)v, u, &w_temp); ; 126 : *w = -w_temp; mov DWORD PTR [rsi], eax ; 127 : return (PMC_STATUS_OK); xor eax, eax ; 128 : } mov rbx, QWORD PTR [rsp+48] mov rsi, QWORD PTR [rsp+56] add rsp, 32 ; 00000020H pop rdi ret 0 $LN8@PMC_Compar: ; 76 : else if (v == 0) test edi, edi je SHORT $LN27@PMC_Compar ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_inline_func.h ; 601 : _BitScanReverse(&pos, x); bsr eax, edi ; 602 : #elif defined(__GNUC__) ; 603 : __asm__("bsrl %1, %0" : "=r"(pos) : "rm"(x)); ; 604 : #else ; 605 : #error unknown compiler ; 606 : #endif ; 607 : return (sizeof(x) * 8 - 1 - pos); mov ecx, 31 sub ecx, eax ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_compare.c ; 85 : __UNIT_TYPE v_bit_count = sizeof(v) * 8 - _LZCNT_ALT_32(v); movsxd rax, ecx mov ecx, 32 ; 00000020H sub rcx, rax ; 86 : if (u_bit_count > v_bit_count) cmp QWORD PTR [rbx+16], rcx ja SHORT $LN27@PMC_Compar ; 87 : { ; 88 : // 明らかに u > v である場合 ; 89 : *w = 1; ; 90 : } ; 91 : else if (u_bit_count < v_bit_count) jae SHORT $LN16@PMC_Compar ; 92 : { ; 93 : // 明らかに u < v である場合 ; 94 : *w = -1; mov eax, 1 ; 123 : return (result); ; 124 : _INT32_T w_temp; ; 125 : PMC_Compare_X_I_Imp((NUMBER_HEADER*)v, u, &w_temp); ; 126 : *w = -w_temp; mov DWORD PTR [rsi], eax ; 127 : return (PMC_STATUS_OK); xor eax, eax ; 128 : } mov rbx, QWORD PTR [rsp+48] mov rsi, QWORD PTR [rsp+56] add rsp, 32 ; 00000020H pop rdi ret 0 $LN16@PMC_Compar: ; 100 : if (u->BLOCK[0] > v) mov rax, QWORD PTR [rbx+56] mov rdx, QWORD PTR [rax] cmp rdx, rdi jbe SHORT $LN18@PMC_Compar $LN27@PMC_Compar: ; 123 : return (result); ; 124 : _INT32_T w_temp; ; 125 : PMC_Compare_X_I_Imp((NUMBER_HEADER*)v, u, &w_temp); ; 126 : *w = -w_temp; mov eax, -1 mov DWORD PTR [rsi], eax ; 127 : return (PMC_STATUS_OK); xor eax, eax ; 128 : } mov rbx, QWORD PTR [rsp+48] mov rsi, QWORD PTR [rsp+56] add rsp, 32 ; 00000020H pop rdi ret 0 $LN18@PMC_Compar: ; 102 : else if (u->BLOCK[0] < v) xor eax, eax cmp rdx, rdi setb al ; 123 : return (result); ; 124 : _INT32_T w_temp; ; 125 : PMC_Compare_X_I_Imp((NUMBER_HEADER*)v, u, &w_temp); ; 126 : *w = -w_temp; mov DWORD PTR [rsi], eax ; 127 : return (PMC_STATUS_OK); xor eax, eax ; 128 : } mov rbx, QWORD PTR [rsp+48] mov rsi, QWORD PTR [rsp+56] add rsp, 32 ; 00000020H pop rdi ret 0 $LN26@PMC_Compar: ; 120 : return (PMC_STATUS_ARGUMENT_ERROR); mov eax, -1 $LN1@PMC_Compar: ; 128 : } mov rbx, QWORD PTR [rsp+48] mov rsi, QWORD PTR [rsp+56] add rsp, 32 ; 00000020H pop rdi ret 0 PMC_Compare_I_X ENDP _TEXT ENDS ; Function compile flags: /Ogtpy ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_compare.c ; COMDAT Initialize_Compare _TEXT SEGMENT feature$ = 8 Initialize_Compare PROC ; COMDAT ; 356 : return (PMC_STATUS_OK); xor eax, eax ; 357 : } ret 0 Initialize_Compare ENDP _TEXT ENDS ; Function compile flags: /Ogtpy ; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_compare.c ; COMDAT Compare_Imp _TEXT SEGMENT u$ = 8 v$ = 16 count$ = 24 Compare_Imp PROC ; COMDAT ; 40 : u += count; lea rax, QWORD PTR [r8*8] add rcx, rax ; 41 : v += count; add rdx, rax ; 42 : while (count > 0) test r8, r8 je SHORT $LN3@Compare_Im npad 13 $LL2@Compare_Im: ; 43 : { ; 44 : --u; ; 45 : --v; ; 46 : --count; ; 47 : ; 48 : if (*u > *v) mov rax, QWORD PTR [rcx-8] lea rcx, QWORD PTR [rcx-8] lea rdx, QWORD PTR [rdx-8] dec r8 cmp rax, QWORD PTR [rdx] ja SHORT $LN10@Compare_Im ; 50 : else if (*u < *v) jb SHORT $LN11@Compare_Im ; 42 : while (count > 0) test r8, r8 jne SHORT $LL2@Compare_Im $LN3@Compare_Im: ; 52 : else ; 53 : { ; 54 : } ; 55 : } ; 56 : return (0); xor eax, eax ; 57 : } ret 0 $LN11@Compare_Im: ; 51 : return (-1); mov eax, -1 ; 57 : } ret 0 $LN10@Compare_Im: ; 49 : return (1); mov eax, 1 ; 57 : } ret 0 Compare_Imp ENDP _TEXT ENDS END
21.868371
121
0.571412
0e335e31da4dd5f69e1185468b36f3d86d0e3930
17,029
asm
Assembly
src/notepad.asm
jwse2/MijnOS
eaa280a5673604439a16575febc0ce342ba55f2e
[ "MIT" ]
null
null
null
src/notepad.asm
jwse2/MijnOS
eaa280a5673604439a16575febc0ce342ba55f2e
[ "MIT" ]
null
null
null
src/notepad.asm
jwse2/MijnOS
eaa280a5673604439a16575febc0ce342ba55f2e
[ "MIT" ]
null
null
null
[BITS 16] ; [ORG 0x15E00] jmp main ;=============================================== ; PREFIXES ; np = NotePad ; fn = FileName ;=============================================== %include "src\const.inc" %define BUFFER_SIZE 512 text_buffer times BUFFER_SIZE db 0 ; Buffer the user writes to when pressing a key text_double times BUFFER_SIZE db 0 ; Double buffer for redraws text_size dw 0 ; Number of characters currently in the buffer opt_quit db 0 ; Should notepad quit/terminate? opt_menu db 0 ; Should the menu be displayed text_bbuf db 08h, 20h, 08h, 0 ; Instructions for backspace file_str db 'FILE: ', 0 file_buff times 16 db 0 ; Max size is 12 incl. ext, excl. zst .length dw ($-file_buff) ; Length of the buffer .count dw 0 ; Number of written characters cursor_pos dw 0 ; Cursor position %define MENU_COLOR 070h text_ferr dw 0 ;=============================================== ; Clears the screen ;=============================================== %macro mClearScreen 0 push ax mov ax,INT_CLEAR_SCREEN int 70h pop ax %endmacro %macro mConvertName 1 push es push si push di push bx mov bx,ss mov es,bx pop bx mov si,file_buff lea di,[bp-%1] call cmd_convertString pop di pop si pop es %endmacro %macro mDebugHex 0 push ax push cx mov cx,ax mov ax,INT_PRINT_HEX int 70h mov ax,INT_KEYPRESS int 70h pop cx pop ax %endmacro %macro mDebugName 0 ; 0) initialize push bp mov bp,sp sub sp,12 ; 11 but need 2-byte alignment push ax ; 1) conversion push es push si push bx mov bx,ss mov es,bx pop bx lea di,[bp-12] mov si,file_buff call cmd_convertString pop si pop es ; 2) display push ds push si push bx mov bx,ss mov ds,bx pop bx lea si,[bp-12] mov ax,INT_PRINT_STRING int 70h pop si pop ds ; 3) await mov ax,INT_KEYPRESS int 70h ; 4) return pop ax mov sp,bp pop bp %endmacro ;=============================================== ; Entry point ;=============================================== main: push bp mov bp,sp ; initialize the program .init: mov ax,INT_CLEAR_SCREEN int 70h ; Ensure te screen is clear xor dx,dx mov ax,INT_SET_CURSOR_POS int 70h ; Ensure we are top-left ; programs main loop .loop: mov cl,byte [opt_menu] ; Opt. 1) Check if the menu is opened test cl,cl jne .h_menu mov cl,byte [opt_quit] ; Opt. 2) Quit the editor? test cl,cl jne exit mov ax,INT_KEYPRESS ; 1) Wait for a key. int 70h call np_drawChar jmp .loop ; continue the program loop ; menu handling code .h_menu: call handle_menu jmp .loop ; NOTE: ; The dot is missing so we can exit from ; anywhere within the program. exit: mov sp,bp pop bp retf ;=============================================== ; Stores the cursor position. ;=============================================== util_getCursor: mov ax,INT_GET_CURSOR_POS int 70h mov word [cursor_pos],dx ret ;=============================================== ; Restores the cursor position. ;=============================================== util_setCursor: mov dx,word [cursor_pos] mov ax,INT_SET_CURSOR_POS int 70h ret ;=============================================== ; Draws the character to the screen if necessary ;=============================================== np_drawChar: cmp ax,20h ; Opt. 1) Complex, control characters jb np_complexChar cmp ax,7Fh ; Opt. 2) Complex, language characters jae np_complexChar jmp np_simpleChar ; Opt. 3) It's a simple character ;=============================================== ; Copies characters in the range of [0x20, 0x7F) ; into the buffer and displays them on screen. ;=============================================== np_simpleChar: mov cx,word [text_size] cmp cx,BUFFER_SIZE jae .return .insert: mov di,text_buffer add di,cx mov word [di],ax add word [text_size],1 .print: mov cx,ax mov ax,INT_PRINT_CHAR int 70h .return: ret ;=============================================== ; Control characters, these require special ; functions to handle properly. ;=============================================== np_complexChar: .0: cmp ax,08h ; KEY_BACKSPACE jne .1 call np_keyBackspace jmp .return .1: cmp ax,09h ; KEY_TAB jne .2 call np_keyTab jmp .return .2: cmp ax,0Ah ; KEY_NEWLINE jne .3 call np_keyNewline jmp .return .3: cmp ax,0Dh ; KEY_RETURN jne .4 call np_keyNewline jmp .return .4: cmp ax,1Bh ; KEY_ESCAPE jne .5 call np_keyEscape jmp .return .5: cmp ax,7Fh ; KEY_DELETE jne .return call np_keyDelete .return: ret ;=============================================== ; Remove the last character from the buffer; and ; removed the the respective character(s) from ; the screen. ;=============================================== np_keyBackspace: mov cx,word [text_size] cmp cx,0 jbe .return mov di,text_buffer add di,cx sub di,1 .check: mov al,byte [di] cmp al,09h ; KEY_TAB je .tab cmp al,0Ah ; \r\n je .newline mov si,text_bbuf mov ax,INT_PRINT_STRING int 70h .insert: mov word [di],0 sub word [text_size],1 .return: ret ; Tabs are displayed using 4-spaces .tab: mov cx,4 .loop: mov si,text_bbuf mov ax,INT_PRINT_STRING int 70h loop .loop jmp .insert ; New lines consist of \r\n .newline: mov word [di],0 sub word [text_size],1 mov si,text_bbuf mov ax,INT_PRINT_STRING int 70h sub di,1 mov al,byte [di] ; We must check the input, cmp al,0Dh ; as some files may only use \n jne .return mov word [di],0 sub word [text_size],1 mov si,text_bbuf mov ax,INT_PRINT_STRING int 70h jmp .return ;=============================================== ; TABs can be insert like a normal character. ;=============================================== np_keyTab: mov cx,word [text_size] cmp cx,BUFFER_SIZE jae .return .insert: mov di,text_buffer add di,cx mov word [di],09h add word [text_size],1 mov cx,4 .print: push cx mov cx,20h mov ax,INT_PRINT_CHAR int 70h pop cx loop .print .return: ret ;=============================================== ; New lines are done \r\n style. ;=============================================== np_keyNewline: mov cx,word [text_size] mov dx,BUFFER_SIZE-1 cmp cx,dx jae .return .insert: mov di,text_buffer add di,cx mov word [di+0],0Dh mov word [di+1],0Ah add word [text_size],2 .print: mov si,di mov ax,INT_PRINT_STRING int 70h .return: ret ;=============================================== ; Set the menu open flag ;=============================================== np_keyEscape: mov byte [opt_menu],1 call util_setCursor ret ;=============================================== ; Closes the menu and redraws all the contents ;=============================================== np_closeMenu: push ax mov byte [opt_menu],0 ; always hide the menu mov al,byte [opt_quit] test al,al jne .return .redraw: call util_getCursor ; only execute when not quiting call np_refillScreen .return: pop ax ret ;=============================================== ; Refills the screen with the data from the ; text buffer. ;=============================================== np_refillScreen: pusha ; Clear the screen mov ax,INT_CLEAR_SCREEN int 70h ; Move the cursor back to 0,0 xor dx,dx mov ax,INT_SET_CURSOR_POS int 70h ; Return immediately if no text mov ax,word [text_size] test ax,ax je .return ; Copy the buffer contents .copy: mov cx,word [text_size] mov si,text_buffer mov di,text_double .copy_loop: mov al,byte [ds:si] mov byte [ds:di],al add si,1 add di,1 sub cx,1 jne .copy_loop ; Zero-terminate the output mov byte [ds:di],0 ; Redraw the file's contents mov cx,word [text_size] mov word [text_size],0 mov si,text_double .redraw: movzx ax,byte [ds:si] ;test ax,ax ;je .return push si push cx call np_drawChar pop cx pop si add si,1 sub cx,1 jne .redraw .return: popa ret ;=============================================== ; Menu + options ;=============================================== handle_menu: .active: ; Move the cursor to the lower-left corner mov dh,24 ; row mov dl,0 ; column mov ax,INT_SET_CURSOR_POS int 70h ; Print the menu prefix mov bx,MENU_COLOR mov cx,03Ah ; ':' mov ax,INT_PRINT_COLORED int 70h ; Menu loop .loop: mov ax,INT_KEYPRESS ; 1) Wait for a key press int 70h ; Display the typed character mov cx,ax ;mov bx,MENU_COLOR ;mov ax,INT_PRINT_COLORED ;int 70h ; Menu options can be caught here cmp cx,KEY_UC_Q ; QUIT je .m_quit ;je exit cmp cx,KEY_LC_Q je .m_quit ;je exit cmp cx,KEY_UC_W ; WRITE je .m_write cmp cx,KEY_LC_W je .m_write cmp cx,KEY_UC_O ; OPEN je .m_open cmp cx,KEY_LC_O je .m_open cmp cx,KEY_ESCAPE ; Close the menu je .m_close jmp .loop ; Default ; Write to filename .m_write: call fn_typing test ax,ax jne .m_close call np_writeFile jmp .m_close ; Open from filename .m_open: call fn_typing test ax,ax jne .m_close call np_loadFile ; TODO: update cursor position, etc. cmp ax,0FFFFh je .m_quit ; on error quit, should make it clearer jmp .m_close ; Quit the application .m_quit: mov byte [opt_quit],1 ; Close the menu and quit .m_close: call np_closeMenu ret ;=============================================== ; Loads a file from the medium. ;=============================================== np_loadFile: push bp mov bp,sp sub sp,12 ; 11 required but 2-byte aligned necessary pusha push ds push es ; convert the string into a FAT compliant name .convert: mConvertName 12 ; initialize variables and registers .init: push ds mov bx,ds mov es,bx mov di,text_buffer ; file data mov bx,ss mov ds,bx lea si,[bp-12] ; FAT compliant file name mov cx,BUFFER_SIZE-1 ; max data mov ax,INT_READ_FILE int 70h pop ds ; restore DS for variable addressing cmp ax,0FFFFh je .error ; error mov word [text_size],ax ; store the file size ; return to caller .return: pop es pop ds popa mov sp,bp pop bp ret ; an error occured .error: mov word [text_size],0 jmp .return ;=============================================== ; Writes a file from the medium. ;=============================================== np_writeFile: ;mDebugName ;ret push bp mov bp,sp sub sp,12 ; convert the string into a FAT compliant name .convert: mConvertName 12 .preserve: push ds push es push si push di push cx .write: mov cx,word [text_size] ; data size push bx ; set stack mov bx,ds mov es,bx mov di,text_buffer ; file data mov bx,ss mov ds,bx lea si,[bp-12] ; file name pop bx mov ax,INT_WRITE_FILE int 70h .restore: pop cx pop di pop si pop es pop ds ; return to the caller .return: mov sp,bp pop bp ret np_tName db 'D0123456TXT',0 np_tData db 'Test from NP',0 .size dw $-np_tData-1 ;=============================================== ; Loops till the filename has been written ;=============================================== fn_typing: call fn_clear ; clear the old buffer mov si,file_str mov ax,INT_PRINT_STRING int 70h .loop: mov ax,INT_KEYPRESS int 70h cmp ax,KEY_ENTER je .action cmp ax,KEY_ESCAPE je .escape cmp ax,KEY_BACKSPACE je .back .limit: mov cx,word [file_buff.count] add cx,1 cmp cx,word [file_buff.length] jae .continue call fn_append cmp ax,0 je .continue mov cx,ax mov bx,MENU_COLOR mov ax,INT_PRINT_COLORED int 70h .continue: jmp .loop .back: mov bx,word [file_buff.count] sub bx,1 cmp bx,0 jl .loop ; Do nothing when there is nothing mov byte [file_buff+bx],0 mov word [file_buff.count],bx mov si,text_bbuf ; Remove the character from the screen mov ax,INT_PRINT_STRING int 70h jmp .loop .escape: call np_closeMenu .return: mov ax,0FFFFh ret .action: call np_closeMenu xor ax,ax ret ;=============================================== ; Appends the filename with the specified character ;=============================================== fn_append: push bp mov bp,sp sub sp,2 pusha .init: mov word [bp-2],0 ; period, extension sep .period: cmp ax,KEY_PERIOD je .append ; character is [.] ; numbers .0: cmp ax,KEY_0 jl .return cmp ax,KEY_9 jle .append ; character is [0-9] ; uppercase .1: cmp ax,KEY_UC_A jl .return cmp ax,KEY_UC_Z jle .append ; character is [A-Z] ; lowercase .2: cmp ax,KEY_LC_A jl .return cmp ax,KEY_LC_Z ja .return ; invalid character sub ax,020h ; convert [a-z] to [A-Z] jmp .append ; append the character to the buffer .append: mov bx,word [file_buff.count] mov dx,bx add dx,1 cmp dx,word [file_buff.length] jae .return mov byte [file_buff+bx],al add bx,1 mov word [file_buff.count],bx ; only reaches here when successful .success: mov word [bp-2],ax ; return to caller .return: popa mov ax,word [bp-2] mov sp,bp pop bp ret ;=============================================== ; Zero fills the filename buffer ;=============================================== fn_clear: pusha mov cx,word [file_buff.length] mov bx,file_buff add bx,cx .loop: sub bx,1 mov byte [bx],0 loop .loop .return: mov word [file_buff.count],0 popa ret ;=============================================== ; Not currently implemented. ;=============================================== np_keyDelete: ret %include "src/fatname.inc"
20.034118
95
0.460685
1a8f778fb159e5a084d3671b8f8cf4555ee204e0
8,841
asm
Assembly
tests/miaf/valid-exif.asm
gpac/ComplianceWarden
e6c73769bbe6531ef4a92d6853fa55bd49503d44
[ "BSD-3-Clause" ]
3
2020-01-02T17:30:16.000Z
2021-09-27T18:32:18.000Z
tests/miaf/valid-exif.asm
gpac/ComplianceWarden
e6c73769bbe6531ef4a92d6853fa55bd49503d44
[ "BSD-3-Clause" ]
34
2020-01-22T01:41:22.000Z
2021-12-09T13:20:33.000Z
tests/miaf/valid-exif.asm
gpac/ComplianceWarden
e6c73769bbe6531ef4a92d6853fa55bd49503d44
[ "BSD-3-Clause" ]
2
2020-11-05T01:41:08.000Z
2021-11-19T13:12:35.000Z
%define BE(a) ( ((((a)>>24)&0xFF) << 0) + ((((a)>>16)&0xFF) << 8) + ((((a)>>8)&0xFF) << 16) + ((((a)>>0)&0xFF) << 24)) ftyp_start: dd BE(ftyp_end - ftyp_start) dd "ftyp" db 0x61, 0x76, 0x69, 0x66 ; brand(32) ('avif') db 0x00, 0x00, 0x00, 0x00 ; version(32) db 0x6D, 0x69, 0x66, 0x31 ; compatible_brand(32) ('mif1') db 0x61, 0x76, 0x69, 0x66 ; compatible_brand(32) ('avif') db 0x6D, 0x69, 0x61, 0x66 ; compatible_brand(32) ('miaf') db 0x4D, 0x41, 0x31, 0x42 ; compatible_brand(32) ('MA1B') ftyp_end: meta_start: dd BE(meta_end - meta_start) dd "meta" db 0x00 ; version(8) db 0x00, 0x00, 0x00 ; flags(24) hdlr_start: dd BE(hdlr_end - hdlr_start) dd "hdlr" db 0x00 ; version(8) db 0x00, 0x00, 0x00 ; flags(24) db 0x00, 0x00, 0x00, 0x00 ; pre_defined(32) db 0x70, 0x69, 0x63, 0x74 ; handler_type(32) ('pict') db 0x00, 0x00, 0x00, 0x00 ; reserved1(32) db 0x00, 0x00, 0x00, 0x00 ; reserved2(32) db 0x00, 0x00, 0x00, 0x00 ; reserved3(32) db 0x00 ; name(8) hdlr_end: pitm_start: dd BE(pitm_end - pitm_start) dd "pitm" db 0x00 ; version(8) db 0x00, 0x00, 0x00 ; flags(24) db 0x00, 0x01 ; item_ID(16) pitm_end: iinf_start: dd BE(iinf_end - iinf_start) dd "iinf" db 0x00 ; version(8) db 0x00, 0x00, 0x00 ; flags(24) db 0x00, 0x02 ; entry_count(16) infe_start: dd BE(infe_end - infe_start) dd "infe" db 0x02 ; version(8) db 0x00, 0x00, 0x00 ; flags(24) db 0x00, 0x01 ; item_ID(16) db 0x00, 0x00 ; item_protection_index(16) db 0x61, 0x76, 0x30, 0x31 ; item_type(32) ('av01') db 0x00 ; item_name(8) infe_end: infe2_start: dd BE(infe2_end - infe2_start) dd "infe" db 0x02 ; version(8) db 0x00, 0x00, 0x01 ; flags(24) db 0x00, 0x02 ; item_ID(16) db 0x00, 0x00 ; item_protection_index(16) db 0x45, 0x78, 0x69, 0x66 ; item_type(32) ('Exif') db 0x00 ; item_name(8) infe2_end: iinf_end: iloc_start: dd BE(iloc_end - iloc_start) dd "iloc" db 0x01 ; version(8) db 0x00, 0x00, 0x00 ; flags(24) db 0x44 ; offset_size(4) ('D') length_size(4) ('D') db 0x00 ; base_offset_size(4) reserved1(4) db 0x00, 0x02 ; item_count(16) db 0x00, 0x01 ; item_ID(16) db 0x00, 0x00 ; "reserved2(12)" "construction_method(4)" db 0x00, 0x00 ; data_reference_index(16) ; base_offset(0) db 0x00, 0x01 ; extent_count(16) dd BE(mdat_start - ftyp_start + 8) ; extent_offset(32) db 0x00, 0x00, 0x00, 0x01 ; extent_length(32) db 0x00, 0x02 ; item_ID(16) db 0x00, 0x00 ; "reserved2(12)" "construction_method(4)" db 0x00, 0x00 ; data_reference_index(16) ; base_offset(0) db 0x00, 0x01 ; extent_count(16) dd BE(mdat_start - ftyp_start + 8) ; extent_offset(32) db 0x00, 0x00, 0x00, 0x01 ; extent_length(32) iloc_end: iprp_start: dd BE(iprp_end - iprp_start) dd "iprp" ipco_start: dd BE(ipco_end - ipco_start) dd "ipco" ispe_start: dd BE(ispe_end - ispe_start) dd "ispe" db 0x00 ; version(8) db 0x00, 0x00, 0x00 ; flags(24) db 0x00, 0x00, 0x07, 0x80 ; image_width(32) db 0x00, 0x00, 0x04, 0x38 ; image_height(32) ispe_end: colr_start: dd BE(colr_end - colr_start) dd "colr" db 0x6E ; (8) ('n') db 0x63 ; (8) ('c') db 0x6C ; (8) ('l') db 0x78 ; (8) ('x') db 0x00 ; (8) db 0x02 ; (8) db 0x00 ; (8) db 0x02 ; (8) db 0x00 ; (8) db 0x02 ; (8) db 0x80 ; (8) colr_end: av1C_start: dd BE(av1C_end - av1C_start) dd "av1C" db 0x81 ; marker(1) version(7) db 0x09 ; seq_profile(3) seq_level_idx_0(5) db 0x0C ; seq_tier_0(1) high_bitdepth(1) twelve_bit(1) monochrome(1) chroma_subsampling_x(1) chroma_subsampling_y(1) chroma_sample_position(2) db 0x00 ; reserved(3) initial_presentation_delay_present(1) reserved(4) ; configOBUs(0) ; obu(0) db 0x0A ; forbidden(1) obu_type(4) obu_extension_flag(1) obu_has_size_field(1) obu_reserved_1bit(1) db 0x0B ; leb128_byte(8) ; seqhdr(0) db 0x00, 0x00, 0x00 ; seq_profile(3) still_picture(1) reduced_still_picture_header(1) timing_info_present_flag(1) initial_display_delay_present_flag(1) operating_points_cnt_minus_1(5) operating_point_idc[i])(12) db 0x4A, 0xAB, 0xBF, 0xC3, 0x77 ; seq_level_idx[i](5) seq_tier[i](1) frame_width_bits_minus_1(4) frame_height_bits_minus_1(4) max_frame_width_minus_1(11) max_frame_height_minus_1(11) frame_id_numbers_present_flag(1) use_128x128_superblock(1) enable_filter_intra(1) enable_intra_edge_filter(1) db 0xFF ; enable_interintra_compound(1) enable_masked_compound(1) enable_warped_motion(1) enable_dual_filter(1) enable_order_hint(1) enable_jnt_comp(1) enable_ref_frame_mvs(1) seq_choose_screen_content_tools(1) db 0xE6 ; seq_choose_integer_mv(1) order_hint_bits_minus_1(3) enable_superres(1) enable_cdef(1) enable_restoration(1) high_bitdepth(1) db 0x01 ; mono_chrome(1) color_description_present_flag(1) color_range(1) chroma_sample_position(1) separate_uv_delta_q(1) film_grain_params_present(1) bits(2) ; /seqhdr(0) av1C_end: pixi_start: dd BE(pixi_end - pixi_start) dd "pixi" db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x03 ; (8) db 0x08 ; (8) db 0x08 ; (8) db 0x08 ; (8) pixi_end: irot_start: dd BE(irot_end - irot_start) dd "irot" db 0x03 ; (8) irot_end: ipco_end: ipma_start: dd BE(ipma_end - ipma_start) dd "ipma" db 0x00 ; version(8) db 0x00, 0x00, 0x00 ; flags(24) db 0x00, 0x00, 0x00, 0x01 ; entry_count(32) db 0x00, 0x01 ; item_ID(16) db 0x05 ; association_count(8) db 0x01 ; essential(1) property_index(7) db 0x02 ; essential(1) property_index(7) db 0x83 ; essential(1) property_index(7) db 0x04 ; essential(1) property_index(7) db 0x85 ; essential(1) property_index(7) ipma_end: iprp_end: iref_start: dd BE(iref_end - iref_start) dd "iref" db 0x00 ; version(8) db 0x00, 0x00, 0x00 ; flags(24) db 0x00, 0x00, 0x00, 0x0E ; box_size(32) db 0x63, 0x64, 0x73, 0x63 ; box_type(32) ('cdsc') db 0x00, 0x02 ; from_item_ID(16) db 0x00, 0x01 ; reference_count(16) db 0x00, 0x01 ; to_item_ID(16) iref_end: meta_end: free_start: dd BE(free_end - free_start) dd "free" db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) db 0x00 ; (8) free_end: mdat_start: dd BE(mdat_end - mdat_start) db "mdat" db 0x00 mdat_end: ; vim: syntax=nasm
35.793522
309
0.518154
03cb49f4d3049162eec1fad0648d5a85a6e8100c
4,074
asm
Assembly
scripts/PokemonTower6F.asm
opiter09/ASM-Machina
75d8e457b3e82cc7a99b8e70ada643ab02863ada
[ "CC0-1.0" ]
1
2022-02-15T00:19:44.000Z
2022-02-15T00:19:44.000Z
scripts/PokemonTower6F.asm
opiter09/ASM-Machina
75d8e457b3e82cc7a99b8e70ada643ab02863ada
[ "CC0-1.0" ]
null
null
null
scripts/PokemonTower6F.asm
opiter09/ASM-Machina
75d8e457b3e82cc7a99b8e70ada643ab02863ada
[ "CC0-1.0" ]
null
null
null
PokemonTower6F_Script: call EnableAutoTextBoxDrawing ld hl, PokemonTower6TrainerHeaders ld de, PokemonTower6F_ScriptPointers ld a, [wPokemonTower6FCurScript] call ExecuteCurMapScriptInTable ld [wPokemonTower6FCurScript], a ret PokemonTower6Script_60b02: xor a ld [wJoyIgnore], a ld [wPokemonTower6FCurScript], a ld [wCurMapScript], a ret PokemonTower6F_ScriptPointers: dw PokemonTower6Script0 dw DisplayEnemyTrainerTextAndStartBattle dw EndTrainerBattle dw PokemonTower6Script3 dw PokemonTower6Script4 PokemonTower6Script0: CheckEvent EVENT_BEAT_GHOST_MAROWAK jp nz, CheckFightingMapTrainers ld hl, CoordsData_60b45 call ArePlayerCoordsInArray jp nc, CheckFightingMapTrainers xor a ldh [hJoyHeld], a ld a, $6 ldh [hSpriteIndexOrTextID], a call DisplayTextID ld a, RESTLESS_SOUL ld [wCurOpponent], a ld a, 30 ld [wCurEnemyLVL], a ld a, $4 ld [wPokemonTower6FCurScript], a ld [wCurMapScript], a ret CoordsData_60b45: dbmapcoord 10, 16 db -1 ; end PokemonTower6Script4: ld a, [wIsInBattle] cp $ff jp z, PokemonTower6Script_60b02 ld a, $ff ld [wJoyIgnore], a ld a, [wd72d] bit 6, a ret nz call UpdateSprites ld a, $f0 ld [wJoyIgnore], a ld a, [wBattleResult] and a jr nz, .asm_60b82 SetEvent EVENT_BEAT_GHOST_MAROWAK ld a, $7 ldh [hSpriteIndexOrTextID], a call DisplayTextID xor a ld [wJoyIgnore], a ld a, $0 ld [wPokemonTower6FCurScript], a ld [wCurMapScript], a ret .asm_60b82 ld a, $1 ld [wSimulatedJoypadStatesIndex], a ld a, $10 ld [wSimulatedJoypadStatesEnd], a xor a ld [wSpritePlayerStateData2MovementByte1], a ld [wOverrideSimulatedJoypadStatesMask], a ld hl, wd730 set 7, [hl] ld a, $3 ld [wPokemonTower6FCurScript], a ld [wCurMapScript], a ret PokemonTower6Script3: ld a, [wSimulatedJoypadStatesIndex] and a ret nz call Delay3 xor a ld [wPokemonTower6FCurScript], a ld [wCurMapScript], a ret PokemonTower6F_TextPointers: dw PokemonTower6Text1 dw PokemonTower6Text2 dw PokemonTower6Text3 dw PickUpItemText dw PickUpItemText dw PokemonTower6Text6 dw PokemonTower6Text7 PokemonTower6TrainerHeaders: def_trainers PokemonTower6TrainerHeader0: trainer EVENT_BEAT_POKEMONTOWER_6_TRAINER_0, 3, PokemonTower6BattleText1, PokemonTower6EndBattleText1, PokemonTower6AfterBattleText1 PokemonTower6TrainerHeader1: trainer EVENT_BEAT_POKEMONTOWER_6_TRAINER_1, 3, PokemonTower6BattleText2, PokemonTower6EndBattleText2, PokemonTower6AfterBattleText2 PokemonTower6TrainerHeader2: trainer EVENT_BEAT_POKEMONTOWER_6_TRAINER_2, 2, PokemonTower6BattleText3, PokemonTower6EndBattleText3, PokemonTower6AfterBattleText3 db -1 ; end PokemonTower6Text1: text_asm ld hl, PokemonTower6TrainerHeader0 call TalkToTrainer jp TextScriptEnd PokemonTower6Text2: text_asm ld hl, PokemonTower6TrainerHeader1 call TalkToTrainer jp TextScriptEnd PokemonTower6Text3: text_asm ld hl, PokemonTower6TrainerHeader2 call TalkToTrainer jp TextScriptEnd PokemonTower6Text7: text_asm ld hl, PokemonTower2Text_60c1f call PrintText ld a, RESTLESS_SOUL call PlayCry call WaitForSoundToFinish ld c, 30 call DelayFrames ld hl, PokemonTower2Text_60c24 call PrintText jp TextScriptEnd PokemonTower2Text_60c1f: text_far _PokemonTower2Text_60c1f text_end PokemonTower2Text_60c24: text_far _PokemonTower2Text_60c24 text_end PokemonTower6BattleText1: text_far _PokemonTower6BattleText1 text_end PokemonTower6EndBattleText1: text_far _PokemonTower6EndBattleText1 text_end PokemonTower6AfterBattleText1: text_far _PokemonTower6AfterBattleText1 text_end PokemonTower6BattleText2: text_far _PokemonTower6BattleText2 text_end PokemonTower6EndBattleText2: text_far _PokemonTower6EndBattleText2 text_end PokemonTower6AfterBattleText2: text_far _PokemonTower6AfterBattleText2 text_end PokemonTower6BattleText3: text_far _PokemonTower6BattleText3 text_end PokemonTower6EndBattleText3: text_far _PokemonTower6EndBattleText3 text_end PokemonTower6AfterBattleText3: text_far _PokemonTower6AfterBattleText3 text_end PokemonTower6Text6: text_far _PokemonTower6Text6 text_end
20.892308
133
0.827933
9135dfde4c3f3cef2442fadaa758253d3a40bf6c
6,987
asm
Assembly
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1552.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1552.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1552.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
3
2020-07-14T17:07:07.000Z
2022-03-21T01:12:22.000Z
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r15 push %r8 push %rax push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0x14e22, %rdx nop nop nop sub %r15, %r15 mov (%rdx), %bp nop nop nop xor %rdx, %rdx lea addresses_UC_ht+0xab6a, %rax nop nop nop add $17395, %r10 movb (%rax), %r8b nop and $17841, %rdx lea addresses_WT_ht+0x13722, %rdi nop nop and $51010, %r10 mov (%rdi), %r15d nop nop nop nop nop sub %rax, %rax lea addresses_UC_ht+0x19602, %r8 nop nop nop nop cmp %rdi, %rdi movw $0x6162, (%r8) sub %r10, %r10 lea addresses_A_ht+0x15f22, %rsi lea addresses_A_ht+0xd4e8, %rdi nop xor %r15, %r15 mov $127, %rcx rep movsw nop nop nop add %rbp, %rbp lea addresses_UC_ht+0x18122, %rsi lea addresses_normal_ht+0x9dd2, %rdi nop add $53962, %r15 mov $35, %rcx rep movsw nop nop nop nop nop sub %rcx, %rcx lea addresses_D_ht+0x1c70c, %rcx xor %rax, %rax mov $0x6162636465666768, %rdx movq %rdx, %xmm5 and $0xffffffffffffffc0, %rcx movntdq %xmm5, (%rcx) nop nop nop and $36761, %rbp lea addresses_WC_ht+0xf47e, %r15 dec %rcx mov $0x6162636465666768, %rsi movq %rsi, %xmm6 movups %xmm6, (%r15) sub $29846, %r8 lea addresses_A_ht+0x4a2, %r10 nop nop nop nop nop add %r8, %r8 mov $0x6162636465666768, %rax movq %rax, %xmm1 movups %xmm1, (%r10) nop nop and $52733, %rsi lea addresses_WC_ht+0xe22, %rax nop nop cmp %r15, %r15 vmovups (%rax), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $1, %xmm5, %rdx nop nop sub %rbp, %rbp lea addresses_UC_ht+0x1dec2, %rbp nop cmp $27130, %rsi mov (%rbp), %di nop nop nop cmp $14841, %r8 lea addresses_normal_ht+0x6e22, %r8 nop nop nop cmp %rcx, %rcx mov $0x6162636465666768, %rdi movq %rdi, (%r8) nop nop nop cmp $25308, %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %rax pop %r8 pop %r15 pop %r10 ret .global s_faulty_load s_faulty_load: push %rax push %rbp push %rbx push %rcx push %rdi push %rdx push %rsi // Faulty Load lea addresses_D+0x13622, %rax nop nop xor %rcx, %rcx movb (%rax), %dl lea oracles, %rsi and $0xff, %rdx shlq $12, %rdx mov (%rsi,%rdx,1), %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %rax ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_D', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_D', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 8}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 4}} {'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}} {'src': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16, 'NT': True, 'same': False, 'congruent': 1}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 2}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 6}} {'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 11}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 11}} {'36': 21829} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
36.581152
2,999
0.657077
217f18880f2a37d6d5babc2252d8506865679039
467
asm
Assembly
oeis/092/A092236.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/092/A092236.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/092/A092236.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A092236: a(n) = (3^n + 2*3^(n/2)*cos(n*Pi/6))/3. ; Submitted by Christian Krause ; 1,2,4,9,24,72,225,702,2160,6561,19764,59292,177633,532170,1595052,4782969,14346720,43040160,129127041,387400806,1162241784,3486784401,10460412252,31381236756,94143533121,282430067922,847289140884,2541865828329,7625595890664 lpb $0 sub $0,1 add $4,$1 add $1,$3 max $5,$1 add $5,$2 mul $2,2 add $2,1 add $2,$4 add $5,1 mov $3,$5 mul $4,2 lpe mov $0,$2 add $0,1
23.35
225
0.67666
1587fdb83303d8747dc71737ff04e4beb40968fa
174,727
asm
Assembly
engine/battle/effect_commands.asm
AtmaBuster/pokeplat-gen2
fa83b2e75575949b8f72cb2c48f7a1042e97f70f
[ "blessing" ]
6
2021-06-19T06:41:19.000Z
2022-02-15T17:12:33.000Z
engine/battle/effect_commands.asm
AtmaBuster/pokeplat-gen2
fa83b2e75575949b8f72cb2c48f7a1042e97f70f
[ "blessing" ]
null
null
null
engine/battle/effect_commands.asm
AtmaBuster/pokeplat-gen2
fa83b2e75575949b8f72cb2c48f7a1042e97f70f
[ "blessing" ]
2
2021-08-11T19:47:07.000Z
2022-01-01T07:07:56.000Z
SECTION "Effect Commands", ROMX CompareMove: ; checks if the move ID in a matches the move in bc push hl call GetMoveIndexFromID ld a, h cp b ld a, l pop hl ret nz cp c ret GetOppUnderwaterAddr: call BattleCommand_switchturn call GetUserUnderwaterAddr jp BattleCommand_switchturn GetUserUnderwaterAddr: ldh a, [hBattleTurn] and a ld hl, wPlayerUnderwater ret z ld hl, wEnemyUnderwater ret DoPlayerTurn: call SetPlayerTurn ld a, [wBattlePlayerAction] and a ; BATTLEPLAYERACTION_USEMOVE? ret nz jr DoTurn DoEnemyTurn: call SetEnemyTurn ld a, [wLinkMode] and a jr z, DoTurn ld a, [wBattleAction] cp BATTLEACTION_STRUGGLE jr z, DoTurn cp BATTLEACTION_SWITCH1 ret nc ; fallthrough DoTurn: ; Read in and execute the user's move effects for this turn. xor a ld [wTurnEnded], a ; Effect command checkturn is called for every move. call CheckTurn ld a, [wTurnEnded] and a ret nz call UpdateMoveData DoMove: ; Get the user's move effect. ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar ld c, a ld b, 0 ld hl, MoveEffectsPointers add hl, bc add hl, bc ld a, BANK(MoveEffectsPointers) call GetFarHalfword ld de, wBattleScriptBuffer .GetMoveEffect: ld a, BANK(MoveEffects) call GetFarByte inc hl ld [de], a inc de cp endmove_command jr nz, .GetMoveEffect ; Start at the first command. ld hl, wBattleScriptBuffer ld a, l ld [wBattleScriptBufferAddress], a ld a, h ld [wBattleScriptBufferAddress + 1], a .ReadMoveEffectCommand: ; ld a, [wBattleScriptBufferAddress++] call ReadMoveScriptByte ; endturn_command (-2) is used to terminate branches without ending the read cycle. cp endturn_command ret nc ; The rest of the commands (01-af) are read from BattleCommandPointers. push bc dec a ld c, a ld b, 0 ld hl, BattleCommandPointers add hl, bc add hl, bc add hl, bc pop bc ld a, BANK(BattleCommandPointers) call GetFarBankAddress rst FarCall jr .ReadMoveEffectCommand ReadMoveScriptByte: ld a, [wBattleScriptBufferAddress] ld l, a ld a, [wBattleScriptBufferAddress + 1] ld h, a ld a, [hli] push af ld a, l ld [wBattleScriptBufferAddress], a ld a, h ld [wBattleScriptBufferAddress + 1], a pop af ret CheckTurn: BattleCommand_checkturn: ; checkturn ; Repurposed as hardcoded turn handling. Useless as a command. ; Move $ff immediately ends the turn. ld a, BATTLE_VARS_MOVE call GetBattleVar inc a jp z, EndTurn xor a ld [wAttackMissed], a ld [wEffectFailed], a ld [wKickCounter], a ld [wAlreadyDisobeyed], a ld [wAlreadyFailed], a ld [wSomeoneIsRampaging], a ld [wWonderGuardMiss], a ld a, EFFECTIVE ld [wTypeModifier], a ldh a, [hBattleTurn] and a jp nz, CheckEnemyTurn CheckPlayerTurn: ld hl, wPlayerSubStatus4 bit SUBSTATUS_RECHARGE, [hl] jr z, .no_recharge res SUBSTATUS_RECHARGE, [hl] ld hl, MustRechargeText call StdBattleTextbox call CantMove jp EndTurn .no_recharge ld hl, wBattleMonStatus ld a, [hl] and SLP jr z, .not_asleep dec a ld [wBattleMonStatus], a and SLP jr z, .woke_up xor a ld [wNumHits], a ld de, ANIM_SLP call FarPlayBattleAnimation jr .fast_asleep .woke_up ld hl, WokeUpText call StdBattleTextbox call CantMove call UpdateBattleMonInParty ld hl, UpdatePlayerHUD call CallBattleCore ld a, $1 ldh [hBGMapMode], a ld hl, wPlayerSubStatus1 res SUBSTATUS_NIGHTMARE, [hl] jr .not_asleep .fast_asleep ld hl, FastAsleepText call StdBattleTextbox ; Snore and Sleep Talk bypass sleep. ld a, [wCurPlayerMove] ld hl, .sleep_bypass_moves call CheckMoveInList jr c, .not_asleep call CantMove jp EndTurn .sleep_bypass_moves dw SNORE dw SLEEP_TALK dw -1 .not_asleep ld hl, wBattleMonStatus bit FRZ, [hl] jr z, .not_frozen ; Flame Wheel and Sacred Fire thaw the user. ld a, [wCurPlayerMove] ld hl, .thawing_moves call CheckMoveInList jr c, .not_frozen ld hl, FrozenSolidText call StdBattleTextbox call CantMove jp EndTurn .thawing_moves dw FLAME_WHEEL dw SACRED_FIRE dw -1 .not_frozen ld hl, wPlayerSubStatus3 bit SUBSTATUS_FLINCHED, [hl] jr z, .not_flinched res SUBSTATUS_FLINCHED, [hl] ld hl, FlinchedText call StdBattleTextbox call CantMove jp EndTurn .not_flinched ld hl, wPlayerDisableCount ld a, [hl] and a jr z, .not_disabled dec a ld [hl], a and $f jr nz, .not_disabled ld [hl], a ld [wDisabledMove], a ld hl, DisabledNoMoreText call StdBattleTextbox .not_disabled ld a, [wPlayerSubStatus3] add a jr nc, .not_confused ld hl, wPlayerConfuseCount dec [hl] jr nz, .confused ld hl, wPlayerSubStatus3 res SUBSTATUS_CONFUSED, [hl] ld hl, ConfusedNoMoreText call StdBattleTextbox jr .not_confused .confused ld hl, IsConfusedText call StdBattleTextbox xor a ld [wNumHits], a ld de, ANIM_CONFUSED call FarPlayBattleAnimation ; 50% chance of hitting itself call BattleRandom cp 50 percent + 1 jr nc, .not_confused ; clear confusion-dependent substatus ld hl, wPlayerSubStatus3 ld a, [hl] and 1 << SUBSTATUS_CONFUSED ld [hl], a call HitConfusion call CantMove jp EndTurn .not_confused ld a, [wPlayerSubStatus1] add a ; bit SUBSTATUS_ATTRACT jr nc, .not_infatuated ld hl, InLoveWithText call StdBattleTextbox xor a ld [wNumHits], a ld de, ANIM_IN_LOVE call FarPlayBattleAnimation ; 50% chance of infatuation call BattleRandom cp 50 percent + 1 jr c, .not_infatuated ld hl, InfatuationText call StdBattleTextbox call CantMove jp EndTurn .not_infatuated ; We can't disable a move that doesn't exist. ld a, [wDisabledMove] and a jr z, .no_disabled_move ; Are we using the disabled move? ld hl, wCurPlayerMove cp [hl] jr nz, .no_disabled_move call MoveDisabled call CantMove jp EndTurn .no_disabled_move ld hl, wBattleMonStatus bit PAR, [hl] ret z ; 25% chance to be fully paralyzed call BattleRandom cp 25 percent ret nc ld hl, FullyParalyzedText call StdBattleTextbox call CantMove jp EndTurn CantMove: ld a, BATTLE_VARS_SUBSTATUS1 call GetBattleVarAddr res SUBSTATUS_ROLLOUT, [hl] ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr ld a, [hl] and $ff ^ (1 << SUBSTATUS_BIDE | 1 << SUBSTATUS_RAMPAGE | 1 << SUBSTATUS_CHARGED) ld [hl], a ld a, BATTLE_VARS_SUBSTATUS6 call GetBattleVarAddr res SUBSTATUS_UPROAR, [hl] call ResetFuryCutterCount ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar push hl ld hl, .fly_dig_moves call CheckMoveInList pop hl ret nc res SUBSTATUS_UNDERGROUND, [hl] res SUBSTATUS_FLYING, [hl] call GetUserUnderwaterAddr xor a ld [hl], a jp AppearUserRaiseSub .fly_dig_moves dw FLY dw DIG dw DIVE dw BOUNCE dw SHADOW_FORCE dw -1 OpponentCantMove: call BattleCommand_switchturn call CantMove jp BattleCommand_switchturn CheckEnemyTurn: ld hl, wEnemySubStatus4 bit SUBSTATUS_RECHARGE, [hl] jr z, .no_recharge res SUBSTATUS_RECHARGE, [hl] ld hl, MustRechargeText call StdBattleTextbox call CantMove jp EndTurn .no_recharge ld hl, wEnemyMonStatus ld a, [hl] and SLP jr z, .not_asleep dec a ld [wEnemyMonStatus], a and a jr z, .woke_up ld hl, FastAsleepText call StdBattleTextbox xor a ld [wNumHits], a ld de, ANIM_SLP call FarPlayBattleAnimation jr .fast_asleep .woke_up ld hl, WokeUpText call StdBattleTextbox call CantMove call UpdateEnemyMonInParty ld hl, UpdateEnemyHUD call CallBattleCore ld a, $1 ldh [hBGMapMode], a ld hl, wEnemySubStatus1 res SUBSTATUS_NIGHTMARE, [hl] jr .not_asleep .fast_asleep ; Snore and Sleep Talk bypass sleep. ld a, [wCurEnemyMove] ld hl, .sleep_bypass_moves call CheckMoveInList jr c, .not_asleep call CantMove jp EndTurn .sleep_bypass_moves dw SNORE dw SLEEP_TALK dw -1 .not_asleep ld hl, wEnemyMonStatus bit FRZ, [hl] jr z, .not_frozen ; Flame Wheel and Sacred Fire thaw the user. ld a, [wCurEnemyMove] ld hl, .thawing_moves call CheckMoveInList jr c, .not_frozen ld hl, FrozenSolidText call StdBattleTextbox call CantMove jp EndTurn .thawing_moves dw FLAME_WHEEL dw SACRED_FIRE dw -1 .not_frozen ld hl, wEnemySubStatus3 bit SUBSTATUS_FLINCHED, [hl] jr z, .not_flinched res SUBSTATUS_FLINCHED, [hl] ld hl, FlinchedText call StdBattleTextbox call CantMove jp EndTurn .not_flinched ld hl, wEnemyDisableCount ld a, [hl] and a jr z, .not_disabled dec a ld [hl], a and $f jr nz, .not_disabled ld [hl], a ld [wEnemyDisabledMove], a ld hl, DisabledNoMoreText call StdBattleTextbox .not_disabled ld a, [wEnemySubStatus3] add a ; bit SUBSTATUS_CONFUSED jr nc, .not_confused ld hl, wEnemyConfuseCount dec [hl] jr nz, .confused ld hl, wEnemySubStatus3 res SUBSTATUS_CONFUSED, [hl] ld hl, ConfusedNoMoreText call StdBattleTextbox jr .not_confused .confused ld hl, IsConfusedText call StdBattleTextbox xor a ld [wNumHits], a ld de, ANIM_CONFUSED call FarPlayBattleAnimation ; 50% chance of hitting itself call BattleRandom cp 50 percent + 1 jr nc, .not_confused ; clear confusion-dependent substatus ld hl, wEnemySubStatus3 ld a, [hl] and 1 << SUBSTATUS_CONFUSED ld [hl], a ld hl, HurtItselfText call StdBattleTextbox call HitSelfInConfusion call BattleCommand_damagecalc call BattleCommand_lowersub xor a ld [wNumHits], a ; Flicker the monster pic unless flying or underground. ld de, ANIM_HIT_CONFUSION ld a, BATTLE_VARS_SUBSTATUS3_OPP call GetBattleVar and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND jr nz, .no_flicker call GetOppUnderwaterAddr ld a, [hl] and a jr nz, .no_flicker call z, PlayFXAnimID .no_flicker ld c, TRUE call DoEnemyDamage call BattleCommand_raisesub call CantMove jp EndTurn .not_confused ld a, [wEnemySubStatus1] add a ; bit SUBSTATUS_ATTRACT jr nc, .not_infatuated ld hl, InLoveWithText call StdBattleTextbox xor a ld [wNumHits], a ld de, ANIM_IN_LOVE call FarPlayBattleAnimation ; 50% chance of infatuation call BattleRandom cp 50 percent + 1 jr c, .not_infatuated ld hl, InfatuationText call StdBattleTextbox call CantMove jp EndTurn .not_infatuated ; We can't disable a move that doesn't exist. ld a, [wEnemyDisabledMove] and a jr z, .no_disabled_move ; Are we using the disabled move? ld hl, wCurEnemyMove cp [hl] jr nz, .no_disabled_move call MoveDisabled call CantMove jp EndTurn .no_disabled_move ld hl, wEnemyMonStatus bit PAR, [hl] ret z ; 25% chance to be fully paralyzed call BattleRandom cp 25 percent ret nc ld hl, FullyParalyzedText call StdBattleTextbox call CantMove ; fallthrough EndTurn: ld a, $1 ld [wTurnEnded], a jp ResetDamage MoveDisabled: ; Make sure any charged moves fail ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr res SUBSTATUS_CHARGED, [hl] ld a, BATTLE_VARS_MOVE call GetBattleVar ld [wNamedObjectIndexBuffer], a call GetMoveName ld hl, DisabledMoveText jp StdBattleTextbox HitConfusion: ld hl, HurtItselfText call StdBattleTextbox xor a ld [wCriticalHit], a call HitSelfInConfusion call BattleCommand_damagecalc call BattleCommand_lowersub xor a ld [wNumHits], a ; Flicker the monster pic unless flying or underground. ld de, ANIM_HIT_CONFUSION ld a, BATTLE_VARS_SUBSTATUS3_OPP call GetBattleVar and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND jr nz, .no_flicker call GetOppUnderwaterAddr ld a, [hl] and a jr z, .no_flicker call z, PlayFXAnimID .no_flicker ld hl, UpdatePlayerHUD call CallBattleCore ld a, $1 ldh [hBGMapMode], a ld c, TRUE call DoPlayerDamage jp BattleCommand_raisesub BattleCommand_checkobedience: ; checkobedience ; Enemy can't disobey ldh a, [hBattleTurn] and a ret nz call CheckUserIsCharging ret nz ; If we've already checked this turn ld a, [wAlreadyDisobeyed] and a ret nz xor a ld [wAlreadyDisobeyed], a ; No obedience in link battles ; (since no handling exists for enemy) ld a, [wLinkMode] and a ret nz ld a, [wInBattleTowerBattle] and a ret nz ; If the monster's id doesn't match the player's, ; some conditions need to be met. ld a, MON_ID call BattlePartyAttr ld a, [wPlayerID] cp [hl] jr nz, .obeylevel inc hl ld a, [wPlayerID + 1] cp [hl] ret z .obeylevel ; The maximum obedience level is constrained by owned badges: ld hl, wJohtoBadges ; risingbadge bit RISINGBADGE, [hl] ld a, MAX_LEVEL + 1 jr nz, .getlevel ; stormbadge bit STORMBADGE, [hl] ld a, 70 jr nz, .getlevel ; fogbadge bit FOGBADGE, [hl] ld a, 50 jr nz, .getlevel ; hivebadge bit HIVEBADGE, [hl] ld a, 30 jr nz, .getlevel ; no badges ld a, 10 .getlevel ; c = obedience level ; d = monster level ; b = c + d ld b, a ld c, a ld a, [wBattleMonLevel] ld d, a add b ld b, a ; No overflow (this should never happen) jr nc, .checklevel ld b, $ff .checklevel ; If the monster's level is lower than the obedience level, it will obey. ld a, c cp d ret nc ; Random number from 0 to obedience level + monster level .rand1 call BattleRandom swap a cp b jr nc, .rand1 ; The higher above the obedience level the monster is, ; the more likely it is to disobey. cp c ret c ; Sleep-only moves have separate handling, and a higher chance of ; being ignored. Lazy monsters like their sleep. call IgnoreSleepOnly ret c ; Another random number from 0 to obedience level + monster level .rand2 call BattleRandom cp b jr nc, .rand2 ; A second chance. cp c jr c, .UseInstead ; No hope of using a move now. ; b = number of levels the monster is above the obedience level ld a, d sub c ld b, a ; The chance of napping is the difference out of 256. call BattleRandom swap a sub b jr c, .Nap ; The chance of not hitting itself is the same. cp b jr nc, .DoNothing ld hl, WontObeyText call StdBattleTextbox call HitConfusion jp .EndDisobedience .Nap: call BattleRandom add a swap a and SLP jr z, .Nap ld [wBattleMonStatus], a ld hl, BeganToNapText jr .Print .DoNothing: ; 4 random choices call BattleRandom and %11 ld hl, LoafingAroundText and a ; 0 jr z, .Print ld hl, WontObeyText dec a ; 1 jr z, .Print ld hl, TurnedAwayText dec a ; 2 jr z, .Print ld hl, IgnoredOrdersText .Print: call StdBattleTextbox jp .EndDisobedience .UseInstead: ; Can't use another move if the monster only has one! ld a, [wBattleMonMoves + 1] and a jr z, .DoNothing ; Don't bother trying to handle Disable. ld a, [wDisabledMove] and a jr nz, .DoNothing ld hl, wBattleMonPP ld de, wBattleMonMoves ld b, 0 ld c, NUM_MOVES .GetTotalPP: ld a, [hli] and PP_MASK add b ld b, a dec c jr z, .CheckMovePP ; Stop at undefined moves. inc de ld a, [de] and a jr nz, .GetTotalPP .CheckMovePP: ld hl, wBattleMonPP ld a, [wCurMoveNum] ld e, a ld d, 0 add hl, de ; Can't use another move if only one move has PP. ld a, [hl] and PP_MASK cp b jr z, .DoNothing ; Make sure we can actually use the move once we get there. ld a, 1 ld [wAlreadyDisobeyed], a ld a, [w2DMenuNumRows] ld b, a ; Save the move we originally picked for afterward. ld a, [wCurMoveNum] ld c, a push af .RandomMove: call BattleRandom maskbits NUM_MOVES cp b jr nc, .RandomMove ; Not the move we were trying to use. cp c jr z, .RandomMove ; Make sure it has PP. ld [wCurMoveNum], a ld hl, wBattleMonPP ld e, a ld d, 0 add hl, de ld a, [hl] and PP_MASK jr z, .RandomMove ; Use it. ld a, [wCurMoveNum] ld c, a ld b, 0 ld hl, wBattleMonMoves add hl, bc ld a, [hl] ld [wCurPlayerMove], a call SetPlayerTurn call UpdateMoveData call DoMove ; Restore original move choice. pop af ld [wCurMoveNum], a .EndDisobedience: xor a ld [wLastPlayerMove], a ld [wLastPlayerCounterMove], a ; Break Encore too. ld hl, wPlayerSubStatus5 res SUBSTATUS_ENCORED, [hl] xor a ld [wPlayerEncoreCount], a jp EndMoveEffect IgnoreSleepOnly: ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar ; Snore and Sleep Talk bypass sleep. ld hl, .sleep_moves call CheckMoveInList ret nc ld a, BATTLE_VARS_STATUS call GetBattleVar and SLP ret z ; 'ignored orders…sleeping!' ld hl, IgnoredSleepingText call StdBattleTextbox call EndMoveEffect scf ret .sleep_moves dw SNORE dw SLEEP_TALK dw -1 CheckUserIsCharging: ldh a, [hBattleTurn] and a ld a, [wPlayerCharging] ; player jr z, .end ld a, [wEnemyCharging] ; enemy .end and a ret BattleCommand_doturn: call CheckUserIsCharging ret nz call CheckUserImprisonedMove jp c, .imprison ld hl, wBattleMonPP ld de, wPlayerSubStatus3 ld bc, wPlayerTurnsTaken ldh a, [hBattleTurn] and a jr z, .proceed ld hl, wEnemyMonPP ld de, wEnemySubStatus3 ld bc, wEnemyTurnsTaken .proceed ; If we've gotten this far, this counts as a turn. ld a, [bc] inc a ld [bc], a ld a, BATTLE_VARS_MOVE call GetBattleVar ld bc, STRUGGLE call CompareMove ret z ld a, [de] and 1 << SUBSTATUS_IN_LOOP | 1 << SUBSTATUS_RAMPAGE | 1 << SUBSTATUS_BIDE ret nz inc de inc de inc de ld a, [de] bit SUBSTATUS_UPROAR, a ret nz call .consume_pp ld a, b and a jp nz, EndMoveEffect ld a, BATTLE_VARS_MOVE_TYPE call GetBattleVar and CATEGORY_MASK cp STATUS jr nz, .not_status_move ld a, [de] bit SUBSTATUS_TAUNT, a jp nz, .taunt_fail .not_status_move ; SubStatus5 dec de ld a, [de] bit SUBSTATUS_TRANSFORMED, a ret nz farcall SetLastResortFlag ldh a, [hBattleTurn] and a ld hl, wPartyMon1PP ld a, [wCurBattleMon] jr z, .player ; mimic this part entirely if wildbattle ld a, [wBattleMode] dec a jr z, .wild ld hl, wOTPartyMon1PP ld a, [wCurOTMon] .player call GetPartyLocation push hl call CheckMimicUsed pop hl ret c .consume_pp ldh a, [hBattleTurn] and a ld a, [wCurMoveNum] jr z, .okay ld a, [wCurEnemyMoveNum] .okay ld c, a ld b, 0 add hl, bc ld a, [hl] and PP_MASK jr z, .out_of_pp dec [hl] ld b, 0 ret .wild ld hl, wEnemyMonMoves ld a, [wCurEnemyMoveNum] ld e, a ld d, 0 add hl, de ld a, [hl] ld bc, MIMIC call CompareMove jr z, .mimic ld hl, wWildMonMoves add hl, de ld a, [hl] call CompareMove ret z .mimic ld hl, wWildMonPP call .consume_pp ret .out_of_pp call BattleCommand_movedelay ; get move effect ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar ; continuous? ld hl, .continuousmoves ld de, 1 call IsInArray ; 'has no pp left for [move]' ld hl, HasNoPPLeftText jr c, .print ; 'but no pp is left for the move' ld hl, NoPPLeftText .print call StdBattleTextbox ld b, 1 ret .continuousmoves db EFFECT_RAZOR_WIND db EFFECT_SKY_ATTACK db EFFECT_SKULL_BASH db EFFECT_SOLARBEAM db EFFECT_FLY db EFFECT_ROLLOUT db EFFECT_BIDE db EFFECT_RAMPAGE db -1 .imprison .taunt_fail call AnimateFailedMove call PrintButItFailed jp EndMoveEffect CheckMimicUsed: ldh a, [hBattleTurn] and a ld a, [wCurMoveNum] jr z, .player ld a, [wCurEnemyMoveNum] .player ld c, a ld a, MON_MOVES call UserPartyAttr ld b, 0 add hl, bc ld a, [hl] ld bc, MIMIC call CompareMove jr nz, .mimic ld a, BATTLE_VARS_MOVE call GetBattleVar call CompareMove jr z, .mimic scf ret .mimic and a ret CheckUserImprisonedMove: ldh a, [hBattleTurn] and a ld hl, wEnemyMonMoves ld a, [wEnemySubStatus2] jr z, .go ld hl, wBattleMonMoves ld a, [wPlayerSubStatus2] .go bit SUBSTATUS_IMPRISON, a jr z, .nope ld a, BATTLE_VARS_MOVE call GetBattleVar ld bc, STRUGGLE call CompareMove jr z, .nope ld a, BATTLE_VARS_MOVE call GetBattleVar ld b, a ld c, 4 .loop ld a, [hli] cp b jr z, .yep dec c jr nz, .loop .nope and a ret .yep scf ret BattleCommand_critical: ; critical ; Determine whether this attack's hit will be critical. xor a ld [wCriticalHit], a ; don't crit if opponent has lucky chant ldh a, [hBattleTurn] and a ld hl, wEnemyLuckyChantCount jr z, .got_lucky_chant ld hl, wPlayerLuckyChantCount .got_lucky_chant ld a, [hl] and a ret nz ld a, BATTLE_VARS_MOVE_POWER call GetBattleVar and a ret z ldh a, [hBattleTurn] and a ld hl, wEnemyMonItem ld a, [wEnemyMonSpecies] jr nz, .Item ld hl, wBattleMonItem ld a, [wBattleMonSpecies] .Item: ; force crit if using Fling and holding Silver Leaf ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_FLING jr nz, .skip_fling ld a, [hl] cp SILVER_LEAF jr nz, .skip_fling ld a, 1 ld [wCriticalHit], a ret .skip_fling ld c, 0 ld b, [hl] call GetPokemonIndexFromID ld a, l sub LOW(CHANSEY) if HIGH(CHANSEY) == 0 or h else jr nz, .Farfetchd if HIGH(CHANSEY) == 1 dec h else ld a, h cp HIGH(CHANSEY) endc endc jr nz, .Farfetchd ld a, b cp LUCKY_PUNCH jr nz, .FocusEnergy ; +2 critical level ld c, 2 jr .Tally .Farfetchd: ld a, l sub LOW(FARFETCH_D) if HIGH(FARFETCH_D) == 0 or h else jr nz, .FocusEnergy if HIGH(FARFETCH_D) == 1 dec h else ld a, h cp HIGH(FARFETCH_D) endc endc jr nz, .FocusEnergy ld a, b cp STICK jr nz, .FocusEnergy ; +2 critical level ld c, 2 jr .Tally .FocusEnergy: ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVar bit SUBSTATUS_FOCUS_ENERGY, a jr z, .CheckCritical ; +1 critical level inc c .CheckCritical: ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar call GetMoveIndexFromID ld de, 2 ld hl, CriticalHitMoves push bc ld b, h ld c, l call IsInHalfwordArray pop bc jr nc, .ScopeLens ; +2 critical level inc c inc c .ScopeLens: push bc call GetUserItem ld a, b cp HELD_CRITICAL_UP ; Increased critical chance. Only Scope Lens has this. pop bc jr nz, .Tally ; +1 critical level inc c .Tally: ld hl, CriticalHitChances ld b, 0 add hl, bc call BattleRandom cp [hl] ret nc ld a, 1 ld [wCriticalHit], a ret INCLUDE "data/moves/critical_hit_moves.asm" INCLUDE "data/battle/critical_hit_chances.asm" INCLUDE "engine/battle/move_effects/triple_kick.asm" CheckAnyTypeMatchup: ld hl, wTypeMatchupBuffer push hl push de push bc ld a, [wTypeMatchupBuffer + 2] jr CheckTypeMatchup_join BattleCheckTypeMatchup: ld hl, wEnemyMonType1 ldh a, [hBattleTurn] and a jr z, CheckTypeMatchup ld hl, wBattleMonType1 CheckTypeMatchup: ; There is an incorrect assumption about this function made in the AI related code: when ; the AI calls CheckTypeMatchup (not BattleCheckTypeMatchup), it assumes that placing the ; offensive type in a will make this function do the right thing. Since a is overwritten, ; this assumption is incorrect. A simple fix would be to load the move type for the ; current move into a in BattleCheckTypeMatchup, before falling through, which is ; consistent with how the rest of the code assumes this code works like. push hl push de push bc call GetCurrentMoveType2 CheckTypeMatchup_join: ld d, a ld b, [hl] inc hl ld c, [hl] ld a, 10 ; 1.0 ld [wTypeMatchup], a farcall TypeMatchupSpecialCases2 jr c, .End ld hl, TypeMatchups .TypesLoop: ld a, [hli] cp -1 jr z, .End cp -2 jr nz, .Next ld a, BATTLE_VARS_SUBSTATUS1_OPP call GetBattleVar bit SUBSTATUS_IDENTIFIED, a jr nz, .End jr .TypesLoop .Next: cp d jr nz, .Nope ld a, [hli] cp b jr z, .Yup cp c jr z, .Yup jr .Nope2 .Nope: inc hl .Nope2: inc hl jr .TypesLoop .Yup: xor a ldh [hDividend + 0], a ldh [hMultiplicand + 0], a ldh [hMultiplicand + 1], a ld a, [hli] ldh [hMultiplicand + 2], a ld a, [wTypeMatchup] ldh [hMultiplier], a call Multiply ld a, 10 ldh [hDivisor], a push bc ld b, 4 call Divide pop bc ldh a, [hQuotient + 3] ld [wTypeMatchup], a jr .TypesLoop .End: pop bc pop de pop hl ret BattleCommand_resettypematchup: ; Reset the type matchup multiplier to 1.0, if the type matchup is not 0. ; If there is immunity in play, the move automatically misses. call BattleCheckTypeMatchup ld a, [wTypeMatchup] and a ld a, 10 ; 1.0 jr nz, .reset call ResetDamage xor a ld [wTypeModifier], a inc a ld [wAttackMissed], a ret .reset ld [wTypeMatchup], a ret INCLUDE "engine/battle/ai/switch.asm" INCLUDE "data/types/type_matchups.asm" BattleCommand_damagevariation: ; damagevariation ; Modify the damage spread between 85% and 100%. ; Because of the method of division the probability distribution ; is not consistent. This makes the highest damage multipliers ; rarer than normal. ; No point in reducing 1 or 0 damage. ld hl, wCurDamage ld a, [hli] and a jr nz, .go ld a, [hl] cp 2 ret c .go ; Start with the maximum damage. xor a ldh [hMultiplicand + 0], a dec hl ld a, [hli] ldh [hMultiplicand + 1], a ld a, [hl] ldh [hMultiplicand + 2], a ; Multiply by 85-100%... .loop call BattleRandom rrca cp 85 percent + 1 jr c, .loop ldh [hMultiplier], a call Multiply ; ...divide by 100%... ld a, $ff ; 100% ldh [hDivisor], a ld b, $4 call Divide ; ...to get .85-1.00x damage. ldh a, [hQuotient + 2] ld hl, wCurDamage ld [hli], a ldh a, [hQuotient + 3] ld [hl], a ret BattleCommand_checkhit: ; checkhit call .DreamEater jp z, .Miss call .Feint jr z, .skip_protect call .Protect jp nz, .Miss .skip_protect call .DrainSub jp z, .Miss call .LockOn ret nz call .FlyDigMoves jp nz, .Miss call .ThunderRain ret z call .XAccuracy ret nz ; Perfect-accuracy moves ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar ld hl, AlwaysHitEffects ld de, 1 call IsInArray ret c call .StatModifiers ld a, [wPlayerMoveStruct + MOVE_ACC] ld b, a ldh a, [hBattleTurn] and a jr z, .BrightPowder ld a, [wEnemyMoveStruct + MOVE_ACC] ld b, a .BrightPowder: push bc call GetOpponentItem ld a, b cp HELD_BRIGHTPOWDER ld a, c ; % miss pop bc jr nz, .skip_brightpowder ld c, a ld a, b sub c ld b, a jr nc, .skip_brightpowder ld b, 0 .skip_brightpowder ld a, b cp -1 jr z, .Hit farcall GetGravityAccuracyMultiplier call BattleRandom cp b jr nc, .Miss .Hit: ret .Miss: ; Keep the damage value intact if we're using (Hi) Jump Kick. ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_JUMP_KICK jr z, .Missed call ResetDamage .Missed: ld a, 1 ld [wAttackMissed], a ret .DreamEater: ; Return z if we're trying to eat the dream of ; a monster that isn't sleeping. ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_DREAM_EATER ret nz ld a, BATTLE_VARS_STATUS_OPP call GetBattleVar and SLP ret .Feint: ; Return z if using Feint and opponent is protected. ; Fail move if using Feint and opponent isn't protected. ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_FEINT ret nz call .Protect jr z, .Feint_Fail xor a ret .Feint_Fail call AnimateAndPrintFailedMove jp EndMoveEffect .Protect: ; Return nz if the opponent is protected. ld a, BATTLE_VARS_SUBSTATUS1_OPP call GetBattleVar bit SUBSTATUS_PROTECT, a ret z ld c, 40 call DelayFrames ; 'protecting itself!' ld hl, ProtectingItselfText call StdBattleTextbox ld c, 40 call DelayFrames ld a, 1 and a ret .LockOn: ; Return nz if we are locked-on and aren't trying to use Earthquake, ; Fissure or Magnitude on a monster that is flying. ld a, BATTLE_VARS_SUBSTATUS5_OPP call GetBattleVarAddr bit SUBSTATUS_LOCK_ON, [hl] res SUBSTATUS_LOCK_ON, [hl] ret z ld a, BATTLE_VARS_SUBSTATUS3_OPP call GetBattleVar bit SUBSTATUS_FLYING, a ld hl, .DigMoves jr nz, .check_move_in_list ld a, 1 and a ret .DrainSub: ; Return z if using an HP drain move on a substitute. call CheckSubstituteOpp jr z, .not_draining_sub ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_LEECH_HIT ret z cp EFFECT_DREAM_EATER ret z .not_draining_sub ld a, 1 and a ret .FlyDigMoves: ; Check for moves that can hit underground/flying opponents. ; Return z if the current move can hit the opponent. ld a, BATTLE_VARS_SUBSTATUS3_OPP call GetBattleVar and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND jr nz, .hit_hidden_move call GetOppUnderwaterAddr ld a, [hl] and a ret z ld hl, .DiveMoves jr .check_move_in_list .hit_hidden_move bit SUBSTATUS_FLYING, a ld hl, .FlyMoves jr nz, .check_move_in_list ld hl, .DigMoves .check_move_in_list ; returns z (and a = 0) if the current move is in a given list, or nz (and a = 1) if not ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar call CheckMoveInList sbc a inc a ret .FlyMoves: dw GUST dw WHIRLWIND dw THUNDER dw TWISTER dw SKY_UPPERCUT dw -1 .DigMoves: dw EARTHQUAKE dw FISSURE dw MAGNITUDE dw -1 .DiveMoves: dw SURF dw WHIRLPOOL dw -1 .ThunderRain: ; Return z if the current move always hits in rain, and it is raining. ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_THUNDER ret nz ld a, [wBattleWeather] cp WEATHER_RAIN ret .XAccuracy: ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVar bit SUBSTATUS_X_ACCURACY, a ret .StatModifiers: ldh a, [hBattleTurn] and a ; load the user's accuracy into b and the opponent's evasion into c. ld hl, wPlayerMoveStruct + MOVE_ACC ld a, [wPlayerAccLevel] ld b, a ld a, [wEnemyEvaLevel] ld c, a jr z, .got_acc_eva ld hl, wEnemyMoveStruct + MOVE_ACC ld a, [wEnemyAccLevel] ld b, a ld a, [wPlayerEvaLevel] ld c, a .got_acc_eva cp b jr c, .skip_foresight_check ; if the target's evasion is greater than the user's accuracy, ; check the target's foresight status ld a, BATTLE_VARS_SUBSTATUS1_OPP call GetBattleVar bit SUBSTATUS_IDENTIFIED, a ret nz .skip_foresight_check ; subtract evasion from 14 ld a, MAX_STAT_LEVEL + 1 sub c ld c, a ; store the base move accuracy for math ops xor a ldh [hMultiplicand + 0], a ldh [hMultiplicand + 1], a ld a, [hl] ldh [hMultiplicand + 2], a push hl ld d, 2 ; do this twice, once for the user's accuracy and once for the target's evasion .accuracy_loop ; look up the multiplier from the table push bc ld hl, AccuracyLevelMultipliers dec b sla b ld c, b ld b, 0 add hl, bc pop bc ; multiply by the first byte in that row... ld a, [hli] ldh [hMultiplier], a call Multiply ; ... and divide by the second byte ld a, [hl] ldh [hDivisor], a ld b, 4 call Divide ; minimum accuracy is $0001 ldh a, [hQuotient + 3] ld b, a ldh a, [hQuotient + 2] or b jr nz, .min_accuracy ldh [hQuotient + 2], a ld a, 1 ldh [hQuotient + 3], a .min_accuracy ; do the same thing to the target's evasion ld b, c dec d jr nz, .accuracy_loop ; if the result is more than 2 bytes, max out at 100% ldh a, [hQuotient + 2] and a ldh a, [hQuotient + 3] jr z, .finish_accuracy ld a, $ff .finish_accuracy pop hl ld [hl], a ret INCLUDE "data/battle/accuracy_multipliers.asm" INCLUDE "data/moves/always_hit.asm" BattleCommand_lowersub: ; lowersub ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVar bit SUBSTATUS_SUBSTITUTE, a ret z ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVar bit SUBSTATUS_CHARGED, a jr nz, .already_charged ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_RAZOR_WIND jr z, .charge_turn cp EFFECT_SKY_ATTACK jr z, .charge_turn cp EFFECT_SKULL_BASH jr z, .charge_turn cp EFFECT_SOLARBEAM jr z, .charge_turn cp EFFECT_FLY jr z, .charge_turn .already_charged call .Rampage jr z, .charge_turn call CheckUserIsCharging ret nz .charge_turn call _CheckBattleScene jr c, .mimic_anims xor a ld [wNumHits], a inc a ld [wKickCounter], a ld hl, SUBSTITUTE call GetMoveIDFromIndex jp LoadAnim .mimic_anims call BattleCommand_lowersubnoanim jp BattleCommand_movedelay .Rampage: ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_ROLLOUT jr z, .rollout_rampage cp EFFECT_RAMPAGE jr z, .rollout_rampage cp EFFECT_UPROAR jr z, .rollout_rampage ld a, 1 and a ret .rollout_rampage ld a, [wSomeoneIsRampaging] and a ld a, 0 ld [wSomeoneIsRampaging], a ret BattleCommand_moveanim: ; moveanim call CheckAlreadyFailed call BattleCommand_lowersub call BattleCommand_moveanimnosub jp BattleCommand_raisesub BattleCommand_moveanimnosub: ld a, [wAttackMissed] and a jp nz, BattleCommand_movedelay ldh a, [hBattleTurn] and a ld de, wPlayerRolloutCount ld a, BATTLEANIM_ENEMY_DAMAGE jr z, .got_rollout_count ld de, wEnemyRolloutCount ld a, BATTLEANIM_PLAYER_DAMAGE .got_rollout_count ld [wNumHits], a ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_MULTI_HIT jr z, .alternate_anim cp EFFECT_CONVERSION jr z, .alternate_anim cp EFFECT_DOUBLE_HIT jr z, .alternate_anim cp EFFECT_POISON_MULTI_HIT jr z, .alternate_anim ; cp EFFECT_SECRET_POWER ; jr z, .alternate_anim cp EFFECT_TRIPLE_KICK jr z, .triplekick xor a ld [wKickCounter], a .triplekick ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar call SetMoveAnimationID call PlaySelectedFXAnim ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar ld hl, .fly_dig_moves call CheckMoveInList ret nc jp AppearUserLowerSub .fly_dig_moves dw FLY dw DIG dw DIVE dw BOUNCE dw SHADOW_FORCE dw -1 .alternate_anim ld a, [wKickCounter] and 1 xor 1 ld [wKickCounter], a ld a, [de] cp 1 push af ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar call SetMoveAnimationID pop af jr z, .play_anim xor a ld [wNumHits], a .play_anim jp PlaySelectedFXAnim BattleCommand_statupanim: ld a, [wAttackMissed] and a jp nz, BattleCommand_movedelay xor a jr BattleCommand_statupdownanim BattleCommand_statdownanim: ld a, [wAttackMissed] and a jp nz, BattleCommand_movedelay ldh a, [hBattleTurn] and a ld a, BATTLEANIM_ENEMY_STAT_DOWN jr z, BattleCommand_statupdownanim ld a, BATTLEANIM_WOBBLE ; fallthrough BattleCommand_statupdownanim: ld [wNumHits], a xor a ld [wKickCounter], a ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar call SetMoveAnimationID jp PlaySelectedFXAnim ;BattleCommand_switchturn: ;; switchturn ; ; ldh a, [hBattleTurn] ; xor 1 ; ldh [hBattleTurn], a ; ret BattleCommand_raisesub: ; raisesub ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVar bit SUBSTATUS_SUBSTITUTE, a ret z call _CheckBattleScene jp c, BattleCommand_raisesubnoanim xor a ld [wNumHits], a ld a, $2 ld [wKickCounter], a ld hl, SUBSTITUTE call GetMoveIDFromIndex jp LoadAnim BattleCommand_failuretext: ; failuretext ; If the move missed or failed, load the appropriate ; text, and end the effects of multi-turn or multi- ; hit moves. ld a, [wAttackMissed] and a ret z call GetFailureResultText ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVarAddr push hl ld hl, .fly_dig_moves call CheckMoveInList pop hl jr c, .fly_dig ; Move effect: inc hl ld a, [hl] cp EFFECT_MULTI_HIT jr z, .multihit cp EFFECT_DOUBLE_HIT jr z, .multihit cp EFFECT_POISON_MULTI_HIT jr z, .multihit jp EndMoveEffect .multihit call BattleCommand_raisesub jp EndMoveEffect .fly_dig ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr res SUBSTATUS_UNDERGROUND, [hl] res SUBSTATUS_FLYING, [hl] call GetUserUnderwaterAddr xor a ld [hl], a call AppearUserRaiseSub jp EndMoveEffect .fly_dig_moves dw FLY dw DIG dw DIVE dw BOUNCE dw SHADOW_FORCE dw -1 BattleCommand_applydamage: ; applydamage farcall TookDamageFlag ld a, BATTLE_VARS_SUBSTATUS1_OPP call GetBattleVar bit SUBSTATUS_ENDURE, a jr z, .focus_band call BattleCommand_falseswipe ld b, 0 jr nc, .damage ld b, 1 jr .damage .focus_band call GetOpponentItem ld a, b cp HELD_FOCUS_BAND ld b, 0 jr nz, .damage call BattleRandom cp c jr nc, .damage call BattleCommand_falseswipe ld b, 0 jr nc, .damage ld b, 2 .damage push bc call .update_damage_taken ld c, FALSE ldh a, [hBattleTurn] and a jr nz, .damage_player call DoEnemyDamage jr .done_damage .damage_player call DoPlayerDamage .done_damage pop bc ld a, b and a ret z dec a jr nz, .focus_band_text ld hl, EnduredText jp StdBattleTextbox .focus_band_text call GetOpponentItem ld a, [hl] ld [wNamedObjectIndexBuffer], a call GetItemName ld hl, HungOnText jp StdBattleTextbox .update_damage_taken ld a, BATTLE_VARS_SUBSTATUS4_OPP call GetBattleVar bit SUBSTATUS_SUBSTITUTE, a ret nz ld de, wPlayerDamageTaken + 1 ldh a, [hBattleTurn] and a jr nz, .got_damage_taken ld de, wEnemyDamageTaken + 1 .got_damage_taken ld a, [wCurDamage + 1] ld b, a ld a, [de] add b ld [de], a dec de ld a, [wCurDamage] ld b, a ld a, [de] adc b ld [de], a ret nc ld a, $ff ld [de], a inc de ld [de], a ret GetFailureResultText: ld a, [wWonderGuardMiss] and a ld hl, WonderGuardMissText ld de, WonderGuardMissText jr nz, .got_text ld hl, DoesntAffectText ld de, DoesntAffectText ld a, [wTypeModifier] and $7f jr z, .got_text ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_FUTURE_SIGHT ld hl, ButItFailedText ld de, ItFailedText jr z, .got_text cp EFFECT_TRICK jr z, .got_text ld hl, AttackMissedText ld de, AttackMissed2Text ld a, [wCriticalHit] cp -1 jr nz, .got_text ld hl, UnaffectedText .got_text call FailText_CheckOpponentProtect xor a ld [wCriticalHit], a ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_JUMP_KICK ret nz ld a, [wTypeModifier] and $7f ret z ld hl, wCurDamage ld a, [hli] ld b, [hl] rept 3 srl a rr b endr ld [hl], b dec hl ld [hli], a or b jr nz, .do_at_least_1_damage inc a ld [hl], a .do_at_least_1_damage ld hl, CrashedText call StdBattleTextbox ld a, $1 ld [wKickCounter], a call LoadMoveAnim ld c, TRUE ldh a, [hBattleTurn] and a jp nz, DoEnemyDamage jp DoPlayerDamage FailText_CheckOpponentProtect: ld a, BATTLE_VARS_SUBSTATUS1_OPP call GetBattleVar bit SUBSTATUS_PROTECT, a jr z, .not_protected ld h, d ld l, e .not_protected jp StdBattleTextbox BattleCommand_bidefailtext: ld a, [wAttackMissed] and a ret z ld a, [wTypeModifier] and $7f jp z, PrintDoesntAffect jp PrintButItFailed BattleCommand_criticaltext: ; criticaltext ; Prints the message for critical hits or one-hit KOs. ; If there is no message to be printed, wait 20 frames. ld a, [wCriticalHit] and a jr z, .wait dec a add a ld hl, .texts ld b, 0 ld c, a add hl, bc ld a, [hli] ld h, [hl] ld l, a call StdBattleTextbox xor a ld [wCriticalHit], a .wait ld c, 20 jp DelayFrames .texts dw CriticalHitText dw OneHitKOText BattleCommand_startloop: ; startloop ld hl, wPlayerRolloutCount ldh a, [hBattleTurn] and a jr z, .ok ld hl, wEnemyRolloutCount .ok xor a ld [hl], a ret BattleCommand_supereffectivelooptext: ; supereffectivelooptext ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr bit SUBSTATUS_IN_LOOP, a ret nz ; fallthrough BattleCommand_supereffectivetext: ; supereffectivetext ld a, [wTypeModifier] and $7f cp 10 ; 1.0 ret z ld hl, SuperEffectiveText jr nc, .print ld hl, NotVeryEffectiveText .print jp StdBattleTextbox BattleCommand_checkfaint: ; checkfaint ; Faint the opponent if its HP reached zero ; and faint the user along with it if it used Destiny Bond. ; Ends the move effect if the opponent faints. ld hl, wEnemyMonHP ldh a, [hBattleTurn] and a jr z, .got_hp ld hl, wBattleMonHP .got_hp ld a, [hli] or [hl] ret nz ld a, BATTLE_VARS_SUBSTATUS5_OPP call GetBattleVar bit SUBSTATUS_DESTINY_BOND, a jr z, .no_dbond ld hl, TookDownWithItText call StdBattleTextbox ldh a, [hBattleTurn] and a ld hl, wEnemyMonMaxHP + 1 bccoord 2, 2 ; hp bar ld a, 0 jr nz, .got_max_hp ld hl, wBattleMonMaxHP + 1 bccoord 10, 9 ; hp bar ld a, 1 .got_max_hp ld [wWhichHPBar], a ld a, [hld] ld [wBuffer1], a ld a, [hld] ld [wBuffer2], a ld a, [hl] ld [wBuffer3], a xor a ld [hld], a ld a, [hl] ld [wBuffer4], a xor a ld [hl], a ld [wBuffer5], a ld [wBuffer6], a ld h, b ld l, c predef AnimateHPBar call RefreshBattleHuds call BattleCommand_switchturn xor a ld [wNumHits], a inc a ld [wKickCounter], a ld hl, DESTINY_BOND call GetMoveIDFromIndex call LoadAnim call BattleCommand_switchturn jr .finish .no_dbond ld a, BATTLE_VARS_SUBSTATUS2_OPP call GetBattleVar bit SUBSTATUS_GRUDGE, a jr z, .no_grudge farcall DoGrudgeEffect jr .finish .no_grudge ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_MULTI_HIT jr z, .multiple_hit_raise_sub cp EFFECT_DOUBLE_HIT jr z, .multiple_hit_raise_sub cp EFFECT_POISON_MULTI_HIT jr z, .multiple_hit_raise_sub cp EFFECT_TRIPLE_KICK jr z, .multiple_hit_raise_sub cp EFFECT_BEAT_UP jr nz, .finish .multiple_hit_raise_sub call BattleCommand_raisesub .finish jp EndMoveEffect BattleCommand_buildopponentrage: ; buildopponentrage jp .start .start ld a, [wAttackMissed] and a ret nz ld a, BATTLE_VARS_SUBSTATUS4_OPP call GetBattleVar bit SUBSTATUS_RAGE, a ret z ld de, wEnemyRageCounter ldh a, [hBattleTurn] and a jr z, .player ld de, wPlayerRageCounter .player ld a, [de] inc a ret z ld [de], a call BattleCommand_switchturn ld hl, RageBuildingText call StdBattleTextbox jp BattleCommand_switchturn BattleCommand_ragedamage: ; ragedamage ld a, [wCurDamage] ld h, a ld b, a ld a, [wCurDamage + 1] ld l, a ld c, a ldh a, [hBattleTurn] and a ld a, [wPlayerRageCounter] jr z, .rage_loop ld a, [wEnemyRageCounter] .rage_loop and a jr z, .done dec a add hl, bc jr nc, .rage_loop ld hl, $ffff .done ld a, h ld [wCurDamage], a ld a, l ld [wCurDamage + 1], a ret EndMoveEffect: ld a, [wBattleScriptBufferAddress] ld l, a ld a, [wBattleScriptBufferAddress + 1] ld h, a ld a, $ff ld [hli], a ld [hli], a ld [hl], a ret CheckCharge: and TYPE_MASK cp ELECTRIC ret nz ld a, d add a ld d, a ret nc ld d, 255 ret DittoMetalPowder: ld a, MON_SPECIES call BattlePartyAttr ldh a, [hBattleTurn] and a ld a, [hl] jr nz, .Ditto ld a, [wTempEnemyMonSpecies] .Ditto: push hl call GetPokemonIndexFromID ld a, l sub LOW(DITTO) if HIGH(DITTO) == 0 or h pop hl else ld a, h pop hl ret nz if HIGH(DITTO) == 1 dec a else cp HIGH(DITTO) endc endc ret nz push bc call GetOpponentItem ld a, [hl] cp METAL_POWDER pop bc ret nz ld a, c srl a add c ld c, a ret nc srl b ld a, b and a jr nz, .done inc b .done scf rr c ret BattleCommand_damagestats: ; damagestats ldh a, [hBattleTurn] and a jp nz, EnemyAttackDamage ; fallthrough PlayerAttackDamage: ; Return move power d, player level e, enemy defense c and player attack b. call ResetDamage ld hl, wPlayerMoveStructPower ld a, [hli] and a ld d, a ret z ld a, [hl] cp SPECIAL jr nc, .special .physical ld hl, wEnemyMonDefense ld a, [hli] ld b, a ld c, [hl] ld a, [wEnemyScreens] bit SCREENS_REFLECT, a jr z, .physicalcrit sla c rl b .physicalcrit ld hl, wBattleMonAttack call CheckDamageStatsCritical jr c, .thickclub ld hl, wEnemyDefense ld a, [hli] ld b, a ld c, [hl] ld hl, wPlayerAttack jr .thickclub .special ld hl, wEnemyMonSpclDef ld a, [hli] ld b, a ld c, [hl] ld hl, wEnemyMonType call TrySandstormSpDefBoost ld a, [wEnemyScreens] bit SCREENS_LIGHT_SCREEN, a jr z, .specialcrit sla c rl b .specialcrit ld hl, wBattleMonSpclAtk call CheckDamageStatsCritical jr c, .lightball ld hl, wEnemySpDef ld a, [hli] ld b, a ld c, [hl] ld hl, wEnemyMonType call TrySandstormSpDefBoost ld hl, wPlayerSpAtk .lightball ; Note: Returns player special attack at hl in hl. call SpecialSpeciesItemBoost jr .done .thickclub ; Note: Returns player attack at hl in hl. call ThickClubBoost .done call TruncateHL_BC ld a, [wBattleMonLevel] ld e, a call DittoMetalPowder ld a, [wPlayerChargeFlag] and a ld a, [wPlayerMoveStructType] call nz, CheckCharge farcall CheckSports ld a, 1 and a ret TrySandstormSpDefBoost: ; multiply bc by 1.5 if rock type and sandstorm ld a, [wBattleWeather] cp WEATHER_SANDSTORM ret nz ld a, [hli] cp ROCK jr z, .sandstorm_boost ld a, [hl] cp ROCK ret nz .sandstorm_boost ld h, b ld l, c rrc h rr l add hl, bc ld b, h ld c, l ret TruncateHL_BC: .loop ; Truncate 16-bit values hl and bc to 8-bit values b and c respectively. ; b = hl, c = bc ld a, h or b jr z, .finish srl b rr c srl b rr c ld a, c or b jr nz, .done_bc inc c .done_bc srl h rr l srl h rr l ld a, l or h jr nz, .finish inc l .finish ld a, [wLinkMode] cp LINK_COLOSSEUM jr z, .done ; If we go back to the loop point, ; it's the same as doing this exact ; same check twice. ld a, h or b jr nz, .loop .done ld b, l ret CheckDamageStatsCritical: ; Return carry if boosted stats should be used in damage calculations. ; Unboosted stats should be used if the attack is a critical hit, ; and the stage of the opponent's defense is higher than the user's attack. ld a, [wCriticalHit] and a scf ret z push hl push bc ldh a, [hBattleTurn] and a jr nz, .enemy ld a, [wPlayerMoveStructType] cp SPECIAL ; special ld a, [wPlayerSAtkLevel] ld b, a ld a, [wEnemySDefLevel] jr nc, .end ; physical ld a, [wPlayerAtkLevel] ld b, a ld a, [wEnemyDefLevel] jr .end .enemy ld a, [wEnemyMoveStructType] cp SPECIAL ; special ld a, [wEnemySAtkLevel] ld b, a ld a, [wPlayerSDefLevel] jr nc, .end ; physical ld a, [wEnemyAtkLevel] ld b, a ld a, [wPlayerDefLevel] .end cp b pop bc pop hl ret ThickClubBoost: ; Return in hl the stat value at hl. ; If the attacking monster is Cubone or Marowak and ; it's holding a Thick Club, double it. push bc push de ld bc, CUBONE ld d, THICK_CLUB call SpeciesItemBoost if MAROWAK == (CUBONE + 1) inc bc else ld bc, MAROWAK endc call DoubleStatIfSpeciesHoldingItem pop de pop bc ret SpecialSpeciesItemBoost: ; Return in hl the stat value at hl. ; If the attacking monster is Pikachu and it's ; holding a Light Ball, double it. push bc push de ld bc, PIKACHU ld d, LIGHT_BALL call SpeciesItemBoost ld bc, CLAMPERL ld d, DEEPSEATOOTH call DoubleStatIfSpeciesHoldingItem ld bc, CLAMPERL ld d, DEEPSEASCALE call HalveStatIfSpeciesHoldingItem pop de pop bc ret SpeciesItemBoost: ; Return in hl the stat value at hl. ; If the attacking monster is species bc and ; it's holding item d, double it. ld a, [hli] ld l, [hl] ld h, a ; fallthrough DoubleStatIfSpeciesHoldingItem: ; If the attacking monster is species bc and ; it's holding item d, double the stat in hl. call StatChangeItemCheck ret nz push hl call GetUserItem ld a, [hl] pop hl cp d ret nz ; Double the stat sla l rl h ret HalveStatIfSpeciesHoldingItem: ; If the defending monster is species bc and ; it's holding item d, halve the stat in hl. call StatChangeItemCheck ret nz push hl call GetOpponentItem ld a, [hl] pop hl cp d ret nz ; Halve the stat rrc h rr l ret StatChangeItemCheck: push hl ld a, MON_SPECIES call BattlePartyAttr ldh a, [hBattleTurn] and a ld a, [hl] jr nz, .CompareSpecies ld a, [wTempEnemyMonSpecies] .CompareSpecies: call GetPokemonIndexFromID ld a, h cp b ld a, l pop hl ret nz cp c ret EnemyAttackDamage: call ResetDamage ; No damage dealt with 0 power. ld hl, wEnemyMoveStructPower ld a, [hli] ; hl = wEnemyMoveStructType ld d, a and a ret z ld a, [hl] cp SPECIAL jr nc, .Special .physical ld hl, wBattleMonDefense ld a, [hli] ld b, a ld c, [hl] ld a, [wPlayerScreens] bit SCREENS_REFLECT, a jr z, .physicalcrit sla c rl b .physicalcrit ld hl, wEnemyMonAttack call CheckDamageStatsCritical jr c, .thickclub ld hl, wPlayerDefense ld a, [hli] ld b, a ld c, [hl] ld hl, wEnemyAttack jr .thickclub .Special: ld hl, wBattleMonSpclDef ld a, [hli] ld b, a ld c, [hl] ld hl, wBattleMonType call TrySandstormSpDefBoost ld a, [wPlayerScreens] bit SCREENS_LIGHT_SCREEN, a jr z, .specialcrit sla c rl b .specialcrit ld hl, wEnemyMonSpclAtk call CheckDamageStatsCritical jr c, .lightball ld hl, wPlayerSpDef ld a, [hli] ld b, a ld c, [hl] ld hl, wBattleMonType call TrySandstormSpDefBoost ld hl, wEnemySpAtk .lightball call SpecialSpeciesItemBoost jr .done .thickclub call ThickClubBoost .done call TruncateHL_BC ld a, [wEnemyMonLevel] ld e, a call DittoMetalPowder ld a, [wEnemyChargeFlag] and a ld a, [wEnemyMoveStructType] call nz, CheckCharge farcall CheckSports ld a, 1 and a ret INCLUDE "engine/battle/move_effects/beat_up.asm" HitSelfInConfusion: call ResetDamage ldh a, [hBattleTurn] and a ld hl, wBattleMonDefense ld de, wPlayerScreens ld a, [wBattleMonLevel] jr z, .got_it ld hl, wEnemyMonDefense ld de, wEnemyScreens ld a, [wEnemyMonLevel] .got_it push af ld a, [hli] ld b, a ld c, [hl] ld a, [de] bit SCREENS_REFLECT, a jr z, .mimic_screen sla c rl b .mimic_screen dec hl dec hl dec hl ld a, [hli] ld l, [hl] ld h, a call TruncateHL_BC ld d, 40 pop af ld e, a ret BattleCommand_damagecalc: ; damagecalc ; Return a damage value for move power d, player level e, enemy defense c and player attack b. ; Return 1 if successful, else 0. ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar ; Selfdestruct and Explosion halve defense. cp EFFECT_SELFDESTRUCT jr nz, .dont_selfdestruct farcall SelfdestructDefenseMultiplier jr .skip_me_first .dont_selfdestruct farcall MeFirstDamageMultiplier .skip_me_first ; Variable-hit moves and Conversion can have a power of 0. cp EFFECT_MULTI_HIT jr z, .skip_zero_damage_check cp EFFECT_CONVERSION jr z, .skip_zero_damage_check ; No damage if move power is 0. ld a, d and a ret z .skip_zero_damage_check ; Minimum defense value is 1. ld a, c and a jr nz, .not_dividing_by_zero ld c, 1 .not_dividing_by_zero xor a ld hl, hDividend ld [hli], a ld [hli], a ld [hl], a ; Level * 2 ld a, e add a jr nc, .level_not_overflowing ld [hl], 1 .level_not_overflowing inc hl ld [hli], a ; / 5 ld a, 5 ld [hld], a push bc ld b, 4 call Divide pop bc ; + 2 inc [hl] inc [hl] ; * bp inc hl ld [hl], d call Multiply ; * Attack ld [hl], b call Multiply ; / Defense ld [hl], c ld b, 4 call Divide ; / 50 ld [hl], 50 ld b, $4 call Divide ; Item boosts call GetUserItem ld a, b and a jr z, .DoneItem ld hl, TypeBoostItems .NextItem: ld a, [hli] cp -1 jr z, .DoneItem ; Item effect cp b ld a, [hli] jr nz, .NextItem ; Type ld b, a call GetCurrentMoveType2 cp b jr nz, .DoneItem ; * 100 + item effect amount ld a, c add 100 ldh [hMultiplier], a call Multiply ; / 100 ld a, 100 ldh [hDivisor], a ld b, 4 call Divide .DoneItem: ; Critical hits call .CriticalMultiplier ; Update wCurDamage (capped at 997). ld hl, wCurDamage ld b, [hl] ldh a, [hProduct + 3] add b ldh [hProduct + 3], a jr nc, .dont_cap_1 ldh a, [hProduct + 2] inc a ldh [hProduct + 2], a and a jr z, .Cap .dont_cap_1 ldh a, [hProduct] ld b, a ldh a, [hProduct + 1] or a jr nz, .Cap ldh a, [hProduct + 2] cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1) jr c, .dont_cap_2 cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1) + 1 jr nc, .Cap ldh a, [hProduct + 3] cp LOW(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1) jr nc, .Cap .dont_cap_2 inc hl ldh a, [hProduct + 3] ld b, [hl] add b ld [hld], a ldh a, [hProduct + 2] ld b, [hl] adc b ld [hl], a jr c, .Cap ld a, [hl] cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1) jr c, .dont_cap_3 cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1) + 1 jr nc, .Cap inc hl ld a, [hld] cp LOW(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1) jr c, .dont_cap_3 .Cap: ld a, HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE) ld [hli], a ld a, LOW(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE) ld [hld], a .dont_cap_3 ; Minimum neutral damage is 2 (bringing the cap to 999). inc hl ld a, [hl] add MIN_NEUTRAL_DAMAGE ld [hld], a jr nc, .dont_floor inc [hl] .dont_floor ld a, 1 and a ret .CriticalMultiplier: ld a, [wCriticalHit] and a ret z ; x2 ldh a, [hQuotient + 3] add a ldh [hProduct + 3], a ldh a, [hQuotient + 2] rl a ldh [hProduct + 2], a ; Cap at $ffff. ret nc ld a, $ff ldh [hProduct + 2], a ldh [hProduct + 3], a ret INCLUDE "data/types/type_boost_items.asm" BattleCommand_constantdamage: ; constantdamage ld hl, wBattleMonLevel ldh a, [hBattleTurn] and a jr z, .got_turn ld hl, wEnemyMonLevel .got_turn ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_LEVEL_DAMAGE ld b, [hl] ld a, 0 jr z, .got_power ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_PSYWAVE jr z, .psywave cp EFFECT_SUPER_FANG jr z, .super_fang cp EFFECT_REVERSAL jr z, .reversal ld a, BATTLE_VARS_MOVE_POWER call GetBattleVar ld b, a ld a, $0 jr .got_power .psywave ld a, b srl a add b ld b, a .psywave_loop call BattleRandom and a jr z, .psywave_loop cp b jr nc, .psywave_loop ld b, a ld a, 0 jr .got_power .super_fang ld hl, wEnemyMonHP ldh a, [hBattleTurn] and a jr z, .got_hp ld hl, wBattleMonHP .got_hp ld a, [hli] srl a ld b, a ld a, [hl] rr a push af ld a, b pop bc and a jr nz, .got_power or b ld a, 0 jr nz, .got_power ld b, 1 jr .got_power .got_power ld hl, wCurDamage ld [hli], a ld [hl], b ret .reversal ld hl, wBattleMonHP ldh a, [hBattleTurn] and a jr z, .reversal_got_hp ld hl, wEnemyMonHP .reversal_got_hp xor a ldh [hDividend], a ldh [hMultiplicand + 0], a ld a, [hli] ldh [hMultiplicand + 1], a ld a, [hli] ldh [hMultiplicand + 2], a ld a, 48 ldh [hMultiplier], a call Multiply ld a, [hli] ld b, a ld a, [hl] ldh [hDivisor], a ld a, b and a jr z, .skip_to_divide ldh a, [hProduct + 4] srl b rr a srl b rr a ldh [hDivisor], a ldh a, [hProduct + 2] ld b, a srl b ldh a, [hProduct + 3] rr a srl b rr a ldh [hDividend + 3], a ld a, b ldh [hDividend + 2], a .skip_to_divide ld b, 4 call Divide ldh a, [hQuotient + 3] ld b, a ld hl, FlailReversalPower .reversal_loop ld a, [hli] cp b jr nc, .break_loop inc hl jr .reversal_loop .break_loop ldh a, [hBattleTurn] and a ld a, [hl] jr nz, .notPlayersTurn ld hl, wPlayerMoveStructPower ld [hl], a push hl call PlayerAttackDamage jr .notEnemysTurn .notPlayersTurn ld hl, wEnemyMoveStructPower ld [hl], a push hl call EnemyAttackDamage .notEnemysTurn call BattleCommand_damagecalc pop hl ld [hl], 1 ret INCLUDE "data/moves/flail_reversal_power.asm" INCLUDE "engine/battle/move_effects/counter.asm" INCLUDE "engine/battle/move_effects/encore.asm" INCLUDE "engine/battle/move_effects/pain_split.asm" INCLUDE "engine/battle/move_effects/snore.asm" INCLUDE "engine/battle/move_effects/conversion2.asm" INCLUDE "engine/battle/move_effects/lock_on.asm" INCLUDE "engine/battle/move_effects/sketch.asm" ;BattleCommand_defrostopponent: ;; defrostopponent ;; Thaw the opponent if frozen, and ;; raise the user's Attack one stage. ; ; call AnimateCurrentMove ; ; ld a, BATTLE_VARS_STATUS_OPP ; call GetBattleVarAddr ; call Defrost ; ; ld a, BATTLE_VARS_MOVE_EFFECT ; call GetBattleVarAddr ; ld a, [hl] ; push hl ; push af ; ; ld a, EFFECT_ATTACK_UP ; ld [hl], a ; call BattleCommand_statup ; ; pop af ; pop hl ; ld [hl], a ; ret INCLUDE "engine/battle/move_effects/sleep_talk.asm" INCLUDE "engine/battle/move_effects/destiny_bond.asm" INCLUDE "engine/battle/move_effects/spite.asm" INCLUDE "engine/battle/move_effects/false_swipe.asm" INCLUDE "engine/battle/move_effects/heal_bell.asm" FarPlayBattleAnimation: ; play animation de ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVar and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND ret nz call GetUserUnderwaterAddr ld a, [hl] and a ret nz ; fallthrough PlayFXAnimID: ld a, e ld [wFXAnimID], a ld a, d ld [wFXAnimID + 1], a PlaySelectedFXAnim: ld c, 3 call DelayFrames callfar PlayBattleAnim ret DoEnemyDamage: ld hl, wCurDamage ld a, [hli] ld b, a ld a, [hl] or b jr z, .did_no_damage ld a, c and a jr nz, .ignore_substitute ld a, [wEnemySubStatus4] bit SUBSTATUS_SUBSTITUTE, a jp nz, DoSubstituteDamage .ignore_substitute ; Substract wCurDamage from wEnemyMonHP. ; store original HP in little endian wBuffer3/4 ld a, [hld] ld b, a ld a, [wEnemyMonHP + 1] ld [wBuffer3], a sub b ld [wEnemyMonHP + 1], a ld a, [hl] ld b, a ld a, [wEnemyMonHP] ld [wBuffer4], a sbc b ld [wEnemyMonHP], a jr nc, .no_underflow ld a, [wBuffer4] ld [hli], a ld a, [wBuffer3] ld [hl], a xor a ld hl, wEnemyMonHP ld [hli], a ld [hl], a .no_underflow ld hl, wEnemyMonMaxHP ld a, [hli] ld [wBuffer2], a ld a, [hl] ld [wBuffer1], a ld hl, wEnemyMonHP ld a, [hli] ld [wBuffer6], a ld a, [hl] ld [wBuffer5], a hlcoord 2, 2 xor a ld [wWhichHPBar], a predef AnimateHPBar .did_no_damage jp RefreshBattleHuds DoPlayerDamage: ld hl, wCurDamage ld a, [hli] ld b, a ld a, [hl] or b jr z, .did_no_damage ld a, c and a jr nz, .ignore_substitute ld a, [wPlayerSubStatus4] bit SUBSTATUS_SUBSTITUTE, a jp nz, DoSubstituteDamage .ignore_substitute ; Substract wCurDamage from wBattleMonHP. ; store original HP in little endian wBuffer3/4 ; store new HP in little endian wBuffer5/6 ld a, [hld] ld b, a ld a, [wBattleMonHP + 1] ld [wBuffer3], a sub b ld [wBattleMonHP + 1], a ld [wBuffer5], a ld b, [hl] ld a, [wBattleMonHP] ld [wBuffer4], a sbc b ld [wBattleMonHP], a ld [wBuffer6], a jr nc, .no_underflow ld a, [wBuffer4] ld [hli], a ld a, [wBuffer3] ld [hl], a xor a ld hl, wBattleMonHP ld [hli], a ld [hl], a ld hl, wBuffer5 ld [hli], a ld [hl], a .no_underflow ld hl, wBattleMonMaxHP ld a, [hli] ld [wBuffer2], a ld a, [hl] ld [wBuffer1], a hlcoord 10, 9 ld a, 1 ld [wWhichHPBar], a predef AnimateHPBar .did_no_damage jp RefreshBattleHuds DoSubstituteDamage: ld hl, SubTookDamageText call StdBattleTextbox ld de, wEnemySubstituteHP ldh a, [hBattleTurn] and a jr z, .got_hp ld de, wPlayerSubstituteHP .got_hp ld hl, wCurDamage ld a, [hli] and a jr nz, .broke ld a, [de] sub [hl] ld [de], a jr z, .broke jr nc, .done .broke ld a, BATTLE_VARS_SUBSTATUS4_OPP call GetBattleVarAddr res SUBSTATUS_SUBSTITUTE, [hl] ld hl, SubFadedText call StdBattleTextbox call BattleCommand_switchturn call BattleCommand_lowersubnoanim ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVar and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND jr nz, .no_appear call GetUserUnderwaterAddr ld a, [hl] and a jr nz, .no_appear call AppearUserLowerSub .no_appear call BattleCommand_switchturn ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVarAddr cp EFFECT_MULTI_HIT jr z, .ok cp EFFECT_DOUBLE_HIT jr z, .ok cp EFFECT_POISON_MULTI_HIT jr z, .ok cp EFFECT_TRIPLE_KICK jr z, .ok cp EFFECT_BEAT_UP jr z, .ok xor a ld [hl], a .ok call RefreshBattleHuds .done jp ResetDamage UpdateMoveData: ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVarAddr ld d, h ld e, l ld a, BATTLE_VARS_MOVE call GetBattleVar ld [wCurSpecies], a ld [wNamedObjectIndexBuffer], a call GetMoveData call GetMoveName jp CopyName1 BattleCommand_sleeptarget: ; sleeptarget call GetOpponentItem ld a, b cp HELD_PREVENT_SLEEP jr nz, .not_protected_by_item ld a, [hl] ld [wNamedObjectIndexBuffer], a call GetItemName ld hl, ProtectedByText jr .fail .not_protected_by_item ld a, [wPlayerSubStatus6] bit SUBSTATUS_UPROAR, a jr nz, .fail ld a, [wEnemySubStatus6] bit SUBSTATUS_UPROAR, a jr nz, .fail ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarAddr ld d, h ld e, l ld a, [de] and SLP ld hl, AlreadyAsleepText jr nz, .fail ld a, [wAttackMissed] and a jp nz, PrintDidntAffect2 ld hl, DidntAffect1Text call .CheckAIRandomFail jr c, .fail ld a, [de] and a jr nz, .fail call CheckSubstituteOpp jr nz, .fail call AnimateCurrentMove jp SetSleep .fail push hl call AnimateFailedMove pop hl jp StdBattleTextbox .CheckAIRandomFail: ; Enemy turn ldh a, [hBattleTurn] and a jr z, .dont_fail ; Not in link battle ld a, [wLinkMode] and a jr nz, .dont_fail ld a, [wInBattleTowerBattle] and a jr nz, .dont_fail ; Not locked-on by the enemy ld a, [wPlayerSubStatus5] bit SUBSTATUS_LOCK_ON, a jr nz, .dont_fail call BattleRandom cp 25 percent + 1 ; 25% chance AI fails ret c .dont_fail xor a ret SetSleep: ; sets de to a valid sleep count ld b, $7 ld a, [wInBattleTowerBattle] and a jr z, .random_loop ld b, $3 .random_loop call BattleRandom and b jr z, .random_loop cp 7 jr z, .random_loop inc a ld [de], a call UpdateOpponentInParty call RefreshBattleHuds ld hl, FellAsleepText call StdBattleTextbox farcall UseHeldStatusHealingItem jp z, OpponentCantMove ret BattleCommand_poisontarget: ; poisontarget call CheckSubstituteOpp ret nz ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarAddr and a ret nz ld a, [wTypeModifier] and $7f ret z call CheckIfTargetIsPoisonType ret z call GetOpponentItem ld a, b cp HELD_PREVENT_POISON ret z ld a, [wEffectFailed] and a ret nz call SafeCheckSafeguard ret nz call CheckToxic jr z, .toxic call .apply_poison ld hl, WasPoisonedText call StdBattleTextbox jr .finished .toxic set SUBSTATUS_TOXIC, [hl] xor a ld [de], a call .apply_poison ld hl, BadlyPoisonedText call StdBattleTextbox .finished farcall UseHeldStatusHealingItem ret .apply_poison call PoisonOpponent ld de, ANIM_PSN call PlayOpponentBattleAnim call RefreshBattleHuds ret BattleCommand_poison: ; poison ld hl, DoesntAffectText ld a, [wTypeModifier] and $7f jp z, .failed call CheckIfTargetIsPoisonType jp z, .failed ld a, BATTLE_VARS_STATUS_OPP call GetBattleVar ld b, a ld hl, AlreadyPoisonedText and 1 << PSN jp nz, .failed call GetOpponentItem ld a, b cp HELD_PREVENT_POISON jr nz, .do_poison ld a, [hl] ld [wNamedObjectIndexBuffer], a call GetItemName ld hl, ProtectedByText jr .failed .do_poison ld hl, DidntAffect1Text ld a, BATTLE_VARS_STATUS_OPP call GetBattleVar and a jr nz, .failed ldh a, [hBattleTurn] and a jr z, .dont_sample_failure ld a, [wLinkMode] and a jr nz, .dont_sample_failure ld a, [wInBattleTowerBattle] and a jr nz, .dont_sample_failure ld a, [wPlayerSubStatus5] bit SUBSTATUS_LOCK_ON, a jr nz, .dont_sample_failure call BattleRandom cp 25 percent + 1 ; 25% chance AI fails jr c, .failed .dont_sample_failure call CheckSubstituteOpp jr nz, .failed ld a, [wAttackMissed] and a jr nz, .failed call CheckToxic jr z, .toxic call .apply_poison ld hl, WasPoisonedText call StdBattleTextbox jr .finished .toxic set SUBSTATUS_TOXIC, [hl] xor a ld [de], a call .apply_poison ld hl, BadlyPoisonedText call StdBattleTextbox .finished farcall UseHeldStatusHealingItem ret .failed push hl call AnimateFailedMove pop hl jp StdBattleTextbox .apply_poison call AnimateCurrentMove call PoisonOpponent jp RefreshBattleHuds CheckToxic: ld a, BATTLE_VARS_SUBSTATUS5_OPP call GetBattleVarAddr ldh a, [hBattleTurn] and a ld de, wEnemyToxicCount jr z, .ok ld de, wPlayerToxicCount .ok ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_TOXIC ret z cp EFFECT_POISON_FANG ret CheckIfTargetIsPoisonType: ld b, POISON CheckIfTargetIsType: ; checks if target is type b ld de, wEnemyMonType1 ldh a, [hBattleTurn] and a jr z, .ok ld de, wBattleMonType1 .ok ld a, [de] inc de cp b ret z ld a, [de] cp b ret PoisonOpponent: ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarAddr set PSN, [hl] jp UpdateOpponentInParty BattleCommand_draintarget: ; draintarget call SapHealth ld hl, SuckedHealthText jp StdBattleTextbox BattleCommand_eatdream: ; eatdream call SapHealth ld hl, DreamEatenText jp StdBattleTextbox SapHealth: ; Divide damage by 2, store it in hDividend ld hl, wCurDamage ld a, [hli] srl a ldh [hDividend], a ld b, a ld a, [hl] rr a ldh [hDividend + 1], a or b jr nz, .at_least_one ld a, 1 ldh [hDividend + 1], a .at_least_one ld hl, wBattleMonHP ld de, wBattleMonMaxHP ldh a, [hBattleTurn] and a jr z, .battlemonhp ld hl, wEnemyMonHP ld de, wEnemyMonMaxHP .battlemonhp ; Store current HP in little endian wBuffer3/4 ld bc, wBuffer4 ld a, [hli] ld [bc], a ld a, [hl] dec bc ld [bc], a ; Store max HP in little endian wBuffer1/2 ld a, [de] dec bc ld [bc], a inc de ld a, [de] dec bc ld [bc], a ; Add hDividend to current HP and copy it to little endian wBuffer5/6 ldh a, [hDividend + 1] ld b, [hl] add b ld [hld], a ld [wBuffer5], a ldh a, [hDividend] ld b, [hl] adc b ld [hli], a ld [wBuffer6], a jr c, .max_hp ; Substract current HP from max HP (to see if we have more than max HP) ld a, [hld] ld b, a ld a, [de] dec de sub b ld a, [hli] ld b, a ld a, [de] inc de sbc b jr nc, .finish .max_hp ; Load max HP into current HP and copy it to little endian wBuffer5/6 ld a, [de] ld [hld], a ld [wBuffer5], a dec de ld a, [de] ld [hli], a ld [wBuffer6], a inc de .finish ldh a, [hBattleTurn] and a hlcoord 10, 9 ld a, $1 jr z, .hp_bar hlcoord 2, 2 xor a .hp_bar ld [wWhichHPBar], a predef AnimateHPBar call RefreshBattleHuds jp UpdateBattleMonInParty BattleCommand_burntarget: ; burntarget xor a ld [wNumHits], a call CheckSubstituteOpp ret nz ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarAddr and a jp nz, Defrost ld a, [wTypeModifier] and $7f ret z farcall CheckIfTargetIsFireType ; Don't burn a Fire-type ret z call GetOpponentItem ld a, b cp HELD_PREVENT_BURN ret z ld a, [wEffectFailed] and a ret nz call SafeCheckSafeguard ret nz ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarAddr set BRN, [hl] call UpdateOpponentInParty ld hl, ApplyBrnEffectOnAttack call CallBattleCore ld de, ANIM_BRN call PlayOpponentBattleAnim call RefreshBattleHuds ld hl, WasBurnedText call StdBattleTextbox farcall UseHeldStatusHealingItem ret Defrost: ld a, [hl] and 1 << FRZ ret z xor a ld [hl], a ldh a, [hBattleTurn] and a ld a, [wCurOTMon] ld hl, wOTPartyMon1Status jr z, .ok ld hl, wPartyMon1Status ld a, [wCurBattleMon] .ok call GetPartyLocation xor a ld [hl], a call UpdateOpponentInParty ld hl, DefrostedOpponentText jp StdBattleTextbox BattleCommand_freezetarget: ; freezetarget xor a ld [wNumHits], a call CheckSubstituteOpp ret nz ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarAddr and a ret nz ld a, [wTypeModifier] and $7f ret z ld a, [wBattleWeather] cp WEATHER_SUN ret z farcall CheckIfTargetIsIceType ; Don't freeze an Ice-type ret z call GetOpponentItem ld a, b cp HELD_PREVENT_FREEZE ret z ld a, [wEffectFailed] and a ret nz call SafeCheckSafeguard ret nz ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarAddr set FRZ, [hl] call UpdateOpponentInParty ld de, ANIM_FRZ call PlayOpponentBattleAnim call RefreshBattleHuds ld hl, WasFrozenText call StdBattleTextbox farcall UseHeldStatusHealingItem ret nz call OpponentCantMove call EndRechargeOpp ld hl, wEnemyJustGotFrozen ldh a, [hBattleTurn] and a jr z, .finish ld hl, wPlayerJustGotFrozen .finish ld [hl], $1 ; handle Shaymin Sky Forme revert ldh a, [hBattleTurn] and a ld hl, wBattleMonSpecies ld de, wPartySpecies jr nz, .got_species ld hl, wEnemyMonSpecies ld de, wOTPartySpecies .got_species ld a, [hl] push hl call GetPokemonIndexFromID pop bc ld a, h cp HIGH(SHAYMIN_S) ret nz ld a, l cp LOW(SHAYMIN_S) ret nz ld hl, SHAYMIN call GetPokemonIDFromIndex ld [wCurPartySpecies], a ld [bc], a ; set Battle/Enemy Mon Species push af ldh a, [hBattleTurn] and a ld a, [wCurBattleMon] jr nz, .got_cur_mon ld a, [wCurOTMon] .got_cur_mon ld h, 0 ld l, a add hl, de pop af ld [hl], a ; set Party/OT Species push af ld a, MON_SPECIES call OpponentPartyAttr pop af ld [hl], a ; set wParty/OT Mon Species ld [wCurSpecies], a call GetBaseData ; for CalcMonStats ldh a, [hBattleTurn] and a jr nz, .get_battlemon_stat_addrs ld a, [wEnemyMonLevel] ld [wCurPartyLevel], a ld de, wEnemyMonMaxHP push de ld a, MON_MAXHP call OTPartyAttr ld d, h ld e, l ld a, MON_STAT_EXP - 1 call OTPartyAttr jr .recalc_stats .get_battlemon_stat_addrs ld a, [wBattleMonLevel] ld [wCurPartyLevel], a ld de, wBattleMonMaxHP push de ld a, MON_MAXHP call BattlePartyAttr ld d, h ld e, l ld a, MON_STAT_EXP - 1 call BattlePartyAttr .recalc_stats ld b, 1 ; use stat EXP predef CalcMonStats pop de predef CalcMonStats ; play animation call BattleCommand_switchturn call _CheckBattleScene jr c, .mimic_anims xor a ld [wNumHits], a ld hl, ANIM_REFRESH_SPRITE call GetMoveIDFromIndex call LoadAnim jr .after_anim .mimic_anims call BattleCommand_movedelay call BattleCommand_raisesubnoanim .after_anim ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVarAddr bit SUBSTATUS_SUBSTITUTE, [hl] jr z, .no_sub ld hl, SUBSTITUTE call GetMoveIDFromIndex call LoadAnim .no_sub call BattleCommand_switchturn ; textbox ld hl, RevertedFormText jp StdBattleTextbox BattleCommand_paralyzetarget: ; paralyzetarget xor a ld [wNumHits], a call CheckSubstituteOpp ret nz ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarAddr and a ret nz ld a, [wTypeModifier] and $7f ret z call GetOpponentItem ld a, b cp HELD_PREVENT_PARALYZE ret z ld a, [wEffectFailed] and a ret nz call SafeCheckSafeguard ret nz ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarAddr set PAR, [hl] call UpdateOpponentInParty ld hl, ApplyPrzEffectOnSpeed call CallBattleCore ld de, ANIM_PAR call PlayOpponentBattleAnim call RefreshBattleHuds call PrintParalyze ld hl, UseHeldStatusHealingItem jp CallBattleCore ;BattleCommand_attackup: ;; attackup ; ld b, ATTACK ; jr BattleCommand_statup ; ;BattleCommand_defenseup: ;; defenseup ; ld b, DEFENSE ; jr BattleCommand_statup ; ;BattleCommand_speedup: ;; speedup ; ld b, SPEED ; jr BattleCommand_statup ; ;BattleCommand_specialattackup: ;; specialattackup ; ld b, SP_ATTACK ; jr BattleCommand_statup ; ;BattleCommand_specialdefenseup: ;; specialdefenseup ; ld b, SP_DEFENSE ; jr BattleCommand_statup ; ;BattleCommand_accuracyup: ;; accuracyup ; ld b, ACCURACY ; jr BattleCommand_statup ; ;BattleCommand_evasionup: ;; evasionup ; ld b, EVASION ; jr BattleCommand_statup ; ;BattleCommand_attackup2: ;; attackup2 ; ld b, $10 | ATTACK ; jr BattleCommand_statup ; ;BattleCommand_defenseup2: ;; defenseup2 ; ld b, $10 | DEFENSE ; jr BattleCommand_statup ; ;BattleCommand_speedup2: ;; speedup2 ; ld b, $10 | SPEED ; jr BattleCommand_statup ; ;BattleCommand_specialattackup2: ;; specialattackup2 ; ld b, $10 | SP_ATTACK ; jr BattleCommand_statup ; ;BattleCommand_specialdefenseup2: ;; specialdefenseup2 ; ld b, $10 | SP_DEFENSE ; jr BattleCommand_statup ; ;BattleCommand_accuracyup2: ;; accuracyup2 ; ld b, $10 | ACCURACY ; jr BattleCommand_statup ; ;BattleCommand_evasionup2: ;; evasionup2 ; ld b, $10 | EVASION ; jr BattleCommand_statup ; ;BattleCommand_statup: ;; statup ; call RaiseStat ; ld a, [wFailedMessage] ; and a ; ret nz ; jp MinimizeDropSub ; ;RaiseStat: ; ld a, b ; ld [wLoweredStat], a ; ld hl, wPlayerStatLevels ; ldh a, [hBattleTurn] ; and a ; jr z, .got_stat_levels ; ld hl, wEnemyStatLevels ;.got_stat_levels ; ld a, [wAttackMissed] ; and a ; jp nz, .stat_raise_failed ; ld a, [wEffectFailed] ; and a ; jp nz, .stat_raise_failed ; ld a, [wLoweredStat] ; and $f ; ld c, a ; ld b, 0 ; add hl, bc ; ld b, [hl] ; inc b ; ld a, $d ; cp b ; jp c, .cant_raise_stat ; ld a, [wLoweredStat] ; and $f0 ; jr z, .got_num_stages ; inc b ; ld a, $d ; cp b ; jr nc, .got_num_stages ; ld b, a ;.got_num_stages ; ld [hl], b ; push hl ; ld a, c ; cp $5 ; jr nc, .done_calcing_stats ; ld hl, wBattleMonStats + 1 ; ld de, wPlayerStats ; ldh a, [hBattleTurn] ; and a ; jr z, .got_stats_pointer ; ld hl, wEnemyMonStats + 1 ; ld de, wEnemyStats ;.got_stats_pointer ; push bc ; sla c ; ld b, 0 ; add hl, bc ; ld a, c ; add e ; ld e, a ; jr nc, .no_carry ; inc d ;.no_carry ; pop bc ; ld a, [hld] ; sub LOW(MAX_STAT_VALUE) ; jr nz, .not_already_max ; ld a, [hl] ; sbc HIGH(MAX_STAT_VALUE) ; jp z, .stats_already_max ;.not_already_max ; ldh a, [hBattleTurn] ; and a ; jr z, .calc_player_stats ; call CalcEnemyStats ; jr .done_calcing_stats ; ;.calc_player_stats ; call CalcPlayerStats ;.done_calcing_stats ; pop hl ; xor a ; ld [wFailedMessage], a ; ret ; ;.stats_already_max ; pop hl ; dec [hl] ; ; fallthrough ; ;.cant_raise_stat ; ld a, $2 ; ld [wFailedMessage], a ; ld a, $1 ; ld [wAttackMissed], a ; ret ; ;.stat_raise_failed ; ld a, $1 ; ld [wFailedMessage], a ; ret MinimizeDropSub: ; Lower the substitute if we're minimizing ld de, wPlayerMinimized ld hl, DropPlayerSub ldh a, [hBattleTurn] and a jr z, .do_player ld de, wEnemyMinimized ld hl, DropEnemySub .do_player ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar ld bc, MINIMIZE call CompareMove ret nz ld a, $1 ld [de], a call _CheckBattleScene ret nc xor a ldh [hBGMapMode], a call CallBattleCore call WaitBGMap jp BattleCommand_movedelay ;BattleCommand_attackdown: ;; attackdown ; ld a, ATTACK ; jr BattleCommand_statdown ; ;BattleCommand_defensedown: ;; defensedown ; ld a, DEFENSE ; jr BattleCommand_statdown ; ;BattleCommand_speeddown: ;; speeddown ; ld a, SPEED ; jr BattleCommand_statdown ; ;BattleCommand_specialattackdown: ;; specialattackdown ; ld a, SP_ATTACK ; jr BattleCommand_statdown ; ;BattleCommand_specialdefensedown: ;; specialdefensedown ; ld a, SP_DEFENSE ; jr BattleCommand_statdown ; ;BattleCommand_accuracydown: ;; accuracydown ; ld a, ACCURACY ; jr BattleCommand_statdown ; ;BattleCommand_evasiondown: ;; evasiondown ; ld a, EVASION ; jr BattleCommand_statdown ; ;BattleCommand_attackdown2: ;; attackdown2 ; ld a, $10 | ATTACK ; jr BattleCommand_statdown ; ;BattleCommand_defensedown2: ;; defensedown2 ; ld a, $10 | DEFENSE ; jr BattleCommand_statdown ; ;BattleCommand_speeddown2: ;; speeddown2 ; ld a, $10 | SPEED ; jr BattleCommand_statdown ; ;BattleCommand_specialattackdown2: ;; specialattackdown2 ; ld a, $10 | SP_ATTACK ; jr BattleCommand_statdown ; ;BattleCommand_specialdefensedown2: ;; specialdefensedown2 ; ld a, $10 | SP_DEFENSE ; jr BattleCommand_statdown ; ;BattleCommand_accuracydown2: ;; accuracydown2 ; ld a, $10 | ACCURACY ; jr BattleCommand_statdown ; ;BattleCommand_evasiondown2: ;; evasiondown2 ; ld a, $10 | EVASION ; ;BattleCommand_statdown: ;; statdown ; ; ld [wLoweredStat], a ; ; call CheckMist ; jp nz, .Mist ; ; ld hl, wEnemyStatLevels ; ldh a, [hBattleTurn] ; and a ; jr z, .GetStatLevel ; ld hl, wPlayerStatLevels ; ;.GetStatLevel: ;; Attempt to lower the stat. ; ld a, [wLoweredStat] ; and $f ; ld c, a ; ld b, 0 ; add hl, bc ; ld b, [hl] ; dec b ; jp z, .CantLower ; ;; Sharply lower the stat if applicable. ; ld a, [wLoweredStat] ; and $f0 ; jr z, .ComputerMiss ; dec b ; jr nz, .ComputerMiss ; inc b ; ;.ComputerMiss: ;; Computer opponents have a 25% chance of failing. ; ldh a, [hBattleTurn] ; and a ; jr z, .DidntMiss ; ; ld a, [wLinkMode] ; and a ; jr nz, .DidntMiss ; ; ld a, [wInBattleTowerBattle] ; and a ; jr nz, .DidntMiss ; ;; Lock-On still always works. ; ld a, [wPlayerSubStatus5] ; bit SUBSTATUS_LOCK_ON, a ; jr nz, .DidntMiss ; ;; Attacking moves that also lower accuracy are unaffected. ; ld a, BATTLE_VARS_MOVE_EFFECT ; call GetBattleVar ; cp EFFECT_ACCURACY_DOWN_HIT ; jr z, .DidntMiss ; ; call BattleRandom ; cp 25 percent + 1 ; 25% chance AI fails ; jr c, .Failed ; ;.DidntMiss: ; call CheckSubstituteOpp ; jr nz, .Failed ; ; ld a, [wAttackMissed] ; and a ; jr nz, .Failed ; ; ld a, [wEffectFailed] ; and a ; jr nz, .Failed ; ; call CheckHiddenOpponent ; jr nz, .Failed ; ;; Accuracy/Evasion reduction don't involve stats. ; ld [hl], b ; ld a, c ; cp ACCURACY ; jr nc, .Hit ; ; push hl ; ld hl, wEnemyMonAttack + 1 ; ld de, wEnemyStats ; ldh a, [hBattleTurn] ; and a ; jr z, .do_enemy ; ld hl, wBattleMonAttack + 1 ; ld de, wPlayerStats ;.do_enemy ; call TryLowerStat ; pop hl ; jr z, .CouldntLower ; ;.Hit: ; xor a ; ld [wFailedMessage], a ; ret ; ;.CouldntLower: ; inc [hl] ;.CantLower: ; ld a, 3 ; ld [wFailedMessage], a ; ld a, 1 ; ld [wAttackMissed], a ; ret ; ;.Failed: ; ld a, 1 ; ld [wFailedMessage], a ; ld [wAttackMissed], a ; ret ; ;.Mist: ; ld a, 2 ; ld [wFailedMessage], a ; ld a, 1 ; ld [wAttackMissed], a ; ret ; ;CheckMist: ; ld a, BATTLE_VARS_MOVE_EFFECT ; call GetBattleVar ; cp EFFECT_ATTACK_DOWN ; jr c, .dont_check_mist ; cp EFFECT_EVASION_DOWN + 1 ; jr c, .check_mist ; cp EFFECT_ATTACK_DOWN_2 ; jr c, .dont_check_mist ; cp EFFECT_EVASION_DOWN_2 + 1 ; jr c, .check_mist ; cp EFFECT_ATTACK_DOWN_HIT ; jr c, .dont_check_mist ; ;cp EFFECT_EVASION_DOWN_HIT + 1 ; ;jr c, .check_mist ;.dont_check_mist ; xor a ; ret ; ;.check_mist ; ld a, BATTLE_VARS_SUBSTATUS4_OPP ; call GetBattleVar ; bit SUBSTATUS_MIST, a ; ret ; ;BattleCommand_statupmessage: ; ld a, [wFailedMessage] ; and a ; ret nz ; ld a, [wLoweredStat] ; and $f ; ld b, a ; inc b ; call GetStatName ; ld hl, .stat ; jp BattleTextbox ; ;.stat ; text_far UnknownText_0x1c0cc6 ; text_asm ; ld hl, .up ; ld a, [wLoweredStat] ; and $f0 ; ret z ; ld hl, .wayup ; ret ; ;.wayup ; text_far UnknownText_0x1c0cd0 ; text_end ; ;.up ; text_far UnknownText_0x1c0ce0 ; text_end ; ;BattleCommand_statdownmessage: ; ld a, [wFailedMessage] ; and a ; ret nz ; ld a, [wLoweredStat] ; and $f ; ld b, a ; inc b ; call GetStatName ; ld hl, .stat ; jp BattleTextbox ; ;.stat ; text_far UnknownText_0x1c0ceb ; text_asm ; ld hl, .fell ; ld a, [wLoweredStat] ; and $f0 ; ret z ; ld hl, .sharplyfell ; ret ; ;.sharplyfell ; text_far UnknownText_0x1c0cf5 ; text_end ; ;.fell ; text_far UnknownText_0x1c0d06 ; text_end ; ;TryLowerStat: ;; Lower stat c from stat struct hl (buffer de). ; ; push bc ; sla c ; ld b, 0 ; add hl, bc ; ; add de, c ; ld a, c ; add e ; ld e, a ; jr nc, .no_carry ; inc d ;.no_carry ; pop bc ; ;; The lowest possible stat is 1. ; ld a, [hld] ; sub 1 ; jr nz, .not_min ; ld a, [hl] ; and a ; ret z ; ;.not_min ; ldh a, [hBattleTurn] ; and a ; jr z, .Player ; ; call BattleCommand_switchturn ; call CalcPlayerStats ; call BattleCommand_switchturn ; jr .end ; ;.Player: ; call BattleCommand_switchturn ; call CalcEnemyStats ; call BattleCommand_switchturn ;.end ; ld a, 1 ; and a ; ret ; ;BattleCommand_statupfailtext: ;; statupfailtext ; ld a, [wFailedMessage] ; and a ; ret z ; push af ; call BattleCommand_movedelay ; pop af ; dec a ; jp z, TryPrintButItFailed ; ld a, [wLoweredStat] ; and $f ; ld b, a ; inc b ; call GetStatName ; ld hl, WontRiseAnymoreText ; jp StdBattleTextbox ; ;BattleCommand_statdownfailtext: ;; statdownfailtext ; ld a, [wFailedMessage] ; and a ; ret z ; push af ; call BattleCommand_movedelay ; pop af ; dec a ; jp z, TryPrintButItFailed ; dec a ; ld hl, ProtectedByMistText ; jp z, StdBattleTextbox ; ld a, [wLoweredStat] ; and $f ; ld b, a ; inc b ; call GetStatName ; ld hl, WontDropAnymoreText ; jp StdBattleTextbox ; ;GetStatName: ; ld hl, StatNames ; ld c, "@" ;.CheckName: ; dec b ; jr z, .Copy ;.GetName: ; ld a, [hli] ; cp c ; jr z, .CheckName ; jr .GetName ; ;.Copy: ; ld de, wStringBuffer2 ; ld bc, wStringBuffer3 - wStringBuffer2 ; jp CopyBytes ; ;INCLUDE "data/battle/stat_names.asm" ; INCLUDE "data/battle/stat_multipliers.asm" ; ;BattleCommand_allstatsup: ;; allstatsup ; ;; Attack ; call ResetMiss ; call BattleCommand_attackup ; call BattleCommand_statupmessage ; ;; Defense ; call ResetMiss ; call BattleCommand_defenseup ; call BattleCommand_statupmessage ; ;; Speed ; call ResetMiss ; call BattleCommand_speedup ; call BattleCommand_statupmessage ; ;; Special Attack ; call ResetMiss ; call BattleCommand_specialattackup ; call BattleCommand_statupmessage ; ;; Special Defense ; call ResetMiss ; call BattleCommand_specialdefenseup ; jp BattleCommand_statupmessage ; ;ResetMiss: ; xor a ; ld [wAttackMissed], a ; ret ; ;LowerStat: ; ld [wLoweredStat], a ; ; ld hl, wPlayerStatLevels ; ldh a, [hBattleTurn] ; and a ; jr z, .got_target ; ld hl, wEnemyStatLevels ; ;.got_target ; ld a, [wLoweredStat] ; and $f ; ld c, a ; ld b, 0 ; add hl, bc ; ld b, [hl] ; dec b ; jr z, .cant_lower_anymore ; ; ld a, [wLoweredStat] ; and $f0 ; jr z, .got_num_stages ; dec b ; jr nz, .got_num_stages ; inc b ; ;.got_num_stages ; ld [hl], b ; ld a, c ; cp 5 ; jr nc, .accuracy_evasion ; ; push hl ; ld hl, wBattleMonStats + 1 ; ld de, wPlayerStats ; ldh a, [hBattleTurn] ; and a ; jr z, .got_target_2 ; ld hl, wEnemyMonStats + 1 ; ld de, wEnemyStats ; ;.got_target_2 ; call TryLowerStat ; pop hl ; jr z, .failed ; ;.accuracy_evasion ; ldh a, [hBattleTurn] ; and a ; jr z, .player ; ; call CalcEnemyStats ; ; jr .finish ; ;.player ; call CalcPlayerStats ; ;.finish ; xor a ; ld [wFailedMessage], a ; ret ; ;.failed ; inc [hl] ; ;.cant_lower_anymore ; ld a, 2 ; ld [wFailedMessage], a ; ret BattleCommand_raisestat: ld b, -1 RaiseStat: xor a _RaiseStat: or STAT_MISS | STAT_SILENT jr ChangeStat BattleCommand_lowerstat: ld b, -1 LowerStat: xor a _LowerStat: or STAT_LOWER | STAT_MISS | STAT_SILENT jr ChangeStat BattleCommand_forceraisestat: ld b, -1 ForceRaiseStat: xor a _ForceRaiseStat: ; or 0 jr ChangeStat BattleCommand_forcelowerstat: ld b, -1 ForceLowerStat: xor a _ForceLowerStat: or STAT_LOWER jr ChangeStat BattleCommand_raisestathit: ld b, -1 RaiseStatHit: xor a _RaiseStatHit: or STAT_MISS | STAT_SECONDARY | STAT_SILENT jr ChangeStat BattleCommand_lowerstathit: ld b, -1 LowerStatHit: xor a _LowerStatHit: or STAT_LOWER | STAT_MISS | STAT_SECONDARY | STAT_SILENT jr ChangeStat BattleCommand_forceraiseoppstat: ld b, -1 ForceRaiseOppStat: xor a _ForceRaiseOppStat: or STAT_TARGET jr ChangeStat BattleCommand_forceloweroppstat: ld b, -1 ForceLowerOppStat: xor a _ForceLowerOppStat: or STAT_TARGET | STAT_LOWER jr ChangeStat BattleCommand_raiseoppstat: ld b, -1 RaiseOppStat: xor a _RaiseOppStat: or STAT_TARGET | STAT_MISS jr ChangeStat BattleCommand_loweroppstat: ld b, -1 LowerOppStat: xor a _LowerOppStat: or STAT_TARGET | STAT_LOWER | STAT_MISS jr ChangeStat BattleCommand_raiseoppstathit: ld b, -1 RaiseOppStatHit: xor a _RaiseOppStatHit: or STAT_TARGET | STAT_MISS | STAT_SECONDARY | STAT_SILENT jr ChangeStat BattleCommand_loweroppstathit: ld b, -1 LowerOppStatHit: xor a _LowerOppStatHit: or STAT_TARGET | STAT_LOWER | STAT_MISS | STAT_SECONDARY | STAT_SILENT ChangeStat: farcall2 FarChangeStat ret BattleCommand_tristatuschance: ; tristatuschance farcall BattleCommand_effectchance .loop ; 1/3 chance of each status call BattleRandom swap a and %11 jr z, .loop dec a ld hl, .ptrs rst JumpTable ret .ptrs dw BattleCommand_paralyzetarget ; paralyze dw BattleCommand_freezetarget ; freeze dw BattleCommand_burntarget ; burn BattleCommand_raisesubnoanim: ld hl, GetBattleMonBackpic ldh a, [hBattleTurn] and a jr z, .PlayerTurn ld hl, GetEnemyMonFrontpic .PlayerTurn: xor a ldh [hBGMapMode], a call CallBattleCore jp WaitBGMap BattleCommand_lowersubnoanim: ld hl, DropPlayerSub ldh a, [hBattleTurn] and a jr z, .PlayerTurn ld hl, DropEnemySub .PlayerTurn: xor a ldh [hBGMapMode], a call CallBattleCore jp WaitBGMap CalcPlayerStats: ld hl, wPlayerAtkLevel ld de, wPlayerStats ld bc, wBattleMonAttack ld a, 5 call CalcBattleStats ld hl, BadgeStatBoosts call CallBattleCoreAlt call BattleCommand_switchturn ld hl, ApplyPrzEffectOnSpeed call CallBattleCore ld hl, ApplyBrnEffectOnAttack call CallBattleCore farcall ApplySlowStartEffectOnPlayerStats farcall ApplyPowerTrick jp BattleCommand_switchturn CalcEnemyStats: ld hl, wEnemyAtkLevel ld de, wEnemyStats ld bc, wEnemyMonAttack ld a, 5 call CalcBattleStats call BattleCommand_switchturn ld hl, ApplyPrzEffectOnSpeed call CallBattleCore ld hl, ApplyBrnEffectOnAttack call CallBattleCore farcall ApplySlowStartEffectOnEnemyStats farcall ApplyPowerTrick jp BattleCommand_switchturn CalcBattleStats: .loop push af ld a, [hli] push hl push bc ld c, a dec c ld b, 0 ld hl, StatLevelMultipliers add hl, bc add hl, bc xor a ldh [hMultiplicand + 0], a ld a, [de] ldh [hMultiplicand + 1], a inc de ld a, [de] ldh [hMultiplicand + 2], a inc de ld a, [hli] ldh [hMultiplier], a call Multiply ld a, [hl] ldh [hDivisor], a ld b, 4 call Divide ldh a, [hQuotient + 2] ld b, a ldh a, [hQuotient + 3] or b jr nz, .check_maxed_out ld a, 1 ldh [hQuotient + 3], a jr .not_maxed_out .check_maxed_out ldh a, [hQuotient + 3] cp LOW(MAX_STAT_VALUE) ld a, b sbc HIGH(MAX_STAT_VALUE) jr c, .not_maxed_out ld a, LOW(MAX_STAT_VALUE) ldh [hQuotient + 3], a ld a, HIGH(MAX_STAT_VALUE) ldh [hQuotient + 2], a .not_maxed_out pop bc ldh a, [hQuotient + 2] ld [bc], a inc bc ldh a, [hQuotient + 3] ld [bc], a inc bc pop hl pop af dec a jr nz, .loop ret INCLUDE "engine/battle/move_effects/bide.asm" BattleCommand_checkrampage: ; checkrampage ld de, wPlayerRolloutCount ldh a, [hBattleTurn] and a jr z, .player ld de, wEnemyRolloutCount .player ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr bit SUBSTATUS_RAMPAGE, [hl] ret z ld a, [de] dec a ld [de], a jr nz, .continue_rampage res SUBSTATUS_RAMPAGE, [hl] call BattleCommand_switchturn call SafeCheckSafeguard push af call BattleCommand_switchturn pop af jr nz, .continue_rampage set SUBSTATUS_CONFUSED, [hl] call BattleRandom and %00000001 inc a inc a inc de ; ConfuseCount ld [de], a .continue_rampage ld b, rampage_command jp SkipToBattleCommand BattleCommand_rampage: ; rampage ; No rampage during Sleep Talk. ld a, BATTLE_VARS_STATUS call GetBattleVar and SLP ret nz ld de, wPlayerRolloutCount ldh a, [hBattleTurn] and a jr z, .ok ld de, wEnemyRolloutCount .ok ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr set SUBSTATUS_RAMPAGE, [hl] ; Rampage for 1 or 2 more turns call BattleRandom and %00000001 inc a ld [de], a ld a, 1 ld [wSomeoneIsRampaging], a ret INCLUDE "engine/battle/move_effects/teleport.asm" SetBattleDraw: ld a, [wBattleResult] and BATTLERESULT_BITMASK or DRAW ld [wBattleResult], a ret BattleCommand_forceswitch: ; forceswitch ld a, [wBattleType] cp BATTLETYPE_SHINY jp z, .fail cp BATTLETYPE_TRAP jp z, .fail cp BATTLETYPE_CELEBI jp z, .fail cp BATTLETYPE_SUICUNE jp z, .fail ldh a, [hBattleTurn] and a jp nz, .force_player_switch ld a, [wAttackMissed] and a jr nz, .missed ld a, [wBattleMode] dec a jr nz, .trainer ld a, [wCurPartyLevel] ld b, a ld a, [wBattleMonLevel] cp b jr nc, .wild_force_flee add b ld c, a inc c .random_loop_wild call BattleRandom cp c jr nc, .random_loop_wild srl b srl b cp b jr nc, .wild_force_flee .missed jp .fail .wild_force_flee call UpdateBattleMonInParty xor a ld [wNumHits], a inc a ld [wForcedSwitch], a call SetBattleDraw ld a, [wPlayerMoveStructAnimation] jp .succeed .trainer call FindAliveEnemyMons jr c, .switch_fail ld a, [wEnemySubStatus4] bit SUBSTATUS_INGRAIN, a jr nz, .switch_fail ld a, [wEnemyGoesFirst] and a jr z, .switch_fail call UpdateEnemyMonInParty ld a, $1 ld [wKickCounter], a call AnimateCurrentMove ld c, $14 call DelayFrames hlcoord 1, 0 lb bc, 4, 10 call ClearBox ld c, 20 call DelayFrames ld a, [wOTPartyCount] ld b, a ld a, [wCurOTMon] ld c, a ; select a random enemy mon to switch to .random_loop_trainer call BattleRandom and $7 cp b jr nc, .random_loop_trainer cp c jr z, .random_loop_trainer push af push bc ld hl, wOTPartyMon1HP call GetPartyLocation ld a, [hli] or [hl] pop bc pop de jr z, .random_loop_trainer ld a, d inc a ld [wEnemySwitchMonIndex], a callfar ForceEnemySwitch ld hl, DraggedOutText call StdBattleTextbox ld hl, DoEntryHazards jp CallBattleCore .switch_fail jp .fail .force_player_switch ld a, [wAttackMissed] and a jr nz, .player_miss ld a, [wBattleMode] dec a jr nz, .vs_trainer ld a, [wBattleMonLevel] ld b, a ld a, [wCurPartyLevel] cp b jr nc, .wild_succeed_playeristarget add b ld c, a inc c .wild_random_loop_playeristarget call BattleRandom cp c jr nc, .wild_random_loop_playeristarget srl b srl b cp b jr nc, .wild_succeed_playeristarget .player_miss jr .fail .wild_succeed_playeristarget call UpdateBattleMonInParty xor a ld [wNumHits], a inc a ld [wForcedSwitch], a call SetBattleDraw ld a, [wEnemyMoveStructAnimation] jr .succeed .vs_trainer call CheckPlayerHasMonToSwitchTo jr c, .fail ld a, [wPlayerSubStatus4] bit SUBSTATUS_INGRAIN, a jr nz, .fail ld a, [wEnemyGoesFirst] cp $1 jr z, .switch_fail call UpdateBattleMonInParty ld a, $1 ld [wKickCounter], a call AnimateCurrentMove ld c, 20 call DelayFrames hlcoord 9, 7 lb bc, 5, 11 call ClearBox ld c, 20 call DelayFrames ld a, [wPartyCount] ld b, a ld a, [wCurBattleMon] ld c, a .random_loop_trainer_playeristarget call BattleRandom and $7 cp b jr nc, .random_loop_trainer_playeristarget cp c jr z, .random_loop_trainer_playeristarget push af push bc ld hl, wPartyMon1HP call GetPartyLocation ld a, [hli] or [hl] pop bc pop de jr z, .random_loop_trainer_playeristarget ld a, d ld [wCurPartyMon], a ld hl, SwitchPlayerMon call CallBattleCore ld hl, DraggedOutText call StdBattleTextbox ld hl, DoEntryHazards jp CallBattleCore .fail call BattleCommand_lowersub call BattleCommand_movedelay call BattleCommand_raisesub jp PrintButItFailed .succeed push af call SetBattleDraw ld a, $1 ld [wKickCounter], a call AnimateCurrentMove ld c, 20 call DelayFrames pop af ld hl, FledInFearText ld bc, ROAR call CompareMove jr z, .do_text ld hl, BlownAwayText .do_text jp StdBattleTextbox CheckPlayerHasMonToSwitchTo: ld a, [wPartyCount] ld d, a ld e, 0 ld bc, PARTYMON_STRUCT_LENGTH .loop ld a, [wCurBattleMon] cp e jr z, .next ld a, e ld hl, wPartyMon1HP call AddNTimes ld a, [hli] or [hl] jr nz, .not_fainted .next inc e dec d jr nz, .loop scf ret .not_fainted and a ret BattleCommand_endloop: ; endloop ; Loop back to 'critical'. ld de, wPlayerRolloutCount ld bc, wPlayerDamageTaken ldh a, [hBattleTurn] and a jr z, .got_addrs ld de, wEnemyRolloutCount ld bc, wEnemyDamageTaken .got_addrs ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr bit SUBSTATUS_IN_LOOP, [hl] jp nz, .in_loop set SUBSTATUS_IN_LOOP, [hl] ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVarAddr ld a, [hl] cp EFFECT_POISON_MULTI_HIT jr z, .twineedle cp EFFECT_DOUBLE_HIT ld a, 1 jr z, .double_hit ld a, [hl] cp EFFECT_BEAT_UP jr z, .beat_up cp EFFECT_TRIPLE_KICK jr nz, .not_triple_kick .reject_triple_kick_sample call BattleRandom and $3 jr z, .reject_triple_kick_sample dec a jr nz, .double_hit ld a, 1 ld [bc], a jr .done_loop .beat_up ldh a, [hBattleTurn] and a jr nz, .check_ot_beat_up ld a, [wPartyCount] cp 1 jp z, .only_one_beatup dec a jr .double_hit .check_ot_beat_up ld a, [wBattleMode] cp WILD_BATTLE jp z, .only_one_beatup ld a, [wOTPartyCount] cp 1 jp z, .only_one_beatup dec a jr .double_hit .only_one_beatup ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr res SUBSTATUS_IN_LOOP, [hl] call BattleCommand_beatupfailtext jp EndMoveEffect .not_triple_kick call BattleRandom and $3 cp 2 jr c, .got_number_hits call BattleRandom and $3 .got_number_hits inc a .double_hit ld [de], a inc a ld [bc], a jr .loop_back_to_critical .twineedle ld a, 1 jr .double_hit .in_loop ld a, [de] dec a ld [de], a jr nz, .loop_back_to_critical .done_loop ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr res SUBSTATUS_IN_LOOP, [hl] ld hl, PlayerHitTimesText ldh a, [hBattleTurn] and a jr z, .got_hit_n_times_text ld hl, EnemyHitTimesText .got_hit_n_times_text push bc ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_BEAT_UP jr z, .beat_up_2 call StdBattleTextbox .beat_up_2 pop bc xor a ld [bc], a ret .loop_back_to_critical ld a, [wBattleScriptBufferAddress + 1] ld h, a ld a, [wBattleScriptBufferAddress] ld l, a .not_critical ld a, [hld] cp critical_command jr nz, .not_critical inc hl ld a, h ld [wBattleScriptBufferAddress + 1], a ld a, l ld [wBattleScriptBufferAddress], a ret BattleCommand_fakeout: ld hl, wPlayerTurnsTaken ldh a, [hBattleTurn] and a jr z, .got_var dec hl .got_var ld a, [hl] cp 1 ret z call AnimateFailedMove call PrintButItFailed jp EndMoveEffect BattleCommand_flinchtarget: call CheckSubstituteOpp ret nz ld a, BATTLE_VARS_STATUS_OPP call GetBattleVar and 1 << FRZ | SLP ret nz call CheckOpponentWentFirst ret nz ld a, [wEffectFailed] and a ret nz ; fallthrough FlinchTarget: ld a, BATTLE_VARS_SUBSTATUS3_OPP call GetBattleVarAddr set SUBSTATUS_FLINCHED, [hl] jp EndRechargeOpp CheckOpponentWentFirst: ; Returns a=0, z if user went first ; Returns a=1, nz if opponent went first push bc ld a, [wEnemyGoesFirst] ; 0 if player went first ld b, a ldh a, [hBattleTurn] ; 0 if it's the player's turn xor b ; 1 if opponent went first pop bc ret BattleCommand_heldflinch: ; kingsrock ld a, [wAttackMissed] and a ret nz call GetUserItem ld a, b cp HELD_FLINCH ret nz call CheckSubstituteOpp ret nz ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVarAddr ld d, h ld e, l call GetUserItem call BattleRandom cp c ret nc call EndRechargeOpp ld a, BATTLE_VARS_SUBSTATUS3_OPP call GetBattleVarAddr set SUBSTATUS_FLINCHED, [hl] ret BattleCommand_ohko: ; ohko call ResetDamage ld a, [wTypeModifier] and $7f jr z, .no_effect ld hl, wEnemyMonLevel ld de, wBattleMonLevel ld bc, wPlayerMoveStruct + MOVE_ACC ldh a, [hBattleTurn] and a jr z, .got_move_accuracy push hl ld h, d ld l, e pop de ld bc, wEnemyMoveStruct + MOVE_ACC .got_move_accuracy ld a, [de] sub [hl] jr c, .no_effect add a ld e, a ld a, [bc] add e jr nc, .finish_ohko ld a, $ff .finish_ohko ld [bc], a call BattleCommand_checkhit ld hl, wCurDamage ld a, $ff ld [hli], a ld [hl], a ld a, $2 ld [wCriticalHit], a ret .no_effect ld a, $ff ld [wCriticalHit], a ld a, $1 ld [wAttackMissed], a ret BattleCommand_checkcharge: ; checkcharge ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr bit SUBSTATUS_CHARGED, [hl] ret z res SUBSTATUS_CHARGED, [hl] res SUBSTATUS_UNDERGROUND, [hl] res SUBSTATUS_FLYING, [hl] call GetUserUnderwaterAddr xor a ld [hl], a ld b, charge_command jp SkipToBattleCommand BattleCommand_charge: ; charge call BattleCommand_cleartext ld a, BATTLE_VARS_STATUS call GetBattleVar and SLP jr z, .awake call BattleCommand_movedelay call BattleCommand_raisesub call PrintButItFailed jp EndMoveEffect .awake ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr set SUBSTATUS_CHARGED, [hl] ld hl, IgnoredOrders2Text ld a, [wAlreadyDisobeyed] and a call nz, StdBattleTextbox call BattleCommand_lowersub xor a ld [wNumHits], a inc a ld [wKickCounter], a call LoadMoveAnim ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar ld h, a ld bc, FLY call CompareMove ld a, 1 << SUBSTATUS_FLYING jr z, .got_move_type ld bc, BOUNCE ld a, h call CompareMove ld a, 1 << SUBSTATUS_FLYING jr z, .got_move_type ld bc, DIG ld a, h call CompareMove ld a, 1 << SUBSTATUS_UNDERGROUND jr z, .got_move_type ld bc, DIVE ld a, h call CompareMove ld a, -1 jr z, .got_move_type ld bc, SHADOW_FORCE ld a, h call CompareMove ld a, -2 jr z, .got_move_type call BattleCommand_raisesub xor a .got_move_type ; a will contain the substatus 3 bit to set (1 << bit), or 0 if none (not flying/digging underground), or $ff is underwater (special case), or $fe is using shadow force (special case 2) cp -1 jr z, .underwater cp -2 jr z, .shadow_force and a ld l, a push hl call nz, DisappearUser jr .continue .shadow_force ld l, 0 push hl farcall SetShadowForce jr .continue .underwater ld l, 0 push hl farcall SetUnderwater .continue ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarAddr pop bc ld a, c or [hl] ld [hl], a call CheckUserIsCharging jr nz, .mimic ld a, BATTLE_VARS_LAST_COUNTER_MOVE call GetBattleVarAddr ld [hl], b ld a, BATTLE_VARS_LAST_MOVE call GetBattleVarAddr ld [hl], b .mimic call ResetDamage ld hl, .UsedText call BattleTextbox ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_SKULL_BASH ld b, endturn_command jp z, SkipToBattleCommand jp EndMoveEffect .UsedText: text_far UnknownText_0x1c0d0e ; "<USER>" text_asm ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar push bc call GetMoveIndexFromID ld b, h ld c, l ld de, 4 ld hl, .move_messages call IsInHalfwordArray ; hl will point to the low byte of the found item jr c, .found_text ld hl, .move_messages .found_text inc hl inc hl ld a, [hli] ld h, [hl] ld l, a pop bc ret .move_messages dw RAZOR_WIND, .RazorWind dw SOLARBEAM, .Solarbeam dw SKULL_BASH, .SkullBash dw SKY_ATTACK, .SkyAttack dw FLY, .Fly dw DIG, .Dig dw BOUNCE, .Bounce dw DIVE, .Dive dw SHADOW_FORCE, .ShadowForce dw -1 .RazorWind: ; 'made a whirlwind!' text_far UnknownText_0x1c0d12 text_end .Solarbeam: ; 'took in sunlight!' text_far UnknownText_0x1c0d26 text_end .SkullBash: ; 'lowered its head!' text_far UnknownText_0x1c0d3a text_end .SkyAttack: ; 'is glowing!' text_far UnknownText_0x1c0d4e text_end .Fly: ; 'flew up high!' text_far UnknownText_0x1c0d5c text_end .Dig: ; 'dug a hole!' text_far UnknownText_0x1c0d6c text_end .Bounce: ; 'sprang up!' text_far _SprangUpText text_end .Dive: text_far _HidUnderwaterText text_end .ShadowForce: text_far _ShadowForceText text_end INCLUDE "engine/battle/move_effects/mist.asm" INCLUDE "engine/battle/move_effects/focus_energy.asm" BattleCommand_recoil: ; recoil farcall2 ReadMoveScriptByte push af ld hl, wBattleMonMaxHP ldh a, [hBattleTurn] and a jr z, .got_hp ld hl, wEnemyMonMaxHP .got_hp ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar ld d, a pop af ; divide damage by parameter ldh [hDivisor], a xor a ldh [hDividend], a ldh [hDividend + 1], a ld a, [wCurDamage] ldh [hDividend + 2], a ld a, [wCurDamage + 1] ldh [hDividend + 3], a ld b, 4 call Divide ldh a, [hQuotient + 2] ld b, a ldh a, [hQuotient + 3] ld c, a ; if recoil damage is 0, set to 1 ld a, b or c jr nz, .min_damage inc c .min_damage ld a, [hli] ld [wBuffer2], a ld a, [hl] ld [wBuffer1], a dec hl dec hl ld a, [hl] ld [wBuffer3], a sub c ld [hld], a ld [wBuffer5], a ld a, [hl] ld [wBuffer4], a sbc b ld [hl], a ld [wBuffer6], a jr nc, .dont_ko xor a ld [hli], a ld [hl], a ld hl, wBuffer5 ld [hli], a ld [hl], a .dont_ko hlcoord 10, 9 ldh a, [hBattleTurn] and a ld a, 1 jr z, .animate_hp_bar hlcoord 2, 2 xor a .animate_hp_bar ld [wWhichHPBar], a predef AnimateHPBar call RefreshBattleHuds ld hl, RecoilText jp StdBattleTextbox BattleCommand_confusetarget: ; confusetarget call GetOpponentItem ld a, b cp HELD_PREVENT_CONFUSE ret z ld a, [wEffectFailed] and a ret nz call SafeCheckSafeguard ret nz call CheckSubstituteOpp ret nz ld a, BATTLE_VARS_SUBSTATUS3_OPP call GetBattleVarAddr bit SUBSTATUS_CONFUSED, [hl] ret nz jr BattleCommand_finishconfusingtarget BattleCommand_confuse: ; confuse call GetOpponentItem ld a, b cp HELD_PREVENT_CONFUSE jr nz, .no_item_protection ld a, [hl] ld [wNamedObjectIndexBuffer], a call GetItemName call AnimateFailedMove ld hl, ProtectedByText jp StdBattleTextbox .no_item_protection ld a, BATTLE_VARS_SUBSTATUS3_OPP call GetBattleVarAddr bit SUBSTATUS_CONFUSED, [hl] jr z, .not_already_confused call AnimateFailedMove ld hl, AlreadyConfusedText jp StdBattleTextbox .not_already_confused call CheckSubstituteOpp jr nz, BattleCommand_confuse_checksnore_swagger_confusehit ld a, [wAttackMissed] and a jr nz, BattleCommand_confuse_checksnore_swagger_confusehit BattleCommand_finishconfusingtarget: ld bc, wEnemyConfuseCount ldh a, [hBattleTurn] and a jr z, .got_confuse_count ld bc, wPlayerConfuseCount .got_confuse_count set SUBSTATUS_CONFUSED, [hl] ; confused for 2-5 turns call BattleRandom and %11 inc a inc a ld [bc], a ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_CONFUSE_HIT jr z, .got_effect cp EFFECT_SNORE jr z, .got_effect cp EFFECT_SWAGGER jr z, .got_effect cp EFFECT_FLATTER jr z, .got_effect call AnimateCurrentMove .got_effect ld de, ANIM_CONFUSED call PlayOpponentBattleAnim ld hl, BecameConfusedText call StdBattleTextbox call GetOpponentItem ld a, b cp HELD_HEAL_STATUS jr z, .heal_confusion cp HELD_HEAL_CONFUSION ret nz .heal_confusion ld hl, UseConfusionHealingItem jp CallBattleCore BattleCommand_confuse_checksnore_swagger_confusehit: ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_CONFUSE_HIT ret z cp EFFECT_SNORE ret z cp EFFECT_SWAGGER ret z cp EFFECT_FLATTER ret z jp PrintDidntAffect2 BattleCommand_paralyze: ; paralyze ld a, BATTLE_VARS_STATUS_OPP call GetBattleVar bit PAR, a jr nz, .paralyzed ld a, [wTypeModifier] and $7f jr z, .didnt_affect call GetOpponentItem ld a, b cp HELD_PREVENT_PARALYZE jr nz, .no_item_protection ld a, [hl] ld [wNamedObjectIndexBuffer], a call GetItemName call AnimateFailedMove ld hl, ProtectedByText jp StdBattleTextbox .no_item_protection ldh a, [hBattleTurn] and a jr z, .dont_sample_failure ld a, [wLinkMode] and a jr nz, .dont_sample_failure ld a, [wInBattleTowerBattle] and a jr nz, .dont_sample_failure ld a, [wPlayerSubStatus5] bit SUBSTATUS_LOCK_ON, a jr nz, .dont_sample_failure call BattleRandom cp 25 percent + 1 ; 25% chance AI fails jr c, .failed .dont_sample_failure ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarAddr and a jr nz, .failed ld a, [wAttackMissed] and a jr nz, .failed call CheckSubstituteOpp jr nz, .failed ld c, 30 call DelayFrames call AnimateCurrentMove ld a, $1 ldh [hBGMapMode], a ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarAddr set PAR, [hl] call UpdateOpponentInParty ld hl, ApplyPrzEffectOnSpeed call CallBattleCore call UpdateBattleHuds call PrintParalyze ld hl, UseHeldStatusHealingItem jp CallBattleCore .paralyzed call AnimateFailedMove ld hl, AlreadyParalyzedText jp StdBattleTextbox .failed jp PrintDidntAffect2 .didnt_affect call AnimateFailedMove jp PrintDoesntAffect CheckMoveTypeMatchesTarget: ; Compare move type to opponent type. ; Return z if matching the opponent type, ; unless the move is Normal (Tri Attack). push hl ld hl, wEnemyMonType1 ldh a, [hBattleTurn] and a jr z, .ok ld hl, wBattleMonType1 .ok call GetCurrentMoveType2 cp NORMAL jr z, .normal cp [hl] jr z, .return inc hl cp [hl] .return pop hl ret .normal ld a, 1 and a pop hl ret INCLUDE "engine/battle/move_effects/substitute.asm" BattleCommand_rechargenextturn: ; rechargenextturn ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVarAddr set SUBSTATUS_RECHARGE, [hl] ret EndRechargeOpp: push hl ld a, BATTLE_VARS_SUBSTATUS4_OPP call GetBattleVarAddr res SUBSTATUS_RECHARGE, [hl] pop hl ret INCLUDE "engine/battle/move_effects/rage.asm" BattleCommand_doubleflyingdamage: ; doubleflyingdamage ld a, BATTLE_VARS_SUBSTATUS3_OPP call GetBattleVar bit SUBSTATUS_FLYING, a ret z jr DoubleDamage BattleCommand_doubleunderwaterdamage: call GetOppUnderwaterAddr ld a, [hl] cp 1 ret nz jr DoubleDamage BattleCommand_doubleundergrounddamage: ; doubleundergrounddamage ld a, BATTLE_VARS_SUBSTATUS3_OPP call GetBattleVar bit SUBSTATUS_UNDERGROUND, a ret z ; fallthrough DoubleDamage: ld hl, wCurDamage + 1 sla [hl] dec hl rl [hl] jr nc, .quit ld a, $ff ld [hli], a ld [hl], a .quit ret INCLUDE "engine/battle/move_effects/mimic.asm" INCLUDE "engine/battle/move_effects/leech_seed.asm" INCLUDE "engine/battle/move_effects/splash.asm" INCLUDE "engine/battle/move_effects/disable.asm" INCLUDE "engine/battle/move_effects/pay_day.asm" INCLUDE "engine/battle/move_effects/conversion.asm" BattleCommand_resetstats: ; resetstats ld a, 7 ; neutral ld hl, wPlayerStatLevels call .Fill ld hl, wEnemyStatLevels call .Fill ldh a, [hBattleTurn] push af call SetPlayerTurn call CalcPlayerStats call SetEnemyTurn call CalcEnemyStats pop af ldh [hBattleTurn], a call AnimateCurrentMove ld hl, EliminatedStatsText jp StdBattleTextbox .Fill: ld b, wPlayerStatLevelsEnd - wPlayerStatLevels .next ld [hli], a dec b jr nz, .next ret BattleCommand_heal: ; heal ld de, wBattleMonHP ld hl, wBattleMonMaxHP ldh a, [hBattleTurn] and a jr z, .got_hp ld de, wEnemyMonHP ld hl, wEnemyMonMaxHP .got_hp ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar ld b, a push hl push de push bc ld c, 2 call CompareBytes pop bc pop de pop hl jp z, .hp_full ld a, b ld bc, ROOST call CompareMove jr nz, .not_roost ldh a, [hBattleTurn] and a ld bc, wPlayerRoost jr z, .roost_turn ld bc, wEnemyRoost .roost_turn ld a, 1 ld [bc], a .not_roost ld bc, REST call CompareMove jr nz, .not_rest push hl push de push af call BattleCommand_movedelay ld a, BATTLE_VARS_SUBSTATUS5 call GetBattleVarAddr res SUBSTATUS_TOXIC, [hl] ld a, BATTLE_VARS_STATUS call GetBattleVarAddr ld a, [hl] and a ld [hl], REST_SLEEP_TURNS + 1 ld hl, WentToSleepText jr z, .no_status_to_heal ld hl, RestedText .no_status_to_heal call StdBattleTextbox ldh a, [hBattleTurn] and a jr nz, .calc_enemy_stats call CalcPlayerStats jr .got_stats .calc_enemy_stats call CalcEnemyStats .got_stats pop af pop de pop hl .not_rest jr z, .restore_full_hp ld hl, GetHalfMaxHP call CallBattleCore jr .finish .restore_full_hp ld hl, GetMaxHP call CallBattleCore .finish call AnimateCurrentMove call BattleCommand_switchturn ld hl, RestoreHP call CallBattleCore call BattleCommand_switchturn call UpdateUserInParty call RefreshBattleHuds ld hl, RegainedHealthText jp StdBattleTextbox .hp_full call AnimateFailedMove ld hl, HPIsFullText jp StdBattleTextbox INCLUDE "engine/battle/move_effects/transform.asm" BattleEffect_ButItFailed: call AnimateFailedMove jp PrintButItFailed ClearLastMove: ld a, BATTLE_VARS_LAST_COUNTER_MOVE call GetBattleVarAddr xor a ld [hl], a ld a, BATTLE_VARS_LAST_MOVE call GetBattleVarAddr xor a ld [hl], a ret ResetActorDisable: ldh a, [hBattleTurn] and a jr z, .player xor a ld [wEnemyDisableCount], a ld [wEnemyDisabledMove], a ret .player xor a ld [wPlayerDisableCount], a ld [wDisabledMove], a ret BattleCommand_screen: ; screen ld hl, wPlayerScreens ld bc, wPlayerLightScreenCount ldh a, [hBattleTurn] and a jr z, .got_screens_pointer ld hl, wEnemyScreens ld bc, wEnemyLightScreenCount .got_screens_pointer ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_LIGHT_SCREEN jr nz, .Reflect bit SCREENS_LIGHT_SCREEN, [hl] jr nz, .failed set SCREENS_LIGHT_SCREEN, [hl] ld a, 5 ld [bc], a ld hl, LightScreenEffectText jr .good .Reflect: bit SCREENS_REFLECT, [hl] jr nz, .failed set SCREENS_REFLECT, [hl] ; LightScreenCount -> ReflectCount inc bc ld a, 5 ld [bc], a ld hl, ReflectEffectText .good call AnimateCurrentMove jp StdBattleTextbox .failed call AnimateFailedMove jp PrintButItFailed PrintDoesntAffect: ; 'it doesn't affect' ld hl, DoesntAffectText jp StdBattleTextbox PrintNothingHappened: ; 'but nothing happened!' ld hl, NothingHappenedText jp StdBattleTextbox TryPrintButItFailed: ld a, [wAlreadyFailed] and a ret nz ; fallthrough _PrintButItFailed: ; 'but it failed!' jp PrintButItFailed AnimateAndPrintFailedMove: call AnimateFailedMove jp PrintButItFailed FailMove: call AnimateFailedMove ; fallthrough FailMimic: ld hl, ButItFailedText ; 'but it failed!' ld de, ItFailedText ; 'it failed!' jp FailText_CheckOpponentProtect PrintDidntAffect: ; 'it didn't affect' ld hl, DidntAffect1Text jp StdBattleTextbox PrintDidntAffect2: call AnimateFailedMove ld hl, DidntAffect1Text ; 'it didn't affect' ld de, DidntAffect2Text ; 'it didn't affect' jp FailText_CheckOpponentProtect PrintParalyze: ; 'paralyzed! maybe it can't attack!' ld hl, ParalyzedText jp StdBattleTextbox CheckSubstituteOpp: ld a, BATTLE_VARS_SUBSTATUS4_OPP call GetBattleVar bit SUBSTATUS_SUBSTITUTE, a ret INCLUDE "engine/battle/move_effects/selfdestruct.asm" INCLUDE "engine/battle/move_effects/mirror_move.asm" INCLUDE "engine/battle/move_effects/metronome.asm" CheckUserMove: ; Return z if the user has move a. ld b, a ld de, wBattleMonMoves ldh a, [hBattleTurn] and a jr z, .ok ld de, wEnemyMonMoves .ok ld c, NUM_MOVES .loop ld a, [de] inc de cp b ret z dec c jr nz, .loop ld a, 1 and a ret ResetTurn: ld hl, wPlayerCharging ldh a, [hBattleTurn] and a jr z, .player ld hl, wEnemyCharging .player ld [hl], 1 xor a ld [wAlreadyDisobeyed], a call DoMove jp EndMoveEffect INCLUDE "engine/battle/move_effects/thief.asm" BattleCommand_arenatrap: ; arenatrap ; Doesn't work on an absent opponent. call CheckHiddenOpponent jr nz, .failed ; Don't trap if the opponent is already trapped. ld a, BATTLE_VARS_SUBSTATUS5 call GetBattleVarAddr bit SUBSTATUS_CANT_RUN, [hl] jr nz, .failed ; Otherwise trap the opponent. set SUBSTATUS_CANT_RUN, [hl] call AnimateCurrentMove ld hl, CantEscapeNowText jp StdBattleTextbox .failed call AnimateFailedMove jp PrintButItFailed INCLUDE "engine/battle/move_effects/nightmare.asm" BattleCommand_defrost: ; defrost ; Thaw the user. ld a, BATTLE_VARS_STATUS call GetBattleVarAddr bit FRZ, [hl] ret z res FRZ, [hl] ; Don't update the enemy's party struct in a wild battle. ldh a, [hBattleTurn] and a jr z, .party ld a, [wBattleMode] dec a jr z, .done .party ld a, MON_STATUS call UserPartyAttr res FRZ, [hl] .done call RefreshBattleHuds ld hl, WasDefrostedText jp StdBattleTextbox INCLUDE "engine/battle/move_effects/curse.asm" INCLUDE "engine/battle/move_effects/protect.asm" INCLUDE "engine/battle/move_effects/endure.asm" INCLUDE "engine/battle/move_effects/foresight.asm" INCLUDE "engine/battle/move_effects/perish_song.asm" INCLUDE "engine/battle/move_effects/rollout.asm" INCLUDE "engine/battle/move_effects/fury_cutter.asm" INCLUDE "engine/battle/move_effects/attract.asm" INCLUDE "engine/battle/move_effects/return.asm" INCLUDE "engine/battle/move_effects/present.asm" INCLUDE "engine/battle/move_effects/frustration.asm" INCLUDE "engine/battle/move_effects/safeguard.asm" SafeCheckSafeguard: push hl ld hl, wEnemyScreens ldh a, [hBattleTurn] and a jr z, .got_turn ld hl, wPlayerScreens .got_turn bit SCREENS_SAFEGUARD, [hl] pop hl ret BattleCommand_checksafeguard: ; checksafeguard ld hl, wEnemyScreens ldh a, [hBattleTurn] and a jr z, .got_turn ld hl, wPlayerScreens .got_turn bit SCREENS_SAFEGUARD, [hl] ret z ld a, 1 ld [wAttackMissed], a call BattleCommand_movedelay ld hl, SafeguardProtectText call StdBattleTextbox jp EndMoveEffect INCLUDE "engine/battle/move_effects/baton_pass.asm" INCLUDE "engine/battle/move_effects/pursuit.asm" INCLUDE "engine/battle/move_effects/rapid_spin.asm" BattleCommand_healmorn: ; healmorn ld b, MORN_F jr BattleCommand_timebasedhealcontinue BattleCommand_healday: ; healday ld b, DAY_F jr BattleCommand_timebasedhealcontinue BattleCommand_healnite: ; healnite ld b, NITE_F ; fallthrough BattleCommand_timebasedhealcontinue: ; Time- and weather-sensitive heal. ld hl, wBattleMonMaxHP ld de, wBattleMonHP ldh a, [hBattleTurn] and a jr z, .start ld hl, wEnemyMonMaxHP ld de, wEnemyMonHP .start ; Index for .Multipliers ; Default restores half max HP. ld c, 2 ; Don't bother healing if HP is already full. push bc call CompareBytes pop bc jr z, .Full ; Don't factor in time of day in link battles. ld a, [wLinkMode] and a jr nz, .Weather ld a, [wTimeOfDay] cp b jr z, .Weather dec c ; double .Weather: ld a, [wBattleWeather] and a jr z, .Heal ; x2 in sun ; /2 in rain/sandstorm inc c cp WEATHER_SUN jr z, .Heal dec c dec c .Heal: ld b, 0 ld hl, .Multipliers add hl, bc add hl, bc ld a, [hli] ld h, [hl] ld l, a ld a, BANK(GetMaxHP) rst FarCall call AnimateCurrentMove call BattleCommand_switchturn callfar RestoreHP call BattleCommand_switchturn call UpdateUserInParty ; 'regained health!' ld hl, RegainedHealthText jp StdBattleTextbox .Full: call AnimateFailedMove ; 'hp is full!' ld hl, HPIsFullText jp StdBattleTextbox .Multipliers: dw GetEighthMaxHP dw GetQuarterMaxHP dw GetHalfMaxHP dw GetMaxHP INCLUDE "engine/battle/move_effects/hidden_power.asm" INCLUDE "engine/battle/move_effects/belly_drum.asm" INCLUDE "engine/battle/move_effects/psych_up.asm" INCLUDE "engine/battle/move_effects/mirror_coat.asm" BattleCommand_starthail: ; starthail ld b, WEATHER_HAIL ld hl, StartedToHailText jr Battle_StartWeather BattleCommand_startsun: ; startsun ld b, WEATHER_SUN ld hl, SunGotBrightText jr Battle_StartWeather BattleCommand_startrain: ; startrain ld b, WEATHER_RAIN ld hl, DownpourText jr Battle_StartWeather BattleCommand_startsandstorm: ; startsandstorm ld b, WEATHER_SANDSTORM ld hl, SandstormBrewedText ; fallthrough Battle_StartWeather: ld a, [wBattleWeather] cp b jr z, .failed ld a, b ld [wBattleWeather], a ld a, 5 ld [wWeatherCount], a call AnimateCurrentMove call StdBattleTextbox farjump UpdateWeatherForms .failed call AnimateFailedMove jp PrintButItFailed BattleCommand_skipsuncharge: ; mimicsuncharge ld a, [wBattleWeather] cp WEATHER_SUN ret nz ld b, charge_command jp SkipToBattleCommand INCLUDE "engine/battle/move_effects/future_sight.asm" INCLUDE "engine/battle/move_effects/thunder.asm" CheckHiddenOpponent: ; BUG: This routine is completely redundant and introduces a bug, since BattleCommand_checkhit does these checks properly. ld a, BATTLE_VARS_SUBSTATUS3_OPP call GetBattleVar and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND ret nz ldh a, [hBattleTurn] and a ld a, [wPlayerUnderwater] jr nz, .go ld a, [wEnemyUnderwater] .go and a ret GetUserItem: ; Return the effect of the user's item in bc, and its id at hl. ld hl, wBattleMonItem ldh a, [hBattleTurn] and a jr z, .go ld hl, wEnemyMonItem .go ld a, BATTLE_VARS_SUBSTATUS2 call GetBattleVar bit SUBSTATUS_EMBARGO, a jr nz, .embargo ld b, [hl] jp GetItemHeldEffect .embargo ld b, HELD_NONE ret GetOpponentItem: ; Return the effect of the opponent's item in bc, and its id at hl. ld hl, wEnemyMonItem ldh a, [hBattleTurn] and a jr z, .go ld hl, wBattleMonItem .go ld a, BATTLE_VARS_SUBSTATUS2_OPP call GetBattleVar bit SUBSTATUS_EMBARGO, a jr nz, .embargo ld b, [hl] jp GetItemHeldEffect .embargo ld b, HELD_NONE ret GetItemHeldEffect: ; Return the effect of item b in bc. ld a, b and a ret z push hl ld hl, ItemAttributes + ITEMATTR_EFFECT dec a ld c, a ld b, 0 ld a, ITEMATTR_STRUCT_LENGTH call AddNTimes ld a, BANK(ItemAttributes) call GetFarHalfword ld b, l ld c, h pop hl ret AnimateCurrentMoveEitherSide: push hl push de push bc ld a, [wKickCounter] push af call BattleCommand_lowersub pop af ld [wKickCounter], a call PlayDamageAnim call BattleCommand_raisesub pop bc pop de pop hl ret AnimateCurrentMove: push hl push de push bc ld a, [wKickCounter] push af call BattleCommand_lowersub pop af ld [wKickCounter], a call LoadMoveAnim call BattleCommand_raisesub pop bc pop de pop hl ret PlayDamageAnim: ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar and a ret z call SetMoveAnimationID ldh a, [hBattleTurn] and a ld a, BATTLEANIM_ENEMY_DAMAGE jr z, .player ld a, BATTLEANIM_PLAYER_DAMAGE .player ld [wNumHits], a jp PlayUserBattleAnim LoadMoveAnim: xor a ld [wNumHits], a ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar and a ret z ; fallthrough LoadAnim: call SetMoveAnimationID ; fallthrough PlayUserBattleAnim: push hl push de push bc callfar PlayBattleAnim pop bc pop de pop hl ret SetMoveAnimationID: push hl call GetMoveIndexFromID ld a, l ld [wFXAnimID], a ld a, h ld [wFXAnimID + 1], a pop hl ret PlayOpponentBattleAnim: ld a, e ld [wFXAnimID], a ld a, d ld [wFXAnimID + 1], a xor a ld [wNumHits], a push hl push de push bc call BattleCommand_switchturn callfar PlayBattleAnim call BattleCommand_switchturn pop bc pop de pop hl ret CallBattleCore: ld a, BANK("Battle Core") rst FarCall ret CallBattleCoreAlt: ld a, BANK("Battle Core 2") rst FarCall ret AnimateFailedMove: call BattleCommand_lowersub call BattleCommand_movedelay jp BattleCommand_raisesub BattleCommand_movedelay: ; movedelay ; Wait 40 frames. ld c, 40 jp DelayFrames BattleCommand_cleartext: ; cleartext ; Used in multi-hit moves. ld hl, .text jp BattleTextbox .text: text_end SkipToBattleCommand: ; Skip over commands until reaching command b. ld a, [wBattleScriptBufferAddress + 1] ld h, a ld a, [wBattleScriptBufferAddress] ld l, a .loop ld a, [hli] cp b jr nz, .loop ld a, h ld [wBattleScriptBufferAddress + 1], a ld a, l ld [wBattleScriptBufferAddress], a ret DisappearUser: farcall _DisappearUser ret AppearUserLowerSub: farcall _AppearUserLowerSub ret AppearUserRaiseSub: farcall _AppearUserRaiseSub ret _CheckBattleScene: ; Checks the options. Returns carry if battle animations are disabled. push hl push de push bc farcall CheckBattleScene pop bc pop de pop hl ret CheckMoveInList: ; checks if the move ID in a belongs to a list of moves in hl push bc push de push hl call GetMoveIndexFromID ld b, h ld c, l pop hl ld de, 2 call IsInHalfwordArray pop de pop bc ret BattleCommand_stab: ; STAB = Same Type Attack Bonus ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar ld bc, STRUGGLE call CompareMove ret z ld hl, wBattleMonType1 ld a, [hli] ld b, a ld c, [hl] ld hl, wEnemyMonType1 ld a, [hli] ld d, a ld e, [hl] ldh a, [hBattleTurn] and a jr z, .go ; Who Attacks and who Defends ld hl, wEnemyMonType1 ld a, [hli] ld b, a ld c, [hl] ld hl, wBattleMonType1 ld a, [hli] ld d, a ld e, [hl] .go call GetCurrentMoveType ld [wCurType], a push hl push de push bc farcall DoWeatherModifiers pop bc pop de pop hl push de push bc farcall DoBadgeTypeBoosts pop bc pop de push de push bc farcall DoOrbTypeDamageBoosts pop bc pop de ld a, [wCurType] cp b jr z, .stab cp c jr z, .stab jr .SkipStab .stab ld hl, wCurDamage + 1 ld a, [hld] ld h, [hl] ld l, a ld b, h ld c, l srl b rr c add hl, bc ld a, h ld [wCurDamage], a ld a, l ld [wCurDamage + 1], a ld hl, wTypeModifier set 7, [hl] .SkipStab: farcall WonderGuardCheck jp nc, .wonder_guard call GetCurrentMoveType2 ld b, a ld hl, TypeMatchups farcall2 TypeMatchupSpecialCases jr c, .force_end .TypesLoop: ld a, [hli] cp -1 jr z, .end ; foresight cp -2 jr nz, .SkipForesightCheck ld a, BATTLE_VARS_SUBSTATUS1_OPP call GetBattleVar bit SUBSTATUS_IDENTIFIED, a jr nz, .end jr .TypesLoop .SkipForesightCheck: cp b jr nz, .SkipType ld a, [hl] cp d jr z, .GotMatchup cp e jr z, .GotMatchup jr .SkipType .GotMatchup: push hl push bc inc hl ld a, [wTypeModifier] and %10000000 ld b, a ; If the target is immune to the move, treat it as a miss and calculate the damage as 0 ld a, [hl] and a jr nz, .NotImmune inc a ld [wAttackMissed], a xor a .NotImmune: ldh [hMultiplier], a add b ld [wTypeModifier], a xor a ldh [hMultiplicand + 0], a ld hl, wCurDamage ld a, [hli] ldh [hMultiplicand + 1], a ld a, [hld] ldh [hMultiplicand + 2], a call Multiply ldh a, [hProduct + 1] ld b, a ldh a, [hProduct + 2] or b ld b, a ldh a, [hProduct + 3] or b jr z, .ok ; This is a very convoluted way to get back that we've essentially dealt no damage. ; Take the product and divide it by 10. ld a, 10 ldh [hDivisor], a ld b, 4 call Divide ldh a, [hQuotient + 2] ld b, a ldh a, [hQuotient + 3] or b jr nz, .ok ld a, 1 ldh [hMultiplicand + 2], a .ok ldh a, [hMultiplicand + 1] ld [hli], a ldh a, [hMultiplicand + 2] ld [hl], a pop bc pop hl .SkipType: inc hl inc hl jr .TypesLoop .wonder_guard ld a, 1 ld [wWonderGuardMiss], a .force_end ld a, 1 ld [wAttackMissed], a .end farcall BattleCheckTypeMatchup ld a, [wTypeMatchup] ld b, a ld a, [wTypeModifier] and %10000000 or b ld [wTypeModifier], a ret GetCurrentMoveType2: push hl call GetCurrentMoveType pop hl ret GetCurrentMoveType: ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_WEATHER_BALL jr z, .weather_ball_type cp EFFECT_JUDGMENT jr z, .judgment_type ld a, BATTLE_VARS_MOVE_TYPE call GetBattleVarAddr and TYPE_MASK ret .weather_ball_type push bc ld a, [wBattleWeather] cp WEATHER_NONE ld b, NORMAL jr .got_weather_type cp WEATHER_SUN ld b, FIRE jr .got_weather_type cp WEATHER_RAIN ld b, WATER jr .got_weather_type cp WEATHER_HAIL ld b, ICE jr .got_weather_type ; sandstorm ld b, ROCK .got_weather_type ld a, b pop bc ret .judgment_type push bc push de ld hl, wBattleMonItem ldh a, [hBattleTurn] and a jr z, .got_item ld hl, wEnemyMonItem .got_item ld a, [hl] ld b, BANK(PlateItems) ld hl, PlateItems ld de, 2 call IsInFarArray pop de pop bc jr nc, .no_plate inc hl ld a, BANK(PlateItems) call GetFarByte ret .no_plate xor a ret SECTION "Effect Commands 2", ROMX CompareMove2: ; checks if the move ID in a matches the move in bc push hl call GetMoveIndexFromID ld a, h cp b ld a, l pop hl ret nz cp c ret CallBattleCore2: ld a, BANK("Battle Core") rst FarCall ret AnimateCurrentMove2: push af push hl farcall AnimateCurrentMove pop hl pop af ret AnimateAndPrintFailedMove2: farcall AnimateAndPrintFailedMove ret FailMove2: farcall FailMove ret UpdateArceusForm: farcall BattleCommand_switchturn call .Update farcall BattleCommand_switchturn ; update player form ; fallthrough .Update: ldh a, [hBattleTurn] and a ld hl, wBattleMonSpecies ld de, wBattleMonType jr z, .got_species ld hl, wEnemyMonSpecies ld de, wEnemyMonType .got_species ld a, [hli] push hl call GetPokemonIndexFromID ld a, h cp HIGH(ARCEUS) jr nz, .miss ld a, l cp LOW(ARCEUS) jr nz, .miss pop hl ld a, [hl] push de ld hl, PlateItems ld de, 2 call IsInArray pop de ret nc ; is Arceus, is holding a Plate inc hl ld a, [hl] ; target type ld [de], a inc de ld [de], a ret .miss pop hl ret INCLUDE "data/items/plate_items.asm" UpdateWeatherForms: ; update enemy form call BattleCommand_switchturn call .Update call BattleCommand_switchturn ; update player form ; fallthrough .Update: ldh a, [hBattleTurn] and a ld hl, wBattleMonSpecies jr z, .got_species ld hl, wEnemyMonSpecies .got_species ld a, [hl] call GetPokemonIndexFromID call GetBaseFormNumber ld a, h cp HIGH(CASTFORM) jr nz, .check_cherrim ld a, l cp LOW(CASTFORM) jr nz, .check_cherrim ; is Castform ld a, [wBattleWeather] and a jr z, .castform_revert cp WEATHER_SANDSTORM jr z, .castform_revert cp WEATHER_RAIN jr z, .castform_rain cp WEATHER_SUN jr z, .castform_sun ; hail ld hl, CASTFORM_SW lb bc, ICE, ICE ; type 1 / type 2 jr .update .castform_rain ld hl, CASTFORM_RN lb bc, WATER, WATER ; type 1 / type 2 jr .update .castform_sun ld hl, CASTFORM_SN lb bc, FIRE, FIRE ; type 1 / type 2 jr .update .castform_revert ld hl, CASTFORM lb bc, NORMAL, NORMAL ; type 1 / type 2 jr .update .check_cherrim ld a, h cp HIGH(CHERRIM) ret nz ld a, l cp LOW(CHERRIM) ret nz ld a, [wBattleWeather] cp WEATHER_SUN jr z, .cherrim_sunny ; revert ld hl, CHERRIM lb bc, GRASS, GRASS ; type 1 / type 2 jr .update .cherrim_sunny ld hl, CHERRIM_S lb bc, GRASS, GRASS ; type 1 / type 2 ; fallthrough .update call .sanity_check ret nc call GetPokemonIDFromIndex ld [wCurPartySpecies], a push af ldh a, [hBattleTurn] and a ld hl, wBattleMonSpecies ld de, wBattleMonType jr z, .set_species ld hl, wEnemyMonSpecies ld de, wEnemyMonType .set_species pop af ld [hl], a push af ld a, b ld [de], a inc de ld a, c ld [de], a ldh a, [hBattleTurn] and a ld hl, wTempBattleMonSpecies jr z, .got_tempmon ld hl, wTempEnemyMonSpecies .got_tempmon pop af ld [hl], a ; play animation farcall _CheckBattleScene jr c, .mimic_anims xor a ld [wNumHits], a ld hl, ANIM_REFRESH_SPRITE call GetMoveIDFromIndex farcall LoadAnim jr .after_anim .mimic_anims farcall BattleCommand_movedelay farcall BattleCommand_raisesubnoanim farcall BattleAnimCmd_ReloadPal .after_anim ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVarAddr bit SUBSTATUS_SUBSTITUTE, [hl] jr z, .no_sub ld hl, SUBSTITUTE call GetMoveIDFromIndex farcall LoadAnim .no_sub ld hl, ChangedFormBattleText jp StdBattleTextbox .sanity_check ; don't change form if you won't actually change push de push hl ld d, h ld e, l ldh a, [hBattleTurn] and a ld hl, wBattleMonSpecies jr z, .sc_got_species ld hl, wEnemyMonSpecies .sc_got_species ld a, [hl] call GetPokemonIndexFromID ld a, h cp d jr nz, .diff ld a, l cp e jr nz, .diff pop hl pop de and a ret .diff pop hl pop de scf ret BattleCommand_camouflage: ld hl, wBattleMonType ldh a, [hBattleTurn] and a jr z, .ok ld hl, wEnemyMonType .ok call AnimateCurrentMove2 push hl call GetEnvironmentType pop hl ld [hli], a ld [hl], a ld [wNamedObjectIndexBuffer], a farcall GetTypeName ld hl, CamouflageText jp StdBattleTextbox BattleCommand_naturepower: ld c, 45 call DelayFrames call GetEnvironmentType ld hl, NaturePowerMoves ld de, 3 call IsInArray ret nc inc hl ld a, [hli] ld h, [hl] ld l, a call GetMoveIDFromIndex ld [wNamedObjectIndexBuffer], a push af call GetMoveName ld hl, NaturePowerText call StdBattleTextbox ld a, BATTLE_VARS_MOVE call GetBattleVarAddr pop af ld [hl], a farcall UpdateMoveData farjump ResetTurn GetEnvironmentType: ld a, [wPlayerState] cp PLAYER_SURF jr z, .water cp PLAYER_SURF_PIKA jr z, .water ld a, [wBattleMode] cp WILD_BATTLE jr nz, .tileset ld a, [wEnvironment] cp TOWN jr z, .grass cp ROUTE jr z, .grass .tileset ld a, [wMapTileset] ld l, a ld h, 0 ld bc, NaturePowerTilesets add hl, bc ld a, [hl] ret .grass ld a, GRASS ret .water ld a, WATER ret INCLUDE "data/moves/nature_power_tilesets.asm" BattleCommand_endeavor: ld hl, wBattleMonHP ld de, wEnemyMonHP ldh a, [hBattleTurn] and a jr z, .ok ld hl, wEnemyMonHP ld de, wBattleMonHP .ok ld a, [hli] ld l, [hl] ld h, a ld a, [de] ld b, a inc de ld a, [de] ld c, a ld a, h cp b jr c, .do_effect ld a, l cp c jr nc, .fail .do_effect ld a, b sub h ld h, a ld a, c sbc l ld [wCurDamage + 1], a ld a, h ld [wCurDamage], a ret .fail ld a, 1 ld [wAttackMissed], a ret BattleCommand_brine: push bc ld hl, wEnemyMonMaxHP + 1 ldh a, [hBattleTurn] and a jr z, .go ld hl, wBattleMonMaxHP + 1 .go ld a, [hld] ld c, a ld a, [hld] ld b, a ld a, [hld] ld h, [hl] ld l, a add hl, hl dec hl ld a, h cp b jr c, .ok ld a, l cp c jr nc, .no .ok pop bc ld a, d add a ld d, a ret .no pop bc ret BattleCommand_trick: ; fail if wild opponent uses it ldh a, [hBattleTurn] and a jr z, .player_turn ld a, [wBattleMode] cp WILD_BATTLE jr nz, .player_turn .fail jp AnimateAndPrintFailedMove2 .player_turn ld a, 1 ld [wAttackMissed], a ld de, wBattleMonItem farcall CheckStealableItem jr c, .fail ld de, wEnemyMonItem farcall CheckStealableItem jr c, .fail ld a, [wBattleMonItem] and a jr nz, .ok ld a, [wEnemyMonItem] and a jr z, .fail .ok call AnimateCurrentMove2 xor a ld [wAttackMissed], a ld hl, wBattleMonItem ld de, wEnemyMonItem ld b, [hl] ld a, [de] ld [hl], a ld a, b ld [de], a ld a, MON_ITEM call BattlePartyAttr push hl ld a, [wBattleMode] cp WILD_BATTLE jr z, .wild_battle ld a, MON_ITEM call OTPartyAttr pop de ld b, [hl] ld a, [de] ld [hl], a ld a, b ld [de], a jr .text .wild_battle pop de ld hl, wBattleMonItem ld a, [hl] ld [de], a .text ld hl, TrickText call StdBattleTextbox ld hl, wBattleMonItem ld de, wEnemyMonItem ldh a, [hBattleTurn] and a jr z, .gotturn ld hl, wEnemyMonItem ld de, wBattleMonItem .gotturn ld a, [hl] and a jr z, .skip_user_item ld [wNamedObjectIndexBuffer], a push de call GetItemName ld hl, UserGotItemText call StdBattleTextbox pop de .skip_user_item ld a, [de] and a ret z ld [wNamedObjectIndexBuffer], a call GetItemName ld hl, TargetGotItemText jp StdBattleTextbox BattleCommand_taunt: ld a, [wAttackMissed] and a jp nz, FailMove2 ld a, BATTLE_VARS_SUBSTATUS6_OPP call GetBattleVarAddr bit SUBSTATUS_TAUNT, [hl] jr nz, .fail set SUBSTATUS_TAUNT, [hl] ld hl, wEnemyTauntCount ldh a, [hBattleTurn] and a jr z, .go ld hl, wPlayerTauntCount .go call AnimateCurrentMove2 call BattleRandom and %11 ; [0..3] add 3 ; [3..6] ld [hl], a ld hl, FellForTauntText jp StdBattleTextbox .fail farcall AnimateFailedMove jp PrintButItFailed BattleCommand_trumpcard: push bc ldh a, [hBattleTurn] and a ld a, [wCurMoveNum] ld hl, wBattleMonPP jr z, .ok ld a, [wCurEnemyMoveNum] ld hl, wEnemyMonPP .ok ld c, a ld b, 0 add hl, bc pop bc ld a, [hl] cp 4 ld d, 40 ret nc cp 3 ld d, 50 ret nc cp 2 ld d, 60 ret nc cp 1 ld d, 80 ret nc ld d, 200 ret BattleCommand_refresh: ld a, BATTLE_VARS_STATUS call GetBattleVarAddr ld a, [hl] and (1 << PSN) | (1 << BRN) | (1 << PAR) jr z, .fail call AnimateCurrentMove2 xor a ld [hl], a ld a, BATTLE_VARS_SUBSTATUS5 call GetBattleVarAddr res SUBSTATUS_TOXIC, [hl] call UpdateUserInParty ld hl, StatusHealText call StdBattleTextbox ldh a, [hBattleTurn] and a jp z, CalcPlayerStats jp CalcEnemyStats .fail farcall AnimateFailedMove jp PrintButItFailed BattleCommand_wakeupslap: ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarAddr ld a, [hl] and SLP ret z xor a ld [hl], a ld a, BATTLE_VARS_SUBSTATUS1_OPP call GetBattleVarAddr res SUBSTATUS_NIGHTMARE, [hl] ld a, d add a ld d, a push bc push de call UpdateOpponentInParty call BattleCommand_switchturn ld hl, StatusHealText call StdBattleTextbox call BattleCommand_switchturn pop de pop bc ret BattleCommand_smellingsalt: ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarAddr bit PAR, [hl] ret z ld a, d add a ld d, a res PAR, [hl] push bc push de call UpdateOpponentInParty call BattleCommand_switchturn ld hl, StatusHealText call StdBattleTextbox call BattleCommand_switchturn pop de pop bc ret BattleCommand_imprison: ld a, BATTLE_VARS_SUBSTATUS2 call GetBattleVarAddr bit SUBSTATUS_IMPRISON, [hl] jp nz, AnimateAndPrintFailedMove2 ld hl, wBattleMonMoves ld c, 4 .loop_x ld b, 4 ld de, wEnemyMonMoves .loop_y ld a, [de] and a jr z, .next inc de cp [hl] jr z, .hit dec b jr nz, .loop_y .next ld a, [hli] and a jp z, AnimateAndPrintFailedMove2 dec c jr nz, .loop_x jp AnimateAndPrintFailedMove2 .hit call AnimateCurrentMove2 ld a, BATTLE_VARS_SUBSTATUS2 call GetBattleVarAddr set SUBSTATUS_IMPRISON, [hl] ld hl, ImprisonText jp StdBattleTextbox BattleCommand_torment: ld a, [wAttackMissed] and a jp nz, FailMove2 ld a, BATTLE_VARS_SUBSTATUS5_OPP call GetBattleVarAddr bit SUBSTATUS_TORMENT, [hl] jp nz, AnimateAndPrintFailedMove2 set SUBSTATUS_TORMENT, [hl] call AnimateCurrentMove2 ld hl, TormentText jp StdBattleTextbox BattleCommand_movecharge: ld hl, wPlayerChargeFlag ldh a, [hBattleTurn] and a jr z, .go ld hl, wEnemyChargeFlag .go ld a, 2 ld [hl], a call AnimateCurrentMove2 ld hl, ChargeText jp StdBattleTextbox BattleCommand_watersport: ld a, BATTLE_VARS_SUBSTATUS6 call GetBattleVarAddr bit SUBSTATUS_WATER_SPORT, [hl] jp nz, AnimateAndPrintFailedMove2 set SUBSTATUS_WATER_SPORT, [hl] call AnimateCurrentMove2 ld hl, WaterSportText jp StdBattleTextbox BattleCommand_mudsport: ld a, BATTLE_VARS_SUBSTATUS6 call GetBattleVarAddr bit SUBSTATUS_MUD_SPORT, [hl] jp nz, AnimateAndPrintFailedMove2 set SUBSTATUS_MUD_SPORT, [hl] call AnimateCurrentMove2 ld hl, WaterSportText jp StdBattleTextbox CheckSports: ldh a, [hBattleTurn] and a ld a, [wPlayerMoveStructType] jr z, .go ld a, [wEnemyMoveStructType] .go and TYPE_MASK cp FIRE jr z, .water_sport cp ELECTRIC ret nz ld a, [wPlayerSubStatus6] bit SUBSTATUS_MUD_SPORT, a jr nz, .hit ld a, [wEnemySubStatus6] bit SUBSTATUS_MUD_SPORT, a jr nz, .hit ret .water_sport ld a, [wPlayerSubStatus6] bit SUBSTATUS_WATER_SPORT, a jr nz, .hit ld a, [wEnemySubStatus6] bit SUBSTATUS_WATER_SPORT, a ret z .hit rrc d ret BattleCommand_ingrain: ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVarAddr bit SUBSTATUS_INGRAIN, [hl] jp nz, AnimateAndPrintFailedMove2 set SUBSTATUS_INGRAIN, [hl] call AnimateCurrentMove2 ld hl, wPlayerMagnetRiseCount ldh a, [hBattleTurn] and a jr z, .go ld hl, wEnemyMagnetRiseCount .go xor a ld [hl], a ld hl, IngrainText jp StdBattleTextbox INCLUDE "engine/battle/move_effects/assist.asm" INCLUDE "engine/battle/move_effects/water_spout.asm" BattleCommand_aquaring: ld a, BATTLE_VARS_SUBSTATUS6 call GetBattleVarAddr bit SUBSTATUS_AQUA_RING, [hl] jp nz, AnimateAndPrintFailedMove2 set SUBSTATUS_AQUA_RING, [hl] call AnimateCurrentMove2 ld hl, AquaRingText jp StdBattleTextbox BattleCommand_checkuproar: ld de, wPlayerRolloutCount ldh a, [hBattleTurn] and a jr z, .player ld de, wEnemyRolloutCount .player ld a, BATTLE_VARS_SUBSTATUS6 call GetBattleVarAddr bit SUBSTATUS_UPROAR, [hl] ret z ld a, [de] dec a ld [de], a ld b, doturn_command farjump SkipToBattleCommand BattleCommand_uproar: ld de, wPlayerRolloutCount ldh a, [hBattleTurn] and a jr z, .ok ld de, wEnemyRolloutCount .ok ld a, BATTLE_VARS_SUBSTATUS6 call GetBattleVarAddr bit SUBSTATUS_UPROAR, [hl] ret nz set SUBSTATUS_UPROAR, [hl] ; Rampage for 1 - 4 more turns call BattleRandom and %00000011 inc a ld [de], a ld a, 1 ld [wSomeoneIsRampaging], a ld hl, CausedAnUproarText jp StdBattleTextbox BattleCommand_stockpile: ld a, BATTLE_VARS_SUBSTATUS6 call GetBattleVarAddr ld a, [hl] and MASK_STOCKPILE cp STOCKPILE_3 jr z, .fail call AnimateCurrentMove2 call CheckAlreadyFailed ld a, [hl] add STOCKPILE_1 ld [hl], a swap a rrca ld [wStringBuffer1], a ld hl, StockpileText jp StdBattleTextbox .fail call AnimateAndPrintFailedMove2 farjump EndMoveEffect BattleCommand_spitup: ld a, BATTLE_VARS_SUBSTATUS6 call GetBattleVarAddr ld a, [hl] and MASK_STOCKPILE jr z, .fail cp STOCKPILE_1 ld d, 100 ret z cp STOCKPILE_2 ld d, 200 ret z ld d, 255 ret .fail call AnimateAndPrintFailedMove2 farjump EndMoveEffect BattleCommand_swallow: ld a, BATTLE_VARS_SUBSTATUS6 call GetBattleVarAddr ld a, [hl] and MASK_STOCKPILE jr z, .fail push af ld de, wBattleMonHP ld hl, wBattleMonMaxHP ldh a, [hBattleTurn] and a jr z, .got_hp ld de, wEnemyMonHP ld hl, wEnemyMonMaxHP .got_hp push hl push de push bc ld c, 2 call CompareBytes pop bc pop de pop hl jp z, .hp_full pop af cp STOCKPILE_1 jr z, .quarter cp STOCKPILE_2 jr z, .half ld hl, GetMaxHP call CallBattleCore2 jr .restore .quarter ld hl, GetQuarterMaxHP call CallBattleCore2 jr .restore .half ld hl, GetHalfMaxHP call CallBattleCore2 .restore call AnimateCurrentMove2 call BattleCommand_switchturn ld hl, RestoreHP call CallBattleCore2 call BattleCommand_switchturn call UpdateUserInParty call RefreshBattleHuds ld hl, RegainedHealthText jp StdBattleTextbox .hp_full farcall AnimateFailedMove ld hl, HPIsFullText call StdBattleTextbox farjump EndMoveEffect .fail call AnimateAndPrintFailedMove2 farjump EndMoveEffect BattleCommand_removestockpile: ld a, BATTLE_VARS_SUBSTATUS6 call GetBattleVarAddr ld a, [hl] and MASK_STOCKPILE ret z swap a rrca .loop push af ld b, DEFENSE ld a, STAT_LOWER | STAT_SILENT | STAT_SKIPTEXT farcall2 FarChangeStat ld b, SP_DEFENSE ld a, STAT_LOWER | STAT_SILENT | STAT_SKIPTEXT farcall2 FarChangeStat pop af dec a jr nz, .loop ld a, BATTLE_VARS_SUBSTATUS6 call GetBattleVarAddr res SUBSTATUS_STOCKPILE_1, [hl] res SUBSTATUS_STOCKPILE_2, [hl] ld hl, StockpileWoreOffText jp StdBattleTextbox BattleCommand_acupressure: ld hl, wPlayerStatLevels ldh a, [hBattleTurn] and a jr z, .go ld hl, wEnemyStatLevels .go ; make sure there's a stat that can be raised ld bc, 0 .check_loop push hl add hl, bc ld a, [hl] pop hl cp MAX_STAT_LEVEL jr nz, .ok inc c ld a, c cp 7 jp z, AnimateAndPrintFailedMove2 jr .check_loop .ok ; choose a stat to raise .raise_loop call BattleRandom maskbits 7 cp 7 jr nc, .raise_loop ld c, a push hl add hl, bc ld a, [hl] pop hl cp MAX_STAT_LEVEL jr z, .raise_loop ; found a stat, raise it by 2 levels ld a, c or $10 ld b, a xor a farcall2 FarChangeStat ret BattleCommand_recycle: ldh a, [hBattleTurn] and a ld hl, wPlayerRecycleMemory ld bc, wPartyMon1Item ld de, wBattleMonItem ld a, [wCurBattleMon] jr z, .go ld hl, wEnemyRecycleMemory ld bc, wOTPartyMon1Item ld de, wEnemyMonItem ld a, [wCurOTMon] .go push af push bc ld c, a ld b, 0 add hl, bc pop bc ld a, [hl] and a jr z, .fail ld a, [de] and a jr nz, .fail ld a, [hl] ld [de], a xor a ld [hl], a ldh a, [hBattleTurn] and a jr z, .continue ld a, [wBattleMode] dec a jr z, .done_wild .continue pop af call AnimateCurrentMove2 ld h, b ld l, c call GetPartyLocation ld a, [de] ld [hl], a ld [wNamedObjectIndexBuffer], a call GetItemName ld hl, RecycleText jp StdBattleTextbox .fail pop af jp AnimateAndPrintFailedMove2 .done_wild pop af ret BattleCommand_knockoff: ldh a, [hBattleTurn] and a ld hl, wOTPartyMon1Item ld de, wEnemyMonItem ld a, [wCurOTMon] jr z, .go ; fail if wild mon uses it ld a, [wBattleMode] cp WILD_BATTLE ret z ld hl, wPartyMon1Item ld de, wBattleMonItem ld a, [wCurBattleMon] .go ld b, a ld a, [de] and a ret z farcall CheckStealableItem ret c ld [wNamedObjectIndexBuffer], a ld a, b call GetPartyLocation xor a ld [hl], a ld [de], a call GetItemName ld hl, KnockOffText jp StdBattleTextbox BattleCommand_captivate: ld a, [wAttackMissed] and a jr nz, .failed farcall CheckOppositeGender jr c, .failed farcall CheckHiddenOpponent jr nz, .failed call CheckAlreadyFailed farjump AnimateCurrentMove .failed farcall FailMove farjump EndMoveEffect BattleCommand_gyroball: push bc push de ld hl, wBattleMonSpeed ld de, wEnemyMonSpeed ldh a, [hBattleTurn] and a jr z, .go ld hl, wEnemyMonSpeed ld de, wBattleMonSpeed .go ld a, [de] ld b, a inc de ld a, [de] ld e, a ld d, b xor a ldh [hMultiplicand + 0], a ld a, d ldh [hMultiplicand + 1], a ld a, e ldh [hMultiplicand + 2], a ld a, 25 ldh [hMultiplier], a call Multiply ld a, [hli] ld b, [hl] and a jr z, .lt256 ld c, 2 cp 1 jr z, .lt512 ld c, 4 rrca rr b .lt512 rrca rr b ; a should be 0 ld a, c ldh [hDivisor], a push bc ld b, 4 call Divide pop bc .lt256 ld a, b ldh [hDivisor], a ld b, 4 call Divide ldh a, [hQuotient + 3] pop de pop bc ld d, a cp -1 jr z, .max inc d ldh a, [hQuotient + 2] and a jr nz, .max ld a, d cp 151 ret c .max ld d, 150 ret BattleCommand_tailwind: ld hl, wPlayerTailwindCount ldh a, [hBattleTurn] and a jr z, .go ld hl, wEnemyTailwindCount .go ld a, [hl] and a jp nz, AnimateAndPrintFailedMove2 ld [hl], 3 ld hl, TailwindText call StdBattleTextbox ldh a, [hBattleTurn] and a jr z, .player farjump CalcEnemyStats .player farjump CalcPlayerStats SetLastResortFlag: ldh a, [hBattleTurn] and a ld a, [wCurMoveNum] ld hl, wPlayerLastResortFlags jr z, .okay ld a, [wCurEnemyMoveNum] ld hl, wEnemyLastResortFlags .okay ld b, a ld a, 1 inc b .loop dec b jr z, .done add a jr .loop .done or [hl] ld [hl], a ret BattleCommand_lastresort: ld a, 1 ld [wAttackMissed], a ldh a, [hBattleTurn] and a ld a, [wPlayerLastResortFlags] ld hl, wBattleMonMoves jr z, .go ld a, [wEnemyLastResortFlags] ld hl, wEnemyMonMoves .go ld d, a ; make sure mon knows last resort push hl xor a ccf push af ld e, NUM_MOVES .check_loop ld a, [hli] and a jr z, .done ld bc, LAST_RESORT call CompareMove2 jr z, .check_hit pop af adc a ld b, a and d ld a, b push af jr z, .fail2 .check_loop_2 dec e jr nz, .check_loop .done pop af pop hl ld a, [wAttackMissed] and a jr nz, .fail ; make sure the user knows more than one move inc hl ld a, [hl] and a jr z, .fail ret .fail2 pop af pop hl .fail call AnimateAndPrintFailedMove2 farjump EndMoveEffect .check_hit xor a ld [wAttackMissed], a jr .check_loop_2 TookDamageFlag: ld a, BATTLE_VARS_SUBSTATUS4_OPP call GetBattleVar bit SUBSTATUS_SUBSTITUTE, a ret nz ldh a, [hBattleTurn] and a ld hl, wPlayerTookDamage jr nz, .got_turn_damage_flag ld hl, wEnemyTookDamage .got_turn_damage_flag ld a, 1 ld [hl], a ret BattleCommand_focuspunch: ldh a, [hBattleTurn] and a ld a, [wPlayerTookDamage] jr z, .go ld a, [wEnemyTookDamage] .go and a ret z farcall AnimateFailedMove ld hl, LostFocusText call StdBattleTextbox farjump EndMoveEffect BattleCommand_revenge: ldh a, [hBattleTurn] and a ld a, [wPlayerTookDamage] jr z, .go ld a, [wEnemyTookDamage] .go and a ret z ld a, d add a ld d, a ret BattleCommand_powerswap: ld a, ATTACK call SwapStatStage ld a, SP_ATTACK call SwapStatStage call CalcBothMonStats call AnimateCurrentMove2 ld hl, SwitchedStatChangesText jp StdBattleTextbox BattleCommand_guardswap: ld a, DEFENSE call SwapStatStage ld a, SP_DEFENSE call SwapStatStage call CalcBothMonStats call AnimateCurrentMove2 ld hl, SwitchedStatChangesText jp StdBattleTextbox BattleCommand_heartswap: xor a .loop push af call SwapStatStage pop af inc a cp EVASION + 1 jr nz, .loop call AnimateCurrentMove2 ld hl, SwitchedStatChangesText jp StdBattleTextbox SwapStatStage: ld c, a ld b, 0 ld hl, wPlayerStatLevels add hl, bc ld d, [hl] push hl ld hl, wEnemyStatLevels add hl, bc ld a, [hl] ld [hl], d pop hl ld [hl], a ret CalcBothMonStats: ldh a, [hBattleTurn] push af farcall CalcPlayerStats farcall CalcEnemyStats pop af ldh [hBattleTurn], a ret SetShadowForce: ldh a, [hBattleTurn] and a ld hl, wPlayerUnderwater jr z, .got_underwater ld hl, wEnemyUnderwater .got_underwater ld a, 2 ld [hl], a farcall _DisappearUser ret SetUnderwater: ldh a, [hBattleTurn] and a ld hl, wPlayerUnderwater jr z, .got_underwater ld hl, wEnemyUnderwater .got_underwater ld a, 1 ld [hl], a farcall _DisappearUser ret BattleCommand_weightdamage: push bc push de ; get weight from dex entry ldh a, [hBattleTurn] and a ld hl, wEnemyMonSpecies jr z, .got_species ld hl, wBattleMonSpecies .got_species ld b, [hl] farcall GetMonWeight ld b, d ld c, e ; get base damage ld hl, .weight_damage_table .damage_loop ld a, [hli] ld e, a ld a, [hli] ld d, a cp b jr c, .next jr nz, .got_it ld a, e cp c jr nc, .got_it .next inc hl jr .damage_loop .got_it pop de ld d, [hl] pop bc ret .weight_damage_table dwb 219, 20 dwb 551, 40 dwb 1102, 60 dwb 2204, 80 dwb 4409, 100 dwb -1, 120 BattleCommand_facade: ; facade ld hl, wBattleMonStatus ldh a, [hBattleTurn] and a jr z, .ok ld hl, wEnemyMonStatus .ok bit PSN, [hl] jr nz, .double bit PAR, [hl] jr nz, .double bit BRN, [hl] ret z .double ld a, d add a jr c, .max ld d, a ret .max ld b, $ff ret INCLUDE "engine/battle/move_effects/brick_break.asm" BattleCommand_metalburst: ld a, 1 ld [wAttackMissed], a ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar and a ret z ld b, a callfar GetMoveEffect ld a, b cp EFFECT_COUNTER ret z cp EFFECT_MIRROR_COAT ret z cp EFFECT_METAL_BURST ret z farcall BattleCommand_resettypematchup ld a, [wTypeMatchup] and a ret z farcall CheckOpponentWentFirst ret z ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP call GetBattleVar ld de, wStringBuffer1 call GetMoveData ld a, [wStringBuffer1 + MOVE_POWER] and a ret z ; BUG: Move should fail with all non-damaging battle actions ld hl, wCurDamage ld a, [hli] or [hl] ret z ld a, [hld] ld c, a ld a, [hl] ld b, a ld hl, 0 add hl, bc rrc b rr c ld a, h add hl, bc add b push af ld a, h ld [wCurDamage], a ld a, l ld [wCurDamage + 1], a pop af jr nc, .capped ld a, $ff ld [wCurDamage], a ld [wCurDamage + 1], a .capped xor a ld [wAttackMissed], a ret INCLUDE "engine/battle/move_effects/spikes.asm" TypeMatchupSpecialCases2: ld a, b ld b, d ld d, a ld e, c call TypeMatchupSpecialCases ld [wTypeMatchup], a ld a, b ld b, d ld d, a ld c, e ret TypeMatchupSpecialCases: call .magnet_rise ret c call .gravity_roost ret c call .miracle_eye ret c ld a, 10 ret .magnet_rise ldh a, [hBattleTurn] and a ld a, [wPlayerMagnetRiseCount] jr nz, .m_r_go ld a, [wEnemyMagnetRiseCount] .m_r_go and a ret z ld a, GROUND cp b jr z, .yes and a ret .gravity_roost ld a, GROUND cp b jr nz, .no ld a, [wGravityCount] and a jr nz, .no ldh a, [hBattleTurn] and a ld a, [wPlayerRoost] jr nz, .g_r_go ld a, [wEnemyRoost] .g_r_go and a ret nz ; check Levitate ldh a, [hBattleTurn] and a ld a, [wBattleMonSpecies] jr nz, .lev_go ld a, [wEnemyMonSpecies] .lev_go push de call IsLevitateMon pop de jr c, .yes ; check Gravity/Roost typing ld a, FLYING cp d jr z, .yes cp e jr z, .yes and a ret .miracle_eye ld a, BATTLE_VARS_SUBSTATUS2_OPP call GetBattleVar bit SUBSTATUS_MIRACLE_EYE, a ret z ld a, PSYCHIC cp b jr nz, .no ld a, DARK cp d jr z, .yes cp e jr z, .yes and a ret .no and a ret .yes xor a scf ret BattleCommand_miracleeye: ld a, [wAttackMissed] and a jr nz, .failed call CheckHiddenOpponent jr nz, .failed ld a, BATTLE_VARS_SUBSTATUS2_OPP call GetBattleVarAddr bit SUBSTATUS_MIRACLE_EYE, [hl] jr nz, .failed set SUBSTATUS_MIRACLE_EYE, [hl] call AnimateCurrentMove2 ld hl, IdentifiedText jp StdBattleTextbox .failed jp FailMove BattleCommand_magnetrise: ld a, [wGravityCount] and a jr nz, .fail ldh a, [hBattleTurn] and a ld hl, wPlayerMagnetRiseCount jr z, .go ld hl, wEnemyMagnetRiseCount .go ld a, [hl] and a jr nz, .fail ld a, BATTLE_VARS_SUBSTATUS4 call GetBattleVar bit SUBSTATUS_INGRAIN, a jr nz, .fail ld a, 5 ld [hl], a call AnimateCurrentMove2 ld hl, MagnetRiseText jp StdBattleTextbox .fail jp AnimateAndPrintFailedMove2 BattleCommand_gravity: ld a, [wGravityCount] and a jr nz, .fail ldh a, [hBattleTurn] and a ld hl, wPlayerMagnetRiseCount jr z, .go ld hl, wEnemyMagnetRiseCount .go xor a ld [hl], a ld a, 5 ld [wGravityCount], a call AnimateCurrentMove2 ld hl, GravityText call StdBattleTextbox ld a, BATTLE_VARS_SUBSTATUS3_OPP call GetBattleVarAddr bit SUBSTATUS_FLYING, [hl] ret z res SUBSTATUS_FLYING, [hl] res SUBSTATUS_CHARGED, [hl] ld hl, CouldntStayAirborneText jp StdBattleTextbox .fail jp AnimateAndPrintFailedMove2 GetGravityAccuracyMultiplier: ld a, [wGravityCount] and a ret z ld h, 0 ld l, b ld c, b ld b, 0 add hl, hl add hl, hl add hl, bc xor a ldh [hDividend + 0], a ldh [hDividend + 1], a ld a, h ldh [hDividend + 2], a ld a, l ldh [hDividend + 3], a ld a, 3 ldh [hDivisor], a ld a, 4 call Divide ldh a, [hQuotient + 2] and a jr nz, .overflow ldh a, [hQuotient + 3] ld b, a ret .overflow ld b, -1 ret BattleCommand_trickroom: ld hl, wTrickRoomCount ld a, [hl] and a jr z, .set_trick_room xor a ld [hl], a ld hl, UserRestoredDimensionText jp StdBattleTextbox .set_trick_room ld a, 5 ld [hl], a ld hl, UserTwistedDimensionText jp StdBattleTextbox BattleCommand_healblock: ld hl, wPlayerHealBlockCount ldh a, [hBattleTurn] and a jr nz, .go ld hl, wEnemyHealBlockCount .go ld a, [hl] and a jr nz, .fail ld a, 5 ld [hl], a ld hl, HealBlockText jp StdBattleTextbox .fail jp AnimateAndPrintFailedMove2 BattleCommand_payback: farcall CheckOpponentWentFirst ret z ld a, d add a ld d, a ret CheckIfTargetIsFireType: ld b, FIRE farcall CheckIfTargetIsType ret CheckIfTargetIsIceType: ld b, ICE farcall CheckIfTargetIsType ret BattleCommand_freeze: ; freeze ld hl, DoesntAffectText ld a, [wTypeModifier] and $7f jp z, .failed call CheckIfTargetIsIceType jp z, .failed ld a, BATTLE_VARS_STATUS_OPP call GetBattleVar bit FRZ, a jp nz, .frozen ld a, [wTypeModifier] and $7f jp z, .didnt_affect farcall GetOpponentItem ld a, b cp HELD_PREVENT_FREEZE jr nz, .no_item_protection ld a, [hl] ld [wNamedObjectIndexBuffer], a call GetItemName farcall AnimateFailedMove ld hl, ProtectedByText jp StdBattleTextbox .no_item_protection ldh a, [hBattleTurn] and a jr z, .dont_sample_failure ld a, [wLinkMode] and a jr nz, .dont_sample_failure ld a, [wInBattleTowerBattle] and a jr nz, .dont_sample_failure ld a, [wPlayerSubStatus5] bit SUBSTATUS_LOCK_ON, a jr nz, .dont_sample_failure call BattleRandom cp 25 percent + 1 ; 25% chance AI fails jr c, .failed .dont_sample_failure ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarAddr and a jr nz, .failed ld a, [wAttackMissed] and a jr nz, .failed farcall CheckSubstituteOpp jr nz, .failed ld c, 30 call DelayFrames call AnimateCurrentMove2 ld a, $1 ldh [hBGMapMode], a ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarAddr set FRZ, [hl] call UpdateOpponentInParty call UpdateBattleHuds ld hl, WasFrozenText call StdBattleTextbox ld hl, UseHeldStatusHealingItem jp CallBattleCore2 .frozen farcall AnimateFailedMove ld hl, AlreadyFrozenText jp StdBattleTextbox .didnt_affect farcall AnimateFailedMove farjump PrintDoesntAffect .failed farjump PrintDidntAffect2 BattleCommand_burn: ; burn ld hl, DoesntAffectText ld a, [wTypeModifier] and $7f jp z, .failed call CheckIfTargetIsFireType jp z, .failed ld a, BATTLE_VARS_STATUS_OPP call GetBattleVar bit BRN, a jp nz, .burned ld a, [wTypeModifier] and $7f jp z, .didnt_affect farcall GetOpponentItem ld a, b cp HELD_PREVENT_BURN jr nz, .no_item_protection ld a, [hl] ld [wNamedObjectIndexBuffer], a call GetItemName farcall AnimateFailedMove ld hl, ProtectedByText jp StdBattleTextbox .no_item_protection ldh a, [hBattleTurn] and a jr z, .dont_sample_failure ld a, [wLinkMode] and a jr nz, .dont_sample_failure ld a, [wInBattleTowerBattle] and a jr nz, .dont_sample_failure ld a, [wPlayerSubStatus5] bit SUBSTATUS_LOCK_ON, a jr nz, .dont_sample_failure call BattleRandom cp 25 percent + 1 ; 25% chance AI fails jr c, .failed .dont_sample_failure ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarAddr and a jr nz, .failed ld a, [wAttackMissed] and a jr nz, .failed farcall CheckSubstituteOpp jr nz, .failed ld c, 30 call DelayFrames call AnimateCurrentMove2 ld a, $1 ldh [hBGMapMode], a ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarAddr set BRN, [hl] call UpdateOpponentInParty ld hl, ApplyBrnEffectOnAttack call CallBattleCore2 call UpdateBattleHuds ld hl, WasBurnedText call StdBattleTextbox ld hl, UseHeldStatusHealingItem jp CallBattleCore2 .burned farcall AnimateFailedMove ld hl, AlreadyBurnedText jp StdBattleTextbox .didnt_affect farcall AnimateFailedMove farjump PrintDoesntAffect .failed farjump PrintDidntAffect2 BattleCommand_traptarget: ; traptarget ld a, [wAttackMissed] and a ret nz ld hl, wEnemyWrapCount ld de, wEnemyTrappingMove ldh a, [hBattleTurn] and a jr z, .got_trap ld hl, wPlayerWrapCount ld de, wPlayerTrappingMove .got_trap ld a, [hl] and a ret nz ld a, BATTLE_VARS_SUBSTATUS4_OPP call GetBattleVar bit SUBSTATUS_SUBSTITUTE, a ret nz call BattleRandom ; trapped for 2-5 turns and %11 inc a inc a inc a ld [hl], a ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar ld [de], a call GetMoveIndexFromID ld b, h ld c, l ld hl, .Traps .find_trap_text ld a, [hli] cp c ld a, [hli] jr nz, .next_trap_text cp b jr z, .found_trap_text .next_trap_text inc hl inc hl jr .find_trap_text .found_trap_text ld a, [hli] ld h, [hl] ld l, a jp StdBattleTextbox .Traps: dw BIND, UsedBindText ; 'used BIND on' dw WRAP, WrappedByText ; 'was WRAPPED by' dw FIRE_SPIN, FireSpinTrapText ; 'was trapped!' dw CLAMP, ClampedByText ; 'was CLAMPED by' dw WHIRLPOOL, WhirlpoolTrapText ; 'was trapped!' dw SAND_TOMB, SandTombTrapText ; 'was trapped by SAND TOMB!' dw MAGMA_STORM, MagmaStormTrapText ; 'became trapped by...' BattleCommand_crushgrip: call BattleCommand_switchturn ld d, 120 call BattleCommand_lifepower jp BattleCommand_switchturn WonderGuardCheck: push bc push de call .check pop de pop bc ret .check ; special case, if using Fire Fang, it works! ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar ld bc, FIRE_FANG call CompareMove2 jr z, .ok ; otherwise, get relevant information ldh a, [hBattleTurn] and a ld de, wBattleMonType ld a, [wBattleMonSpecies] jr nz, .go ld de, wEnemyMonType ld a, [wEnemyMonSpecies] .go call GetPokemonIndexFromID ld a, h cp HIGH(SHEDINJA) jr nz, .ok ld a, l cp LOW(SHEDINJA) jr nz, .ok ld a, [de] ld [wTypeMatchupBuffer], a inc de ld a, [de] ld [wTypeMatchupBuffer + 1], a farcall2 GetCurrentMoveType2 ld [wTypeMatchupBuffer + 2], a farcall CheckAnyTypeMatchup ld a, [wTypeMatchup] cp 11 jr nc, .ok and a ret .ok scf ret BattleCommand_yawn: ; fail if opponent has status already ld a, BATTLE_VARS_STATUS_OPP call GetBattleVar and a jr nz, .fail ; fail if opponent has sub ld a, BATTLE_VARS_SUBSTATUS4_OPP call GetBattleVar bit SUBSTATUS_SUBSTITUTE, a jr nz, .fail ; fail if opponent is uproaring ld a, BATTLE_VARS_SUBSTATUS6_OPP call GetBattleVar bit SUBSTATUS_UPROAR, a jr nz, .fail ; fail if already yawned or opponent has safeguard ldh a, [hBattleTurn] and a ld hl, wPlayerScreens ld de, wPlayerYawnTimer jr nz, .go ld hl, wEnemyScreens ld de, wEnemyYawnTimer .go ld a, [de] and a jr nz, .fail bit SCREENS_SAFEGUARD, [hl] jr nz, .fail ; set yawn ld a, 2 ld [de], a call AnimateCurrentMove2 ld hl, MadeDrowsyText jp StdBattleTextbox .fail jp AnimateAndPrintFailedMove2 DoGrudgeEffect: ldh a, [hBattleTurn] and a ld a, [wCurPlayerMove] jr z, .ok1 ld a, [wCurEnemyMove] .ok1 ld [wNamedObjectIndexBuffer], a call GetMoveName call .drain_mon_pp ld hl, LostPPDueToGrudgeText call StdBattleTextbox ret .drain_mon_pp ldh a, [hBattleTurn] and a ld hl, wBattleMonPP jr z, .go ld hl, wEnemyMonPP .go call .drain_pp ldh a, [hBattleTurn] and a ld hl, wPartyMon1PP ld a, [wCurBattleMon] jr z, .player ld a, [wBattleMode] dec a jr z, .wild ld hl, wOTPartyMon1PP ld a, [wCurOTMon] .player call GetPartyLocation push hl farcall CheckMimicUsed pop hl ret c jr .drain_pp .wild ld hl, wWildMonPP .drain_pp ldh a, [hBattleTurn] and a ld a, [wCurMoveNum] jr z, .ok ld a, [wCurEnemyMoveNum] .ok ld c, a ld b, 0 add hl, bc ld a, [hl] and PP_UP_MASK ld [hl], a ret BattleCommand_doubleminimizedamage: ; doubleminimizedamage ld hl, wEnemyMinimized ldh a, [hBattleTurn] and a jr z, .ok ld hl, wPlayerMinimized .ok ld a, [hl] and a ret z ld hl, wCurDamage + 1 sla [hl] dec hl rl [hl] ret nc ld a, $ff ld [hli], a ld [hl], a ret BattleCommand_grudge: ld a, BATTLE_VARS_SUBSTATUS2 call GetBattleVarAddr set SUBSTATUS_GRUDGE, [hl] call AnimateCurrentMove2 ld hl, BearAGrudgeText jp StdBattleTextbox INCLUDE "engine/battle/move_effects/u_turn.asm" BattleCommand_secretpoweranim: call GetEnvironmentType ld hl, SecretPowerTypeData ld de, 6 call IsInArray jr nc, .error inc hl ld a, [hli] ld h, [hl] ld l, a call GetMoveIDFromIndex push af ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVarAddr pop af ld [hl], a farcall BattleCommand_moveanim ret .error call AnimateAndPrintFailedMove2 farcall EndMoveEffect ret BattleCommand_secretpowereffect: call GetEnvironmentType ld hl, SecretPowerTypeData ld de, 6 call IsInArray jr nc, .error inc hl inc hl inc hl ld a, [hli] push af ld a, [hli] ld h, [hl] ld l, a pop af rst FarCall ret .error call AnimateAndPrintFailedMove2 farcall EndMoveEffect ret SecretPowerLowerAccuracy: ld b, ACCURACY ld a, STAT_LOWER | STAT_SECONDARY | STAT_TARGET farcall2 FarChangeStat ret SecretPowerLowerAttack: ld b, ATTACK ld a, STAT_LOWER | STAT_SECONDARY | STAT_TARGET farcall2 FarChangeStat ret SecretPowerSleep: xor a ld [wNumHits], a farcall CheckSubstituteOpp ret nz ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarAddr and a ret nz ; ld a, [wTypeModifier] ; and $7f ; ret z farcall GetOpponentItem ld a, b cp HELD_PREVENT_SLEEP ret z ld a, [wPlayerSubStatus6] bit SUBSTATUS_UPROAR, a ret nz ld a, [wEnemySubStatus6] bit SUBSTATUS_UPROAR, a ret nz ld a, [wEffectFailed] and a ret nz farcall SafeCheckSafeguard ret nz ld a, BATTLE_VARS_STATUS_OPP call GetBattleVarAddr ld d, h ld e, l farjump SetSleep INCLUDE "data/moves/secret_power.asm" INCLUDE "engine/battle/move_effects/magnitude.asm" CheckUserTruant: ldh a, [hBattleTurn] and a ld hl, wBattleMonSpecies ld a, [wPlayerPseudoAbilityFlags] jr z, .go ld hl, wEnemyMonSpecies ld a, [wEnemyPseudoAbilityFlags] .go bit TRUANT, a jr z, .no ld a, [hl] call GetPokemonIndexFromID ; is it Slakoth? ld a, h cp HIGH(SLAKOTH) jr nz, .not_slakoth ld a, l cp LOW(SLAKOTH) jr z, .yes .not_slakoth ; is it Slaking? ld a, h cp HIGH(SLAKING) jr nz, .no ld a, l cp LOW(SLAKING) jr z, .yes .no and a ret .yes farcall EndMoveEffect ld hl, TruantText call StdBattleTextbox ; if charging+not visible, appear sprite ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVar and (1 << SUBSTATUS_FLYING) | (1 << SUBSTATUS_UNDERGROUND) jr z, .appear ldh a, [hBattleTurn] and a ld a, [wPlayerUnderwater] jr z, .got_underwater ld a, [wEnemyUnderwater] .got_underwater and a jr z, .finish .appear farcall AppearUserRaiseSub .finish scf ret BattleCommand_checkwish: ld hl, wPlayerWishCount ldh a, [hBattleTurn] and a jr z, .ok ld hl, wEnemyWishCount .ok ld a, [hl] and a ret z cp 1 ret nz ld b, wish_command farjump SkipToBattleCommand BattleCommand_wish: farcall CheckUserIsCharging jr nz, .AlreadyCharging ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar ld b, a ld a, BATTLE_VARS_LAST_COUNTER_MOVE call GetBattleVarAddr ld [hl], b ld a, BATTLE_VARS_LAST_MOVE call GetBattleVarAddr ld [hl], b .AlreadyCharging ld hl, wPlayerWishCount ldh a, [hBattleTurn] and a jr z, .GotCount ld hl, wEnemyWishCount .GotCount ld a, [hl] and a jr nz, .failed ld a, 3 ld [hl], a farcall BattleCommand_lowersub farcall BattleCommand_movedelay ld hl, MadeAWishText call StdBattleTextbox farcall BattleCommand_raisesub farjump EndMoveEffect .failed call AnimateAndPrintFailedMove2 farjump EndMoveEffect BattleCommand_magiccoat: farcall CheckOpponentWentFirst jr nz, .fail ld a, BATTLE_VARS_SUBSTATUS2 call GetBattleVarAddr set SUBSTATUS_MAGIC_COAT, [hl] call AnimateCurrentMove2 ld hl, MagicCoatText jp StdBattleTextbox .fail jp AnimateAndPrintFailedMove2 BattleCommand_snatch: farcall CheckOpponentWentFirst jr nz, .fail ld a, BATTLE_VARS_SUBSTATUS2 call GetBattleVarAddr set SUBSTATUS_SNATCH, [hl] call AnimateCurrentMove2 ld hl, WaitsForMoveText jp StdBattleTextbox .fail jp AnimateAndPrintFailedMove2 BattleCommand_checkmagiccoat: ld a, BATTLE_VARS_SUBSTATUS2_OPP call GetBattleVarAddr bit SUBSTATUS_MAGIC_COAT, [hl] ret z res SUBSTATUS_MAGIC_COAT, [hl] ld hl, BouncedBackText push hl jr MagicCoatSnatchDoMove BattleCommand_checksnatch: ld a, BATTLE_VARS_SUBSTATUS2_OPP call GetBattleVarAddr bit SUBSTATUS_SNATCH, [hl] ret z res SUBSTATUS_SNATCH, [hl] ld hl, SnatchedMoveText push hl MagicCoatSnatchDoMove: ; get move name ld a, BATTLE_VARS_MOVE call GetBattleVar ld [wNamedObjectIndexBuffer], a call GetMoveName ; display bounce back/snatch text pop hl call StdBattleTextbox ; backup and replace enemy move call BattleCommand_switchturn ld a, BATTLE_VARS_MOVE call GetBattleVarAddr ld a, [hl] push af push hl call BattleCommand_switchturn ld a, BATTLE_VARS_MOVE call GetBattleVar ld b, a call BattleCommand_switchturn pop hl ld [hl], b push hl farcall UpdateMoveData farcall ResetTurn ; restore old move pop hl pop af ld [hl], a farcall UpdateMoveData call BattleCommand_switchturn ret BattleCommand_suckerpunch: farcall CheckOpponentWentFirst jr nz, .fail call BattleCommand_switchturn ld a, BATTLE_VARS_MOVE_TYPE call GetBattleVar push af call BattleCommand_switchturn pop af and CATEGORY_MASK cp STATUS jr z, .fail ret .fail call AnimateAndPrintFailedMove2 farjump EndMoveEffect BattleCommand_luckychant: ldh a, [hBattleTurn] and a ld hl, wPlayerLuckyChantCount jr z, .go ld hl, wEnemyLuckyChantCount .go ld a, [hl] and a jr nz, .fail ld a, 5 ld [hl], a call AnimateCurrentMove2 ld hl, ShieldedFromCritText jp StdBattleTextbox .fail jp AnimateAndPrintFailedMove2 BattleCommand_defog: ldh a, [hBattleTurn] and a ld hl, wEnemyScreens jr z, .go ld hl, wPlayerScreens .go ; reflect bit SCREENS_REFLECT, [hl] jr z, .skip_reflect ld bc, REFLECT call .show_blew_away_text .skip_reflect ; light screen bit SCREENS_LIGHT_SCREEN, [hl] jr z, .skip_light_screen ld bc, LIGHT_SCREEN call .show_blew_away_text .skip_light_screen ; safeguard bit SCREENS_SAFEGUARD, [hl] jr z, .skip_safeguard ld bc, SAFEGUARD call .show_blew_away_text .skip_safeguard ; spikes ld a, [hl] and MASK_SPIKES jr z, .skip_spikes ld bc, SPIKES call .show_blew_away_text .skip_spikes ; toxic spikes ld a, [hl] and MASK_TOXIC_SPIKES jr z, .skip_toxic_spikes ld bc, TOXIC_SPIKES call .show_blew_away_text .skip_toxic_spikes ; stealth rock bit SCREENS_STEALTH_ROCK, [hl] jr z, .skip_stealth_rock ld bc, STEALTH_ROCK call .show_blew_away_text .skip_stealth_rock xor a ld [hl], a ret .show_blew_away_text push hl ld h, b ld l, c call GetMoveIDFromIndex ld [wNamedObjectIndexBuffer], a call GetMoveName ld hl, DefogBlewAwayText call StdBattleTextbox pop hl ret BattleCommand_psychoshift: ; heal user ld a, BATTLE_VARS_STATUS call GetBattleVarAddr ld a, [hl] and a jp z, .fail ld b, a xor a ld [hl], a ; status opponent ; remember old opponent status, if it didn't change the move failed ld a, BATTLE_VARS_STATUS_OPP call GetBattleVar push af push bc ld a, b cp (1 << PSN) jr z, .poison cp (1 << BRN) jr z, .burn cp (1 << FRZ) jr z, .freeze cp (1 << PAR) jr z, .paralyze ;sleep farcall BattleCommand_sleeptarget jr .finish .poison ; don't poison steel types ; (poison type check is already taken care of) ldh a, [hBattleTurn] and a ld hl, wBattleMonType jr nz, .got_type ld hl, wEnemyMonType .got_type ld a, [hli] cp STEEL jr z, .fail2 ld a, [hl] cp STEEL jr z, .fail2 ; check for badly poison ld a, BATTLE_VARS_SUBSTATUS5 call GetBattleVarAddr bit SUBSTATUS_TOXIC, [hl] jr nz, .toxic farcall BattleCommand_poison jr .finish .toxic ; fake using toxic res SUBSTATUS_TOXIC, [hl] ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVarAddr push af push hl ld a, EFFECT_TOXIC ld [hl], a farcall BattleCommand_poison pop hl pop af ld [hl], a jr .finish .burn call BattleCommand_burn jr .finish .freeze call BattleCommand_freeze jr .finish .paralyze farcall BattleCommand_paralyze .finish pop bc pop af ld c, a ld a, BATTLE_VARS_STATUS_OPP call GetBattleVar cp c jr nz, .update_party ; if it failed, restore old status ld a, BATTLE_VARS_STATUS call GetBattleVarAddr ld [hl], b .update_party call UpdateBattleMonInParty call UpdateEnemyMonInParty ret .fail2 pop bc pop af .fail jp AnimateAndPrintFailedMove2 BattleCommand_pluck: ldh a, [hBattleTurn] and a ld hl, wEnemyMonItem ld de, wEnemyRecycleMemory ld a, [wCurOTMon] jr z, .go ld hl, wBattleMonItem ld de, wPlayerRecycleMemory ld a, [wCurBattleMon] .go ; get recycle memory location now push hl ld h, 0 ld l, a add hl, de ld d, h ld e, l pop hl ; is opponent's item a berry? ld a, [hl] push de push hl ld hl, .berry_list ld de, 3 call IsInArray ld b, h ld c, l pop hl pop de ret nc ; consume berry, put it into recycle memory ld a, [hl] ld [de], a xor a ld [hl], a ; update item in party ldh a, [hBattleTurn] and a ld a, [wCurBattleMon] ld hl, wPartyMon1Item jr nz, .do_party ld a, [wBattleMode] dec a jr z, .skip_party ld a, [wCurOTMon] ld hl, wOTPartyMon1Item .do_party call GetPartyLocation xor a ld [hl], a .skip_party ; don't actiavte effect if under embargo ld a, BATTLE_VARS_SUBSTATUS2 call GetBattleVar bit SUBSTATUS_EMBARGO, a ret nz ; activate effect ld a, [bc] inc bc ld [wNamedObjectIndexBuffer], a call GetItemName ld a, [bc] ld l, a inc bc ld a, [bc] ld h, a jp hl .berry ld bc, 10 jr .heal_hp .gold ld bc, 30 .heal_hp ldh a, [hBattleTurn] ld hl, wBattleMonHP jr z, .got_hp ld hl, wEnemyMonHP .got_hp push bc ld a, [hli] ld b, a ld a, [hli] ld c, a ld a, [hli] ld d, a ld a, [hl] ld e, a ld a, d cp b jr nz, .do_heal ld a, e cp c pop bc ret z .do_heal push bc call BattleCommand_switchturn farcall ItemRecoveryAnim pop bc farcall RestoreHP call BattleCommand_switchturn ld hl, PluckText call StdBattleTextbox ret .mystery ldh a, [hBattleTurn] and a jr z, .mystery_berry_player ld a, [wBattleMode] dec a jr z, .mystery_berry_wild ld a, [wCurOTMon] ld [wCurPartyMon], a ld a, OTPARTYMON ld [wMonType], a jr .do_mystery_berry .mystery_berry_wild ld a, WILDMON ld [wMonType], a jr .do_mystery_berry .mystery_berry_player ld a, [wCurBattleMon] ld [wCurPartyMon], a ld a, PARTYMON ld [wMonType], a .do_mystery_berry farcall ForceMysteryBerryEffect ret nc call BattleCommand_switchturn farcall ItemRecoveryAnim call BattleCommand_switchturn ld hl, PluckText call StdBattleTextbox ret .miracle ld b, HELD_HEAL_STATUS jr .heal_status .mint ld b, HELD_HEAL_SLEEP jr .heal_status .burnt ld b, HELD_HEAL_FREEZE jr .heal_status .ice ld b, HELD_HEAL_BURN jr .heal_status .bitter ld b, HELD_HEAL_CONFUSION call BattleCommand_switchturn farcall UseConfusionHealingItemAlt call BattleCommand_switchturn ld hl, PluckText call StdBattleTextbox ret .przcure ld b, HELD_HEAL_PARALYZE jr .heal_status .psncure ld b, HELD_HEAL_POISON .heal_status call BattleCommand_switchturn farcall UseStatusHealingItemEffect call BattleCommand_switchturn ld hl, PluckText call StdBattleTextbox ret .berry_list dbw BERRY, .berry dbw GOLD_BERRY, .gold dbw MYSTERYBERRY, .mystery dbw MIRACLEBERRY, .miracle dbw MINT_BERRY, .mint dbw BURNT_BERRY, .burnt dbw ICE_BERRY, .ice dbw BITTER_BERRY, .bitter dbw PRZCUREBERRY, .przcure dbw PSNCUREBERRY, .psncure db -1 BattleCommand_healingwish: ldh a, [hBattleTurn] and a jr nz, .enemy ; check for valid switch in farcall CheckAnyOtherAlivePartyMons jr z, .fail ; play anim call AnimateCurrentMove2 ; set flag ld a, 1 ld [wPlayerHealingWishFlag], a ret .enemy ; fail in wild battles ld a, [wBattleMode] dec a jr z, .fail ; check for valid switch in farcall CheckAnyOtherAliveEnemyMons jr z, .fail ; play anim call AnimateCurrentMove2 ; set flag ld a, 1 ld [wPlayerHealingWishFlag], a ret .fail call AnimateAndPrintFailedMove2 farjump EndMoveEffect BattleCommand_lunardance: ldh a, [hBattleTurn] and a jr nz, .enemy ; check for valid switch in farcall CheckAnyOtherAlivePartyMons jr z, .fail ; play anim call AnimateCurrentMove2 ; set flag ld a, 2 ld [wPlayerHealingWishFlag], a ret .enemy ; fail in wild battles ld a, [wBattleMode] dec a jr z, .fail ; check for valid switch in farcall CheckAnyOtherAliveEnemyMons jr z, .fail ; play anim call AnimateCurrentMove2 ; set flag ld a, 2 ld [wPlayerHealingWishFlag], a ret .fail call AnimateAndPrintFailedMove2 farjump EndMoveEffect BattleCommand_naturalgift: push bc push de ldh a, [hBattleTurn] and a ld a, [wBattleMonItem] jr z, .go ld a, [wEnemyMonItem] .go and a jr z, .fail ld hl, NaturalGiftItemTable ld de, 3 call IsInArray jr nc, .fail inc hl ld d, [hl] push hl ld a, BATTLE_VARS_MOVE_TYPE call GetBattleVarAddr ld a, [hl] and CATEGORY_MASK or d ld [hl], a pop hl inc hl pop de ld d, [hl] pop bc ret .fail call AnimateAndPrintFailedMove2 farjump EndMoveEffect BattleCommand_forceconsumeholditem: ldh a, [hBattleTurn] and a jr nz, .enemy ld a, [wCurPartyMon] ld hl, wPartyMon1Item call GetPartyLocation ld a, [hl] push af xor a ld [hl], a ld [wBattleMonItem], a ld hl, wPlayerRecycleMemory pop af ret .enemy xor a ld [wEnemyMonItem], a ld a, [wBattleMode] dec a ret z ; don't update party for wild mon ld a, [wCurOTMon] ld hl, wOTPartyMon1Item call GetPartyLocation xor a ld [hl], a ret INCLUDE "data/moves/natural_gift.asm" BattleCommand_powertrick: ld a, BATTLE_VARS_SUBSTATUS2 call GetBattleVarAddr ld a, [hl] xor (1 << SUBSTATUS_POWER_TRICK) ld [hl], a call AnimateCurrentMove2 ld hl, PowerTrickText call StdBattleTextbox jp CalcBothMonStats ApplyPowerTrick: ldh a, [hBattleTurn] and a jr nz, .enemy ld a, [wPlayerSubStatus2] bit SUBSTATUS_POWER_TRICK, a ret z ld hl, wBattleMonStats jr .swap_stats .enemy ld a, [wEnemySubStatus2] bit SUBSTATUS_POWER_TRICK, a ret z ld hl, wEnemyMonStats .swap_stats push bc push de ; get attack ld a, [hli] ld b, a ld a, [hli] ld c, a ; get defense and put attack ld a, [hli] ld d, a ld a, [hl] ld e, a ld [hl], c dec hl ld [hl], b dec hl ; put defense ld [hl], e dec hl ld [hl], d pop de pop bc ret BattleCommand_curl: ; curl ld a, BATTLE_VARS_SUBSTATUS2 call GetBattleVarAddr set SUBSTATUS_CURLED, [hl] ret BattleCommand_punishment: ldh a, [hBattleTurn] and a ld hl, wPlayerStatLevels jr z, .go ld hl, wEnemyStatLevels .go push bc push de ld e, 3 ld d, NUM_LEVEL_STATS .loop ld a, [hli] sub 7 jr c, .next add e ld e, a .next dec d jr nz, .loop ld a, e cp 11 jr c, .no_overflow ld e, 10 .no_overflow ld a, e ld hl, 0 ld bc, 20 call AddNTimes ld a, l pop de ld d, a pop bc ret BattleCommand_copycat: ld a, [wLastCopycatMove] and a jr z, .fail call AnimateCurrentMove2 ld a, BATTLE_VARS_MOVE call GetBattleVarAddr ld a, [wLastCopycatMove] ld [hl], a farcall UpdateMoveData farjump ResetTurn .fail call AnimateAndPrintFailedMove2 ret BattleCommand_mefirst: farcall CheckOpponentWentFirst jr nz, .fail ldh a, [hBattleTurn] and a ld de, wCurPlayerMove jr nz, .go ld de, wCurEnemyMove .go ld a, [de] call IsStatusMove jr c, .fail call GetMoveIndexFromID ld b, h ld c, l ld hl, MeFirstUncallableMoves push de ld de, 2 call IsInHalfwordArray pop de jr c, .fail ldh a, [hBattleTurn] and a ld hl, wPlayerMeFirst jr z, .got_mefirst ld hl, wEnemyMeFirst .got_mefirst ld a, 1 ld [hl], a call AnimateCurrentMove2 ld a, BATTLE_VARS_MOVE call GetBattleVarAddr ld a, [de] ld [hl], a farcall UpdateMoveData farjump ResetTurn .fail call AnimateAndPrintFailedMove2 ret INCLUDE "data/moves/me_first_uncallable.asm" SelfdestructDefenseMultiplier: ; If user used Me First, multiply defense by 2/3 ; Otherwise, Me First multiplier would overflow ldh a, [hBattleTurn] and a ld a, [wPlayerMeFirst] jr z, .got_me_first ld a, [wEnemyMeFirst] .got_me_first and a jr z, .apply_selfdestruct call MeFirstSeldestruct .apply_selfdestruct srl c ret nz inc c ret MeFirstSeldestruct: push bc ld a, c ld c, 3 call SimpleDivide ld a, b add a pop bc ld c, a ret MeFirstDamageMultiplier: ; If user used Me First, multiply power by 1.5, max of 255 ldh a, [hBattleTurn] and a ld a, [wPlayerMeFirst] jr z, .ok ld a, [wEnemyMeFirst] .ok and a ret z ld a, d rrca add d ld d, a ret nc ld d, $ff ret BattleCommand_clearmissdamage: ; clearmissdamage ld a, [wAttackMissed] and a ret z farcall ResetDamage ret BattleCommand_flingdamage: ld a, BATTLE_VARS_SUBSTATUS2 call GetBattleVar bit SUBSTATUS_EMBARGO, a jr nz, .fail ldh a, [hBattleTurn] and a ld hl, wBattleMonItem jr z, .go ld hl, wEnemyMonItem .go ld a, [hl] and a jr z, .fail push bc dec a ld c, a ld b, 0 ld hl, FlingDamage add hl, bc pop bc ld a, [hl] cp -1 jr z, .fail ld d, a ret .fail call AnimateAndPrintFailedMove2 farjump EndMoveEffect BattleCommand_flingeffect: ld a, BATTLE_VARS_SUBSTATUS2_OPP call GetBattleVar bit SUBSTATUS_EMBARGO, a ret nz ldh a, [hBattleTurn] and a ld hl, wBattleMonItem jr z, .go ld hl, wEnemyMonItem .go ld a, [hl] ld hl, FlingBerryEffects ld de, 3 call IsInArray jr c, .berry ld a, c ld hl, FlingEffects ld de, 4 call IsInArray ret nc xor a ld [wEffectFailed], a inc hl ld a, [hli] push af ld a, [hli] ld h, [hl] ld l, a pop af rst FarCall ret .berry inc hl ld a, [hli] ld h, [hl] ld l, a jp hl FlingBerryEffects: dbw BERRY, .berry dbw GOLD_BERRY, .gold dbw MYSTERYBERRY, .mystery dbw MIRACLEBERRY, .miracle dbw MINT_BERRY, .mint dbw BURNT_BERRY, .burnt dbw ICE_BERRY, .ice dbw BITTER_BERRY, .bitter dbw PRZCUREBERRY, .przcure dbw PSNCUREBERRY, .psncure db -1 .berry ld bc, 10 jr .heal_hp .gold ld bc, 30 .heal_hp ldh a, [hBattleTurn] ld hl, wBattleMonHP jr nz, .got_hp ld hl, wEnemyMonHP .got_hp push bc ld a, [hli] ld b, a ld a, [hli] ld c, a ld a, [hli] ld d, a ld a, [hl] ld e, a ld a, d cp b jr nz, .do_heal ld a, e cp c pop bc ret z .do_heal push bc ; call BattleCommand_switchturn farcall ItemRecoveryAnim pop bc farcall RestoreHP ; call BattleCommand_switchturn ; ld hl, PluckText ; call StdBattleTextbox ret .mystery ldh a, [hBattleTurn] and a jr z, .mystery_berry_player ld a, [wBattleMode] dec a jr z, .mystery_berry_wild ld a, [wCurOTMon] ld [wCurPartyMon], a ld a, OTPARTYMON ld [wMonType], a jr .do_mystery_berry .mystery_berry_wild ld a, WILDMON ld [wMonType], a jr .do_mystery_berry .mystery_berry_player ld a, [wCurBattleMon] ld [wCurPartyMon], a ld a, PARTYMON ld [wMonType], a .do_mystery_berry call BattleCommand_switchturn farcall ForceMysteryBerryEffect ret nc call BattleCommand_switchturn farcall ItemRecoveryAnim ; ld hl, PluckText ; call StdBattleTextbox ret .miracle ld b, HELD_HEAL_STATUS jr .heal_status .mint ld b, HELD_HEAL_SLEEP jr .heal_status .burnt ld b, HELD_HEAL_FREEZE jr .heal_status .ice ld b, HELD_HEAL_BURN jr .heal_status .bitter ld b, HELD_HEAL_CONFUSION ; call BattleCommand_switchturn farcall UseConfusionHealingItemAlt ; call BattleCommand_switchturn ; ld hl, PluckText ; call StdBattleTextbox ret .przcure ld b, HELD_HEAL_PARALYZE jr .heal_status .psncure ld b, HELD_HEAL_POISON .heal_status ; call BattleCommand_switchturn farcall UseStatusHealingItemEffect ; call BattleCommand_switchturn ; ld hl, PluckText ; call StdBattleTextbox ret INCLUDE "data/moves/fling_damage.asm" FlingPoisonEffect: ; don't poison steel types ; (poison type check is already taken care of) ldh a, [hBattleTurn] and a ld hl, wBattleMonType jr nz, .go ld hl, wEnemyMonType .go ld a, [hli] cp STEEL ret z ld a, [hl] cp STEEL ret z farjump BattleCommand_poisontarget BattleCommand_embargo: ld a, [wAttackMissed] and a jr nz, .fail ld a, BATTLE_VARS_SUBSTATUS2_OPP call GetBattleVarAddr bit SUBSTATUS_EMBARGO, [hl] jr nz, .fail set SUBSTATUS_EMBARGO, [hl] ld hl, EmbargoText jp StdBattleTextbox .fail jp AnimateAndPrintFailedMove2 BattleCommand_usedmovetext: ; usedmovetext farcall CheckUserTruant ret c farcall DisplayUsedMoveText ret BattleCommand_effectchance: ; effectchance xor a ld [wEffectFailed], a farcall CheckSubstituteOpp jr nz, .failed push hl ld hl, wPlayerMoveStruct + MOVE_CHANCE ldh a, [hBattleTurn] and a jr z, .got_move_chance ld hl, wEnemyMoveStruct + MOVE_CHANCE .got_move_chance ld a, [hl] cp -1 jr z, .ok call BattleRandom cp [hl] pop hl ret c .failed ld a, 1 ld [wEffectFailed], a and a ret .ok pop hl ret
15.557564
186
0.73149
16e003cd967620e5af871dd202fd5e73458d183f
1,093
asm
Assembly
programs/oeis/277/A277975.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/277/A277975.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/277/A277975.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A277975: a(n) = n*x^n + (n-1)*x^(n-1) + . . . + x + 1 for x=5. ; 1,6,56,431,2931,18556,112306,659181,3784181,21362306,119018556,656127931,3585815431,19454956056,104904174806,562667846681,3004074096681,15974044799806,84638595581056,447034835815431,2354383468627931,12367963790893556,64820051193237306,339001417160034181,1769512891769409181,9220093488693237306,47963112592697143556,249128788709640502931,1292210072278976440431,6693881005048751831056,34633558243513107299806,178988557308912277221681,924046617001295089721681,4765752237290143966674806,24556356947869062423706056,126419763546437025070190431,650288711767643690109252931,3342393029015511274337768556,17166712495964020490646362306,88107299234252423048019409181,451905179943423718214035034181,2316369318577926605939865112306,11866063687193673104047775268556,60751403907488565891981124877931,310862446895043831318616867065431,1589839371263224165886640548706056,8126832540256145875900983810424806,41522341120980854611843824386596681,212052597703404899220913648605346681 lpb $0 add $1,$0 sub $0,1 mul $1,5 lpe add $1,1 mov $0,$1
99.363636
962
0.885636
47b00d5a0286f8a4ce204191bef39a355204e68a
1,097
asm
Assembly
run/programs/print.asm
thecodewarrior/KotlinToyCPU
a3e6655efed5fa318d0354ace5141894d4f1176d
[ "MIT" ]
null
null
null
run/programs/print.asm
thecodewarrior/KotlinToyCPU
a3e6655efed5fa318d0354ace5141894d4f1176d
[ "MIT" ]
null
null
null
run/programs/print.asm
thecodewarrior/KotlinToyCPU
a3e6655efed5fa318d0354ace5141894d4f1176d
[ "MIT" ]
null
null
null
#include log.asm ; pcall PTEXT, PRINT_CHAR ; pcall PTEXT, PRINT_ASCIIZ ; pcall PTEXT, PRINT_FMT println: mov 0xA, r0 pcall PTEXT, PRINT_CHAR mov lr, pc print_hex: mov r0, r1 shr r1, 28, r0 and r0, 0xf, r0 ldr'b r0 [:print_hex_digits, r0] pcall PTEXT, PRINT_CHAR shr r1, 24, r0 and r0, 0xf, r0 ldr'b r0 [:print_hex_digits, r0] pcall PTEXT, PRINT_CHAR shr r1, 20, r0 and r0, 0xf, r0 ldr'b r0 [:print_hex_digits, r0] pcall PTEXT, PRINT_CHAR shr r1, 16, r0 and r0, 0xf, r0 ldr'b r0 [:print_hex_digits, r0] pcall PTEXT, PRINT_CHAR shr r1, 12, r0 and r0, 0xf, r0 ldr'b r0 [:print_hex_digits, r0] pcall PTEXT, PRINT_CHAR shr r1, 8, r0 and r0, 0xf, r0 ldr'b r0 [:print_hex_digits, r0] pcall PTEXT, PRINT_CHAR shr r1, 4, r0 and r0, 0xf, r0 ldr'b r0 [:print_hex_digits, r0] pcall PTEXT, PRINT_CHAR shr r1, 0, r0 and r0, 0xf, r0 ldr'b r0 [:print_hex_digits, r0] pcall PTEXT, PRINT_CHAR mov lr, pc print_hex_digits: %data .ascii "0123456789abcdef"
18.913793
49
0.620784
59b1aae498c2a3574de466814809bc4e0f77000a
810
asm
Assembly
programs/oeis/214/A214062.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/214/A214062.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/214/A214062.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A214062: Least m>0 such that gcd(2*n+m, 2*n-1-m) > 1. ; 1,3,5,1,9,11,1,15,2,1,21,23,1,2,29,1,33,35,1,39,41,1,3,2,1,51,53,1,2,3,1,63,65,1,69,5,1,75,2,1,81,83,1,2,89,1,5,95,1,99,3,1,105,2,1,111,113,1,2,119,1,6,125,1,3,131,1,135,2,1,141,3,1,2,6,1,153,155,1,5,8,1,165,2,1,3,173,1,2,179,1,183,3,1,189,191,1,8,2,1,6,5,1,2,209,1,3,215,1,219,221,1,5,2,1,231,233,1,2,239,1,243,245,1,249,251,1,3,2,1,261,8,1,2,3,1,273,9,1,6,281,1,285,2,1,5,293,1,2,299,1,303,6,1,309,3,1,315,2,1,321,323,1,2,329,1,11,5,1,3,341,1,345,2,1,9,3,1,2,359,1,363,8,1,369,371,1,375,2,1,3,6,1,2,9,1,393,3,1,8,5,1,405,2,1,411,413,1,2,419,1,3,11,1,429,431,1,6,2,1,441,443,1,2,14,1,453,455,1,459,6,1,3,2,1,11,473,1,2,3,1,483,485,1,5,491,1,495,2,1 mul $0,2 add $0,1 cal $0,90368 ; a(1) = 1; for n>1, smallest divisor > 1 of 2n-1. mov $1,$0 div $1,2
90
651
0.606173
1cdec7de71f3fc4498d2574a2bf3ca6bcf6691e8
1,851
asm
Assembly
src/drivers/emulations/OPNOnOPNADual.asm
sharksym/vgmplay-sharksym
d7763b87a379da4e6dadcc55026969d310957952
[ "BSD-2-Clause" ]
6
2020-04-21T17:26:27.000Z
2021-09-25T18:41:01.000Z
src/drivers/emulations/OPNOnOPNADual.asm
sharksym/vgmplay-sharksym
d7763b87a379da4e6dadcc55026969d310957952
[ "BSD-2-Clause" ]
null
null
null
src/drivers/emulations/OPNOnOPNADual.asm
sharksym/vgmplay-sharksym
d7763b87a379da4e6dadcc55026969d310957952
[ "BSD-2-Clause" ]
null
null
null
; ; OPN on OPNA (2nd half) + PSG driver ; OPNOnOPNADual_CLOCK: equ 3579545 OPNOnOPNADual: MACRO super: Driver Device_noName, OPNOnOPNADual_CLOCK, OPNOnOPNADual_PrintInfoImpl opnOnOPNADriver: dw 0 psgDriver: dw 0 ; e = register ; d = value SafeWriteRegister: PROC ld a,e cp 20H jp c,System_Return writePSGRegister: equ $ - 2 cp 30H jp nc,System_Return writeFMRegister2: equ $ - 2 set 2,d cp 28H jp System_Return writeFMRegister: equ $ - 2 ENDP ENDM ; ix = this ; iy = drivers OPNOnOPNADual_Construct: call Driver_Construct call OPNOnOPNADual_TryCreateOPNOnOPNA jp nc,Driver_NotFound ld (ix + OPNOnOPNADual.opnOnOPNADriver),e ld (ix + OPNOnOPNADual.opnOnOPNADriver + 1),d ld bc,OPNOnOPNADual.SafeWriteRegister.writeFMRegister call Device_ConnectInterface ld bc,OPNOnOPNADual.SafeWriteRegister.writeFMRegister2 call Device_ConnectInterface call OPNOnOPNADual_TryCreatePSG ret nc ld (ix + OPNOnOPNADual.psgDriver),e ld (ix + OPNOnOPNADual.psgDriver + 1),d ld bc,OPNOnOPNADual.SafeWriteRegister.writePSGRegister jp Device_ConnectInterface ; ix = this OPNOnOPNADual_Destruct: equ System_Return ; ret ; iy = drivers ; ix = this ; de <- driver ; hl <- device interface ; f <- c: succeeded OPNOnOPNADual_TryCreateOPNOnOPNA: push ix ld bc,Drivers.opnOnOPNA call Drivers_TryGet_IY ld e,ixl ld d,ixh pop ix ld hl,OPNOnOPNA_interface ret ; iy = drivers ; ix = this ; de <- driver ; hl <- device interface ; f <- c: succeeded OPNOnOPNADual_TryCreatePSG: equ AY8910_TryCreate ; jp AY8910_TryCreate ; ix = this OPNOnOPNADual_PrintInfoImpl: ld de,OPNOnOPNADual.opnOnOPNADriver call Driver_PrintInfoIXOffset ld de,OPNOnOPNADual.psgDriver jp Driver_PrintInfoIXOffset ; SECTION RAM OPNOnOPNADual_instance: OPNOnOPNADual ENDS OPNOnOPNADual_interface: InterfaceOffset OPNOnOPNADual.SafeWriteRegister
20.119565
78
0.778498
f751990d3a220a229369ddcc8bbc8abd93b4899f
735
asm
Assembly
4/decoder.asm
91fc7b/SLAE
8ba0831963b077cb3739b8bb53ed430cd3b564e0
[ "Unlicense" ]
null
null
null
4/decoder.asm
91fc7b/SLAE
8ba0831963b077cb3739b8bb53ed430cd3b564e0
[ "Unlicense" ]
null
null
null
4/decoder.asm
91fc7b/SLAE
8ba0831963b077cb3739b8bb53ed430cd3b564e0
[ "Unlicense" ]
null
null
null
global _start section .text _start: jmp short call_shellcode decoder: pop esi ; now contains address of the encoded shellcode xor ecx,ecx mov cl,13 ;13 = 26/2, shellcode is decoded 2bytewise (swap) decode: ;swap first byte (esi) and second byte (esi+1) mov al,[esi] ;load first byte to al inc esi mov ah,[esi] ;load second byte to ah mov [esi],al ;load al to second byte dec esi mov [esi],ah ;load ah to first byte ;mov to next 2 bytes add esi,2 ;esi + 2 loop decode jmp short EncodedShellcode call_shellcode: call decoder EncodedShellcode: db 0xc0,0x31,0x68,0x50,0x2f,0x2f,0x68,0x73,0x2f,0x68,0x69,0x62,0x89,0x6e,0x50,0xe3,0xe2,0x89,0x89,0x53,0xb0,0xe1,0xcd,0x0b,0x90,0x80 ;shellcode length = 26
19.864865
151
0.72381
f78d6fb810075334ad26e1545ede2d1bbe6a5d29
2,621
asm
Assembly
Zeus/constants.asm
Threetwosevensixseven/NirvanaPlusCalculator
8fd671df0d4cc16f2b3544e6c5c24f67643a9f11
[ "MIT" ]
null
null
null
Zeus/constants.asm
Threetwosevensixseven/NirvanaPlusCalculator
8fd671df0d4cc16f2b3544e6c5c24f67643a9f11
[ "MIT" ]
null
null
null
Zeus/constants.asm
Threetwosevensixseven/NirvanaPlusCalculator
8fd671df0d4cc16f2b3544e6c5c24f67643a9f11
[ "MIT" ]
null
null
null
; Constants.asm zoLogicOperatorsHighPri = false zoSupportStringEscapes = false Zeus_PC = NStart Zeus_SP = NStart - 2 Zeus_StimDataErase = true TOTAL_ROWS equ 23 ; 1..23 Red equ $52 White equ $7F Cyan equ $6D DarkMagentaBlueP equ $0B DarkMagentaCyanP equ $2B ATTRS_8x8 equ $5800 ATTRS_8x8_END equ $5AFF FRAMES equ 23672 NIRVANA_org equ 56323 ; Note the IM2 table will need manually moving if you relocate NIRVANA+ NIRVANA_relocate_offset equ 56323-NIRVANA_org NIRVANA_end equ NIRVANA_org+9054 NOFS equ NIRVANA_relocate_offset SPRITE_A_LINE equ 56470+0*8 ; Line address (sprite 0) SPRITE_A_COL equ SPRITE_A_LINE-1 ; Column address SPRITE_A_IX equ SPRITE_A_LINE+2 ; Index address SPRITE_B_LINE equ 56470+1*8 ; Line address (sprite 1) SPRITE_B_COL equ SPRITE_B_LINE-1 ; Column address SPRITE_B_IX equ SPRITE_B_LINE+2 ; Index address SPRITE_C_LINE equ 56470+2*8 ; Line address (sprite 2) SPRITE_C_COL equ SPRITE_C_LINE-1 ; Column address SPRITE_C_IX equ SPRITE_C_LINE+2 ; Index address SPRITE_D_LINE equ 56470+3*8 ; Line address (sprite 3) SPRITE_D_COL equ SPRITE_D_LINE-1 ; Column address SPRITE_D_IX equ SPRITE_D_LINE+2 ; Index address SPRITE_E_LINE equ 56470+4*8 ; Line address (sprite 4) SPRITE_E_COL equ SPRITE_E_LINE-1 ; Column address SPRITE_E_IX equ SPRITE_E_LINE+2 ; Index address SPRITE_F_LINE equ 56470+5*8 ; Line address (sprite 5) SPRITE_F_COL equ SPRITE_F_LINE-1 ; Column address SPRITE_F_IX equ SPRITE_F_LINE+2 ; Index address SPRITE_G_LINE equ 56470+6*8 ; Line address (sprite 6) SPRITE_G_COL equ SPRITE_G_LINE-1 ; Column address SPRITE_G_IX equ SPRITE_G_LINE+2 ; Index address SPRITE_H_LINE equ 56470+7*8 ; Line address (sprite 7) SPRITE_H_COL equ SPRITE_H_LINE-1 ; Column address SPRITE_H_IX equ SPRITE_H_LINE+2 ; Index address
55.765957
127
0.539489
0c7ffc0acb677492033a2f6732c44e56baecd826
24,012
asm
Assembly
vanilla/sound library 1.asm
PJBoy/SM-SPC
1345e173d5239132870c0f84603778546de49633
[ "0BSD" ]
4
2019-11-28T19:12:09.000Z
2022-02-04T20:51:06.000Z
vanilla/sound library 1.asm
PJBoy/SM-SPC
1345e173d5239132870c0f84603778546de49633
[ "0BSD" ]
null
null
null
vanilla/sound library 1.asm
PJBoy/SM-SPC
1345e173d5239132870c0f84603778546de49633
[ "0BSD" ]
null
null
null
; $1EE4 goToProcessSound1: { jmp processSound1 } ; $1EE7 handleCpuIo1: { mov y,!cpuIo1_read_prev mov a,!cpuIo1_read : mov !cpuIo1_read_prev,a mov !cpuIo1_write,a cmp y,!cpuIo1_read : bne .branch_change .branch_noChange mov a,!sound1 : bne goToProcessSound1 ret .branch_change cmp a,#$00 : beq .branch_noChange mov a,!cpuIo1_read cmp a,#$02 : beq + cmp a,#$01 : beq + mov a,!sound1Priority : bne .branch_noChange + mov a,!sound1 : beq + mov a,#$00 : mov !sound1_enabledVoices,a call resetSound1Channel0 call resetSound1Channel1 call resetSound1Channel2 call resetSound1Channel3 + mov a,#$00 mov !sound1_channel0_legatoFlag,a mov !sound1_channel1_legatoFlag,a mov !sound1_channel2_legatoFlag,a mov !sound1_channel3_legatoFlag,a mov a,!cpuIo1_write : dec a : asl a : mov !i_sound1,a mov x,!i_sound1 : mov a,sound1InstructionLists+x : mov !sound1_instructionListPointerSet,a : inc x : mov a,sound1InstructionLists+x : mov !sound1_instructionListPointerSet+1,a mov a,!cpuIo1_write : mov !sound1,a call goToJumpTableEntry !sc = sound1Configurations_sound ; Shorthand for the `soundN` sublabels within the sound1Configurations label dw !{sc}1, !{sc}2, !{sc}3, !{sc}4, !{sc}5, !{sc}6, !{sc}7, !{sc}8, !{sc}9, !{sc}A, !{sc}B, !{sc}C, !{sc}D, !{sc}E, !{sc}F, !{sc}10,\ !{sc}11, !{sc}12, !{sc}13, !{sc}14, !{sc}15, !{sc}16, !{sc}17, !{sc}18, !{sc}19, !{sc}1A, !{sc}1B, !{sc}1C, !{sc}1D, !{sc}1E, !{sc}1F, !{sc}20,\ !{sc}21, !{sc}22, !{sc}23, !{sc}24, !{sc}25, !{sc}26, !{sc}27, !{sc}28, !{sc}29, !{sc}2A, !{sc}2B, !{sc}2C, !{sc}2D, !{sc}2E, !{sc}2F, !{sc}30,\ !{sc}31, !{sc}32, !{sc}33, !{sc}34, !{sc}35, !{sc}36, !{sc}37, !{sc}38, !{sc}39, !{sc}3A, !{sc}3B, !{sc}3C, !{sc}3D, !{sc}3E, !{sc}3F, !{sc}40,\ !{sc}41, !{sc}42 } ; $1FD1 processSound1: { mov a,#$FF : cmp a,!sound1_initialisationFlag : beq + call sound1Initialisation mov y,#$00 : mov a,(!sound1_instructionListPointerSet)+y : mov !sound1_channel0_p_instructionList,a : call getSound1ChannelInstructionListPointer : mov !sound1_channel0_p_instructionList+1,a call getSound1ChannelInstructionListPointer : mov !sound1_channel1_p_instructionList,a : call getSound1ChannelInstructionListPointer : mov !sound1_channel1_p_instructionList+1,a call getSound1ChannelInstructionListPointer : mov !sound1_channel2_p_instructionList,a : call getSound1ChannelInstructionListPointer : mov !sound1_channel2_p_instructionList+1,a call getSound1ChannelInstructionListPointer : mov !sound1_channel3_p_instructionList,a : call getSound1ChannelInstructionListPointer : mov !sound1_channel3_p_instructionList+1,a mov a,!sound1_channel0_voiceIndex : call sound1MultiplyBy8 : mov !sound1_channel0_dspIndex,a mov a,!sound1_channel1_voiceIndex : call sound1MultiplyBy8 : mov !sound1_channel1_dspIndex,a mov a,!sound1_channel2_voiceIndex : call sound1MultiplyBy8 : mov !sound1_channel2_dspIndex,a mov a,!sound1_channel3_voiceIndex : call sound1MultiplyBy8 : mov !sound1_channel3_dspIndex,a mov y,#$00 mov !sound1_channel0_i_instructionList,y mov !sound1_channel1_i_instructionList,y mov !sound1_channel2_i_instructionList,y mov !sound1_channel3_i_instructionList,y mov y,#$01 mov !sound1_channel0_instructionTimer,y mov !sound1_channel1_instructionTimer,y mov !sound1_channel2_instructionTimer,y mov !sound1_channel3_instructionTimer,y + %ProcessSoundChannel(1, 0, resetSound1Channel0, getNextSound1Channel0DataByte, 0, 1) %ProcessSoundChannel(1, 1, resetSound1Channel1, getNextSound1Channel1DataByte, 6, 0) %ProcessSoundChannel(1, 2, resetSound1Channel2, getNextSound1Channel2DataByte, 6, 0) %ProcessSoundChannel(1, 3, resetSound1Channel3, getNextSound1Channel3DataByte, 5, 0) ret } ; $2732 resetSound1Channel0: : %ResetSoundChannel(1, 0) : jmp resetSound1IfNoEnabledVoices ; $2775 resetSound1Channel1: : %ResetSoundChannel(1, 1) : jmp resetSound1IfNoEnabledVoices ; $27B8 resetSound1Channel2: : %ResetSoundChannel(1, 2) : jmp resetSound1IfNoEnabledVoices ; $27FB resetSound1Channel3: : %ResetSoundChannel(1, 3) : jmp resetSound1IfNoEnabledVoices ; $283E resetSound1IfNoEnabledVoices: { mov a,!sound1_enabledVoices : bne + mov a,#$00 mov !sound1,a mov !sound1Priority,a mov !sound1_initialisationFlag,a + ret } ; $284F getNextSound1Channel0DataByte: { mov y,!sound1_channel0_i_instructionList : mov a,(!sound1_channel0_p_instructionList)+y : inc !sound1_channel0_i_instructionList ret } ; $2858 getNextSound1Channel1DataByte: { mov y,!sound1_channel1_i_instructionList : mov a,(!sound1_channel1_p_instructionList)+y : inc !sound1_channel1_i_instructionList ret } ; $2861 getNextSound1Channel2DataByte: { mov y,!sound1_channel2_i_instructionList : mov a,(!sound1_channel2_p_instructionList)+y : inc !sound1_channel2_i_instructionList ret } ; $286A getNextSound1Channel3DataByte: { mov y,!sound1_channel3_i_instructionList : mov a,(!sound1_channel3_p_instructionList)+y : inc !sound1_channel3_i_instructionList ret } ; $2873 ; Unused rets ret ret ; $2875 goToJumpTableEntry: { cmp a,#$01 : beq .branch_pointlessSpecialCase dec a : asl a : mov y,a .branch_continue pop a : mov !p_return_word,a : pop a : mov !p_return_word+1,a mov a,(!p_return)+y : mov x,a : inc y : mov a,(!p_return)+y : mov !p_return_word+1,a : mov !p_return_word,x mov x,#$00 : jmp (!p_return_word+x) .branch_pointlessSpecialCase mov y,#$00 jmp .branch_continue } ; $289A ; Sound 1 channel variable pointers { ; $289A sound1ChannelVoiceBitsets: dw !sound1_channel0_voiceBitset, !sound1_channel1_voiceBitset, !sound1_channel2_voiceBitset, !sound1_channel3_voiceBitset ; $28A2 sound1ChannelVoiceMasks: dw !sound1_channel0_voiceMask, !sound1_channel1_voiceMask, !sound1_channel2_voiceMask, !sound1_channel3_voiceMask ; $28AA sound1ChannelVoiceIndices: dw !sound1_channel0_voiceIndex, !sound1_channel1_voiceIndex, !sound1_channel2_voiceIndex, !sound1_channel3_voiceIndex } ; $28B2 sound1Initialisation: { mov a,#$09 : mov !sound1_voiceId,a mov a,!enableSoundEffectVoices : mov !sound1_remainingEnabledSoundVoices,a mov a,#$FF : mov !sound1_initialisationFlag,a mov a,#$00 mov !sound1_2i_channel,a mov !sound1_i_channel,a mov !sound1_channel0_voiceBitset,a mov !sound1_channel1_voiceBitset,a mov !sound1_channel2_voiceBitset,a mov !sound1_channel3_voiceBitset,a mov !sound1_channel0_voiceIndex,a mov !sound1_channel1_voiceIndex,a mov !sound1_channel2_voiceIndex,a mov !sound1_channel3_voiceIndex,a mov a,#$FF mov !sound1_channel0_voiceMask,a mov !sound1_channel1_voiceMask,a mov !sound1_channel2_voiceMask,a mov !sound1_channel3_voiceMask,a mov !sound1_channel0_disableByte,a mov !sound1_channel1_disableByte,a mov !sound1_channel2_disableByte,a mov !sound1_channel3_disableByte,a .loop dec !sound1_voiceId : beq .ret asl !sound1_remainingEnabledSoundVoices : bcs .loop mov a,#$00 : cmp a,!sound1_n_voices : beq .ret dec !sound1_n_voices mov a,#$00 : mov x,!sound1_i_channel : mov !sound1_channel0_disableByte+x,a inc !sound1_i_channel mov a,!sound1_2i_channel : mov x,a : mov y,a mov a,sound1ChannelVoiceBitsets+x : mov !sound1_p_charVoiceBitset,a mov a,sound1ChannelVoiceMasks+x : mov !sound1_p_charVoiceMask,a mov a,sound1ChannelVoiceIndices+x : mov !sound1_p_charVoiceIndex,a inc x mov a,sound1ChannelVoiceBitsets+x : mov !sound1_p_charVoiceBitset+1,a mov a,sound1ChannelVoiceMasks+x : mov !sound1_p_charVoiceMask+1,a mov a,sound1ChannelVoiceIndices+x : mov !sound1_p_charVoiceIndex+1,a inc !sound1_2i_channel : inc !sound1_2i_channel mov a,!sound1_voiceId : mov !sound1_i_voice,a : dec !sound1_i_voice : clrc : asl !sound1_i_voice mov x,!sound1_i_voice : mov a,!trackOutputVolumes+x : mov !sound1_channel0_trackOutputVolumeBackup+y,a inc y : mov a,!trackPhaseInversionOptions+x : mov !sound1_channel0_trackOutputVolumeBackup+y,a mov y,#$00 : mov a,!sound1_i_voice : mov (!sound1_p_charVoiceIndex)+y,a mov a,!sound1_voiceId : call goToJumpTableEntry dw .voice0, .voice1, .voice2, .voice3, .voice4, .voice5, .voice6, .voice7 .ret ret .voice7 : %SetVoice(1, 7) : jmp .loop .voice6 : %SetVoice(1, 6) : jmp .loop .voice5 : %SetVoice(1, 5) : jmp .loop .voice4 : %SetVoice(1, 4) : jmp .loop .voice3 : %SetVoice(1, 3) : jmp .loop .voice2 : %SetVoice(1, 2) : jmp .loop .voice1 : %SetVoice(1, 1) : jmp .loop .voice0 : %SetVoice(1, 0) : jmp .loop } ; $2A57 getSound1ChannelInstructionListPointer: { inc y : mov a,(!sound1_instructionListPointerSet)+y ret } ; $2A5B sound1MultiplyBy8: { asl a : asl a : asl a ret } ; $2A5F sound1Configurations: { .sound1 call nSound1Voices_4_sound1Priority_0_dup : ret .sound2 .sound3 .sound4 .sound5 .sound6 .sound7 call nSound1Voices_1_sound1Priority_0 : ret .sound8 call nSound1Voices_2_sound1Priority_0 ret .sound9 .soundA .soundB .soundC .soundD .soundE .soundF .sound10 .sound11 .sound12 .sound13 .sound14 .sound15 .sound16 .sound17 .sound18 .sound19 .sound1A .sound1B .sound1C .sound1D .sound1E .sound1F .sound20 .sound21 .sound22 .sound23 call nSound1Voices_1_sound1Priority_0 ret .sound24 call nSound1Voices_2_sound1Priority_0 ret .sound25 .sound26 call nSound1Voices_1_sound1Priority_0 ret .sound27 call nSound1Voices_2_sound1Priority_0 ret .sound28 .sound29 .sound2A .sound2B call nSound1Voices_1_sound1Priority_0 ret .sound2C call nSound1Voices_1_sound1Priority_0 ret .sound2D call nSound1Voices_1_sound1Priority_0 ret .sound2E call nSound1Voices_4_sound1Priority_0 ret .sound2F .sound30 .sound31 .sound32 call nSound1Voices_1_sound1Priority_0 ret .sound33 call nSound1Voices_2_sound1Priority_0 ret .sound34 call nSound1Voices_1_sound1Priority_0 ret .sound35 call nSound1Voices_1_sound1Priority_1 ret .sound36 .sound37 .sound38 .sound39 .sound3A .sound3B .sound3C .sound3D .sound3E .sound3F call nSound1Voices_1_sound1Priority_0 ret .sound40 call nSound1Voices_3_sound1Priority_1 ret .sound41 call nSound1Voices_2_sound1Priority_0 ret .sound42 call nSound1Voices_2_sound1Priority_0 : ret } ; $2AAB nSound1Voices_1_sound1Priority_0: { mov a,#$01 : mov !sound1_n_voices,a mov a,#$00 : mov !sound1Priority,a ret } ; $2AB6 nSound1Voices_1_sound1Priority_1: { mov a,#$01 : mov !sound1_n_voices,a mov a,#$01 : mov !sound1Priority,a ret } ; $2AC1 nSound1Voices_2_sound1Priority_0: { mov a,#$02 : mov !sound1_n_voices,a mov a,#$00 : mov !sound1Priority,a ret } ; $2ACC nSound1Voices_3_sound1Priority_1: { mov a,#$03 : mov !sound1_n_voices,a mov a,#$01 : mov !sound1Priority,a ret } ; $2AD7 nSound1Voices_4_sound1Priority_0: { mov a,#$04 : mov !sound1_n_voices,a mov a,#$00 : mov !sound1Priority,a ret } ; $2AE2 nSound1Voices_4_sound1Priority_0_dup: { mov a,#$04 : mov !sound1_n_voices,a mov a,#$00 : mov !sound1Priority,a ret } ; $2AED sound1InstructionLists: { dw .sound1, .sound2, .sound3, .sound4, .sound5, .sound6, .sound7, .sound8, .sound9, .soundA, .soundB, .soundC, .soundD, .soundE, .soundF, .sound10,\ .sound11, .sound12, .sound13, .sound14, .sound15, .sound16, .sound17, .sound18, .sound19, .sound1A, .sound1B, .sound1C, .sound1D, .sound1E, .sound1F, .sound20,\ .sound21, .sound22, .sound23, .sound24, .sound25, .sound26, .sound27, .sound28, .sound29, .sound2A, .sound2B, .sound2C, .sound2D, .sound2E, .sound2F, .sound30,\ .sound31, .sound32, .sound33, .sound34, .sound35, .sound36, .sound37, .sound38, .sound39, .sound3A, .sound3B, .sound3C, .sound3D, .sound3E, .sound3F, .sound40,\ .sound41, .sound42 ; Instruction list format: { ; Commands: ; F5h dd tt - legato pitch slide with subnote delta = d, target note = t ; F8h dd tt - pitch slide with subnote delta = d, target note = t ; F9h aaaa - voice's ADSR settings = a ; FBh - repeat ; FCh - enable noise ; FDh - decrement repeat counter and repeat if non-zero ; FEh cc - set repeat pointer with repeat counter = c ; FFh - end ; Otherwise: ; ii vv pp nn tt ; i: Instrument index ; v: Volume ; p: Panning ; n: Note. F6h is a tie ; t: Length } ; Sound 1: Power bomb explosion .sound1 dw ..voice0, ..voice1, ..voice2, ..voice3 ..voice0 : db $F5,$B0,$C7, $05,$D0,$0A,$98,$46, $FF ..voice1 : db $F5,$A0,$C7, $09,$D0,$0F,$80,$50, $F5,$50,$80, $09,$D0,$0A,$AB,$46, $FF ..voice2 : db $09,$D0,$0F,$87,$10, $F5,$B0,$C7, $05,$D0,$0F,$80,$60, $FF ..voice3 : db $09,$D0,$05,$82,$30, $F5,$A0,$80, $05,$D0,$05,$C7,$60, $FF ; Sound 2: Silence .sound2 dw ..voice0 ..voice0 : db $15,$00,$0A,$BC,$03, $FF ; Sound 3: Missile .sound3 dw ..voice0 ..voice0 : db $00,$D8,$0A,$95,$08, $01,$D8,$0A,$8B,$30, $FF ; Sound 4: Super missile .sound4 dw ..voice0 ..voice0 : db $00,$D0,$0A,$95,$08, $01,$D0,$0A,$90,$30, $FF ; Sound 5: Grapple start .sound5 dw ..voice0 ..voice0 : db $01,$80,$0A,$9D,$10, $02,$50,$0A,$93,$07, $02,$50,$0A,$93,$03, $02,$50,$0A,$93,$05, $02,$50,$0A,$93,$08, $02,$50,$0A,$93,$04, $02,$50,$0A,$93,$06, $02,$50,$0A,$93,$04, $FF ; Sound 6: Grappling .sound6 dw ..voice0 ..voice0 : db $0D,$50,$0A,$80,$03, $0D,$50,$0A,$85,$04,\ $FE,$00, $02,$50,$0A,$93,$07, $02,$50,$0A,$93,$03, $02,$50,$0A,$93,$05, $02,$50,$0A,$93,$08, $02,$50,$0A,$93,$04, $02,$50,$0A,$93,$06, $02,$50,$0A,$93,$04, $FB,\ $FF ; Sound 7: Grapple end .sound7 dw ..voice0 ..voice0 : db $02,$50,$0A,$93,$05, $FF ; Sound 8: Charging beam .sound8 dw ..voice0, ..voice1 ..voice0 : db $05,$00,$0A,$B4,$15, $F5,$30,$C7, $05,$50,$0A,$B7,$25,\ $FE,$00, $07,$60,$0A,$C7,$30, $FB,\ $FF ..voice1 : db $02,$00,$0A,$9C,$07, $02,$10,$0A,$9C,$03, $02,$00,$0A,$9C,$05, $02,$20,$0A,$9C,$08 ; Shared by charging beam and resume charging beam .resumeChargingBeamVoice db $02,$20,$0A,$9C,$04, $02,$30,$0A,$9C,$06, $02,$00,$0A,$9C,$04, $02,$30,$0A,$9C,$03, $02,$30,$0A,$9C,$07, $02,$00,$0A,$9C,$0A, $02,$30,$0A,$9C,$03, $02,$00,$0A,$9C,$04, $02,$40,$0A,$9C,$03, $02,$40,$0A,$9C,$07, $02,$00,$0A,$9C,$05, $02,$40,$0A,$9C,$06, $02,$40,$0A,$9C,$03, $02,$00,$0A,$9C,$0A, $02,$50,$0A,$9C,$03, $02,$50,$0A,$9C,$03, $02,$60,$0A,$9C,$05, $02,$00,$0A,$9C,$06, $02,$60,$0A,$9C,$07, $02,$00,$0A,$9C,$03, $02,$60,$0A,$9C,$04, $02,$60,$0A,$9C,$03, $02,$00,$0A,$9C,$03,\ $FE,$00, $02,$40,$0A,$9C,$05, $02,$40,$0A,$9C,$06, $02,$40,$0A,$9C,$07, $02,$40,$0A,$9C,$03, $02,$40,$0A,$9C,$04, $02,$40,$0A,$9C,$03, $02,$40,$0A,$9C,$03, $FB,\ $FF ; Sound 9: X-ray .sound9 dw ..voice0 ..voice0 : db $F5,$70,$AD, $06,$40,$0A,$A4,$40,\ $FE,$00, $06,$40,$0A,$AD,$F0, $FB,\ $FF ; Sound Ah: X-ray end .soundA dw ..voice0 ..voice0 : db $06,$00,$0A,$AD,$03, $FF ; Sound Bh: Uncharged power beam .soundB dw ..voice0 ..voice0 : db $04,$90,$0A,$89,$03, $04,$90,$0A,$84,$0E, $FF ; Sound Ch: Uncharged ice beam .soundC dw .weakUnchargedIceVoice ; Uncharged ice / ice + wave beam .weakUnchargedIceVoice db $04,$B0,$0A,$8B,$03, $04,$B0,$0A,$89,$07, $F5,$90,$C7, $10,$90,$0A,$BC,$0A, $10,$60,$0A,$C3,$06, $10,$30,$0A,$C7,$03, $10,$20,$0A,$C7,$03, $FF ; Sound Dh: Uncharged wave beam .soundD dw ..voice0 ..voice0 : db $04,$90,$0A,$89,$03, $04,$70,$0A,$84,$0B, $04,$30,$0A,$84,$08, $FF ; Sound Eh: Uncharged ice + wave beam .soundE dw .weakUnchargedIceVoice ; Sound Fh: Uncharged spazer beam .soundF dw .unchargedSpazerVoice ; Uncharged spazer / spazer + wave beam .unchargedSpazerVoice db $00,$D0,$0A,$98,$0C, $04,$C0,$0A,$80,$10, $04,$30,$0A,$80,$08, $04,$10,$0A,$80,$06, $FF ; Sound 10h: Uncharged spazer + ice beam .sound10 dw .strongUnchargedIceVoice ; Uncharged spazer + ice / spazer + ice + wave / plasma + ice / plasma + ice + wave beam .strongUnchargedIceVoice db $00,$D0,$0A,$98,$0C, $F5,$90,$C7, $10,$90,$0A,$BC,$0A, $10,$60,$0A,$C3,$06, $10,$30,$0A,$C7,$03, $10,$20,$0A,$C7,$03, $FF ; Sound 11h: Uncharged spazer + ice + wave beam .sound11 dw .strongUnchargedIceVoice ; Sound 12h: Uncharged spazer + wave beam .sound12 dw .unchargedSpazerVoice ; Sound 13h: Uncharged plasma beam .sound13 dw .unchargedPlasmaVoice ; Uncharged plasma / plasma + wave beam .unchargedPlasmaVoice db $00,$D0,$0A,$98,$0C, $04,$B0,$0A,$80,$13, $FF ; Sound 14h: Uncharged plasma + ice beam .sound14 dw .strongUnchargedIceVoice ; Sound 15h: Uncharged plasma + ice + wave beam .sound15 dw .strongUnchargedIceVoice ; Sound 16h: Uncharged plasma + wave beam .sound16 dw .unchargedPlasmaVoice ; Sound 17h: Charged power beam .sound17 dw ..voice0 ..voice0 : db $04,$D0,$0A,$84,$05, $04,$D0,$0A,$80,$0C, $02,$80,$0A,$98,$03, $02,$60,$0A,$98,$03, $02,$50,$0A,$98,$03, $FF ; Sound 18h: Charged ice beam .sound18 dw .chargedIceVoice ; Charged ice / ice + wave / spazer + ice / spazer + ice + wave / plasma + ice / plasma + ice + wave beam .chargedIceVoice db $00,$E0,$0A,$98,$0C, $F5,$B0,$C7, $10,$E0,$0A,$BC,$0A, $10,$70,$0A,$C3,$06, $10,$30,$0A,$C7,$03, $10,$20,$0A,$C7,$03, $FF ; Sound 19h: Charged wave beam .sound19 dw ..voice0 ..voice0 : db $04,$E0,$0A,$84,$03, $04,$E0,$0A,$80,$10, $04,$50,$0A,$80,$04, $04,$30,$0A,$80,$09, $FF ; Sound 1Ah: Charged ice + wave beam .sound1A dw .chargedIceVoice ; Sound 1Bh: Charged spazer beam .sound1B dw .chargedSpazerVoice ; Charged spazer / spazer + wave beam .chargedSpazerVoice db $00,$D0,$0A,$95,$08, $04,$D0,$0A,$80,$0F, $04,$80,$0A,$80,$0D, $04,$20,$0A,$80,$0A, $FF ; Sound 1Ch: Charged spazer + ice beam .sound1C dw .chargedIceVoice ; Sound 1Dh: Charged spazer + ice + wave beam .sound1D dw .chargedIceVoice ; Sound 1Eh: Charged spazer + wave beam .sound1E dw .chargedSpazerVoice ; Sound 1Fh: Charged plasma beam / hyper beam .sound1F dw .chargedPlasmaVoice ; Charged plasma / hyper / plasma + wave beam .chargedPlasmaVoice db $00,$D0,$0A,$98,$0E, $04,$D0,$0A,$80,$10, $04,$70,$0A,$80,$10, $04,$30,$0A,$80,$10, $FF ; Sound 20h: Charged plasma + ice beam .sound20 dw .chargedIceVoice ; Sound 21h: Charged plasma + ice + wave beam .sound21 dw .chargedIceVoice ; Sound 22h: Charged plasma + wave beam .sound22 dw .chargedPlasmaVoice ; Sound 23h: Ice SBA .sound23 dw ..voice0 ..voice0 : db $FE,$00, $10,$50,$0A,$C0,$03, $10,$50,$0A,$C1,$03, $10,$60,$0A,$C3,$03, $10,$60,$0A,$C5,$03, $10,$70,$0A,$C7,$03, $10,$60,$0A,$C5,$03, $10,$50,$0A,$C3,$03, $10,$50,$0A,$C1,$03, $FB, $FF ; Sound 24h: Ice SBA end .sound24 dw ..voice0, ..voice1 ..voice0 : db $10,$D0,$0A,$BC,$0A, $10,$70,$0A,$C3,$06, $10,$30,$0A,$C7,$03, $10,$20,$0A,$C7,$03, $10,$50,$0A,$C3,$06, $10,$40,$0A,$C7,$03, $10,$40,$0A,$C7,$03, $10,$30,$0A,$C3,$06, $10,$20,$0A,$C7,$03, $10,$20,$0A,$C7,$03, $FF ..voice1 : db $04,$D0,$0A,$80,$10, $04,$70,$0A,$80,$10, $04,$30,$0A,$80,$10, $FF ; Sound 25h: Spazer SBA .sound25 dw ..voice0 ..voice0 : db $04,$D0,$0A,$80,$10, $04,$70,$0A,$80,$10, $04,$30,$0A,$80,$02, $04,$D0,$0A,$80,$10, $04,$70,$0A,$80,$10, $04,$30,$0A,$80,$10, $FF ; Sound 26h: Spazer SBA end .sound26 dw ..voice0 ..voice0 : db $04,$D0,$0A,$80,$10, $04,$70,$0A,$80,$04, $04,$30,$0A,$80,$02, $04,$30,$0A,$80,$06, $04,$30,$0A,$80,$06, $04,$70,$0A,$80,$07, $04,$70,$0A,$80,$07, $FF ; Sound 27h: Plasma SBA .sound27 dw ..voice0, ..voice1 ..voice0 : db $F5,$30,$C7, $07,$90,$0A,$B7,$25, $F5,$30,$B7, $07,$90,$0A,$F6,$25, $F5,$B0,$C7, $07,$90,$0A,$F6,$25, $FF ..voice1 : db $F5,$30,$C7, $05,$90,$0A,$B7,$27, $F5,$30,$B7, $05,$90,$0A,$F6,$27, $F5,$B0,$C7, $05,$90,$0A,$F6,$27, $FF ; Sound 28h: Wave SBA .sound28 dw ..voice0 ..voice0 : db $F5,$30,$C7, $05,$50,$0A,$B7,$25, $FF ; Sound 29h: Wave SBA end .sound29 dw ..voice0 ..voice0 : db $05,$00,$0A,$B7,$03, $FF ; Sound 2Ah: Selected save file .sound2A dw ..voice0 ..voice0 : db $07,$90,$0A,$C5,$12, $FF ; Sound 2Bh: (Empty) .sound2B dw ..voice0 ..voice0 : db $FF ; Sound 2Ch: (Empty) .sound2C dw ..voice0 ..voice0 : db $FF ; Sound 2Dh: (Empty) .sound2D dw ..voice0 ..voice0 : db $FF ; Sound 2Eh: Saving .sound2E dw ..voice0, ..voice1, ..voice2, ..voice3 ..voice0 : db $F5,$F0,$B1, $06,$45,$0A,$99,$19, $06,$45,$0A,$B1,$80, $F5,$F0,$99, $06,$45,$0A,$B1,$19, $FF ..voice1 : db $F5,$F0,$A7, $06,$45,$0A,$8F,$19, $06,$45,$0A,$A7,$80, $F5,$F0,$8F, $06,$45,$0A,$A7,$19, $FF ..voice2 : db $F5,$F0,$A0, $06,$45,$0A,$88,$19, $06,$45,$0A,$A0,$80, $F5,$F0,$88, $06,$45,$0A,$A0,$19, $FF ..voice3 : db $F5,$F0,$98, $06,$45,$0A,$80,$19, $06,$45,$0A,$98,$80, $F5,$F0,$80, $06,$45,$0A,$98,$19, $FF ; Sound 2Fh: Underwater space jump (without gravity suit) .sound2F dw ..voice0 ..voice0 : db $07,$80,$0A,$C7,$10, $FF ; Sound 30h: Resumed spin jump .sound30 dw ..voice0 ..voice0 : db $FE,$00, $07,$80,$0A,$C7,$10, $FB, $FF ; Sound 31h: Spin jump .sound31 dw ..voice0 ..voice0 : db $07,$30,$0A,$C5,$10, $07,$40,$0A,$C6,$10, $07,$50,$0A,$C7,$10,\ $FE,$00, $07,$80,$0A,$C7,$10, $FB,\ $FF ; Sound 32h: Spin jump end .sound32 dw ..voice0 ..voice0 : db $0A,$00,$0A,$87,$03, $FF ; Sound 33h: Screw attack .sound33 dw ..voice0, ..voice1 ..voice0 : db $07,$30,$0A,$C7,$04, $07,$40,$0A,$C7,$05, $07,$50,$0A,$C7,$06, $07,$60,$0A,$C7,$07, $07,$70,$0A,$C7,$09, $07,$80,$0A,$C7,$0D, $07,$80,$0A,$C7,$0F,\ $FE,$00, $07,$80,$0A,$C7,$10, $FB,\ $FF ..voice1 : db $F5,$E0,$BC, $05,$60,$0A,$98,$0E, $F5,$E0,$BC, $05,$70,$0A,$A4,$08, $F5,$E0,$BC, $05,$80,$0A,$B0,$06,\ $FE,$00, $05,$80,$0A,$BC,$03, $05,$80,$0A,$C4,$03, $05,$80,$0A,$C6,$03, $FB,\ $FF ; Sound 34h: Screw attack end .sound34 dw ..voice0 ..voice0 : db $0A,$00,$0A,$87,$03, $FF ; Sound 35h: Samus damaged .sound35 dw ..voice0 ..voice0 : db $13,$60,$0A,$A4,$10, $13,$10,$0A,$A4,$07, $FF ; Sound 36h: Scrolling map .sound36 dw ..voice0 ..voice0 : db $0C,$60,$0A,$B0,$02, $FF ; Sound 37h: Toggle reserve mode / moved cursor .sound37 dw ..voice0 ..voice0 : db $03,$60,$0A,$9C,$04, $FF ; Sound 38h: Pause menu transition / toggled equipment .sound38 dw ..voice0 ..voice0 : db $F5,$90,$C7, $15,$90,$0A,$B0,$15, $FF ; Sound 39h: Switch HUD item .sound39 dw ..voice0 ..voice0 : db $03,$40,$0A,$9C,$03, $FF ; Sound 3Ah: (Empty) .sound3A dw ..voice0 ..voice0 : db $FF ; Sound 3Bh: Hexagon map -> square map transition .sound3B dw ..voice0 ..voice0 : db $05,$90,$0A,$9C,$0B, $F5,$F0,$C2, $05,$90,$0A,$9C,$12, $FF ; Sound 3Ch: Square map -> hexagon map transition .sound3C dw ..voice0 ..voice0 : db $05,$90,$0A,$9C,$0B, $F5,$F0,$80, $05,$90,$0A,$9C,$12, $FF ; Sound 3Dh: Dud shot .sound3D dw ..voice0 ..voice0 : db $08,$70,$0A,$99,$03, $08,$70,$0A,$9C,$05, $FF ; Sound 3Eh: Space jump .sound3E dw ..voice0 ..voice0 : db $07,$30,$0A,$C7,$04, $07,$40,$0A,$C7,$05, $07,$50,$0A,$C7,$06, $07,$60,$0A,$C7,$07, $07,$70,$0A,$C7,$09, $07,$80,$0A,$C7,$0D, $07,$80,$0A,$C7,$0F,\ $FE,$00, $07,$80,$0A,$C7,$10, $FB,\ $FF ; Sound 3Fh: Resumed space jump .sound3F dw ..voice0 ..voice0 : db $FE,$00, $07,$80,$0A,$C7,$10, $FB, $FF ; Sound 40h: Mother Brain's rainbow beam .sound40 dw ..voice0, ..voice1, ..voice2 ..voice0 : db $FE,$00, $23,$D0,$0A,$89,$07, $23,$D0,$0A,$8B,$07, $23,$D0,$0A,$8C,$07, $23,$D0,$0A,$8E,$07, $23,$D0,$0A,$90,$07, $23,$D0,$0A,$91,$07, $23,$D0,$0A,$93,$07, $23,$D0,$0A,$95,$07, $23,$D0,$0A,$97,$07, $FB, $FF ..voice1 : db $FE,$00, $06,$D0,$0A,$BA,$F0, $FB, $FF ..voice2 : db $FE,$00, $06,$D0,$0A,$B3,$F0, $FB, $FF ; Sound 41h: Resume charging beam .sound41 dw ..voice0, .resumeChargingBeamVoice ..voice0 : db $F5,$70,$C7, $05,$50,$0A,$C0,$03,\ $FE,$00, $07,$60,$0A,$C7,$30, $FB,\ $FF ; Sound 42h: .sound42 dw ..voice0, ..voice1 ..voice0 : db $24,$A0,$0A,$9C,$20, $FF ..voice1 : db $24,$00,$0A,$9D,$05, $24,$80,$0A,$95,$40, $FF }
28.93012
487
0.647093
8e03bece2e7c6a090608c69f66771b3d59102073
2,176
asm
Assembly
Sources/Toggle_PP5_PWM_Buzzer_AssemProg.asm
billhhh/hcs12-dragon12
49341a48b06072c349fac074fe560de68dd00f22
[ "MIT" ]
null
null
null
Sources/Toggle_PP5_PWM_Buzzer_AssemProg.asm
billhhh/hcs12-dragon12
49341a48b06072c349fac074fe560de68dd00f22
[ "MIT" ]
null
null
null
Sources/Toggle_PP5_PWM_Buzzer_AssemProg.asm
billhhh/hcs12-dragon12
49341a48b06072c349fac074fe560de68dd00f22
[ "MIT" ]
null
null
null
;Toggling PP5 to sound the buzzer using PWM (pulse width modulation) on Dragon12 Plus Trainer Board ;The J26 jumper selection allows to SPK_SEL (speaker selection) to be PT5, PP5 (PWM chan 5) or DACB output ;When the Dragon12 board is shipped the J26 jumper is set for PT5 of PORTT speaker/buzzer selection (Default setting). ;Because of this PT5 jumper setting you hear the speaker sound when the board is RESET ;This program toggles PP5 to sound the speaker/buzzer using the PWM of channel 5. ;Modified from Example 17-13 Mazidi & Causey HCS12 book. See Chapter 17 for PWM discussion ;Written and tested by M. Mazidi ;Before you run this program MAKE SURE YOU MOVE THE JUMPER ON J26 FROM PT5 TO PP5 ;AFTER YOU RUN THIS PROGRAM MAKE SURE TO MOVE THE JUMPER BACK TO PT5. ;OTHERWISE UPON RESETING THE BOARD YOU WILL NOT HEAR THE SPEAKER/BUZZER SOUND ABSENTRY Entry ; for absolute assembly: mark this as application entry point ; Include derivative-specific definitions INCLUDE 'mc9s12dp256.inc' ;CPU used by Dragon12+ board ;code section ORG $4000 ;Flash ROM address for Dragon12+ Entry: LDS #$4000 ;Stack MOVB #$04, PWMPRCLK ;ClockA=Fbus/2**4=24MHz/16=1.5MHz MOVB #125, PWMSCLA ;ClockSA=1.5MHz/2x125=1.5Mhz/250=6000Hz MOVB #$20, PWMCLK ;Use clockSA for chan 5 PWM MOVB #$20,PWMPOL ;high then low for polarity MOVB #$0,PWMCAE ;left aligned MOVB #$0, PWMCTL ;8-bit chan,pwm during feeze and wait MOVB #100, PWMPER5 ;PWM_Freq=ClockSA/100=6000 Hz/100=60 Hz. CHANGE THIS MOVB #50, PWMDTY5 ;50% duty cycle AND THIS TO GET DIFFERENT SOUND MOVB #0,PWMCNT5 ;start the counter with zero (optional) BSET PWME,%00100000 ;enable chan 5 PWM BRA $ ;************************************************************** ;* Interrupt Vectors * ;************************************************************** ORG $FFFE DC.W Entry ;Reset Vector. CPU wakes here and it is sent to start of the code at $4000
44.408163
119
0.622702
fbd02c9366ba62b4431a0d11d33222dd88457e6e
663
asm
Assembly
oeis/172/A172117.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/172/A172117.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/172/A172117.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A172117: a(n) = n*(n+1)*(20*n-17)/6. ; Submitted by Jamie Morken(s1.) ; 0,1,23,86,210,415,721,1148,1716,2445,3355,4466,5798,7371,9205,11320,13736,16473,19551,22990,26810,31031,35673,40756,46300,52325,58851,65898,73486,81635,90365,99696,109648,120241,131495,143430,156066,169423,183521,198380,214020,230461,247723,265826,284790,304635,325381,347048,369656,393225,417775,443326,469898,497511,526185,555940,586796,618773,651891,686170,721630,758291,796173,835296,875680,917345,960311,1004598,1050226,1097215,1145585,1195356,1246548,1299181,1353275,1408850,1465926,1524523 lpb $0 sub $0,1 add $2,$3 add $2,1 add $4,$2 add $1,$4 mov $3,19 lpe mov $0,$1
47.357143
498
0.760181
cc8e82cb1b33aab5166ce2f7e530812879454dc4
608
asm
Assembly
oeis/179/A179060.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/179/A179060.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/179/A179060.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A179060: Number of non-attacking placements of 5 rooks on an n X n board. ; 0,0,0,0,120,4320,52920,376320,1905120,7620480,25613280,75271680,198764280,480960480,1082161080,2289530880,4594961280,8809274880,16225246080,28844881920,49689816120,83217546720,135870624120,216790801920,338735628000,519241008000,782079948000,1159075008000,1692330003000,2436955204320,3464369750520,4866275205120,6759405227520,9291168184320,12646312250880,17054756167680,22800743353080,30233492563680,39779534765880,51956943367680,67391683488480,86836325546880,111191389152480,141529605127680 add $0,1 bin $0,5 pow $0,2 mul $0,120
76
492
0.865132
087f27bd8daabec54ccaa02211c17d7c7729fd25
73
asm
Assembly
gfx/pokemon/ampharos/anim_idle.asm
Dev727/ancientplatinum
8b212a1728cc32a95743e1538b9eaa0827d013a7
[ "blessing" ]
28
2019-11-08T07:19:00.000Z
2021-12-20T10:17:54.000Z
gfx/pokemon/ampharos/anim_idle.asm
Dev727/ancientplatinum
8b212a1728cc32a95743e1538b9eaa0827d013a7
[ "blessing" ]
13
2020-01-11T17:00:40.000Z
2021-09-14T01:27:38.000Z
gfx/pokemon/ampharos/anim_idle.asm
Dev727/ancientplatinum
8b212a1728cc32a95743e1538b9eaa0827d013a7
[ "blessing" ]
22
2020-05-28T17:31:38.000Z
2022-03-07T20:49:35.000Z
frame 4, 10 setrepeat 2 frame 5, 06 frame 6, 06 dorepeat 2 endanim
10.428571
12
0.684932
f28e9df07e34214cdace74379c20e3e1cb638a90
114
asm
Assembly
libsrc/_DEVELOPMENT/math/float/math48/lm/c/sccz80/acosh.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/_DEVELOPMENT/math/float/math48/lm/c/sccz80/acosh.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/_DEVELOPMENT/math/float/math48/lm/c/sccz80/acosh.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
SECTION code_clib SECTION code_fp_math48 PUBLIC acosh EXTERN cm48_sccz80_acosh defc acosh = cm48_sccz80_acosh
11.4
30
0.850877
d54a1badb619a4563f238bf54dae006884b63348
198
asm
Assembly
sway-core/tests/ir_to_asm/tiny_asm_block.asm
anrestbe/Bimbam
11d4f534088e9272af1399cc8a0fe417f56af5a1
[ "Apache-2.0" ]
1
2022-02-01T19:57:26.000Z
2022-02-01T19:57:26.000Z
sway-core/tests/ir_to_asm/tiny_asm_block.asm
anrestbe/Bimbam
11d4f534088e9272af1399cc8a0fe417f56af5a1
[ "Apache-2.0" ]
null
null
null
sway-core/tests/ir_to_asm/tiny_asm_block.asm
anrestbe/Bimbam
11d4f534088e9272af1399cc8a0fe417f56af5a1
[ "Apache-2.0" ]
null
null
null
.program: ji i4 noop DATA_SECTION_OFFSET[0..32] DATA_SECTION_OFFSET[32..64] lw $ds $is 1 add $$ds $$ds $is bhei $r0 move $r1 $r0 ; return value from inline asm ret $r1 .data:
16.5
60
0.621212
abcbb55bc838f401667eba2678e71f8b273dbfef
973
asm
Assembly
Altair101/asm/programsUntested/opOutLcdOffOn.asm
tigerfarm/arduino
e51f111a092fe6737646b146a825f4eecbd05d44
[ "OLDAP-2.4", "OLDAP-2.7" ]
2
2021-12-12T23:27:10.000Z
2022-02-17T14:01:21.000Z
Altair101/asm/programsUntested/opOutLcdOffOn.asm
tigerfarm/arduino
e51f111a092fe6737646b146a825f4eecbd05d44
[ "OLDAP-2.4", "OLDAP-2.7" ]
null
null
null
Altair101/asm/programsUntested/opOutLcdOffOn.asm
tigerfarm/arduino
e51f111a092fe6737646b146a825f4eecbd05d44
[ "OLDAP-2.4", "OLDAP-2.7" ]
4
2021-08-29T19:55:49.000Z
2022-02-15T08:30:15.000Z
; -------------------------------------- Start: ; Turn LCD back light off. mvi a,0 out 1 hlt ; Turn LCD back light on. mvi a,1 out 1 hlt ; Clear screen. mvi a,2 out 1 hlt ; Turn LCD back light off. mvi a,0 out 1 hlt ; Turn LCD back light on. mvi a,1 out 1 hlt ; Initialize with splash message. mvi a,3 out 1 hlt ; jmp Start ; -------------------------------------- end
31.387097
80
0.20555
dae34ca6340f71fb53ef469cf6b928cb98b6b315
4,388
asm
Assembly
Transynther/x86/_processed/P/_zr_/i3-7100_9_0x84_notsx.log_9_547.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/P/_zr_/i3-7100_9_0x84_notsx.log_9_547.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/P/_zr_/i3-7100_9_0x84_notsx.log_9_547.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 %r13 push %r14 push %r9 push %rbp push %rcx push %rdi push %rsi lea addresses_normal_ht+0xdc99, %r9 clflush (%r9) nop nop nop sub %r12, %r12 mov (%r9), %ecx nop nop cmp $52240, %rbp lea addresses_D_ht+0x6e49, %r13 clflush (%r13) and %rcx, %rcx movb (%r13), %r14b add %r13, %r13 lea addresses_D_ht+0x64a1, %rsi lea addresses_D_ht+0xb849, %rdi nop nop nop nop nop add %r9, %r9 mov $120, %rcx rep movsb add %rdi, %rdi lea addresses_WT_ht+0x74e9, %r13 nop cmp $19771, %rbp vmovups (%r13), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $0, %xmm4, %r12 nop nop nop nop nop add $50636, %rdi lea addresses_UC_ht+0x4249, %r9 nop nop nop nop xor $39571, %rcx mov $0x6162636465666768, %r12 movq %r12, %xmm1 movups %xmm1, (%r9) nop nop nop nop nop cmp %r14, %r14 lea addresses_UC_ht+0x18c9, %rsi lea addresses_D_ht+0x1e249, %rdi nop nop nop nop nop and %r13, %r13 mov $17, %rcx rep movsl nop nop nop nop inc %r14 lea addresses_A_ht+0x7949, %rsi nop nop xor $40537, %r12 mov $0x6162636465666768, %r9 movq %r9, %xmm1 vmovups %ymm1, (%rsi) nop nop nop inc %rcx lea addresses_A_ht+0xd009, %rdi inc %rcx movl $0x61626364, (%rdi) add %rcx, %rcx lea addresses_A_ht+0x8279, %rbp nop nop nop nop nop and $35672, %r14 movb (%rbp), %cl nop nop nop add $54107, %r13 lea addresses_normal_ht+0x13f49, %rsi lea addresses_WC_ht+0xad89, %rdi nop mfence mov $66, %rcx rep movsq nop add %r14, %r14 lea addresses_WC_ht+0xb149, %rsi lea addresses_WC_ht+0x4889, %rdi and $26915, %r13 mov $61, %rcx rep movsw nop nop nop nop nop xor %r12, %r12 lea addresses_normal_ht+0xed79, %rsi lea addresses_A_ht+0x6f29, %rdi nop nop xor $5571, %r14 mov $79, %rcx rep movsb nop nop nop nop nop add %rcx, %rcx pop %rsi pop %rdi pop %rcx pop %rbp pop %r9 pop %r14 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %rbp push %rcx push %rdi push %rsi // REPMOV lea addresses_WT+0x1f849, %rsi lea addresses_D+0x1e189, %rdi nop nop nop nop cmp $42735, %rbp mov $44, %rcx rep movsb nop nop nop nop cmp %rdi, %rdi // Faulty Load mov $0x249, %r12 nop nop nop nop nop add %rdi, %rdi mov (%r12), %ebp lea oracles, %r11 and $0xff, %rbp shlq $12, %rbp mov (%r11,%rbp,1), %rbp pop %rsi pop %rdi pop %rcx pop %rbp pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_P', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_D', 'congruent': 4, 'same': False}, 'OP': 'REPM'} [Faulty Load] {'src': {'type': 'addresses_P', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'same': False, 'size': 1, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 32, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 16, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 32, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 1, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'} {'00': 9} 00 00 00 00 00 00 00 00 00 */
20.221198
152
0.652461
f82b2854313156eb4bf38012d6b2eda4fa1a3b2f
486
asm
Assembly
programs/oeis/262/A262011.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/262/A262011.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/262/A262011.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A262011: a(n) = (1/n!) * Product_{k=1..n} (k^3 + 1). ; 1,2,9,84,1365,34398,1244061,61136712,3920391657,317987323290,31830531061329,3854387943062748,555353062796290941,93897387078942114486,18410594823692578876005,4143611208319076419026192,1061023445030203505546894289,306698188757554119191614031538,99387251945711843180260258108953 lpb $0 mov $0,45 add $1,1 lpe add $1,$0 mov $2,$0 mov $0,$1 add $2,1 lpb $0 mov $1,$0 sub $0,1 pow $1,2 sub $1,$0 mul $2,$1 lpe mov $0,$2
24.3
277
0.734568
a690a11049670a277b7af53523cd61b6c536ef5c
9,834
asm
Assembly
Driver/Video/Dumb/VidMem/CMYK/cmykTables.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
504
2018-11-18T03:35:53.000Z
2022-03-29T01:02:51.000Z
Driver/Video/Dumb/VidMem/CMYK/cmykTables.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
96
2018-11-19T21:06:50.000Z
2022-03-06T10:26:48.000Z
Driver/Video/Dumb/VidMem/CMYK/cmykTables.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
73
2018-11-19T20:46:53.000Z
2022-03-29T00:59:26.000Z
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1991 -- All Rights Reserved PROJECT: PC GEOS MODULE: Video driver FILE: cmykTables.asm AUTHOR: Jim DeFrisco REVISION HISTORY: Name Date Description ---- ---- ----------- jad 12/91 initial version DESCRIPTION: $Id: cmykTables.asm,v 1.1 97/04/18 11:43:06 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ; left mask table leftMaskTable label word byte 11111111b,11111111b byte 01111111b,11111111b byte 00111111b,11111111b byte 00011111b,11111111b byte 00001111b,11111111b byte 00000111b,11111111b byte 00000011b,11111111b byte 00000001b,11111111b byte 00000000b,11111111b byte 00000000b,01111111b byte 00000000b,00111111b byte 00000000b,00011111b byte 00000000b,00001111b byte 00000000b,00000111b byte 00000000b,00000011b byte 00000000b,00000001b rightMaskTable label word byte 10000000b,00000000b byte 11000000b,00000000b byte 11100000b,00000000b byte 11110000b,00000000b byte 11111000b,00000000b byte 11111100b,00000000b byte 11111110b,00000000b byte 11111111b,00000000b byte 11111111b,10000000b byte 11111111b,11000000b byte 11111111b,11100000b byte 11111111b,11110000b byte 11111111b,11111000b byte 11111111b,11111100b byte 11111111b,11111110b byte 11111111b,11111111b ;------------------------------------------------------------------------------ ; Table of draw mode routines ;------------------------------------------------------------------------------ drawModeTable label word nptr ModeCLEAR nptr ModeCOPY nptr ModeNOP nptr ModeAND nptr ModeINVERT nptr ModeXOR nptr ModeSET nptr ModeOR VidSegment Bitmap ; this is a table of routines to put a single bitmap scan ; line. The B_type field passed in PutBitsArgs is used to ; index into the table (the lower 5 bits). The low three ; bits are the bitmap format, the next bit (BMT_COMPLEX) is ; used by the kernel bitmap code to signal that it is a ; monochrome bitmap that should be filled with the current ; area color. The fifth bit is set if there is a mask storeed ; with the bitmap. putbitsTable label nptr ; FORMAT mask? fill? nptr offset PutBWScanCMYK ; BMF_MONO no no nptr offset PutCMYKColor4 ; BMF_CLR4 no no nptr offset PutCMYKColor8 ; BMF_CLR8 no no nptr offset PutCMYKColor24 ; BMF_CLR24 no no nptr offset NullBMScan ; BMF_CMYK no no nptr offset NullBMScan ; UNUSED no no nptr offset NullBMScan ; UNUSED no no nptr offset NullBMScan ; UNUSED no no nptr offset FillBWScanCMYK ; BMF_MONO no yes nptr offset NullBMScan ; BMF_CLR4 no yes nptr offset NullBMScan ; BMF_CLR8 no yes nptr offset NullBMScan ; BMF_CLR24 no yes nptr offset NullBMScan ; BMF_CMYK no yes nptr offset NullBMScan ; UNUSED no yes nptr offset NullBMScan ; UNUSED no yes nptr offset NullBMScan ; UNUSED no yes nptr offset PutBWScanMaskCMYK ; BMF_MONO yes no nptr offset PutCMYKColor4Mask ; BMF_CLR4 yes no nptr offset PutCMYKColor8Mask ; BMF_CLR8 yes no nptr offset PutCMYKColor24Mask ; BMF_CLR24 yes no nptr offset NullBMScan ; BMF_CMYK yes no nptr offset NullBMScan ; UNUSED yes no nptr offset NullBMScan ; UNUSED yes no nptr offset NullBMScan ; UNUSED yes no nptr offset FillBWScanCMYK ; BMF_MONO yes yes nptr offset FillBWScanCMYK ; BMF_CLR4 yes yes nptr offset FillBWScanCMYK ; BMF_CLR8 yes yes nptr offset FillBWScanCMYK ; BMF_CLR24 yes yes nptr offset FillBWScanCMYK ; BMF_CMYK yes yes VidEnds Bitmap VidSegment PutLine ; this is a table of routines to put a single bitmap scan ; line. The B_type field passed in PutBitsArgs is used to ; index into the table (the lower 5 bits). The low three ; bits are the bitmap format, the next bit (BMT_COMPLEX) is ; used by the kernel bitmap code to signal that it is a ; monochrome bitmap that should be filled with the current ; area color. The fifth bit is set if there is a mask storeed ; with the bitmap. putlineTable label nptr ; FORMAT mask? fill? nptr offset PutBWScanCMYK ; BMF_MONO no no nptr offset PutCMYKColor4 ; BMF_CLR4 no no nptr offset PutCMYKColor8 ; BMF_CLR8 no no nptr offset PutCMYKColor24 ; BMF_CLR24 no no nptr offset NullBMScan ; BMF_CMYK no no nptr offset NullBMScan ; UNUSED no no nptr offset NullBMScan ; UNUSED no no nptr offset NullBMScan ; UNUSED no no nptr offset FillBWScanCMYK ; BMF_MONO no yes nptr offset NullBMScan ; BMF_CLR4 no yes nptr offset NullBMScan ; BMF_CLR8 no yes nptr offset NullBMScan ; BMF_CLR24 no yes nptr offset NullBMScan ; BMF_CMYK no yes nptr offset NullBMScan ; UNUSED no yes nptr offset NullBMScan ; UNUSED no yes nptr offset NullBMScan ; UNUSED no yes nptr offset PutBWScanMaskCMYK ; BMF_MONO yes no nptr offset PutCMYKColor4Mask ; BMF_CLR4 yes no nptr offset PutCMYKColor8Mask ; BMF_CLR8 yes no nptr offset PutCMYKColor24Mask ; BMF_CLR24 yes no nptr offset NullBMScan ; BMF_CMYK yes no nptr offset NullBMScan ; UNUSED yes no nptr offset NullBMScan ; UNUSED yes no nptr offset NullBMScan ; UNUSED yes no nptr offset FillBWScanCMYK ; BMF_MONO yes yes nptr offset FillBWScanCMYK ; BMF_CLR4 yes yes nptr offset FillBWScanCMYK ; BMF_CLR8 yes yes nptr offset FillBWScanCMYK ; BMF_CLR24 yes yes nptr offset FillBWScanCMYK ; BMF_CMYK yes yes ; these are offsets to the byte mode routines in the ; bitmap module PLByteModeRout label nptr nptr ByteCLEAR nptr ByteCOPY nptr ByteNOP nptr ByteAND nptr ByteINV nptr ByteXOR nptr ByteSET nptr ByteOR VidEnds PutLine ;---------------------------------------------------------------------------- ; Driver jump table (used by DriverStrategy) ;---------------------------------------------------------------------------- driverJumpTable label word dw 0 ; intiialization dw 0 ; last gasp dw 0 ; suspend dw 0 ; unsuspend dw 0 ; test for device existance dw 0 ; set device type dw 0 ; get ptr to info block dw 0 ; get exclusive dw 0 ; start exclusive dw 0 ; end exclusive dw offset cmykcode:VidGetPixel ; get a pixel color dw offset cmykcode:CMYKCallMod ; GetBits in another module dw 0 ; set the ptr pic dw 0 ; hide the cursor dw 0 ; show the cursor dw 0 ; move the cursor dw 0 ; set save under area dw 0 ; restore save under area dw 0 ; nuke save under area dw 0 ; request save under dw 0 ; check save under dw 0 ; get save under info dw 0 ; check s.u. collision dw 0 ; set xor region dw 0 ; clear xor region dw offset cmykcode:VidDrawRect ; rectangle dw offset cmykcode:VidPutString ; char string dw offset cmykcode:CMYKCallMod ; BitBlt in another module dw offset cmykcode:CMYKCallMod ; PutBits in another module dw offset cmykcode:CMYKCallMod ; DrawLine in another module dw offset cmykcode:VidDrawRegion ; draws a region dw offset cmykcode:CMYKCallMod ; PutLine in another module dw offset cmykcode:CMYKCallMod ; Polygon in another module dw 0 ; ScreenOn in another module dw 0 ; ScreenOff in another module dw offset cmykcode:CMYKCallMod ; Polyline in another module dw offset cmykcode:CMYKCallMod ; DashLine in another module dw offset cmykcode:CMYKCallMod ; DashFill in another module dw 0 ; SetPalette elsewhere dw 0 ; GetPalette elsewhere .assert ($-driverJumpTable) eq VidFunction ; this table holds offsets to the routines in different modules moduleTable label fptr fptr 0 ; intiialization fptr 0 ; last gasp fptr 0 ; suspend fptr 0 ; unsuspend fptr 0 ; test for device existance fptr 0 ; set device type fptr 0 ; get ptr to info block fptr 0 ; get exclusive fptr 0 ; start exclusive fptr 0 ; end exclusive fptr 0 ; get a pixel color fptr CMYKMisc:VidGetBits ; GetBits in another module fptr 0 ; set the ptr pic fptr 0 ; hide the cursor fptr 0 ; show the cursor fptr 0 ; move the cursor fptr 0 ; set save under area fptr 0 ; restore save under area fptr 0 ; nuke save under area fptr 0 ; request save under fptr 0 ; check save under fptr 0 ; get save under info fptr 0 ; check s.u. collision fptr 0 ; set xor region fptr 0 ; clear xor region fptr 0 ; rectangle fptr 0 ; char string fptr CMYKBlt:VidBitBlt ; BitBlt in another module fptr CMYKBitmap:VidPutBits ; PutBits in another module fptr CMYKLine:VidDrawLine ; DrawLine in another module fptr 0 ; draws a region fptr CMYKPutLine:VidPutLine ; PutLine in another module fptr CMYKLine:VidPolygon ; Polygon in another module fptr 0 ; ScreenOn in another module fptr 0 ; ScreenOff in another module fptr CMYKLine:VidPolyline ; Polyline in another module fptr CMYKLine:VidDashLine ; DashLine in another module fptr CMYKLine:VidDashFill ; DashFill in another module fptr 0 ; SetPalette elsewhere fptr 0 ; GetPalette elsewhere .assert ($-moduleTable) eq (VidFunction*2) ;---------------------------------------------------------------------------- ; Video Semaphores ;---------------------------------------------------------------------------- videoSem Semaphore <1,0>
34.87234
80
0.650702
3e5942e2f77d4b3b5edba51615ec660308ac5219
299
asm
Assembly
programs/oeis/159/A159325.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/159/A159325.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
programs/oeis/159/A159325.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
; A159325: Median number of comparisons used by insertion sort on n (distinct) elements. ; 0,1,3,5,8,11,15,19,24,30,36,42,49,56,64,73,82,91,101,111,122,134,146,158,171,185 mov $2,$0 mul $0,2 mov $1,$0 lpb $0 mul $1,2 pow $1,2 mov $3,$0 mov $0,1 mul $3,2 lpe add $1,$3 div $1,63 add $1,$2
17.588235
88
0.628763
1a45d6821e4466d2f0bf7b530c58cc6b0edfba4a
144
asm
Assembly
other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/日本_Ver1/sfc/ys_w13.asm
prismotizm/gigaleak
d082854866186a05fec4e2fdf1def0199e7f3098
[ "MIT" ]
null
null
null
other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/日本_Ver1/sfc/ys_w13.asm
prismotizm/gigaleak
d082854866186a05fec4e2fdf1def0199e7f3098
[ "MIT" ]
null
null
null
other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/日本_Ver1/sfc/ys_w13.asm
prismotizm/gigaleak
d082854866186a05fec4e2fdf1def0199e7f3098
[ "MIT" ]
null
null
null
Name: ys_w13.asm Type: file Size: 27621 Last-Modified: '2016-05-13T04:51:16Z' SHA-1: 6D51F1D542343A523A8198ADA1505263F2F29AE8 Description: null
20.571429
47
0.8125
9d7ad84438be122485d56d064c00d969e85853a1
474
asm
Assembly
oeis/237/A237353.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/237/A237353.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/237/A237353.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A237353: For n=g+h, a(n) is the minimum value of omega(g)+omega(h). ; Submitted by Jon Maiga ; 0,1,1,1,1,2,1,1,1,2,1,2,1,2,2,1,1,2,1,2,2,2,1,2,1,2,1,2,1,2,1,1,2,2,2,2,1,2,2,2,1,2,1,2,2,2,1,2,1,2,2,2,1,2,2,2,2,2,1,2,1,2,2,1,2,2,1,2,2,2,1,2,1,2,2,2,2,2,1,2,1,2,1,2,2,2,2,2,1,2,2,2,2,2,2,2,1,2,2,2 lpb $0 mov $2,$0 mov $0,0 mov $3,$2 cmp $3,0 add $2,$3 seq $2,230799 ; The number of distinct nonzero coefficients in the n-th cyclotomic polynomial. lpe mov $0,$2
33.857143
201
0.586498
56ee7e65bd158f29651bf696542f60d22118f7a6
2,731
asm
Assembly
programs/oeis/017/A017206.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/017/A017206.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/017/A017206.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A017206: a(n) = (9*n + 3)^10. ; 59049,61917364224,16679880978201,590490000000000,8140406085191601,64925062108545024,362033331456891249,1568336880910795776,5631351470947265625,17490122876598091776,48398230717929318249,121899441999475713024,283942098606901565601,619173642240000000000,1276136419117121619201,2504902718110474036224,4711653532607691047049,8535834451185868210176,14956826027973134765625,25438557613203014501376,42122185590781554706449,68078861925529707085824,107636749520976961802001,166798809782010000000000,253770507618165375615801,379619462565741198311424,559092234403032700371849,811616880235713665688576,1162523670191533212890625,1644520413237918591614976,2299463235875612705183649,3180468387218973248922624,4354415726901861885367401,5904900000000000000000000,7935691828389105528301401,10574776563315896351130624,13979045762098993055105649,18339723085451720682110976,23888613873581638681640625,30905275561625163865752576,39725214450772735983309849,50749223173283452812263424,64453982490130814650341801,81404060851916010000000000,102265455449584888327196001,127820829294042245259853824,158986610205625133715088449,196832129478228454438757376,242600990421323914541015625,297734869988830416051634176,363899970289432891533245049,443016350951160383613748224,537290388096475613165205201,649250621085450240000000000,781787264216455333610219601,938195677248838082877441024,1122224105942936326061760249,1338126021812154918975307776,1590717408962345123291015625,1885439365268042931666379776,2228426405215887395008749249,2626580872545408423007617024,3087653892348998035244837601,3620333314568912490000000000,4234339123862247954529692201,4940526814607642247350452224,5750999254412632523130161049,6679227584860796427425842176,7740181734425675064931640625,8950471145486672944353509376,10328496345223305728741182449,11894612018850973975317709824,13671302273206532936786519001,15683368809107957760000000000,17958132752212022900976333801,20525650924289777120787047424,23418947369944353878040930849,26674260987821964133794840576,30331310150327427376962890625,34433575231762959905906942976,39028600001675809908107504649,44168312878039359507869466624,49909369073716157545145929401,56313514709472656250000000000,63447974007646853030203264401,71385860722424238137224986624,80206615005567072861632309649,89996466950379723975933182976,100848928101691211234384765625,112865312265707938698495000576,126155287000747430327098275849,140837457218120428494221927424,157039982371796593719713148801,174901228765980917760000000000,194570458561356483152650004001,216208557113527023181799629824,239988800331132509875292137449,266097663796225376901714149376,294735675445796621949697265625,326118313670842582186084402176 mul $0,9 add $0,3 pow $0,10
390.142857
2,669
0.9513
959876bfd8743ff3543af33459e9ab762d9988be
690
asm
Assembly
oeis/090/A090300.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/090/A090300.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/090/A090300.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A090300: a(n) = 14*a(n-1) + a(n-2), starting with a(0) = 2 and a(1) = 14. ; Submitted by Jon Maiga ; 2,14,198,2786,39202,551614,7761798,109216786,1536796802,21624372014,304278004998,4281516441986,60245508192802,847718631141214,11928306344169798,167844007449518386,2361744410637427202,33232265756373499214,467613464999866416198,6579820775754503325986,92585104325562912980002,1302771281333635285046014,18331383042996456903624198,257942133883284031935784786,3629521257408972904004611202,51071239737608904688000341614,718626877583933638536009393798,10111847525912679844192131854786 mov $3,1 lpb $0 sub $0,1 add $2,$3 mov $3,$1 mov $1,$2 mul $2,7 add $3,$2 lpe mov $0,$3 mul $0,2
43.125
478
0.810145
f88881337acc6acb2f890d411162438017f4d1f2
549
asm
Assembly
oeis/010/A010985.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/010/A010985.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/010/A010985.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A010985: Binomial coefficient C(n,32). ; 1,33,561,6545,58905,435897,2760681,15380937,76904685,350343565,1471442973,5752004349,21090682613,73006209045,239877544005,751616304549,2254848913647,6499270398159,18053528883775,48459472266975,125994627894135,317986441828055,780512175396135,1866442158555975,4355031703297275,9929472283517787,22150361247847371,48402641245296107,103719945525634515,218169540588403635,450883717216034179,916312070471295267,1832624140942590534,3609714217008132870,7007092303604022630,13413576695470557606 add $0,32 bin $0,32
91.5
486
0.894353
b17f32a658371ca78e0ef1894241647ab70afca5
267
asm
Assembly
programs/oeis/056/A056810.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/056/A056810.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/056/A056810.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A056810: Numbers whose fourth power is a palindrome. ; 0,1,11,101,1001,10001,100001,1000001,10000001,100000001,1000000001 sub $0,1 mov $2,$0 mov $3,$0 lpb $3 div $2,3 max $2,1 sub $3,2 lpe mov $1,10 pow $1,$0 mov $4,$1 cmp $4,0 add $1,$4 add $1,$2 mov $0,$1
14.052632
68
0.644195
898e1014592fe4bf59e2c02b6cfc32e06adda591
501
asm
Assembly
programs/oeis/314/A314668.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/314/A314668.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/314/A314668.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A314668: Coordination sequence Gal.6.115.6 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,5,9,13,17,21,25,29,33,37,41,45,50,55,59,63,67,71,75,79,83,87,91,95,100,105,109,113,117,121,125,129,133,137,141,145,150,155,159,163,167,171,175,179,183,187,191,195,200,205 mov $1,1 mov $2,$0 mov $3,$0 lpb $2,1 trn $1,$2 trn $2,11 mov $4,1 add $4,$2 add $1,$4 sub $2,1 lpe lpb $3,1 add $1,4 sub $3,1 lpe
26.368421
177
0.668663
854aad4c1338bfec8d56870ed6dc338a9742e13a
1,536
asm
Assembly
stats/customtext.asm
KScl/z3rasm
7739c9bd6a0c803b1e4e1f435af3178b8e04207b
[ "MIT" ]
null
null
null
stats/customtext.asm
KScl/z3rasm
7739c9bd6a0c803b1e4e1f435af3178b8e04207b
[ "MIT" ]
null
null
null
stats/customtext.asm
KScl/z3rasm
7739c9bd6a0c803b1e4e1f435af3178b8e04207b
[ "MIT" ]
null
null
null
;================================================================================ ; Text written by the randomizer ;-------------------------------------------------------------------------------- table "textmaps/credit_b_hi.map" YourSpriteCreditsHi: db 2, 55 : db " " ; $23F002 table "textmaps/credit_b_lo.map" YourSpriteCreditsLo: db 2, 55 : db " " ; $23F020 table "textmaps/credit_b_hi.map" CollectionRateHi: db 2, 55 : db "COLLECTION RATE /216" ; Counter at $23F057 table "textmaps/credit_b_lo.map" CollectionRateLo: db 2, 55 : db "COLLECTION RATE /216" ; Counter at $23F075 ;-------------------------------------------------------------------------------- ; Custom stat lines ;-------------------------------------------------------------------------------- table "textmaps/credit_b_hi.map" ExtraStat1Hi: db 2, 55 : db " " ; $23F07A table "textmaps/credit_b_lo.map" ExtraStat1Lo: db 2, 55 : db " " ; $23F098 table "textmaps/credit_b_hi.map" ExtraStat2Hi: db 2, 55 : db " " ; $23F0B6 table "textmaps/credit_b_lo.map" ExtraStat2Lo: db 2, 55 : db " " ; $23F0D4 table "textmaps/credit_b_hi.map" ExtraStat3Hi: db 2, 55 : db " " ; $23F0F2 table "textmaps/credit_b_lo.map" ExtraStat3Lo: db 2, 55 : db " " ; $23F110 ;--------------------------------------------------------------------------------
33.391304
81
0.413411
3a13410b5c15df2931e43598a633ba1984716789
252
asm
Assembly
libsrc/_DEVELOPMENT/sound/bit/c/sdcc_ix/bit_beep_di.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
libsrc/_DEVELOPMENT/sound/bit/c/sdcc_ix/bit_beep_di.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
libsrc/_DEVELOPMENT/sound/bit/c/sdcc_ix/bit_beep_di.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
; void bit_beep_di(uint16_t duration_ms, uint16_t frequency_hz) SECTION code_sound_bit PUBLIC _bit_beep_di EXTERN l0_bit_beep_di_callee _bit_beep_di: pop af pop hl pop de push de push hl push af jp l0_bit_beep_di_callee
12
63
0.746032
72c8d1e8a6ae1531ae3d1fdc39a978bc0cf55a28
335
asm
Assembly
programs/oeis/021/A021088.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/021/A021088.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/021/A021088.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A021088: Decimal expansion of 1/84. ; 0,1,1,9,0,4,7,6,1,9,0,4,7,6,1,9,0,4,7,6,1,9,0,4,7,6,1,9,0,4,7,6,1,9,0,4,7,6,1,9,0,4,7,6,1,9,0,4,7,6,1,9,0,4,7,6,1,9,0,4,7,6,1,9,0,4,7,6,1,9,0,4,7,6,1,9,0,4,7,6,1,9,0,4,7,6,1,9,0,4,7,6,1,9,0,4,7,6,1 add $0,1 mov $1,10 pow $1,$0 sub $1,6 mul $1,9 div $1,18 add $1,4 div $1,42 mod $1,10 mov $0,$1
23.928571
199
0.540299
e2a95db76d974a44da50ef91b2b99e23f5d20827
553
asm
Assembly
programs/oeis/100/A100036.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/100/A100036.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/100/A100036.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A100036: a(n) = smallest m such that A100035(m) = n. ; 1,2,3,5,7,12,14,23,25,38,40,57,59,80,82,107,109,138,140,173,175,212,214,255,257,302,304,353,355,408,410,467,469,530,532,597,599,668,670,743,745,822,824,905,907,992,994,1083,1085,1178,1180,1277,1279,1380 mov $1,$0 lpb $0,4 seq $0,20639 ; Lpf(n): least prime dividing n (when n > 1); a(1) = 1. Or, smallest prime factor of n, or smallest prime divisor of n. mov $2,$1 mod $1,1 add $1,1 cmp $1,$0 trn $0,2 add $1,$2 sub $1,2 add $15,$2 lpe mul $1,$0 sub $1,$15 sub $0,$1 add $0,1
27.65
204
0.631103
2669c4dbe2b251542d694829efb3dc8c58b384f2
37
asm
Assembly
test/assembler/push_i16_v/data/program.asm
jfitz/virtual-processor
b6aa15e7ed210ab862c9c80bbc7c46859ab50501
[ "MIT" ]
null
null
null
test/assembler/push_i16_v/data/program.asm
jfitz/virtual-processor
b6aa15e7ed210ab862c9c80bbc7c46859ab50501
[ "MIT" ]
null
null
null
test/assembler/push_i16_v/data/program.asm
jfitz/virtual-processor
b6aa15e7ed210ab862c9c80bbc7c46859ab50501
[ "MIT" ]
null
null
null
MAIN: PUSH I16 14920 OUT OUT EXIT
7.4
20
0.702703