content
stringlengths
5
1.04M
avg_line_length
float64
1.75
12.9k
max_line_length
int64
2
244k
alphanum_fraction
float64
0
0.98
licenses
sequence
repository_name
stringlengths
7
92
path
stringlengths
3
249
size
int64
5
1.04M
lang
stringclasses
2 values
.setcpu "65C02" .include "x16.inc" ;.org $0800 .segment "STARTUP" .segment "INIT" .segment "ONCE" .segment "CODE" jmp start message: .byte "HELLO" end_msg: NEWLINE = $0D UPPERCASE = $8E start: ; force uppercase lda #UPPERCASE jsr CHROUT ; print message lda #<message sta ZP_PTR_1 lda #>message sta ZP_PTR_1+1 ldy #0 @loop: cpy #(end_msg-message) beq @done lda (ZP_PTR_1),y jsr CHROUT iny bra @loop @done: ; print newline lda #NEWLINE jsr CHROUT rts
11.976744
25
0.631068
[ "CC0-1.0" ]
adolf01/CX16_CC65_BASE
src/main.asm
515
Assembly
;;; ;;; This is Suggested Project 8.4.2.1 ;;; Sum a list of numbers ;;; Pg. 152 for the problem ;;; Pg. 24 for Registers; Pg. 48 for Data Types SECTION .data SUCCESS: equ 0 ; Default success value SYS_EXIT: equ 60 ; Default system exit value ;; Variables used by the project List: dd 2, 4, 6, 8, 10 ; List of numbers Len: dd 5 ; Length of list Sum: dd 0 ; Sum of list of numbers SECTION .text ; Code Section global _start ; Standard start _start: mov ecx, dword [Len] ; Set length mov eax, 0 loop: add eax, dword [List + ((ecx - 1) * 4)] ; Add list element loop loop mov dword [Sum], eax ; Done, terminate program last: mov rax, SYS_EXIT ; Call code for exit mov rdi, SUCCESS ; Exit with success syscall
31.066667
72
0.527897
[ "MIT" ]
pcooksey/Assembly-x86-64
chapter8/Project1.asm
932
Assembly
; A138690: Numbers of the form 56+p^2 (where p is a prime). ; 60,65,81,105,177,225,345,417,585,897,1017,1425,1737,1905,2265,2865,3537,3777,4545,5097,5385,6297,6945,7977,9465,10257,10665,11505,11937,12825,16185,17217,18825,19377,22257,22857,24705,26625,27945,29985 seq $0,6005 ; The odd prime numbers together with 1. pow $0,2 max $0,4 add $0,56
43.25
203
0.745665
[ "Apache-2.0" ]
ckrause/cm
programs/oeis/138/A138690.asm
346
Assembly
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1990 -- All Rights Reserved PROJECT: PC GEOS MODULE: Serial Driver - Public Interface FILE: serial.asm AUTHOR: Adam de Boor, Jan 12, 1990 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- Adam 1/12/90 Initial revision andres 12/10/96 Modified for Penelope DESCRIPTION: Code to communicate with multiple serial ports. Some notes of interest: There can be up to four serial ports on some machines, but there are only two interrupt levels allocated to the things, and most cards don't handle sharing the levels well at all (maybe because they're edge-triggered...). Some cards, however, offer other levels besides SDI_ASYNC and SDI_ASYNC_ALT, so we allow the user to specify the level in the .ini file under the [serial] category: port 1 = <num> gives the interrupt level for COM1 port 2 = <num> gives the interrupt level for COM2 port 3 = <num> gives the interrupt level for COM3 port 4 = <num> gives the interrupt level for COM4 The given interrupt level is verified, however, and the specification ignored if it is not correct. When a port is opened, its interrupt vector will be snagged by the driver, but not before then. $Id: serialMain.asm,v 1.96 98/05/05 17:49:49 cthomas Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ include serial.def include initfile.def include heap.def ; need HF_FIXED UseDriver Internal/powerDr.def if LOG_MODEM_SETTINGS include Internal/log.def endif DefStub macro realFunc Resident segment resource realFunc&Stub proc near call realFunc ret realFunc&Stub endp Resident ends endm ;------------------------------------------------------------------------------ ; MISCELLANEOUS VARIABLES ;------------------------------------------------------------------------------ idata segment if STANDARD_PC_HARDWARE if NEW_ISR primaryVec SerialVectorData <,,MiniSerialPrimaryInt,SDI_ASYNC> alternateVec SerialVectorData <,,MiniSerialAlternateInt,SDI_ASYNC_ALT> weird1Vec SerialVectorData <,,MiniWeird1Int> weird2Vec SerialVectorData <,,MiniWeird2Int> else primaryVec SerialVectorData <,,SerialPrimaryInt,SDI_ASYNC> alternateVec SerialVectorData <,,SerialAlternateInt,SDI_ASYNC_ALT> weird1Vec SerialVectorData <,,SerialWeird1Int> ; Data for first weird ; port interrupting at ; non-standard level weird2Vec SerialVectorData <,,SerialWeird2Int> ; Data for second weird ; port interrupting at ; non-standard level endif ; NEW_ISR irpc n,<12345678> ; ; Data for the active port ; com&n SerialPortData < 0,0,0, offset com&n&_Sem, offset com&n&_passive, 0, SERIAL_COM&n > com&n&_Sem Semaphore ; ; Data for the passive port ; com&n&_passive SerialPortData < 0,0,0, offset com&n&_passive_Sem, offset com&n, mask SPS_PASSIVE, SERIAL_COM&n&_PASSIVE > com&n&_passive_Sem Semaphore endm ; ; com port table of structures ; comPorts nptr.SerialPortData com1, com2, com3, com4, com5, com6, com7, com8 ; ; These are the passive representations of the serial ports, used when ; dealing with a passive (read-only, preemptible) connection. ; comPortsPassive nptr.SerialPortData com1_passive, com2_passive, com3_passive, com4_passive, com5_passive, com6_passive, com7_passive, com8_passive else ImplementMe endif ; ------------------- HARDWARE TYPE --------------------------------- idata ends udata segment ; ; Device map to return from DR_STREAM_GET_DEVICE_MAP ; deviceMap SerialDeviceMap <0,0,0,0,0,0,0,0> powerStrat fptr.far udata ends if INTERRUPT_STAT udata segment com1Stat InterruptStatStructure com2Stat InterruptStatStructure com3Stat InterruptStatStructure udata ends endif ; INTERRUPT_STAT ;------------------------------------------------------------------------------ ; Driver info table ;------------------------------------------------------------------------------ Resident segment resource DriverTable DriverInfoStruct < SerialStrategy, mask DA_CHARACTER, DRIVER_TYPE_STREAM > ForceRef DriverTable Resident ends idata segment numPorts word 0 ; No known ports... will be changed by ; SerialRealInit idata ends Resident segment resource DefFunction macro funcCode, routine if ($-serialFunctions) ne funcCode ErrMessage <routine not in proper slot for funcCode> endif .assert (TYPE routine eq NEAR) AND (SEGMENT routine eq @CurSeg), <Improper serial handler routine> nptr routine endm serialFunctions label nptr DefFunction DR_INIT, SerialInitStub DefFunction DR_EXIT, SerialExitStub DefFunction DR_SUSPEND, SerialSuspend DefFunction DR_UNSUSPEND, SerialUnsuspend DefFunction DR_STREAM_GET_DEVICE_MAP, SerialGetDeviceMap DefFunction DR_STREAM_OPEN, SerialOpenStub DefFunction DR_STREAM_CLOSE, SerialCloseStub DefFunction DR_STREAM_SET_NOTIFY, SerialSetNotify DefFunction DR_STREAM_GET_ERROR, SerialHandOff DefFunction DR_STREAM_SET_ERROR, SerialHandOff DefFunction DR_STREAM_FLUSH, SerialFlush DefFunction DR_STREAM_SET_THRESHOLD, SerialHandOff DefFunction DR_STREAM_READ, SerialRead DefFunction DR_STREAM_READ_BYTE, SerialReadByte DefFunction DR_STREAM_WRITE, SerialWrite DefFunction DR_STREAM_WRITE_BYTE, SerialWriteByte DefFunction DR_STREAM_QUERY, SerialHandOff DefFunction DR_SERIAL_SET_FORMAT, SerialSetFormat DefFunction DR_SERIAL_GET_FORMAT, SerialGetFormat DefFunction DR_SERIAL_SET_MODEM, SerialSetModem DefFunction DR_SERIAL_GET_MODEM, SerialGetModem DefFunction DR_SERIAL_OPEN_FOR_DRIVER, SerialOpenStub DefFunction DR_SERIAL_SET_FLOW_CONTROL, SerialSetFlowControl DefFunction DR_SERIAL_DEFINE_PORT, SerialDefinePortStub DefFunction DR_SERIAL_STAT_PORT, SerialStatPort DefFunction DR_SERIAL_CLOSE_WITHOUT_RESET, SerialCloseWithoutResetStub DefFunction DR_SERIAL_REESTABLISH_STATE, SerialReestablishState DefFunction DR_SERIAL_PORT_ABSENT, SerialPortAbsent DefFunction DR_SERIAL_GET_PASSIVE_STATE, SerialGetPassiveState DefFunction DR_SERIAL_GET_MEDIUM, SerialGetMedium DefFunction DR_SERIAL_SET_MEDIUM, SerialSetMedium DefFunction DR_SERIAL_SET_BUFFER_SIZE, SerialSetBufferSizeStub DefFunction DR_SERIAL_ENABLE_FLOW_CONTROL, SerialEnableFlowControl DefFunction DR_SERIAL_SET_ROLE, SerialSetRole COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialStrategy %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Entry point for all serial-driver functions CALLED BY: GLOBAL PASS: di = routine number bx = open port number (usually) RETURN: depends on function, but an ever-present possibility is carry set with AX = STREAM_CLOSING DESTROYED: PSEUDO CODE/STRATEGY: There are three classes of functions in this interface: - those that open a port - those that work on an open port - those that don't require a port to be open Each open port has a reference count that must be incremented for #2 functions on entry and decremented on exit. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 1/14/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ;serialData sptr dgroup SerialStrategy proc far uses es, ds .enter push bx EC < cmp di, SerialFunction > EC < ERROR_AE INVALID_FUNCTION > segmov es, ds ; In case segment passed in DS push bx mov bx, handle dgroup call MemDerefDS pop bx ; mov ds, cs:serialData cmp di, DR_STREAM_OPEN jb openNotNeeded je openCall cmp di, DR_SERIAL_OPEN_FOR_DRIVER je openCall cmp di, DR_SERIAL_DEFINE_PORT je definePort cmp di, DR_SERIAL_STAT_PORT je openNotNeeded cmp di, DR_SERIAL_SET_MEDIUM ja mustBeOpen cmp di, DR_SERIAL_GET_PASSIVE_STATE jae openNotNeeded ;(get_passive_state, ;get_medium, and set_medium may ;all be done with the port open ;or closed) mustBeOpen: ; ; Point at port data if already open -- most things will ; need it. ; call SerialGetPortData ; bx <- port data offset ; ; Up the reference count if the port is open. Fail if it's closed. ; call SysEnterCritical IsPortOpen bx jg portNotOpen inc ds:[bx].SPD_refCount call SysExitCritical ; ; Call the function. ; push ds, bx call cs:serialFunctions[di] pop ds, bx decRefCount: ; ; Port open/call complete. Reduce the reference count and clean up the ; streams/V the openSem if the count is now 0. Again the check & cleanup ; must be atomic. The port state should have been reestablished, and ; any control returned to the passive open, in SerialClose ; pushf call SysEnterCritical EC < tst ds:[bx].SPD_refCount > EC < ERROR_Z REF_COUNT_UNDERFLOW > dec ds:[bx].SPD_refCount jz cleanUpStreams popf exitCriticalAndExit: call SysExitCritical exit: pop bx .leave ret openCall: ; ; Open the port and reduce the reference count (initialized to 2) if ; the open succeeds. ; call SerialOpen jnc decRefCount ; ; If opened passive port preempted, we still need to drop the refcount ; cmp ax, STREAM_ACTIVE_IN_USE stc je decRefCount jmp exit openNotNeeded: ; ; Port doesn't need to be open, so don't bother with the reference ; count or open semaphore. ; call cs:serialFunctions[di] jmp exit portNotOpen: ; ; ERROR: Port is not open. return with carry set and an error enum ; mov ax, STREAM_CLOSED ; signal error type stc jmp exitCriticalAndExit definePort: ; ; Defining a new port. No reference count shme, but we have to ; return a different BX than we were passed, so we have to handle ; this specially. ; call cs:serialFunctions[di] inc sp ; return the BX we got back inc sp push bx jmp exit cleanUpStreams: ; ; Ref count down to 0. Finish destroying the two streams and release ; the port. ; push cx, dx, ax clr cx xchg ds:[bx].SPD_inStream, cx clr dx xchg ds:[bx].SPD_outStream, dx mov bx, ds:[bx].SPD_openSem VSem ds, [bx], TRASH_AX_BX ; ; Exit critical section before attempting to free up the streams. ; call SysExitCritical ; ; Free the input stream. ; mov bx, cx tst bx jz inStreamGone call StreamFree inStreamGone: ; ; Then the output stream. ; mov bx, dx tst bx jz cleanUpDone call StreamFree cleanUpDone: ; ; Boogie with appropriate error code & flag from call. ; pop cx, dx, ax popf jmp exit SerialStrategy endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialGetPortData %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Return the offset for the active or passive SerialPortData associated with a passed SerialPortNum. CALLED BY: Internal PASS: bx - SerialPortNum ds - serialData segment RETURN: bx - offset to either the active or passive SerialPortData as indicated by the passed SerialPortNum. DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jeremy 4/ 8/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialGetPortDataFAR proc far .enter call SerialGetPortData .leave ret SerialGetPortDataFAR endp SerialGetPortData proc near uses si .enter EC < push ax, bx > EC < and bx, (not SERIAL_PASSIVE) > EC < test bx, 1 > EC < ERROR_NZ INVALID_PORT_NUMBER > EC < cmp bx, SERIAL_COM8 > EC < ERROR_A INVALID_PORT_NUMBER > ;EC < mov ax, cs:serialData > EC < push es > EC < mov bx, handle dgroup > EC < call MemDerefES > EC < mov ax, es > EC < pop es > EC < mov bx, ds > EC < cmp ax, bx > EC < ERROR_NE DS_NOT_POINTING_TO_SERIAL_DATA > EC < pop ax, bx > mov si, offset comPorts test bx, SERIAL_PASSIVE jz loadOffset ; jump if active port ; ; The requested port has the passive flag set. Clear the ; flag, and the offset will be appropriate for indexing into ; the comPortsPassive table. ; mov si, offset comPortsPassive and bx, (not SERIAL_PASSIVE) loadOffset: mov bx, ds:[si][bx] .leave ret SerialGetPortData endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialInitStub %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Front-end for DR_INIT function. Just calls to SerialInit, which is movable. CALLED BY: DR_INIT (SerialStrategy) PASS: ds = dgroup RETURN: Carry clear if we're happy DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 1/14/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialInitStub proc near .enter CallMod SerialInit .leave ret SerialInitStub endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialExitStub %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle driver exit. CALLED BY: DR_EXIT (SerialStrategy) PASS: Nothing RETURN: Carry clear if we're happy, which we generally are... DESTROYED: PSEUDO CODE/STRATEGY: Nothing to do on exit, in contrast to init, so we don't. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 1/14/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialExitStub proc near .enter CallMod SerialExit .leave ret SerialExitStub endp Resident ends OpenClose segment resource if INTERRUPT_STAT COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialResetStatVar %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Clear all variables in stat CALLED BY: SerialOpen PASS: ds:si = SerialPortData for the port that was open just now RETURN: nothing DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 4/29/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialResetStatVar proc near uses ax, di, es .enter segmov es, ds, ax clr ax mov di, offset com1Stat cmp si, offset com1 je doclr mov di, offset com2Stat cmp si, offset com2 je doclr mov di, offset com3Stat cmp si, offset com3 je doclr jmp exit doclr: mov cx, size InterruptStatStructure rep stosw exit: .leave ret SerialResetStatVar endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialWriteOutStat %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Write out contents of stat variables to Ini file CALLED BY: SerialClose PASS: ds:si = SerialPortData of the port just closed RETURN: nothing DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 4/29/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ com1Str char "com1",0 com2Str char "com2",0 com3Str char "com3",0 SerialWriteOutStat proc near uses ds,es,di,si .enter segmov es, ds, di segmov ds, cs, di cmp si, offset com1 jne ne1 mov di, offset com1Stat mov si, offset com1Str jmp doWrite ne1: cmp si, offset com2 jne ne2 mov di, offset com2Stat mov si, offset com2Str jmp doWrite ne2: cmp si, offset com3 jne ne3 mov di, offset com3Stat mov si, offset com3Str jmp doWrite ne3: jmp done doWrite: call WriteOutStat done: .leave ret SerialWriteOutStat endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% WriteOutStat %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Write out stat CALLED BY: SerialWriteOutStat PASS: es:di = one of com1Stat/com2Stat/com3Stat ds:si = pointer to correct category string: com1Str/com2Str/etc RETURN: nothing DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- SJ 4/29/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ interruptCountStr char "interruptCount",0 errorCountStr char "errorCount",0 xmitIntCountStr char "xmitIntCount",0 recvIntCountStr char "recvIntCount",0 fifoTimeoutStr char "fifoTimeout", 0 modemStatusCountStr char "modemStatusCount", 0 noActionCountStr char "noActionCount",0 bogusIntCountStr char "bogusIntCount",0 overrunCountStr char "overrunCount",0 bufferFullCountStr char "bufferFullCount",0 WriteOutStat proc near uses cx,dx,bp .enter mov cx, cs mov bp, es:[di].ISS_interruptCount mov dx, offset interruptCountStr call InitFileWriteInteger mov bp, es:[di].ISS_errorCount mov dx, offset errorCountStr call InitFileWriteInteger mov bp, es:[di].ISS_xmitIntCount mov dx, offset xmitIntCountStr call InitFileWriteInteger mov bp, es:[di].ISS_recvIntCount mov dx, offset recvIntCountStr call InitFileWriteInteger mov bp, es:[di].ISS_fifoTimeout mov dx, offset fifoTimeoutStr call InitFileWriteInteger mov bp, es:[di].ISS_modemStatusCount mov dx, offset modemStatusCountStr call InitFileWriteInteger mov bp, es:[di].ISS_noActionCount mov dx, offset noActionCountStr call InitFileWriteInteger mov bp, es:[di].ISS_bogusIntCount mov dx, offset bogusIntCountStr call InitFileWriteInteger mov bp, es:[di].ISS_overrunCount mov dx, offset overrunCountStr call InitFileWriteInteger mov bp, es:[di].ISS_bufferFullCount mov dx, offset bufferFullCountStr call InitFileWriteInteger .leave ret WriteOutStat endp endif ; INTERRUPT_STAT COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialFindVector %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Find the interrupt vector for a port. CALLED BY: SerialInitPort, SerialClose PASS: ds:si = SerialPortData for the port RETURN: cx = device interrupt level ds:di = SerialVectorData to use carry set if no interrupt vector allocated to the port DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 1/15/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialFindVector proc near .enter clr cx mov cl, ds:[si].SPD_irq ; cx <- interrupt level cmp cl, -1 je noInts ; -1 means can't interrupt ; ; Check known interrupt levels first ; mov di, offset primaryVec if STANDARD_PC_HARDWARE cmp cl, SDI_ASYNC ; Primary vector? je haveVec mov di, offset alternateVec cmp cl, SDI_ASYNC_ALT ; Alternate vector? je haveVec ; ; Not a known level, so see if one of the weird interrupt ; vector slots is available for use (or is already bound ; to this level). ; mov di, offset weird1Vec cmp ds:[di].SVD_irq, cl je haveVec tst ds:[di].SVD_port ; Weird1 taken? jz setVec mov di, offset weird2Vec cmp ds:[di].SVD_irq, cl je haveVec tst ds:[di].SVD_port ; Weird2 taken? jz setVec endif ; STANDARD_PC_HARDWARE noInts: stc ; Signal no vector available haveVec: .leave ret if STANDARD_PC_HARDWARE setVec: mov ds:[di].SVD_irq, cl ; Claim this vector ; for our own. jmp haveVec endif SerialFindVector endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialInitVector %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Snag an interrupt vector. Unmasks the interrupt and makes sure any pending interrupt for the level has been acknowledged (this last is for init code, but can be useful...) CALLED BY: SerialCheckPort, SerialInitPort PASS: di = SerialVectorData in dgroup for vector to be caught ds:si = SerialPortData for port on whose behalf the vector is being caught. bx = segment of handling routine ds = es RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: turn off interrupts fetch interrupt level from data and vector it to the proper handler figure the interrupt mask for the level fetch the current mask from the proper controller save the state of the mask bit for this level enable the interrupt in the controller send a specific end-of-interrupt command to the controller in charge for this level. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/13/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialInitVector proc far uses ax, dx, bx, cx, es .enter INT_OFF tst ds:[di].SVD_port jnz done ; non-zero => already intercepted ; ; Catch the interrupt vector ; push bx mov bx, handle dgroup call MemDerefES pop bx ; segmov es, dgroup, ax clr ax mov al, ds:[di].SVD_irq mov cx, ds:[di].SVD_handler push di call SysCatchDeviceInterrupt pop di mov cl, ds:[di].SVD_irq ; ; Figure which controller to change ; mov dx, IC1_MASKPORT cmp cl, 8 jl 10$ sub cl, 8 if STANDARD_PC_HARDWARE ; ; Deliver specific EOI for chained-controller level to the ; first controller while we're here... ; mov al, IC_SPECEOI or 2 out IC1_CMDPORT, al endif mov dx, IC2_MASKPORT 10$: ; ; Fetch the current mask and mask out the bit for this interrupt ; level, saving it away in SVD_mask for restoration by ; SerialResetVector. ; mov ah, 1 shl ah, cl in al, dx and ah, al mov ds:[di].SVD_mask, ah ; ; Invert the result and mask the current interrupt-mask with it ; If the bit for the level was already 0, this won't change ; anything (only 1 bit was set in ah originally). If the bit ; was 1, however, this will clear it. ; not ah and al, ah out dx, al ; ; Send a specific EOI for the level to the affected controller. ; if STANDARD_PC_HARDWARE mov al, IC_SPECEOI or al, cl CheckHack <IC1_CMDPORT - IC1_MASKPORT eq -1> dec dx endif ; STANDARD_PC_HARDWARE out dx, al done: ; ; Add this port to the list of ports for the interrupt vector. ; mov ax, ds:[di].SVD_port mov ds:[si].SPD_next, ax mov ds:[di].SVD_port, si if NEW_ISR ; ; initialize interrupt handler table to be non-flow control version, ; as this is the faster of the two ( see FcHandlerTbl in ; serialHighSpeed.asm ) ; mov ds:[si].SPD_handlers, offset QuickHandlerTbl endif INT_ON .leave ret SerialInitVector endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialResetVector %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Reset an interrupt vector to its previous contents, re-masking the affected interrupt if it was masked before SerialInitVector was called. CALLED BY: SerialCheckPort, SerialClose PASS: di = SerialVectorData in dgroup si = SerialPortData offset of the port to unhook ds = dgroup RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/13/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialResetVector proc far uses ax, dx, bx, es .enter INT_OFF ; ; Remove the port from the list for this vector ; mov bx, handle dgroup call MemDerefES ; segmov es, dgroup, ax lea ax, ds:[di].SVD_port-SPD_next portLoop: mov bx, ax mov ax, ds:[bx].SPD_next EC < tst ax > EC < ERROR_Z VECTOR_PORT_LIST_CORRUPTED > cmp ax, si jne portLoop mov ax, ds:[si].SPD_next mov ds:[bx].SPD_next, ax ; ; If any ports are still using this interrupt vector, leave it alone ; tst ds:[di].SVD_port jnz stillInUse ; ; Reset the mask bit to its original state, then put back the original ; vector. ; mov dx, IC1_MASKPORT mov al, ds:[di].SVD_irq cmp al, 8 jl 10$ mov dx, IC2_MASKPORT 10$: in al, dx or al, ds:[di].SVD_mask out dx, al clr ax mov al, ds:[di].SVD_irq call SysResetDeviceInterrupt stillInUse: INT_ON .leave ret SerialResetVector endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialFetchPortStatePC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: fetch the port state for a PC-like port CALLED BY: SerialFetchPortState PASS: ds:si = SerialPortData ds:di = SerialPortState to fill RETURN: Void. DESTROYED: ax, dx PSEUDOCODE/STRATEGY: KNOWN BUGS/SIDEFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jimmy 5/ 4/93 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialFetchPortStatePC proc near .enter mov dx, ds:[si].SPD_base add dx, offset SP_lineCtrl in al, dx ; fetch line format first ; so we can mess with SF_DLAB mov ds:[di].SPS_format, al mov ah, al ornf al, mask SF_DLAB out dx, al ; go for the current baud rate jmp $+2 ; I/O delay sub dx, offset SP_lineCtrl in al, dx ; low byte mov ds:[di].SPS_baud.low, al inc dx in al, dx ; high byte mov ds:[di].SPS_baud.high, al mov al, ah add dx, offset SP_lineCtrl - offset SP_divHigh out dx, al ; reset line format jmp $+2 ; I/O delay inc dx ; dx <- SP_modemCtrl in al, dx mov ds:[di].SPS_modem, al add dx, offset SP_ien - offset SP_modemCtrl in al, dx mov ds:[di].SPS_ien, al .leave ret SerialFetchPortStatePC endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialFetchPortState %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Store the current state of the port in the port data for later restoration. CALLED BY: SerialInitPort, SerialCloseWithoutReset PASS: ds:si = SerialPortData for the port RETURN: nothing DESTROYED: ax PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 11/ 8/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialFetchPortState proc near uses dx, es, di, bx, cx .enter INT_OFF lea di, ds:[si].SPD_initState if STANDARD_PC_HARDWARE call SerialFetchPortStatePC endif ; STANDARD_PC_HARDWARE INT_ON ; ; Make sure we know the interrupt level at which the port is operating. ; cmp ds:[si].SPD_irq, -1 clc jne done if STANDARD_PC_HARDWARE mov bx, ds:[si].SPD_portNum ; ; Now try and figure the interrupt level for the port. ; call SerialCheckPort jnc portFound ; jump if found ; ; Not found, so clear the bit from our device map and return an error. ; mov cx, bx and cx, (not SERIAL_PASSIVE) ; nuke passive bit mov ax, not 1 rol ax, cl andnf ds:[deviceMap], ax mov ax, STREAM_NO_DEVICE stc endif ; STANDARD_PC_HARDWARE jmp done portFound: ; ; Copy the interrupt level and base to the passive port's data ; structure if we're opening an active port or to the ; active port if we're opening a passive port. ; mov ax, si ; save original pointer mov cl, ds:[si].SPD_irq mov dx, ds:[si].SPD_base mov si, ds:[si].SPD_otherPortData mov ds:[si].SPD_base, dx mov ds:[si].SPD_irq, cl mov si, ax ; recover original pointer done: .leave ret SerialFetchPortState endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialInitHWPC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: init a PC-like serial port CALLED BY: SerialInitPort PASS: ds:si = SerialPortData cx = buffer size RETURN: Void. DESTROYED: ax, dx PSEUDOCODE/STRATEGY: KNOWN BUGS/SIDEFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jimmy 5/ 3/93 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialInitHWPC proc near .enter mov dx, ds:[si].SPD_base add dx, offset SP_status ; Clear pending in al, dx ; error irq jmp $+2 add dx, offset SP_data-offset SP_status ; Clear pending in al, dx ; data avail ; irq jmp $+2 add dx, offset SP_iid - offset SP_data ; Clear pending in al, dx ; transmit irq jmp $+2 add dx, offset SP_modemStatus-offset SP_iid ;Clear pending in al, dx ; modem status jmp $+2 ; irq ; ; See if the port supports FIFOs. ; add dx, offset SP_iid - offset SP_modemStatus mov al, mask SFC_ENABLE or mask SFC_XMIT_RESET or \ mask SFC_RECV_RESET or \ (FIFO_RECV_THRESHOLD_SFS shl offset SFC_SIZE) out dx, al jmp $+2 in al, dx test al, mask SIID_FIFO_MODE jz raiseSignals jpo cantUseFIFO ; (see note there) ; ; 1/13/98 See if the input buffer is small. If so, don't use ; FIFO anyway. If this port is for a mouse, use of a FIFO ; produces jerky movement as the FIFO needs to time out before ; responding. We assume that a small buffer (<= 16 bytes) is ; for a serial mouse. -- eca cmp cx, 16 ; small buffer? jbe cantUseFIFO ; branch if so ; ; It does. Remember that we turned them on so we turn them off again ; when we're done. ; ornf ds:[si].SPD_flags, mask SPF_FIFO raiseSignals: ; ; Raise DTR and RTS on the port since it's open. Most things like to ; have them asserted (e.g. modems) and I doubt if things would get ; upset, so just do it here to save further calls by the user. ; mov al, mask SMC_OUT2 or mask SMC_DTR or mask SMC_RTS adjustModemControl:: add dx, offset SP_modemCtrl - offset SP_iid out dx, al mov ds:[si].SPD_curState.SPS_modem, al ; ; 4/28/94: wait 3 clock ticks here to allow things to react to ; having DTR asserted. In particular, this is here to allow a ; serial -> parallel converter manufactured by GDT Softworks to ; power up -- ardeb mov ax, 3 call TimerSleep ; ; Now enable interrupts for the port. Only enable the DATA_AVAIL and ; LINE_ERR interrupts until (1) we get data to transmit or (2) the user ; expresses an interest in modem status changes. ; add dx, offset SP_ien - offset SP_modemCtrl mov al, mask SIEN_DATA_AVAIL or mask SIEN_LINE_ERR mov ds:[si].SPD_ien, al out dx, al .leave ret cantUseFIFO: ; ; The original 16550 part had asynchronous (read: random) failures ; when operated in FIFO mode. On the 16550, the SIID_FIFO_MODE field ; is 2 when FIFOs are enabled, while on the (working) 16550A, the field ; is 3. Thus if the field is non-zero but the parity is odd, we've got ; a 16550 and must turn the FIFOs back off again. ; clr al out dx, al jmp raiseSignals SerialInitHWPC endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialInitPort %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Initialize things for a newly opened port CALLED BY: SerialOpen PASS: bx = owner handle ds:si = SerialPortData for the port cx = input buffer size dx = output buffer size RETURN: carry set if port couldn't be initialized (ax = reason) DESTROYED: ax, cx, dx, di, bx PSEUDO CODE/STRATEGY: Create a stream for the port Set up routine notifier for ourselves Set notification threshold to 1 Grab interrupt vector and enable interrupts for port's interrupt level. Force the printer on-line and turn off auto-feed, since we do mostly graphics printing around here. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 1/15/90 Initial version jdashe 4/27/94 Added passive port support %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialInitPort proc near .enter push cx ; save size for init push bx ; save handle for second stream ; creation ; ; Notify the power management driver ; push cx mov cx, 1 ; indicate open call NotifyPowerDriver pop cx mov ax, STREAM_POWER_ERROR LONG jc openFailedPopOwner ; ; If on PCMCIA card, make sure the thing actually exists. ; cmp ds:[si].SPD_socket, -1 je getState mov ax, ds:[si].SPD_base call SerialCheckExists mov ax, STREAM_NO_DEVICE LONG jc openFailedPopOwner getState: ; ; Fetch the initial state of the port and squirrel it away for close. ; ; This was already done for preempted passive ports. ; test ds:[si].SPD_passive, mask SPS_PREEMPTED jnz bumpInputBuffer ; jump if passive call SerialFetchPortState LONG jc openFailedPopOwner ; ; Replicate initial state as port's current state, for use when ; re-establishing the port's state at some later date. ; push si, es, di, cx segmov es, ds lea di, ds:[si].SPD_curState lea si, ds:[si].SPD_initState mov cx, size SPD_curState rep movsb pop si, es, di, cx ; ; If this is a passive port, we need to bump the input buffer size ; by one so we hold as many bytes as the caller requires, and still ; easily check if the buffer has become full. ; test ds:[si].SPD_passive, mask SPS_PASSIVE jz 5$ ; jump if not passive bumpInputBuffer: EC < call ECSerialVerifyPassive > inc cx EC < jmp ECjump > 5$: EC < call ECSerialVerifyActive > EC < ECjump: > ; ; Create the input stream of the specified size (first as ; DR_STREAM_CREATE biffs CX, also want bx = output stream ; for later calls) after setting the high- and low-water marks ; based on the size. ; call SerialInitInput jc openFailedCreatingFirstStream ; ; Now the output stream. ; ; If this is a passive connection, skip creating the output ; stream, since a passive connections are read-only. ; mov_tr ax, dx pop bx ; bx <- owner call SerialInitOutput jc openFailedFreeIn call SerialFindVector EC < ERROR_C SERIAL_PORT_CANT_INTERRUPT_AND_I_DONT_KNOW_WHY > ; ; Intercept the device's interrupt vector, unless this ; is a preempted passive port. ; xchg ax, cx ; (1-byte inst) mov ds:[si].SPD_vector, di ; Record vector pop cx ; cx <- input buffer size test ds:[si].SPD_passive, mask SPS_PREEMPTED jnz afterInit ; jump if preempted mov bx, segment Resident call SerialInitVector ; ; Disable all interrupts from the chip so we can make sure ; all bogus existing conditions (like pending DATA_AVAIL or ; TRANSMIT interrupts) are gone. ; call SerialInitHWPC afterInit: clc ; We're happy done: .leave ret openFailedPopOwner: openFailedCreatingFirstStream: pop bx ;Restore "owner" pop cx ;restore size jmp openFailed openFailedFreeIn: pop cx ;restore size ; ; Open failed b/c we couldn't allocate the output stream. Need ; to biff the input stream. ; push ax ; Save error code mov bx, ds:[si].SPD_inStream mov di, DR_STREAM_DESTROY mov ax, STREAM_DISCARD call StreamStrategy pop ax openFailed: ; ; Open failed, but don't want to leave the port locked, in case ; resources get freed up later. ; push bx mov bx, ds:[si].SPD_openSem VSem ds, [bx] pop bx clr cx ; make sure power management call NotifyPowerDriver ; driver knows the thing's not ; actually open stc jmp done SerialInitPort endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialInitInput %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Create and initialize the input stream for the port. CALLED BY: (INTERNAL) SerialInitPort PASS: cx = buffer size ds:si = SerialPortData bx = handle to own the stream RETURN: carry set if couldn't create DESTROYED: ax, cx, bp, di, bx SIDE EFFECTS: SPD_inStream set PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 8/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialInitInput proc near uses dx .enter ; ; Set the flow-control stuff and other input-related stuff first. ; - SPD_lowWater is set to 1/4 the size of the input buffer ; - SPD_highWater is set to 3/4 the size of the input buffer ; - SPD_byteMask is set to 0x7f (cooked) ; - SPD_mode is set to enable software flow control on both input ; and output ; mov ax, cx ; ax <- buffer size shr cx ; Divide total size by 4 shr cx ; to give low-water mark for mov ds:[si].SPD_lowWater,cx ; the port. mov ds:[si].SPD_highWater,ax; Turn off flow-control if ; buffer too small (by setting ; high-water mark to the size ; of the buffer) neg cx add cx, ax ; cx <- bufsize - bufsize/4 jle 10$ mov ds:[si].SPD_highWater,cx; cx > 0, so set as high water 10$: mov ds:[si].SPD_byteMask, 0x7f mov ds:[si].SPD_mode, mask SF_INPUT or mask SF_OUTPUT or \ mask SF_SOFTWARE ; ; Now create the input stream. ; push ax ; save buffer size mov cx, mask HF_FIXED mov di, DR_STREAM_CREATE call StreamStrategy ; bx = stream token ; ; Set the threshold for when the input stream drains below ; the lowWater mark. We only register the notifier if we ; send an XOFF. ; pop cx ; cx <- buffer size jc done mov ds:[si].SPD_inStream, bx sub cx, ds:[si].SPD_lowWater mov ax, STREAM_WRITE mov di, DR_STREAM_SET_THRESHOLD call StreamStrategy ; ; Initialize the data notifier on the writing side of the ; input stream so we can just change the type to SNM_ROUTINE ; in SerialInt when we want to cause an XON to be sent. ; mov ax, StreamNotifyType <0,SNE_DATA,SNM_NONE> mov bp, si ; Pass SerialPortData offset to us if NEW_ISR mov dx, offset ResumeIncomingData mov cx, segment ResumeIncomingData else mov dx, offset SerialRestart mov cx, segment SerialRestart endif mov di, DR_STREAM_SET_NOTIFY call StreamStrategy clc done: .leave ret SerialInitInput endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialInitOutput %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Create the output stream for the port. If there's an open passive version of the port, preempt it. CALLED BY: (INTERNAL) SerialInitPort PASS: ds:si = SerialPortData ax = buffer size bx = geode to own the stream RETURN: carry set if couldn't create DESTROYED: ax, bx, cx, dx, di, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 8/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialInitOutput proc near .enter ; ; If port is passive, we don't have to do any of this ; test ds:[si].SPD_passive, mask SPS_PASSIVE EC < jz noPassiveCheck > EC < call ECSerialVerifyPassive > EC < jmp doneOK > EC < noPassiveCheck: > jnz done ; (carry cleared by test) ; ; Create the stream. ; EC < call ECSerialVerifyActive > mov cx, mask HF_FIXED mov di, DR_STREAM_CREATE call StreamStrategy jc done mov ds:[si].SPD_outStream, bx ; ; Set up a routine notifier to call us when we stick data in ; the output stream. This may seem strange, after all we're the one who ; caused the data to go there, but it seems somehow cleaner to ; me to do it this way... ; mov ax, StreamNotifyType <1,SNE_DATA,SNM_ROUTINE> mov bp, si ; Pass SerialPortData offset to us mov dx, offset SerialNotify mov cx, segment SerialNotify mov di, DR_STREAM_SET_NOTIFY call StreamStrategy ; ; We need to know if even one byte goes in... ; 8/21/95: set the threshold to 0, not 1, so we get a general ; routine notification (not a special), but still get called ; whenever something is there. This causes an initial ; notification to happen (b/c there are the indicated number ; of bytes currently in the stream [0]), but SerialNotify is ; aware of this -- ardeb ; mov ax, STREAM_READ mov cx, 0 mov di, DR_STREAM_SET_THRESHOLD call StreamStrategy ; ; If there is a passive connection in progress, preempt it ; with a call to SerialResetVector and copy any data in the ; passive buffer to the just-created active input buffer. ; mov di, ds:[si].SPD_otherPortData IsPortOpen di ; passive port in use? jg doneOK ; jump if no passive connection call SerialCopyPassiveData doneOK: clc done: .leave ret SerialInitOutput endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialCopyPassiveData %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Copy data out of passive port, now the output stream has been successfully created. CALLED BY: (INTERNAL) SerialInitOutput PASS: ds:si = SerialPortData for active ds:di = SerialPortData for passive RETURN: nothing DESTROYED: ax, bx, cx, di SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 8/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialCopyPassiveData proc near uses ds, si .enter mov_tr ax, si ; ax <- active port data mov si, di ; pass passive port data in si mov di, ds:[di].SPD_vector ; di <- passive vector call SerialResetVector ; ; copy data from the passive buffer to the active. (note that we can't ; use SD_reader.SSD_sem, as that gets adjusted by reads...) ; mov di, si ; di <- passive port data mov_tr si, ax ; si <- active port data mov bx, ds:[si].SPD_inStream; bx <- active input stream mov ds, ds:[di].SPD_inStream; ds <- passive input stream mov si, offset SD_data ; ds:si <- source for copy mov cx, ds:[SD_writer].SSD_ptr; cx <- number of bytes in sub cx, si ; the passive buffer jz done ; jump if nothing to copy mov ax, STREAM_NOBLOCK ; we want as much as possible mov di, DR_STREAM_WRITE call StreamStrategy ; Ignore results... ; ; Clear out the passive port's data buffer. ; mov bx, ds ; bx <- passive input stream mov di, DR_STREAM_FLUSH call StreamStrategy ; ; Reset the passive port's input stream pointer to the head of the ; buffer. Must change both reader and writer pointers because ; they must be equal when the stream is empty!! ; mov ds:SD_writer.SSD_ptr, offset SD_data mov ds:SD_reader.SSD_ptr, offset SD_data done: .leave ret SerialCopyPassiveData endp OpenClose ends Resident segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialBufferPowerChange %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: The transmit interrupt has changed, so let the power driver know, if this port is a standard serial port (i.e. not PCMCIA) CALLED BY: (EXTERNAL) SerialReestablishState, SerialEnableTransmit, PASS: ds:si = SerialPortData RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/22/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialBufferPowerChange proc near .enter cmp ds:[si].SPD_socket, -1 jne done ; => is PCMCIA push cx mov cx, 1 call NotifyPowerDriver pop cx done: .leave ret SerialBufferPowerChange endp COMMENT @---------------------------------------------------------------------- FUNCTION: NotifyPowerDriver DESCRIPTION: Notify the power management driver that a serial port has opened or closed CALLED BY: INTERNAL PASS: cx = non-zero for open, zero for close ds:si = SerialPortData for the port RETURN: none DESTROYED: cx REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 2/16/92 Initial version ------------------------------------------------------------------------------@ NotifyPowerDriver proc far uses ax, bx, dx, di .enter ; ; If port is in a PCMCIA socket, specify that device instead. ; cmp ds:[si].SPD_socket, -1 je passSerialInfo mov ax, PDT_PCMCIA_SOCKET mov bx, ds:[si].SPD_socket mov dx, mask PCMCIAPI_NO_POWER_OFF ; do not allow power-off while ; this device is open ; ; If this is a passive connection, then allow power-off after all. ; If possible, have the machine wake up if there is data coming in from ; the PCMCIA port. ; test ds:[si].SPD_passive, mask SPS_PASSIVE jz notifyDriver ; ; Passive it is. ; mov dx, mask PCMCIAPI_WAKE_UP_ON_INTERRUPT jmp notifyDriver passSerialInfo: ; ; Convert SerialPortNum into a 0-based index, with the SERIAL_PASSIVE ; bit still set in the high bit, if necessary. ; mov bx, ds:[si].SPD_portNum sar bx, 1 ; (duplicates SERIAL_PASSIVE) andnf bx, not (SERIAL_PASSIVE shr 1) ; clear duplicate SERIAL_PASSIVE ; in bit 14, please mov ax, PDT_SERIAL_PORT clr dx mov dl, ds:[si].SPD_ioMode ornf dx, mask SPI_CONTROLS test ds:[si].SPD_ien, mask SIEN_DATA_AVAIL jz checkXmit ornf dx, mask SPI_RECEIVE checkXmit: test ds:[si].SPD_ien, mask SIEN_TRANSMIT jz notifyDriver ornf dx, mask SPI_TRANSMIT .assert $ eq notifyDriver notifyDriver: mov di, DR_POWER_DEVICE_ON_OFF call SerialCallPowerDriver .leave ret NotifyPowerDriver endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialCallPowerDriver %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: make a call into the power driver CALLED BY: (EXTERNAL) NotifyPowerDriver, SerialCheckExists (zoomer only) PASS: di = call to make ax,bx = args to power driver ds = dgroup RETURN: Void. DESTROYED: di? PSEUDOCODE/STRATEGY: KNOWN BUGS/SIDEFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jimmy 5/20/93 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialCallPowerDriver proc far .enter ; ; Get the strategy routine once, if there's a power driver in the ; system. ; push ax, bx mov ax, ds:[powerStrat].segment inc ax jz noDriver ; => was -1, so power driver sought ; before and not found dec ax jnz haveStrategy ; => was neither -1 nor 0, so have ; strategy already mov ds:[powerStrat].segment, -1 ; assume no power driver mov ax, GDDT_POWER_MANAGEMENT call GeodeGetDefaultDriver tst ax jz noDriver mov_tr bx, ax ; bx <- driver push ds, si call GeodeInfoDriver movdw axbx, ds:[si].DIS_strategy pop ds, si movdw ds:[powerStrat], axbx haveStrategy: pop ax, bx call ds:[powerStrat] done: .leave ret noDriver: pop ax, bx jmp done SerialCallPowerDriver endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialResetPortPC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: reset a PC-like serial port CALLED BY: SerialResetPort PASS: ds:si = SerialPortData ds:bx = SerialPortState RETURN: Void. DESTROYED: ax, dx PSEUDOCODE/STRATEGY: KNOWN BUGS/SIDEFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jimmy 5/ 3/93 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ; this is a useful little macro to check for bogus interrupt requests coming ; in for my com3. Since we can now handle those, it's if'ed out, but I might ; need it again some day... note that it relies on an out 0xa0, 0xa having ; been done, to set the PIC to returning the IRR chkirr macro if 0 local q mov cx, 2000 q: in al, 0xa0 test al, 2 loope q ERROR_NZ -1 endif endm SerialResetPortPC proc far .enter chkirr mov dx, ds:[si].SPD_base ; ; This is the action that can cause a spurious interrupt when ; the chip is degated from the bus by our resetting OUT2, so ; we do it first to give the system time to generate its spurious ; interrupt while we've still got control of the vector... ; add dx, offset SP_modemCtrl ; first reset OUT2 et al mov al, ds:[bx].SPS_modem out dx, al chkirr ; now, the enabled interrupts add dx, offset SP_ien - offset SP_modemCtrl mov al, ds:[bx].SPS_ien out dx, al chkirr add dx, offset SP_lineCtrl - offset SP_ien mov al, ds:[bx].SPS_format mov ah, al ornf al, mask SF_DLAB out dx, al ; reset baud-rate now chkirr jmp $+2 mov al, ds:[bx].SPS_baud.low add dx, offset SP_divLow - offset SP_lineCtrl out dx, al chkirr inc dx mov al, ds:[bx].SPS_baud.high out dx, al chkirr jmp $+2 mov al, ah ; now the line format add dx, offset SP_lineCtrl - offset SP_divHigh out dx, al chkirr ; ; Mess with the FIFO state. If we're resetting the port to its ; initial state, turn off FIFOs if no passive open remains. If we're ; reestablishing the port's state (i.e. bx is SPD_curState), we ; turn them back on again. ; test ds:[si].SPD_flags, mask SPF_FIFO jz done ; => FIFO not enabled add dx, offset SP_iid - offset SP_lineCtrl lea ax, ds:[si].SPD_curState cmp bx, ax je turnFIFOsBackOn test ds:[si].SPD_passive, mask SPS_PASSIVE jnz resetFIFO ; => closing passive, so do reset push si mov si, ds:[si].SPD_otherPortData IsPortOpen si pop si jng done ; => passive still open, so leave alone resetFIFO: clr al setFIFO: out dx, al done: .leave ret turnFIFOsBackOn: mov al, mask SFC_ENABLE or mask SFC_XMIT_RESET or \ mask SFC_RECV_RESET or \ (FIFO_RECV_THRESHOLD_SFS shl offset SFC_SIZE) jmp setFIFO SerialResetPortPC endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialReestablishState %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Reprogram the port to match the state most-recently set for it, to cope with power having been lost, for example. (Must be Resident for PCMCIA support) CALLED BY: DR_SERIAL_REESTABLISH_STATE PASS: ds:bx = SerialPortData for the port RETURN: nothing DESTROYED: ax, bx, di SIDE EFFECTS: PSEUDO CODE/STRATEGY: We alter the state a bit by turning the transmitter interrupt on so any aborted outputs will actually get started up automatically. If there's nothing in the output stream, this just causes an extra interrupt, but does no harm. REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 9/13/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialReestablishState proc near uses si .enter andnf ds:[bx].SPD_flags, not mask SPF_PORT_GONE mov si, bx lea bx, ds:[si].SPD_curState ornf ds:[bx].SPS_ien, mask SIEN_TRANSMIT ; ; Make sure the transmit buffers are enabled for the nonce. ; call SerialBufferPowerChange call SerialResetPortPC .leave ret SerialReestablishState endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialPortAbsent %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Note that a port is temporarily AWOL CALLED BY: DR_SERIAL_PORT_ABSENT PASS: ds:bx = SerialPortData for the port RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 10/ 7/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialPortAbsent proc near .enter ornf ds:[bx].SPD_flags, mask SPF_PORT_GONE .leave ret SerialPortAbsent endp Resident ends OpenClose segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialResetPort %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Reset a port to its initial state, as saved in its SerialPortData descriptor. CALLED BY: SerialEnsureClosed, SerialClose PASS: ds:si = SerialPortData RETURN: nothing DESTROYED: dx, ax PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 9/29/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialResetPort proc near uses cx, bx .enter ; ; Tell the power management driver that we are done with the port ; push cx clr cx call NotifyPowerDriver pop cx ; ; Use the reset routines to restore the port to its initial state. ; INT_OFF if 0 ; for chkirr macro... mov al, 10 out 0xa0, al endif lea bx, ds:[si].SPD_initState call SerialResetPortPC INT_ON .leave ret SerialResetPort endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialOpen %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Open one of the serial ports CALLED BY: DR_STREAM_OPEN, DR_SERIAL_OPEN_FOR_DRIVER (SerialStrategy) PASS: ax = StreamOpenFlags record. SOF_NOBLOCK and SOF_TIMEOUT are exclusive. bx = port number to open cx = total size of input buffer dx = total size of output buffer bp = timeout value if SOF_TIMEOUT given in ax ds = dgroup si = owner handle, if DR_STREAM_OPEN_FOR_DRIVER RETURN: carry set if port couldn't be opened: ax = STREAM_NO_DEVICE if device doesn't exist STREAM_DEVICE_IN_USE if SOF_NOBLOCK or SOF_TIMEOUT given and device is already open/ timeout period expired. carry set and ax = STREAM_ACTIVE_IN_USE if a passive port was opened in a PREEMPTED state. carry clear if port opened ds:bx = SerialPortData for port DESTROYED: cx, dx, bp, bx (preserved by SerialStrategy) See KNOWN BUGS below. PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: By default, though, flow control is turned off. In order to do flow control at driver level, you need to call DR_SERIAL_SET_FLOW_CONTROL, DR_SERIAL_ENABLE_FLOW_CONTROL, and DR_SERIAL_SET_ROLE( for H/W fc ). BUG: It is a bug that cx, dx and bp are destroyed, since they should be preserved according to DR_STREAM_OPEN and DR_SERIAL_OPEN_FOR_DRIVER. But since this bug already exists in shipped products, we decide to keep the bug and document it here instead of fixing it. REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 1/14/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DefStub SerialOpen SerialOpen proc far uses si, di .enter call SerialGetPortDataFAR ; ds:bx <- SerialPortData xchg si, bx tst ds:[si].SPD_base jz portExistethNot ; ; Open passive ports elsewhere. ; test ds:[si].SPD_passive, mask SPS_PASSIVE jz openActive call SerialPassiveOpen jmp exit openActive: EC < test ax, not StreamOpenFlags > EC < ERROR_NZ OPEN_BAD_FLAGS > EC < test ax, mask SOF_NOBLOCK or mask SOF_TIMEOUT > EC < jz 10$ ; neither is ok > EC < jpo 10$ ; just one is fine > EC < ERROR OPEN_BAD_FLAGS > EC <10$: > test ax, mask SOF_NOBLOCK or mask SOF_TIMEOUT jnz noBlockOpenPort push bx mov bx, ds:[si].SPD_openSem PSem ds, [bx] ; Wait for port to be available pop bx afterPortOpen: ; ; Set the reference count to 2: one for the thing being open (will ; be reduced in SerialClose) and one for this call (in case someone ; closes the thing while we're opening it, or something ludicrous ; like that) ; mov ds:[si].SPD_refCount, 2 ; ; This port is free for an active connection. Do we have a ; passive connection which we can preempt? ; mov si, ds:[si].SPD_otherPortData ; si <- passive port IsPortOpen si ; passive connection? jg continueOpening ; jump if no passive ; ; There is a passive connection in progress. Preempt the ; passive connection then continue with the usual connection ; procedure. When we have an input stream, we'll copy the ; data from the passive connection's input stream. ; call SerialPreemptPassive continueOpening: mov si, ds:[si].SPD_otherPortData ; si <- active port cmp di, DR_SERIAL_OPEN_FOR_DRIVER je 15$ ; => bx already contains owner call GeodeGetProcessHandle ; Stream owned by opener 15$: call SerialInitPort exit: mov bx, si ; ds:bx <- SerialPortData, in ; case successful open ; ; interrupt stat ; ds:si - SerialPortData ; IS < pushf > IS < call SerialResetStatVar > IS < popf > .leave ret portExistethNot: mov ax, STREAM_NO_DEVICE stc jmp exit noBlockOpenPort: ; ; Perform a non-blocking PSem on the openSem for a port. We ; also come here if just have a timeout option -- in the case ; of a non-blocking one, we just have a timeout value of 0... ; test ax, mask SOF_TIMEOUT jnz 20$ clr bp 20$: push bx mov bx, ds:[si].SPD_openSem PTimedSem ds, [bx], bp pop bx jnc afterPortOpen mov ax, STREAM_DEVICE_IN_USE jmp exit SerialOpen endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialPassiveOpen %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Attempts to open passive serial port connections ala SerialOpen. It's identical in intent to SerialOpen, but the arguments and actions are slightly different: * There are no StreamOpenFlags; passive opens are always SOF_NOBLOCK. * There is no output buffer in passive port connections. CALLED BY: SerialOpen PASS: ds:si = SerialPortData for this port cx = input buffer size bx = owner handle, if DR_STREAM_OPEN_FOR_DRIVER RETURN: carry set and ax set to one of the following: ax = STREAM_NO_DEVICE if device doesn't exist = STREAM_DEVICE_IN_USE if the passive port is in use. = STREAM_ACTIVE_IN_USE if the passive port was opened in a PREEMPTED state. carry clear if the port opened with no problems. DESTROYED: cx, dx, bp, bx (preserved by SerialStrategy or SerialOpen) REVISION HISTORY: Name Date Description ---- ---- ----------- jdashe 5/25/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialPassiveOpen proc near uses si, di .enter EC < call ECSerialVerifyPassive > tst ds:[si].SPD_base LONG jz portExistethNot ; ; If there is already a passive connection in progress, the ; open fails. ; push bx mov bx, ds:[si].SPD_openSem PTimedSem ds, [bx], 0 pop bx jc deviceInUse ; ; Set the reference count to 2: one for the thing being open (will ; be reduced in SerialClose) and one for this call (in case someone ; closes the thing while we're opening it, or something ludicrous ; like that) ; mov ds:[si].SPD_refCount, 2 ; ; The port exists. Initialize its status flags. ; andnf ds:[si].SPD_passive, not (mask SPS_BUFFER_FULL or mask SPS_PREEMPTED) ; ; If there is not an active connection in progress, open the port ; normally. Otherwise, set up the passive connection as a ; preempted port. ; mov si, ds:[si].SPD_otherPortData ; si <- active port IsPortOpen si mov si, ds:[si].SPD_otherPortData ; si <- passive port jg afterPortOpen ornf ds:[si].SPD_passive, mask SPS_PREEMPTED afterPortOpen: ; ; Open the port (or set things up if the port is preempted). ; cmp di, DR_SERIAL_OPEN_FOR_DRIVER je 15$ ; => bx already contains owner call GeodeGetProcessHandle ; Stream owned by opener 15$: call SerialInitPort jc exit ; ; If this port is opening preempted, copy the current state of ; the active port into the passive port's current and initial state. ; test ds:[si].SPD_passive, mask SPS_PREEMPTED jz doneOK ; jump if not opening preempted push es, si segmov es, ds, cx mov di, ds:[si].SPD_otherPortData ; di <- active port add di, SPD_initState add si, SPD_initState xchg di, si ; ; di - passive port's SPD_initState ; si - active port's SPD_initState ; mov cx, size SerialPortState call SysEnterCritical rep movsb call SysExitCritical ; ; Copy the same data for the passive's curState. ; mov cx, size SerialPortState sub di, cx mov si, di ; si <- passive's initState sub di, cx ; di <- passive's curState CheckHack < SPD_curState eq (SPD_initState - size SerialPortState) > rep movsb pop es, si mov ax, STREAM_ACTIVE_IN_USE openFailed: stc jmp exit doneOK: clc exit: .leave ret portExistethNot: mov ax, STREAM_NO_DEVICE jmp openFailed deviceInUse: mov ax, STREAM_DEVICE_IN_USE jmp openFailed SerialPassiveOpen endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialPreemptPassive %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This function deals with preempting a passive connection with an active one. CALLED BY: SerialOpen PASS: ds:si = SerialPortData for the passive port to be preempted RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: * Notify the passive owner that the connection is being preempted. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jeremy 5/16/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialPreemptPassive proc near uses cx .enter EC < test ds:[si].SPD_passive, mask SPS_PASSIVE > EC < ERROR_Z NOT_A_PASSIVE_PORT > EC < call ECSerialVerifyPassive > ; ; Set the preempted flag. ; or ds:[si].SPD_passive, mask SPS_PREEMPTED mov cx, mask SPNS_PREEMPTED or mask SPNS_PREEMPTED_CHANGED call SerialPassiveNotify .leave ret SerialPreemptPassive endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialClose %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Close an open serial port. CALLED BY: DR_STREAM_CLOSE (SerialStrategy) PASS: ds:bx = SerialPortData for the port ax = STREAM_LINGER if should wait for pending data to be read before closing. STREAM_DISCARD if can just throw it away. NOTE: passive ports don't have output buffers, so ax is ignored. RETURN: nothing DESTROYED: ax, bx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 1/15/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DefStub SerialClose SerialClose proc far uses si, di, cx, dx .enter mov si, bx ; ; serial Stat ; ds:si = current SerialPortData ; IS < call SerialWriteOutStat > test ds:[si].SPD_passive, mask SPS_PASSIVE jz notPassive CheckHack <STREAM_DISCARD eq 0> clr ax EC < call ECSerialVerifyPassive > EC < jmp axOK > notPassive: EC < call ECSerialVerifyActive > EC < cmp ax, STREAM_LINGER > EC < je axOK > EC < cmp ax, STREAM_DISCARD > EC < ERROR_NE AX_NOT_STREAM_LINGER_OR_STREAM_DISCARD > EC <axOK: > mov cx, ax ; ; Turn off all but transmit interrupts for the port first. ; CheckHack <STREAM_LINGER eq -1 AND STREAM_DISCARD eq 0> andnf al, ds:[si].SPD_ien ; If discarding, this will ; result in al==0, disabling ; *all* interrupts, which ; will prevent us using a ; dead stream in the interrupt ; routine. If lingering, this ; will just give us SPD_ien andnf al, mask SIEN_MODEM or mask SIEN_TRANSMIT jcxz dontWorryAboutSTOPBit test ds:[si].SPD_mode, mask SF_SOFTSTOP jz dontWorryAboutSTOPBit ; ; If output is currently stopped and we're lingering, we must ; continue to get DATA_AVAIL interrupts so we can get the XON ; character that turns output back on again... ; mov ah, mask SIEN_DATA_AVAIL dontWorryAboutSTOPBit: mov dx, ds:[si].SPD_base add dx, offset SP_ien or al, ah ; or in correct DATA_AVAIL bit ; ; If this is a preempted passive port, no touchie the ; hardware, please. ; test ds:[si].SPD_passive, mask SPS_PREEMPTED EC < jz biffHardware > EC < pushf > EC < call ECSerialVerifyPassive ; sets ZF > EC < popf > EC <biffHardware: > jnz nukeInputStream ; jump if preempted out dx, al nukeInputStream: ; ; Shut down the input stream first, discarding any remaining ; data. The thing will be freed by SerialStrategy when the ; ref count goes to 0. ; mov bx, ds:[si].SPD_inStream mov ax, STREAM_DISCARD call StreamShutdown ; ; If this is a passive buffer, we don't have an output stream. ; test ds:[si].SPD_passive, mask SPS_PASSIVE jnz outStreamGone ; ; Now biff the output stream, passing whatever linger/discard ; constant we were given. ; mov ax, cx mov bx, ds:[si].SPD_outStream call StreamShutdown outStreamGone: ; ; If this is a preempted port, we are not intercepting ; interrupts, nor do we need to reset the port. We do need to ; update the active port's initState with the passive's, ; however, so when the active closes down it will reset the ; port to its original state. ; test ds:[si].SPD_passive, mask SPS_PREEMPTED jz nukeInterrupts EC < call ECSerialVerifyPassive > push es, cx, di, si segmov es, ds, cx mov di, ds:[si].SPD_otherPortData add di, SPD_initState add si, SPD_initState mov cx, size SerialPortState call SysEnterCritical rep movsb call SysExitCritical pop es, cx, di, si jmp vPort nukeInterrupts: ; ; Turn off all interrupts for the port, now the streams are gone. ; mov dx, ds:[si].SPD_base add dx, offset SP_ien clr al out dx, al ; ; Reset the modem-event notifier. ; mov ds:[si].SPD_modemEvent.SN_type, SNM_NONE ; ; Restore the initial state of the port before resetting the vector,, ; as tri-stating the IRQ line can have the nasty side-effect of ; allowing the interrupt line to float, thereby triggering a spurious ; interrupt. Since our interrupt code deals with not having any ; streams to use, it's safe to let it handle any spurious interrupts ; this resetting can generate. ; call SerialResetPort ; ; Reset the appropriate interrupt vector to its earlier condition. ; mov di, ds:[si].SPD_vector call SerialResetVector ; ; We're ready to V the semaphore if this is a passive port. ; test ds:[si].SPD_passive, mask SPS_PASSIVE jnz vPort ; ; We're closing down an active port. Is there a passive port ; that needs to be reawakened? ; mov di, ds:[si].SPD_otherPortData ; ds:di <- passive port IsPortOpen di jg vPort ; jump if no passive connection ; ; There is indeed a passive open that needs dealing with. ; Redo the passive's SerialInitVector and send a notification ; to the passive owner that it's back in business. ; xchg si, di ; ds:si <- passive port andnf ds:[si].SPD_passive, not (mask SPS_PREEMPTED) ; ; Intercept the device's interrupt vector. ; mov di, ds:[si].SPD_vector ; Record vector mov bx, segment Resident call SerialInitVector mov cx, 0xffff ; cx <- large size call SerialInitHWPC ; ; Notify the owner of the passive port that the passive port ; is back in action. ; mov cx, mask SPNS_PREEMPTED_CHANGED call SerialPassiveNotify ; ; In case there's a pending active port, V the closing active ; port's semaphore. ; mov si, ds:[si].SPD_otherPortData vPort: ; ; We used to V the openSem here, but now we do it in SerialStrategy ; when the refCount goes to 0. ; dec ds:[si].SPD_refCount EC < ERROR_Z REF_COUNT_UNDERFLOW > .leave ret SerialClose endp OpenClose ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialCloseWithoutReset %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Close down an open port without resetting it to its initial condition. Useful for PCAO, mostly. CALLED BY: DR_SERIAL_CLOSE_WITHOUT_RESET PASS: ds:bx = SerialPortData for the port ax = STREAM_LINGER if should wait for pending data to be read before closing. STREAM_DISCARD if can just throw it away. RETURN: port interrupts are off, but all other attributes of the port remain untouched (except it's closed from our perspective). DESTROYED: ax, bx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 11/ 8/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DefStub SerialCloseWithoutReset OpenClose segment SerialCloseWithoutReset proc far uses si, es, cx .enter ; ; Just store the current state of the port as its initial state, so ; SerialResetPort won't do anything to it. ; lea si, ds:[bx].SPD_curState lea di, ds:[bx].SPD_initState mov cx, size SPD_initState segmov es, ds rep movsb mov si, bx ; ; Do not leave any interrupts on when we've closed the thing. This ; prevents us from dying horribly should a byte come in after we've ; closed but before the system has been shut down. ; mov ds:[si].SPD_initState.SPS_ien, 0 ; ; And close the port normally. ; call SerialClose .leave ret SerialCloseWithoutReset endp OpenClose ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialSetNotify %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set a notifier for the caller. If SNT_EVENT is SNE_ERROR, SNT_READER must be set, as errors are posted only to the reading side of the stream. If SNT_EVENT is SNE_PASSIVE, SNT_READER must be set and the unit number must be for a passive port. If the passive port has a full buffer or has been preempted, a notification will be sent out immediately. CALLED BY: DR_STREAM_SET_NOTIFY PASS: ax = StreamNotifyType bx = unit number (transformed to SerialPortData offset by SerialStrategy). cx:dx = address of handling routine, if SNM_ROUTINE; destination of output if SNM_MESSAGE bp = AX to pass if SNM_ROUTINE (except for SNE_DATA with threshold of 1, in which case value is passed in CX); method to send if SNM_MESSAGE. RETURN: nothing DESTROYED: ax, bx (saved by SerialStrategy) PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 6/90 Initial version jdashe 5/13/90 Added support for passive notifications %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment resource SerialSetNotify proc near uses si, dx .enter ; ; See if the event in question is ours ; mov si, ax andnf si, mask SNT_EVENT cmp si, SNE_MODEM shl offset SNT_EVENT je setupModemEvent ; jump if a modem event cmp si, SNE_PASSIVE shl offset SNT_EVENT jne handOff ; Nope -- hand off to stream driver ; ; We're setting a passive notification, so make sure it's a ; passive port. Also make sure it's being set for the reader. ; EC < test ds:[bx].SPD_passive, mask SPS_PASSIVE > EC < ERROR_Z NOT_A_PASSIVE_PORT > EC < test ax, mask SNT_READER > EC < ERROR_Z BAD_CONTEXT_FOR_PASSIVE_PORT > EC < xchg bx, si > EC < call ECSerialVerifyPassive > EC < xchg bx, si > ; ; Store the parameters in our very own SPD_passiveEvent structure. ; lea si, ds:[bx].SPD_passiveEvent call SerialSetNotificationEvent ; ax <- SNT_HOW only ; ; If there are any pending notifications for this passive ; port, send them off now. ; test ds:[bx].SPD_passive, (mask SPS_PREEMPTED or \ mask SPS_BUFFER_FULL) jz doneOK tst ax ; clearing the notification? jz doneOK ; jump if clearing. push cx clr cx test ds:[bx].SPD_passive, mask SPS_PREEMPTED jz detectBufferFull mov cx, mask SPNS_PREEMPTED or mask SPNS_PREEMPTED_CHANGED detectBufferFull: test ds:[bx].SPD_passive, mask SPS_BUFFER_FULL jz sendNotify ornf cx, (mask SPNS_BUFFER_FULL or \ mask SPNS_BUFFER_FULL_CHANGED) sendNotify: xchg bx, si ; ds:si <- port data call SerialPassiveNotify xchg bx, si ; ds:bx <- port data pop cx jmp doneOK setupModemEvent: ; ; Were's setting the modem notification. Store the parameters in our ; very own SPD_modemEvent structure. ; lea si, ds:[bx].SPD_modemEvent call SerialSetNotificationEvent ; ax <- SNT_HOW only if NOTIFY_WHEN_SNE_MODEM_CHANGED call SerialNotifyModemNotifierChanged endif ; ; Enable/disable modem status interrupts for the port. ; CheckHack <SNM_NONE eq 0> tst ax mov al, ds:[bx].SPD_ien jz disable ; SNT_HOW is SNM_NONE, so no longer ; interested in modem interrupts ; ZSIEN_MODEM HAPPENS TO BE THE SAME AS SIEN_MODEM SO I JUST ; LEFT THE CODE IN AS IS RATHER THAN CHECKING TO SEE WHICH ; TO USE IN THE ZOOMER CODE ornf al, mask SIEN_MODEM jmp setModem disable: test ds:[bx].SPD_mode, mask SF_HARDWARE jnz done ; Leave modem ints on for hwfc andnf al, not mask SIEN_MODEM setModem: mov dx, ds:[bx].SPD_base add dx, offset SP_ien mov ds:[bx].SPD_ien, al out dx, al jmp doneOK handOff: ; ; Hand off the call to the stream driver passing the proper stream. ; Note that if the caller sets an error notifier for the writer, ; it won't have any effect, since errors are posted only to the ; input stream. ; mov si, ds:[bx].SPD_inStream ; Assume reader... test ax, mask SNT_READER jnz 10$ mov si, ds:[bx].SPD_outStream 10$: mov bx, si tst bx stc jz done call StreamStrategy doneOK: clc done: .leave ret SerialSetNotify endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialSetNotificationEvent %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Loads a StreamNotifier structure. CALLED BY: SerialSetNotify PASS: ax = StreamNotifyType cx:dx = address of handling routine, if SNM_ROUTINE; destination of output if SNM_MESSAGE bp = AX to pass if SNM_ROUTINE (except for SNE_DATA with threshold of 1, in which case value is passed in CX); method to send if SNM_MESSAGE. ds:si = StreamNotifier to load RETURN: ax = just the SN_type DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- jdashe 5/27/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialSetNotificationEvent proc near .enter andnf ax, mask SNT_HOW mov ds:[si].SN_type, al mov ds:[si].SN_dest.SND_routine.low, dx mov ds:[si].SN_dest.SND_routine.high, cx mov ds:[si].SN_data, bp .leave ret SerialSetNotificationEvent endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialFlush %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handler for the serial driver's DR_STREAM_FLUSH. If called for an active port, pass straight through to SerialHandOff. A passive port will call SerialHandOff to flush pending data, then reset the writer's SSD_ptr to SD_data. CALLED BY: DR_STREAM_FLUSH PASS: bx = unit number (transformed to SerialPortData by SerialStrategy) di = function code ax = STREAM_READ to apply only to reading STREAM_WRITE to apply only to writing STREAM_BOTH to apply to both (valid only for DR_STREAM_FLUSH and DR_STREAM_SET_THRESHOLD) RETURN: nothing DESTROYED: bx (saved by SerialStrategy) REVISION HISTORY: Name Date Description ---- ---- ----------- jdashe 6/15/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment resource SerialFlush proc near .enter ; ; If this is an active port, jump straight to SerialHandOff. ; test ds:[bx].SPD_passive, mask SPS_PASSIVE jnz handlePassive call SerialHandOff jmp exit handlePassive: push bx call SerialHandOff pop bx mov bx, ds:[bx].SPD_inStream tst bx ; Is there an input stream? jz exit ; If not, leave. ; ; Reset the passive port's input stream pointer to the head of the ; buffer. Must change both reader and writer pointers because ; they must be equal when the stream is empty!! ; push ds mov ds, bx ; ds:0 <- StreamData mov ds:SD_writer.SSD_ptr, offset SD_data mov ds:SD_reader.SSD_ptr, offset SD_data pop ds exit: .leave ret SerialFlush endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ECVerifyReadWriteBothFlag %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: EC: Make sure ax holds STREAM_READ, STREAM_WRITE or STREAM_BOTH CALLED BY: (INTERNAL) PASS: ax = one of those RETURN: nothing DESTROYED: nothing SIDE EFFECTS: death if bad data PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 8/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if ERROR_CHECK ECVerifyReadWriteBothFlag proc near .enter cmp ax, STREAM_READ je notAHoser cmp ax, STREAM_WRITE je notAHoser cmp ax, STREAM_BOTH je notAHoser ERROR AX_NOT_STREAM_WRITE_OR_STREAM_READ_OR_STREAM_BOTH notAHoser: .leave ret ECVerifyReadWriteBothFlag endp endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialHandOff %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Pass a call on to the stream driver for one or both of the streams associated with the port, passing the appropriate side for each. CALLED BY: DR_STREAM_GET_ERROR (STREAM_BOTH should *not* be given), DR_STREAM_SET_ERROR, DR_STREAM_FLUSH, DR_STREAM_SET_THRESHOLD, DR_STREAM_QUERY PASS: bx = unit number (transformed to SerialPortData by SerialStrategy) di = function code ax = STREAM_READ to apply only to reading STREAM_WRITE to apply only to writing STREAM_BOTH to apply to both (valid only for DR_STREAM_FLUSH and DR_STREAM_SET_THRESHOLD) RETURN: ? DESTROYED: bx (saved by SerialStrategy) PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 6/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialHandOff proc near .enter CheckHack <(STREAM_WRITE AND 1) eq 0 and (STREAM_BOTH AND 1) eq 0 and (STREAM_BOTH lt 0) and (STREAM_READ lt 0) and (STREAM_READ AND 1) ne 0> EC < call ECVerifyReadWriteBothFlag > ; ; If this is a passive port, set ax to STREAM_READ only. ; test ds:[bx].SPD_passive, mask SPS_PASSIVE jz testStreamSelection EC < push si > EC < mov si, bx > EC < call ECSerialVerifyPassive > EC < pop si > mov ax, STREAM_READ ; ; If we're clearing out the buffer for the passive buffer, ; clear the full buffer flag just to be sure. ; cmp di, DR_STREAM_FLUSH jne testStreamSelection andnf ds:[bx].SPD_passive, not (mask SPS_BUFFER_FULL) testStreamSelection: ; ; See if output stream affected (STREAM_WRITE and STREAM_BOTH both have ; the low bit 0) ; test ax, 1 jnz readOnly push ax, bx, di mov ax, STREAM_WRITE mov bx, ds:[bx].SPD_outStream tst bx jz 10$ call StreamStrategy 10$: pop bx, di XchgTopStack ax ; Preserve possible return value from ; function if STREAM_WRITE specified ; ; See if input also affected (STREAM_READ and STREAM_BOTH are ; both < 0). ; tst ax pop ax ; Recover possible result... jns done readOnly: mov ax, STREAM_READ mov bx, ds:[bx].SPD_inStream tst bx jz done call StreamStrategy done: .leave ret SerialHandOff endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialRead %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Read data from a port CALLED BY: DR_STREAM_READ PASS: bx = unit number (transformed to SerialPortData by SerialStrategy) ax = STREAM_BLOCK/STREAM_NO_BLOCK cx = number of bytes to read ds:si = buffer to which to read RETURN: cx = number of bytes read DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 6/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialRead proc near .enter mov bx, ds:[bx].SPD_inStream tst bx jz noInputStream segmov ds, es ; Restore ds from entry call StreamStrategy done: .leave ret noInputStream: clr cx stc jmp done SerialRead endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialReadByte %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Read a single byte from a port CALLED BY: DR_STREAM_READ_BYTE PASS: ax = STREAM_BLOCK/STREAM_NO_BLOCK bx = unit number (transformed to SerialPortData by SerialStrategy) RETURN: al = byte read DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 6/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialReadByte proc near .enter mov bx, ds:[bx].SPD_inStream tst bx jz noInputStream call StreamStrategy done: .leave ret noInputStream: stc jmp done SerialReadByte endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialWrite %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Write a buffer to the serial port. CALLED BY: DR_STREAM_WRITE PASS: ax = STREAM_BLOCK/STREAM_NO_BLOCK bx = unit number (transformed to SerialPortData by SerialStrategy) cx = number of bytes to write es:si = buffer from which to write (ds moved to es by SerialStrategy) di = DR_STREAM_WRITE RETURN: cx = number of bytes written DESTROYED: bx (preserved by SerialStrategy) PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 6/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialWrite proc near .enter mov bx, ds:[bx].SPD_outStream tst bx jz noOutputStream segmov ds, es ; ds <- buffer segment for ; stream driver call StreamStrategy done: .leave ret noOutputStream: clr cx stc jmp done SerialWrite endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialWriteByte %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Write a byte to the serial port. CALLED BY: DR_STREAM_WRITE_BYTE PASS: ax = STREAM_BLOCK/STREAM_NO_BLOCK bx = unit number (transformed to SerialPortData by SerialStrategy) cl = byte to write di = DR_STREAM_WRITE_BYTE RETURN: carry set if byte could not be written and STREAM_NO_BLOCK was specified DESTROYED: bx (preserved by SerialStrategy) PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 6/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialWriteByte proc near .enter mov bx, ds:[bx].SPD_outStream tst bx jz noOutputStream call StreamStrategy done: .leave ret noOutputStream: stc jmp done SerialWriteByte endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialSetFormatPC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: set format for a PC-like serial port CALLED BY: SerialSetFormat PASS: al = data format (SerialFormat) ah = SerialMode bx = unit number (transformed to SerialPortData by SerialStrategy) cx = baud rate (SerialBaud) RETURN: Void. DESTROYED: ax, cx, dx PSEUDOCODE/STRATEGY: KNOWN BUGS/SIDEFFECTS/IDEAS: If this is called on a preempted passive port, the hardware is not modified, only the curState for the passive port and the initState for the active port. REVISION HISTORY: Name Date Description ---- ---- ----------- jimmy 5/ 3/93 Initial version. jdashe 5/26/94 passive support added %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialSetFormatPC proc near .enter mov ds:[bx].SPD_curState.SPS_baud, cx mov ds:[bx].SPD_curState.SPS_format, al if _FUNKY_INFRARED ; ; For our funky infrared dongles, the DTR & RTS signals tell the ; thing what baud rate we're using. If the medium is infrared, adjust ; the modem control signals appropriately. ; mov dl, ds:[bx].SPD_curState.SPS_modem cmp ds:[bx].SPD_medium.MET_manuf, MANUFACTURER_ID_GEOWORKS jne setState cmp ds:[bx].SPD_medium.MET_id, GMID_INFRARED jne setState mov dh, mask SMC_RTS cmp cx, SB_9600 je modifyModem mov dh, mask SMC_DTR cmp cx, SB_19200 je modifyModem mov dh, mask SMC_RTS or mask SMC_DTR cmp cx, SB_115200 jne fail modifyModem: andnf dl, not (mask SMC_RTS or mask SMC_DTR) or dl, dh setState: mov ds:[bx].SPD_curState.SPS_modem, dl endif ; _FUNKY_INFRARED test ds:[bx].SPD_passive, mask SPS_PREEMPTED jz normalSet ; ; This is a preempted port. Make the change in the port's ; curState and in the active port's initState, so it'll take ; effect when the preempted port regains control. ; EC < xchg bx, si > EC < call ECSerialVerifyPassive > EC < xchg bx, si > mov bx, ds:[bx].SPD_otherPortData call SysEnterCritical mov ds:[bx].SPD_initState.SPS_baud, cx mov ds:[bx].SPD_initState.SPS_format, al if _FUNKY_INFRARED mov ds:[bx].SPD_initState.SPS_modem, dl endif ; _FUNKY_INFRARED call SysExitCritical mov bx, ds:[bx].SPD_otherPortData jmp done normalSet: ; ; Establish the format right away while setting DLAB, allowing ; us to store the new baud rate as well. ; mov dx, ds:[bx].SPD_base add dx, offset SP_lineCtrl ornf al, mask SF_DLAB out dx, al ; ; Stuff the new baud rate in its two pieces. ; sub dx, offset SP_lineCtrl - offset SP_divLow xchg ax, cx out dx, al inc dx mov al, ah out dx, al ; ; Restore the data format and stuff it again after clearing DLAB (this ; is also a nice, painless way to make sure the user passing us DLAB ; set causes us no problems). ; xchg cx, ax andnf al, not mask SF_DLAB add dx, offset SP_lineCtrl - offset SP_divHigh out dx, al if _FUNKY_INFRARED ; ; Set modem control signals for IR baud rate ; mov al, ds:[bx].SPD_curState.SPS_modem sub dx, offset SP_modemCtrl - offset SP_lineCtrl out dx, al endif ; _FUNKY_INFRARED done: clc exit:: .leave ret if _FUNKY_INFRARED fail: mov ax, STREAM_UNSUPPORTED_FORMAT stc jmp exit endif ; _FUNKY_INFRARED SerialSetFormatPC endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialSetFormat %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the data format and baud rate and mode for a port CALLED BY: DR_SERIAL_SET_FORMAT PASS: al = data format (SerialFormat) ah = SerialMode bx = unit number (transformed to SerialPortData by SerialStrategy) cx = baud rate (SerialBaud) RETURN: carry set if passed an invalid format DESTROYED: ax, cx, bx (preserved by SerialStrategy) PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/13/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialSetFormat proc near uses dx .enter INT_OFF call SerialSetFormatPC jc done ; ; Adjust for the passed mode. ; dl <- SerialFlow with SF_SOFTWARE adjusted properly ; dh <- byte mask for input bytes (0x7f or 0xff) ; mov dl, ds:[bx].SPD_mode ornf dl, mask SF_SOFTWARE mov dh, 0x7f ; dl, dh <- assume cooked cmp ah, SM_RARE CheckHack <SM_COOKED gt SM_RARE> ja haveMode ; => is cooked mov dh, 0xff ; else set 8-bit data input CheckHack <SM_RAW lt SM_RARE> je haveMode ; ; RAW mode -- turn off all aspects of software flow-control ; andnf dl, not (mask SF_SOFTWARE or mask SF_XON or \ mask SF_XOFF or mask SF_SOFTSTOP) test dl, mask SF_HARDWARE jnz haveMode ; ; raw mode with no hardware flow control, so no flow control at all ; ( save some cycles in SerialInt or MiniSerialInt code ) ; andnf dl, not (mask SF_OUTPUT or mask SF_INPUT) haveMode: mov ds:[bx].SPD_byteMask, dh call SerialAdjustFCCommon done: INT_ON .leave ret SerialSetFormat endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialAdjustFCCommon %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Have a new SerialFlow record that may have turned off output flowcontrol, and therefore overridden a hard or soft stop. Set the new mode and reenable transmission if there was a change. CALLED BY: (INTERNAL) SerialSetFormat, SerialSetFlowControl, SerialEnableFlowControl PASS: ds:bx = SerialPortData dl = SerialFlow to set interrupts *OFF* RETURN: carry clear interrupts *ON* DESTROYED: dx, ax SIDE EFFECTS: SPD_mode set, transmit interrupt may be set in SPD_ien PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 8/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialAdjustFCCommon proc near .enter ; ; Set the new mode and get the mask of bits that have changed. ; mov_tr ax, dx xchg ds:[bx].SPD_mode, al xor al, ds:[bx].SPD_mode if NEW_ISR ; ; if any flow control is set, switch to flow control version of ; interrupt handlers. If flow control is cleared, switch to fast ; non-flow control version of interrupt handlers. ; test ds:[bx].SPD_mode, mask SF_SOFTWARE or \ mask SF_HARDWARE jz noFc mov ds:[bx].SPD_handlers, offset FcHandlerTbl jmp cont noFc: mov ds:[bx].SPD_handlers, offset QuickHandlerTbl cont: endif ; NEW_ISR ; ; al = mask of SerialFlow bits that changed. ; test al, mask SF_SOFTSTOP or mask SF_HARDSTOP jnz newIEN ; ; If hardware flow-control changed, we want to tweak the hardware, ; in case the modem-status interrupt has been enabled or disabled. ; test al, mask SF_HARDWARE jz done newIEN: ; ; If preempted passive, don't tweak the hardware. ; test ds:[bx].SPD_passive, mask SPS_PREEMPTED jnz done ; ; We enable transmit always, even if it was just a change in the ; HWFC, but not in the softstop/hardstop flags, as it's smaller ; codewise and does everything we need to do when we do need to turn ; on the transmitter. In the case where we're just changing the ; modem interrupt, this yields an extra interrupt, but it will find ; the output stream empty, and no harm will be done. ; call SerialEnableTransmit done: INT_ON clc .leave ret SerialAdjustFCCommon endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialGetFormatPC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: get format for a PC-like serial port CALLED BY: SerialGetFormat PASS: ds:bx = SerialPortData RETURN: al = SerialFormat cx = SerialBaud DESTROYED: Nada. PSEUDOCODE/STRATEGY: KNOWN BUGS/SIDEFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jimmy 5/ 3/93 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialGetFormatPC proc near .enter mov al, ds:[bx].SPD_curState.SPS_format mov cx, ds:[bx].SPD_curState.SPS_baud .leave ret SerialGetFormatPC endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialGetFormat %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Fetch the current format parameters for the port CALLED BY: DR_SERIAL_GET_FORMAT PASS: bx = unit number (transformed to SerialPortData by SerialStrategy) RETURN: al = SerialFormat ah = SerialMode cx = SerialBaud DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/13/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialGetFormat proc near uses dx .enter INT_OFF ; ; Compute the current mode based on the SF_SOFTWARE and byteMask ; settings. ; mov ah, SM_RAW test ds:[bx].SPD_mode, mask SF_SOFTWARE jz haveMode CheckHack <SM_RARE eq SM_RAW+1> inc ah cmp ds:[bx].SPD_byteMask, 0xff je haveMode CheckHack <SM_COOKED eq SM_RARE+1> inc ah haveMode: ; ; Fetch the pieces of the current baud divisor into cx ; if STANDARD_PC_HARDWARE call SerialGetFormatPC endif ; STANDARD_PC_HARDWARE INT_ON .leave ret SerialGetFormat endp Resident ends if LOG_MODEM_SETTINGS COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialLogModemSettings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Write the SerialModem settings to the log file CALLED BY: (Internal) SerialSetModem PASS: al = SerialModem RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- grisco 1/15/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SBCS < serialModemString char "RI,DCD,CTS,DSR = 0,0,0,0",0 > DBCS < serialModemString wchar "RI,DCD,CTS,DSR = 0,0,0,0",0 > SerialLogModemSettings proc near uses ax,cx,si,di,ds,es .enter ; ; Copy string template to the stack ; mov cx, cs segmov ds, cx mov si, offset serialModemString ; ds:si = string sub sp, size serialModemString mov cx, ss segmov es, cx mov di, sp ; es:di = target LocalCopyString SAVE_REGS ; copy to stack ; ; Loop to set up the string ; mov si, di ; si = offset to start SBCS < add di, size serialModemString-2 ; idx to last 0 > DBCS < add di, size serialModemString-4 > mov cx, 4 ; # bits to set loopTop: shr ax, 1 ; LSB in carry jnc notSet SBCS < mov {byte} es:[di], '1' > DBCS < mov {word} es:[di], '1' > notSet: SBCS < dec di > SBCS < dec di ; previous zero > DBCS < sub di, 4 > loop loopTop ; do the rest segmov ds, es, ax ; ds:si = final string call LogWriteEntry ; write the string add sp, size serialModemString .leave ret SerialLogModemSettings endp Resident ends endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialSetModem %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the modem-control bits for a port CALLED BY: DR_SERIAL_SET_MODEM PASS: al = modem control bits (SerialModem). SMC_OUT2 is silently forced high. bx = unit number (transformed to SerialPortData by SerialStrategy) RETURN: Nothing DESTROYED: ax PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/14/90 Initial version jdashe 5/26/94 added passive support %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialSetModem proc near uses dx .enter EC < test al, not SerialModem > EC < ERROR_NZ BAD_MODEM_FLAGS > if LOG_MODEM_SETTINGS call SerialLogModemSettings endif ; ; If this is a preempted port, set the modem-contol bits in ; curState and in the active port's initState, then leave ; without modifying the hardware. ; test ds:[bx].SPD_passive, mask SPS_PREEMPTED jz notPreempted EC < xchg bx, si > EC < call ECSerialVerifyPassive > EC < xchg bx, si > ornf al, mask SMC_OUT2 mov bx, ds:[bx].SPD_otherPortData mov ds:[bx].SPD_initState.SPS_modem, al mov bx, ds:[bx].SPD_otherPortData jmp done notPreempted: mov dx, ds:[bx].SPD_base add dx, offset SP_modemCtrl ornf al, mask SMC_OUT2 out dx, al ; ; 4/28/94: wait 3 clock ticks here to allow things to react to ; having DTR asserted. In particular, this is here to allow a ; serial -> parallel converter manufactured by GDT Softworks to ; power up -- ardeb ; checkDTR:: mov ds:[bx].SPD_curState.SPS_modem, al test al, mask SMC_DTR jz done mov ax, 3 call TimerSleep done: .leave ret SerialSetModem endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialGetModem %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Get the modem-control bits for a port CALLED BY: DR_SERIAL_GET_MODEM PASS: bx = unit number (transformed to SerialPortData by SerialStrategy) RETURN: al = modem control bits (SerialModem). DESTROYED: ax PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/14/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialGetModem proc near uses dx .enter ; ; If this is a preempted port, grab the modem control bits ; from the curState rather than from the hardware (we ; don't have control of the hardware, after all). ; test ds:[bx].SPD_passive, mask SPS_PREEMPTED jz notPreempted EC < xchg bx, si > EC < call ECSerialVerifyPassive > EC < xchg bx, si > mov al, ds:[bx].SPD_curState.SPS_modem jmp gotModem notPreempted: mov dx, ds:[bx].SPD_base add dx, offset SP_modemCtrl in al, dx gotModem: ; deal with non-existent port being enabled by masking out all but the ; real modem bits, preventing BAD_MODEM_FLAGS in EC version when caller ; attempts to restore the original modem flags... EC < andnf al, SerialModem > .leave ret SerialGetModem endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialSetFlowControl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Change the flow-control used by a port CALLED BY: DR_SERIAL_SET_FLOW_CONTROL PASS: ax = SerialFlowControl record describing what method(s) of control to use bx = unit number (transformed to SerialPortData by SerialStrategy) cl = signal(s) to use to tell remote to stop sending (SerialModem) if de-asserted ch = signal(s) whose de-assertion indicates we should stop sending (one or more of SMS_DCD, SMS_DSR or SMS_CTS). If more than one signal is given, the dropping of any will cause output to stop until all signals are high again. RETURN: Nothing DESTROYED: ax, cx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 3/ 7/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialSetFlowControl proc near uses dx .enter INT_OFF EC < test ax, not SerialFlowControl > EC < ERROR_NZ BAD_FLOW_CONTROL_FLAGS > mov dl, ds:[bx].SPD_mode ; for Zoomer, we are not allowing Hardware Handshaking, ; due to the way the hardware was designed (cannot be interrupt ; driven as the modem signals are wire-or'ed to be the IRQ ; line, meaning the thing keeps interrupting as long as the ; other side has the signal dropped) test al, mask SFC_SOFTWARE jz clearSWFC ornf dl, mask SF_SOFTWARE jmp checkHWFC clearSWFC: andnf dl, not (mask SF_SOFTWARE or mask SF_XON or \ mask SF_XOFF or mask SF_SOFTSTOP) checkHWFC: test al, mask SFC_HARDWARE jz clearHWFC ornf dl, mask SF_HARDWARE EC < test cl, not (mask SMC_RTS or mask SMC_DTR) > EC < ERROR_NZ BAD_FLOW_CONTROL_FLAGS > EC < test ch, not (mask SMS_CTS or mask SMS_DCD or mask SMS_DSR)> EC < ERROR_NZ BAD_FLOW_CONTROL_FLAGS > mov ds:[bx].SPD_stopCtrl, cl mov ds:[bx].SPD_stopSignal, ch ; SIEN_MODEM IS THE SAME AS ZSIEN_MODEM SO NO NEED TO CHECK ; WHICH PORT IN ZOOMER CODE ornf ds:[bx].SPD_ien, mask SIEN_MODEM done: ; ; Adjust the port's interrupt-enable register to match what we want ; dl = SerialFlow to set ; call SerialAdjustFCCommon .leave ret clearHWFC: andnf dl, not (mask SF_HARDWARE or mask SF_HARDSTOP) tst ds:[bx].SPD_modemEvent.SN_type jnz done ; Modem event registered -- leave modem ; status interrupt enabled. ; SIEN_MODEM IS THE SAME AS ZSIEN_MODEM SO NO NEED TO CHECK ; WHICH PORT IN ZOOMER CODE andnf ds:[bx].SPD_ien, not mask SIEN_MODEM jmp done SerialSetFlowControl endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialEnableFlowControl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set whether flow control is enabled for either or both sides of the serial port. CALLED BY: DR_SERIAL_ENABLE_FLOW_CONTROL PASS: ax = STREAM_READ/STREAM_WRITE/STREAM_BOTH bx = unit RETURN: carry set on error: ax = STREAM_NO_DEVICE = STREAM_CLOSED carry clear if ok: ax = destroyed DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 8/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialEnableFlowControl proc near uses dx .enter EC < call ECVerifyReadWriteBothFlag > INT_OFF ; ; Assume enabling flow control for both sides. ; mov dl, ds:[bx].SPD_mode ornf dl, mask SF_INPUT or mask SF_OUTPUT CheckHack <(STREAM_WRITE and 1) eq 0> CheckHack <(STREAM_BOTH and 1) eq 0> test ax, 1 jz checkInput ; ; Disabling flow control for output. This means we clear SF_OUTPUT ; and also clear SF_SOFTSTOP and SF_HARDSTOP as we are no longer ; constrained not to transmit. ; andnf dl, not (mask SF_OUTPUT or mask SF_SOFTSTOP or \ mask SF_HARDSTOP) checkInput: CheckHack <(STREAM_READ and 0x8000) eq 0x8000> CheckHack <(STREAM_BOTH and 0x8000) eq 0x8000 tst ax js setMode ; ; Disabling flow control for input. This means we clear SF_INPUT ; and also clear SF_XOFF and SF_XON flags (we clear SF_XON to ; ensure consistent behaviour: if the stream hadn't yet drained to ; the low water mark, we would not send an XON when the thing got ; there, so we shouldn't allow one to be sent on the next interrupt ; either; once you disable input flow control, you don't get an ; XON or XOFF generated, period) ; andnf dl, not (mask SF_INPUT or mask SF_XOFF or mask SF_XON) setMode: call SerialAdjustFCCommon .leave ret SerialEnableFlowControl endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialSetRole %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Sets the role of the driver (either DCE or DTE) CALLED BY: DR_SERIAL_SET_ROLE PASS: al = SerialRole bx = unit number RETURN: carry set on error carry clear if ok DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: This doesn't do anything for the serial driver, but the API needed to be defined here so that it could be used in IrCOMM. If the serial driver is ever to be used as a DCE, this routine will need to set the state. REVISION HISTORY: Name Date Description ---- ---- ----------- grisco 12/12/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialSetRole proc near clc ret SerialSetRole endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialGetDeviceMap %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Fetch the map of existing stream devices for this driver CALLED BY: DR_STREAM_GET_DEVICE_MAP PASS: ds = dgroup (from SerialStrategy) RETURN: ax = SerialDeviceMap DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 8/ 7/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialGetDeviceMap proc near .enter mov ax, ds:[deviceMap] .leave ret SerialGetDeviceMap endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialDefinePort %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Define an additional port for the driver to handle. CALLED BY: DR_SERIAL_DEFINE_PORT PASS: ax = base I/O port of device cl = interrupt level for device RETURN: bx = unit number for later calls. carry set if port couldn't be defined (no interrupt vectors available, e.g.) DESTROYED: ax, cx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 10/14/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DefStub SerialDefinePort COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialStatPort %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Check on the status of a serial port. (Must be Resident for PCMCIA support) CALLED BY: DR_SERIAL_STAT_PORT PASS: bx = unit number (SerialPortNum) RETURN: carry set if port doesn't exist carry clear if port is known: al = interrupt level (-1 => unknown) ah = BB_TRUE if port is currently open DESTROYED: nothing (interrupts turned on) PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 10/21/90 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialStatPort proc near uses bx .enter call SerialGetPortData ; ds:bx <- SerialPortData INT_OFF tst ds:[bx].SPD_base jz nonExistent mov al, ds:[bx].SPD_irq clr ah ; assume not open push bx mov bx, ds:[bx].SPD_openSem tst ds:[bx].Sem_value ; (clears carry) pop bx jg done dec ah done: INT_ON .leave ret nonExistent: stc jmp done SerialStatPort endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialGetPassiveState %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Returns the status of a passive port. CALLED BY: DR_SERIAL_GET_PASSIVE_STATE PASS: bx = Serial unit number RETURN: carry clear if the port exists and is available for passive use carry set otherwise, and: ax = STREAM_NO_DEVICE if the indicated unit doesn't exist. = STREAM_ACTIVE_IN_USE if the unit is actively allocated, which means that a passive allocation is allowed (but will immediately block). = STREAM_PASSIVE_IN_USE if the unit is currently passively allocated. An attempted SerialOpen will be unsuccessful. If ax = STREAM_PASSIVE_IN_USE, check cl for more details. cl = SerialPassiveStatus for the open port, with SPS_PREEMPTED and SPS_BUFFER_FULL set as appropriate. DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- jdashe 5/24/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment SerialGetPassiveState proc near uses bx .enter call SerialGetPortData ; bx <- port data offset EC < xchg si, bx > EC < call ECSerialVerifyPassive > EC < xchg si, bx > tst ds:[bx].SPD_base jnz checkPassiveInUse mov ax, STREAM_NO_DEVICE jmp error checkPassiveInUse: mov cl, ds:[bx].SPD_passive IsPortOpen bx jg portNotOpen mov ax, STREAM_PASSIVE_IN_USE jmp error portNotOpen: mov bx, ds:[bx].SPD_otherPortData IsPortOpen bx mov bx, ds:[bx].SPD_otherPortData jg activeNotOpen mov ax, STREAM_ACTIVE_IN_USE jmp error activeNotOpen: clc jmp exit error: stc exit: .leave ret SerialGetPassiveState endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ECSerialVerifyPassive %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Verifies that the passed offset points to a passive port's SerialPortData structure rather than to an active port's. PASS: ds:si - pointer to the port's data structure RETURN: The Z flag set. DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jdashe 4/27/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if ERROR_CHECK Resident segment ECSerialVerifyPassive proc far .enter ; ; Passive ports are not yet available for the Zoomer. ; if STANDARD_PC_HARDWARE ; ; See if it's one of the passive ports... ; push es, di, cx push bx mov bx, handle dgroup call MemDerefES pop bx ; segmov es, dgroup, di mov di, offset comPortsPassive mov cx, length comPortsPassive xchg ax, si repne scasw xchg ax, si pop es, di, cx ERROR_NE INVALID_PORT_DATA_OFFSET ; ; It's in the right place. Make sure the passive bit is set. ; test ds:[si].SPD_passive, mask SPS_PASSIVE ERROR_Z NOT_A_PASSIVE_PORT cmp si, si ; cheesy way to set Z... endif ; STANDARD_PC_HARDWARE .leave ret ECSerialVerifyPassive endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ECSerialVerifyActive %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Verifies that the passed offset points to an active port's SerialPortData structure rather than to a passive port's. PASS: ds:si - pointer to the port's data structure RETURN: The Z flag clear. DESTROYED: nothing PSEUDO CODE/STRATEGY: Hackish. The code assumes the passive port structure definitions are placed after the active ones. REVISION HISTORY: Name Date Description ---- ---- ----------- jdashe 6/ 2/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ECSerialVerifyActive proc far .enter ; ; Make sure the thing is a port at all. ; cmp si, offset com1 ERROR_B INVALID_PORT_DATA_OFFSET cmp si, LAST_ACTIVE_SERIAL_COMPORT ERROR_A NOT_AN_ACTIVE_PORT ; It's something else. ; ; It's in the right place. Make sure the passive bit is clear. ; test ds:[si].SPD_passive, mask SPS_PASSIVE ERROR_NZ NOT_AN_ACTIVE_PORT .leave ret ECSerialVerifyActive endp Resident ends endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialGetMedium %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Fetch the medium bound to a particular port CALLED BY: DR_SERIAL_GET_MEDIUM PASS: bx = unit number (SerialPortNum) cx = medium # to fetch (0 == primary) RETURN: carry set on error: ax = STREAM_NO_DEVICE carry clear if ok: dxax = MediumType (medium.def) DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 9/22/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment resource SerialGetMedium proc near .enter Assert l, cx, SERIAL_MAX_MEDIA and bx, not SERIAL_PASSIVE ; ignore passive bit -- data ; set only on the active call SerialGetPortData tst_clc ds:[bx].SPD_base jz honk CheckHack <size MediumType eq 4> mov ax, cx shl ax shl ax add bx, ax ; offset bx by index into ; SPD_medium so next thing ; fetches the right medium out movdw dxax, ds:[bx].SPD_medium mov bx, ax or bx, dx jz noMedium ; => nothing in that slot done: .leave ret honk: mov ax, STREAM_NO_DEVICE error: stc jmp done noMedium: mov ax, STREAM_NO_SUCH_MEDIUM jmp error SerialGetMedium endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialSetMedium %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Specify the medium for a particular port. CALLED BY: DR_SERIAL_SET_MEDIUM PASS: bx = unit number (SerialPortNum) ds = serialData segment (from SerialStrategy) dx:ax = array of MediumTypes to bind to the port cx = # of MediumTypes to bind to it RETURN: carry set on error: ax = STREAM_NO_DEVICE carry clear if ok: ax = destroyed DESTROYED: nothing (bx, but that's saved by the caller) SIDE EFFECTS: if port had medium bound, MESN_MEDIUM_NOT_AVAILABLE generated for it MESN_MEDIUM_AVAILABLE generated for new medium PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 9/22/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Resident segment resource SerialSetMedium proc near uses cx, dx, si, di .enter ; ; Point to the port data and make sure it exists. ; and bx, not SERIAL_PASSIVE ; ignore passive bit -- data ; set only on the active mov si, bx call SerialGetPortData tst ds:[bx].SPD_base jz honk ; ; First let the world know the currently bound media are gone, before ; we overwrite the info. ; push si ; save port # push dx, ax mov di, MESN_MEDIUM_NOT_AVAILABLE call SerialNotifyMedia ; ; Move the new media into the port data. ; segmov es, ds lea di, ds:[bx].SPD_medium pop ds, si Assert le, cx, SERIAL_MAX_MEDIA CheckHack <size MediumType eq 4> shl cx mov dx, SERIAL_MAX_MEDIA * 2 sub dx, cx ; dx <- # words to zero push si, cx, dx rep movsw mov cx, dx clr ax rep stosw ; mark the rest of the array ; invalid ; ; Now do the same for the passive port, please. ; pop si, cx, dx mov di, es:[bx].SPD_otherPortData add di, offset SPD_medium rep movsw mov cx, dx rep stosw ; ; Let the world know the thing exists. ; pop si ; si <- port # segmov ds, es ; ds:bx <- SPD mov di, MESN_MEDIUM_AVAILABLE call SerialNotifyMedia clc done: .leave ret honk: mov ax, STREAM_NO_DEVICE stc jmp done SerialSetMedium endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialNotifyMedia %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Send notification for each of the Media types bound to a port. CALLED BY: (INTERNAL) SerialSetMedium PASS: ds:bx = SerialPortData with SPD_medium set si = SerialPortNum di = MediumSubsystemNotification to send RETURN: nothing DESTROYED: ax, dx SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 1/23/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialNotifyMedia proc near uses si, bx, cx .enter add bx, offset SPD_medium xchg bx, si ; bx <- unit # ; ds:si <- array mov cx, SERIAL_MAX_MEDIA ; cx <- # media to check mediumLoop: ; ; Fetch the next medium out of the array. ; push cx lodsw mov_tr dx, ax ; dx <- low word lodsw mov cx, ax ; cxdx <- MediumType or ax, dx jz loopDone ; => GMID_INVALID, so done ; ; Send notification out for the medium. ; mov al, MUT_INT push si mov si, SST_MEDIUM call SysSendNotification pop si ; ds:si <- next medium entry pop cx ; cx <- loop counter loop mediumLoop done: .leave ret loopDone: pop cx jmp done SerialNotifyMedia endp SerialSetMediumFAR proc far ; for SerialLookForMedium & SerialDefinePort to ; use push bx call SerialSetMedium pop bx ret SerialSetMediumFAR endp Resident ends COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialSetBufferSize %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Change the size of an open stream's buffers. CALLED BY: DR_SERIAL_SET_BUFFER_SIZE PASS: ax = STREAM_READ/STREAM_WRITE bx = unit # cx = new size RETURN: carry set on error DESTROYED: nothing SIDE EFFECTS: if new size smaller than actual number of bytes, most recent bytes will be discarded. PSEUDO CODE/STRATEGY: fetch & 0 the stream pointer for the appropriate side compute new stream size if too small to hold current # bytes, drop enough to leave stream full if shrinking & data wraps, move bytes down so last byte in current buffer is before new SD_max. there must be enough room in the buffer to do this without overwriting anything vital, because of the size adjusting we did in the previous step. set SD_reader.SSD_ptr accordingly MemRealloc the stream if growing & data wraps, move data in last part of buffer up to reach new SD_max adjust SD_writer.SSD_sem.Sem_value by size difference store new stream pointer back in appropriate side REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 8/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DefStub SerialSetBufferSize OpenClose segment SerialSetBufferSize proc far .enter ; ; Figure which variable holds the stream pointer, based on what ; we were passed. ; mov si, offset SPD_inStream cmp ax, STREAM_READ je haveStreamOffset EC < cmp ax, STREAM_WRITE > EC < ERROR_NE MUST_SPECIFY_READER_OR_WRITER > mov si, offset SPD_outStream haveStreamOffset: ; ; Make sure the new buffer size isn't too large. ; cmp cx, STREAM_MAX_STREAM_SIZE jb bufferSizeOk mov ax, STREAM_BUFFER_TOO_LARGE stc jmp done bufferSizeOk: ; ; Fetch the current stream out of the port and set the stream ; pointer to 0 for the duration. This will cause data to get dropped ; on the floor, etc., but that's fine by us. ; push bx, si, ds clr ax xchg ax, ds:[bx][si] tst ax jz errBusy ; => no stream, so someone else ; must be doing something ; ; If we're not the only thread actively messing with this port, claim ; the thing is busy and do nothing. ; cmp ds:[bx].SPD_refCount, 2 jne errBusy ; => another thread is doing ; stuff in here and might ; be dicking with this stream ; ; Figure how big to make the new stream buffer. ; mov ds, ax ; ds <- stream mov dx, ds:[SD_max] ; dx <- old size add cx, size StreamData ; cx <- new size ; ; Shift the data around to account for any shrinkage we're about to ; perform. ; call SerialAdjustForShrinkage ; ; Resize the stream block, please. ; mov bx, ds:[SD_handle] push cx mov_tr ax, cx ; ax <- new size clr cx call MemReAlloc pop cx ; cx <- new size jc allocErr ; ; Shift the data around to account for any enlargement we just ; performed. ; mov ds, ax ; ds <- stream, again call SerialAdjustForGrowth ; ; All the new space or the lost old space come from the writer's side, ; as the data in the stream remain constant. ; sub cx, dx ; cx <- size difference Assert ge, ds:[SD_writer].SSD_sem.Sem_value, 0 add ds:[SD_writer].SSD_sem.Sem_value, cx ; ; The max value for the stream data pointer gets adjusted by the ; same amount, please. ; add ds:[SD_max], cx clc mov ax, ds ; ax <- stream, for restoration replaceStream: ; ; Restore the stream pointer in the SerialPortData ; pop bx, si, ds mov ds:[bx][si], ax done: .leave ret allocErr: xchg cx, dx ; cx <- old size, dx <- new call SerialAdjustForGrowth ; so we can pretend the stream ; grew to its old size and ; undo the work of ; SerialAdjustForShrinkage mov ax, ds mov cx, STREAM_CANNOT_ALLOC stc jmp replaceStream errBusy: mov cx, STREAM_BUSY stc jmp replaceStream SerialSetBufferSize endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialAdjustForShrinkage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Discard enough data to make it fit in the new size, then shift data down from the end of the buffer to fit under the new limit CALLED BY: (INTERNAL) SerialSetBufferSize PASS: ds = stream being shrunk dx = old size cx = new size RETURN: nothing DESTROYED: ax SIDE EFFECTS: data in the buffer shifted to be below the new max PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 9/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialAdjustForShrinkage proc near uses cx, si, di, es .enter mov ax, cx sub ax, size StreamData sub ax, ds:[SD_reader].SSD_sem.Sem_value jge bytesWillFit ; ; Too many bytes in the stream. Scale back the SSD_sem and advance the ; SSD_ptr for the reader. We adjust the SD_writer.SSD_sem to account ; for the scaling back that'll happen in SerialSetBufferSize itself ; once all is said and done (and in case of error, too...). ; add ds:[SD_reader].SSD_sem.Sem_value, ax neg ax add ds:[SD_writer].SSD_sem.Sem_value, ax add ax, ds:[SD_reader].SSD_ptr cmp ax, ds:[SD_max] ; wrap around end? jb setReaderPtr ; no sub ax, ds:[SD_max] ; ax <- amount of wrap add ax, offset SD_data ; ax <- new pointer setReaderPtr: mov ds:[SD_reader].SSD_ptr, ax bytesWillFit: ; ; There is now room for all the bytes in the new world order. See ; if we need to move any data down from the end of the buffer. ; Note that if the two SSD_ptrs are equal, it either means the buffer ; is empty (in which case we need only shift stuff down to the bottom ; of the buffer) or the buffer is full, which means we're not actually ; shrinking (else we would have thrown away some bytes, above...). ; segmov es, ds ; for moving mov ax, ds:[SD_writer].SSD_ptr cmp ax, ds:[SD_reader].SSD_ptr jae noWrap ; => contiguous or empty ; ; Data wraps around the end of the buffer. If we're actually shrinking, ; we have to shift that data down by the size difference. ; sub cx, dx jae done ; => buffer growing, so don't ; care yet. mov si, ds:[SD_reader].SSD_ptr mov di, si add di, cx ; di <- destination Assert ae, di, ds:[SD_writer].SSD_ptr mov ds:[SD_reader].SSD_ptr, di mov cx, ds:[SD_max] sub cx, si ; cx <- # bytes to move rep movsb jmp done noWrap: ; ; Ok, the data is contiguous or the buffer is empty, but it (the data ; or the pointers) might still be in the way. ; cmp ax, cx ; write pointer after new max? jbe done ; => no so not in the way ; ; Is in the way. Just shift the whole thing down to the start of ; the buffer. For an empty buffer, this moves nothing, but does set ; the SSD_ptr variables to SD_data, which is where we want them. ; mov si, ds:[SD_reader].SSD_ptr mov cx, ax ; cx <- write pointer sub cx, si ; cx <- # bytes to move mov di, offset SD_data ; es:di <- dest mov ds:[SD_reader].SSD_ptr, di rep movsb mov ds:[SD_writer].SSD_ptr, di done: .leave ret SerialAdjustForShrinkage endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SerialAdjustForGrowth %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Shift any data at the end of the ring buffer up to be at the new end of the ring buffer. CALLED BY: (INTERNAL) SerialSetBufferSize PASS: ds = stream affected cx = new size dx = old size RETURN: nothing DESTROYED: ax SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 2/ 9/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SerialAdjustForGrowth proc near uses cx, si, di, es .enter ; ; If didn't grow, do nothing. ; cmp cx, dx jbe done ; ; See if the data wrap around the end of the buffer. If they don't ; then we have nothing to worry about, as the data can merrily reside ; in the middle of the buffer contiguously without hurting anything. ; segmov es, ds mov ax, ds:[SD_reader].SSD_ptr cmp ax, ds:[SD_writer].SSD_ptr ja wraps jb done ; => doesn't wrap, so don't need to ; worry ; ; Either full (wraps) or empty (doesn't wrap). Don't have to worry about ; < 0 case, as no one can be blocked on the thing, since we're the only ; ones here... ; tst ds:[SD_reader].SSD_sem.Sem_value jz done wraps: ; ; Sigh. It wraps. Woe is me. Sniff. ; ; Must move the data up in the world from the old end to the new end. ; mov di, cx ; es:di <- new end+1 mov si, dx ; ds:si <- old end+1 mov cx, dx sub cx, ax ; cx <- # bytes to move dec di ; move to actual last byte dec si ; from actual last byte std ; do that wacky decrement thing rep movsb cld ; ; Point to the new position of the first byte for reading. ; inc di mov ds:[SD_reader].SSD_ptr, di done: .leave ret SerialAdjustForGrowth endp OpenClose ends
25.884393
142
0.61255
[ "Apache-2.0" ]
BOBBYWY/pcgeos
Driver/Stream/Serial/serialMain.asm
129,862
Assembly
; A056488: Number of periodic palindromes using a maximum of six different symbols. ; 6,21,36,126,216,756,1296,4536,7776,27216,46656,163296,279936,979776,1679616,5878656,10077696,35271936,60466176,211631616,362797056,1269789696,2176782336,7618738176,13060694016,45712429056,78364164096,274274574336,470184984576,1645647446016,2821109907456,9873884676096,16926659444736,59243308056576,101559956668416,355459848339456,609359740010496,2132759090036736,3656158440062976,12796554540220416,21936950640377856,76779327241322496,131621703842267136,460675963447934976,789730223053602816,2764055780687609856,4738381338321616896,16584334684125659136,28430288029929701376,99506008104753954816,170581728179578208256,597036048628523728896,1023490369077469249536,3582216291771142373376,6140942214464815497216,21493297750626854240256,36845653286788892983296,128959786503761125441536,221073919720733357899776,773758719022566752649216,1326443518324400147398656,4642552314135400515895296,7958661109946400884391936,27855313884812403095371776,47751966659678405306351616,167131883308874418572230656,286511799958070431838109696,1002791299853246511433383936,1719070799748422591028658176,6016747799119479068600303616,10314424798490535546171949056,36100486794716874411601821696,61886548790943213277031694336,216602920768301246469610930176,371319292745659279662190166016,1299617524609807478817665581056,2227915756473955677973140996096,7797705147658844872905993486336,13367494538843734067838845976576,46786230885953069237435960918016,80204967233062404407033075859456,280717385315718415424615765508096,481229803398374426442198455156736,1684304311894310492547694593048576,2887378820390246558653190730940416,10105825871365862955286167558291456,17324272922341479351919144385642496,60634955228195177731717005349748736,103945637534048876111514866313854976,363809731369171066390302032098492416,623673825204293256669089197883129856 lpb $0 mov $2,$1 trn $2,$0 sub $0,1 add $1,1 mul $2,5 add $1,$2 lpe mul $1,15 add $1,6 mov $0,$1
133.666667
1,810
0.917207
[ "Apache-2.0" ]
ckrause/cm
programs/oeis/056/A056488.asm
2,005
Assembly
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r14 push %r9 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_UC_ht+0x3f8d, %r10 nop nop nop nop nop lfence vmovups (%r10), %ymm2 vextracti128 $0, %ymm2, %xmm2 vpextrq $1, %xmm2, %r14 nop nop and %rbx, %rbx lea addresses_normal_ht+0x8f35, %r10 nop nop nop sub $28455, %rbp mov $0x6162636465666768, %rcx movq %rcx, (%r10) nop sub %r14, %r14 lea addresses_D_ht+0xf28d, %rsi lea addresses_WC_ht+0x151b8, %rdi nop nop and $29087, %r9 mov $44, %rcx rep movsb nop nop xor $58951, %r14 lea addresses_WT_ht+0xaeb5, %r14 clflush (%r14) nop nop nop nop cmp %rsi, %rsi movb (%r14), %bl nop nop nop nop xor $2307, %rsi lea addresses_normal_ht+0x248d, %rsi lea addresses_normal_ht+0x608d, %rdi clflush (%rsi) nop sub %r9, %r9 mov $124, %rcx rep movsb nop nop nop and $13924, %rbp lea addresses_WT_ht+0x5553, %r9 nop nop nop sub %rbp, %rbp mov $0x6162636465666768, %r10 movq %r10, %xmm5 movups %xmm5, (%r9) nop and %rbx, %rbx lea addresses_WC_ht+0x1e38d, %rdi nop dec %rbp mov (%rdi), %r10 nop nop nop nop nop and %r9, %r9 lea addresses_A_ht+0xcc0d, %rsi lea addresses_UC_ht+0x1ba4d, %rdi nop nop sub $19836, %r10 mov $7, %rcx rep movsb nop nop nop nop nop and $58920, %rbp pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r9 pop %r14 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r8 push %rax push %rcx push %rdi push %rdx // Store lea addresses_WC+0x17b6b, %rcx cmp $58441, %rdx movw $0x5152, (%rcx) nop xor $50018, %rax // Load lea addresses_WT+0x1578d, %r13 inc %rdx vmovups (%r13), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $0, %xmm5, %r11 nop nop xor %r11, %r11 // Store lea addresses_PSE+0x1dc75, %rax nop nop nop nop and %r8, %r8 mov $0x5152535455565758, %rcx movq %rcx, %xmm4 vmovups %ymm4, (%rax) nop sub %rcx, %rcx // Faulty Load lea addresses_UC+0x1148d, %rdi nop nop nop nop nop add $877, %r13 mov (%rdi), %r11w lea oracles, %r13 and $0xff, %r11 shlq $12, %r11 mov (%r13,%r11,1), %r11 pop %rdx pop %rdi pop %rcx pop %rax pop %r8 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 5}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 3}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 6}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 3}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 3}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_normal_ht'}, 'dst': {'same': True, 'congruent': 10, 'type': 'addresses_normal_ht'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 1}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 5}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_UC_ht'}} {'37': 21829} 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 */
35.466321
2,999
0.657852
[ "MIT" ]
danielmgmi/medusa
Transynther/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_1032.asm
6,845
Assembly
10003770: e8 cb fd ff ff call 0x10003540 10003775: 83 f8 ff cmp eax,0xffffffff 10003778: a3 00 00 01 10 mov ds:0x10010000,eax 1000377d: 74 1f je 0x1000379e 1000377f: e8 ec fe ff ff call 0x10003670 10003784: 85 c0 test eax,eax 10003786: 75 1a jne 0x100037a2 10003788: a1 00 00 01 10 mov eax,ds:0x10010000 1000378d: 50 push eax 1000378e: ff 15 0c d0 00 10 call DWORD PTR ds:0x1000d00c 10003794: c7 05 00 00 01 10 ff mov DWORD PTR ds:0x10010000,0xffffffff 1000379b: ff ff ff 1000379e: 83 c8 ff or eax,0xffffffff 100037a1: c3 ret 100037a2: e8 f9 fc ff ff call 0x100034a0 100037a7: 85 c0 test eax,eax 100037a9: 75 f3 jne 0x1000379e 100037ab: a3 20 52 01 10 mov ds:0x10015220,eax 100037b0: a3 24 52 01 10 mov ds:0x10015224,eax 100037b5: c3 ret 100037b6: cc int3 100037b7: cc int3 100037b8: cc int3 100037b9: cc int3 100037ba: cc int3 100037bb: cc int3 100037bc: cc int3 100037bd: cc int3 100037be: cc int3 100037bf: cc int3
45.483871
73
0.505674
[ "Unlicense" ]
SamantazFox/dds140-reverse-engineering
library/02_functions_batch1/DeviceOpen.asm
1,410
Assembly
; A128141: A122432 (unsigned) * A128132. ; Submitted by Jon Maiga ; 1,2,2,3,5,3,4,9,8,4,5,14,15,11,5,6,20,24,21,14,6,7,27,35,34,27,17,7,8,35,48,50,44,33,20,8,9,44,63,69,65,54,39,23,9,10,54,80,91,90,80,64,45,26,10 lpb $0 add $1,1 sub $0,$1 lpe add $1,1 sub $1,$0 mul $0,$1 add $0,2 mul $0,11 mul $1,$0 add $0,$1 div $0,22 sub $0,1
18.611111
146
0.602985
[ "Apache-2.0" ]
ckrause/loda-programs
oeis/128/A128141.asm
335
Assembly
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r14 push %r15 push %r9 push %rbp push %rcx push %rdi push %rsi lea addresses_normal_ht+0x10ece, %rsi lea addresses_A_ht+0x12daa, %rdi nop nop xor $8083, %r11 mov $117, %rcx rep movsb nop sub $64538, %r14 lea addresses_D_ht+0x4d3, %r11 nop nop and %r15, %r15 vmovups (%r11), %ymm2 vextracti128 $1, %ymm2, %xmm2 vpextrq $0, %xmm2, %rcx nop nop nop sub $7009, %rdi lea addresses_A_ht+0x834e, %r15 nop nop add $33307, %rbp mov $0x6162636465666768, %r11 movq %r11, (%r15) add $6671, %r15 lea addresses_A_ht+0x514e, %rsi lea addresses_WT_ht+0x1b94e, %rdi nop nop nop cmp $60044, %r9 mov $89, %rcx rep movsq nop nop and %rdi, %rdi lea addresses_D_ht+0xe93a, %rsi lea addresses_normal_ht+0x1514e, %rdi nop nop nop nop nop dec %rbp mov $20, %rcx rep movsl nop nop and %r15, %r15 lea addresses_WT_ht+0x1e00c, %rcx nop and %r15, %r15 mov $0x6162636465666768, %rbp movq %rbp, %xmm7 vmovups %ymm7, (%rcx) nop nop xor %rbp, %rbp lea addresses_WC_ht+0xd98e, %rcx nop nop nop xor %rbp, %rbp vmovups (%rcx), %ymm2 vextracti128 $0, %ymm2, %xmm2 vpextrq $0, %xmm2, %r9 nop inc %r15 lea addresses_A_ht+0x164ce, %rsi lea addresses_WT_ht+0x294e, %rdi nop nop nop nop nop sub %r14, %r14 mov $101, %rcx rep movsq nop xor $59352, %r14 lea addresses_WT_ht+0x1ab5e, %rsi lea addresses_normal_ht+0x196ce, %rdi nop inc %r11 mov $50, %rcx rep movsq sub $48951, %r14 lea addresses_normal_ht+0xd14e, %rsi lea addresses_WT_ht+0xce, %rdi clflush (%rdi) nop xor $54657, %r9 mov $110, %rcx rep movsw and $32859, %r15 pop %rsi pop %rdi pop %rcx pop %rbp pop %r9 pop %r15 pop %r14 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r14 push %r15 push %r8 push %rbp push %rdx // Store mov $0x146baa0000000d4e, %r8 nop sub %rdx, %rdx mov $0x5152535455565758, %r11 movq %r11, (%r8) nop nop cmp $16312, %r8 // Load lea addresses_RW+0xbd8e, %r8 nop nop sub %rbp, %rbp movups (%r8), %xmm7 vpextrq $1, %xmm7, %r15 nop nop nop add %r8, %r8 // Faulty Load mov $0x146baa0000000d4e, %r14 nop dec %r15 movups (%r14), %xmm5 vpextrq $1, %xmm5, %rbp lea oracles, %r8 and $0xff, %rbp shlq $12, %rbp mov (%r8,%rbp,1), %rbp pop %rdx pop %rbp pop %r8 pop %r15 pop %r14 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 8}} {'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_RW', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': False, 'congruent': 7, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_A_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 9, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 8}} {'src': {'same': True, 'congruent': 10, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WT_ht'}} {'src': {'same': False, 'congruent': 2, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32}} {'src': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 7, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WT_ht'}} {'src': {'same': False, 'congruent': 4, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_normal_ht'}} {'src': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}} {'44': 17908, '46': 3326, '00': 508, '42': 1, '45': 83, '6e': 1, 'ff': 2} 44 44 44 46 46 44 44 46 44 44 44 46 44 44 44 44 44 46 00 44 44 44 44 44 00 44 44 46 44 44 44 46 46 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 46 44 44 44 44 44 44 44 46 44 44 44 44 44 44 44 46 46 44 44 44 44 46 44 44 44 44 44 46 44 44 46 46 44 44 44 44 44 44 44 44 44 44 44 46 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 46 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 44 44 44 46 44 46 44 44 44 44 44 44 44 46 44 46 46 46 44 44 44 46 46 46 46 44 44 44 44 44 44 44 44 44 44 44 46 00 44 44 44 46 44 44 44 44 44 44 44 44 44 44 44 44 46 44 44 46 44 44 46 00 44 46 44 44 44 46 44 44 44 44 44 44 44 44 44 44 46 44 44 44 44 44 46 44 46 44 44 44 46 44 46 44 46 44 44 44 46 46 44 44 44 44 44 44 46 44 44 46 46 46 44 44 46 44 46 44 44 00 44 44 44 44 46 44 44 44 44 44 46 44 46 44 46 44 44 44 46 46 44 44 44 44 44 46 44 44 44 44 46 44 44 46 44 44 44 44 00 44 44 44 44 44 44 46 44 46 44 44 44 00 44 44 44 44 44 44 46 44 44 46 46 44 46 44 44 44 44 44 44 44 44 46 44 44 44 46 44 44 44 44 44 44 44 44 44 44 44 44 44 46 44 44 44 45 44 44 44 44 46 44 44 44 46 46 46 44 46 44 44 46 44 44 44 46 46 46 44 44 44 46 44 44 46 46 44 44 44 44 44 44 44 44 44 44 44 44 44 46 46 46 44 44 44 44 44 44 44 44 44 44 46 44 44 44 44 45 00 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 46 44 44 44 46 46 44 44 44 44 44 44 44 46 46 46 44 46 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 46 46 46 44 44 44 44 46 46 46 46 44 44 44 44 44 44 46 44 44 44 46 44 44 44 44 46 44 44 44 44 44 44 44 44 44 44 44 44 00 44 44 44 46 46 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 46 44 44 44 44 44 46 46 44 44 44 46 46 44 44 46 44 44 44 44 44 44 44 46 46 46 44 46 44 44 44 44 44 44 46 44 44 44 44 44 00 44 46 44 44 44 44 44 44 44 44 46 44 44 46 46 46 44 44 44 44 44 44 44 44 44 44 46 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 46 44 46 44 44 44 44 44 44 44 44 44 44 46 44 44 44 44 44 44 44 44 44 44 44 46 44 44 46 44 44 46 44 44 46 44 46 44 44 42 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 46 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 46 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 46 44 44 44 44 44 44 46 45 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 44 44 44 44 44 44 44 46 44 44 44 44 00 46 44 46 44 44 44 44 46 44 46 44 44 44 44 44 44 44 44 44 44 44 44 46 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 46 44 44 46 44 44 46 44 44 44 44 44 44 44 44 44 44 44 44 00 46 44 44 44 46 44 44 44 44 44 44 44 44 44 44 46 46 44 44 46 44 44 44 46 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 00 44 44 44 44 44 44 46 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 46 44 44 46 44 44 44 44 46 44 46 44 44 46 44 44 44 44 44 44 44 44 44 44 44 44 46 46 44 44 44 46 46 44 44 46 44 44 44 44 44 44 44 44 46 46 44 44 44 44 44 44 44 46 44 44 44 46 44 44 44 44 44 44 44 46 44 44 44 46 44 44 44 44 44 44 44 46 46 44 44 44 44 44 44 44 44 46 44 44 44 44 44 44 44 */
38.343915
2,999
0.657375
[ "MIT" ]
danielmgmi/medusa
Transynther/_processed/NC/_ht_zr_un_/i9-9900K_12_0xa0.log_21829_1413.asm
7,247
Assembly
; A056473: Number of palindromic structures using exactly four different symbols. ; 0,0,0,0,0,0,1,1,10,10,65,65,350,350,1701,1701,7770,7770,34105,34105,145750,145750,611501,611501,2532530,2532530,10391745,10391745,42355950,42355950,171798901 div $0,2 mov $1,4 pow $1,$0 seq $0,210448 ; Total number of different letters summed over all ternary words of length n. sub $1,$0 div $1,6 mov $0,$1
35.727273
159
0.75827
[ "Apache-2.0" ]
ckrause/cm
programs/oeis/056/A056473.asm
393
Assembly
; A325958: Sum of corners of a 2n+1 X 2n+1 square spiral. ; 24,76,160,276,424,604,816,1060,1336,1644,1984,2356,2760,3196,3664,4164,4696,5260,5856,6484,7144,7836,8560,9316,10104,10924,11776,12660,13576,14524,15504,16516,17560,18636,19744,20884,22056,23260,24496,25764,27064,28396,29760,31156,32584,34044,35536,37060,38616,40204,41824,43476,45160,46876,48624,50404,52216,54060,55936,57844,59784,61756,63760,65796,67864,69964,72096,74260,76456,78684,80944,83236,85560,87916,90304,92724,95176,97660,100176,102724,105304,107916,110560,113236,115944,118684,121456,124260,127096,129964,132864,135796,138760,141756,144784,147844,150936,154060,157216,160404 mul $0,4 add $0,5 bin $0,2 add $0,2 mul $0,2
77.222222
590
0.798561
[ "Apache-2.0" ]
ckrause/cm
programs/oeis/325/A325958.asm
695
Assembly
.global s_prepare_buffers s_prepare_buffers: ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r8 push %r9 push %rax push %rbx // Store lea addresses_RW+0x48cd, %rax nop nop cmp $56915, %r9 mov $0x5152535455565758, %r8 movq %r8, (%rax) nop xor %r12, %r12 // Faulty Load lea addresses_normal+0x112cd, %rax nop xor %rbx, %rbx mov (%rax), %r9d lea oracles, %r11 and $0xff, %r9 shlq $12, %r9 mov (%r11,%r9,1), %r9 pop %rbx pop %rax pop %r9 pop %r8 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 8, 'NT': True, 'type': 'addresses_normal'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_RW'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 4, 'NT': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
75.807692
2,999
0.661593
[ "MIT" ]
danielmgmi/medusa
Transynther/_processed/NONE/_xt_/i7-7700_9_0xca.log_21829_930.asm
3,942
Assembly
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) Geoworks 1994. All rights reserved. GEOWORKS CONFIDENTIAL PROJECT: Pasta MODULE: ZoomPrnt FILE: zoomprnt.asm AUTHOR: Don Reeves, Nov 30, 1992 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- Don 11/30/92 Initial revision DESCRIPTION: Implements the Zoomer Print Preferences module $Id: preffax.asm,v 1.1 97/04/05 01:38:40 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ;------------------------------------------------------------------------------ ; Common GEODE stuff ;------------------------------------------------------------------------------ include geos.def include heap.def include geode.def include resource.def include ec.def include library.def include object.def include graphics.def include gstring.def include win.def include char.def include initfile.def ;----------------------------------------------------------------------------- ; Libraries used ;----------------------------------------------------------------------------- UseLib ui.def UseLib config.def UseLib spool.def UseLib Internal/spoolInt.def UseLib Objects/vTextC.def ;----------------------------------------------------------------------------- ; Drivers used ;----------------------------------------------------------------------------- UseDriver Internal/serialDr.def UseDriver Internal/printDr.def ;----------------------------------------------------------------------------- ; DEF FILES ;----------------------------------------------------------------------------- include preffax.def include preffaxGlobal.def include preffax.rdef ;----------------------------------------------------------------------------- ; VARIABLES ;----------------------------------------------------------------------------- idata segment PrefFaxDialogClass PrefInteractionSpecialClass PrefItemGroupSpecialClass PreffaxOKTriggerClass idata ends if 0 udata segment serialDeviceMap SerialDeviceMap udata ends endif ;----------------------------------------------------------------------------- ; other code ;----------------------------------------------------------------------------- include preffaxInstallGroup3.asm PrefFaxCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefFaxGetPrefUITree %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Get the root of the preference UI tree CALLED BY: PrefMgr PASS: Nothing RETURN: DX:AX = OD of root of tree DESTROYED: Nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Don 11/30/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefFaxGetPrefUITree proc far mov dx, handle PrefFaxRoot mov ax, offset PrefFaxRoot ret PrefFaxGetPrefUITree endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefFaxGetModuleInfo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Returns PrefModuleInfo to determine visibility of module CALLED BY: PrefMgr PASS: DS:SI = PrefModuleInfo buffer RETURN: DS:SI = PrefModuleInfo filled DESTROYED: AX, BX PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Don 11/30/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefFaxGetModuleInfo proc far clr ax mov ds:[si].PMI_requiredFeatures, mask PMF_USER mov ds:[si].PMI_prohibitedFeatures, ax mov ds:[si].PMI_minLevel, ax mov ds:[si].PMI_maxLevel, UIInterfaceLevel-1 mov ds:[si].PMI_monikerList.handle, handle PrefFaxMonikerList mov ds:[si].PMI_monikerList.offset, offset PrefFaxMonikerList mov {word} ds:[si].PMI_monikerToken, 'Z' or ('M' shl 8) mov {word} ds:[si].PMI_monikerToken+2, 'P' or ('R' shl 8) mov {word} ds:[si].PMI_monikerToken+4, MANUFACTURER_ID_APP_LOCAL ret PrefFaxGetModuleInfo endp ;----------------------------------------------------------------------------- ; Methods for PrefFaxDialogClass ;----------------------------------------------------------------------------- COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefFaxDialogSaveOptions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Install the Group3 printer driver and save the options set by the user. CALLED BY: MSG_META_SAVE_OPTIONS PASS: *ds:si = PrefFaxDialogClass object ds:di = PrefFaxDialogClass instance data es = segment of PrefFaxDialogClass ax = message # RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: 1) Install the Group3 printer driver 2) Call super class to handle the rest REVISION HISTORY: Name Date Description ---- ---- ----------- CL 12/20/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefFaxDialogSaveOptions method dynamic PrefFaxDialogClass, MSG_META_SAVE_OPTIONS uses ax, cx, dx, bp, si, ds .enter ; ; Install the Group3 printer driver ; call PrefFaxInstallGroup3 ; ; Let the superclass handle the rest of it ; .leave ; restore registers mov di, offset PrefFaxDialogClass GOTO ObjCallSuperNoLock PrefFaxDialogSaveOptions endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefFaxDialogStartFaxSoftware %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Start the fax software. CALLED BY: MSG_PREF_FAX_DIALOG_START_FAX_SOFTWARE PASS: *ds:si = PrefFaxDialogClass object ds:di = PrefFaxDialogClass instance data es = segment of PrefFaxDialogClass RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: If a device is not selected { inform the user a device must be selected } else { close the dialog start the spooler inform success or failure send ourself apply msg close dialog } REVISION HISTORY: Name Date Description ---- ---- ----------- jwu 3/14/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefFaxDialogStartFaxSoftware method dynamic PrefFaxDialogClass, MSG_PREF_FAX_DIALOG_START_FAX_SOFTWARE uses ax, cx, dx, bp .enter ; ; Make sure a device has been selected. ; call PrefFaxCheckDeviceSelected jnc spooler ; ; Inform the user that a device must be selected. ; mov si, offset NoDriverString call DisplayError jmp exit spooler: ; ; Launch the fax spooler. ; mov si, offset FaxReadyString ; hope for the best... call PrefFaxLaunchSpooler jnc notifyUser mov si, offset CannotStartString ; but expect the worst :( notifyUser: call DisplayNotification ; ; Send ourself an apply message like a regular apply trigger would do. ; mov si, offset PrefFaxRoot mov ax, MSG_GEN_APPLY call ObjCallInstanceNoLock ; ; Bring down the dialog. ; mov ax, MSG_GEN_GUP_INTERACTION_COMMAND mov cx, IC_DISMISS call ObjCallInstanceNoLock exit: .leave ret PrefFaxDialogStartFaxSoftware endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefFaxDialogClose %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Make sure the user knows that the fax software may not be running before exiting. CALLED BY: MSG_PREF_FAX_DIALOG_CLOSE PASS: *ds:si = PrefFaxDialogClass object ds:di = PrefFaxDialogClass instance data es = segment of PrefFaxDialogClass RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: if a device is not selected { confirm close with user if yes close dialog else do nothing } else { if fax spooler is running close dialog else inform user system won't be ready close dialog } REVISION HISTORY: Name Date Description ---- ---- ----------- jwu 3/14/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefFaxDialogClose method dynamic PrefFaxDialogClass, MSG_PREF_FAX_DIALOG_CLOSE uses ax, cx, dx, bp .enter ; ; Mark ourselves as busy -- this could take a while. ; mov ax, MSG_GEN_APPLICATION_MARK_BUSY call GenCallApplication ; ; Check if a device is selected. ; call PrefFaxCheckDeviceSelected jc confirmClose ; ; Check if fax spooler is running. ; call PrefFaxCheckSpooler jnc closeDialog ; ; Inform user the system won't be fax ready. ; mov si, offset NotFaxReadyString call DisplayNotification jmp closeDialog confirmClose: ; ; Make sure the user really wants to exit without starting fax ; software. ; mov si, offset ExitNoStartString call DisplayQuestion cmp ax, IC_NO je exit closeDialog: ; ; Close the dialog. ; mov si, offset PrefFaxRoot mov ax, MSG_GEN_GUP_INTERACTION_COMMAND mov cx, IC_DISMISS call ObjCallInstanceNoLock exit: ; ; Mark not busy. ; mov ax, MSG_GEN_APPLICATION_MARK_NOT_BUSY call GenCallApplication .leave ret PrefFaxDialogClose endm ;----------------------------------------------------------------------------- ; Utilities for PrefFaxDialogClass ;----------------------------------------------------------------------------- com1Info PrinterPortInfo < mask PC_RS232C, PPT_SERIAL, mask SDM_COM1, SERIAL_COM1 > com2Info PrinterPortInfo < mask PC_RS232C, PPT_SERIAL, mask SDM_COM2, SERIAL_COM2 > com3Info PrinterPortInfo < mask PC_RS232C, PPT_SERIAL, mask SDM_COM3, SERIAL_COM3 > com4Info PrinterPortInfo < mask PC_RS232C, PPT_SERIAL, mask SDM_COM4, SERIAL_COM4 > COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefFaxCheckDeviceSelected %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Determine if there is a fax modem selected. CALLED BY: INTERNAL PASS: ds = object block segment RETURN: carry clear if there is a fax modem selected DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- jwu 3/14/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PrefFaxCheckDeviceSelected proc near uses ax, cx, dx, bp, si .enter ; ; See if anything is selected. ; mov si, offset PrefFaxDeviceList mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION call ObjCallInstanceNoLock jc exit ; ; Hack: due to a bug in PrefDynamicListClass, in which ; the GIGI_selection and GIGI_numSelections will be set ; incorrectly if there is nothing in the list, we can't ; trust the test we just did, so we do another: we check ; to see how many items are in the list. -- Steve Y. ; mov ax, MSG_GEN_DYNAMIC_LIST_GET_NUM_ITEMS call ObjCallInstanceNoLock stc ; assume no items jcxz exit ; ; At this point we know something is selected. ; clc exit: .leave ret PrefFaxCheckDeviceSelected endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefFaxCheckSpooler %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Check if the fax spooler is currently running. CALLED BY: INTERNAL PASS: ds = object block segment RETURN: carry clear if fax spooler is running DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- jwu 3/14/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ faxspoolAppName char 'faxspool', 0 PrefFaxCheckSpooler proc near uses ax, bx, cx, dx, di, es .enter ; ; Check to see if the fax spooler is running. ; segmov es, cs, ax mov di, offset faxspoolAppName mov ax, 8 ; match name clr cx, dx ; ignore attributes call GeodeFind ; carry set if found cmc .leave ret PrefFaxCheckSpooler endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PrefFaxLaunchSpooler %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Start the fax spooler. CALLED BY: INTERNAL PASS: nothing RETURN: carry set if fax spooler could not be launched DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- jwu 3/14/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ NEC< faxSpoolName char "Fax Spooler",0 > EC< faxSpoolName char "EC Fax Spooler",0 > PrefFaxLaunchSpooler proc near uses ax, bx, cx, dx, si, ds .enter segmov ds, cs, ax clr ax, cx, dx mov si, offset faxSpoolName mov bx, SP_SYS_APPLICATION call UserLoadApplication jnc exit cmp ax, GLE_NOT_MULTI_LAUNCHABLE ; already running? je exit stc exit: .leave ret PrefFaxLaunchSpooler endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DisplayError/Notification/Question %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Display a message in a UserStandardDialog CALLED BY: INTERNAL PASS: si - chunk handle of the error string to display RETURN: if DisplayQuestion, AX = response else nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- jwu 3/14/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DisplayError proc near uses ax .enter mov ax, CustomDialogBoxFlags \ <0, CDT_ERROR, GIT_NOTIFICATION,0> call DisplayDialog .leave ret DisplayError endp DisplayNotification proc near uses ax .enter mov ax, CustomDialogBoxFlags \ <0, CDT_NOTIFICATION, GIT_NOTIFICATION, 0> call DisplayDialog .leave ret DisplayNotification endp DisplayQuestion proc near mov ax, CustomDialogBoxFlags \ <0, CDT_QUESTION, GIT_AFFIRMATION, 0> call DisplayDialog ret DisplayQuestion endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DisplayDialog %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Put up a UserStandardDialog of the appropriate type. CALLED BY: INTERNAL PASS: si - chunk handle of string to display ax - CustomDialogBoxFlags RETURN: ax - may contain response or garbage depending on CustomDialogBoxFlags DESTROYED: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- jwu 3/14/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DisplayDialog proc near uses bx, si, bp, ds .enter sub sp, size StandardDialogParams mov bp, sp mov ss:[bp].SDP_customFlags, ax mov bx, handle Strings call MemLock mov ds, ax mov si, ds:[si] mov ss:[bp].SDOP_customString.segment, ds mov ss:[bp].SDOP_customString.offset, si clrdw ss:[bp].SDOP_stringArg1 clrdw ss:[bp].SDOP_stringArg2 clr ss:[bp].SDP_helpContext.segment call UserStandardDialog ; cleans up stack call MemUnlock .leave ret DisplayDialog endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PreffaxOKTriggerSetNotEnabled %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Don't let ourselves become disabled. CALLED BY: MSG_GEN_SET_NOT_ENABLED PASS: *ds:si = PreffaxOKTriggerClass object ds:di = PreffaxOKTriggerClass instance data RETURN: nothing DESTROYED: nothing SIDE EFFECTS: Does not call superclass. PSEUDO CODE/STRATEGY: Basically there's some bug in the Config stuff that causes an OK trigger in a multipleResponse dialog to become disabled when you use it (just like in a properties dialog), except that it never becomes re-enabled. I don't feel like tracking it, so I'm just stubbornly refusing to become disabled. REVISION HISTORY: Name Date Description ---- ---- ----------- stevey 2/24/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PreffaxOKTriggerSetNotEnabled method dynamic PreffaxOKTriggerClass, MSG_GEN_SET_NOT_ENABLED ret PreffaxOKTriggerSetNotEnabled endm PrefFaxCode ends
23.834025
80
0.536792
[ "Apache-2.0" ]
BOBBYWY/pcgeos
Library/Pref/Preffax/preffax.asm
17,232
Assembly
; A113301: Sum of odd-indexed terms of tribonacci numbers. ; 0,1,5,18,62,211,715,2420,8188,27701,93713,317030,1072506,3628263,12274327,41523752,140473848,475219625,1607656477,5438662906,18398864822,62242913851,210566269283,712340586524,2409830942708,8152399683933,27579370581033,93300342369742,315632797374194,1067778105073359,3612267454964015,12220213267339600,41340685362056176,139854536808472145,473124509054812213,1600568749334964962,5414685293868179246,18317749139994314915,61968501463186088955,209637938823420761028,709200067073442686956,2399206641506934910853,8116457930417668180545,27457780499833382139446,92889006071424749509738,314241256644525298849207,1063070556504834028196807,3596341932230452132949368,12166337609840715725894120,41158425318257433338828537,139237955496843467875329101,471038629418628552690709962,1593512269070986559286287526,5390813392128431698424901643,18236991074874910207251702419,61695298885824148879466296428,208713701124475788544075493348,706073393334126424718944478893,2388629180012679211580375226457,8080674634496639848004145651614,27336726476836725180311756660194,92479483245019494600519790858655,312855850846391848829875274887775,1058383762261031766270457372182176,3580486620874506642241767182292960,12112699475730943541825634193948833,40976968810328369033989127136321637,138624092527590557286034782785206706,468961945868830984433919109685890590 lpb $0 mov $2,$0 sub $0,1 seq $2,73717 ; a(n)=T(2n+1), where T(n) are the tribonacci numbers A000073. add $1,$2 lpe mov $0,$1
138.181818
1,325
0.907895
[ "Apache-2.0" ]
ckrause/cm
programs/oeis/113/A113301.asm
1,520
Assembly
; A106002: a(n)=1 if there is a number of the form 6k+3 such that prime(n) < 6k+3 < prime(n+1), otherwise 0. ; 0,0,0,1,0,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,1,1,1,1,1,0,1,0,1,1,1,1,0,1,0,1,1,1,1,1,0,1,0,1,0,1,1,1,0,1,1,0,1,1,1,1,0,1,1,0,1,1,1,0,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1 seq $0,175216 ; The first nonprimes after the primes. seq $0,80545 ; Characteristic function of {1} union {odd primes}: 1 if n is 1 or an odd prime, else 0. pow $1,$0 mov $0,$1
61.125
201
0.603272
[ "Apache-2.0" ]
ckrause/cm
programs/oeis/106/A106002.asm
489
Assembly
Include "p16F84A.inc" ; ---------------------------------------------------------- ; General Purpose RAM Assignments ; ---------------------------------------------------------- cblock 0x0C Endc ; ---------------------------------------------------------- ; Macro Definitions ; ---------------------------------------------------------- ;. ;. ;. ;. ; ---------------------------------------------------------- ; Vector definition ; ---------------------------------------------------------- org 0x000 nop goto Main INT_Routine org 0x004 goto INT_Routine ; ---------------------------------------------------------- ; The main Program ; ---------------------------------------------------------- Main Movlw 0x00 Movwf EEADR Movlw A'M' Bcf STATUS,RP0 Movwf EEDATA Incf EEADR,f Bsf STATUS, RP0 Bcf INTCON, GIE Bsf EECON1, WREN Movlw 0x55 Movwf EECON2 Movlw 0xAA Movwf EECON2 Bsf EECON1,WR Bsf INTCON, GIE Test Btfsc EECON1,WR Goto Test Movlw A'U' Bcf STATUS,RP0 Movwf EEDATA Incf EEADR,f Bsf STATUS, RP0 Bcf INTCON, GIE Bsf EECON1, WREN Movlw 0x55 Movwf EECON2 Movlw 0xAA Movwf EECON2 Bsf EECON1,WR Bsf INTCON, GIE Test3 Btfsc EECON1,WR Goto Test3 Movlw A'S' Bcf STATUS,RP0 Movwf EEDATA Incf EEADR,f Bsf STATUS, RP0 Bcf INTCON, GIE Bsf EECON1, WREN Movlw 0x55 Movwf EECON2 Movlw 0xAA Movwf EECON2 Bsf EECON1,WR Bsf INTCON, GIE Test1 Btfsc EECON1,WR Goto Test1 Movlw A'A' Bcf STATUS,RP0 Movwf EEDATA Incf EEADR,f Bsf STATUS, RP0 Bcf INTCON, GIE Bsf EECON1, WREN Movlw 0x55 Movwf EECON2 Movlw 0xAA Movwf EECON2 Bsf EECON1,WR Bsf INTCON, GIE Test4 Btfsc EECON1,WR Goto Test4 ; ---------------------------------------------------------- ; Sub Routine Definitions ; ---------------------------------------------------------- ;. ;. ;. nop end
18.442308
61
0.455683
[ "MIT" ]
MuhammadAlBarham/pic16f778_projects
Microcontroller_Lab/Lab_6/Write_code.asm
1,918
Assembly
; A263200: Number of perfect matchings on a Möbius strip of width 3 and length 2n. ; 28,104,388,1448,5404,20168,75268,280904,1048348,3912488,14601604,54493928,203374108,759002504,2832635908,10571541128,39453528604,147242573288,549516764548,2050824484904,7653781175068,28564300215368,106603419686404,397849378530248,1484794094434588,5541326999208104,20680513902397828,77180728610383208,288042400539135004,1074988873546156808,4011913093645492228,14972663501035812104,55878740910497756188,208542300140955212648,778290459653323094404,2904619538472337164968,10840187694236025565468 add $0,2 mov $1,4 lpb $0 sub $0,1 add $2,$1 add $1,$2 add $2,$1 lpe mov $0,$1
51.076923
493
0.84488
[ "Apache-2.0" ]
ckrause/loda-programs
oeis/263/A263200.asm
665
Assembly
lda #0 sec sbc {m1} sta {m1} lda #0 sbc {m1}+1 sta {m1}+1
7.25
10
0.568966
[ "MIT" ]
jbrandwood/kickc
src/main/fragment/mos6502-common/vwsm1=_neg_vwsm1.asm
58
Assembly
global loader_start section .text bits 32 %define MULTIBOOT_MAGIC 0x36d76289 ; grub entry point loader_start: mov esp, stack.top push eax ; eax should contain the multiboot magic call vga.clear call vga.print_crlf mov esi, string_title call vga.println mov esi, string_init call log.check call log.check_ok mov esi, string_multiboot ; multiboot check call log.check pop eax call multiboot.check call log.check_ok mov esi, string_cpuid ; cpuid check call log.check call cpuid.check call log.check_ok mov esi, string_long_mode ; long mode check call log.check call long_mode.check call log.check_ok call vga.print_crlf call memory.init mov esi, string_long_mode_jump call log.check jmp gdt.code:long_mode.enable error: mov edx, esi mov esi, error_string call vga.set_style_error call vga.print mov esi, edx call vga.println hlt multiboot: .check: cmp eax, MULTIBOOT_MAGIC jne multiboot.error ret .error: call log.check_error mov esi, error_string_multiboot jmp error %include "vga.asm" %include "cpuid.asm" %include "memory.asm" %include "long.asm" section .rodata error_string: db "An error occured, ",0 error_string_multiboot: db "could not validate the multiboot magic number",0 string_title: db " +------------------------+",10,13 db " | TetanOS Loader, v0.1 |",10,13 db " +------------------------+",10,13,0 string_init: db "vaccinating components",0 string_multiboot: db "checking multiboot magic",0
20.517647
80
0.616399
[ "MIT" ]
afrigon/TetanOS
src/bootloader/loader.asm
1,744
Assembly
.model flat @PushAllRegisters MACRO push eax push ebx push ecx push edx ENDM @PopAllRegisters MACRO pop edx pop ecx pop ebx pop eax ENDM @FunctionBody MACRO index _HookFunctionASM&index proc @PushAllRegisters call _NextEvent ;Check wheter profiler is active and create new EventData cmp eax, 0 ;Check for null je NotActiveProlog&index ;Jump if Profiler is not active push eax call _GetTime ;GetTime pop ebx ;Store EventData in ebx mov dword ptr[ebx], eax ;StartTime mov dword ptr[ebx + 4], edx ;StartTime mov eax, [_hookSlotData + index * HookDataSize + EventDescriptionAddress] ;Store description mov dword ptr[ebx + 16], eax ;EventDescription mov [_hookSlotData + index * HookDataSize + EventDataAddress], ebx ;StoreActive EventData NotActiveProlog&index: @PopAllRegisters pop [_hookSlotData + index * HookDataSize + ReturnAddress] ;Store return address call [_hookSlotData + index * HookDataSize + OriginalAddress] ;Call original function push [_hookSlotData + index * HookDataSize + ReturnAddress] ;Restore return address cmp [_hookSlotData + index * HookDataSize + EventDataAddress], 0 ;Check for active EventData je NotActiveEpilog&index ;If not active go to return @PushAllRegisters call _GetTime ;Get Finish Time mov ebx, [_hookSlotData + index * HookDataSize + EventDataAddress] ;Store EventData address mov [ebx + 8 ], eax ;Store FinishTime mov [ebx + 12], edx ;Store FinishTime @PopAllRegisters NotActiveEpilog&index: ret _HookFunctionASM&index endp ENDM .data extern _NextEvent : proc extern _GetTime : proc extern _hookSlotData : dword ReturnAddress = 0 ; [hookSlotData + 0 ] - Return Address OriginalAddress = 4 ; [hookSlotData + 4 ] - Original Function Address EventDataAddress = 8 ; [hookSlotData + 8 ] - EventData EventDescriptionAddress = 12 ; [hookSlotData + 12] - EventDescription HookDataSize = 16 ; Sizeof(HookData) .code @FunctionBody 0 @FunctionBody 1 @FunctionBody 2 @FunctionBody 3 @FunctionBody 4 @FunctionBody 5 @FunctionBody 6 @FunctionBody 7 @FunctionBody 8 @FunctionBody 9 @FunctionBody 10 @FunctionBody 11 @FunctionBody 12 @FunctionBody 13 @FunctionBody 14 @FunctionBody 15 @FunctionBody 16 @FunctionBody 17 @FunctionBody 18 @FunctionBody 19 @FunctionBody 20 @FunctionBody 21 @FunctionBody 22 @FunctionBody 23 @FunctionBody 24 @FunctionBody 25 @FunctionBody 26 @FunctionBody 27 @FunctionBody 28 @FunctionBody 29 @FunctionBody 30 @FunctionBody 31 @FunctionBody 32 @FunctionBody 33 @FunctionBody 34 @FunctionBody 35 @FunctionBody 36 @FunctionBody 37 @FunctionBody 38 @FunctionBody 39 @FunctionBody 40 @FunctionBody 41 @FunctionBody 42 @FunctionBody 43 @FunctionBody 44 @FunctionBody 45 @FunctionBody 46 @FunctionBody 47 @FunctionBody 48 @FunctionBody 49 @FunctionBody 50 @FunctionBody 51 @FunctionBody 52 @FunctionBody 53 @FunctionBody 54 @FunctionBody 55 @FunctionBody 56 @FunctionBody 57 @FunctionBody 58 @FunctionBody 59 @FunctionBody 60 @FunctionBody 61 @FunctionBody 62 @FunctionBody 63 @FunctionBody 64 @FunctionBody 65 @FunctionBody 66 @FunctionBody 67 @FunctionBody 68 @FunctionBody 69 @FunctionBody 70 @FunctionBody 71 @FunctionBody 72 @FunctionBody 73 @FunctionBody 74 @FunctionBody 75 @FunctionBody 76 @FunctionBody 77 @FunctionBody 78 @FunctionBody 79 @FunctionBody 80 @FunctionBody 81 @FunctionBody 82 @FunctionBody 83 @FunctionBody 84 @FunctionBody 85 @FunctionBody 86 @FunctionBody 87 @FunctionBody 88 @FunctionBody 89 @FunctionBody 90 @FunctionBody 91 @FunctionBody 92 @FunctionBody 93 @FunctionBody 94 @FunctionBody 95 @FunctionBody 96 @FunctionBody 97 @FunctionBody 98 @FunctionBody 99 @FunctionBody 100 @FunctionBody 101 @FunctionBody 102 @FunctionBody 103 @FunctionBody 104 @FunctionBody 105 @FunctionBody 106 @FunctionBody 107 @FunctionBody 108 @FunctionBody 109 @FunctionBody 110 @FunctionBody 111 @FunctionBody 112 @FunctionBody 113 @FunctionBody 114 @FunctionBody 115 @FunctionBody 116 @FunctionBody 117 @FunctionBody 118 @FunctionBody 119 @FunctionBody 120 @FunctionBody 121 @FunctionBody 122 @FunctionBody 123 @FunctionBody 124 @FunctionBody 125 @FunctionBody 126 @FunctionBody 127 end
25.218274
111
0.657609
[ "MIT" ]
corefan/brofiler
ProfilerCore/HookFunction32.asm
4,968
Assembly
; A302393: Number of even parts in the partitions of 3n into 3 parts. ; 0,5,8,18,24,41,50,72,84,113,128,162,180,221,242,288,312,365,392,450,480,545,578,648,684,761,800,882,924,1013,1058,1152,1200,1301,1352,1458,1512,1625,1682,1800,1860,1985,2048,2178,2244,2381,2450,2592,2664,2813 mov $4,$0 mov $5,$0 lpb $4 mov $0,$5 sub $4,1 sub $0,$4 mul $0,3 add $0,1 mov $2,0 lpb $0 mul $2,2 add $2,$0 gcd $0,4 sub $0,1 lpe mov $3,$2 div $3,2 add $1,$3 lpe
21.043478
210
0.621901
[ "Apache-2.0" ]
jmorken/loda
programs/oeis/302/A302393.asm
484
Assembly
device zxspectrum48 org $7D00 CustomFont: db $00, $00, $00, $00, $00, $00, $00, $00 ; ' ' = empty/space db $01, $01, $01, $01, $01, $01, $01, $01 ; '!' = right solid db $01, $01, $01, $01, $01, $01, $01, $FF ; '"' = right bottom solid db $00, $00, $00, $00, $00, $00, $00, $FF ; '#' = bottom solid db $00, $01, $00, $01, $00, $01, $00, $01 ; '$' = right dotted db $00, $01, $00, $01, $00, $01, $00, $55 ; '%' = right bottom dotted db $00, $00, $00, $00, $00, $00, $00, $55 ; '&' = bottom dotted db $00, $70, $60, $50, $08, $04, $02, $00 ; ''' = arrow top-left db $00, $40, $20, $10, $0A, $06, $0E, $00 ; '(' = arrow bottom-right db $01, $01, $01, $01, $01, $01, $01, $55 ; ')' = right solid, bottom dotted db $00, $01, $00, $01, $00, $01, $00, $FF ; '*' = right dotted, bottom solid db $00, $11, $28, $11, $54, $39, $00, $FF ; '+' = anchor + solid bottom + dotted right db $00, $00, $20, $50, $20, $A8, $70, $00 ; ',' = anchor db $00, $11, $28, $11, $54, $39, $00, $55 ; '-' = anchor + dotted bottom + right ; './0123' org $8000 INCLUDE "../../Constants.asm" INCLUDE "../../Macros.asm" INCLUDE "../../TestFunctions.asm" INCLUDE "../../OutputFunctions.asm" INCLUDE "../../controls.i.asm" SPRITE_WRONG_PIX_COLOUR equ $A2 OPT_BIT_MARK equ 0 OPT_BIT_ROT equ 1 OPT_BIT_MIRY equ 2 OPT_BIT_MIRX equ 3 OPT_BIT_SHOW equ 4 OPT_BIT_CLIP equ 5 OPTIONS_COUNT equ 6 Options: db 0 ; (1<<OPT_BIT_MARK)|(1<<OPT_BIT_SHOW) db OPTIONS_COUNT ; must follow in memory right after options byte OptionsAttrOfs: ; mark, rot, mirY, mirX, show, clip db 4*32+0, 5*32+20, 5*32+10, 5*32+0, 4*32+8, 4*32+18 ; into last third of attribs Start: call StartTest ; register control keys REGISTER_KEY KEY_Q, KeyHandlerMarks REGISTER_KEY KEY_W, KeyHandlerShowAll REGISTER_KEY KEY_E, KeyHandlerClipWindow REGISTER_KEY KEY_A, KeyHandlerMirrorX REGISTER_KEY KEY_S, KeyHandlerMirrorY REGISTER_KEY KEY_D, KeyHandlerRotate ; draw ULA part of screen call DrawUlaPart call SetSpritePalette RefreshSpritesAndLoop: call SetClipWindowAndNR15 call LoadPatterns call ShowSprites .MainLoop: call RefreshKeyboardState jr .MainLoop ;call EndTest KeyHandlerMarks: ld a,1<<OPT_BIT_MARK jr FlipOptionAndRefreshSprites KeyHandlerShowAll: ld a,1<<OPT_BIT_SHOW jr FlipOptionAndRefreshSprites KeyHandlerClipWindow: ld a,1<<OPT_BIT_CLIP jr FlipOptionAndRefreshSprites KeyHandlerMirrorX: ld a,1<<OPT_BIT_MIRX jr FlipOptionAndRefreshSprites KeyHandlerMirrorY: ld a,1<<OPT_BIT_MIRY jr FlipOptionAndRefreshSprites KeyHandlerRotate: ld a,1<<OPT_BIT_ROT ; continue with FlipOptionAndRefreshSprites FlipOptionAndRefreshSprites: ; flip the option ld hl,Options xor (hl) ld (hl),a ; update the UI state call UpdateKeysStatus ; Reload patterns and sprite attributes jr RefreshSpritesAndLoop ShowSprites: ; Select pattern and sprite slot 0 ld bc, SPRITE_STATUS_SLOT_SELECT_P_303B xor a out (c),a ; prepare modifier bytes into D (Byte3) and E (Byte4) ld e,a ; E = 0 by default (no change to B4) ld a,(Options) bit OPT_BIT_SHOW,a jr z,.NoShowAll ld e,B4_VIS ; E = enforce visible .NoShowAll: ; OPT bits for rot/mir are identical to actual functional bits, so just AND them and B3_ROTATE|B3_MIRRORX|B3_MIRRORY ld d,a ; D = enforce extra bits in B3 ; upload all sprite attributes ld hl, SpritesDefs ld c, SPRITE_ATTRIBUTE_P_57 .UploadSingleSprite: outi ; byte 1 X outi ; byte 2 Y ; byte 3 ld a, (hl) inc hl or d out (c),a ; byte 4 ld a, (hl) inc hl or e out (c),a ; optional byte 5 and B4_5BEXT jr z,.Only4ByteDef ; byte 5 outi .Only4ByteDef: ; loop until end address of data is reached ld a,SpritesDefsEnd&$FF cp l jr nz,.UploadSingleSprite ret ; sprite helper defs ; B1 = X LSB ; B2 = Y LSB B3_PAL_MSK equ $F0 B3_MIRRORX equ $08 B3_MIRRORY equ $04 B3_ROTATE equ $02 B3_MSBX equ $01 B3_REL_PAL equ $01 B4_VIS equ $80 B4_INVIS equ $00 B4_5BEXT equ $40 B4_NAME_MSK equ $3F B5_4BIT_LO equ $80 B5_4BIT_HI equ $C0 B5_RELT_BIG equ $20 ; "big-sprite" type of relatives (not used in this test) B5_REL equ $40 B5_REL_4BHI equ $60 B5_X_2X equ $08 B5_X_4X equ $10 B5_X_8X equ $18 B5_Y_2X equ $02 B5_Y_4X equ $04 B5_Y_8X equ $06 B5_MSBY equ $01 B5_REL_NAME equ $01 SpritesDefs: ; 0 : relati, visib, [ 32, 32], 8R (should be hidden because it has no anchor) db 32, 32, 0, B4_VIS|B4_5BEXT|NAME_8R, B5_REL ;; 8 bit graphics, scale 1x, mostly simple positive coordinates (simple case) ; 1 : anchor, visib, [ 80, 48], 8G (4 byte attributes) db 80, 48, 0, B4_VIS|NAME_8G ; 2 : relati, visib, [ 0, 16], 8G =[80,64] db 0, 16, 0, B4_VIS|B4_5BEXT|NAME_8G, B5_REL ; 3 : relati, invis, [ -48, 32], 8R =[32,80] db -48, 32, 0, B4_INVIS|B4_5BEXT|NAME_8R, B5_REL ; 4 : relati, visib, [ 16, 16], 8G =[96,64] ; visible after invisible in cluster db 16, 16, 0, B4_VIS|B4_5BEXT|NAME_8G, B5_REL ;; 8 bit graphics, scales, negative coordinates for relatives, relative "name" ; 5 : anchor, visib, [ 144, 64], 8G, scale 2x4 db 144, 64, 0, B4_VIS|B4_5BEXT|NAME_8G, B5_X_2X|B5_Y_4X ; 6 : relati, invis, [-112, -16], 8R, scale 1x1 = [32,48] db -112, -16, 0, B4_INVIS|B4_5BEXT|NAME_8R, B5_REL ; 7 : relati, visib, [ -48, -16], 8G, scale 8x1 = [96,48] db -48, -16, 0, B4_VIS|B4_5BEXT|NAME_8G, B5_REL|B5_X_8X ; 8 : relati, visib, [ -64, 32], 8G, scale 4x2 = [80,96] db -64, 32, 0, B4_VIS|B4_5BEXT|NAME_8G, B5_REL|B5_X_4X|B5_Y_2X ; 9 : relati, visib, [ -64, 16], 0+anchor.N = 8G, scale 4x1 = [80,80] db -64, 16, 0, B4_VIS|B4_5BEXT|0, B5_REL|B5_X_4X|B5_REL_NAME ;; 4 bit graphics, scales, positive/negative, palette offset ; A : anchor, visib, [ 176, 112], 4G1.LO (+16), scale 1x1 db 176, 112, $10, B4_VIS|B4_5BEXT|NAME_4G1, B5_4BIT_LO ; B : relati, visib, [ 0, -32], 4G0.LO, scale 2x2 = [176,80] db 0, -32, 0, B4_VIS|B4_5BEXT|NAME_4G0, B5_REL|B5_X_2X|B5_Y_2X ; C : relati, visib, [ 32, -48], 4G0.HI, scale 1x4 = [208,64] db 32, -48, 0, B4_VIS|B4_5BEXT|NAME_4G0, B5_REL|B5_REL_4BHI|B5_Y_4X ; D : relati, invis, [ 80, -16], 4R0.LO, scale 1x1 = [256,96] db 80, -16, 0, B4_INVIS|B4_5BEXT|NAME_4R0, B5_REL ;; 4 bit graphics, invisible anchor ; E : anchor, invis, [ 32, 96], 4R0.HI, scale 1x1 db 32, 96, 0, B4_INVIS|B4_5BEXT|NAME_4R0, B5_4BIT_HI ; F : relati, visib, [ 0, 16], 4R1.LO (+16), scale 1x1 = [32,112] db 0, 16, $10, B4_VIS|B4_5BEXT|NAME_4R1, B5_REL ;; 4 bit graphics, red anchor beyond screen (top left), relative palette offset/name ; G : anchor, visib, [ 64, -63], 4R1.HI (+16), scale 1x1 db 64, -63, $10, B4_VIS|B4_5BEXT|NAME_4R1, B5_4BIT_HI|B5_MSBY ; H : relati, visib, [ 48, 127], "-1" +anchor.N +anchor.pal_ofs = 4G1.LO, scale 1x1 =[112,64] db 48, 127, B3_REL_PAL, B4_VIS|B4_5BEXT|(-1&B4_NAME_MSK), B5_REL|B5_REL_NAME ; I : relati, invis, [ -32, 127], 4RG0.HI +anchor.pal_ofs = 4GR1.HI, scale 1x1 =[32,64] db -32, 127, B3_REL_PAL, B4_INVIS|B4_5BEXT|NAME_4RG0, B5_REL_4BHI ; J : relati, visib, [ 64, 127], 4RG0.HI, scale 1x1 =[128,64] db 64, 127, 0, B4_VIS|B4_5BEXT|NAME_4RG0, B5_REL_4BHI ; K : relati, visib, [ 112, 127], 4RG0.LO +anchor.pal_ofs = 4GR1.LO, scale 2x1 =[176,64] db 112, 127, B3_REL_PAL, B4_VIS|B4_5BEXT|NAME_4RG0, B5_REL|B5_X_2X ;; 4 bit graphics, red anchor beyond screen (bottom right), relative pal ofs wraps! ; L : anchor, visib, [ 320, 240], 4GR1.HI (+16), scale 1x1 db 320&$FF, 240, $10+B3_MSBX, B4_VIS|B4_5BEXT|NAME_4GR1, B5_4BIT_HI ; M : relati, invis, [ -64,-128], 4RG0.LO (+240) +anchor.pal_ofs = 4RG0.LO, scale 1x1 =[256,112] db -64, -128, $F0|B3_REL_PAL, B4_INVIS|B4_5BEXT|NAME_4RG0, B5_REL ; N : relati, visib, [-128,-128], 4RG0.HI (+240) +anchor.pal_ofs = 4RG0.HI, scale 1x1 =[192,112] db -128, -128, $F0|B3_REL_PAL, B4_VIS|B4_5BEXT|NAME_4RG0, B5_REL_4BHI ;; 8 bit graphics, just final dot after everything, sporting over-border feature ; X : anchor, visib, [ 286, 222], 8b dot, scale 1x1 db 286&$FF, 222, B3_MSBX, B4_VIS|NAME_8DOT SpritesDefsEnd equ $ NAME_8DOT equ 0 NAME_8G equ 1 NAME_8R equ 2 NAME_4R0 equ 1 NAME_4G0 equ 2 NAME_4RG0 equ 3 NAME_4G1 equ 1 NAME_4R1 equ 2 NAME_4GR1 equ 3 LoadPatterns: ; Select pattern and sprite slot 0 ld bc, SPRITE_STATUS_SLOT_SELECT_P_303B xor a out (c),a ; Upload dot sprite pattern data (8 bit, created by bitmask provided) ; 0 8b 4x4 "dot" with transparent area around using $55 colour for dot pixels ld c, SPRITE_PATTERN_P_5B call OutputDotPattern ; Upload the remaining patterns for tests (green/red 8/4 bit variants, shared gfx) ; 1 256x $22: 8b G, 4b +0 R0, 4b +16 G1 ; 2 256x $44: 8b R, 4b +0 G0, 4b +16 R1 ; 3 128x $22, 128x $44: 4b +0 RG0, 4b +16 GR1 ; - Can be patched to add orientation "marks" of light blue colour: ; 8b patterns: left-top light blue 1/8 width "mark" and left-middle 1/4 width "mark" ; 4b patterns left-top only: 1/4 width mark = LO pattern, 1/2 width mark = HI pattern ld hl, OtherPatternsDef ld a, (Options) bit OPT_BIT_MARK,a jr z, .OutPatternDataNextBatch ; no marking ld hl, OtherPatternsDefWithMark .OutPatternDataNextBatch: ld b,(hl) inc hl ld a,(hl) inc hl or a ret z .OutPatternData: out (c),a djnz .OutPatternData jr .OutPatternDataNextBatch OtherPatternsDef: db 0, $22, 0, $44, 128, $22, 128, $44, 0, 0 OtherPatternsDefWithMark: db 2, $11, 14+7*16, $22, 4, $11, 12+7*16, $22 db 2, $11, 14+7*16, $44, 4, $11, 12+7*16, $44 db 2, $11, 128-2, $22, 4, $11, 128-4, $44 db 0, 0 OutputDotPattern: ld hl, DotPatternDef ld d,16 .OutputDotPatternLine: ld a,(hl) inc hl ld b,16 .OutputDotPatternPixels: ld e,$FF ; transparent colour srl a jr nc,.TransparentDotPixel ld e,$55 ; pixel colour .TransparentDotPixel: out (c),e djnz .OutputDotPatternPixels dec d jr nz,.OutputDotPatternLine ret DotPatternDef: db %0110 db %1111 db %1111 db %0110 db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 SetSpritePalette: ; Set sprite transparent-index to $FF NEXTREG_nn SPRITE_TRANSPARENCY_I_NR_4B, $FF ; select sprite palette 0, ULANext ON NEXTREG_nn PALETTE_CONTROL_NR_43, $21 ; set whole sprite palette to $A2 violet (to signal some unexpected pixels if it shows) NEXTREG_nn PALETTE_INDEX_NR_40, 0 ld a,SPRITE_WRONG_PIX_COLOUR ld b,0 .setWholeSpritePalLoop: NEXTREG_A PALETTE_VALUE_NR_41 djnz .setWholeSpritePalLoop ; set the few colours which are actually used for sprite patterns ld hl,.SpritePalDef .setSpritePalLoop: ld a,(hl) or a ret z NEXTREG_A PALETTE_INDEX_NR_40 inc hl ld a,(hl) NEXTREG_A PALETTE_VALUE_NR_41 inc hl jr .setSpritePalLoop .SpritePalDef: db $02, %11100000, $04, %00011100, $01, %01001111 ; 4 bit colours pal.ofs=0 db $14, %11100000, $12, %00011100, $11, %01001111 ; 4 bit colours pal.ofs=16 db $44, %11101001, $22, %01011101, $55, %00000010 ; 8 bit colours (lighter than 4b) db 0 SetClipWindowAndNR15: ld a,(Options) bit OPT_BIT_CLIP,a ld a,%00010011 ; Layers: USL, over border ON, sprites ON jr z,.NoClip or %00100000 ; enable clipping in over-border mode push af ; set clip window coordinates to: [136,72] -> [287, 223] NEXTREG_nn CLIP_WINDOW_CONTROL_NR_1C, 2 ; reset sprite clip window index NEXTREG_nn CLIP_SPRITE_NR_19, 68 ; X1 (*2 in "over border" mode) NEXTREG_nn CLIP_SPRITE_NR_19, 143 ; X2 (*2 in "over border" mode) NEXTREG_nn CLIP_SPRITE_NR_19, 72 ; Y1 NEXTREG_nn CLIP_SPRITE_NR_19, 223 ; Y2 pop af .NoClip: ; set the NR15 to final value NEXTREG_A SPRITE_CONTROL_NR_15 ret UpdateKeysStatus: ld bc,(Options) ; C = options, B = number of options ld hl,OptionsAttrOfs ld de,MEM_ZX_ATTRIB_5800 + 16*32 ; target last third of attributes .UpdateKeyLoop: ld a,4+8*4 ; OFF colour rr c jr nc,.OptionIsOff ld a,5+8*5 ; ON colour .OptionIsOff: ld e,(hl) ; fetch target attribute address inc hl ld (de),a ; update attribute with selected colour djnz .UpdateKeyLoop ret DrawUlaPart: ; yellow border (will be reconfigured in palette to grey) ld a,YELLOW out (ULA_P_FE),a ; show MachineID and core version ld de,MEM_ZX_SCREEN_4000+16*256+6*32 ld bc,MEM_ZX_SCREEN_4000+16*256+7*32 ld ix,$ED01 ; display also extended info after MachineId call OutMachineIdAndCore_defLabels ; setup ULANext + palette for ULA info graphics NEXTREG_nn PALETTE_CONTROL_NR_43, $01 ; select ULA palette 0, ULANext ON NEXTREG_nn PALETTE_FORMAT_NR_42, $07 ; ULANext ink format 7 NEXTREG_nn PALETTE_INDEX_NR_40, 0 ; INK 0 = black NEXTREG_nn PALETTE_VALUE_NR_41, 0 NEXTREG_nn PALETTE_INDEX_NR_40, 128+7 ; PAPER 7 = transparent E3 NEXTREG_nn PALETTE_VALUE_NR_41, $E3 NEXTREG_nn PALETTE_INDEX_NR_40, 128+6 ; BORDER 6 = grey NEXTREG_nn PALETTE_VALUE_NR_41, %01101101 ; interactive key colours NEXTREG_nn PALETTE_INDEX_NR_40, 4 ; INK 4 = black NEXTREG_nn PALETTE_VALUE_NR_41, 0 NEXTREG_nn PALETTE_INDEX_NR_40, 128+4 ; PAPER 4 = bright pink NEXTREG_nn PALETTE_VALUE_NR_41, %11110110 NEXTREG_nn PALETTE_INDEX_NR_40, 5 ; INK 5 = bright pink NEXTREG_nn PALETTE_VALUE_NR_41, %11110110 NEXTREG_nn PALETTE_INDEX_NR_40, 128+5 ; PAPER 5 = black NEXTREG_nn PALETTE_VALUE_NR_41, 0 ; global transparency setup ($E3 -> ULA.white) NEXTREG_nn GLOBAL_TRANSPARENCY_NR_14,$E3 ; $E3 is transparent colour for ULA NEXTREG_nn TRANSPARENCY_FALLBACK_COL_NR_4A,%10110110 ; transparency fallback = ULA white ; draw texts and target sprite area - sprite IDs (0..9,A..X), as defined in ReadMe.txt ld hl,SpriteLabels ld de,MEM_ZX_SCREEN_4000 call OutStringAtDe ; highlight interactive control keys call UpdateKeysStatus ; draw target sprite area - rectangles around expected sprites (using custom font) NEXTREG_nn MMU1_2000_NR_51, 11 ; the font at $7D00 to $3D00 ld hl,SpriteLines ld de,MEM_ZX_SCREEN_4000 call OutStringAtDe NEXTREG_nn MMU1_2000_NR_51, $FF ; restore ROM in MMU1 ret SpriteLabels: ; 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 ; 01234567890123456789012345678901 db '0 G ' ; 0 2 db ' - ' ; 1 db '6 1 7 ' ; 2 3 db ' 5 5 ' ; 3 db 'I 2 4 H J 5 K C ' ; 4 4 db ' G 1 1 G G G ' ; 5 db '3 9 B ' ; 6 5 db ' 1 5 ' ; 7 db 'E 8 D ' ; 8 6 db ' A A ' ; 9 db 'F A N M ' ; 0 7 db ' E 5 L A L ' ; 1 db ' ' ; 2 8 db ' ' ; 3 db ' ' ; 4 9 db ' ' ; 5 db ' ' ; 6 0 db ' ' ; 7 db ' ' ; 8 1 db ' ' ; 9 db 'Qmarks WshowAll Eclip L ' ; 0 2 db 'AmirrorX SmirrorY Drotate ' ; 1 db 0 SpriteLines: ; 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 ; 01234567890123456789012345678901 db " $ ' , " ; 0 2 db '&% ################## ' ; 1 db ' $ ! $ ! ' ; 2 3 db '&% !&-&&&&&&&&&&&&&&&) ' ; 3 db ' $ ! $ $ $ $ $ $ ! ' ; 4 4 db '&% !&%&%&%&% $&&&% ! ' ; 5 db ' $ ! $ $ $ ! ' ; 6 5 db '&% !&&&&&&&% $ $ ! && ' ; 7 db ' $ ! $ $ $ ! $ $ ' ; 8 6 db '&- ! $ $&&&% ! $&% ' ; 9 db ' $ ! $ $ $ $ ! $ $ ' ; 0 7 db '&% !#######*###+#+#*#" $&% ' ; 1 db ' ' ; 2 8 db ' ' ; 3 db ' ' ; 4 9 db ' ' ; 5 db ' ' ; 6 0 db ' ' ; 7 db ' ' ; 8 1 db ' ' ; 9 db ' ,' ; 0 2 db ' (' ; 1 db 0 savesna "SpritRel.sna", Start
38.267932
100
0.550306
[ "MIT" ]
MrKWatkins/ZXSpectrumNextTests
Tests/Sprites/Relative/Main.asm
18,139
Assembly
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r14 push %r9 push %rax push %rcx push %rdi push %rsi lea addresses_UC_ht+0xaf87, %r11 nop nop nop nop nop inc %r14 mov $0x6162636465666768, %rsi movq %rsi, %xmm5 movups %xmm5, (%r11) nop nop nop nop add %r13, %r13 lea addresses_WT_ht+0x1afc1, %rsi lea addresses_D_ht+0x1cc07, %rdi nop nop nop nop add %r11, %r11 mov $104, %rcx rep movsl nop nop nop nop cmp $59176, %rdi lea addresses_A_ht+0x42e9, %rdi nop nop nop cmp $49406, %rax mov $0x6162636465666768, %r11 movq %r11, %xmm6 movups %xmm6, (%rdi) nop nop nop cmp $28282, %rax lea addresses_WC_ht+0x387, %rsi lea addresses_WC_ht+0x12d07, %rdi nop nop nop add %r11, %r11 mov $101, %rcx rep movsq nop add %r14, %r14 lea addresses_WC_ht+0x6507, %rdi nop sub $65328, %r14 vmovups (%rdi), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $0, %xmm0, %rax cmp $44462, %rsi lea addresses_normal_ht+0x4d07, %rsi lea addresses_D_ht+0x34f, %rdi nop nop nop nop xor %r9, %r9 mov $126, %rcx rep movsq nop nop nop dec %rcx lea addresses_WT_ht+0x10f91, %rsi lea addresses_WC_ht+0x1c91d, %rdi nop nop inc %r14 mov $77, %rcx rep movsq nop cmp $64229, %rdi lea addresses_WT_ht+0xcec4, %r13 clflush (%r13) nop nop nop nop sub %rax, %rax vmovups (%r13), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $1, %xmm4, %rsi and $39597, %rax lea addresses_WC_ht+0xa587, %rsi lea addresses_UC_ht+0x675c, %rdi sub %r14, %r14 mov $7, %rcx rep movsw add $14372, %r9 lea addresses_WT_ht+0x11947, %rsi lea addresses_A_ht+0x1ab07, %rdi clflush (%rdi) nop nop sub $23166, %r13 mov $82, %rcx rep movsb nop nop nop add %r11, %r11 lea addresses_A_ht+0xdea7, %rsi lea addresses_WC_ht+0x272b, %rdi clflush (%rsi) nop sub %rax, %rax mov $27, %rcx rep movsq nop nop nop nop dec %rsi pop %rsi pop %rdi pop %rcx pop %rax pop %r9 pop %r14 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r8 push %rax push %rbp push %rcx // Faulty Load lea addresses_PSE+0xb507, %r8 nop nop nop cmp $23214, %rax mov (%r8), %r10 lea oracles, %r8 and $0xff, %r10 shlq $12, %r10 mov (%r8,%r10,1), %r10 pop %rcx pop %rbp pop %rax pop %r8 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_PSE', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 7}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 1}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 7}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 6}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 11}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 10}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 8}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 1}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 1}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 4}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 0}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 6}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 9}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 2}} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
36.769634
2,999
0.66211
[ "MIT" ]
danielmgmi/medusa
Transynther/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_1467.asm
7,023
Assembly
#note: r40 (the exception handler) and r46 (the start of usermode code) must #be specified in hex (0xwhatever) #I just don't see any reason not to, and it makes programming the script #much nicer to deal with... #load exception handler lc r40, 0x80000050 leh r40 #enable exceptions cle #load TLB entries #virtual page 0 is for instructions #virtual page 1 is for data lc r46, 0x0000005c #usermode start address lc r47, 1 #interrupts off lc r48, 1 #in user mode lc r42, 0x00000000 #denotes VPN 0 lc r43, 0x0000000d #denotes VPN 0 maps to physical page 0 #and is fetchable, readable, and valid tlbse r0, r42 #load into entry 0 lc r42, 0x00001000 #denotes VPN 1 lc r43, 0x0000101e #denotes VPN 1 maps to physical page 1 #and is readable, writable, valid, and dirty #(dirty to prevent taking a #read-only exception) tlbse r48, r42 #load into entry 1 #this last tlb entry is designed to produce a bus error lc r44, 2 #load into TLB entry 2 lc r42, 0x3fffe000 #denotes VPN 0x3fffe lc r43, 0x3fffe01f #map VPN 0x3fffe to page 0x3fffe #and is readable, writable, valid, and dirty #(dirty to prevent taking a #read-only exception) tlbse r44, r42 #warp to user mode rfe r46, r47, r48 #handle exceptions lc r49, 0xdeadbeef halt #or rather don't =) lc r30, 1 ex4 r30, k2, 1 trap #@expected values #e3 = 0x000000a0 #mode = S #interrupts = off #exceptions = off #r40 = 0x80000050 #r46 = 0x0000005c #r47 = 1 #r48 = 1 #r42 = 0x3fffe000 #r43 = 0x3fffe01f #r44 = 2 #r49 = 0xdeadbeef #pc = 0x8000005c #e0 = 0x00000060 #e2 = 0x00000060 #e1 = 0x00000001 #tlb 0: # vpn = 0x00000 # os = 0x000 # ppn = 0x00000 # at = 0x00d #tlb 1: # vpn = 0x00001 # os = 0x000 # ppn = 0x00001 # at = 0x01e #tlb 2: # vpn = 0x3fffe # os = 0x000 # ppn = 0x3fffe # at = 0x01f
24.694118
76
0.598857
[ "BSD-3-Clause" ]
dellard/ant-architecture
Src/Ant32/Tests/ant32/mem/ex4-src1-user-kreg-1.autotest.asm
2,099
Assembly
SECTION code_fp_mbf64 PUBLIC l_f64_ne EXTERN l_f64_yes EXTERN l_f64_no EXTERN ___mbf64_setup_comparison INCLUDE "mbf64.def" ; Stack == registers l_f64_ne: call ___mbf64_setup_comparison ; 0b00000000 = stack == register ; 0b00000001 = stack > register ; 0b11111111 = stack < register and a jp nz,l_f64_yes jp l_f64_no
16.7
33
0.766467
[ "BSD-2-Clause" ]
ByteProject/Puddle-BuildTools
FictionTools/z88dk/libsrc/math/mbf64/c/sccz80/l_f64_ne.asm
334
Assembly
; A300613: Number of partitions of the n-dimensional hypercube resulting from a sequence of n n-sections, each of which divides any part perpendicular to any of the axes. ; 1,1,8,324,35840,7906250,2931489792,1645181968584,1302784779485184,1384565648740109550,1902231808400000000000,3281726715984295577534536,6946466406905591840863420416,17702487251379919853870809258728,53467000591059566447137539120168960,188866266043391540481929787597656250000,771452910311185758369764186003439039283200,3608158530702648867193781088355832174711533590,19158303399002050302025852486792708292669343793152,114614909486133842053155630908523726042600550165096200 mov $1,$0 mul $1,$0 mov $2,$0 trn $0,1 bin $1,$0 pow $2,$0 mul $1,$2 mov $0,$1
60.166667
470
0.867036
[ "Apache-2.0" ]
ckrause/loda-programs
oeis/300/A300613.asm
722
Assembly
; A206373: (14*4^n + 1)/3. ; 5,19,75,299,1195,4779,19115,76459,305835,1223339,4893355,19573419,78293675,313174699,1252698795,5010795179,20043180715,80172722859,320690891435,1282763565739,5131054262955,20524217051819,82096868207275,328387472829099,1313549891316395 mov $1,4 pow $1,$0 div $1,3 mul $1,14 add $1,5 mov $0,$1
32.2
236
0.78882
[ "Apache-2.0" ]
ckrause/cm
programs/oeis/206/A206373.asm
322
Assembly
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r8 push %r9 push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x3e77, %rsi lea addresses_A_ht+0x428d, %rdi nop nop nop nop xor %r10, %r10 mov $14, %rcx rep movsl nop nop and %r9, %r9 lea addresses_WT_ht+0xc07, %r12 nop nop nop nop sub %r8, %r8 movw $0x6162, (%r12) add $46073, %r8 lea addresses_A_ht+0x19147, %rsi lea addresses_normal_ht+0x19b8b, %rdi cmp %r12, %r12 mov $50, %rcx rep movsw nop nop nop xor %rsi, %rsi lea addresses_WC_ht+0x1147, %rsi lea addresses_normal_ht+0x11dd7, %rdi nop nop nop sub $35029, %r9 mov $127, %rcx rep movsw nop nop nop nop nop cmp $44565, %r10 lea addresses_normal_ht+0x1e547, %rsi lea addresses_WC_ht+0x11147, %rdi inc %rdx mov $99, %rcx rep movsw nop nop nop add %r10, %r10 lea addresses_D_ht+0x7147, %rsi lea addresses_D_ht+0x18ce7, %rdi nop nop nop nop xor $19317, %r12 mov $85, %rcx rep movsq nop nop dec %r9 lea addresses_UC_ht+0xf147, %r10 nop nop xor $21873, %rsi movups (%r10), %xmm0 vpextrq $1, %xmm0, %r9 nop and %rdx, %rdx lea addresses_normal_ht+0x1d947, %r12 nop nop nop and $2568, %r9 mov (%r12), %rcx nop nop nop dec %r12 lea addresses_A_ht+0xa547, %rsi sub %rdx, %rdx mov $0x6162636465666768, %r8 movq %r8, %xmm5 vmovups %ymm5, (%rsi) nop add $57934, %r9 lea addresses_UC_ht+0x1a847, %rcx clflush (%rcx) nop nop nop nop nop sub $43300, %r10 mov (%rcx), %esi nop nop nop nop nop cmp $12499, %rsi lea addresses_A_ht+0x4c07, %rsi lea addresses_WT_ht+0x3547, %rdi nop nop sub %r12, %r12 mov $34, %rcx rep movsl nop nop nop nop nop and $4445, %r10 lea addresses_UC_ht+0x12b47, %r9 nop nop nop nop xor $59020, %rdi mov (%r9), %r12d nop nop nop nop sub $44431, %rsi lea addresses_UC_ht+0x3d8f, %rsi lea addresses_UC_ht+0x18707, %rdi nop inc %r9 mov $81, %rcx rep movsb nop nop nop nop nop add $5512, %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %r9 pop %r8 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r15 push %r8 push %r9 push %rbp push %rcx push %rdi push %rsi // Load lea addresses_RW+0x1a147, %rdi nop nop nop nop nop add %r8, %r8 mov (%rdi), %r9w nop nop nop nop add %rbp, %rbp // REPMOV mov $0x2e7, %rsi lea addresses_RW+0xf61f, %rdi nop nop nop cmp %r15, %r15 mov $85, %rcx rep movsb nop cmp $3569, %rcx // Store lea addresses_normal+0x11b5f, %r9 nop nop nop nop nop sub %r8, %r8 movl $0x51525354, (%r9) nop nop cmp %rsi, %rsi // Store mov $0xe47, %rsi nop nop sub $39871, %rbp mov $0x5152535455565758, %r15 movq %r15, %xmm3 vmovups %ymm3, (%rsi) nop nop nop cmp $64916, %rbp // Store lea addresses_US+0xa0e6, %rsi nop nop nop nop sub %r9, %r9 movl $0x51525354, (%rsi) nop nop xor %r9, %r9 // Faulty Load lea addresses_RW+0x1a147, %rcx nop nop nop nop and %rbp, %rbp mov (%rcx), %r15d lea oracles, %r9 and $0xff, %r15 shlq $12, %r15 mov (%r9,%r15,1), %r15 pop %rsi pop %rdi pop %rcx pop %rbp pop %r9 pop %r8 pop %r15 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 4, 'type': 'addresses_P'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_RW'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_normal', 'AVXalign': False, 'size': 4}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_P', 'AVXalign': False, 'size': 32}} {'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 4}} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': True, 'size': 4}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_A_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 2}} {'src': {'same': False, 'congruent': 9, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_normal_ht'}} {'src': {'same': False, 'congruent': 10, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_normal_ht'}} {'src': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_WC_ht'}} {'src': {'same': False, 'congruent': 9, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_D_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32}} {'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 6, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WT_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 1, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 6, 'type': 'addresses_UC_ht'}} {'32': 16284} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
30.248252
2,999
0.654953
[ "MIT" ]
danielmgmi/medusa
Transynther/_processed/AVXALIGN/_st_/i9-9900K_12_0xa0.log_16284_444.asm
8,651
Assembly
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r14 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x1973a, %rsi lea addresses_A_ht+0x487e, %rdi nop nop nop nop nop xor %r12, %r12 mov $20, %rcx rep movsb nop sub $42676, %r14 lea addresses_normal_ht+0x100ca, %rax nop nop sub %r12, %r12 mov (%rax), %edi xor $65451, %rax lea addresses_normal_ht+0x7cda, %rax nop dec %rdx mov $0x6162636465666768, %rsi movq %rsi, %xmm0 and $0xffffffffffffffc0, %rax movaps %xmm0, (%rax) nop and $43563, %rdx lea addresses_normal_ht+0x1baba, %rsi lea addresses_WC_ht+0x1167a, %rdi nop nop nop nop dec %r12 mov $108, %rcx rep movsl nop nop cmp $10510, %r14 lea addresses_A_ht+0x1c0ef, %rdx nop nop xor $46167, %rsi movl $0x61626364, (%rdx) nop nop nop nop nop and $41808, %rdi lea addresses_UC_ht+0x977a, %rsi lea addresses_WT_ht+0x1009a, %rdi nop nop cmp %r11, %r11 mov $70, %rcx rep movsb nop dec %r14 lea addresses_D_ht+0x4d51, %r11 nop nop inc %rax mov $0x6162636465666768, %rsi movq %rsi, %xmm5 vmovups %ymm5, (%r11) nop nop nop sub $64114, %rax lea addresses_WC_ht+0x81ea, %r14 nop nop nop add $40565, %rax movw $0x6162, (%r14) nop nop nop nop xor %rax, %rax pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r14 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r15 push %r9 push %rcx // Faulty Load lea addresses_PSE+0x179a, %r15 nop cmp $50346, %r13 mov (%r15), %r12d lea oracles, %rcx and $0xff, %r12 shlq $12, %r12 mov (%rcx,%r12,1), %r12 pop %rcx pop %r9 pop %r15 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_PSE', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_PSE', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 4, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 6, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_WC_ht', 'same': True, 'size': 2, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
41.451389
2,999
0.662758
[ "MIT" ]
danielmgmi/medusa
Transynther/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_351.asm
5,969
Assembly
; A279318: Permutation of the nonnegative integers [6k+3, 6k+2, 6k+1, 6k, 6k+5, 6k+4]. ; 3,2,1,0,5,4,9,8,7,6,11,10,15,14,13,12,17,16,21,20,19,18,23,22,27,26,25,24,29,28,33,32,31,30,35,34,39,38,37,36,41,40,45,44,43,42,47,46,51,50,49,48,53,52,57,56,55,54,59,58,63,62,61,60,65,64,69 mov $2,$0 gcd $0,2 mov $3,$0 trn $0,2 add $3,$2 sub $2,2 lpb $3 add $0,6 mov $1,$0 sub $3,3 lpe sub $1,$2 sub $1,5
23.647059
192
0.609453
[ "Apache-2.0" ]
jmorken/loda
programs/oeis/279/A279318.asm
402
Assembly
; A173513: a(n) = ceiling(A173510(n)/2). ; 1,1,2,2,3,3,4,5,7,9,11,14,18,23,30,38,49,63,80,103,132,169,216,277,355,454,582,745,954,1222,1565 seq $0,173510 ; a(n) = a(n-1) + a(n-2) - floor( a(n-1)/2 ). add $0,1 div $0,2
31.285714
98
0.584475
[ "Apache-2.0" ]
ckrause/cm
programs/oeis/173/A173513.asm
219
Assembly
INCLUDE "hardware.inc" SECTION "Header", rom0[$100] EntryPoint: di jp Start REPT $150 - $104 db 0 ENDR SECTION "Game Code", rom0 Start: .waitVBlank ld a, [rLY] cp a, 144 jr c, .waitVBlank xor a; ld a, 0 ld [rLCDC], a ld hl, $9000 ld de, FontTiles ld bc, FontTilesEnd - FontTiles .copyFont ld a, [de] ld [hli], a inc de dec bc ld a, b or a, c jr nz, .copyFont ld hl, $9900; print sentence on top screen ld de, HelloWorldStr .copyString ld a, [de] ld [hli], a inc de and a jr nz, .copyString ld a, %11100100 ld [rBGP], a xor a; ld a, 0 ld [rSCY], a ld [rSCX], a ld [rNR52], a ld a, %10000001 ld [rLCDC], a .lockup jr .lockup SECTION "Font", ROM0 FontTiles: INCBIN "font.chr" FontTilesEnd: SECTION "Hello World string", ROM0 HelloWorldStr: db "Hello Github !", 0
13.289855
46
0.568157
[ "MIT" ]
dusterherz/gb-hello-world
helloworld/main.asm
917
Assembly
.model small .stack .code start: ; Start of background mov ah, 06h mov bh, 70h mov ch, 00 mov cl, 00 mov dh, 32 mov dl, 80 int 10h mov ah, 06h mov bh, 00h mov ch, 2 mov cl, 2 mov dh, 2 mov dl, 4 int 10h mov ah, 06h mov bh, 00h mov ch, 2 mov cl, 7 mov dh, 2 mov dl, 9 int 10h mov ah, 06h mov bh, 00h mov ch, 3 mov cl, 1 mov dh, 4 mov dl, 1 int 10h mov ah, 06h mov bh, 00h mov ch, 3 mov cl, 5 mov dh, 4 mov dl, 5 int 10h mov ah, 06h mov bh, 00h mov ch, 3 mov cl, 6 mov dh, 4 mov dl, 6 int 10h mov ah, 06h mov bh, 00h mov ch, 3 mov cl, 10 mov dh, 4 mov dl, 10 int 10h mov ah, 06h mov bh, 00h mov ch, 5 mov cl, 2 mov dh, 5 mov dl, 2 int 10h mov ah, 06h mov bh, 00h mov ch, 5 mov cl, 9 mov dh, 5 mov dl, 9 int 10h mov ah, 06h mov bh, 00h mov ch, 6 mov cl, 1 mov dh, 8 mov dl, 1 int 10h mov ah, 06h mov bh, 00h mov ch, 6 mov cl, 10 mov dh, 8 mov dl, 10 int 10h mov ah, 06h mov bh, 00h mov ch, 7 mov cl, 3 mov dh, 7 mov dl, 3 int 10h mov ah, 06h mov bh, 00h mov ch, 7 mov cl, 8 mov dh, 7 mov dl, 8 int 10h mov ah, 06h mov bh, 00h mov ch, 8 mov cl, 5 mov dh, 8 mov dl, 6 int 10h mov ah, 06h mov bh, 00h mov ch, 9 mov cl, 2 mov dh, 9 mov dl, 2 int 10h mov ah, 06h mov bh, 00h mov ch, 9 mov cl, 9 mov dh, 9 mov dl, 9 int 10h mov ah, 06h mov bh, 00h mov ch, 10 mov cl, 3 mov dh, 10 mov dl, 8 int 10h mov ah, 06h mov bh, 00h mov ch, 11 mov cl, 2 mov dh, 11 mov dl, 2 int 10h mov ah, 06h mov bh, 00h mov ch, 11 mov cl, 9 mov dh, 11 mov dl, 9 int 10h mov ah, 06h mov bh, 00h mov ch, 11 mov cl, 11 mov dh, 11 mov dl, 12 int 10h mov ah, 06h mov bh, 00h mov ch, 12 mov cl, 1 mov dh, 13 mov dl, 1 int 10h mov ah, 06h mov bh, 00h mov ch, 12 mov cl, 10 mov dh, 13 mov dl, 10 int 10h mov ah, 06h mov bh, 00h mov ch, 13 mov cl, 11 mov dh, 13 mov dl, 12 int 10h mov ah, 06h mov bh, 00h mov ch, 12 mov cl, 13 mov dh, 12 mov dl, 13 int 10h mov ah, 06h mov bh, 00h mov ch, 14 mov cl, 2 mov dh, 14 mov dl, 9 int 10h ;Heart mov ah, 06h mov bh, 65 mov ch, 5 mov cl, 20 mov dh, 7 mov dl, 28 int 10h mov ah, 06h mov bh, 65 mov ch, 4 mov cl, 21 mov dh, 4 mov dl, 23 int 10h mov ah, 06h mov bh, 65 mov ch, 4 mov cl, 25 mov dh, 4 mov dl, 27 int 10h mov ah, 06h mov bh, 65 mov ch, 8 mov cl, 21 mov dh, 8 mov dl, 27 int 10h mov ah, 06h mov bh, 65 mov ch, 9 mov cl, 22 mov dh, 9 mov dl, 26 int 10h mov ah, 06h mov bh, 65 mov ch, 10 mov cl, 23 mov dh, 10 mov dl, 25 int 10h mov ah, 06h mov bh, 65 mov ch, 11 mov cl, 24 mov dh, 11 mov dl, 24 int 10h ;White Rabbit mov ah, 06h mov bh, 00h mov ch, 2 mov cl, 42 mov dh, 2 mov dl, 44 int 10h mov ah, 06h mov bh, 00h mov ch, 2 mov cl, 47 mov dh, 2 mov dl, 49 int 10h mov ah, 06h mov bh, 00h mov ch, 3 mov cl, 41 mov dh, 4 mov dl, 41 int 10h mov ah, 06h mov bh, 00h mov ch, 3 mov cl, 45 mov dh, 4 mov dl, 45 int 10h mov ah, 06h mov bh, 00h mov ch, 3 mov cl, 46 mov dh, 4 mov dl, 46 int 10h mov ah, 06h mov bh, 00h mov ch, 3 mov cl, 50 mov dh, 4 mov dl, 50 int 10h mov ah, 06h mov bh, 00h mov ch, 5 mov cl, 42 mov dh, 5 mov dl, 42 int 10h mov ah, 06h mov bh, 00h mov ch, 5 mov cl, 49 mov dh, 5 mov dl, 49 int 10h mov ah, 06h mov bh, 00h mov ch, 6 mov cl, 41 mov dh, 8 mov dl, 41 int 10h mov ah, 06h mov bh, 00h mov ch, 6 mov cl, 50 mov dh, 8 mov dl, 50 int 10h mov ah, 06h mov bh, 00h mov ch, 7 mov cl, 43 mov dh, 7 mov dl, 43 int 10h mov ah, 06h mov bh, 00h mov ch, 7 mov cl, 48 mov dh, 7 mov dl, 48 int 10h mov ah, 06h mov bh, 00h mov ch, 8 mov cl, 45 mov dh, 8 mov dl, 46 int 10h mov ah, 06h mov bh, 00h mov ch, 9 mov cl, 42 mov dh, 9 mov dl, 42 int 10h mov ah, 06h mov bh, 00h mov ch, 9 mov cl, 49 mov dh, 9 mov dl, 49 int 10h mov ah, 06h mov bh, 00h mov ch, 10 mov cl, 43 mov dh, 10 mov dl, 48 int 10h mov ah, 06h mov bh, 00h mov ch, 11 mov cl, 42 mov dh, 11 mov dl, 42 int 10h mov ah, 06h mov bh, 00h mov ch, 11 mov cl, 49 mov dh, 11 mov dl, 49 int 10h mov ah, 06h mov bh, 00h mov ch, 11 mov cl, 41 mov dh, 11 mov dl, 42 int 10h mov ah, 06h mov bh, 00h mov ch, 12 mov cl, 41 mov dh, 13 mov dl, 41 int 10h mov ah, 06h mov bh, 00h mov ch, 12 mov cl, 50 mov dh, 13 mov dl, 50 int 10h mov ah, 06h mov bh, 00h mov ch, 13 mov cl, 51 mov dh, 13 mov dl, 52 int 10h mov ah, 06h mov bh, 00h mov ch, 12 mov cl, 53 mov dh, 12 mov dl, 53 int 10h mov ah, 06h mov bh, 00h mov ch, 14 mov cl, 42 mov dh, 14 mov dl, 49 int 10h mov ah, 06h mov bh, 00h mov ch, 14 mov cl, 42 mov dh, 14 mov dl, 49 int 10h mov ah, 4ch int 21h end start
10.257384
22
0.579186
[ "MIT" ]
martianworm17/college-assembly-files
c.asm
4,862
Assembly
; A037674: Base-4 digits are, in order, the first n terms of the periodic sequence with initial period 1,0,2,3. ; 1,4,18,75,301,1204,4818,19275,77101,308404,1233618,4934475,19737901,78951604,315806418,1263225675,5052902701,20211610804,80846443218,323385772875,1293543091501,5174172366004,20696689464018,82786757856075 mov $1,4 pow $1,$0 mul $1,20 div $1,17
44.75
205
0.798883
[ "Apache-2.0" ]
jmorken/loda
programs/oeis/037/A037674.asm
358
Assembly
LMDiamond9 label byte word C_BLACK Bitmap <71,100,BMC_PACKBITS,BMF_MONO> db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0x01, 0x03, 0xe0, 0xfa, 0x00 db 0x01, 0x07, 0xf0, 0xfc, 0x00, 0x01, 0x04, 0x00 db 0x01, 0x0e, 0x38, 0xfc, 0x00, 0x01, 0x0e, 0x00 db 0x01, 0x0c, 0x18, 0xfc, 0x00, 0x01, 0x1b, 0x00 db 0x01, 0x0c, 0x18, 0xfc, 0x00, 0x01, 0x35, 0x80 db 0x01, 0x0c, 0x18, 0xfc, 0x00, 0x01, 0x2a, 0x80 db 0x01, 0x0c, 0x18, 0xfc, 0x00, 0x01, 0x55, 0x40 db 0x08, 0x0e, 0x38, 0x00, 0x80, 0x00, 0x02, 0x00, 0x2a, 0x80 db 0x08, 0x07, 0xf8, 0x01, 0xc0, 0x00, 0x07, 0x00, 0x35, 0x80 db 0x08, 0x03, 0xf8, 0x03, 0x60, 0x00, 0x0d, 0x80, 0x1b, 0x00 db 0x08, 0x00, 0x18, 0x06, 0xb0, 0x00, 0x1a, 0xc0, 0x0e, 0x00 db 0x08, 0x0c, 0x18, 0x0d, 0x58, 0x00, 0x35, 0x60, 0x04, 0x00 db 0x08, 0x0e, 0x38, 0x1a, 0xac, 0x00, 0x6a, 0xb0, 0x00, 0x00 db 0x08, 0x07, 0xf0, 0x15, 0x54, 0x00, 0x55, 0x50, 0x00, 0x00 db 0x08, 0x03, 0xe0, 0x2a, 0xaa, 0x00, 0xaa, 0xa8, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x15, 0x54, 0x00, 0x55, 0x50, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x1a, 0xac, 0x00, 0x6a, 0xb0, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x0d, 0x58, 0x00, 0x35, 0x60, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x06, 0xb0, 0x00, 0x1a, 0xc0, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x03, 0x60, 0x00, 0x0d, 0x80, 0x00, 0x00 db 0x05, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x07, 0xfe, 0x00 db 0xfe, 0x00, 0x02, 0x80, 0x00, 0x02, 0xfe, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xfe, 0x00, 0x02, 0x80, 0x00, 0x02, 0xfe, 0x00 db 0x05, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x07, 0xfe, 0x00 db 0x08, 0x00, 0x00, 0x03, 0x60, 0x00, 0x0d, 0x80, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x06, 0xb0, 0x00, 0x1a, 0xc0, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x0d, 0x58, 0x00, 0x35, 0x60, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x1a, 0xac, 0x00, 0x6a, 0xb0, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x15, 0x54, 0x00, 0x55, 0x50, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x2a, 0xaa, 0x00, 0xaa, 0xa8, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x15, 0x54, 0x00, 0x55, 0x50, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x1a, 0xac, 0x00, 0x6a, 0xb0, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x0d, 0x58, 0x00, 0x35, 0x60, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x06, 0xb0, 0x10, 0x1a, 0xc0, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x03, 0x60, 0x38, 0x0d, 0x80, 0x00, 0x00 db 0x05, 0x00, 0x00, 0x01, 0xc0, 0x6c, 0x07, 0xfe, 0x00 db 0xfe, 0x00, 0x02, 0x80, 0xd6, 0x02, 0xfe, 0x00 db 0xfe, 0x00, 0x01, 0x01, 0xab, 0xfd, 0x00 db 0xfe, 0x00, 0x02, 0x03, 0x55, 0x80, 0xfe, 0x00 db 0xfe, 0x00, 0x02, 0x02, 0xaa, 0x80, 0xfe, 0x00 db 0xfe, 0x00, 0x02, 0x05, 0x55, 0x40, 0xfe, 0x00 db 0xfe, 0x00, 0x02, 0x02, 0xaa, 0x80, 0xfe, 0x00 db 0xfe, 0x00, 0x02, 0x03, 0x55, 0x80, 0xfe, 0x00 db 0xfe, 0x00, 0x01, 0x01, 0xab, 0xfd, 0x00 db 0xfe, 0x00, 0x02, 0x80, 0xd6, 0x02, 0xfe, 0x00 db 0x05, 0x00, 0x00, 0x01, 0xc0, 0x6c, 0x07, 0xfe, 0x00 db 0x08, 0x00, 0x00, 0x03, 0x60, 0x38, 0x0d, 0x80, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x06, 0xb0, 0x10, 0x1a, 0xc0, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x0d, 0x58, 0x00, 0x35, 0x60, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x1a, 0xac, 0x00, 0x6a, 0xb0, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x15, 0x54, 0x00, 0x55, 0x50, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x2a, 0xaa, 0x00, 0xaa, 0xa8, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x15, 0x54, 0x00, 0x55, 0x50, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x1a, 0xac, 0x00, 0x6a, 0xb0, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x0d, 0x58, 0x00, 0x35, 0x60, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x06, 0xb0, 0x00, 0x1a, 0xc0, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x03, 0x60, 0x00, 0x0d, 0x80, 0x00, 0x00 db 0x05, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x07, 0xfe, 0x00 db 0xfe, 0x00, 0x02, 0x80, 0x00, 0x02, 0xfe, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xfe, 0x00, 0x02, 0x80, 0x00, 0x02, 0xfe, 0x00 db 0x05, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x07, 0xfe, 0x00 db 0x08, 0x00, 0x00, 0x03, 0x60, 0x00, 0x0d, 0x80, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x06, 0xb0, 0x00, 0x1a, 0xc0, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x0d, 0x58, 0x00, 0x35, 0x60, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x1a, 0xac, 0x00, 0x6a, 0xb0, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x15, 0x54, 0x00, 0x55, 0x50, 0x0f, 0x80 db 0x08, 0x00, 0x00, 0x2a, 0xaa, 0x00, 0xaa, 0xa8, 0x1f, 0xc0 db 0x08, 0x00, 0x00, 0x15, 0x54, 0x00, 0x55, 0x50, 0x38, 0xe0 db 0x08, 0x00, 0x40, 0x1a, 0xac, 0x00, 0x6a, 0xb0, 0x30, 0x60 db 0x08, 0x00, 0xe0, 0x0d, 0x58, 0x00, 0x35, 0x60, 0x30, 0x00 db 0x08, 0x01, 0xb0, 0x06, 0xb0, 0x00, 0x1a, 0xc0, 0x3f, 0x80 db 0x08, 0x03, 0x58, 0x03, 0x60, 0x00, 0x0d, 0x80, 0x3f, 0xc0 db 0x08, 0x02, 0xa8, 0x01, 0xc0, 0x00, 0x07, 0x00, 0x38, 0xe0 db 0x08, 0x05, 0x54, 0x00, 0x80, 0x00, 0x02, 0x00, 0x30, 0x60 db 0x01, 0x02, 0xa8, 0xfc, 0x00, 0x01, 0x30, 0x60 db 0x01, 0x03, 0x58, 0xfc, 0x00, 0x01, 0x30, 0x60 db 0x01, 0x01, 0xb0, 0xfc, 0x00, 0x01, 0x30, 0x60 db 0x01, 0x00, 0xe0, 0xfc, 0x00, 0x01, 0x38, 0xe0 db 0x01, 0x00, 0x40, 0xfc, 0x00, 0x01, 0x1f, 0xc0 db 0xfa, 0x00, 0x01, 0x0f, 0x80 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00
33.78481
53
0.628887
[ "Apache-2.0" ]
BOBBYWY/pcgeos
Appl/Art/Decks/GeoDeck/LMDiamond9.asm
5,338
Assembly
; A178947: Expansion of x*(1+2*x+8*x^2+3*x^4+4*x^3) / ( (1+x)^2*(x-1)^4 ). ; 1,4,17,38,81,138,229,340,497,680,921,1194,1537,1918,2381,2888,3489,4140,4897,5710,6641,7634,8757,9948,11281,12688,14249,15890,17697,19590,21661,23824,26177,28628,31281,34038,37009,40090,43397,46820,50481,54264,58297,62458,66881,71438,76269,81240,86497,91900,97601,103454,109617,115938,122581,129388,136529,143840,151497,159330,167521,175894,184637,193568,202881,212388,222289,232390,242897,253610,264741,276084,287857,299848,312281,324938,338049,351390,365197,379240,393761,408524,423777,439278,455281,471538,488309,505340,522897,540720,559081,577714,596897,616358,636381,656688,677569,698740,720497,742550 mov $2,$0 add $2,1 mov $7,$0 lpb $2 mov $0,$7 sub $2,1 sub $0,$2 mov $4,$0 mov $9,0 mov $10,$0 add $10,1 lpb $10 mov $0,$4 sub $10,1 sub $0,$10 mul $0,3 mov $3,$8 mov $5,6 gcd $5,$0 mul $0,$5 sub $0,2 sub $0,$5 div $0,3 pow $6,$8 add $0,$6 add $0,4 add $3,$0 add $3,10 add $3,$6 trn $3,16 add $3,1 add $9,$3 lpe add $1,$9 lpe mov $0,$1
28.025
608
0.646744
[ "Apache-2.0" ]
ckrause/cm
programs/oeis/178/A178947.asm
1,121
Assembly
; A026053: (d(n)-r(n))/5, where d = A008778 and r is the periodic sequence with fundamental period (0,3,1,0,1). ; 1,2,5,9,14,21,29,40,53,68,86,106,130,157,187,221,258,300,346,396,451,510,575,645,720,801,887,980,1079,1184,1296,1414,1540,1673,1813,1961,2116,2280,2452,2632,2821,3018,3225,3441,3666,3901,4145,4400,4665,4940,5226,5522,5830,6149,6479,6821 mov $12,$0 mov $14,$0 add $14,1 lpb $14,1 clr $0,12 mov $0,$12 sub $14,1 sub $0,$14 mov $9,$0 mov $11,$0 add $11,1 lpb $11,1 mov $0,$9 sub $11,1 sub $0,$11 mov $4,6 add $4,$0 mov $6,2 add $6,$4 mod $4,5 mod $4,2 div $6,5 add $4,$6 mov $1,$4 sub $1,1 add $10,$1 lpe add $13,$10 lpe mov $1,$13
21.176471
238
0.583333
[ "Apache-2.0" ]
karttu/loda
programs/oeis/026/A026053.asm
720
Assembly
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r14 push %r15 push %rax push %rbx push %rdx lea addresses_D_ht+0x1c371, %r12 nop nop nop and $25567, %rbx movb (%r12), %al xor %rdx, %rdx lea addresses_A_ht+0x13b11, %r15 nop nop add $39027, %rbx mov (%r15), %r14d nop nop nop nop dec %r15 pop %rdx pop %rbx pop %rax pop %r15 pop %r14 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %r15 push %r8 push %rax push %rbp push %rsi // Store mov $0x691, %r14 nop nop nop nop nop sub %rbp, %rbp mov $0x5152535455565758, %r15 movq %r15, %xmm2 vmovups %ymm2, (%r14) nop and %rsi, %rsi // Faulty Load lea addresses_normal+0x1cb11, %r10 nop nop nop nop sub %rax, %rax mov (%r10), %r14w lea oracles, %r8 and $0xff, %r14 shlq $12, %r14 mov (%r8,%r14,1), %r14 pop %rsi pop %rbp pop %rax pop %r8 pop %r15 pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'34': 1950} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
49.543478
2,999
0.6595
[ "MIT" ]
danielmgmi/medusa
Transynther/_processed/NONE/_xt_/i7-8650U_0xd2.log_1950_553.asm
4,558
Assembly
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %rax push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_normal_ht+0x9e0, %rbx nop nop nop nop nop cmp %rcx, %rcx mov $0x6162636465666768, %r12 movq %r12, (%rbx) nop nop nop nop add $64472, %rax lea addresses_WC_ht+0x611c, %rsi lea addresses_D_ht+0x1160, %rdi nop add $59220, %rbp mov $120, %rcx rep movsl nop nop nop nop nop sub $21579, %rsi lea addresses_A_ht+0xdb60, %rsi lea addresses_A_ht+0x1a00, %rdi nop nop nop nop sub $33588, %r10 mov $90, %rcx rep movsq nop nop and $42636, %rbx lea addresses_WT_ht+0x14be0, %rsi lea addresses_WC_ht+0x15180, %rdi nop dec %r10 mov $91, %rcx rep movsb inc %rbp lea addresses_UC_ht+0x9d60, %rsi lea addresses_WT_ht+0xfe0, %rdi nop nop nop nop nop sub %r10, %r10 mov $55, %rcx rep movsl nop nop nop nop nop cmp $3793, %rax lea addresses_A_ht+0x65e0, %rbp nop nop nop sub %r10, %r10 movl $0x61626364, (%rbp) nop nop nop and $64668, %rsi lea addresses_WT_ht+0x16f60, %rbp nop nop nop nop cmp %r12, %r12 movb (%rbp), %bl nop xor $56227, %rdi lea addresses_D_ht+0xc5e0, %rcx nop nop xor %rax, %rax movw $0x6162, (%rcx) nop nop nop nop nop add %rsi, %rsi lea addresses_WC_ht+0x1ee2d, %rsi lea addresses_UC_ht+0x12ee2, %rdi nop nop nop nop add %r10, %r10 mov $20, %rcx rep movsb nop nop nop cmp %rcx, %rcx pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %rax pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r13 push %r15 push %rax push %rbx push %rdi // Store lea addresses_D+0x48c0, %r12 nop nop nop xor $28195, %r15 movw $0x5152, (%r12) nop sub $6038, %rdi // Faulty Load lea addresses_PSE+0xcde0, %rdi nop nop nop nop and %rbx, %rbx movb (%rdi), %r15b lea oracles, %rdi and $0xff, %r15 shlq $12, %r15 mov (%rdi,%r15,1), %r15 pop %rdi pop %rbx pop %rax pop %r15 pop %r13 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 4, 'NT': True, 'type': 'addresses_PSE'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_D'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': True, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_normal_ht'}} {'src': {'congruent': 2, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_D_ht'}} {'src': {'congruent': 6, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_A_ht'}} {'src': {'congruent': 7, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_WC_ht'}} {'src': {'congruent': 4, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_WT_ht'}} {'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': True, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_A_ht'}} {'src': {'congruent': 7, 'AVXalign': False, 'same': True, 'size': 1, 'NT': True, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_D_ht'}} {'src': {'congruent': 0, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_UC_ht'}} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
35.177419
2,999
0.660095
[ "MIT" ]
danielmgmi/medusa
Transynther/_processed/AVXALIGN/_st_/i7-7700_9_0xca.log_21829_473.asm
6,543
Assembly
<% from pwnlib.shellcraft.arm.linux import syscall %> <%page args="set"/> <%docstring> Invokes the syscall sigpending. See 'man 2 sigpending' for more information. Arguments: set(sigset_t): set </%docstring> ${syscall('SYS_sigpending', set)}
18.428571
77
0.693798
[ "MIT" ]
FDlucifer/binjitsu
pwnlib/shellcraft/templates/arm/linux/sigpending.asm
258
Assembly
BITS 32 section .text foo: fadd dword [eax] fsub qword [ebx] fsubr st0, st4 fmul st7, st0 fdiv dword [eax] fdivr qword [ebx] fdivrp st2, st0 fdivp st2, st0 fmulp st2, st0 fsubp st3, st0 fsubrp st2, st0 faddp st4, st0 fimul dword [eax] fiadd word [ebx] fidiv word [ebx] fidivr dword [eax] fisub word [ebx] fisubr dword [eax]
14.727273
18
0.725309
[ "MIT" ]
Acidburn0zzz/larceny
src/Lib/Sassy/tests/fp1.asm
324
Assembly
; A079589: a(n) = C(5n+1,n). ; 1,6,55,560,5985,65780,736281,8347680,95548245,1101716330,12777711870,148902215280,1742058970275,20448884000160,240719591939480,2840671544105280,33594090947249085,398039194165652550,4724081931321677925,56151322242892212960,668324943343021950370,7964235968972627303960,95012501118129501092550,1134632930723553470042400,13562231801970983941985175,162246633998500042073712630,1942497021989669009217637680,23273395430633195454908470400,279030186412390462423177273800,3347452172425285764303659940800,40181955259625451419433071976400,482597166588521931980005859542656,5799099572476420822828150315185805,69717997594570220076773804335369470,838543187239532877870723715923491055 mov $1,5 mul $1,$0 add $1,1 bin $1,$0 mov $0,$1
83.222222
670
0.898531
[ "Apache-2.0" ]
ckrause/cm
programs/oeis/079/A079589.asm
749
Assembly
; A337273: Number of distinct positive integer pairs, (s,t), such that s < t < n where neither s nor t divides n. ; 0,0,0,0,3,1,10,6,15,15,36,15,55,45,55,55,105,66,136,91,136,153,210,120,231,231,253,231,351,231,406,325,406,435,465,351,595,561,595,496,741,561,820,703,741,861,990,703,1035,946,1081,1035,1275,1035,1275,1128,1378,1431,1596 mov $1,$0 seq $0,5 ; d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n. sub $0,$1 bin $0,2
56
222
0.694196
[ "Apache-2.0" ]
ckrause/cm
programs/oeis/337/A337273.asm
448
Assembly
; A029014: Expansion of 1/((1-x)(1-x^2)(1-x^5)(1-x^9)). ; 1,1,2,2,3,4,5,6,7,9,11,13,15,17,20,23,26,29,33,37,42,46,51,56,62,68,74,81,88,96,104,112,121,130,140,150,161,172,184,196,209,222,236,250,265,281,297,314,331,349,368,387,407,427,449,471,494,517,541,566,592,618,645,673,702,732,762,793,825,858,892,926,962,998,1036,1074,1113,1153,1194,1236,1279,1323,1368,1414,1461,1509,1558,1608,1659,1711,1765,1819,1875,1931,1989,2048,2108,2169,2231,2295,2360,2426,2493,2561,2631,2702,2774,2847,2922,2998,3076,3154,3234,3315,3398,3482,3567,3654,3742,3832,3923,4015,4109,4204,4301,4399,4499,4600,4703,4807,4913,5020,5129,5239,5351,5465,5580,5697,5815,5935,6057,6180,6305,6431,6560,6690,6822,6955,7090,7227,7366,7506,7648,7792,7938,8086,8235,8386,8539,8694,8851,9009,9170,9332,9497,9663,9831,10001,10173,10347,10523,10701,10881,11063,11247,11433,11621,11811,12003,12197,12394,12592,12793,12995,13200,13407,13616,13827,14040,14256,14474,14694,14916,15140,15367,15596,15827,16060,16296,16534,16775,17017,17262,17509,17759,18011,18265,18522,18781,19043,19307,19573,19842,20113,20387,20663,20942,21223,21507,21793,22082,22373,22667,22963,23262,23564,23868,24175,24484,24796,25111,25428,25748,26070,26396,26724,27055,27388,27724,28063,28405,28749,29096,29446,29799,30155,30513,30874,31238,31605 mov $1,17 lpb $0 mov $2,$0 sub $0,1 cal $2,25779 ; Expansion of 1/((1-x)*(1-x^5)*(1-x^9)). sub $0,1 add $1,$2 lpe sub $1,16
108.615385
1,220
0.755666
[ "Apache-2.0" ]
jmorken/loda
programs/oeis/029/A029014.asm
1,412
Assembly
; A055770: Largest factorial number which divides n. ; 1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,24,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,24,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,24,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,24,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,120,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,24,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,24,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,24,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,24,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,6,1,2,1,2,1,120,1,2,1,2,1,6,1,2,1,2 cal $0,55881 ; a(n) = largest m such that m! divides n. cal $0,142 mov $1,$0
92.142857
513
0.545736
[ "Apache-2.0" ]
jmorken/loda
programs/oeis/055/A055770.asm
645
Assembly
_echo: file format elf32-i386 Disassembly of section .text: 00000000 <main>: #include "stat.h" #include "user.h" int main(int argc, char *argv[]) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 53 push %ebx e: 51 push %ecx f: 83 ec 10 sub $0x10,%esp 12: 89 cb mov %ecx,%ebx int i; for(i = 1; i < argc; i++) 14: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp) 1b: eb 3c jmp 59 <main+0x59> printf(1, "%s%s", argv[i], i+1 < argc ? " " : "\n"); 1d: 8b 45 f4 mov -0xc(%ebp),%eax 20: 83 c0 01 add $0x1,%eax 23: 3b 03 cmp (%ebx),%eax 25: 7d 07 jge 2e <main+0x2e> 27: ba 09 08 00 00 mov $0x809,%edx 2c: eb 05 jmp 33 <main+0x33> 2e: ba 0b 08 00 00 mov $0x80b,%edx 33: 8b 45 f4 mov -0xc(%ebp),%eax 36: 8d 0c 85 00 00 00 00 lea 0x0(,%eax,4),%ecx 3d: 8b 43 04 mov 0x4(%ebx),%eax 40: 01 c8 add %ecx,%eax 42: 8b 00 mov (%eax),%eax 44: 52 push %edx 45: 50 push %eax 46: 68 0d 08 00 00 push $0x80d 4b: 6a 01 push $0x1 4d: e8 01 04 00 00 call 453 <printf> 52: 83 c4 10 add $0x10,%esp int main(int argc, char *argv[]) { int i; for(i = 1; i < argc; i++) 55: 83 45 f4 01 addl $0x1,-0xc(%ebp) 59: 8b 45 f4 mov -0xc(%ebp),%eax 5c: 3b 03 cmp (%ebx),%eax 5e: 7c bd jl 1d <main+0x1d> printf(1, "%s%s", argv[i], i+1 < argc ? " " : "\n"); exit(); 60: e8 57 02 00 00 call 2bc <exit> 00000065 <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 65: 55 push %ebp 66: 89 e5 mov %esp,%ebp 68: 57 push %edi 69: 53 push %ebx asm volatile("cld; rep stosb" : 6a: 8b 4d 08 mov 0x8(%ebp),%ecx 6d: 8b 55 10 mov 0x10(%ebp),%edx 70: 8b 45 0c mov 0xc(%ebp),%eax 73: 89 cb mov %ecx,%ebx 75: 89 df mov %ebx,%edi 77: 89 d1 mov %edx,%ecx 79: fc cld 7a: f3 aa rep stos %al,%es:(%edi) 7c: 89 ca mov %ecx,%edx 7e: 89 fb mov %edi,%ebx 80: 89 5d 08 mov %ebx,0x8(%ebp) 83: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 86: 90 nop 87: 5b pop %ebx 88: 5f pop %edi 89: 5d pop %ebp 8a: c3 ret 0000008b <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 8b: 55 push %ebp 8c: 89 e5 mov %esp,%ebp 8e: 83 ec 10 sub $0x10,%esp char *os; os = s; 91: 8b 45 08 mov 0x8(%ebp),%eax 94: 89 45 fc mov %eax,-0x4(%ebp) while((*s++ = *t++) != 0) 97: 90 nop 98: 8b 45 08 mov 0x8(%ebp),%eax 9b: 8d 50 01 lea 0x1(%eax),%edx 9e: 89 55 08 mov %edx,0x8(%ebp) a1: 8b 55 0c mov 0xc(%ebp),%edx a4: 8d 4a 01 lea 0x1(%edx),%ecx a7: 89 4d 0c mov %ecx,0xc(%ebp) aa: 0f b6 12 movzbl (%edx),%edx ad: 88 10 mov %dl,(%eax) af: 0f b6 00 movzbl (%eax),%eax b2: 84 c0 test %al,%al b4: 75 e2 jne 98 <strcpy+0xd> ; return os; b6: 8b 45 fc mov -0x4(%ebp),%eax } b9: c9 leave ba: c3 ret 000000bb <strcmp>: int strcmp(const char *p, const char *q) { bb: 55 push %ebp bc: 89 e5 mov %esp,%ebp while(*p && *p == *q) be: eb 08 jmp c8 <strcmp+0xd> p++, q++; c0: 83 45 08 01 addl $0x1,0x8(%ebp) c4: 83 45 0c 01 addl $0x1,0xc(%ebp) } int strcmp(const char *p, const char *q) { while(*p && *p == *q) c8: 8b 45 08 mov 0x8(%ebp),%eax cb: 0f b6 00 movzbl (%eax),%eax ce: 84 c0 test %al,%al d0: 74 10 je e2 <strcmp+0x27> d2: 8b 45 08 mov 0x8(%ebp),%eax d5: 0f b6 10 movzbl (%eax),%edx d8: 8b 45 0c mov 0xc(%ebp),%eax db: 0f b6 00 movzbl (%eax),%eax de: 38 c2 cmp %al,%dl e0: 74 de je c0 <strcmp+0x5> p++, q++; return (uchar)*p - (uchar)*q; e2: 8b 45 08 mov 0x8(%ebp),%eax e5: 0f b6 00 movzbl (%eax),%eax e8: 0f b6 d0 movzbl %al,%edx eb: 8b 45 0c mov 0xc(%ebp),%eax ee: 0f b6 00 movzbl (%eax),%eax f1: 0f b6 c0 movzbl %al,%eax f4: 29 c2 sub %eax,%edx f6: 89 d0 mov %edx,%eax } f8: 5d pop %ebp f9: c3 ret 000000fa <strlen>: uint strlen(char *s) { fa: 55 push %ebp fb: 89 e5 mov %esp,%ebp fd: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) 100: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 107: eb 04 jmp 10d <strlen+0x13> 109: 83 45 fc 01 addl $0x1,-0x4(%ebp) 10d: 8b 55 fc mov -0x4(%ebp),%edx 110: 8b 45 08 mov 0x8(%ebp),%eax 113: 01 d0 add %edx,%eax 115: 0f b6 00 movzbl (%eax),%eax 118: 84 c0 test %al,%al 11a: 75 ed jne 109 <strlen+0xf> ; return n; 11c: 8b 45 fc mov -0x4(%ebp),%eax } 11f: c9 leave 120: c3 ret 00000121 <memset>: void* memset(void *dst, int c, uint n) { 121: 55 push %ebp 122: 89 e5 mov %esp,%ebp stosb(dst, c, n); 124: 8b 45 10 mov 0x10(%ebp),%eax 127: 50 push %eax 128: ff 75 0c pushl 0xc(%ebp) 12b: ff 75 08 pushl 0x8(%ebp) 12e: e8 32 ff ff ff call 65 <stosb> 133: 83 c4 0c add $0xc,%esp return dst; 136: 8b 45 08 mov 0x8(%ebp),%eax } 139: c9 leave 13a: c3 ret 0000013b <strchr>: char* strchr(const char *s, char c) { 13b: 55 push %ebp 13c: 89 e5 mov %esp,%ebp 13e: 83 ec 04 sub $0x4,%esp 141: 8b 45 0c mov 0xc(%ebp),%eax 144: 88 45 fc mov %al,-0x4(%ebp) for(; *s; s++) 147: eb 14 jmp 15d <strchr+0x22> if(*s == c) 149: 8b 45 08 mov 0x8(%ebp),%eax 14c: 0f b6 00 movzbl (%eax),%eax 14f: 3a 45 fc cmp -0x4(%ebp),%al 152: 75 05 jne 159 <strchr+0x1e> return (char*)s; 154: 8b 45 08 mov 0x8(%ebp),%eax 157: eb 13 jmp 16c <strchr+0x31> } char* strchr(const char *s, char c) { for(; *s; s++) 159: 83 45 08 01 addl $0x1,0x8(%ebp) 15d: 8b 45 08 mov 0x8(%ebp),%eax 160: 0f b6 00 movzbl (%eax),%eax 163: 84 c0 test %al,%al 165: 75 e2 jne 149 <strchr+0xe> if(*s == c) return (char*)s; return 0; 167: b8 00 00 00 00 mov $0x0,%eax } 16c: c9 leave 16d: c3 ret 0000016e <gets>: char* gets(char *buf, int max) { 16e: 55 push %ebp 16f: 89 e5 mov %esp,%ebp 171: 83 ec 18 sub $0x18,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 174: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 17b: eb 42 jmp 1bf <gets+0x51> cc = read(0, &c, 1); 17d: 83 ec 04 sub $0x4,%esp 180: 6a 01 push $0x1 182: 8d 45 ef lea -0x11(%ebp),%eax 185: 50 push %eax 186: 6a 00 push $0x0 188: e8 47 01 00 00 call 2d4 <read> 18d: 83 c4 10 add $0x10,%esp 190: 89 45 f0 mov %eax,-0x10(%ebp) if(cc < 1) 193: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 197: 7e 33 jle 1cc <gets+0x5e> break; buf[i++] = c; 199: 8b 45 f4 mov -0xc(%ebp),%eax 19c: 8d 50 01 lea 0x1(%eax),%edx 19f: 89 55 f4 mov %edx,-0xc(%ebp) 1a2: 89 c2 mov %eax,%edx 1a4: 8b 45 08 mov 0x8(%ebp),%eax 1a7: 01 c2 add %eax,%edx 1a9: 0f b6 45 ef movzbl -0x11(%ebp),%eax 1ad: 88 02 mov %al,(%edx) if(c == '\n' || c == '\r') 1af: 0f b6 45 ef movzbl -0x11(%ebp),%eax 1b3: 3c 0a cmp $0xa,%al 1b5: 74 16 je 1cd <gets+0x5f> 1b7: 0f b6 45 ef movzbl -0x11(%ebp),%eax 1bb: 3c 0d cmp $0xd,%al 1bd: 74 0e je 1cd <gets+0x5f> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 1bf: 8b 45 f4 mov -0xc(%ebp),%eax 1c2: 83 c0 01 add $0x1,%eax 1c5: 3b 45 0c cmp 0xc(%ebp),%eax 1c8: 7c b3 jl 17d <gets+0xf> 1ca: eb 01 jmp 1cd <gets+0x5f> cc = read(0, &c, 1); if(cc < 1) break; 1cc: 90 nop buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 1cd: 8b 55 f4 mov -0xc(%ebp),%edx 1d0: 8b 45 08 mov 0x8(%ebp),%eax 1d3: 01 d0 add %edx,%eax 1d5: c6 00 00 movb $0x0,(%eax) return buf; 1d8: 8b 45 08 mov 0x8(%ebp),%eax } 1db: c9 leave 1dc: c3 ret 000001dd <stat>: int stat(char *n, struct stat *st) { 1dd: 55 push %ebp 1de: 89 e5 mov %esp,%ebp 1e0: 83 ec 18 sub $0x18,%esp int fd; int r; fd = open(n, O_RDONLY); 1e3: 83 ec 08 sub $0x8,%esp 1e6: 6a 00 push $0x0 1e8: ff 75 08 pushl 0x8(%ebp) 1eb: e8 0c 01 00 00 call 2fc <open> 1f0: 83 c4 10 add $0x10,%esp 1f3: 89 45 f4 mov %eax,-0xc(%ebp) if(fd < 0) 1f6: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 1fa: 79 07 jns 203 <stat+0x26> return -1; 1fc: b8 ff ff ff ff mov $0xffffffff,%eax 201: eb 25 jmp 228 <stat+0x4b> r = fstat(fd, st); 203: 83 ec 08 sub $0x8,%esp 206: ff 75 0c pushl 0xc(%ebp) 209: ff 75 f4 pushl -0xc(%ebp) 20c: e8 03 01 00 00 call 314 <fstat> 211: 83 c4 10 add $0x10,%esp 214: 89 45 f0 mov %eax,-0x10(%ebp) close(fd); 217: 83 ec 0c sub $0xc,%esp 21a: ff 75 f4 pushl -0xc(%ebp) 21d: e8 c2 00 00 00 call 2e4 <close> 222: 83 c4 10 add $0x10,%esp return r; 225: 8b 45 f0 mov -0x10(%ebp),%eax } 228: c9 leave 229: c3 ret 0000022a <atoi>: int atoi(const char *s) { 22a: 55 push %ebp 22b: 89 e5 mov %esp,%ebp 22d: 83 ec 10 sub $0x10,%esp int n; n = 0; 230: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while('0' <= *s && *s <= '9') 237: eb 25 jmp 25e <atoi+0x34> n = n*10 + *s++ - '0'; 239: 8b 55 fc mov -0x4(%ebp),%edx 23c: 89 d0 mov %edx,%eax 23e: c1 e0 02 shl $0x2,%eax 241: 01 d0 add %edx,%eax 243: 01 c0 add %eax,%eax 245: 89 c1 mov %eax,%ecx 247: 8b 45 08 mov 0x8(%ebp),%eax 24a: 8d 50 01 lea 0x1(%eax),%edx 24d: 89 55 08 mov %edx,0x8(%ebp) 250: 0f b6 00 movzbl (%eax),%eax 253: 0f be c0 movsbl %al,%eax 256: 01 c8 add %ecx,%eax 258: 83 e8 30 sub $0x30,%eax 25b: 89 45 fc mov %eax,-0x4(%ebp) atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 25e: 8b 45 08 mov 0x8(%ebp),%eax 261: 0f b6 00 movzbl (%eax),%eax 264: 3c 2f cmp $0x2f,%al 266: 7e 0a jle 272 <atoi+0x48> 268: 8b 45 08 mov 0x8(%ebp),%eax 26b: 0f b6 00 movzbl (%eax),%eax 26e: 3c 39 cmp $0x39,%al 270: 7e c7 jle 239 <atoi+0xf> n = n*10 + *s++ - '0'; return n; 272: 8b 45 fc mov -0x4(%ebp),%eax } 275: c9 leave 276: c3 ret 00000277 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 277: 55 push %ebp 278: 89 e5 mov %esp,%ebp 27a: 83 ec 10 sub $0x10,%esp char *dst, *src; dst = vdst; 27d: 8b 45 08 mov 0x8(%ebp),%eax 280: 89 45 fc mov %eax,-0x4(%ebp) src = vsrc; 283: 8b 45 0c mov 0xc(%ebp),%eax 286: 89 45 f8 mov %eax,-0x8(%ebp) while(n-- > 0) 289: eb 17 jmp 2a2 <memmove+0x2b> *dst++ = *src++; 28b: 8b 45 fc mov -0x4(%ebp),%eax 28e: 8d 50 01 lea 0x1(%eax),%edx 291: 89 55 fc mov %edx,-0x4(%ebp) 294: 8b 55 f8 mov -0x8(%ebp),%edx 297: 8d 4a 01 lea 0x1(%edx),%ecx 29a: 89 4d f8 mov %ecx,-0x8(%ebp) 29d: 0f b6 12 movzbl (%edx),%edx 2a0: 88 10 mov %dl,(%eax) { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 2a2: 8b 45 10 mov 0x10(%ebp),%eax 2a5: 8d 50 ff lea -0x1(%eax),%edx 2a8: 89 55 10 mov %edx,0x10(%ebp) 2ab: 85 c0 test %eax,%eax 2ad: 7f dc jg 28b <memmove+0x14> *dst++ = *src++; return vdst; 2af: 8b 45 08 mov 0x8(%ebp),%eax } 2b2: c9 leave 2b3: c3 ret 000002b4 <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 2b4: b8 01 00 00 00 mov $0x1,%eax 2b9: cd 40 int $0x40 2bb: c3 ret 000002bc <exit>: SYSCALL(exit) 2bc: b8 02 00 00 00 mov $0x2,%eax 2c1: cd 40 int $0x40 2c3: c3 ret 000002c4 <wait>: SYSCALL(wait) 2c4: b8 03 00 00 00 mov $0x3,%eax 2c9: cd 40 int $0x40 2cb: c3 ret 000002cc <pipe>: SYSCALL(pipe) 2cc: b8 04 00 00 00 mov $0x4,%eax 2d1: cd 40 int $0x40 2d3: c3 ret 000002d4 <read>: SYSCALL(read) 2d4: b8 05 00 00 00 mov $0x5,%eax 2d9: cd 40 int $0x40 2db: c3 ret 000002dc <write>: SYSCALL(write) 2dc: b8 10 00 00 00 mov $0x10,%eax 2e1: cd 40 int $0x40 2e3: c3 ret 000002e4 <close>: SYSCALL(close) 2e4: b8 15 00 00 00 mov $0x15,%eax 2e9: cd 40 int $0x40 2eb: c3 ret 000002ec <kill>: SYSCALL(kill) 2ec: b8 06 00 00 00 mov $0x6,%eax 2f1: cd 40 int $0x40 2f3: c3 ret 000002f4 <exec>: SYSCALL(exec) 2f4: b8 07 00 00 00 mov $0x7,%eax 2f9: cd 40 int $0x40 2fb: c3 ret 000002fc <open>: SYSCALL(open) 2fc: b8 0f 00 00 00 mov $0xf,%eax 301: cd 40 int $0x40 303: c3 ret 00000304 <mknod>: SYSCALL(mknod) 304: b8 11 00 00 00 mov $0x11,%eax 309: cd 40 int $0x40 30b: c3 ret 0000030c <unlink>: SYSCALL(unlink) 30c: b8 12 00 00 00 mov $0x12,%eax 311: cd 40 int $0x40 313: c3 ret 00000314 <fstat>: SYSCALL(fstat) 314: b8 08 00 00 00 mov $0x8,%eax 319: cd 40 int $0x40 31b: c3 ret 0000031c <link>: SYSCALL(link) 31c: b8 13 00 00 00 mov $0x13,%eax 321: cd 40 int $0x40 323: c3 ret 00000324 <mkdir>: SYSCALL(mkdir) 324: b8 14 00 00 00 mov $0x14,%eax 329: cd 40 int $0x40 32b: c3 ret 0000032c <chdir>: SYSCALL(chdir) 32c: b8 09 00 00 00 mov $0x9,%eax 331: cd 40 int $0x40 333: c3 ret 00000334 <dup>: SYSCALL(dup) 334: b8 0a 00 00 00 mov $0xa,%eax 339: cd 40 int $0x40 33b: c3 ret 0000033c <getpid>: SYSCALL(getpid) 33c: b8 0b 00 00 00 mov $0xb,%eax 341: cd 40 int $0x40 343: c3 ret 00000344 <sbrk>: SYSCALL(sbrk) 344: b8 0c 00 00 00 mov $0xc,%eax 349: cd 40 int $0x40 34b: c3 ret 0000034c <sleep>: SYSCALL(sleep) 34c: b8 0d 00 00 00 mov $0xd,%eax 351: cd 40 int $0x40 353: c3 ret 00000354 <uptime>: SYSCALL(uptime) 354: b8 0e 00 00 00 mov $0xe,%eax 359: cd 40 int $0x40 35b: c3 ret 0000035c <getMagic>: SYSCALL(getMagic) 35c: b8 17 00 00 00 mov $0x17,%eax 361: cd 40 int $0x40 363: c3 ret 00000364 <incrementMagic>: SYSCALL(incrementMagic) 364: b8 16 00 00 00 mov $0x16,%eax 369: cd 40 int $0x40 36b: c3 ret 0000036c <getCurrentProcessName>: SYSCALL(getCurrentProcessName) 36c: b8 18 00 00 00 mov $0x18,%eax 371: cd 40 int $0x40 373: c3 ret 00000374 <modifyCurrentProcessName>: SYSCALL(modifyCurrentProcessName) 374: b8 19 00 00 00 mov $0x19,%eax 379: cd 40 int $0x40 37b: c3 ret 0000037c <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 37c: 55 push %ebp 37d: 89 e5 mov %esp,%ebp 37f: 83 ec 18 sub $0x18,%esp 382: 8b 45 0c mov 0xc(%ebp),%eax 385: 88 45 f4 mov %al,-0xc(%ebp) write(fd, &c, 1); 388: 83 ec 04 sub $0x4,%esp 38b: 6a 01 push $0x1 38d: 8d 45 f4 lea -0xc(%ebp),%eax 390: 50 push %eax 391: ff 75 08 pushl 0x8(%ebp) 394: e8 43 ff ff ff call 2dc <write> 399: 83 c4 10 add $0x10,%esp } 39c: 90 nop 39d: c9 leave 39e: c3 ret 0000039f <printint>: static void printint(int fd, int xx, int base, int sgn) { 39f: 55 push %ebp 3a0: 89 e5 mov %esp,%ebp 3a2: 53 push %ebx 3a3: 83 ec 24 sub $0x24,%esp static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 3a6: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) if(sgn && xx < 0){ 3ad: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 3b1: 74 17 je 3ca <printint+0x2b> 3b3: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 3b7: 79 11 jns 3ca <printint+0x2b> neg = 1; 3b9: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) x = -xx; 3c0: 8b 45 0c mov 0xc(%ebp),%eax 3c3: f7 d8 neg %eax 3c5: 89 45 ec mov %eax,-0x14(%ebp) 3c8: eb 06 jmp 3d0 <printint+0x31> } else { x = xx; 3ca: 8b 45 0c mov 0xc(%ebp),%eax 3cd: 89 45 ec mov %eax,-0x14(%ebp) } i = 0; 3d0: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) do{ buf[i++] = digits[x % base]; 3d7: 8b 4d f4 mov -0xc(%ebp),%ecx 3da: 8d 41 01 lea 0x1(%ecx),%eax 3dd: 89 45 f4 mov %eax,-0xc(%ebp) 3e0: 8b 5d 10 mov 0x10(%ebp),%ebx 3e3: 8b 45 ec mov -0x14(%ebp),%eax 3e6: ba 00 00 00 00 mov $0x0,%edx 3eb: f7 f3 div %ebx 3ed: 89 d0 mov %edx,%eax 3ef: 0f b6 80 68 0a 00 00 movzbl 0xa68(%eax),%eax 3f6: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1) }while((x /= base) != 0); 3fa: 8b 5d 10 mov 0x10(%ebp),%ebx 3fd: 8b 45 ec mov -0x14(%ebp),%eax 400: ba 00 00 00 00 mov $0x0,%edx 405: f7 f3 div %ebx 407: 89 45 ec mov %eax,-0x14(%ebp) 40a: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 40e: 75 c7 jne 3d7 <printint+0x38> if(neg) 410: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 414: 74 2d je 443 <printint+0xa4> buf[i++] = '-'; 416: 8b 45 f4 mov -0xc(%ebp),%eax 419: 8d 50 01 lea 0x1(%eax),%edx 41c: 89 55 f4 mov %edx,-0xc(%ebp) 41f: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1) while(--i >= 0) 424: eb 1d jmp 443 <printint+0xa4> putc(fd, buf[i]); 426: 8d 55 dc lea -0x24(%ebp),%edx 429: 8b 45 f4 mov -0xc(%ebp),%eax 42c: 01 d0 add %edx,%eax 42e: 0f b6 00 movzbl (%eax),%eax 431: 0f be c0 movsbl %al,%eax 434: 83 ec 08 sub $0x8,%esp 437: 50 push %eax 438: ff 75 08 pushl 0x8(%ebp) 43b: e8 3c ff ff ff call 37c <putc> 440: 83 c4 10 add $0x10,%esp buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 443: 83 6d f4 01 subl $0x1,-0xc(%ebp) 447: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 44b: 79 d9 jns 426 <printint+0x87> putc(fd, buf[i]); } 44d: 90 nop 44e: 8b 5d fc mov -0x4(%ebp),%ebx 451: c9 leave 452: c3 ret 00000453 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 453: 55 push %ebp 454: 89 e5 mov %esp,%ebp 456: 83 ec 28 sub $0x28,%esp char *s; int c, i, state; uint *ap; state = 0; 459: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) ap = (uint*)(void*)&fmt + 1; 460: 8d 45 0c lea 0xc(%ebp),%eax 463: 83 c0 04 add $0x4,%eax 466: 89 45 e8 mov %eax,-0x18(%ebp) for(i = 0; fmt[i]; i++){ 469: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 470: e9 59 01 00 00 jmp 5ce <printf+0x17b> c = fmt[i] & 0xff; 475: 8b 55 0c mov 0xc(%ebp),%edx 478: 8b 45 f0 mov -0x10(%ebp),%eax 47b: 01 d0 add %edx,%eax 47d: 0f b6 00 movzbl (%eax),%eax 480: 0f be c0 movsbl %al,%eax 483: 25 ff 00 00 00 and $0xff,%eax 488: 89 45 e4 mov %eax,-0x1c(%ebp) if(state == 0){ 48b: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 48f: 75 2c jne 4bd <printf+0x6a> if(c == '%'){ 491: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 495: 75 0c jne 4a3 <printf+0x50> state = '%'; 497: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp) 49e: e9 27 01 00 00 jmp 5ca <printf+0x177> } else { putc(fd, c); 4a3: 8b 45 e4 mov -0x1c(%ebp),%eax 4a6: 0f be c0 movsbl %al,%eax 4a9: 83 ec 08 sub $0x8,%esp 4ac: 50 push %eax 4ad: ff 75 08 pushl 0x8(%ebp) 4b0: e8 c7 fe ff ff call 37c <putc> 4b5: 83 c4 10 add $0x10,%esp 4b8: e9 0d 01 00 00 jmp 5ca <printf+0x177> } } else if(state == '%'){ 4bd: 83 7d ec 25 cmpl $0x25,-0x14(%ebp) 4c1: 0f 85 03 01 00 00 jne 5ca <printf+0x177> if(c == 'd'){ 4c7: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp) 4cb: 75 1e jne 4eb <printf+0x98> printint(fd, *ap, 10, 1); 4cd: 8b 45 e8 mov -0x18(%ebp),%eax 4d0: 8b 00 mov (%eax),%eax 4d2: 6a 01 push $0x1 4d4: 6a 0a push $0xa 4d6: 50 push %eax 4d7: ff 75 08 pushl 0x8(%ebp) 4da: e8 c0 fe ff ff call 39f <printint> 4df: 83 c4 10 add $0x10,%esp ap++; 4e2: 83 45 e8 04 addl $0x4,-0x18(%ebp) 4e6: e9 d8 00 00 00 jmp 5c3 <printf+0x170> } else if(c == 'x' || c == 'p'){ 4eb: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp) 4ef: 74 06 je 4f7 <printf+0xa4> 4f1: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp) 4f5: 75 1e jne 515 <printf+0xc2> printint(fd, *ap, 16, 0); 4f7: 8b 45 e8 mov -0x18(%ebp),%eax 4fa: 8b 00 mov (%eax),%eax 4fc: 6a 00 push $0x0 4fe: 6a 10 push $0x10 500: 50 push %eax 501: ff 75 08 pushl 0x8(%ebp) 504: e8 96 fe ff ff call 39f <printint> 509: 83 c4 10 add $0x10,%esp ap++; 50c: 83 45 e8 04 addl $0x4,-0x18(%ebp) 510: e9 ae 00 00 00 jmp 5c3 <printf+0x170> } else if(c == 's'){ 515: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp) 519: 75 43 jne 55e <printf+0x10b> s = (char*)*ap; 51b: 8b 45 e8 mov -0x18(%ebp),%eax 51e: 8b 00 mov (%eax),%eax 520: 89 45 f4 mov %eax,-0xc(%ebp) ap++; 523: 83 45 e8 04 addl $0x4,-0x18(%ebp) if(s == 0) 527: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 52b: 75 25 jne 552 <printf+0xff> s = "(null)"; 52d: c7 45 f4 12 08 00 00 movl $0x812,-0xc(%ebp) while(*s != 0){ 534: eb 1c jmp 552 <printf+0xff> putc(fd, *s); 536: 8b 45 f4 mov -0xc(%ebp),%eax 539: 0f b6 00 movzbl (%eax),%eax 53c: 0f be c0 movsbl %al,%eax 53f: 83 ec 08 sub $0x8,%esp 542: 50 push %eax 543: ff 75 08 pushl 0x8(%ebp) 546: e8 31 fe ff ff call 37c <putc> 54b: 83 c4 10 add $0x10,%esp s++; 54e: 83 45 f4 01 addl $0x1,-0xc(%ebp) } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 552: 8b 45 f4 mov -0xc(%ebp),%eax 555: 0f b6 00 movzbl (%eax),%eax 558: 84 c0 test %al,%al 55a: 75 da jne 536 <printf+0xe3> 55c: eb 65 jmp 5c3 <printf+0x170> putc(fd, *s); s++; } } else if(c == 'c'){ 55e: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp) 562: 75 1d jne 581 <printf+0x12e> putc(fd, *ap); 564: 8b 45 e8 mov -0x18(%ebp),%eax 567: 8b 00 mov (%eax),%eax 569: 0f be c0 movsbl %al,%eax 56c: 83 ec 08 sub $0x8,%esp 56f: 50 push %eax 570: ff 75 08 pushl 0x8(%ebp) 573: e8 04 fe ff ff call 37c <putc> 578: 83 c4 10 add $0x10,%esp ap++; 57b: 83 45 e8 04 addl $0x4,-0x18(%ebp) 57f: eb 42 jmp 5c3 <printf+0x170> } else if(c == '%'){ 581: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 585: 75 17 jne 59e <printf+0x14b> putc(fd, c); 587: 8b 45 e4 mov -0x1c(%ebp),%eax 58a: 0f be c0 movsbl %al,%eax 58d: 83 ec 08 sub $0x8,%esp 590: 50 push %eax 591: ff 75 08 pushl 0x8(%ebp) 594: e8 e3 fd ff ff call 37c <putc> 599: 83 c4 10 add $0x10,%esp 59c: eb 25 jmp 5c3 <printf+0x170> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 59e: 83 ec 08 sub $0x8,%esp 5a1: 6a 25 push $0x25 5a3: ff 75 08 pushl 0x8(%ebp) 5a6: e8 d1 fd ff ff call 37c <putc> 5ab: 83 c4 10 add $0x10,%esp putc(fd, c); 5ae: 8b 45 e4 mov -0x1c(%ebp),%eax 5b1: 0f be c0 movsbl %al,%eax 5b4: 83 ec 08 sub $0x8,%esp 5b7: 50 push %eax 5b8: ff 75 08 pushl 0x8(%ebp) 5bb: e8 bc fd ff ff call 37c <putc> 5c0: 83 c4 10 add $0x10,%esp } state = 0; 5c3: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 5ca: 83 45 f0 01 addl $0x1,-0x10(%ebp) 5ce: 8b 55 0c mov 0xc(%ebp),%edx 5d1: 8b 45 f0 mov -0x10(%ebp),%eax 5d4: 01 d0 add %edx,%eax 5d6: 0f b6 00 movzbl (%eax),%eax 5d9: 84 c0 test %al,%al 5db: 0f 85 94 fe ff ff jne 475 <printf+0x22> putc(fd, c); } state = 0; } } } 5e1: 90 nop 5e2: c9 leave 5e3: c3 ret 000005e4 <free>: static Header base; static Header *freep; void free(void *ap) { 5e4: 55 push %ebp 5e5: 89 e5 mov %esp,%ebp 5e7: 83 ec 10 sub $0x10,%esp Header *bp, *p; bp = (Header*)ap - 1; 5ea: 8b 45 08 mov 0x8(%ebp),%eax 5ed: 83 e8 08 sub $0x8,%eax 5f0: 89 45 f8 mov %eax,-0x8(%ebp) for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 5f3: a1 84 0a 00 00 mov 0xa84,%eax 5f8: 89 45 fc mov %eax,-0x4(%ebp) 5fb: eb 24 jmp 621 <free+0x3d> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 5fd: 8b 45 fc mov -0x4(%ebp),%eax 600: 8b 00 mov (%eax),%eax 602: 3b 45 fc cmp -0x4(%ebp),%eax 605: 77 12 ja 619 <free+0x35> 607: 8b 45 f8 mov -0x8(%ebp),%eax 60a: 3b 45 fc cmp -0x4(%ebp),%eax 60d: 77 24 ja 633 <free+0x4f> 60f: 8b 45 fc mov -0x4(%ebp),%eax 612: 8b 00 mov (%eax),%eax 614: 3b 45 f8 cmp -0x8(%ebp),%eax 617: 77 1a ja 633 <free+0x4f> free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 619: 8b 45 fc mov -0x4(%ebp),%eax 61c: 8b 00 mov (%eax),%eax 61e: 89 45 fc mov %eax,-0x4(%ebp) 621: 8b 45 f8 mov -0x8(%ebp),%eax 624: 3b 45 fc cmp -0x4(%ebp),%eax 627: 76 d4 jbe 5fd <free+0x19> 629: 8b 45 fc mov -0x4(%ebp),%eax 62c: 8b 00 mov (%eax),%eax 62e: 3b 45 f8 cmp -0x8(%ebp),%eax 631: 76 ca jbe 5fd <free+0x19> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ 633: 8b 45 f8 mov -0x8(%ebp),%eax 636: 8b 40 04 mov 0x4(%eax),%eax 639: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 640: 8b 45 f8 mov -0x8(%ebp),%eax 643: 01 c2 add %eax,%edx 645: 8b 45 fc mov -0x4(%ebp),%eax 648: 8b 00 mov (%eax),%eax 64a: 39 c2 cmp %eax,%edx 64c: 75 24 jne 672 <free+0x8e> bp->s.size += p->s.ptr->s.size; 64e: 8b 45 f8 mov -0x8(%ebp),%eax 651: 8b 50 04 mov 0x4(%eax),%edx 654: 8b 45 fc mov -0x4(%ebp),%eax 657: 8b 00 mov (%eax),%eax 659: 8b 40 04 mov 0x4(%eax),%eax 65c: 01 c2 add %eax,%edx 65e: 8b 45 f8 mov -0x8(%ebp),%eax 661: 89 50 04 mov %edx,0x4(%eax) bp->s.ptr = p->s.ptr->s.ptr; 664: 8b 45 fc mov -0x4(%ebp),%eax 667: 8b 00 mov (%eax),%eax 669: 8b 10 mov (%eax),%edx 66b: 8b 45 f8 mov -0x8(%ebp),%eax 66e: 89 10 mov %edx,(%eax) 670: eb 0a jmp 67c <free+0x98> } else bp->s.ptr = p->s.ptr; 672: 8b 45 fc mov -0x4(%ebp),%eax 675: 8b 10 mov (%eax),%edx 677: 8b 45 f8 mov -0x8(%ebp),%eax 67a: 89 10 mov %edx,(%eax) if(p + p->s.size == bp){ 67c: 8b 45 fc mov -0x4(%ebp),%eax 67f: 8b 40 04 mov 0x4(%eax),%eax 682: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 689: 8b 45 fc mov -0x4(%ebp),%eax 68c: 01 d0 add %edx,%eax 68e: 3b 45 f8 cmp -0x8(%ebp),%eax 691: 75 20 jne 6b3 <free+0xcf> p->s.size += bp->s.size; 693: 8b 45 fc mov -0x4(%ebp),%eax 696: 8b 50 04 mov 0x4(%eax),%edx 699: 8b 45 f8 mov -0x8(%ebp),%eax 69c: 8b 40 04 mov 0x4(%eax),%eax 69f: 01 c2 add %eax,%edx 6a1: 8b 45 fc mov -0x4(%ebp),%eax 6a4: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 6a7: 8b 45 f8 mov -0x8(%ebp),%eax 6aa: 8b 10 mov (%eax),%edx 6ac: 8b 45 fc mov -0x4(%ebp),%eax 6af: 89 10 mov %edx,(%eax) 6b1: eb 08 jmp 6bb <free+0xd7> } else p->s.ptr = bp; 6b3: 8b 45 fc mov -0x4(%ebp),%eax 6b6: 8b 55 f8 mov -0x8(%ebp),%edx 6b9: 89 10 mov %edx,(%eax) freep = p; 6bb: 8b 45 fc mov -0x4(%ebp),%eax 6be: a3 84 0a 00 00 mov %eax,0xa84 } 6c3: 90 nop 6c4: c9 leave 6c5: c3 ret 000006c6 <morecore>: static Header* morecore(uint nu) { 6c6: 55 push %ebp 6c7: 89 e5 mov %esp,%ebp 6c9: 83 ec 18 sub $0x18,%esp char *p; Header *hp; if(nu < 4096) 6cc: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp) 6d3: 77 07 ja 6dc <morecore+0x16> nu = 4096; 6d5: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp) p = sbrk(nu * sizeof(Header)); 6dc: 8b 45 08 mov 0x8(%ebp),%eax 6df: c1 e0 03 shl $0x3,%eax 6e2: 83 ec 0c sub $0xc,%esp 6e5: 50 push %eax 6e6: e8 59 fc ff ff call 344 <sbrk> 6eb: 83 c4 10 add $0x10,%esp 6ee: 89 45 f4 mov %eax,-0xc(%ebp) if(p == (char*)-1) 6f1: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp) 6f5: 75 07 jne 6fe <morecore+0x38> return 0; 6f7: b8 00 00 00 00 mov $0x0,%eax 6fc: eb 26 jmp 724 <morecore+0x5e> hp = (Header*)p; 6fe: 8b 45 f4 mov -0xc(%ebp),%eax 701: 89 45 f0 mov %eax,-0x10(%ebp) hp->s.size = nu; 704: 8b 45 f0 mov -0x10(%ebp),%eax 707: 8b 55 08 mov 0x8(%ebp),%edx 70a: 89 50 04 mov %edx,0x4(%eax) free((void*)(hp + 1)); 70d: 8b 45 f0 mov -0x10(%ebp),%eax 710: 83 c0 08 add $0x8,%eax 713: 83 ec 0c sub $0xc,%esp 716: 50 push %eax 717: e8 c8 fe ff ff call 5e4 <free> 71c: 83 c4 10 add $0x10,%esp return freep; 71f: a1 84 0a 00 00 mov 0xa84,%eax } 724: c9 leave 725: c3 ret 00000726 <malloc>: void* malloc(uint nbytes) { 726: 55 push %ebp 727: 89 e5 mov %esp,%ebp 729: 83 ec 18 sub $0x18,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 72c: 8b 45 08 mov 0x8(%ebp),%eax 72f: 83 c0 07 add $0x7,%eax 732: c1 e8 03 shr $0x3,%eax 735: 83 c0 01 add $0x1,%eax 738: 89 45 ec mov %eax,-0x14(%ebp) if((prevp = freep) == 0){ 73b: a1 84 0a 00 00 mov 0xa84,%eax 740: 89 45 f0 mov %eax,-0x10(%ebp) 743: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 747: 75 23 jne 76c <malloc+0x46> base.s.ptr = freep = prevp = &base; 749: c7 45 f0 7c 0a 00 00 movl $0xa7c,-0x10(%ebp) 750: 8b 45 f0 mov -0x10(%ebp),%eax 753: a3 84 0a 00 00 mov %eax,0xa84 758: a1 84 0a 00 00 mov 0xa84,%eax 75d: a3 7c 0a 00 00 mov %eax,0xa7c base.s.size = 0; 762: c7 05 80 0a 00 00 00 movl $0x0,0xa80 769: 00 00 00 } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 76c: 8b 45 f0 mov -0x10(%ebp),%eax 76f: 8b 00 mov (%eax),%eax 771: 89 45 f4 mov %eax,-0xc(%ebp) if(p->s.size >= nunits){ 774: 8b 45 f4 mov -0xc(%ebp),%eax 777: 8b 40 04 mov 0x4(%eax),%eax 77a: 3b 45 ec cmp -0x14(%ebp),%eax 77d: 72 4d jb 7cc <malloc+0xa6> if(p->s.size == nunits) 77f: 8b 45 f4 mov -0xc(%ebp),%eax 782: 8b 40 04 mov 0x4(%eax),%eax 785: 3b 45 ec cmp -0x14(%ebp),%eax 788: 75 0c jne 796 <malloc+0x70> prevp->s.ptr = p->s.ptr; 78a: 8b 45 f4 mov -0xc(%ebp),%eax 78d: 8b 10 mov (%eax),%edx 78f: 8b 45 f0 mov -0x10(%ebp),%eax 792: 89 10 mov %edx,(%eax) 794: eb 26 jmp 7bc <malloc+0x96> else { p->s.size -= nunits; 796: 8b 45 f4 mov -0xc(%ebp),%eax 799: 8b 40 04 mov 0x4(%eax),%eax 79c: 2b 45 ec sub -0x14(%ebp),%eax 79f: 89 c2 mov %eax,%edx 7a1: 8b 45 f4 mov -0xc(%ebp),%eax 7a4: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; 7a7: 8b 45 f4 mov -0xc(%ebp),%eax 7aa: 8b 40 04 mov 0x4(%eax),%eax 7ad: c1 e0 03 shl $0x3,%eax 7b0: 01 45 f4 add %eax,-0xc(%ebp) p->s.size = nunits; 7b3: 8b 45 f4 mov -0xc(%ebp),%eax 7b6: 8b 55 ec mov -0x14(%ebp),%edx 7b9: 89 50 04 mov %edx,0x4(%eax) } freep = prevp; 7bc: 8b 45 f0 mov -0x10(%ebp),%eax 7bf: a3 84 0a 00 00 mov %eax,0xa84 return (void*)(p + 1); 7c4: 8b 45 f4 mov -0xc(%ebp),%eax 7c7: 83 c0 08 add $0x8,%eax 7ca: eb 3b jmp 807 <malloc+0xe1> } if(p == freep) 7cc: a1 84 0a 00 00 mov 0xa84,%eax 7d1: 39 45 f4 cmp %eax,-0xc(%ebp) 7d4: 75 1e jne 7f4 <malloc+0xce> if((p = morecore(nunits)) == 0) 7d6: 83 ec 0c sub $0xc,%esp 7d9: ff 75 ec pushl -0x14(%ebp) 7dc: e8 e5 fe ff ff call 6c6 <morecore> 7e1: 83 c4 10 add $0x10,%esp 7e4: 89 45 f4 mov %eax,-0xc(%ebp) 7e7: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 7eb: 75 07 jne 7f4 <malloc+0xce> return 0; 7ed: b8 00 00 00 00 mov $0x0,%eax 7f2: eb 13 jmp 807 <malloc+0xe1> nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 7f4: 8b 45 f4 mov -0xc(%ebp),%eax 7f7: 89 45 f0 mov %eax,-0x10(%ebp) 7fa: 8b 45 f4 mov -0xc(%ebp),%eax 7fd: 8b 00 mov (%eax),%eax 7ff: 89 45 f4 mov %eax,-0xc(%ebp) return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } 802: e9 6d ff ff ff jmp 774 <malloc+0x4e> } 807: c9 leave 808: c3 ret
34.170772
60
0.421192
[ "MIT-0" ]
carsontyler/CS3100_Assignment4
echo.asm
41,620
Assembly
; ######################################################################### hEditProc proc hCtl :DWORD, uMsg :DWORD, wParam :DWORD, lParam :DWORD LOCAL Pt :POINT LOCAL hSM :DWORD .if uMsg == WM_KEYUP ; -------------------------- ; process the F1 to F3 keys ; -------------------------- .if wParam == VK_F1 ; ------------------------- ; impliment help code here ; ------------------------- .elseif wParam == VK_F2 invoke CallSearchDlg return 0 .elseif wParam == VK_F3 invoke TextFind,ADDR SearchText, TextLen .endif .elseif uMsg == WM_RBUTTONDOWN invoke GetCursorPos,ADDR Pt invoke GetSubMenu,hMnu,menu_popup mov hSM, eax invoke TrackPopupMenu,hSM,TPM_LEFTALIGN or TPM_LEFTBUTTON, Pt.x,Pt.y,0, hWnd,NULL .endif invoke CallWindowProc,lpfnhEditProc,hCtl,uMsg,wParam,lParam ret hEditProc endp ; #########################################################################
27
75
0.417989
[ "MIT" ]
AlexRogalskiy/Masm
exampl07/shuflarr/unique_riched/edproc.asm
1,134
Assembly
.constant_pool .const 0 string [start] .const 1 string [constructor] .const 2 string [2.0 * (49.0 / 7.0 - 3.0)=] .const 3 real [2.000000] .const 4 real [49.000000] .const 5 real [7.000000] .const 6 real [3.000000] .const 7 int [2] .const 8 string [io.writeln] .end .entity start .valid_context_when (always) .method constructor ldconst 2 --> [2.0 * (49.0 / 7.0 - 3.0)=] ldconst 3 --> [2.000000] ldconst 4 --> [49.000000] ldconst 5 --> [7.000000] div ldconst 6 --> [3.000000] sub mul ldconst 7 --> [2] lcall 8 --> [io.writeln] exit .end .end
27.535714
55
0.453956
[ "MIT" ]
alexgarzao/UOP
testsuite/ubic/expected/expr_real_4.asm
771
Assembly
bits 64 global main section .text main:
5.375
13
0.72093
[ "Unlicense" ]
dbarella/xchg-rax-rax
__tmpl__.asm
43
Assembly
; ****************************************************************************************************************** ; ****************************************************************************************************************** ; ****************************************************************************************************************** ; ; Machine Language Monitor ; ; ****************************************************************************************************************** ; ****************************************************************************************************************** ; ****************************************************************************************************************** cpu sc/mp cursor = 0xC00 ; cursor position current = 0xC01 ; current address hi,lo parPosn = 0xC03 ; current param offset in buffer (low addr) kbdBuffer = 0xC04 ; 12 character keyboard buffer kbdBufferLn = 12 codeStart = kbdBuffer+kbdBufferLn ; code starts here. org 0x0000 nop ; ****************************************************************************************************************** ; ; Clear the screen ; ; ****************************************************************************************************************** ClearScreen: xpal p1 ; clear screen ldi ' ' st @1(p1) xpal p1 jp ClearScreen ; ****************************************************************************************************************** ; ; Find Top of Memory to initialise the stack. ; ; ****************************************************************************************************************** ldi 0x80 ; point P2 to theoretical top of RAM + 64 xpah p2 ; e.g. $803F ldi 0x3F xpal p2 FindTopMemory: ldi 0xA5 ; try to write this to memory st @-64(p2) ; predecrementing by 64. xor (p2) ; did it write correctly. jnz FindTopMemory ; now P2 points to top of memory. ; ****************************************************************************************************************** ; ; Reset cursor position and current address. ; ; ****************************************************************************************************************** ldi Cursor/256 ; reset the cursor position to TOS xpah p1 ldi Cursor&255 xpal p1 ldi 0 st @1(p1) ldi codeStart/256 ; reset current address to code start st @1(p1) ldi codeStart&255 st @1(p1) ; **************************************************************************************************************** ; ; Main Loop ; ; **************************************************************************************************************** CommandMainLoop: ldi (PrintAddressData-1)/256 ; print Address and Data there xpah p3 ldi (PrintAddressData-1)&255 xpal p3 ldi 1 xppc p3 ldi (PrintCharacter-1)/256 ; set P3 = print character. xpah p3 ldi (PrintCharacter-1)&255 xpal p3 ldi '.' xppc p3 ; **************************************************************************************************************** ; ; Keyboard Line Input ; ; **************************************************************************************************************** ldi 0 ; set E = character position. xae KeyboardLoop: ldi 0x8 ; set P1 to point to keyboard latch xpah p1 _KBDWaitRelease: ld 0(p1) ; wait for strobe to clear jp _KBDWaitKey jmp _KBDWaitRelease _KBDWaitKey: ld 0(p1) ; wait for strobe, i.e. new key jp _KBDWaitKey ani 0x7F ; throw away bit 7 st -1(p2) ; save key. ldi kbdBuffer/256 ; set P1 = keyboard buffer xpah p1 ldi kbdBuffer&255 xpal p1 ld -1(p2) ; read key xri 8 ; is it backspace jz __KBDBackSpace xri 8!13 ; is it CR, then exit jz __KBDExit lde ; have we a full buffer. xri kbdBufferLn ; if so, ignore the key. jz KeyboardLoop ld -1(p2) ; restore the key. ccl adi 0x20 ; will make lower case -ve jp __KBDNotLower cai 0x20 ; capitalise __KBDNotLower: adi 0xE0 ; fix up. st -0x80(p1) ; save in the buffer using E as index. xppc p3 ; print the character xae ; increment E ccl adi 1 xae jmp KeyboardLoop ; and get the next key. __KBDBackSpace: lde ; get position jz KeyboardLoop ; can't go back if at beginning scl ; go back 1 from E cai 1 xae ldi 8 ; print a backspace xppc p3 jmp KeyboardLoop ; and go round again. __KBDExit: st -0x80(p1) ; add the ASCIIZ terminator. ldi 13 ; print a new line. xppc p3 ; **************************************************************************************************************** ; ; Extract the 5 bit 3 letter (max command value). P1 points to buffer ; ; **************************************************************************************************************** ldi 0 xae ; E contains the LSB of the 5 bit shift lde st -1(p2) ; -1(P2) contains the MSB Extract5Bit: ld (p1) ; look at character ccl ; add 128-65, will be +ve if < 64 adi 128-65 jp __ExtractEnd ldi 5 ; shift current value left 5 times using -2(p2) st -2(p2) __Ex5Shift: lde ; shift E left into CY/L ccl ade xae ld -1(p2) ; shift CY/L into -1(p2) and carry/link add -1(p2) st -1(p2) dld -2(p2) ; done it 5 times ? jnz __Ex5Shift ld @1(p1) ; re-read character. ani 0x1F ; lower 5 bits only. ore ; OR into E xae jmp Extract5Bit ; go and get the next one. __ExtractEnd: ldi parPosn & 255 ; P1.L = Parameter Position, A = first non cmd char xpal p1 st (p1) ; write to parameter position. wait: jmp wait ;jmp CommandMainLoop ; **************************************************************************************************************** ; **************************************************************************************************************** ; ; Print A as a hexadecimal 2 digit value. If CY/L set precede with space ; ; **************************************************************************************************************** ; **************************************************************************************************************** PrintHexByte: st @-1(p2) ; push A and P3, set P3 up to print character ldi (PrintCharacter-1)/256 xpah p3 st @-1(p2) ldi (PrintCharacter-1)&255 xpal p3 st @-1(p2) csa ; check carry jp __PHBNoSpace ; if clear, no space. ldi ' ' ; print leading space xppc p3 __PHBNoSpace: ld 2(p2) ; read digit sr ; convert MSB sr sr sr ccl dai 0x90 dai 0x40 xppc p3 ; print ld 2(p2) ; read digit ani 0x0F ; convert LSB ccl dai 0x90 dai 0x40 xppc p3 ; print ld @1(p2) ; restore P3 & A and Return xpal p3 ld @1(p2) xpah p3 ld @1(p2) xppc p3 jmp PrintHexByte ; **************************************************************************************************************** ; **************************************************************************************************************** ; ; Print Character in A, preserves all registers, re-entrant. Handles 13 (New Line), 8 (Backspace) ; Characters 32 - 95 only. ; ; Rolls to screen top rather than scrolling. ; ; **************************************************************************************************************** ; **************************************************************************************************************** PrintCharacter: st @-1(p2) ; save A ldi Cursor/256 ; save P1, setting up P1 -> Cursor at same time. xpah p1 st @-1(p2) ldi Cursor&255 xpal p1 st @-1(p2) ldi 0 ; save P3, setting up P3 -> Page 0 (Video RAM Write) xpah p3 st @-1(p2) xpal p3 st @-1(p2) ld (p1) ; read cursor position xpal p3 ; put in P3.Low ldi ' ' ; erase the cursor. st 0(p3) ld 4(p2) ; read character to print. xri 13 ; is it CR ? jz __PCNewLine ; if so, go to new line. xri 13!8 ; is it Backspace ? jz __PCBackSpace ld 4(p2) ; get character to print ani 0x3F ; make 6 bit ASCII st @1(p3) ; write into P3, e.g. the screen and bump it. ild (p1) ; increment cursor position and load ani 15 ; are we at line start ? jnz __PCExit ; if so, erase the current line. __PCBlankNewLine: ldi 16 ; count to 16, the number of spaces to write out. st -1(p2) __PCBlankNewLineLoop: ldi ' ' st @1(p3) dld -1(p2) jnz __PCBlankNewLineLoop __PCExit: ld (p1) ; read cursor xpal p3 ; put in P3.L ldi 0x9B ; shaded block cursor on screen st (p3) ld @1(p2) ; restore P3 xpal p3 ld @1(p2) xpah p3 ld @1(p2) ; restore P1 xpal p1 ld @1(p2) xpah p1 ld @1(p2) ; restore A and Return. xppc p3 jmp PrintCharacter ; and it is re-entrant. __PCBackSpace: xpal p3 ; get current cursor position jz __PCExit ; if top of screen then exit. dld (p1) ; backspace and load cursor xpal p3 ; put in P3 ldi ' ' ; erase character there st (p3) jmp __PCExit ; and exit. __PCNewLine: ld (p1) ; read cursor position ani 0x70 ; line ccl ; next line adi 0x10 st (p1) ; write back xpal p3 ; put in P3.L jmp __PCBlankNewLine ; **************************************************************************************************************** ; **************************************************************************************************************** ; ; Print current address followed by A data bytes. Doesn't update current address ; ; **************************************************************************************************************** ; **************************************************************************************************************** PrintAddressData: st @-1(p2) ; save count, we don't restore this. ldi (PrintHexByte-1)/256 ; save and set up P3 xpah p3 st @-1(p2) ldi (PrintHexByte-1)&255 xpal p3 st @-1(p2) ldi current / 256 ; point P1 to current address xpah p1 ldi current & 255 xpal p1 ld 0(p1) ; read high byte of address ccl xppc p3 ; print w/o leading space ld 1(p1) ; read low byte of address ccl xppc p3 ; print w/o leading space. xae ; put in E ld 0(p1) ; high byte to P1.H xpah p1 lde ; low byte to P1.H xpal p1 _PADLoop: dld 2(p2) ; decrement counter jp _PADPrint ; if +ve print another byte ld @1(p2) ; restore P3, skipping A hence @2 xpal p3 ld @2(p2) xpah p3 xppc p3 jmp PrintAddressData _PADPrint: ld @1(p1) ; read byte advance pointer scl xppc p3 ; print with space. jmp _PADLoop
32.026525
116
0.379079
[ "MIT" ]
paulscottrobson/retrochallenge-jan-2016
software_releases/Post12-monitor.asm
12,074
Assembly
%include "io.mac" section .data len_needle dd 0 len_haystack dd 0 section .text global my_strstr extern printf my_strstr: ;; DO NOT MODIFY push ebp mov ebp, esp pusha mov edi, [ebp + 8] ; substr_index mov esi, [ebp + 12] ; haystack mov ebx, [ebp + 16] ; needle mov ecx, [ebp + 20] ; haystack_len mov edx, [ebp + 24] ; needle_len ;; DO NOT MODIFY ; Make ecx = haystack_len - needle_len + 1. ; This is done in order not to search for the needle in the haystack if ; there aren't as many characters left in the haystack as in the needle. sub ecx, edx inc ecx ; Keep the length of the needle and (haystack_legth - needle_length + 1) ; for later. mov dword[len_needle], edx mov dword[len_haystack], ecx ; Set ecx to 0. xor ecx, ecx ; Loop through the haystack. loop_haystack: ; Check if the end if the haystack has been reached( => no match was found). cmp ecx, dword [len_haystack] je no_needle_in_haystack ; Set edx to 0. xor edx, edx ; Loop through the needle. loop_needle: ; If the end of the needle has been reached then it's a match. cmp edx, dword [len_needle] je done ; Move (ecx + edx)'th character from the haystack to al. push ecx add ecx, edx mov al, byte [esi + ecx] pop ecx ; Check if the character from al matches the edx'th character from the ; needle. cmp al, byte [ebx + edx] jne no_match ; Move to the next character from the needle. inc edx jmp loop_needle ; Move to the next character from the haystack. no_match: inc ecx jmp loop_haystack ; If there wasn't any match set ecx to be haystack_length + 1 by adding the ; needle's length to it. no_needle_in_haystack: add ecx, dword [len_needle] ; Move to [edi] the index of the first match of the needle in the haystack or ; haystack's length if there isn't any match. done: mov [edi], ecx ;; DO NOT MODIFY popa leave ret ;; DO NOT MODIFY
22.910112
80
0.649338
[ "MIT" ]
vioo-bkp/Projects-Year-2-University
IOCLA - .asm/IOCLA_H2_Strings/my_strstr.asm
2,039
Assembly
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r14 push %rbp push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0x5eb2, %rcx clflush (%rcx) nop nop xor %rsi, %rsi movups (%rcx), %xmm0 vpextrq $0, %xmm0, %rbx nop nop nop mfence lea addresses_WC_ht+0x6902, %rsi lea addresses_normal_ht+0x1b01a, %rdi nop nop nop nop inc %r14 mov $66, %rcx rep movsb nop nop nop nop nop and $24415, %r14 lea addresses_UC_ht+0x1d665, %rsi lea addresses_WC_ht+0xddee, %rdi nop nop xor $25909, %r12 mov $26, %rcx rep movsb nop nop nop nop inc %r12 lea addresses_A_ht+0xd73a, %r12 clflush (%r12) nop nop nop sub $44086, %r14 mov (%r12), %di nop nop nop xor %rdi, %rdi lea addresses_WC_ht+0xdeb2, %rsi lea addresses_UC_ht+0x1af52, %rdi add %rbp, %rbp mov $125, %rcx rep movsb nop nop nop nop and $41857, %rdi lea addresses_UC_ht+0x6562, %rsi sub $32560, %rcx movb (%rsi), %bl nop nop add %r12, %r12 lea addresses_D_ht+0x1aa5c, %rsi lea addresses_UC_ht+0x10172, %rdi nop and %r12, %r12 mov $26, %rcx rep movsb nop xor $48239, %r14 lea addresses_D_ht+0x19c32, %r14 nop sub $25759, %rsi vmovups (%r14), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $1, %xmm7, %rbx nop nop nop sub %rcx, %rcx lea addresses_UC_ht+0x1165a, %rsi lea addresses_WC_ht+0xe702, %rdi nop nop nop nop dec %r14 mov $107, %rcx rep movsw and $29765, %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %r14 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r13 push %r14 push %r8 push %r9 // Load lea addresses_PSE+0xea2e, %r11 nop nop nop sub %r14, %r14 vmovups (%r11), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $1, %xmm0, %r12 cmp $33757, %r14 // Store lea addresses_RW+0x1e356, %r14 nop nop nop nop nop cmp %r9, %r9 movb $0x51, (%r14) nop nop nop nop inc %r8 // Store lea addresses_PSE+0xdb8a, %r13 inc %r11 mov $0x5152535455565758, %r12 movq %r12, (%r13) nop nop add %r9, %r9 // Store lea addresses_A+0x1b6b2, %r12 clflush (%r12) nop nop nop cmp %r10, %r10 mov $0x5152535455565758, %r14 movq %r14, (%r12) nop nop nop nop add %r12, %r12 // Store mov $0xef4, %r11 nop nop nop sub $57255, %r13 movw $0x5152, (%r11) cmp %r9, %r9 // Store lea addresses_A+0x554a, %r8 nop nop nop nop and $9256, %r11 movl $0x51525354, (%r8) nop add $32453, %r14 // Load lea addresses_A+0x18080, %r9 nop nop nop nop nop add $550, %r14 mov (%r9), %r11d nop xor $5928, %r10 // Faulty Load lea addresses_RW+0x32b2, %r11 xor %r10, %r10 mov (%r11), %r12 lea oracles, %r9 and $0xff, %r12 shlq $12, %r12 mov (%r9,%r12,1), %r12 pop %r9 pop %r8 pop %r14 pop %r13 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_RW', 'AVXalign': False, 'size': 1}} {'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 1, 'type': 'addresses_PSE', 'AVXalign': True, 'size': 8}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_A', 'AVXalign': False, 'size': 8}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_P', 'AVXalign': False, 'size': 2}} {'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 3, 'type': 'addresses_A', 'AVXalign': False, 'size': 4}} {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 4, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_normal_ht'}} {'src': {'same': False, 'congruent': 0, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 2, 'type': 'addresses_WC_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 9, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_UC_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 0, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 5, 'type': 'addresses_UC_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 0, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}} {'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 */
32.220884
2,999
0.652
[ "MIT" ]
danielmgmi/medusa
Transynther/_processed/NONE/_xt_/i9-9900K_12_0xa0.log_21829_1605.asm
8,023
Assembly
;************************************************************************** ; arch/z80/src/ez80/ez80f92_init.asm ; ; Licensed to the Apache Software Foundation (ASF) under one or more ; contributor license agreements. See the NOTICE file distributed with ; this work for additional information regarding copyright ownership. The ; ASF licenses this file to you under the Apache License, Version 2.0 (the ; "License"); you may not use this file except in compliance with the ; License. You may obtain a copy of the License at ; ; http://www.apache.org/licenses/LICENSE-2.0 ; ; Unless required by applicable law or agreed to in writing, software ; distributed under the License is distributed on an "AS IS" BASIS, WITHOUT ; WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the ; License for the specific language governing permissions and limitations ; under the License. ; ;************************************************************************** ;************************************************************************** ; Included Files ;************************************************************************** include "ez80F92.inc" ;************************************************************************** ; Global symbols used ;************************************************************************** ; Exported symbols xdef _ez80_init xdef _ez80_initsysclk ; Imported symbols xref __CS0_LBR_INIT_PARAM xref __CS0_UBR_INIT_PARAM xref __CS0_CTL_INIT_PARAM xref __CS1_LBR_INIT_PARAM xref __CS1_UBR_INIT_PARAM xref __CS1_CTL_INIT_PARAM xref __CS2_LBR_INIT_PARAM xref __CS2_UBR_INIT_PARAM xref __CS2_CTL_INIT_PARAM xref __CS3_LBR_INIT_PARAM xref __CS3_UBR_INIT_PARAM xref __CS3_CTL_INIT_PARAM xref __CS0_BMC_INIT_PARAM xref __CS1_BMC_INIT_PARAM xref __CS2_BMC_INIT_PARAM xref __CS3_BMC_INIT_PARAM xref __FLASH_CTL_INIT_PARAM xref __FLASH_ADDR_U_INIT_PARAM xref __RAM_CTL_INIT_PARAM xref __RAM_ADDR_U_INIT_PARAM ;************************************************************************** ; Chip-specific initialization logic ;************************************************************************** ; Minimum default initialization for eZ80F91 define .STARTUP, space = ROM segment .STARTUP .assume ADL = 1 _ez80_init: ; Disable internal peripheral interrupt sources ld a, %ff out0 (PB_DDR), a ; GPIO out0 (PC_DDR), a out0 (PD_DDR), a ld a, %00 out0 (PB_ALT1), a out0 (PC_ALT1), a out0 (PD_ALT1), a out0 (PB_ALT2), a out0 (PC_ALT2), a out0 (PD_ALT2), a out0 (UART0_IER), a ; UARTs out0 (UART1_IER), a out0 (I2C_CTL), a ; I2C out0 (FLASH_IRQ), a ; Flash ld a, %04 out0 (SPI_CTL), a ; SPI in0 a, (RTC_CTRL) ; RTC, and a, %be out0 (RTC_CTRL), a ; Configure external memory/io ld a, __CS0_LBR_INIT_PARAM out0 (CS0_LBR), a ld a, __CS0_UBR_INIT_PARAM out0 (CS0_UBR), a ld a, __CS0_BMC_INIT_PARAM out0 (CS0_BMC), a ld a, __CS0_CTL_INIT_PARAM out0 (CS0_CTL), a ld a, __CS1_LBR_INIT_PARAM out0 (CS1_LBR), a ld a, __CS1_UBR_INIT_PARAM out0 (CS1_UBR), a ld a, __CS1_BMC_INIT_PARAM out0 (CS1_BMC), a ld a, __CS1_CTL_INIT_PARAM out0 (CS1_CTL), a ld a, __CS2_LBR_INIT_PARAM out0 (CS2_LBR), a ld a, __CS2_UBR_INIT_PARAM out0 (CS2_UBR), a ld a, __CS2_BMC_INIT_PARAM out0 (CS2_BMC), a ld a, __CS2_CTL_INIT_PARAM out0 (CS2_CTL), a ld a, __CS3_LBR_INIT_PARAM out0 (CS3_LBR), a ld a, __CS3_UBR_INIT_PARAM out0 (CS3_UBR), a ld a, __CS3_BMC_INIT_PARAM out0 (CS3_BMC), a ld a, __CS3_CTL_INIT_PARAM out0 (CS3_CTL), a ; Enable internal memory ld a, __FLASH_ADDR_U_INIT_PARAM out0 (FLASH_ADDR_U), a ld a, __FLASH_CTL_INIT_PARAM out0 (FLASH_CTRL), a ld a, __RAM_ADDR_U_INIT_PARAM out0 (RAM_ADDR_U), a ld a, __RAM_CTL_INIT_PARAM out0 (RAM_CTL), a ret ;***************************************************************************** ; eZ80F91 System Clock Initialization ;***************************************************************************** _ez80_initsysclk: ret ; No PLL end
25.916667
78
0.610932
[ "MIT" ]
19cb0475536a9e7d/nuttx
arch/z80/src/ez80/ez80f92_init.asm
4,043
Assembly
;Spawn location table cryptic documentation ;$A0 |$15B6E - $15B7B (2) Starting room ;$0601 |$15B7C - $15BB3 (8) scroll ranges ;$E2 |$15BB4 - $15BC1 (2) Location X? Scroll Data ;$E8 |$15BC2 - $15BCF (2) Location Y? Scroll Data ;$20 |$15BD0 - $15BDD (2) link x? ;$22 |$15BDE - $15BEB (2) link y? ;$0618 |$15BEC - $15BF9 (2) camera y? ;$061c |$15BFA - $15C07 (2) camera x? ;$0AA1 |$15C08 - $15C0E (1) Starting Location Blockset Type ;$A4 |$15C0F - $15C15 (1) Starting Location Floor Type ;$040C |$15C16 - $15C1C (1) Dungeon Designation ;$EE,$0476|$15C1D - $15C23 (1) ladder and background ;$A6,$A7 |$15C24 - $15C2A (1) scroll properties ;$A9,$AA |$15C2B - $15C31 (1) Scroll Quandrant ;$0696 |$15C32 - $15C3F (2) overworld exit location ;$010E |$15C40 - $15C4D (2) starting location entrance value ;$0132 |$15C4E - $15C54 (1) music ;----------------------------------------------- ; Sanc Spawn point at dark sanc ;----------------------------------------------- org $02D8D4 : dw $112 org $02D8E8 : db $22, $22, $22, $23, $04, $04, $04, $05 org $02D91A : dw $0400 org $02D928 : dw $222e org $02D936 : dw $229a org $02D944 : dw $0480 org $02D952 : dw $00a5 org $02D960 : dw $007F org $02D96D : db $14 org $02D974 : db $00 org $02D97B : db $FF org $02D982 : db $00 org $02D989 : db $02 org $02D990 : db $00 org $02D998 : dw $0000 org $02D9A6 : dw $005A org $02D9B3 : db $12 ; Handle exit from this cave org $308250 ;StartingAreaExitTable dw $0112 : db $53 : dw $001e, $0400, $06e2, $0446, $0758, $046d, $075f : db $00, $00, $00 org $308240 ;StartingAreaExitOffset db $00, $01, $00, $00, $00, $00, $00 ;----------------------------------------------- ; Old man spawn point at End of Cave ;----------------------------------------------- org $02D8DE : dw $00F1 org $02D910 : db $1F, $1E, $1F, $1F, $03, $02, $03, $03 org $02D924 : dw $0300 org $02D932 : dw $1F10 org $02D940 : dw $1FC0 org $02D94E : dw $0378 org $02D95C : dw $0187 org $02D96A : dw $017F org $02D972 : db $06 org $02D979 : db $00 org $02D980 : db $FF org $02D987 : db $00 org $02D98E : db $22 org $02D995 : db $12 org $02D9A2 : dw $0000 org $02D9B0 : dw $0007 org $02D9B8 : db $12 ;-------------------------------------------------------------- ; Make Houlihan exit at Pyramid ;-------------------------------------------------------------- org $02DB68 : dw $0003 org $02DBC9 : db $5b org $02DC55 : dw $0b0e org $02DCF3 : dw $075a org $02DD91 : dw $0674 org $02DE2F : dw $07a8 org $02DECD : dw $06e8 org $02DF6B : dw $07c7 org $02E009 : dw $06f3 org $02E06A : db $06 org $02E0B9 : db $fa org $02E145 : dw $0000 org $02E1E3 : dw $0000 ;-------------------------------------------------------------- ; Make Houlihan exit at C-Shaped House ;-------------------------------------------------------------- ;org $02DB68 : dw $0003 ;org $02DBC9 : db $58 ;org $02DC55 : dw $09d8 ;org $02DCF3 : dw $0744 ;org $02DD91 : dw $02ce ;org $02DE2F : dw $0797 ;org $02DECD : dw $0348 ;org $02DF6B : dw $07b3 ;org $02E009 : dw $0353 ;org $02E06A : db $0a ;org $02E0B9 : db $f6 ;org $02E145 : dw $0DE8 ;org $02E1E3 : dw $0000 ;-------------------------------------------------------------- ; Inverted Exit Shuffles ;-------------------------------------------------------------- ; swap bomb shop and links house org $02DB8C+$00 : db $6C org $1BBB73+$00 : db $53 org $1BBB73+$52 : db $01 ; swap AT and GT org $1BBB73+$23 : db $37 org $1BBB73+$36 : db $24 org $02DAEE+$38+$38 : dw $00e0 org $02DAEE+$25+$25 : dw $000c ; Bumper Cave (Bottom) => Old Man Cave (West) org $1BBB73+$15 : db $06 org $02DAEE+$17+$17 : dw $00f0 ; Old Man Cave (West) => Bumper Cave (Bottom) org $1BBB73+$05 : db $16 org $02DAEE+$07+$07 : dw $00fb ; Death Mountain Return Cave (West) => Bumper Cave (Top) org $1BBB73+$2d : db $17 org $02DAEE+$2f+$2f : dw $00eb ; Old Man Cave (East) => Death Mountain Return Cave (West) org $1BBB73+$06 : db $2e org $02DAEE+$08+$08 : dw $00e6 ; Bumper Cave (Top) => Dark Death Mountain Fairy org $1BBB73+$16 : db $5e ; Dark Death Mountain Healer Fairy => Old Man Cave (East) org $1BBB73+$6F : db $07 org $02DAEE+$18+$18 : dw $00f1 org $02DB8C+$18 : db $43 org $02DBDB+$18+$18 : dw $1400 org $02DC79+$18+$18 : dw $0294 org $02DD17+$18+$18 : dw $0600 org $02DDB5+$18+$18 : dw $02e8 org $02DE53+$18+$18 : dw $0678 org $02DEF1+$18+$18 : dw $0303 org $02DF8F+$18+$18 : dw $0685 org $02E02D+$18 : db $0a org $02E07C+$18 : db $f6 org $02E0CB+$18+$18 : dw $0000 org $02E169+$18+$18 : dw $0000 ;-------------------------------------------------------------- ; Other inverted ;-------------------------------------------------------------- org $30804A : db $01 ; main toggle org $0283E0 : db $F0 ; residual portal org $02B34D : db $F0 ; residual portal org $06DB78 : db $8B ; residual portal org $05AF79 : db $F0 ; vortex org $0DB3C5 : db $C6 ; vortex org $07A3F4 : db $F0 ; duck org $07A3F4 : db $F0 ; duck org $02E849 : dw $0043, $0056, $0058, $006C, $006F, $0070, $007B, $007F, $001B ; Dark World Flute Spots org $02E8D5 : dw $07C8 ; nudge flute spot 3 out of gargoyle statue org $02E8F7 : dw $01F8 ; nudge flute spot 3 out of gargoyle statue org $07A943 : db $F0 ; Dark to light world mirror org $07A96D : db $D0 ; residual portal? org $07A9A7 : db $F0 ; residual portal? org $07A9F3 : db $F0 ; residual portal? org $07AA3A : db $D0 ; residual portal? org $08D40C : db $D0 ; morph poof org $308174 : db $01 ; ER's Fix fake worlds fix. Currently needed for inverted org $1FED31 : db $0E ; pre-open open TR bomb door org $1FED41 : db $0E ; pre-open open TR bomb door ; Write to StartingAreaOverworldDoor table to indicate the overworld door being used for ; the single entrance spawn point org $308247 ; PC 0x180247 db $00, $5A, $00, $00, $00, $00, $00 org $1AF696 : db #$F0 ;Bat X position (sprite_retreat_bat.asm:130) org $1AF6B2 : db #$33 ;Bat Delay (sprite_retreat_bat.asm:136) ;New Hole Mask Position org $1AF730 db $6A, $9E, $0C, $00 db $7A, $9E, $0C, $00 db $8A, $9E, $0C, $00 db $6A, $AE, $0C, $00 db $7A, $AE, $0C, $00 db $8A, $AE, $0C, $00 db $67, $97, $0C, $00 db $8D, $97, $0C, $00 ;Cryptic documentation of flute/whirlpool table format (all value 16 bit) ;eae5 - Overworld area that the exit leads to ;eb07 $0084 - VRAM locations to place Link at. ;eb29 $e6/0122/0124 - Y Scroll Data ;eb4b $e0/011e/0120 - X Scroll Data ;eb6d $20 - Link's Y Coordinate ;eb8f $22 - Link's X Coordinate ;ebb1 $0618 - Camera Y Coordinate ;ebd3 $061c - Camera X Coordinate ;ebf5 $0624- Ukn1 in HM ;ec17 $0628- Ukn2 in HM ;adjust flute spot 9 position org $02E87B : dw $00ae org $02E89D : dw $0610 org $02E8BF : dw $077e org $02E8E1 : dw $0672 org $02E903 : dw $07f8 org $02E925 : dw $067d org $02E947 : dw $0803 org $02E969 : dw $0000 org $02E98B : dw $FFF2 ; aga tower exit/ pyramid spawn (now hyrule castle ledge spawn) org $02DAEE+$06+$06 : dw $0020 org $02DB8C+$06 : db $1B org $02DBDB+$06+$06 : dw $00ae org $02DC79+$06+$06 : dw $0610 org $02DD17+$06+$06 : dw $077e org $02DDB5+$06+$06 : dw $0672 org $02DE53+$06+$06 : dw $07f8 org $02DEF1+$06+$06 : dw $067d org $02DF8F+$06+$06 : dw $0803 org $02E02D+$06 : db $00 org $02E07C+$06 : db $f2 org $02E0CB+$06+$06 : dw $0000 org $02E169+$06+$06 : dw $0000 ;(0x????,0x1B,0x0130,0x060a,0x0716,0x0672,0x07f8,0x0681,0x0803,0x0c,0x02,xx,xx) ; Exit table cryptic documentation: ;??|$15D8A-$15E27 - (0x4F entries, 2 bytes each) - Rooms that exit to overworld Areas ("Room" in HM) ;??|$15E28-$15E76 - (0x4F entries, 1 byte each) - Overworld area that the exit leads to. ("Map" in HM) ;84|$15E77-$15F14 - (0x4F entries, 2 bytes each) - VRAM locations to place Link at. Gets fed to $7E0084 (???? in HM) ;e6|$15F15-$15FB2 - (0x4F entries, 2 bytes each) - Y Scroll Data ;e0|$15FB3-$16050 - (0x4F entries, 2 bytes each) - X Scroll Data ;$20|$16051-$160EE - (0x4F entries, 2 bytes each) - Link's Y Coordinate ;$22|$160EF-$1618C - (0x4F entries, 2 bytes each) - Link's X Coordinate ;0618|$1618D-$1622A - (0x4F entries, 2 bytes each) - Camera Y Coordinate ;061c|$1622B-$162C8 - (0x4F entries, 2 bytes each) - Camera X Coordinate ;0624|$162C9-$16317 - (0x4F entries, 1 byte each) - Ukn1 in HM ;0628|$16318-$16366 - (0x4F entries, 1 byte each) - Ukn2 in HM ; redefine some map16 tiles org $0FF1C8 dw #$190F, #$190F, #$190F, #$194C dw #$190F, #$194B, #$190F, #$195C dw #$594B, #$194C, #$19EE, #$19EE dw #$194B, #$19EE, #$19EE, #$19EE dw #$594B, #$190F, #$595C, #$190F dw #$190F, #$195B, #$190F, #$190F dw #$19EE, #$19EE, #$195C, #$19EE dw #$19EE, #$19EE, #$19EE, #$595C dw #$595B, #$190F, #$190F, #$190F ; Redefine more map16 tiles org $0FA480 dw #$190F, #$196B, #$9D04, #$9D04 dw #$196B, #$190F, #$9D04, #$9D04 ; update pyramid hole entrances org $1bb810 : dw $00BE, $00C0, $013E org $1bb836 : dw $001B, $001B, $001B ; add an extra pyramid hole entrance ; ExtraHole_Map16: org $308300 : dw $0140 ; ExtraHole_Area: org $308320 : dw $001B ; ExtraHole_Entrance: org $308340 : db $7B ;prioritize retreat Bat and use 3rd sprite section org $1af504 : dw $148B org $1af50c : dw $149B org $1af514 : dw $14A4 org $1af51c : dw $1489 org $1af524 : dw $14AC org $1af52c : dw $54AC org $1af534 : dw $148C org $1af53c : dw $548C org $1af544 : dw $1484 org $1af54c : dw $5484 org $1af554 : dw $14A2 org $1af55c : dw $54A2 org $1af564 : dw $14A0 org $1af56c : dw $54A0 org $1af574 : dw $148E org $1af57c : dw $548E org $1af584 : dw $14AE org $1af58c : dw $54AE ;Make retreat bat gfx available in Hyrule castle. org $00DB9D : db $1A ;sprite set 1, section 3 ;use new castle hole graphics (The values are the SNES address of the graphics: 31e000) org $00D009 : db $31 org $00D0e8 : db $E0 org $00D1c7 : db $00 ;org $02E849 ; Fly 1 to Sanctuary ;db #$13, #$00, #$16, #$00, #$18, #$00, #$2C, #$00, #$2F, #$00, #$30, #$00, #$3B, #$00, #$3F, #$00, #$5B, #$00, #$35, #$00, #$0F, #$00, #$15, #$00, #$33, #$00, #$12, #$00, #$3F, #$00, #$55, #$00, #$7F, #$00, #$1A, #$00, #$88, #$08, #$30, #$0B, #$88, #$05, #$98, #$07, #$80, #$18, #$9E, #$06, #$10, #$08, #$2E, #$00, #$42, #$12, #$80, #$06, #$12, #$01, #$9E, #$05, #$8E, #$04, #$80, #$02, #$12, #$01, #$80, #$02, #$00, #$04, #$16, #$05, #$59, #$07, #$B9, #$0A, #$FA, #$0A, #$1E, #$0F, #$DF, #$0E, #$05, #$0F, #$00, #$06, #$46, #$0E, #$C6, #$02, #$2A, #$04, #$BA, #$0C, #$9A, #$04, #$56, #$0E, #$2A, #$04, #$56, #$0E, #$D6, #$06, #$4E, #$0C, #$7E, #$01, #$40, #$08, #$B2, #$0E, #$00, #$00, #$F2, #$06, #$75, #$0E, #$78, #$07, #$0A, #$0C, #$06, #$0E, #$8A, #$0A, #$EA, #$06, #$62, #$04, #$00, #$0E, #$8A, #$0A, #$00, #$0E, #$68, #$04, #$78, #$05, #$B7, #$07, #$17, #$0B, #$58, #$0B, #$A8, #$0F, #$3D, #$0F, #$67, #$0F, #$5C, #$06, #$A8, #$0E, #$28, #$03, #$88, #$04, #$18, #$0D, #$F8, #$04, #$B8, #$0E, #$88, #$04, #$B8, #$0E, #$56, #$07, #$C8, #$0C, #$00, #$02, #$B8, #$08, #$30, #$0F, #$78, #$00, #$78, #$07, #$F3, #$0E, #$F0, #$07, #$90, #$0C, #$80, #$0E, #$10, #$0B, #$70, #$07, #$E8, #$04, #$68, #$0E, #$10, #$0B, #$68, #$0E, #$70, #$04, #$83, #$05, #$C6, #$07, #$26, #$0B, #$67, #$0B, #$8D, #$0F, #$4C, #$0F, #$72, #$0F, #$6D, #$06, #$B3, #$0E, #$33, #$03, #$97, #$04, #$27, #$0D, #$07, #$05, #$C3, #$0E, #$97, #$04, #$C3, #$0E, #$56, #$07, #$D3, #$0C, #$0B, #$02, #$BF, #$08, #$37, #$0F, #$8D, #$00, #$7F, #$07, #$FA, #$0E, #$F7, #$07, #$97, #$0C, #$8B, #$0E, #$17, #$0B, #$77, #$07, #$EF, #$04, #$85, #$0E, #$17, #$0B, #$85, #$0E, #$F6, #$FF, #$FA, #$FF, #$07, #$00, #$F7, #$FF, #$F6, #$FF, #$00, #$00, #$F1, #$FF, #$FB, #$FF, #$00, #$00, #$FA, #$FF, #$0A, #$00, #$F6, #$FF, #$F6, #$FF, #$F6, #$FF, #$FA, #$FF, #$F6, #$FF, #$FA, #$FF, #$F2, #$FF, #$F2, #$FF, #$02, #$00, #$00, #$00, #$0E, #$00, #$00, #$00, #$FE, #$FF, #$0B, #$00, #$F8, #$FF, #$06, #$00, #$FA, #$FF, #$FA, #$FF, #$06, #$00, #$0E, #$00, #$00, #$00, #$FA, #$FF, #$00, #$00 ;
37.583333
2,042
0.556456
[ "MIT" ]
Zarby89/z3randomizer
sandbox.asm
11,726
Assembly
; A256818: Number of length n+3 0..1 arrays with at most two downsteps in every n consecutive neighbor pairs. ; 16,32,64,128,245,442,753,1220,1894,2836,4118,5824,8051,10910,14527,19044,24620,31432,39676,49568,61345,75266,91613,110692,132834,158396,187762,221344,259583,302950,351947,407108,469000,538224,615416,701248,796429,901706,1017865,1145732,1286174,1440100,1608462,1792256,1992523,2210350,2446871,2703268,2980772,3280664,3604276,3952992,4328249,4731538,5164405,5628452,6125338,6656780,7224554,7830496,8476503,9164534,9896611,10674820,11501312,12378304,13308080,14292992,15335461,16437978,17603105,18833476,20131798,21500852,22943494,24462656,26061347,27742654,29509743,31365860,33314332,35358568,37502060,39748384,42101201,44564258,47141389,49836516,52653650,55596892,58670434,61878560,65225647,68716166,72354683,76145860,80094456,84205328,88483432,92933824 mov $2,$0 add $2,5 bin $2,$0 mov $4,$0 mul $0,10 add $0,$2 add $0,6 mov $5,11 add $5,$0 mov $1,$5 sub $1,2 mov $3,$4 mul $3,$4 mul $3,$4 add $1,$3 mov $0,$1
51.15
754
0.801564
[ "Apache-2.0" ]
ckrause/cm
programs/oeis/256/A256818.asm
1,023
Assembly
; A311384: Coordination sequence Gal.6.220.1 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; 1,4,8,12,16,22,28,32,36,40,44,48,52,56,60,66,72,76,80,84,88,92,96,100,104,110,116,120,124,128,132,136,140,144,148,154,160,164,168,172,176,180,184,188,192,198,204,208,212,216 mov $3,$0 add $3,1 mov $4,$0 lpb $3 mov $0,$4 sub $3,1 sub $0,$3 mul $0,2 mov $2,0 lpb $0 sub $0,1 sub $2,6 mov $6,2 mov $7,1 sub $7,$2 add $2,2 div $0,$2 mul $6,$0 mov $0,5 mov $5,$7 add $5,$2 gcd $2,10 sub $2,2 sub $6,2 add $5,$6 add $2,$5 mov $7,2 bin $7,$2 sub $0,$7 mul $5,2 mov $2,$5 lpe mov $5,$0 add $5,1 add $1,$5 lpe mov $0,$1
19.414634
177
0.557789
[ "Apache-2.0" ]
ckrause/cm
programs/oeis/311/A311384.asm
796
Assembly
format binary BASE = 0x7c00; That's where code is loaded by BIOS. LF = 10 ; Line feed. CR = 13 ; Carriage return. B = 219 ; Full block. S = 32 ; Space. macro _put destination*, source* { mov [destination+BASE], source } macro _get destination*, source* { mov destination, [source+BASE] } ; Print the greeting and the instructions. xor si, si mov ah, 0xe _get al, greeting @@: int 0x10 inc si _get al, greeting+si cmp al, 0 jne @b ; A blank line (to be eye candy). mov al, LF mov ah, 0xe int 0x10 mov al, CR int 0x10 ; Seed PRNG with the system time. xor ah, ah int 0x1a _put prngState, dx ioLoop: ; Zero out the count of dice we've already rolled in this iteration. xor bl, bl ; Get the count of dice. ; Only one keystroke is read. xor ah, ah int 0x16 ; If a space is received, do not alter the dice count. cmp al, S je @f ; Otherwise try to parse a number. sub al, '1' cmp al, 9 ja ioLoop inc al _put diceCount, al ; Print the prompt. @@: mov al, LF mov ah, 0xe times 2 int 0x10 mov al, CR int 0x10 mov al, '>' times 3 int 0x10 mov al, S int 0x10 ; Zero out the total score. _put totalScore, 0 prngLoop: ; Setup for the roll. _get ax, prngState mov dx, ax ; The PRNG itself. ; The 16-bit xorshift algorithm. shl dx, 7 xor ax, dx mov dx, ax shr dx, 9 xor ax, dx mov dx, ax shl dx, 8 xor ax, dx ; Save the state. _put prngState, ax ; Get reminder by 6. shr ax, 8 mov cl, 6 div cl mov al, ah inc al add byte [totalScore+BASE], al ; Store the score movzx si, bl _put si+scores, al ; Print the score. add al, '0' mov ah, 0xe int 0x10 ; Print a space. mov al, S mov ah, 0xe int 0x10 ; Check whether we've rolled all dice. inc bl cmp bl, [diceCount+BASE] jnb @f jmp prngLoop ; We have rolled all dice. ; Print the total score. @@: mov ah, 0xe mov al, ':' int 0x10 ; Two digits are supported as for now. ; Should be enough since we allow only 9 dices or less. ; 6*9 < 100 mov cl, 10 xor ah, ah _get al, totalScore div cl mov cl, ah add cl, '0' mov dl, al add dl, '0' mov ah, 0xe mov al, dl cmp al, '0' je @f int 0x10 @@: mov al, cl int 0x10 ; Print the visualization. mov ah, 0xe xor bh, bh macro _fill5cell { xor si, si @@: mov al, B times 5 int 0x10 mov al, S int 0x10 inc si movzx bx, [diceCount+BASE] cmp si, bx jl @b } macro _newLine { mov al, LF int 0x10 mov al, CR int 0x10 } _newLine _fill5cell _newLine xor bl, bl visualLoop: movzx si, bl imul si, si, 6*3 ;go to the needed row. add si, texture ;go to the needed texture. xor cl, cl @@: movzx di, cl movzx di, [scores+di+BASE] dec di imul di, di, 3 add di, BASE add di, si mov al, B int 0x10 mov al, [di] int 0x10 mov al, [di+1] int 0x10 mov al, [di+2] int 0x10 mov al, B int 0x10 mov al, S int 0x10 inc cl cmp cl, [diceCount+BASE] jl @b _newLine inc bl cmp bl, 3 jl visualLoop _fill5cell jmp ioLoop ; Data. greeting db \ LF,LF,"DICE TOWER OS",LF,LF,CR, 0 texture db B,B,B, B,B,S, B,B,S, S,B,S, S,B,S, S,B,S, \ B,S,B, B,B,B, B,S,B, B,B,B, B,S,B, S,B,S, \ B,B,B, S,B,B, S,B,B, S,B,S, S,B,S, S,B,S ; Reserved space. scores rb 9 prngState rw 1 totalScore rb 1 diceCount rb 1 ; Magic. rb 510-$ dw 0xaa55
16.088983
68
0.548591
[ "MIT" ]
Kharacternyk/dice-tower-os
boot.asm
3,797
Assembly
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r14 push %r9 push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0xab9b, %r10 nop sub $18332, %rcx mov $0x6162636465666768, %rsi movq %rsi, %xmm2 movups %xmm2, (%r10) nop nop nop nop cmp %r9, %r9 lea addresses_normal_ht+0x1881b, %rsi lea addresses_WT_ht+0x117a5, %rdi inc %r9 mov $38, %rcx rep movsb nop nop nop dec %rsi lea addresses_WC_ht+0x1e81b, %rsi lea addresses_WC_ht+0x1cf3, %rdi nop nop nop add $40192, %r11 mov $30, %rcx rep movsl nop nop nop nop nop cmp $42756, %r10 lea addresses_A_ht+0xc61b, %rsi lea addresses_UC_ht+0xde5b, %rdi nop nop nop nop cmp %r14, %r14 mov $32, %rcx rep movsl nop sub %r11, %r11 lea addresses_normal_ht+0x14903, %r10 nop nop nop nop cmp %rcx, %rcx mov $0x6162636465666768, %rsi movq %rsi, %xmm7 movups %xmm7, (%r10) nop nop nop add $59529, %rdi lea addresses_normal_ht+0xe91b, %rdi nop nop nop nop and %r10, %r10 mov $0x6162636465666768, %rcx movq %rcx, %xmm3 vmovups %ymm3, (%rdi) nop nop and $38748, %rcx lea addresses_normal_ht+0xbddb, %rsi lea addresses_D_ht+0x421b, %rdi nop and $13716, %rdx mov $103, %rcx rep movsl nop and %r11, %r11 pop %rsi pop %rdx pop %rdi pop %rcx pop %r9 pop %r14 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r8 push %rax push %rcx push %rsi // Faulty Load lea addresses_WT+0xc61b, %rax nop nop nop nop nop sub %r8, %r8 movups (%rax), %xmm2 vpextrq $1, %xmm2, %rsi lea oracles, %rax and $0xff, %rsi shlq $12, %rsi mov (%rax,%rsi,1), %rsi pop %rsi pop %rcx pop %rax pop %r8 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 4}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_WT_ht'}} {'OP': 'REPM', 'src': {'same': True, 'congruent': 9, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_UC_ht'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 3}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 8}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_D_ht'}} {'39': 21829} 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 */
40.558621
2,999
0.664853
[ "MIT" ]
danielmgmi/medusa
Transynther/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_1838.asm
5,881
Assembly
addi $1,$1,1 EoP: beq $11, $11, EoP #end of program (infinite loop)
25.666667
63
0.571429
[ "MIT" ]
colasgrenier/pipelined-mips-processor
Test_Benchmark1/benchmark1.asm
77
Assembly
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r13 push %r15 push %r8 push %rcx push %rdi push %rsi lea addresses_UC_ht+0x14966, %rsi lea addresses_WT_ht+0x6532, %rdi nop xor $25147, %r8 mov $46, %rcx rep movsw nop sub %rsi, %rsi lea addresses_WC_ht+0x10a6, %rsi nop nop nop nop inc %r15 mov $0x6162636465666768, %r11 movq %r11, (%rsi) cmp $33134, %r11 lea addresses_D_ht+0x11fe6, %rdi nop nop nop add %r12, %r12 movb (%rdi), %r11b nop add $44712, %r12 lea addresses_D_ht+0x8d9a, %rsi nop nop nop cmp %r11, %r11 mov (%rsi), %r8w nop nop nop nop nop cmp %rsi, %rsi lea addresses_A_ht+0xdfea, %rsi lea addresses_D_ht+0x2a8e, %rdi nop nop nop nop and %r13, %r13 mov $57, %rcx rep movsq dec %r8 lea addresses_normal_ht+0x1e566, %rsi clflush (%rsi) xor %r15, %r15 movb $0x61, (%rsi) nop add $24055, %rsi lea addresses_normal_ht+0xfd4c, %r15 nop nop nop sub $24714, %rcx mov (%r15), %r13d nop add %r12, %r12 lea addresses_UC_ht+0x119c6, %r15 nop xor $30459, %r13 mov $0x6162636465666768, %r12 movq %r12, %xmm1 vmovups %ymm1, (%r15) nop nop nop nop sub %rsi, %rsi lea addresses_WT_ht+0x5c66, %rsi lea addresses_WT_ht+0x148e6, %rdi sub %r13, %r13 mov $113, %rcx rep movsb nop and %r11, %r11 lea addresses_normal_ht+0x82c6, %rsi lea addresses_WT_ht+0x15866, %rdi nop nop nop nop sub $36819, %r11 mov $48, %rcx rep movsq nop nop nop nop nop dec %rcx pop %rsi pop %rdi pop %rcx pop %r8 pop %r15 pop %r13 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r9 push %rax push %rbx push %rdx // Store lea addresses_WC+0xf4a6, %r10 nop nop nop nop and %rdx, %rdx movb $0x51, (%r10) nop nop sub %rax, %rax // Faulty Load lea addresses_D+0x1a566, %r12 clflush (%r12) nop dec %r11 mov (%r12), %rax lea oracles, %r9 and $0xff, %rax shlq $12, %rax mov (%r9,%rax,1), %rax pop %rdx pop %rbx pop %rax pop %r9 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_D', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 5}} [Faulty Load] {'src': {'type': 'addresses_D', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 6}} {'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 7}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2, 'NT': True, 'same': False, 'congruent': 2}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 1, 'NT': False, 'same': False, 'congruent': 11}} {'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4, 'NT': True, 'same': False, 'congruent': 1}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 3}} {'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}} {'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': True}} {'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 */
37.774011
2,999
0.657643
[ "MIT" ]
danielmgmi/medusa
Transynther/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_349.asm
6,686
Assembly
include uXmx86asm.inc option casemap:none ifndef __X64__ .686P .xmm .model flat, c else .X64P .xmm option win64:11 option stackbase:rsp endif option frame:auto .code align 16 uXm_has_enabled_YMM proto VECCALL (byte) align 16 uXm_has_enabled_YMM proc VECCALL (byte) mov eax, 1 cpuid and ecx, bit_OSXSAVE cmp ecx, bit_OSXSAVE ; OSXSAVE support by microprocessor jne not_supported ; processor supports XGETBV is enabled by OS mov ecx, 0 ; specify 0 for XCR0 register xgetbv ; result in edx:eax and eax, 06h cmp eax, 06h ; check OS has enabled both XMM and YMM state support jne not_supported mov al, true jmp done not_supported: mov al, false done: ret uXm_has_enabled_YMM endp end ;.code
18.468085
80
0.62788
[ "MIT" ]
Navegos/uasmlib
src/host/x86/asm/has/uXmhas_enabled_YMM.asm
868
Assembly
//------------------------------------------------------------------------------ // // Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> // // This program and the accompanying materials // are licensed and made available under the terms and conditions of the BSD License // which accompanies this distribution. The full text of the license may be found at // http://opensource.org/licenses/bsd-license.php // // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // //------------------------------------------------------------------------------ INCLUDE AsmMacroExport.inc ; ;UINT32 ;EFIAPI ;__aeabi_uwrite4 ( ; IN UINT32 Data, ; IN VOID *Pointer ; ); ; ; RVCT_ASM_EXPORT __aeabi_uwrite4 mov r2, r0, lsr #8 strb r0, [r1] strb r2, [r1, #1] mov r2, r0, lsr #16 strb r2, [r1, #2] mov r2, r0, lsr #24 strb r2, [r1, #3] bx lr ; ;UINT64 ;EFIAPI ;__aeabi_uwrite8 ( ; IN UINT64 Data, //r0-r1 ; IN VOID *Pointer //r2 ; ); ; ; RVCT_ASM_EXPORT __aeabi_uwrite8 mov r3, r0, lsr #8 strb r0, [r2] strb r3, [r2, #1] mov r3, r0, lsr #16 strb r3, [r2, #2] mov r3, r0, lsr #24 strb r3, [r2, #3] mov r3, r1, lsr #8 strb r1, [r2, #4] strb r3, [r2, #5] mov r3, r1, lsr #16 strb r3, [r2, #6] mov r3, r1, lsr #24 strb r3, [r2, #7] bx lr END
22.955224
85
0.514304
[ "BSD-2-Clause" ]
James992927108/uEFI_Edk2_Practice
ArmPkg/Library/CompilerIntrinsicsLib/Arm/uwrite.asm
1,538
Assembly
; A227417: Integer triples a(3n-2) = n, a(3n-1) = n+4, and a(3n) = n+7. ; 1,5,8,2,6,9,3,7,10,4,8,11,5,9,12,6,10,13,7,11,14,8,12,15,9,13,16,10,14,17,11,15,18,12,16,19,13,17,20,14,18,21,15,19,22,16,20,23,17,21,24,18,22,25,19,23,26,20,24,27,21,25,28,22,26,29,23,27,30,24 mov $2,$0 lpb $0 lpb $2 add $0,$2 trn $0,3 mov $2,$0 add $3,3 lpe trn $2,3 mov $0,$2 add $3,1 lpe add $0,$3 add $0,1 mov $1,$0
22.210526
195
0.552133
[ "Apache-2.0" ]
jmorken/loda
programs/oeis/227/A227417.asm
422
Assembly
; A188220: Positions of 1 in the zero-one sequence [nr]-[5r]-[nr-5r], where r=sqrt(5), n>=1. ; 9,13,17,26,30,34,43,47,51,60,64,68,77,81,85,89,98,102,106,115,119,123,132,136,140,149,153,157,161,170,174,178,187,191,195,204,208,212,221,225,229,233,242,246,250,259,263,267,276,280,284,293,297,301,305,314,318,322,331,335,339,348,352,356,365,369,373,382,386,390,394,403,407,411,420,424 seq $0,188293 ; Positions of 1 in A188291; complement of A188292. add $0,5
76.166667
287
0.71116
[ "Apache-2.0" ]
ckrause/cm
programs/oeis/188/A188220.asm
457
Assembly
; Allow the player to specify the destination of item-dragging by key rather ; than by mouse, calling eop-openableItemForKey to specify the destination ; and then calling eop-dropToPresetDestination to do the dropping. ; This makes it quicker and easier for the player to give a dragged item to a ; particular party member. [bits 16] startPatch EXE_LENGTH, dropToKeySelectedItem startBlockAt addr_loopDuringDrag_beforeLoop ; si: pn_mouseState ; di: pn_draggedItemDisplay %assign var_hasShown -0x2 %assign var_draggedIbo -0x4 mov word [bp+var_hasShown], 0 callVarArgsEopFromOverlay ensureDragAndDropAreasInitialized, 0 ; if our drop area has already been configured with a destination, ; then we'll drop there without looping or checking for keys. mov bx, [dseg_pn_dropArea] cmp word [bx+InventoryArea_ibo], 0 jz .loopStart mov ax, 1 jmp .exitLoop .loopStart: ; original game did not cycle palette during drag, but it's nice to do callFromOverlay cyclePalette push si callFromOverlay updateAndCopyMouseState pop cx ; call showItem only once cmp word [bp+var_hasShown], 0 jnz .afterShowing push di mov bx, [di+0xC] call far [bx+4] ; DraggedItemDisplay_?showItem pop cx mov word [bp+var_hasShown], 1 .afterShowing: ; don't let eop-openableItemForKey consume keys if the player is using ; key-mouse to drag cmp byte [dseg_isKeyMouseEnabled], 0 jnz .processMouse ; try to place the dragged item into an item selected by key push 0 ; key code (none) callVarArgsEopFromOverlay openableItemForKey, 1 pop cx test ax, ax jz .processMouse ; configure drop area to drop into the selected item mov bx, [dseg_pn_dropArea] mov [bx+InventoryArea_ibo], ax mov ax, 1 jmp .exitLoop .processMouse: cmp byte [si+7], MouseAction_MOVE jnz .afterUpdatingDisplay ; mouse moved, so update where the item is displayed push word [si+4] mov ax, [si+2] sar ax, 1 push ax push di mov bx, [di+0xC] call far [bx+0x14] ; DraggedItemDisplay_updatePosition add sp, 6 .afterUpdatingDisplay: cmp byte [si+7], 3 jnz .loopStart cmp byte [si+1], 1 jnz .loopStart mov ax, 0 .exitLoop: ; ax == 0 : dropped by mouse ; ax == 1 : dropped by key; dropArea's ibo set to destination endBlockAt off_loopDuringDrag_loopEnd startBlockAt addr_dragItem_afterDragging %assign var_draggedIbo -0x04 %assign var_pn_dialogListNode -0x06 %assign var_doesItemHaveQuantity -0x07 %assign var_destinationIbo -0x0A %assign var_draggedItemDisplay -0x2E %define reg_pn_sourceControl si ; patched drag loop will return 0 if dropped by mouse, 1 if by key push ax ; destroy the DraggedItemDisplay push 2 lea ax, [bp+var_draggedItemDisplay+0xE] push ax mov bx, word [bp+var_draggedItemDisplay+0x16] ; first destructor call far [bx] pop cx pop cx push 0 lea ax, [bp+var_draggedItemDisplay] push ax callFromOverlay AbstractInventoryDialog_destructor pop cx pop cx pop ax test ax, ax jz notDroppedByKey dropToDropArea: ; try to drop the item into the key-selected destination push reg_pn_sourceControl callVarArgsEopFromOverlay dropToPresetDestination, 1 pop cx ; skip the rest of dragItem (trying to drop the item; putting the ; item back if the drop location was invalid) jmp calcJump(off_dragItem_endProc) notDroppedByKey: push word [bp+var_draggedIbo] callVarArgsEopFromOverlay doesItemHaveQuantity, 1 pop cx mov byte [bp+var_doesItemHaveQuantity], al mov word [bp+var_pn_dialogListNode], 0 jmp calcJump(off_dragItem_determineWhereToPut) endBlockWithFillAt nop, off_dragItem_afterDragging_end endPatch
26.170068
78
0.717962
[ "MIT" ]
JohnGlassmyer/UltimaHacks
u7-common/patch-dropToKeySelectedItem.asm
3,847
Assembly
_text SEGMENT ; char _InterlockedCompareExchange8(volatile char*, char NewValue, char Expected) ; - RCX, RDX, R8 _InterlockedCompareExchange8 PROC mov eax,r8d lock cmpxchg [rcx],dl ret _InterlockedCompareExchange8 ENDP _text ENDS END
17
83
0.66436
[ "Apache-2.0" ]
webos21/xi
src/base/src/win32/xg_atomic_S.asm
289
Assembly
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% (c) Copyright GeoWorks 1996. All Rights Reserved. GEOWORKS CONFIDENTIAL PROJECT: GEOS MODULE: CommonUI/COpen (common code for several specific ui's) FILE: copenCtrlCommon.asm ROUTINES: Name Description ---- ----------- INT PropogatePreApplyCallback Broadcasts MSG_GEN_PRE_APPLY, returning carry set if any child returns carry set. MTD MSG_SPEC_SET_EMPHASIS Emphasizes/De-emphasizes an OLCtrl MTD MSG_VIS_OPEN When coming onscreen, register as an emphasizable interaction INT OLCtrlSendSetEmphasizedObject Sends MSG_SPEC_SET_EMPHASIZED_OBJECT to win group MTD MSG_SPEC_SET_EMPHASIZED_OBJECT Registers (or removes) an object as the emphasized object underneath a windowed OLCtrl. INT OpenDrawCtrlMoniker Draws the moniker for OLCtrl and their kin, if the moniker is being used. Also draws a box around things if the appropriate flag is set. INT RedrawCtrlFrame Draws the frame of an OLCtrl INT DrawCtrlFrame Draws a frame around the control. INT DrawLeafIfHaveFocus Draw the silly leaf if we have the focus. INT DrawEtchedVLine Draws an etched line. INT DrawEtchedVLine Draws an etched line. INT DrawEtchedHLine Draws an etched horizontal line. INT EraseOuterFrameIfNoEmphasis After drawing the frame, erases any pixels leftover from a previous, thicker frame INT DrawEtchedHLine After drawing the frame, erases any pixels leftover from a previous, thicker frame INT SetWhiteIfNotClearing After drawing the frame, erases any pixels leftover from a previous, thicker frame INT SetBlack After drawing the frame, erases any pixels leftover from a previous, thicker frame INT SetColorIfNotClearing After drawing the frame, erases any pixels leftover from a previous, thicker frame INT CheckIfDoingShadows Returns whether we need a shadow INT DrawCtrlFrameTopLines Draws top lines of a framed OLCtrl. INT DrawCtrlFrameTopLineSegments Draw OLCtrlClass top line segments INT DrawCtrlFrameSegmentsCB Draw OLCtrlClass top line segments INT DrawRoundedBoxCorners Draw rounded corners INT ClearMonikerArea Clears the area behind the moniker. We also must clear the area around the frame, if any. MTD MSG_VIS_VUP_QUERY We intercept visual-upward queries here to see if we can answer them. REVISION HISTORY: Name Date Description ---- ---- ----------- dlitwin 10/10/94 Broken out of copenCtrl.asm DESCRIPTION: $Id: copenCtrlCommon.asm,v 1.2 98/03/11 05:49:00 joon Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CommonFunctional segment resource COMMENT @---------------------------------------------------------------------- METHOD: OLCtrlInteractionComplete DESCRIPTION: PASS: *ds:si - instance data es - segment of OLCtrlClass ax - MSG_GEN_GUP_INTERACTION_COMMAND cx - InteractionCommand RETURN: carry set - handled DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 9/89 Initial version ------------------------------------------------------------------------------@ OLCtrlInteractionComplete method OLCtrlClass, \ MSG_GEN_GUP_INTERACTION_COMMAND cmp cx, IC_INTERACTION_COMPLETE jne notHandled ; if not, indicate NOT handled ; Check if this is a GenInteraction, if not ; (some spec UI objects are off OLCtrlClass, ; but no GenInteraction), let parent handle push es mov di, segment GenInteractionClass mov es, di mov di, offset GenInteractionClass call ObjIsObjectInClass pop es jnc done ; nope, let parent handle ; C clr -> NOT handled here ; If dialog, stop method here. If anything ; wants it, it should subclass this method. ; (OLDialogWin, OLPopupWin, OLMenuWin do) mov di, ds:[si] add di, ds:[di].Gen_offset cmp ds:[di].GII_visibility, GIV_DIALOG stc ; assume not, indicate handled je done notHandled: clc ; indicate NOT handled done: ret OLCtrlInteractionComplete endp COMMENT @---------------------------------------------------------------------- METHOD: OLCtrlPropogateApplyReset DESCRIPTION: Simply passes any MSG_GEN_APPLY or MSG_GEN_RESET that reaches here to all generic, usable children, so that they may perform the function. Allows a single MSG_GEN_APPLY/RESET to be sent to a GenSummons or GenInteraction, to cause all gadgets to APPLY/RESET their changes. (This because ALL groups holding gadgets in OL ARE or are SUBCLASSED from this class) PASS: *ds:si - instance data es - segment of OLCtrlClass ax - MSG_GEN_APPLY, MSG_GEN_RESET cx, dx, bp - ? RETURN: nothing DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: This handler will send MSG_GEN_APPLY or MSG_GEN_RESET on to ANY GenInteraction encountered, even if they are merely a button leading to a separate window from the current property area. Only objects in the reply bar are skipped. THIS MAY OR MAY NOT BE THE DESIRED BEHAVIOR! We'll just have to wait & see IF anyone ever wants to do this, & then see how it should work. REVISION HISTORY: Name Date Description ---- ---- ----------- Doug 1/90 Initial version ------------------------------------------------------------------------------@ OLCtrlPropogateApplyReset method OLCtrlClass, MSG_GEN_APPLY, MSG_GEN_RESET, MSG_GEN_POST_APPLY mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset ;ds:[di] -- SpecInstance ; Don't send to the reply bar. This area ; only has triggers, or possibly ; GenInteractions or GenSummons which we wish ; to have come up separately from APPLIED area. mov bx, ds:[di].OLCI_buildFlags and bx, mask OLBF_TARGET cmp bx, OLBT_REPLY_BAR shl offset OLBF_TARGET jz Done clr dl ; No flags to compare with. Call all ; USABLE children. call VisIfFlagSetCallGenChildren Done: ret OLCtrlPropogateApplyReset endm COMMENT @---------------------------------------------------------------------- METHOD: OLCtrlPropogatePreApply DESCRIPTION: Pass MSG_GEN_PRE_APPLY to all children, noting if they return error. PASS: *ds:si - instance data es - segment of OLCtrlClass ax - MSG_GEN_PRE_APPLY cx, dx, bp - ? RETURN: carry set if any children returns carry set DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: This handler will send MSG_GEN_PRE_APPLY on to ANY GenInteraction encountered, even if they are merely a button leading to a separate window from the current property area. Only objects in the reply bar are skipped. THIS MAY OR MAY NOT BE THE DESIRED BEHAVIOR! We'll just have to wait & see IF anyone ever wants to do this, & then see how it should work. REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 3/11/92 modified ------------------------------------------------------------------------------@ OLCtrlPropogatePreApply method OLCtrlClass, MSG_GEN_PRE_APPLY mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset ;ds:[di] -- SpecInstance ; Don't send to the reply bar. This area ; only has triggers, or possibly ; GenInteractions which we wish ; to have come up separately from APPLIED area. mov bx, ds:[di].OLCI_buildFlags and bx, mask OLBF_TARGET cmp bx, OLBT_REPLY_BAR shl offset OLBF_TARGET jz Done clr dx ; no carry flag returned, yet clr bx ; initial child (first child) push bx push bx mov bx, offset GI_link push bx ; offset to LinkPart mov bx, SEGMENT_CS push bx ; callback routine (seg) mov bx, offset PropogatePreApplyCallback push bx ; callback routine (off) mov bx, offset Gen_offset mov di, offset GI_comp call ObjCompProcessChildren tst dx ; any carry returned? ; (clears carry) jz Done ; no, return carry clear stc ; else, return carry set Done: ret OLCtrlPropogatePreApply endm COMMENT @---------------------------------------------------------------------- FUNCTION: PropogatePreApplyCallback DESCRIPTION: Broadcasts MSG_GEN_PRE_APPLY, returning carry set if any child returns carry set. CALLED BY: OLCtrlPropogatePreApply (as call-back) PASS: *ds:si - child *es:di - composite ax - message dx - TRUE if carry flag returned RETURN: carry - set to end processing dx - TRUE if carry flag set previously DESTROYED: cx, bp REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 3/89 Initial version ------------------------------------------------------------------------------@ PropogatePreApplyCallback proc far mov di, ds:[si] add di, ds:[di].Gen_offset test ds:[di].GI_states, mask GS_USABLE ;clears carry jz leaveDX push ax, dx call ObjCallInstanceNoLock pop ax, dx jnc leaveDX mov dx, -1 ; carry returned, indicate this in DX leaveDX: ret PropogatePreApplyCallback endp COMMENT @---------------------------------------------------------------------- METHOD: OLCtrlDraw -- MSG_VIS_DRAW for OLCtrlClass DESCRIPTION: Draws the visual moniker, if appropriate. Also will draw a box around the outside, if appropriate. PASS: *ds:si - instance data es - segment of MetaClass ax - MSG_VIS_DRAW cl - DrawFlags: DF_EXPOSED set if updating bp - GState to use RETURN: nothing DESTROYED: bx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 9/29/89 Initial version ------------------------------------------------------------------------------@ OLCtrlDraw method OLCtrlClass, MSG_VIS_DRAW if CTRL_USES_BACKGROUND_COLOR call DrawCtrlBackground endif push bp mov di, offset OLCtrlClass ;do Vis Comp draw CallSuper MSG_VIS_DRAW pop bp call OpenDrawCtrlMoniker ;and go draw moniker ret OLCtrlDraw endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DrawCtrlBackground %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: draw OLCtrlBackground CALLED BY: INTERNAL OLCtrlDraw PASS: *ds:si = OLCtrl bp = gstate RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 9/ 3/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if CTRL_USES_BACKGROUND_COLOR DrawCtrlBackground proc near uses ax,bx,cx,dx,di, es .enter call GetCtrlCustomColor jnc done ; no custom color mov di, ds:[si] add di, ds:[di].Vis_offset test ds:[di].VI_attrs, mask VA_FULLY_ENABLED mov cx, ax ; cx = colors mov di, bp ; di = gstate jnz fullyEnabled mov al, SDM_50 call GrSetAreaMask ; 50% if disabled fullyEnabled: call GrGetAreaColor pushdw bxax ; save current color push cx ; save colors mov_tr ax, cx ; ax = colors clr ah call GrSetAreaColor ; set main color call VisGetBounds call GrFillRect pop ax ; al = main, ah = mask color cmp al, ah ; same color? je washDone ; yes, done clr ah call GrSetAreaColor mov al, SDM_50 call GrSetAreaMask call VisGetBounds call GrFillRect washDone: popdw bxax call GrSetAreaColor ; restore color mov al, SDM_100 call GrSetAreaMask ; restore mask done: .leave ret DrawCtrlBackground endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GetCtrlCustomColor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: get custom color for OLCtrl, if any CALLED BY: INTERNAL DrawCtrlBackground ClearMonikerArea PASS: *ds:si = OLCtrl RETURN: carry set if custom color al = main color ah = mask color DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 9/11/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GetCtrlCustomColor proc near ; ; only have custom color if we are a OLItemGroup or a ; GIV_SUB_GROUP GenInteraction ; mov di, segment GenInteractionClass mov es, di mov di, offset GenInteractionClass call ObjIsObjectInClass jnc checkItemGroup mov di, ds:[si] add di, ds:[di].Gen_offset cmp ds:[di].GII_visibility, GIV_SUB_GROUP je checkColor clc ; indicate no custom color jmp short done checkItemGroup: mov di, segment OLItemGroupClass mov es, di mov di, offset OLItemGroupClass call ObjIsObjectInClass jnc done ; carry clear, no custom color mov ax, HINT_ITEM_GROUP_TAB_STYLE call ObjVarFindData cmc ; carry clear if tabs jnc done ; no custom color for tabs ; ; get custom background color ; checkColor: mov ax, 0 ; unselected color, please call OpenGetBackgroundColor ; carry set if custom color done: ret GetCtrlCustomColor endp endif ; CTRL_USES_BACKGROUND_COLOR COMMENT @---------------------------------------------------------------------- ROUTINE: OpenDrawCtrlMoniker SYNOPSIS: Draws the moniker for OLCtrl and their kin, if the moniker is being used. Also draws a box around things if the appropriate flag is set. CALLED BY: OLCtrlDraw, OLScrollingListDraw PASS: *ds:si -- handle of object bp - graphics state RETURN: nothing DESTROYED: cx, dx, di, es PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 10/ 2/89 Initial version ------------------------------------------------------------------------------@ OpenDrawCtrlMoniker proc far class OLCtrlClass ; ; Set patterns to 50% if not enabled. ; push bp ;save gstate mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset test ds:[di].VI_attrs, mask VA_FULLY_ENABLED jnz drawFrame ;enabled, OK, branch clearEm: call ClearMonikerArea ;clear area behind monikers if not USE_COLOR_FOR_DISABLED_GADGETS mov di, bp ;else pass gstate mov al, SDM_50 ;use a 50% mask call GrSetLineMask call GrSetTextMask endif drawFrame: ; ; Set up line and text draw colors. ; if not USE_COLOR_FOR_DISABLED_GADGETS mov di, bp endif mov ax, C_BLACK if USE_COLOR_FOR_DISABLED_GADGETS mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset test ds:[di].VI_attrs, mask VA_FULLY_ENABLED jnz setColorOK ;enabled, OK, branch mov ax, DISABLED_COLOR setColorOK: mov di, bp call GrSetAreaColor endif call GrSetLineColor ;set line color to black call GrSetTextColor ;and text color if PARENT_CTRLS_INVERTED_ON_CHILD_FOCUS push di mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset ;ds:[di] -- SpecInstance test ds:[di].OLCI_rudyFlags, mask OLCRF_HAS_FOCUS pop di jz afterFocusWeirdness mov ax, HINT_INTERACTION_FOCUSABLE call ObjVarFindData jc afterFocusWeirdness ;don't change color if this ; hint is present! 10/21/94 cbh mov di, bp mov ax, C_BLACK call GrSetLineColor ;set line color to black call GrSetTextColor ;and text color afterFocusWeirdness: endif clr dx ;assume no x margins mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset ;ds:[di] -- SpecInstance test ds:[di].OLCI_optFlags, mask OLCOF_DISPLAY_BORDER jz skipRect call DrawCtrlFrame ;draw frame around control mov dx, TOP_FRAME_AT_END_MARGIN + OL_CTRL_MKR_MARGIN ;default x margin, for use if ; left or right justifying skipRect: mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset ;ds:[di] -- SpecInstance test ds:[di].OLCI_optFlags, mask OLCOF_DISPLAY_MONIKER LONG jz exit ;not doing monikers, exit ; ; Center the object if drawing a frame, otherwise left justify. ; X margin kept in dx. ; mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset ;ds:[di] -- SpecInstance mov cx, ds:[di].OLCI_monikerPos.P_y ; ; If aligning with child object, substitute that now. Must be ; set along with DISPLAY_MKR_ABOVE. ; test ds:[di].OLCI_optFlags, mask OLCOF_DISPLAY_MKR_ABOVE jz noMaligning test ds:[di].OLCI_moreFlags, \ mask OLCOF_ALIGN_LEFT_MKR_EDGE_WITH_CHILD jz noMaligning mov dx, ds:[di].OLCI_monikerPos.P_x ;use our special left inset noMaligning: test ds:[di].OLCI_optFlags, mask OLCOF_CENTER_ON_MONIKER jz noCenter test ds:[di].OLCI_optFlags, mask OLCOF_LEFT_JUSTIFY_MONIKERS jnz noCenter push ax call GetParentMonikerSpace ;get parent space add dx, ax pop ax mov di, ds:[si] add di, ds:[di].Vis_offset sub dx, ds:[di].OLCI_monikerSpace ;subtract our space noCenter: mov di, bp ;gstate in di sub sp, size OpenMonikerArgs ;make room for args mov bp, sp ;pass pointer in bp EC < call ECInitOpenMonikerArgs ;save IDs on stack for testing> mov ss:[bp].OMA_gState, di ;pass gstate mov ss:[bp].OMA_leftInset, dx ;pass left inset mov ss:[bp].OMA_rightInset, dx ;pass right inset mov ss:[bp].OMA_topInset, cx ;pass top inset mov ss:[bp].OMA_bottomInset, cx ;pass bottom inset mov ss:[bp].OMA_monikerAttrs, mask OLMA_DRAW_SHORTCUT_TO_RIGHT or \ mask OLMA_DISP_KBD_MONIKER mov cl, (J_LEFT shl offset DMF_X_JUST) or \ (J_LEFT shl offset DMF_Y_JUST) mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset ;ds:[di] -- SpecInstance test ds:[di].OLCI_moreFlags, mask OLCOF_LEFT_JUSTIFY_MONIKER jnz draw ;left justifying, branch mov cl, (J_RIGHT shl offset DMF_X_JUST) or \ (J_LEFT shl offset DMF_Y_JUST) test ds:[di].OLCI_moreFlags, mask OLCOF_RIGHT_JUSTIFY_MONIKER jnz draw ;right justifying, branch mov cl, (J_CENTER shl offset DMF_X_JUST) or \ (J_LEFT shl offset DMF_Y_JUST) draw: clr ch ; pass flag to underline accelerator mov ss:[bp].OMA_drawMonikerFlags, cx segmov es, ds ;*es:bx - generic object mov bx, si call OpenDrawMoniker ;draw the moniker EC < call ECVerifyOpenMonikerArgs ;make structure still ok > add sp, size OpenMonikerArgs ;dump args exit: pop di ;restore gstate if not USE_COLOR_FOR_DISABLED_GADGETS mov al, SDM_100 ;restore masks to 100% call GrSetLineMask call GrSetTextMask endif ret OpenDrawCtrlMoniker endp COMMENT @---------------------------------------------------------------------- ROUTINE: DrawCtrlFrame SYNOPSIS: Draws a frame around the control. CALLED BY: OpenDrawCtrlMoniker PASS: *ds:si -- object bp -- gstate RETURN: nothing DESTROYED: ax, bx, cx, dx, di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 1/29/90 Initial version ------------------------------------------------------------------------------@ if DRAW_STYLES CtrlDrawHints VarDataHandler \ <HINT_DRAW_STYLE_FLAT, CtrlDrawFlat>, <HINT_DRAW_STYLE_3D_RAISED, CtrlDrawRaised>, <HINT_DRAW_STYLE_3D_LOWERED, CtrlDrawLowered>, <HINT_INTERACTION_NOTEBOOK_STYLE, CtrlDrawNotebook> CtrlDrawFlat proc far tst dx jnz done ; something overrides us mov cx, ((mask DIAFF_FRAME or mask DIAFF_NO_WASH) shl 8) or DS_FLAT done: ret CtrlDrawFlat endp CtrlDrawRaised proc far tst dx jnz done ; something overrides us mov cx, ((mask DIAFF_NO_WASH) shl 8) or DS_RAISED done: ret CtrlDrawRaised endp CtrlDrawLowered proc far cmp dx, 1 ja done ; something overrides us mov dx, 1 ; we have medium priority mov cx, ((mask DIAFF_NO_WASH) shl 8) or DS_LOWERED done: ret CtrlDrawLowered endp CtrlDrawNotebook proc far mov dx, 2 ; highest priority mov cx, ((mask DIAFF_FRAME or mask DIAFF_NO_WASH) shl 8) or DS_FLAT ret CtrlDrawNotebook endp endif ; DRAW_STYLES DrawCtrlFrame proc near if DRAW_STYLES ;--------------------------------------------------------------- ; ; get draw flags based on draw style ; push es clr dx ; no override yet ; default to lowered mov cx, ((mask DIAFF_NO_WASH) shl 8) or DS_LOWERED mov di, segment OLItemGroupClass mov es, di mov di, offset OLItemGroupClass call ObjIsObjectInClass jnc haveDefault ; not item group, lowered def. ; item group, flat default mov cx, ((mask DIAFF_FRAME or mask DIAFF_NO_WASH) shl 8) or DS_FLAT haveDefault: segmov es, cs mov di, offset CtrlDrawHints mov ax, length CtrlDrawHints call ObjVarScanData ; cx = draw flags pop es ; ; draw OLCtrl frame for draw styles ; mov di, bp ; di = gstate push cx ; pass flags mov ax, (DRAW_STYLE_FRAME_WIDTH shl 8) or DRAW_STYLE_THIN_INSET_WIDTH push ax ; pass widths call VisGetBounds call OpenDrawInsetAndFrame else ;------------------------------------------------------------------------- if (_MOTIF or _ISUI) and ALLOW_TAB_ITEMS ; ; Handle HINT_RAISED_FRAME ; mov ax, HINT_RAISED_FRAME call ObjVarFindData jnc noRaisedFrame mov di, bp ;di <- GState mov bp, {GenRaisedFrameInfo}ds:[bx] ;bp <- GenRaisedFrameInfo ; ; Draw top and left in white ; mov ax, C_WHITE call GrSetLineColor call VisGetBounds test bp, mask GRFI_TOP jz noTopLine call GrDrawHLine noTopLine: test bp, mask GRFI_LEFT jz noLeftLine call GrDrawVLine noLeftLine: ; ; draw bottom and right in dark color (and black for ISUI) ; if _MOTIF push ax mov ax, C_BLACK call GrSetLineColor pop ax endif test bp, mask GRFI_BOTTOM jz noBottomLine if _MOTIF xchg bx, dx ;bx <- bottom call GrDrawHLine xchg bx, dx ;bx <- top elseif _ISUI push ax, bx mov bx, dx ;bx <- botom call setBlack call GrDrawHLine call setDark dec bx inc ax call GrDrawHLine pop ax, bx endif noBottomLine: test bp, mask GRFI_RIGHT jz noRightLine if _MOTIF mov_tr ax, cx ;ax <- right call GrDrawVLine elseif _ISUI mov_tr ax, cx call setBlack call GrDrawVLine dec ax call setDark call GrDrawVLine endif noRightLine: jmp raisedFrameDone noRaisedFrame: endif ; ; Get the coordinates to use for the box. We need to inset the box ; from any window-imposed margins we've added. Also we won't be ; drawing the line under the moniker text. ; call VisGetSize ;get width of the control push cx ;now save the overall width #1 call SpecGetGenMonikerSize ;get the size of the moniker push cx ;save width #2 push dx ;save height #3 push bp ;save gstate #4 clr cl ;get real ctrl bounds call OpenGetLineBounds ; pop bp ;restore gstate #4 pop di ;restore height #3 tst di ;was there a moniker? jz 5$ ;no, branch add bx, CTRL_MKR_INSET_Y ;else add offset to text to top 5$: shr di, 1 ;divide moniker height by 2 add bx, di ;add half moniker ht to top if DRAW_LEAF_IF_HAVE_FOCUS push di ;save moniker height #L3 endif mov di, bp ;keep gstate in di ; ; Frame coordinates in ax, bx, cx, dx. Draw the sides and bottom, ; then do some calculations to do the edges. ; if CTRL_ROUNDED_BOX_CORNERS call DrawRoundedBoxCorners push bx, dx ; #C4,5 add bx, 4 sub dx, 4 endif if DRAW_LEAF_IF_HAVE_FOCUS push ax, dx ;save left, top for leaf #L6,7 endif clc ;left pos OK call DrawEtchedVLine ;draw left edge xchg ax, cx ;pass right x pos stc ;need to fix if etching call DrawEtchedVLine ;draw right edge if CTRL_ROUNDED_BOX_CORNERS pop bx, dx ; #C4,5 sub ax, 4 add cx, 4 endif xchg ax, cx ;restore original setup xchg bx, dx ;pass bottom x pos stc ;need to fix if etching dec cx ;this pixel already drawn call DrawEtchedHLine ;draw bottom line inc cx if DRAW_LEAF_IF_HAVE_FOCUS pop di, bx ;left, top to draw leaf...#L6,7 call DrawLeafIfHaveFocus ;see if have focus, draw leaf endif ; ; Calculate how much line to draw to the left and right of the ; moniker. And draw them. ; mov bx, dx ;pass top x pos again if DRAW_LEAF_IF_HAVE_FOCUS pop di ;restore moniker height #L3 add bx, di ;add to top, for underline endif pop di ;restore moniker width #2 pop dx ;restore control width #1 if CTRL_ROUNDED_BOX_CORNERS mov dx, cx sub dx, ax ;width = x2-x1 endif call DrawCtrlFrameTopLines ;draw top lines if _MOTIF or _ISUI raisedFrameDone: endif endif ; DRAW_STYLES ----------------------------------------------------------- ret if _ISUI setBlack: push ax mov ax, C_BLACK call GrSetLineColor pop ax retn setDark: push ax call GetDarkColor call GrSetLineColor pop ax retn endif DrawCtrlFrame endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DrawLeafIfHaveFocus %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Draw the silly leaf if we have the focus. CALLED BY: DrawCtrlFrame PASS: *ds:si -- OLCtrl di, bx -- left/bottom corner of leaf if we draw bp -- gstate RETURN: nothing DESTROYED: di, bx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 8/25/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if DRAW_LEAF_IF_HAVE_FOCUS DrawLeafIfHaveFocus proc near uses ax, cx, dx, ds, si .enter push bx mov ax, HINT_INTERACTION_FOCUSABLE call ObjVarFindData pop bx jnc exit ;not doing this shme mov ax, di ;left edge mov dx, bx ;bottom edge mov di, bp ;gstate in di ; ; Clear out area behind leaf ; push ax mov ax, C_WHITE call GrSetAreaColor pop ax mov bx, dx sub bx, CTRL_LEAF_ICON_HEIGHT mov cx, ax add cx, CTRL_LEAF_ICON_WIDTH inc ax ;back off of outside lines dec dx call GrFillRect dec ax ;restore inc dx push di mov di, ds:[si] add di, ds:[di].Vis_offset test ds:[di].OLCI_rudyFlags, mask OLCRF_HAS_FOCUS pop di jz exit ; ; Doing a leaf, gotta clear some more pixels. ; push bx ;save bitmap top dec ax inc dx inc dx call GrFillRect inc ax pop bx ; ; Now for our fun little leaf! ; push ax mov ax, C_BLACK call GrSetAreaColor pop ax clr dx ;no callback FXIP < push bx, ax > FXIP < mov bx, handle DrawBWRegions > FXIP < call MemLock > FXIP < mov ds, ax > FXIP < pop bx, ax > NOFXIP <segmov ds, cs, si > mov si, offset LeafBlackBitmap call GrFillBitmap push ax mov ax, C_LIGHT_GREY call GrSetAreaColor pop ax mov si, offset LeafGreyBitmap call GrFillBitmap FXIP < mov bx, handle DrawBWRegions > FXIP < call MemUnlock > exit: .leave ret DrawLeafIfHaveFocus endp FXIP < DrawBWRegions segment resource > LeafBlackBitmap label word word CTRL_LEAF_ICON_WIDTH ;width word CTRL_LEAF_ICON_HEIGHT ;height byte BMC_UNCOMPACTED ;method of compaction byte BMF_MONO ;bitmap type byte 11111111b, 11110000b byte 01000000b, 00010000b byte 00100000b, 00010000b byte 00010000b, 00010000b byte 00001000b, 00010000b byte 00000100b, 00010000b byte 00000010b, 00010000b byte 00000001b, 00010000b byte 00000000b, 10010000b byte 00000000b, 01010000b byte 00000000b, 00110000b byte 00000000b, 00010000b LeafGreyBitmap label word word CTRL_LEAF_ICON_WIDTH ;width word CTRL_LEAF_ICON_HEIGHT ;height byte BMC_UNCOMPACTED ;method of compaction byte BMF_MONO ;bitmap type byte 00000000b, 00000000b byte 00111111b, 11100000b byte 00011111b, 11100000b byte 00001111b, 11100000b byte 00000111b, 11100000b byte 00000011b, 11100000b byte 00000001b, 11100000b byte 00000000b, 11100000b byte 00000000b, 01100000b byte 00000000b, 00100000b byte 00000000b, 00000000b byte 00000000b, 00000000b FXIP <DrawBWRegions ends > endif COMMENT @---------------------------------------------------------------------- ROUTINE: DrawEtchedVLine SYNOPSIS: Draws an etched line. CALLED BY: DrawCtrlFrame PASS: ax -- x position bx, dx -- top, bottom di -- gstate, with GS_areaColor = C_BLACK carry set if we should decrement ax if etching if RUDY: carry set means draw a shadow. RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 12/12/92 Initial version ------------------------------------------------------------------------------@ if (not DRAW_STYLES) ; not needed for draw styles frame drawing DrawEtchedVLine proc near uses ax .enter if _MOTIF or _ISUI jnc 10$ ;no position problems, branch call OpenCheckIfBW ;B/W, branch jc 10$ dec ax ;adjust ax for first line 10$: call GrDrawVLine call OpenCheckIfBW jc exit ;B/W, done inc ax call SetWhiteIfNotClearing pushf call GrDrawVLine popf jc exit ;didn't change color, exit call SetBlack exit: else ;not _MOTIF or _ISUI call GrDrawVLine endif .leave ret DrawEtchedVLine endp endif ; (not DRAW_STYLES) COMMENT @---------------------------------------------------------------------- ROUTINE: DrawEtchedHLine SYNOPSIS: Draws an etched horizontal line. CALLED BY: DrawCtrlFrame PASS: ax, cx -- left, right bx -- y position di -- gstate, with GS_areaColor = C_BLACK carry set if we should decrement bx if etching bp set if we're actually clearing the thing (i.e drawing in the window bkgd color) if RUDY: carry set means draw a shadow. RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: Note: Coordinates are line coordinates, so if using GrFillXX, make sure to asjust. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 12/12/92 Initial version ------------------------------------------------------------------------------@ DrawEtchedHLine proc near uses bx .enter if _MOTIF or _ISUI jnc 10$ ;no position problems, branch call OpenCheckIfBW ;B/W, branch jc 10$ dec bx 10$: call GrDrawHLine call OpenCheckIfBW jc exit ;B/W, done inc bx call SetWhiteIfNotClearing pushf call GrDrawHLine popf jc exit ;didn't change color, exit call SetBlack exit: else ;not _MOTIF or _ISUI call GrDrawHLine endif .leave ret DrawEtchedHLine endp if (_MOTIF or _ISUI) SetWhiteIfNotClearing proc near uses ax .enter mov ax, C_WHITE call SetColorIfNotClearing .leave ret SetWhiteIfNotClearing endp SetBlack proc near uses ax .enter mov ax, C_BLACK call GrSetLineColor .leave ret SetBlack endp SetColorIfNotClearing proc near ; ax - color ; returns carry set if nothing done push ax, bx, ds ;this code makes me sad. call GrGetLineColor ;returns RGB line color tst al jnz 10$ tst bx 10$: pop ax, bx, ds stc jnz exit ;not doing black (0.0.0), exit call GrSetLineColor clc exit: ret SetColorIfNotClearing endp endif if (not DRAW_STYLES) ; not needed for draw styles frame drawing COMMENT @---------------------------------------------------------------------- ROUTINE: DrawCtrlFrameTopLines SYNOPSIS: Draws top lines of a framed OLCtrl. CALLED BY: DrawCtrlFrame PASS: *ds:si -- ctrl ax -- left edge to draw from cx -- right edge to draw to bx -- y position of top di -- moniker width dx -- control width bp -- gstate RETURN: nothing DESTROYED: ax, bx, cx, dx, bp, di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 10/17/92 Initial version ------------------------------------------------------------------------------@ DrawCtrlFrameTopLines proc near uses si .enter mov si, ds:[si] add si, ds:[si].Vis_offset ; ; First, calculate how far to draw the left part of the line to, based ; on the justification being used. ; tst di ;no moniker, draw whole thing jz gotLeftLineLen test ds:[si].OLCI_moreFlags, mask OLCOF_LEFT_JUSTIFY_MONIKER jnz leftJustified ;left justified, branch sub dx, di ;dx <- length - mkrWidth sub dx, OL_CTRL_MKR_MARGIN * 2 ;leave margins around moniker tst dx jns 10$ clr dx 10$: test ds:[si].OLCI_moreFlags, mask OLCOF_RIGHT_JUSTIFY_MONIKER jnz rightJustified ;right justified, branch shr dx, 1 ;else centering: divide by two jmp short gotLeftLineLen rightJustified: sub dx, TOP_FRAME_AT_END_MARGIN ;right justified, leave a bit jmp short gotLeftLineLen ; of a line on right side leftJustified: test ds:[si].OLCI_moreFlags, \ mask OLCOF_ALIGN_LEFT_MKR_EDGE_WITH_CHILD jz noMaligning mov dx, ds:[si].OLCI_monikerPos.P_x ;use our special left inset sub dx, OL_CTRL_MKR_MARGIN jnz gotLeftLineLen clr dx jmp short gotLeftLineLen noMaligning: mov dx, TOP_FRAME_AT_END_MARGIN ;leave a little line on left gotLeftLineLen: push cx ;save right edge mov cx, ax ;left edge in cx add cx, dx ;add line before moniker dec cx ;adjust for strange text place push di ;save length of moniker mov di, bp inc ax ;this pixel already drawn clc ;position OK call DrawEtchedHLine ;draw the line left of moniker pop ax ;restore moniker length tst ax jz doneEarly ;no moniker, done. add ax, cx ;add right edge of line add ax, OL_CTRL_MKR_MARGIN*2 ;add space around moniker pop cx ;restore right edge dec ax ;adjust for strange text place if _MOTIF call OpenCheckIfBW jc rightEdgeOK sub cx, 2 ;these 2 pixels already drawn rightEdgeOK: endif clc ;position OK call DrawEtchedHLine ;and draw the right line jmp short exit doneEarly: pop cx exit: .leave ret DrawCtrlFrameTopLines endp endif ; (not DRAW_STYLES) COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DrawRoundedBoxCorners %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Draw rounded corners CALLED BY: DrawCtrlFrame PASS: *ds:si = ctrl (ax,bx,cx,dx) = box corners di = gstate, with GS_areaColor = C_BLACK RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Joon 5/ 5/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if CTRL_ROUNDED_BOX_CORNERS ;---------------------------------------------- DrawRoundedBoxCorners proc near uses cx,dx,si,ds .enter push ax mov ax, C_BLACK call GrSetAreaColor pop ax segmov ds, cs mov si, offset RoundedBoxCorners sub cx, ax sub dx, bx call GrDrawRegion .leave ret DrawRoundedBoxCorners endp RoundedBoxCorners label Region word 0, 0, PARAM_2-1, PARAM_3-1 ;bounds word 0, EOREGREC word 1, 2, 3, PARAM_2-3, PARAM_2-2, EOREGREC word 3, 1, 1, PARAM_2-1, PARAM_2-1, EOREGREC word PARAM_3-4, EOREGREC word PARAM_3-2, 1, 1, PARAM_2-1, PARAM_2-1, EOREGREC word PARAM_3-1, 2, 3, PARAM_2-3, PARAM_2-2, EOREGREC word EOREGREC endif ;-------------------------------------------------------------- COMMENT @---------------------------------------------------------------------- ROUTINE: ClearMonikerArea SYNOPSIS: Clears the area behind the moniker. We also must clear the area around the frame, if any. CALLED BY: DrawCtrlMoniker PASS: *ds:si -- handle of moniker bp -- gstate RETURN: nothing DESTROYED: ax, bx, cx, dx, di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 1/29/90 Initial version ------------------------------------------------------------------------------@ ClearMonikerArea proc near ;CANNOT BE FAR ROUTINE ; AS WRITTEN! if CTRL_USES_BACKGROUND_COLOR ; ; use wash color or custom background color to clear moniker area ; call OpenGetWashColors ; ax = colors mov cx, ax call GetCtrlCustomColor ; any custom color? jnc useColor ; use wash color mov cx, ax ; use custom color useColor: clr ax ; CF_INDEX mov al, cl ; main color else ;al <- color scheme. push ds mov ax, segment moCS_dsLightColor mov ds, ax mov al, ds:[moCS_dsLightColor] ;get the light display ; scheme color pop ds if PARENT_CTRLS_INVERTED_ON_CHILD_FOCUS mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset ;ds:[di] -- SpecInstance test ds:[di].OLCI_rudyFlags, mask OLCRF_HAS_FOCUS jz afterFocusWeirdness mov al, SELECTED_TEXT_BACKGROUND afterFocusWeirdness: endif clr ah endif ; CTRL_USES_BACKGROUND_COLOR mov di, bp ;pass gstate call GrSetAreaColor ;set as area color call GrSetLineColor ;and line color mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset ;ds:[di] -- SpecInstance test ds:[di].OLCI_optFlags, mask OLCOF_DISPLAY_MONIKER pushf ;save display mkr flag test ds:[di].OLCI_optFlags, mask OLCOF_DISPLAY_BORDER jz clearMkr ;no border, branch if DRAW_STYLES ; ; for draw styles, just clear rect as DrawCtrlFrame always draws ; with fixed colors ; bp = gstate ; if CTRL_USES_BACKGROUND_COLOR ; cx = wash colors push cx ; save wash colors push cx ; save wash colors again mov di, bp ; di = gstate call VisGetBounds dec cx ; adjust for ? dec dx call GrDrawRect mov bp, ax ; bp = left bound pop ax ; ax = wash colors cmp al, ah je noLineMaskColor mov al, ah clr ah call GrSetLineColor ; set mask color mov al, SDM_50 call GrSetLineMask mov ax, bp ; ax = left bound call GrDrawRect mov al, SDM_100 call GrSetLineMask noLineMaskColor: mov bp, di ; bp = gstate pop cx ; cx = wash colors else call VisGetBounds dec cx ; adjust for ? dec dx call GrDrawRect endif ; CTRL_USES_BACKGROUND_COLOR else call DrawCtrlFrame ;clear out the damn frame. endif ; DRAW_STYLES clearMkr: popf ;restore display mkr flag jz exit ;no moniker, branch if CTRL_USES_BACKGROUND_COLOR mov di, cx ; save wash colors endif call VisGetBoundsInsideMargins mov dx, bx ;dx - top of area push cx ;save right edge of area if CTRL_USES_BACKGROUND_COLOR push di ; save wash colors endif mov cx, ax ;cx - left edge of area mov di, ds:[si] ;point to instance add di, ds:[di].Vis_offset ;ds:[di] -- VisInstance mov ax, ds:[di].VI_bounds.R_left ;real left and top mov bx, ds:[di].VI_bounds.R_top if PARENT_CTRLS_INVERTED_ON_CHILD_FOCUS add bl, ds:[di].OLCI_invTopMargin adc bh, 0 endif test ds:[di].OLCI_optFlags, mask OLCOF_DISPLAY_MKR_ABOVE jnz above ;displaying above, branch ;left: ; Do stuff to left. mov dx, ds:[di].VI_bounds.R_bottom if PARENT_CTRLS_INVERTED_ON_CHILD_FOCUS sub dl, ds:[di].OLCI_invBotMargin sbb dh, 0 endif if CTRL_USES_BACKGROUND_COLOR pop di ; di = wash colors endif call fillIfAnything ; Do stuff to right. 6/ 5/94 cbh pop ax ;get right edge of kids if CTRL_USES_BACKGROUND_COLOR call getRightBound ; cx = right bound else mov cx, ds:[di].VI_bounds.R_right endif jmp short fillIfAnything ;and go clear things above: if CTRL_USES_BACKGROUND_COLOR pop di ; di = wash colors endif pop cx ;toss saved right edge if CTRL_USES_BACKGROUND_COLOR call getRightBound ; cx = right bound else mov cx, ds:[di].VI_bounds.R_right ;clear to right edge endif fillIfAnything: ; ; rect = ax, bx, cx, dx ; bp = gstate if CTRL_USES_BACKGROUND_COLOR ; di = wash colors endif ; preserves di ; push di cmp ax, cx jge nope ;ax=cx does nothing cmp bx, dx jge nope mov di, bp ;gstate in di if PARENT_CTRLS_INVERTED_ON_CHILD_FOCUS inc cx ;and hope for the best ;Another terrible hack to limit the size of the inverted area. push bp push di mov di, ds:[si] add di, ds:[di].Vis_offset test ds:[di].OLCI_rudyFlags, mask OLCRF_HAS_FOCUS pop di jz afterHack mov bp, dx sub bp, bx cmp bp, 24 ;avoid too large an outline jbe afterHack mov dx, bx add dx, 16 afterHack: pop bp endif call GrFillRect ;and fill in the rectangle if CTRL_USES_BACKGROUND_COLOR ; ; handle wash mask color, if any ; ax, bx, cx, dx = bounds ; bp = di = gstate ; on stack: wash colors ; pop di ; di = wash colors push di ; save again push bp ; save gstate xchg ax, di ; ax = wash colors, di = left xchg bp, di ; bp = left, di = gstate cmp al, ah ; any mask color? je noAreaMaskColor mov al, ah clr ah call GrSetAreaColor ; set mask color mov al, SDM_50 call GrSetAreaMask mov ax, bp ; ax = left bound call GrFillRect mov al, SDM_100 call GrSetAreaMask noAreaMaskColor: mov ax, bp ; ax = left bound pop bp ; bp = gstate endif nope: pop di exit: retn if CTRL_USES_BACKGROUND_COLOR getRightBound label near push di ; save wash colors mov di, ds:[si] add di, ds:[di].Vis_offset mov cx, ds:[di].VI_bounds.R_right pop di ; di = save wash colors retn endif ClearMonikerArea endp COMMENT @---------------------------------------------------------------------- FUNCTION: OLCtrlBroadcastForDefaultFocus -- MSG_SPEC_BROADCAST_FOR_DEFAULT_FOCUS handler. DESCRIPTION: This broadcast method is used to find the object within a window which has HINT_DEFAULT_FOCUS{_WIN}. We handle here so that the broadcast can be propogated into GenInteractions (OLCtrl) which are inside a window. PASS: *ds:si = instance data for object RETURN: ^lcx:dx = OD of object with hint carry set if broadcast handled DESTROYED: ? PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 3/90 initial version Eric 5/90 rewritten to use broadcast which scans entire window. ------------------------------------------------------------------------------@ OLCtrlBroadcastForDefaultFocus method OLCtrlClass, \ MSG_SPEC_BROADCAST_FOR_DEFAULT_FOCUS test ds:[di].OLCI_buildFlags, mask OLBF_TOOLBOX jnz exit ;toolbox, exit, carry clear ;send MSG_SPEC_BROADCAST_FOR_DEFAULT_FOCUS to all visible ;children which are FULLY_ENABLED. Returns OD of last object in visible ;tree which has HINT_DEFAULT_FOCUS{_WIN}. mov di, 500 call ThreadBorrowStackSpace push di mov bx, offset OLBroadcastForDefaultFocus_callBack ;pass offset to callback routine, ;in Resident resource call OLResidentProcessVisChildren lahf pop di call ThreadReturnStackSpace sahf exit: ret OLCtrlBroadcastForDefaultFocus endm COMMENT @---------------------------------------------------------------------- FUNCTION: OLCtrlVupQuery DESCRIPTION: We intercept visual-upward queries here to see if we can answer them. PASS: *ds:si = instance data for object cx = SpecVisQueryType (see cConstant.def) RETURN: carry set if answered query DESTROYED: ? PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Eric 5/90 initial version Chris 6/16/92 Added SVQT_BACKGROUND_COLORS ------------------------------------------------------------------------------@ OLCtrlVupQuery method dynamic OLCtrlClass, MSG_VIS_VUP_QUERY if HOLISTIC_SCROLLBAR_POSITIONING ; ; Someone's asking us about where scrollbars should go. ; cmp cx, SVQT_SCROLLBAR_POSITION jne notHolistic ; ; bp = ScrollbarPositionQueryFlags ; We only want to manhandle the scrollbar if we are supplying ; some margin in which to place it. ; mov ax, HINT_INDENT_CHILDREN call ObjVarFindData jc isHolistic ; ; Don't send this query up past WIN_GROUP's, because we don't ; care what anyone else has to say. ; test ds:[di].VI_typeFlags, mask VTF_IS_WIN_GROUP jz callSuper ; (carry clear) ; ; And return "not answered" ; jmp done isHolistic: ; ; Are they asking for a position, or just whether or not ; we care? ; test bp, mask SPQF_IS_MANAGED_BY_VIEW jz figurePosition ; ; Tell them we like to play with left scrollbars ; mov bp, mask SPQF_LEFT jmp setCarry figurePosition: test bp, mask SPQF_LEFT jz done ; ; If indenting children, place the scrollbar inside the ; indented margin, to the left. ; call VisGetBoundsInsideMargins ; ax,bx,cx,dx push ax ; save inside X bound clr ax call RudyHandleChildIndent ; ax -> width of indent pop cx sub cx, ax mov bp, mask SPQF_LEFT_JUSTIFY jmp setCarry notHolistic: endif ; HOLISTIC_SCROLLBAR_POSITIONING ;Handled in an optimized way in copenUtils.asm ; cmp cx, SVQT_BACKGROUND_COLORS ; jne checkReplyBar ; ; test ds:[di].OLCI_buildFlags, mask OLBF_TOOLBOX ; jz done ;not in toolbox, no custom color ; ; mov ax, HINT_BACKGROUND_COLORS ; call ObjVarFindData ;see if hint exists ; jnc callSuper ;no hint, try superclass ; ; mov cx, ds:[bx].BC_unselectedColor ; mov dx, ds:[bx].BC_selectedColor ; jmp short setCarry ;else return the colors ; ;checkReplyBar: cmp cx, SVQT_QUERY_FOR_REPLY_BAR jne callSuper mov bx, ds:[di].OLCI_buildFlags ANDNF bx, mask OLBF_TARGET cmp bx, OLBT_REPLY_BAR shl offset OLBF_TARGET clc ;assume not reply bar jne done setCarry: stc done: ret callSuper: mov ax, MSG_VIS_VUP_QUERY ;ax trashed in some cases mov di,offset OLCtrlClass GOTO ObjCallSuperNoLock OLCtrlVupQuery endm if _HAS_LEGOS_LOOKS COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLCtrlSpecSetLegosLook %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Set the hints on an OLCtrl (organizational interaction, or Legos "Group" component) according to the legos look requested, after removing the hints for its previous look. these hintes are stored in tables that each different SpecUI will change according to the legos looks they support. CALLED BY: MSG_SPEC_SET_LEGOS_LOOK PASS: *ds:si = OLCtrlClass object ds:di = OLCtrlClass instance data cl = legos look RETURN: carry = set if the look was invalid (new look not set) = clear if the look was valid (new look set) DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- dlitwin 3/4/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ OLCtrlSpecSetLegosLook method dynamic OLCtrlClass, MSG_SPEC_SET_LEGOS_LOOK uses ax, cx, dx, bp .enter clr bx mov bl, ds:[di].OLCI_legosLook cmp bx, LAST_LEGOS_GROUP_LOOK jbe validExistingLook clr bx ; make the look valid if it wasn't EC< WARNING WARNING_INVALID_LEGOS_LOOK > validExistingLook: clr ch cmp cx, LAST_LEGOS_GROUP_LOOK ja invalidNewLook mov ds:[di].OLCI_legosLook, cl ; ; remove hint from old look ; shl bx ; byte value to word table offset mov ax, cs:[legosGroupLookHintTable][bx] tst bx jz noHintToRemove call ObjVarDeleteData ; ; add hints for new look ; noHintToRemove: mov bx, cx shl bx ; byte value to word table offset mov ax, cs:[legosGroupLookHintTable][bx] tst bx jz noHintToAdd ; no hints for look zero clr cx call ObjVarAddData noHintToAdd: clc done: .leave ret invalidNewLook: stc jmp done OLCtrlSpecSetLegosLook endm ; ; Make sure this table matches that in copenCtrlClass.asm. The ; only reason the table is in two places it is that I don't want ; to be bringing in the CommonFunctional resource at build time, ; and it is really a small table. ; Make sure any changes in either table are reflected in the other ; legosGroupLookHintTable label word word 0 LAST_LEGOS_GROUP_LOOK equ ((($ - legosGroupLookHintTable)/(size word)) - 1) CheckHack<LAST_LEGOS_GROUP_LOOK eq LAST_BUILD_LEGOS_GROUP_LOOK> COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLCtrlSpecGetLegosLook %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Get the legos look. CALLED BY: MSG_SPEC_GET_LEGOS_LOOK PASS: *ds:si = OLCtrlClass object ds:di = OLCtrlClass instance data RETURN: cl = legos look DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- dlitwin 10/11/95 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ OLCtrlSpecGetLegosLook method dynamic OLCtrlClass, MSG_SPEC_GET_LEGOS_LOOK .enter mov cl, ds:[di].OLCI_legosLook .leave ret OLCtrlSpecGetLegosLook endm endif ; if _HAS_LEGOS_LOOKS COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% OLCtrlNotifyEnabled %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: forward notification to notebook parts CALLED BY: MSG_SPEC_NOTIFY_ENABLED, MSG_SPEC_NOTIFY_NOT_ENABLED PASS: *ds:si = OLCtrlClass object ds:di = OLCtrlClass instance data ds:bx = OLCtrlClass object (same as *ds:si) es = segment of OLCtrlClass ax = message # dl = update mode dh = NotifyEnabledFlags RETURN: carry set if visual state changed DESTROYED: SIDE EFFECTS: PSEUDO CODE/STRATEGY: If we are a Background control, we have a NotebookBinderClass child (the only vis child) and we have vardata pointing to the left and right pages and the notebook ring. REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 9/11/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if NOTEBOOK_INTERACTION OLCtrlNotifyEnabled method dynamic OLCtrlClass, MSG_SPEC_NOTIFY_ENABLED, MSG_SPEC_NOTIFY_NOT_ENABLED push ax, dx mov di, offset OLCtrlClass ; call superclass call ObjCallSuperNoLock pop ax, dx jnc exit ; nothing special happened, exit push ax ; save message mov ax, TEMP_OL_CTRL_NOTEBOOK_PARTS call ObjVarFindData pop ax jnc done ; not a Background push ds:[bx].TOCNP_rightPage push ds:[bx].TOCNP_rings push ds:[bx].TOCNP_leftPage push ax, dx call VisCallFirstChild ; send to NotebookBinderClass pop ax, dx pop si ; *ds:si = leftPage call callPart pop si ; *ds:si = rings call callPart pop si ; *ds:si = right page call callPart done: stc ; indicate something changed exit: ret callPart label near tst si jz noPart push ax, dx call ObjCallInstanceNoLock pop ax, dx noPart: retn OLCtrlNotifyEnabled endm endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% NotebookBinderVisDraw %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Draw left, right, bottom border CALLED BY: MSG_VIS_DRAW PASS: *ds:si = NotebookBinderClass object ds:di = NotebookBinderClass instance data ds:bx = NotebookBinderClass object (same as *ds:si) es = segment of NotebookBinderClass ax = message # cl = DrawFlags ^hbp = GState RETURN: nothing DESTROYED: ax, cx, dx, bp SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- joon 1/ 1/97 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if NOTEBOOK_INTERACTION NotebookBinderVisDraw method dynamic NotebookBinderClass, MSG_VIS_DRAW push bp mov di, offset NotebookBinderClass call ObjCallSuperNoLock pop di mov ax, C_BLACK call GrSetLineColor call VisGetBounds dec cx ; adjust for line drawing dec dx ; adjust for line drawing call GrDrawVLine ; draw left border xchg ax, cx call GrDrawVLine ; draw right border mov bx, dx GOTO GrDrawHLine ; draw bottom border NotebookBinderVisDraw endm endif ; NOTEBOOK_INTERACTION if _ISUI OLCtrlNoInputDestination method dynamic OLCtrlClass, MSG_SPEC_NO_INPUT_DESTINATION cmp bp, MSG_META_START_MOVE_COPY jne done push ds mov ax, segment olRightClickHelp mov ds, ax tst ds:[olRightClickHelp] pop ds jz done call ShowHelpMenu done: ret OLCtrlNoInputDestination endm endif CommonFunctional ends
23.932978
80
0.638712
[ "Apache-2.0" ]
BOBBYWY/pcgeos
Library/SpecUI/CommonUI/CComp/copenCtrlCommon.asm
53,921
Assembly
pushpc org $0ef51b jml RenderCharExtended org $0ef520 RenderCharExtended_returnOriginal: org $0ef567 RenderCharExtended_returnUncompressed: org $0ef356 jsl RenderCharLookupWidth org $0ef3ba jsl RenderCharLookupWidth org $0ef48e jml RenderCharLookupWidthDraw org $0ef499 RenderCharLookupWidthDraw_return: org $0ef6aa jml RenderCharToMapExtended org $0ef6c2 RenderCharToMapExtended_return: org $0efa50 jsl RenderCharSetColorExtended org $0eee5d jsl RenderCharSetColorExtended_init org $0ef285 jsl RenderCharSetColorExtended_close : nop org $531000 NewFont: incbin data/newfont.bin NewFontInverted: incbin data/newfont_inverted.bin pullpc !INVERTED_TEMP = $35 RenderCharSetColorExtended_init: stz !INVERTED_TEMP jsl $00d84e rtl RenderCharSetColorExtended_close: stz !INVERTED_TEMP lda $010c sta $10 rtl RenderCharSetColorExtended: pha and #$10 cmp #$10 beq .inverted lda #$00 bra .end .inverted lda #$01 .end sta !INVERTED_TEMP pla and #$07 : asl : asl rtl RenderCharToMapExtended: phx : tya : asl #2 : tax lda.l FontProperties, x and #$0001 bne .uncompressed .compressed plx lda #$0000 sta $00 lda #$007f sta $02 lda #$0000 clc : adc #$0020 sta $03 lda #$007f sta $05 jml RenderCharToMapExtended_return .uncompressed lda.l FontProperties+$2, x plx clc : adc #(NewFont&$ffff) sta $00 clc : adc #$0100 pha lda #(NewFont>>16) sta $02 pla : sta $03 lda #(NewFont>>16) sta $05 jml RenderCharToMapExtended_return RenderCharLookupWidthDraw: rep #$30 phx : lda $09 : and #$fffe : tax lda.l FontProperties, x bmi .thin .wide plx : sep #$30 lda $09 : and #$03 : tay lda $fd7c, y : tay jml RenderCharLookupWidthDraw_return .thin plx : sep #$30 lda $09 : and #$03 : phx : tax lda.l RenderCharThinTable, x : tay : plx jml RenderCharLookupWidthDraw_return RenderCharLookupWidth: phx : lda $09 : and #$fffe : tax lda.l FontProperties, x bmi .thin .wide plx : lda $fd7c, x : clc rtl .thin plx : lda.l RenderCharThinTable, x : clc rtl RenderCharThinTable: db $08, $00, $ff RenderCharExtended: pha asl : asl : tax lda.l FontProperties, x and #$00ff bne .renderUncompressed .renderOriginal pla : asl : tax : asl : adc $0e jml RenderCharExtended_returnOriginal .renderUncompressed pla : phb : pea $5353 : plb : plb lda.l FontProperties+$2, x tay lda !INVERTED_TEMP bne .inverted ldx #$00000 - lda.w NewFont, y sta.l $7EBFC0, x lda.w NewFont+$100, y sta.l $7EBFC0+$16, x inx #2 iny #2 cpx #$0010 bne - bra .end .inverted ldx #$00000 - lda.w NewFontInverted, y sta.l $7EBFC0, x lda.w NewFontInverted+$100, y sta.l $7EBFC0+$16, x inx #2 iny #2 cpx #$0010 bne - .end plb jml RenderCharExtended_returnUncompressed ; Table of font properties and tilemap offset ; Properties are these for now: ; t---- ----u ; t = thin spacing (0 px instead of 3 px) ; u = uncompressed character loaded from offset FontProperties: ; props, offset dw $0000, $0000 ; 00 dw $0000, $0000 ; 01 dw $0000, $0000 ; 02 dw $0000, $0000 ; 03 dw $0000, $0000 ; 04 dw $0000, $0000 ; 05 dw $0000, $0000 ; 06 dw $0000, $0000 ; 07 dw $0000, $0000 ; 08 dw $0000, $0000 ; 09 dw $0000, $0000 ; 0A dw $0000, $0000 ; 0B dw $0000, $0000 ; 0C dw $0000, $0000 ; 0D dw $0000, $0000 ; 0E dw $0000, $0000 ; 0F dw $0000, $0000 ; 10 dw $0000, $0000 ; 11 dw $0000, $0000 ; 12 dw $0000, $0000 ; 13 dw $0000, $0000 ; 14 dw $0000, $0000 ; 15 dw $0000, $0000 ; 16 dw $0000, $0000 ; 17 dw $0000, $0000 ; 18 dw $0000, $0000 ; 19 dw $0000, $0000 ; 1A dw $0000, $0000 ; 1B dw $0000, $0000 ; 1C dw $0000, $0000 ; 1D dw $0000, $0000 ; 1E dw $0000, $0000 ; 1F dw $0000, $0000 ; 20 dw $0000, $0000 ; 21 dw $0000, $0000 ; 22 dw $0000, $0000 ; 23 dw $0000, $0000 ; 24 dw $0000, $0000 ; 25 dw $0000, $0000 ; 26 dw $0000, $0000 ; 27 dw $0000, $0000 ; 28 dw $0000, $0000 ; 29 dw $0000, $0000 ; 2A dw $0000, $0000 ; 2B dw $0000, $0000 ; 2C dw $0000, $0000 ; 2D dw $0000, $0000 ; 2E dw $0000, $0000 ; 2F dw $8001, $0400 ; 30 dw $8001, $0410 ; 31 dw $8001, $0420 ; 32 dw $8001, $0430 ; 33 dw $8001, $0440 ; 34 dw $8001, $0450 ; 35 dw $8001, $0460 ; 36 dw $8001, $0470 ; 37 dw $8001, $0480 ; 38 dw $8001, $0490 ; 39 dw $8001, $04A0 ; 3A dw $8001, $04B0 ; 3B dw $8001, $04C0 ; 3C dw $8001, $04D0 ; 3D dw $8001, $04E0 ; 3E dw $8001, $04F0 ; 3F dw $8001, $0600 ; 40 dw $8001, $0610 ; 41 dw $8001, $0620 ; 42 dw $8001, $0630 ; 43 dw $8001, $0640 ; 44 dw $8001, $0650 ; 45 dw $8001, $0660 ; 46 dw $8001, $0670 ; 47 dw $8001, $0680 ; 48 dw $8001, $0690 ; 49 ; z dw $8001, $06F0 ; 4A ; : dw $8001, $0A90 ; 4B ; @ (thin) dw $8001, $0AA0 ; 4C ; # (thin) dw $8001, $0AB0 ; 4D ; morphball left dw $8001, $0AC0 ; 4E ; morphball right dw $8001, $0EF0 ; 4F dw $0000, $0000 ; 50 dw $0000, $0000 ; 51 dw $0000, $0000 ; 52 dw $0000, $0000 ; 53 dw $0000, $0000 ; 54 dw $0000, $0000 ; 55 dw $0000, $0000 ; 56 dw $0000, $0000 ; 57 dw $0000, $0000 ; 58 dw $0000, $0000 ; 59 dw $0000, $0000 ; 5A dw $0000, $0000 ; 5B dw $0000, $0000 ; 5C dw $0000, $0000 ; 5D dw $0000, $0000 ; 5E dw $0000, $0000 ; 5F dw $0000, $0000 ; 60 dw $0000, $0000 ; 61 dw $0000, $0000 ; 62 dw $0000, $0000 ; 63 dw $0000, $0000 ; 64 dw $0000, $0000 ; 65 dw $0000, $0000 ; 66 dw $0000, $0000 ; 67 dw $0000, $0000 ; 68 dw $0000, $0000 ; 69 dw $0000, $0000 ; 6A dw $0000, $0000 ; 6B dw $0000, $0000 ; 6C dw $0000, $0000 ; 6D dw $0000, $0000 ; 6E dw $0000, $0000 ; 6F dw $0000, $0000 ; 70 dw $0000, $0000 ; 71 dw $0000, $0000 ; 72 dw $0000, $0000 ; 73 dw $0000, $0000 ; 74 dw $0000, $0000 ; 75 dw $0000, $0000 ; 76 dw $0000, $0000 ; 77 dw $0000, $0000 ; 78 dw $0000, $0000 ; 79 dw $0000, $0000 ; 7A dw $0000, $0000 ; 7B dw $0000, $0000 ; 7C dw $0000, $0000 ; 7D dw $0000, $0000 ; 7E dw $0000, $0000 ; 7F dw $0000, $0000 ; 80 dw $0000, $0000 ; 81 dw $0000, $0000 ; 82 dw $0000, $0000 ; 83 dw $0000, $0000 ; 84 dw $0000, $0000 ; 85 dw $0000, $0000 ; 86 dw $0000, $0000 ; 87 dw $0000, $0000 ; 88 dw $0000, $0000 ; 89 dw $0000, $0000 ; 8A dw $0000, $0000 ; 8B dw $0000, $0000 ; 8C dw $0000, $0000 ; 8D dw $0000, $0000 ; 8E dw $0000, $0000 ; 8F dw $0000, $0000 ; 90 dw $0000, $0000 ; 91 dw $0000, $0000 ; 92 dw $0000, $0000 ; 93 dw $0000, $0000 ; 94 dw $0000, $0000 ; 95 dw $0000, $0000 ; 96 dw $0000, $0000 ; 97 dw $0000, $0000 ; 98 dw $0000, $0000 ; 99 dw $0000, $0000 ; 9A dw $0000, $0000 ; 9B dw $0000, $0000 ; 9C dw $0000, $0000 ; 9D dw $0000, $0000 ; 9E dw $0000, $0000 ; 9F dw $8001, $0800 ; A0 dw $8001, $0810 ; A1 dw $8001, $0820 ; A2 dw $8001, $0830 ; A3 dw $8001, $0840 ; A4 dw $8001, $0850 ; A5 dw $8001, $0860 ; A6 dw $8001, $0870 ; A7 dw $8001, $0880 ; A8 dw $8001, $0890 ; A9 dw $8001, $0000 ; AA dw $8001, $0010 ; AB dw $8001, $0020 ; AC dw $8001, $0030 ; AD dw $8001, $0040 ; AE dw $8001, $0050 ; AF dw $8001, $0060 ; B0 dw $8001, $0070 ; B1 dw $8001, $0080 ; B2 dw $8001, $0090 ; B3 dw $8001, $00A0 ; B4 dw $8001, $00B0 ; B5 dw $8001, $00C0 ; B6 dw $8001, $00D0 ; B7 dw $8001, $00E0 ; B8 dw $8001, $00F0 ; B9 dw $8001, $0200 ; BA dw $8001, $0210 ; BB dw $8001, $0220 ; BC dw $8001, $0230 ; BD dw $8001, $0240 ; BE dw $8001, $0250 ; BF dw $8001, $0260 ; C0 dw $8001, $0270 ; C1 dw $8001, $0280 ; C2 dw $8001, $0290 ; C3 Z dw $8000, $0000 ; C4 dw $8000, $0000 ; C5 dw $8001, $06D0 ; C6 ? dw $8001, $06C0 ; C7 ! dw $8001, $02D0 ; C8 , dw $8001, $02B0 ; C9 - dw $8000, $0000 ; CA dw $8000, $0000 ; CB dw $8000, $02E0 ; CC ... dw $8001, $02C0 ; CD . dw $8001, $02F0 ; CE ~ dw $8000, $0000 ; CF dw $0000, $0000 ; D0 dw $0000, $0000 ; D1 dw $8001, $06a0 ; D2 Link face left dw $8001, $06b0 ; D3 Link face right dw $0000, $0000 ; D4 dw $0000, $0000 ; D5 dw $0000, $0000 ; D6 dw $0000, $0000 ; D7 dw $8001, $06E0 ; D8 ' dw $0000, $0000 ; D9 dw $0000, $0000 ; DA dw $0000, $0000 ; DB dw $0000, $0000 ; DC dw $0000, $0000 ; DD dw $0000, $0000 ; DE dw $0000, $0000 ; DF dw $0000, $0000 ; E0 dw $0000, $0000 ; E1 dw $0000, $0000 ; E2 dw $0000, $0000 ; E3 dw $8001, $02A0 ; E4 Arrow > dw $0000, $0000 ; E5 dw $0000, $0000 ; E6 dw $0000, $0000 ; E7 dw $0000, $0000 ; E8 dw $0000, $0000 ; E9 dw $0000, $0000 ; EA dw $0000, $0000 ; EB dw $0000, $0000 ; EC dw $0000, $0000 ; ED dw $0000, $0000 ; EE dw $0000, $0000 ; EF dw $0000, $0000 ; F0 dw $0000, $0000 ; F1 dw $0000, $0000 ; F2 dw $0000, $0000 ; F3 dw $0000, $0000 ; F4 dw $0000, $0000 ; F5 dw $0000, $0000 ; F6 dw $0000, $0000 ; F7 dw $0000, $0000 ; F8 dw $0000, $0000 ; F9 dw $0000, $0000 ; FA dw $0000, $0000 ; FB dw $0000, $0000 ; FC dw $0000, $0000 ; FD dw $0000, $0000 ; FE dw $8001, $0EF0 ; FF
25.942478
48
0.449429
[ "MIT" ]
SmolBig/alttp_sm_combo_randomizer_rom
src/z3/randomizer/textrenderer.asm
11,726
Assembly
; A052768: A simple grammar. ; 0,0,0,0,0,120,360,840,1680,3024,5040,7920,11880,17160,24024,32760,43680,57120,73440,93024,116280,143640,175560,212520,255024,303600,358800,421200,491400,570024,657720,755160,863040,982080,1113024 bin $0,4 lpb $0 bin $0,2 lpe mul $0,24
29.888889
197
0.762082
[ "Apache-2.0" ]
ckrause/cm
programs/oeis/052/A052768.asm
269
Assembly
; A082903: a(n) = gcd(2^n, sigma_1(n)) = gcd(A000079(n), A000203(n)) also a(n) = gcd(2^n, sigma_3(n)) = gcd(A000079(n), A001158(n)). ; 1,1,4,1,2,4,8,1,1,2,4,4,2,8,8,1,2,1,4,2,32,4,8,4,1,2,8,8,2,8,32,1,16,2,16,1,2,4,8,2,2,32,4,4,2,8,16,4,1,1,8,2,2,8,8,8,16,2,4,8,2,32,8,1,4,16,4,2,32,16,8,1,2,2,4,4,32,8,16,2,1,2,4,32,4,4,8,4,2,2,16,8,128,16,8,4,2,1,4,1,2,8,8,2,64,2,4,8,2,8,8,8,2,16,16,2,2,4,16,8,1,2,8,32,4,8,128,1,16,4,4,16,32,4,16,2,2,32,4,16,64,8,8,1,4,2,4,2,2,4,8,4,2,32,64,8,2,16,8,2,64,1,4,2,32,4,8,32,1,4,4,4,2,8,8,4,16,2,4,2,2,16,8,8,4,128,8,16,64,8,64,4,2,2,16,1,2,4,8,1,16,2,16,8,4,8,8,2,16,64,4,2,32,4,8,8,256,2,8,8,4,8,32,8,1,2,4,16,2,16,128,2,2,2,32,4,64,16,16,8,2,1,4,2,2,8,8,32,16,4 cal $0,203 ; a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n). gcd $0,1073741824 mov $1,$0
116
565
0.575123
[ "Apache-2.0" ]
jmorken/loda
programs/oeis/082/A082903.asm
812
Assembly
hirom ORG $84E5C9 JSL $C03E00 ORG $C03E00 PHA JSL $80A73A phy ldy $15 phy sta $15 JSL $80A73A clc adc $15 lsr ply sty $15 ply CMP $01,s PLA RTL
8.318182
13
0.562842
[ "MIT" ]
RobertTheSable/snesfe-2rn
fe4.asm
183
Assembly
; Fib using stack for arg passing - but assumes exclusive use of MAR as stac pointer STACKTOP: EQU $ffff ; location of top of stack STACKPTR: EQU $feff ; location of low byte of stack ptr addressa, top byte is a const, therefore 255 byte stack STACKPTR_ADDR_HI: EQU <:STACKTOP ;fixed [:STACKPTR] = >:STACKTOP ; ram location start: REGA=1 REGB=1 PCHITMP = 0 ; push lop addr to stack MARHI=:STACKPTR_ADDR_HI MARLO=[:STACKPTR] RAM=>:loop ; put return address on stack MARLO=MARLO - 1 [:STACKPTR] = MARLO RAM=REGA ; put ARG on stack MARLO=MARLO - 1 [:STACKPTR] = MARLO PC = >:send_uart loop: REGA=REGA+REGB _S PC = >:start _C ; push lop addr to stack MARHI=:STACKPTR_ADDR_HI MARLO=[:STACKPTR] RAM = >:ret1 ; put return address on stack MARLO=MARLO - 1 [:STACKPTR] = MARLO RAM = REGA ; put ARG on stack MARLO=MARLO - 1 [:STACKPTR] = MARLO PC = >:send_uart ret1: REGB=REGA+REGB _S PC = >:start _C ; start pushing MARHI=:STACKPTR_ADDR_HI MARLO=[:STACKPTR] ; push retun address RAM = >:ret2 ; put return address on stack MARLO=MARLO - 1 ; push arg RAM = REGB ; put ARG on stack MARLO=MARLO - 1 ; end pushing [:STACKPTR] = MARLO PC = >:send_uart ret2: PC = >:loop send_uart: PC = >:transmit _DO PC = >:send_uart ;loop wait transmit: ; start popping MARHI=:STACKPTR_ADDR_HI MARLO=[:STACKPTR] ; pop arg MARLO=MARLO + 1 UART=RAM ; read ARG from stack ; pop return address MARLO=MARLO + 1 PC = RAM ; read return address from stack ; end popping [:STACKPTR] = MARLO end: END
25.75
115
0.486362
[ "MPL-2.0", "MPL-2.0-no-copyleft-exception" ]
portingle/simplecpu
jvmtools/compiler/programs/fibonacci_stack_using_pointer_optimised.asm
2,163
Assembly
Map_4E2A2: dc.w word_4E2A4-Map_4E2A2 word_4E2A4: dc.w 3 dc.b $EC, $E, 0, 0, $FF, $F4 dc.b 4, $D, 0, $C, $FF, $EC dc.b $C, 0, 0, $14, 0, $C
27.833333
37
0.467066
[ "Apache-2.0" ]
NatsumiFox/AMPS-Sonic-3-Knuckles
General/Blue Sphere/Map - Tails Pose.asm
167
Assembly
;****************************************************************************** ;* MEMCPY32.ASM - 32 BIT STATE - * ;* * ;* Copyright (c) 1996 Texas Instruments Incorporated * ;* http://www.ti.com/ * ;* * ;* Redistribution and use in source and binary forms, with or without * ;* modification, are permitted provided that the following conditions * ;* are met: * ;* * ;* Redistributions of source code must retain the above copyright * ;* notice, this list of conditions and the following disclaimer. * ;* * ;* Redistributions in binary form must reproduce the above copyright * ;* notice, this list of conditions and the following disclaimer in * ;* the documentation and/or other materials provided with the * ;* distribution. * ;* * ;* Neither the name of Texas Instruments Incorporated nor the names * ;* of its contributors may be used to endorse or promote products * ;* derived from this software without specific prior written * ;* permission. * ;* * ;* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ;* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * ;* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * ;* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * ;* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * ;* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * ;* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * ;* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * ;* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * ;* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * ;* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ;* * ;****************************************************************************** ;**************************************************************************** ;* C_MEMCPY - COPY CHARACTERS FROM SOURCE TO DEST ;* ;**************************************************************************** ;* ;* o DESTINATION LOCATION IS IN r0 ;* o SOURCE LOCATION IS IN r1 ;* o NUMBER OF CHARACTERS TO BE COPIED IS IN r2 ;**************************************************************************** .arm .if __TI_EABI_ASSEMBLER .asg memcpy, __TI_C_MEMCPY .armfunc __aeabi_memcpy .armfunc __aeabi_memcpy4 .armfunc __aeabi_memcpy8 .global __aeabi_memcpy .global __aeabi_memcpy4 .global __aeabi_memcpy8 __aeabi_memcpy: __aeabi_memcpy4: __aeabi_memcpy8: .else .clink .asg C_MEMCPY, __TI_C_MEMCPY .endif .if __TI_ARM9ABI_ASSEMBLER | __TI_EABI_ASSEMBLER .armfunc __TI_C_MEMCPY .endif .global __TI_C_MEMCPY __TI_C_MEMCPY: .asmfunc stack_usage(12) CMP r2, #0 ; CHECK FOR n == 0 BXEQ lr ; STMFD sp!, {r0, lr} ; SAVE RETURN VALUE AND ADDRESS TST r1, #0x3 ; CHECK ADDRESS ALIGNMENT BNE _unaln ; IF NOT WORD ALIGNED, HANDLE SPECIALLY TST r0, #0x3 ; BNE _saln ; _aln: CMP r2, #16 ; CHECK FOR n >= 16 BCC _l16 ; STMFD sp!, {r4} ; SUB r2, r2, #16 ; _c16: LDMIA r1!, {r3, r4, r12, lr} ; COPY 16 BYTES STMIA r0!, {r3, r4, r12, lr} ; SUBS r2, r2, #16 ; BCS _c16 ; LDMFD sp!, {r4} ; ADDS r2, r2, #16 ; RETURN IF DONE .if __TI_ARM7ABI_ASSEMBLER | __TI_ARM9ABI_ASSEMBLER | !__TI_TMS470_V4__ LDMEQFD sp!, {r0, pc} ; .else LDMEQFD sp!, {r0, lr} BXEQ lr .endif _l16: ANDS r3, r2, #0xC ; BEQ _cp1 ; BICS r2, r2, #0xC ; ADR r12, _4line - 16 ; ADD pc, r12, r3, LSL #2 ; _4line: LDR r3, [r1], #4 ; COPY 4 BYTES STR r3, [r0], #4 ; .if __TI_ARM7ABI_ASSEMBLER | __TI_ARM9ABI_ASSEMBLER | !__TI_TMS470_V4__ LDMEQFD sp!, {r0, pc} ; CHECK FOR n == 0 .else BEQ _ret .endif B _cp1 ; LDMIA r1!, {r3, r12} ; COPY 8 BYTES STMIA r0!, {r3, r12} ; .if __TI_ARM7ABI_ASSEMBLER | __TI_ARM9ABI_ASSEMBLER | !__TI_TMS470_V4__ LDMEQFD sp!, {r0, pc} ; CHECK FOR n == 0 .else BEQ _ret .endif B _cp1 ; LDMIA r1!, {r3, r12, lr} ; COPY 12 BYTES STMIA r0!, {r3, r12, lr} ; .if __TI_ARM7ABI_ASSEMBLER | __TI_ARM9ABI_ASSEMBLER | !__TI_TMS470_V4__ LDMEQFD sp!, {r0, pc} ; CHECK FOR n == 0 .else LDMEQFD sp!, {r0, lr} BXEQ lr .endif _cp1: SUBS r2, r2, #1 ; ADRNE r3, _1line - 4 ; SETUP TO COPY 1 - 3 BYTES... ADDNE pc, r3, r2, LSL #4 ; _1line: LDRB r3, [r1], #1 ; COPY 1 BYTE STRB r3, [r0], #1 ; .if __TI_ARM7ABI_ASSEMBLER | __TI_ARM9ABI_ASSEMBLER | !__TI_TMS470_V4__ LDMFD sp!, {r0, pc} ; .else B _ret .endif LDRH r3, [r1], #2 ; COPY 2 BYTES STRH r3, [r0], #2 ; .if __TI_ARM7ABI_ASSEMBLER | __TI_ARM9ABI_ASSEMBLER | !__TI_TMS470_V4__ LDMFD sp!, {r0, pc} ; NOP .else LDMFD sp!, {r0, lr} BX lr .endif LDRH r3, [r1], #2 ; COPY 3 BYTES STRH r3, [r0], #2 ; LDRB r3, [r1], #1 ; STRB r3, [r0], #1 ; .if __TI_ARM7ABI_ASSEMBLER | __TI_ARM9ABI_ASSEMBLER | !__TI_TMS470_V4__ LDMFD sp!, {r0, pc} ; .else LDMFD sp!, {r0, lr} BX lr .endif _unaln: LDRB r3, [r1], #1 ; THE ADDRESSES ARE NOT WORD ALIGNED. STRB r3, [r0], #1 ; COPY BYTES UNTIL THE SOURCE IS SUBS r2, r2, #1 ; WORD ALIGNED OR THE COPY SIZE .if __TI_ARM7ABI_ASSEMBLER | __TI_ARM9ABI_ASSEMBLER | !__TI_TMS470_V4__ LDMEQFD sp!, {r0, pc} ; BECOMES ZERO .else LDMEQFD sp!, {r0, lr} BXEQ lr .endif TST r1, #0x3 ; BNE _unaln ; _saln: TST r0, #0x1 ; IF THE ADDRESSES ARE OFF BY 1 BYTE BNE _off1 ; JUST BYTE COPY TST r0, #0x2 ; IF THE ADDRESSES ARE NOW WORD ALIGNED BEQ _aln ; GO COPY. ELSE THEY ARE OFF BY 2, SO ; GO SHORT WORD COPY _off2: SUBS r2, r2, #4 ; COPY 2 BYTES AT A TIME... BCC _c1h ; _c2: LDR r3, [r1], #4 ; START BY COPYING CHUNKS OF 4, .if .TMS470_BIG STRH r3, [r0, #2] ; MOV r3, r3, LSR #16 ; STRH r3, [r0], #4 ; .else STRH r3, [r0], #4 ; MOV r3, r3, LSR #16 ; STRH r3, [r0, #-2] ; .endif SUBS r2, r2, #4 ; BCS _c2 ; CMN r2, #4 ; .if __TI_ARM7ABI_ASSEMBLER | __TI_ARM9ABI_ASSEMBLER | !__TI_TMS470_V4__ LDMEQFD sp!, {r0, pc} ; .else LDMEQFD sp!, {r0, lr} BXEQ lr .endif _c1h: ADDS r2, r2, #2 ; THEN COPY THE ODD BYTES. LDRCSH r3, [r1], #2 ; STRCSH r3, [r0], #2 ; SUBCS r2, r2, #2 ; ADDS r2, r2, #1 ; LDRCSB r3, [r1], #1 ; STRCSB r3, [r0], #1 ; .if __TI_ARM7ABI_ASSEMBLER | __TI_ARM9ABI_ASSEMBLER | !__TI_TMS470_V4__ LDMFD sp!, {r0, pc} ; .else LDMFD sp!, {r0, lr} BX lr .endif _off1: SUBS r2, r2, #4 ; COPY 1 BYTE AT A TIME... BCC _c1b ; _c1: LDR r3, [r1], #4 ; START BY COPYING CHUNKS OF 4, .if .TMS470_BIG STRB r3, [r0, #3] ; MOV r3, r3, LSR #8 ; STRB r3, [r0, #2] ; MOV r3, r3, LSR #8 ; STRB r3, [r0, #1] ; MOV r3, r3, LSR #8 ; STRB r3, [r0], #4 ; .else STRB r3, [r0], #4 ; MOV r3, r3, LSR #8 ; STRB r3, [r0, #-3] ; MOV r3, r3, LSR #8 ; STRB r3, [r0, #-2] ; MOV r3, r3, LSR #8 ; STRB r3, [r0, #-1] ; .endif SUBS r2, r2, #4 ; BCS _c1 ; _c1b: ADDS r2, r2, #4 ; THEN COPY THE ODD BYTES. .if __TI_ARM7ABI_ASSEMBLER | __TI_ARM9ABI_ASSEMBLER | !__TI_TMS470_V4__ LDMEQFD sp!, {r0, pc} ; .else LDMEQFD sp!, {r0, lr} BXEQ lr .endif _lp1: LDRB r3, [r1], #1 ; STRB r3, [r0], #1 ; SUBS r2, r2, #1 ; BNE _lp1 ; .if __TI_ARM7ABI_ASSEMBLER | __TI_ARM9ABI_ASSEMBLER | !__TI_TMS470_V4__ _ret: LDMFD sp!, {r0, pc} ; .else _ret: LDMFD sp!, {r0, lr} BX lr .endif .endasmfunc .end
31.411321
79
0.536881
[ "MIT" ]
JosiahCraw/TI-Arm-Docker
compiler/ti-cgt-arm_18.12.4.LTS/lib/src/memcpy32.asm
8,324
Assembly
; A100617: There are n people in a room. The first half (i.e., floor(n/2)) of them leave, then 1/3 (i.e., floor of 1/3) of those remaining leave, then 1/4, then 1/5, etc.; sequence gives number who remain at the end. ; 1,1,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17 add $0,5 mov $2,$0 mov $3,1 lpb $2 sub $1,2 sub $4,3 lpb $4 sub $1,1 trn $4,$3 lpe lpb $5 mov $2,3 add $2,$1 sub $5,$0 lpe mov $1,$2 sub $2,1 add $3,1 add $4,$1 add $5,$0 lpe sub $1,4
43
673
0.601968
[ "Apache-2.0" ]
jmorken/loda
programs/oeis/100/A100617.asm
1,118
Assembly
_forktest: file format elf32-i386 Disassembly of section .text: 00000000 <main>: printf(1, "fork test OK\n"); } int main(void) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 51 push %ecx e: 83 ec 04 sub $0x4,%esp forktest(); 11: e8 3a 00 00 00 call 50 <forktest> exit(); 16: e8 87 03 00 00 call 3a2 <exit> 1b: 66 90 xchg %ax,%ax 1d: 66 90 xchg %ax,%ax 1f: 90 nop 00000020 <printf>: { 20: 55 push %ebp 21: 89 e5 mov %esp,%ebp 23: 53 push %ebx 24: 83 ec 10 sub $0x10,%esp 27: 8b 5d 0c mov 0xc(%ebp),%ebx write(fd, s, strlen(s)); 2a: 53 push %ebx 2b: e8 a0 01 00 00 call 1d0 <strlen> 30: 83 c4 0c add $0xc,%esp 33: 50 push %eax 34: 53 push %ebx 35: ff 75 08 pushl 0x8(%ebp) 38: e8 9d 03 00 00 call 3da <write> } 3d: 83 c4 10 add $0x10,%esp 40: 8b 5d fc mov -0x4(%ebp),%ebx 43: c9 leave 44: c3 ret 45: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 49: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000050 <forktest>: { 50: 55 push %ebp 51: 89 e5 mov %esp,%ebp 53: 53 push %ebx for(n=0; n<N; n++){ 54: 31 db xor %ebx,%ebx { 56: 83 ec 10 sub $0x10,%esp write(fd, s, strlen(s)); 59: 68 5c 04 00 00 push $0x45c 5e: e8 6d 01 00 00 call 1d0 <strlen> 63: 83 c4 0c add $0xc,%esp 66: 50 push %eax 67: 68 5c 04 00 00 push $0x45c 6c: 6a 01 push $0x1 6e: e8 67 03 00 00 call 3da <write> 73: 83 c4 10 add $0x10,%esp 76: eb 19 jmp 91 <forktest+0x41> 78: 90 nop 79: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(pid == 0) 80: 0f 84 7c 00 00 00 je 102 <forktest+0xb2> for(n=0; n<N; n++){ 86: 83 c3 01 add $0x1,%ebx 89: 81 fb e8 03 00 00 cmp $0x3e8,%ebx 8f: 74 4f je e0 <forktest+0x90> pid = fork(); 91: e8 04 03 00 00 call 39a <fork> if(pid < 0) 96: 85 c0 test %eax,%eax 98: 79 e6 jns 80 <forktest+0x30> for(; n > 0; n--){ 9a: 85 db test %ebx,%ebx 9c: 74 10 je ae <forktest+0x5e> 9e: 66 90 xchg %ax,%ax if(wait() < 0){ a0: e8 05 03 00 00 call 3aa <wait> a5: 85 c0 test %eax,%eax a7: 78 5e js 107 <forktest+0xb7> for(; n > 0; n--){ a9: 83 eb 01 sub $0x1,%ebx ac: 75 f2 jne a0 <forktest+0x50> if(wait() != -1){ ae: e8 f7 02 00 00 call 3aa <wait> b3: 83 f8 ff cmp $0xffffffff,%eax b6: 75 71 jne 129 <forktest+0xd9> write(fd, s, strlen(s)); b8: 83 ec 0c sub $0xc,%esp bb: 68 8e 04 00 00 push $0x48e c0: e8 0b 01 00 00 call 1d0 <strlen> c5: 83 c4 0c add $0xc,%esp c8: 50 push %eax c9: 68 8e 04 00 00 push $0x48e ce: 6a 01 push $0x1 d0: e8 05 03 00 00 call 3da <write> } d5: 8b 5d fc mov -0x4(%ebp),%ebx d8: c9 leave d9: c3 ret da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi write(fd, s, strlen(s)); e0: 83 ec 0c sub $0xc,%esp e3: 68 9c 04 00 00 push $0x49c e8: e8 e3 00 00 00 call 1d0 <strlen> ed: 83 c4 0c add $0xc,%esp f0: 50 push %eax f1: 68 9c 04 00 00 push $0x49c f6: 6a 01 push $0x1 f8: e8 dd 02 00 00 call 3da <write> exit(); fd: e8 a0 02 00 00 call 3a2 <exit> exit(); 102: e8 9b 02 00 00 call 3a2 <exit> write(fd, s, strlen(s)); 107: 83 ec 0c sub $0xc,%esp 10a: 68 67 04 00 00 push $0x467 10f: e8 bc 00 00 00 call 1d0 <strlen> 114: 83 c4 0c add $0xc,%esp 117: 50 push %eax 118: 68 67 04 00 00 push $0x467 11d: 6a 01 push $0x1 11f: e8 b6 02 00 00 call 3da <write> exit(); 124: e8 79 02 00 00 call 3a2 <exit> write(fd, s, strlen(s)); 129: 83 ec 0c sub $0xc,%esp 12c: 68 7b 04 00 00 push $0x47b 131: e8 9a 00 00 00 call 1d0 <strlen> 136: 83 c4 0c add $0xc,%esp 139: 50 push %eax 13a: 68 7b 04 00 00 push $0x47b 13f: 6a 01 push $0x1 141: e8 94 02 00 00 call 3da <write> exit(); 146: e8 57 02 00 00 call 3a2 <exit> 14b: 66 90 xchg %ax,%ax 14d: 66 90 xchg %ax,%ax 14f: 90 nop 00000150 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { 150: 55 push %ebp 151: 89 e5 mov %esp,%ebp 153: 53 push %ebx 154: 8b 45 08 mov 0x8(%ebp),%eax 157: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 15a: 89 c2 mov %eax,%edx 15c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 160: 83 c1 01 add $0x1,%ecx 163: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 167: 83 c2 01 add $0x1,%edx 16a: 84 db test %bl,%bl 16c: 88 5a ff mov %bl,-0x1(%edx) 16f: 75 ef jne 160 <strcpy+0x10> ; return os; } 171: 5b pop %ebx 172: 5d pop %ebp 173: c3 ret 174: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 17a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000180 <strcmp>: int strcmp(const char *p, const char *q) { 180: 55 push %ebp 181: 89 e5 mov %esp,%ebp 183: 53 push %ebx 184: 8b 55 08 mov 0x8(%ebp),%edx 187: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 18a: 0f b6 02 movzbl (%edx),%eax 18d: 0f b6 19 movzbl (%ecx),%ebx 190: 84 c0 test %al,%al 192: 75 1c jne 1b0 <strcmp+0x30> 194: eb 2a jmp 1c0 <strcmp+0x40> 196: 8d 76 00 lea 0x0(%esi),%esi 199: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; 1a0: 83 c2 01 add $0x1,%edx while(*p && *p == *q) 1a3: 0f b6 02 movzbl (%edx),%eax p++, q++; 1a6: 83 c1 01 add $0x1,%ecx 1a9: 0f b6 19 movzbl (%ecx),%ebx while(*p && *p == *q) 1ac: 84 c0 test %al,%al 1ae: 74 10 je 1c0 <strcmp+0x40> 1b0: 38 d8 cmp %bl,%al 1b2: 74 ec je 1a0 <strcmp+0x20> return (uchar)*p - (uchar)*q; 1b4: 29 d8 sub %ebx,%eax } 1b6: 5b pop %ebx 1b7: 5d pop %ebp 1b8: c3 ret 1b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 1c0: 31 c0 xor %eax,%eax return (uchar)*p - (uchar)*q; 1c2: 29 d8 sub %ebx,%eax } 1c4: 5b pop %ebx 1c5: 5d pop %ebp 1c6: c3 ret 1c7: 89 f6 mov %esi,%esi 1c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000001d0 <strlen>: uint strlen(const char *s) { 1d0: 55 push %ebp 1d1: 89 e5 mov %esp,%ebp 1d3: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 1d6: 80 39 00 cmpb $0x0,(%ecx) 1d9: 74 15 je 1f0 <strlen+0x20> 1db: 31 d2 xor %edx,%edx 1dd: 8d 76 00 lea 0x0(%esi),%esi 1e0: 83 c2 01 add $0x1,%edx 1e3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 1e7: 89 d0 mov %edx,%eax 1e9: 75 f5 jne 1e0 <strlen+0x10> ; return n; } 1eb: 5d pop %ebp 1ec: c3 ret 1ed: 8d 76 00 lea 0x0(%esi),%esi for(n = 0; s[n]; n++) 1f0: 31 c0 xor %eax,%eax } 1f2: 5d pop %ebp 1f3: c3 ret 1f4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 1fa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000200 <memset>: void* memset(void *dst, int c, uint n) { 200: 55 push %ebp 201: 89 e5 mov %esp,%ebp 203: 57 push %edi 204: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 207: 8b 4d 10 mov 0x10(%ebp),%ecx 20a: 8b 45 0c mov 0xc(%ebp),%eax 20d: 89 d7 mov %edx,%edi 20f: fc cld 210: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 212: 89 d0 mov %edx,%eax 214: 5f pop %edi 215: 5d pop %ebp 216: c3 ret 217: 89 f6 mov %esi,%esi 219: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000220 <strchr>: char* strchr(const char *s, char c) { 220: 55 push %ebp 221: 89 e5 mov %esp,%ebp 223: 53 push %ebx 224: 8b 45 08 mov 0x8(%ebp),%eax 227: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) 22a: 0f b6 10 movzbl (%eax),%edx 22d: 84 d2 test %dl,%dl 22f: 74 1d je 24e <strchr+0x2e> if(*s == c) 231: 38 d3 cmp %dl,%bl 233: 89 d9 mov %ebx,%ecx 235: 75 0d jne 244 <strchr+0x24> 237: eb 17 jmp 250 <strchr+0x30> 239: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 240: 38 ca cmp %cl,%dl 242: 74 0c je 250 <strchr+0x30> for(; *s; s++) 244: 83 c0 01 add $0x1,%eax 247: 0f b6 10 movzbl (%eax),%edx 24a: 84 d2 test %dl,%dl 24c: 75 f2 jne 240 <strchr+0x20> return (char*)s; return 0; 24e: 31 c0 xor %eax,%eax } 250: 5b pop %ebx 251: 5d pop %ebp 252: c3 ret 253: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 259: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000260 <gets>: char* gets(char *buf, int max) { 260: 55 push %ebp 261: 89 e5 mov %esp,%ebp 263: 57 push %edi 264: 56 push %esi 265: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 266: 31 f6 xor %esi,%esi 268: 89 f3 mov %esi,%ebx { 26a: 83 ec 1c sub $0x1c,%esp 26d: 8b 7d 08 mov 0x8(%ebp),%edi for(i=0; i+1 < max; ){ 270: eb 2f jmp 2a1 <gets+0x41> 272: 8d b6 00 00 00 00 lea 0x0(%esi),%esi cc = read(0, &c, 1); 278: 8d 45 e7 lea -0x19(%ebp),%eax 27b: 83 ec 04 sub $0x4,%esp 27e: 6a 01 push $0x1 280: 50 push %eax 281: 6a 00 push $0x0 283: e8 4a 01 00 00 call 3d2 <read> if(cc < 1) 288: 83 c4 10 add $0x10,%esp 28b: 85 c0 test %eax,%eax 28d: 7e 1c jle 2ab <gets+0x4b> break; buf[i++] = c; 28f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 293: 83 c7 01 add $0x1,%edi 296: 88 47 ff mov %al,-0x1(%edi) if(c == '\n' || c == '\r') 299: 3c 0a cmp $0xa,%al 29b: 74 23 je 2c0 <gets+0x60> 29d: 3c 0d cmp $0xd,%al 29f: 74 1f je 2c0 <gets+0x60> for(i=0; i+1 < max; ){ 2a1: 83 c3 01 add $0x1,%ebx 2a4: 3b 5d 0c cmp 0xc(%ebp),%ebx 2a7: 89 fe mov %edi,%esi 2a9: 7c cd jl 278 <gets+0x18> 2ab: 89 f3 mov %esi,%ebx break; } buf[i] = '\0'; return buf; } 2ad: 8b 45 08 mov 0x8(%ebp),%eax buf[i] = '\0'; 2b0: c6 03 00 movb $0x0,(%ebx) } 2b3: 8d 65 f4 lea -0xc(%ebp),%esp 2b6: 5b pop %ebx 2b7: 5e pop %esi 2b8: 5f pop %edi 2b9: 5d pop %ebp 2ba: c3 ret 2bb: 90 nop 2bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 2c0: 8b 75 08 mov 0x8(%ebp),%esi 2c3: 8b 45 08 mov 0x8(%ebp),%eax 2c6: 01 de add %ebx,%esi 2c8: 89 f3 mov %esi,%ebx buf[i] = '\0'; 2ca: c6 03 00 movb $0x0,(%ebx) } 2cd: 8d 65 f4 lea -0xc(%ebp),%esp 2d0: 5b pop %ebx 2d1: 5e pop %esi 2d2: 5f pop %edi 2d3: 5d pop %ebp 2d4: c3 ret 2d5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 2d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000002e0 <stat>: int stat(const char *n, struct stat *st) { 2e0: 55 push %ebp 2e1: 89 e5 mov %esp,%ebp 2e3: 56 push %esi 2e4: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 2e5: 83 ec 08 sub $0x8,%esp 2e8: 6a 00 push $0x0 2ea: ff 75 08 pushl 0x8(%ebp) 2ed: e8 08 01 00 00 call 3fa <open> if(fd < 0) 2f2: 83 c4 10 add $0x10,%esp 2f5: 85 c0 test %eax,%eax 2f7: 78 27 js 320 <stat+0x40> return -1; r = fstat(fd, st); 2f9: 83 ec 08 sub $0x8,%esp 2fc: ff 75 0c pushl 0xc(%ebp) 2ff: 89 c3 mov %eax,%ebx 301: 50 push %eax 302: e8 0b 01 00 00 call 412 <fstat> close(fd); 307: 89 1c 24 mov %ebx,(%esp) r = fstat(fd, st); 30a: 89 c6 mov %eax,%esi close(fd); 30c: e8 d1 00 00 00 call 3e2 <close> return r; 311: 83 c4 10 add $0x10,%esp } 314: 8d 65 f8 lea -0x8(%ebp),%esp 317: 89 f0 mov %esi,%eax 319: 5b pop %ebx 31a: 5e pop %esi 31b: 5d pop %ebp 31c: c3 ret 31d: 8d 76 00 lea 0x0(%esi),%esi return -1; 320: be ff ff ff ff mov $0xffffffff,%esi 325: eb ed jmp 314 <stat+0x34> 327: 89 f6 mov %esi,%esi 329: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000330 <atoi>: int atoi(const char *s) { 330: 55 push %ebp 331: 89 e5 mov %esp,%ebp 333: 53 push %ebx 334: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 337: 0f be 11 movsbl (%ecx),%edx 33a: 8d 42 d0 lea -0x30(%edx),%eax 33d: 3c 09 cmp $0x9,%al n = 0; 33f: b8 00 00 00 00 mov $0x0,%eax while('0' <= *s && *s <= '9') 344: 77 1f ja 365 <atoi+0x35> 346: 8d 76 00 lea 0x0(%esi),%esi 349: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 350: 8d 04 80 lea (%eax,%eax,4),%eax 353: 83 c1 01 add $0x1,%ecx 356: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax while('0' <= *s && *s <= '9') 35a: 0f be 11 movsbl (%ecx),%edx 35d: 8d 5a d0 lea -0x30(%edx),%ebx 360: 80 fb 09 cmp $0x9,%bl 363: 76 eb jbe 350 <atoi+0x20> return n; } 365: 5b pop %ebx 366: 5d pop %ebp 367: c3 ret 368: 90 nop 369: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000370 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 370: 55 push %ebp 371: 89 e5 mov %esp,%ebp 373: 56 push %esi 374: 53 push %ebx 375: 8b 5d 10 mov 0x10(%ebp),%ebx 378: 8b 45 08 mov 0x8(%ebp),%eax 37b: 8b 75 0c mov 0xc(%ebp),%esi char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 37e: 85 db test %ebx,%ebx 380: 7e 14 jle 396 <memmove+0x26> 382: 31 d2 xor %edx,%edx 384: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 388: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 38c: 88 0c 10 mov %cl,(%eax,%edx,1) 38f: 83 c2 01 add $0x1,%edx while(n-- > 0) 392: 39 d3 cmp %edx,%ebx 394: 75 f2 jne 388 <memmove+0x18> return vdst; } 396: 5b pop %ebx 397: 5e pop %esi 398: 5d pop %ebp 399: c3 ret 0000039a <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 39a: b8 01 00 00 00 mov $0x1,%eax 39f: cd 40 int $0x40 3a1: c3 ret 000003a2 <exit>: SYSCALL(exit) 3a2: b8 02 00 00 00 mov $0x2,%eax 3a7: cd 40 int $0x40 3a9: c3 ret 000003aa <wait>: SYSCALL(wait) 3aa: b8 03 00 00 00 mov $0x3,%eax 3af: cd 40 int $0x40 3b1: c3 ret 000003b2 <waitx>: SYSCALL(waitx) 3b2: b8 16 00 00 00 mov $0x16,%eax 3b7: cd 40 int $0x40 3b9: c3 ret 000003ba <set_priority>: SYSCALL(set_priority) 3ba: b8 18 00 00 00 mov $0x18,%eax 3bf: cd 40 int $0x40 3c1: c3 ret 000003c2 <psCall>: SYSCALL(psCall) 3c2: b8 17 00 00 00 mov $0x17,%eax 3c7: cd 40 int $0x40 3c9: c3 ret 000003ca <pipe>: SYSCALL(pipe) 3ca: b8 04 00 00 00 mov $0x4,%eax 3cf: cd 40 int $0x40 3d1: c3 ret 000003d2 <read>: SYSCALL(read) 3d2: b8 05 00 00 00 mov $0x5,%eax 3d7: cd 40 int $0x40 3d9: c3 ret 000003da <write>: SYSCALL(write) 3da: b8 10 00 00 00 mov $0x10,%eax 3df: cd 40 int $0x40 3e1: c3 ret 000003e2 <close>: SYSCALL(close) 3e2: b8 15 00 00 00 mov $0x15,%eax 3e7: cd 40 int $0x40 3e9: c3 ret 000003ea <kill>: SYSCALL(kill) 3ea: b8 06 00 00 00 mov $0x6,%eax 3ef: cd 40 int $0x40 3f1: c3 ret 000003f2 <exec>: SYSCALL(exec) 3f2: b8 07 00 00 00 mov $0x7,%eax 3f7: cd 40 int $0x40 3f9: c3 ret 000003fa <open>: SYSCALL(open) 3fa: b8 0f 00 00 00 mov $0xf,%eax 3ff: cd 40 int $0x40 401: c3 ret 00000402 <mknod>: SYSCALL(mknod) 402: b8 11 00 00 00 mov $0x11,%eax 407: cd 40 int $0x40 409: c3 ret 0000040a <unlink>: SYSCALL(unlink) 40a: b8 12 00 00 00 mov $0x12,%eax 40f: cd 40 int $0x40 411: c3 ret 00000412 <fstat>: SYSCALL(fstat) 412: b8 08 00 00 00 mov $0x8,%eax 417: cd 40 int $0x40 419: c3 ret 0000041a <link>: SYSCALL(link) 41a: b8 13 00 00 00 mov $0x13,%eax 41f: cd 40 int $0x40 421: c3 ret 00000422 <mkdir>: SYSCALL(mkdir) 422: b8 14 00 00 00 mov $0x14,%eax 427: cd 40 int $0x40 429: c3 ret 0000042a <chdir>: SYSCALL(chdir) 42a: b8 09 00 00 00 mov $0x9,%eax 42f: cd 40 int $0x40 431: c3 ret 00000432 <dup>: SYSCALL(dup) 432: b8 0a 00 00 00 mov $0xa,%eax 437: cd 40 int $0x40 439: c3 ret 0000043a <getpid>: SYSCALL(getpid) 43a: b8 0b 00 00 00 mov $0xb,%eax 43f: cd 40 int $0x40 441: c3 ret 00000442 <sbrk>: SYSCALL(sbrk) 442: b8 0c 00 00 00 mov $0xc,%eax 447: cd 40 int $0x40 449: c3 ret 0000044a <sleep>: SYSCALL(sleep) 44a: b8 0d 00 00 00 mov $0xd,%eax 44f: cd 40 int $0x40 451: c3 ret 00000452 <uptime>: SYSCALL(uptime) 452: b8 0e 00 00 00 mov $0xe,%eax 457: cd 40 int $0x40 459: c3 ret
32.056769
58
0.413477
[ "MIT-0" ]
tgv2002/xv6-OS-modified
forktest.asm
22,023
Assembly
; A047789: Denominators of Glaisher's I-numbers. ; 2,3,1,1,9,1,1,3,1,1,3,1,1,27,1,1,3,1,1,3,1,1,9,1,1,3,1,1,3,1,1,9,1,1,3,1,1,3,1,1,81,1,1,3,1,1,3,1,1,9,1,1,3,1,1,3,1,1,9,1,1,3,1,1,3,1,1,27,1,1,3,1,1,3,1,1,9,1,1,3,1,1,3,1,1,9,1,1,3,1,1,3,1,1,27,1,1,3,1,1 mov $1,$0 trn $0,1 add $1,2 add $0,$1 pow $1,$1 gcd $0,$1
31.4
205
0.547771
[ "Apache-2.0" ]
ckrause/loda-programs
oeis/047/A047789.asm
314
Assembly
title "Resource package x86 optimzations" ;++ ; ;Copyright (c) 1991 Microsoft Corporation ; ;Module Name: ; ; resoura.asm ; ;Abstract: ; ; Optimized preambles for some HOT resource code paths. ; ; Takes first crack at satisfying the ExResource API, if it ; can't it passes it onto the full blown API. ; ; Optimized for UP free builds only! ; ;Author: ; ; Ken Reneris (kenr) 13-Jan-1992 ; ;Revision History: ; ;-- .386p include ks386.inc include callconv.inc ; calling convention macros include mac386.inc EXTRNP _ExpReleaseResourceForThread,2 ExculsiveWaiter equ 1 ; From ddkresrc.c SharedWaiter equ 2 ; From ddkresrc.c AnyWaiter equ (ExculsiveWaiter+SharedWaiter) _TEXT$00 SEGMENT PARA PUBLIC 'CODE' ASSUME DS:FLAT, ES:FLAT, SS:NOTHING, FS:NOTHING, GS:NOTHING ifdef NT_UP ife DBG ;++ ; ; VOID ; ExReleaseResourceForThread( ; IN PNTDDK_ERESOURCE Resource, ; IN ERESOURCE_THREAD OurThread ; ) ; ; ; Routine Description: ; ; This routine release the input resource the indcated thread. The ; resource can have been acquired for either shared or exclusive access. ; ; Arguments: ; ; Resource - Supplies the resource to release ; ; Thread - Supplies the thread that originally acquired the resource ; ; Return Value: ; ; None. ; ;-- cPublicProc _ExReleaseResourceForThread,2 cPublicFpo 2,0 mov ecx, [esp+4] ; resource mov eax, [esp+8] ; our thread cli test byte ptr [ecx].RsFlag, AnyWaiter ; any waiter? jnz short rrt_longway_ddk ; yes, go long test byte ptr [ecx].RsFlag, RsOwnedExclusive ; exclusive? jz short rrt_longway_ddk ; bad release, go abort mov edx, [ecx].RsOwnerThreads ; (edx) = ownerthread table cmp [edx], eax ; our thread at table[0]? jne short rrt_longway_ddk ; bad release, go abort mov eax, [ecx].RsOwnerCounts dec byte ptr [eax] ; thread count -= 1 jnz short rrt_exit_ddk ; if not zero, all done mov dword ptr [edx], 0 ; clear thread table[0] dec word ptr [ecx].RsActiveCount ; resource count -= 1 and byte ptr [ecx].RsFlag, not RsOwnedExclusive rrt_exit_ddk: sti stdRET _ExReleaseResourceForThread rrt_longway_ddk: sti jmp _ExpReleaseResourceForThread@8 stdENDP _ExReleaseResourceForThread endif endif _TEXT$00 ends end
25.063063
77
0.584472
[ "MIT" ]
King0987654/windows2000
private/ntos/ex/i386/resoura.asm
2,782
Assembly
.import source "64spec.asm" .eval config_64spec("print_immediate_result", false) sfspec: :init_spec() :describe("assert_a_zero") :it("works for all values of A register");{ .for (var a = 0; a < 256; a++) { .if (a == 0) { lda #a :assert_a_zero } else { lda #a :assert_a_zero _64SPEC.assertion_failed_subroutine : _64SPEC.assertion_passed_subroutine } } } :it("does not affect A register");{ .for (var a = 0; a < 256; a++) { lda #a .if (a == 0) { :assert_a_zero } else { :assert_a_zero _64SPEC.assertion_failed_subroutine : _64SPEC.assertion_passed_subroutine } :assert_a_equal #a } } :finish_spec()
22.090909
96
0.580247
[ "MIT" ]
64bites/64spec
spec/assert_a_zero_spec.asm
729
Assembly
org 7c00h init_foo: jmp init_bar nop nop nop nop nop nop nop nop nop nop nop nop nop init_bar: mov [b1],dl mov [b2],edx nop nop nop nop nop nop nop nop nop nop nop nop nop ret absolute init_bar+7 b1: resb 1 b2: resd 6
6.461538
20
0.642857
[ "BSD-2-Clause" ]
1480c1/nasm
travis/test/absolute.asm
252
Assembly
SECTION "sec", ROMX[1/0]
12.5
24
0.64
[ "MIT" ]
AtariDreams/rgbds
test/asm/divzero-section-bank.asm
25
Assembly
; A158555: a(n) = 196*n^2 + 14. ; 14,210,798,1778,3150,4914,7070,9618,12558,15890,19614,23730,28238,33138,38430,44114,50190,56658,63518,70770,78414,86450,94878,103698,112910,122514,132510,142898,153678,164850,176414,188370,200718,213458,226590,240114,254030,268338,283038,298130,313614,329490,345758,362418,379470,396914,414750,432978,451598,470610,490014,509810,529998,550578,571550,592914,614670,636818,659358,682290,705614,729330,753438,777938,802830,828114,853790,879858,906318,933170,960414,988050,1016078,1044498,1073310,1102514,1132110,1162098,1192478,1223250,1254414,1285970,1317918,1350258,1382990,1416114,1449630,1483538,1517838,1552530,1587614,1623090,1658958,1695218,1731870,1768914,1806350,1844178,1882398,1921010,1960014,1999410,2039198,2079378,2119950,2160914,2202270,2244018,2286158,2328690,2371614,2414930,2458638,2502738,2547230,2592114,2637390,2683058,2729118,2775570,2822414,2869650,2917278,2965298,3013710,3062514,3111710,3161298,3211278,3261650,3312414,3363570,3415118,3467058,3519390,3572114,3625230,3678738,3732638,3786930,3841614,3896690,3952158,4008018,4064270,4120914,4177950,4235378,4293198,4351410,4410014,4469010,4528398,4588178,4648350,4708914,4769870,4831218,4892958,4955090,5017614,5080530,5143838,5207538,5271630,5336114,5400990,5466258,5531918,5597970,5664414,5731250,5798478,5866098,5934110,6002514,6071310,6140498,6210078,6280050,6350414,6421170,6492318,6563858,6635790,6708114,6780830,6853938,6927438,7001330,7075614,7150290,7225358,7300818,7376670,7452914,7529550,7606578,7683998,7761810,7840014,7918610,7997598,8076978,8156750,8236914,8317470,8398418,8479758,8561490,8643614,8726130,8809038,8892338,8976030,9060114,9144590,9229458,9314718,9400370,9486414,9572850,9659678,9746898,9834510,9922514,10010910,10099698,10188878,10278450,10368414,10458770,10549518,10640658,10732190,10824114,10916430,11009138,11102238,11195730,11289614,11383890,11478558,11573618,11669070,11764914,11861150,11957778,12054798,12152210 mov $1,$0 pow $1,2 mul $1,196 add $1,14
249
1,918
0.856426
[ "Apache-2.0" ]
jmorken/loda
programs/oeis/158/A158555.asm
1,992
Assembly
* --------------------------------------------------------------------------- * PlayDPCM8kHz * ------------- * Subroutine to play a Delta PCM sample at 8kHz * 6 bit DAC sample value is encoded as a 4bit lookup value in a delta table * 125 cycles between 2 DAC samples * * No IRQ here, this will freeze anything running ... * DAC Init from Mission: Liftoff (merci Prehisto ;-)) * * input REG : [y] Pcm_ index to play * reset REG : none * * Pcm_ index point to a data structure that store location of sample data: * page[b], start address[w], end address[w] * page[b], start address[w], end address[w] * ... * $00 * * --------------------------------------------------------------------------- PlayDPCM8kHz pshs d,x,y,u _GetCartPageA sta @RestorePage+1 ldd #$fb3f ! Mute by CRA to anda $e7cf ! avoid sound when sta $e7cf ! $e7cd written stb $e7cd ! Full sound line ora #$04 ! Disable mute by sta $e7cf ! CRA and sound ldu #@DACDecodeTbl lda #32 ; init delta value sta @smplh+1 sta @smpll+1 @ReadChunk lda sound_page,y ; [4] load memory page beq @End ; [3] _SetCartPageA ; for each page switch there is a lag, when data in ROM: 24 cycles late in stream ldx sound_start_addr,y ; [6] Chunk start addr @Loop lda ,x ; [4] load data byte lsra ; [2] lsra ; [2] lsra ; [2] lsra ; [2] ldb a,u ; [5] read high nibble sample @smplh addb #00 ; [2] stb @smpll+1 ; [5] stb $e7cd ; [5] send byte to DAC lda ,x+ ; [6] reload data byte anda #$0F ; [2] ldb a,u ; [5] read low nibble sample @smpll addb #00 ; [2] stb @smplh+1 ; [5] lda #19 ; [100] wait @wait deca ; ... bne @wait ; ... brn * ; ... stb $e7cd ; [5] send byte to DAC cmpx sound_end_addr,y ; [7] beq @NextChunk ; [3] lda #15 ; [83] wait @wait2 deca ; ... bne @wait2 ; ... brn * ; ... brn * ; ... bra @Loop ; [3] @NextChunk leay sound_meta_size,y ; [5] IFNDEF T2 lda #10 ; [58] wait @wait3 deca ; ... bne @wait3 ; ... brn * ; ... brn * ; ... ENDC bra @ReadChunk ; [3] @End lda #$00 sta $e7cd ldd #$fbfc ! Mute by CRA to anda $e7cf ! avoid sound when sta $e7cf ! $e7cd is written andb $e7cd ! Activate stb $e7cd ! joystick port ora #$04 ! Disable mute by sta $e7cf ! CRA + joystick @RestorePage lda #$00 _SetCartPageA puls d,x,y,u,pc @DACDecodeTbl fcb 0,1,2,4,8,12,16,24,-32,-1,-2,-4,-8,-12,-16,-24 ; this table use same values as the one used by pcm2dpcm at encoding stage but /4 ; so there is no need to downsample from 8-bit to 6-bit
38.080808
120
0.386737
[ "Apache-2.0" ]
wide-dot/thomson-to8-game-engine
Engine/Sound/PlayDPCM8kHz.asm
3,770
Assembly
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.00.23506.0 TITLE D:\Projects\TaintAnalysis\AntiTaint\Epilog\src\func-alloca.c .686P .XMM include listing.inc .model flat INCLUDELIB MSVCRT INCLUDELIB OLDNAMES PUBLIC ___local_stdio_printf_options PUBLIC ___local_stdio_scanf_options PUBLIC __vfprintf_l PUBLIC _printf PUBLIC __vfscanf_l PUBLIC _scanf PUBLIC _func PUBLIC _main PUBLIC ??_C@_02DPKJAMEF@?$CFd?$AA@ ; `string' EXTRN __imp____acrt_iob_func:PROC EXTRN __imp____stdio_common_vfprintf:PROC EXTRN __imp____stdio_common_vfscanf:PROC EXTRN _gets:PROC EXTRN __alloca_probe_16:PROC _DATA SEGMENT COMM ?_OptionsStorage@?1??__local_stdio_printf_options@@9@9:QWORD ; `__local_stdio_printf_options'::`2'::_OptionsStorage COMM ?_OptionsStorage@?1??__local_stdio_scanf_options@@9@9:QWORD ; `__local_stdio_scanf_options'::`2'::_OptionsStorage _DATA ENDS ; COMDAT ??_C@_02DPKJAMEF@?$CFd?$AA@ CONST SEGMENT ??_C@_02DPKJAMEF@?$CFd?$AA@ DB '%d', 00H ; `string' CONST ENDS ; Function compile flags: /Ogtpy ; File d:\projects\taintanalysis\antitaint\epilog\src\func-alloca.c ; COMDAT _main _TEXT SEGMENT _main PROC ; COMDAT ; 21 : func(); call _func ; 22 : return 0; xor eax, eax ; 23 : } ret 0 _main ENDP _TEXT ENDS ; Function compile flags: /Ogtpy ; File d:\projects\taintanalysis\antitaint\epilog\src\func-alloca.c ; COMDAT _func _TEXT SEGMENT _sz$ = -4 ; size = 4 _func PROC ; COMDAT ; 10 : { push ebp mov ebp, esp push ecx push esi ; 11 : int sz; ; 12 : char *buf; ; 13 : scanf("%d", &sz); lea eax, DWORD PTR _sz$[ebp] push eax push OFFSET ??_C@_02DPKJAMEF@?$CFd?$AA@ call _scanf ; 14 : buf = (char*)alloca(sz); mov eax, DWORD PTR _sz$[ebp] add esp, 8 call __alloca_probe_16 mov esi, esp ; 15 : gets(buf); push esi call _gets ; 16 : printf(buf); push esi call _printf add esp, 8 ; 17 : } lea esp, DWORD PTR [ebp-8] pop esi mov esp, ebp pop ebp ret 0 _func ENDP _TEXT ENDS ; Function compile flags: /Ogtpy ; File c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\stdio.h ; COMDAT _scanf _TEXT SEGMENT __Format$ = 8 ; size = 4 _scanf PROC ; COMDAT ; 1277 : int _Result; ; 1278 : va_list _ArgList; ; 1279 : __crt_va_start(_ArgList, _Format); ; 1280 : _Result = _vfscanf_l(stdin, _Format, NULL, _ArgList); lea eax, DWORD PTR __Format$[esp] push eax push 0 push DWORD PTR __Format$[esp+4] push 0 call DWORD PTR __imp____acrt_iob_func add esp, 4 push eax call __vfscanf_l add esp, 16 ; 00000010H ; 1281 : __crt_va_end(_ArgList); ; 1282 : return _Result; ; 1283 : } ret 0 _scanf ENDP _TEXT ENDS ; Function compile flags: /Ogtpy ; File c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\stdio.h ; COMDAT __vfscanf_l _TEXT SEGMENT __Stream$ = 8 ; size = 4 __Format$ = 12 ; size = 4 __Locale$ = 16 ; size = 4 __ArgList$ = 20 ; size = 4 __vfscanf_l PROC ; COMDAT ; 1059 : return __stdio_common_vfscanf( push DWORD PTR __ArgList$[esp-4] push DWORD PTR __Locale$[esp] push DWORD PTR __Format$[esp+4] push DWORD PTR __Stream$[esp+8] call ___local_stdio_scanf_options push DWORD PTR [eax+4] push DWORD PTR [eax] call DWORD PTR __imp____stdio_common_vfscanf add esp, 24 ; 00000018H ; 1060 : _CRT_INTERNAL_LOCAL_SCANF_OPTIONS, ; 1061 : _Stream, _Format, _Locale, _ArgList); ; 1062 : } ret 0 __vfscanf_l ENDP _TEXT ENDS ; Function compile flags: /Ogtpy ; File c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\stdio.h ; COMDAT _printf _TEXT SEGMENT __Format$ = 8 ; size = 4 _printf PROC ; COMDAT ; 951 : int _Result; ; 952 : va_list _ArgList; ; 953 : __crt_va_start(_ArgList, _Format); ; 954 : _Result = _vfprintf_l(stdout, _Format, NULL, _ArgList); lea eax, DWORD PTR __Format$[esp] push eax push 0 push DWORD PTR __Format$[esp+4] push 1 call DWORD PTR __imp____acrt_iob_func add esp, 4 push eax call __vfprintf_l add esp, 16 ; 00000010H ; 955 : __crt_va_end(_ArgList); ; 956 : return _Result; ; 957 : } ret 0 _printf ENDP _TEXT ENDS ; Function compile flags: /Ogtpy ; File c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\stdio.h ; COMDAT __vfprintf_l _TEXT SEGMENT __Stream$ = 8 ; size = 4 __Format$ = 12 ; size = 4 __Locale$ = 16 ; size = 4 __ArgList$ = 20 ; size = 4 __vfprintf_l PROC ; COMDAT ; 639 : return __stdio_common_vfprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _Stream, _Format, _Locale, _ArgList); push DWORD PTR __ArgList$[esp-4] push DWORD PTR __Locale$[esp] push DWORD PTR __Format$[esp+4] push DWORD PTR __Stream$[esp+8] call ___local_stdio_printf_options push DWORD PTR [eax+4] push DWORD PTR [eax] call DWORD PTR __imp____stdio_common_vfprintf add esp, 24 ; 00000018H ; 640 : } ret 0 __vfprintf_l ENDP _TEXT ENDS ; Function compile flags: /Ogtpy ; File c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\corecrt_stdio_config.h ; COMDAT ___local_stdio_scanf_options _TEXT SEGMENT ___local_stdio_scanf_options PROC ; COMDAT ; 83 : static unsigned __int64 _OptionsStorage; ; 84 : return &_OptionsStorage; mov eax, OFFSET ?_OptionsStorage@?1??__local_stdio_scanf_options@@9@9 ; `__local_stdio_scanf_options'::`2'::_OptionsStorage ; 85 : } ret 0 ___local_stdio_scanf_options ENDP _TEXT ENDS ; Function compile flags: /Ogtpy ; File c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\corecrt_stdio_config.h ; COMDAT ___local_stdio_printf_options _TEXT SEGMENT ___local_stdio_printf_options PROC ; COMDAT ; 74 : static unsigned __int64 _OptionsStorage; ; 75 : return &_OptionsStorage; mov eax, OFFSET ?_OptionsStorage@?1??__local_stdio_printf_options@@9@9 ; `__local_stdio_printf_options'::`2'::_OptionsStorage ; 76 : } ret 0 ___local_stdio_printf_options ENDP _TEXT ENDS END
24.638889
127
0.681591
[ "Apache-2.0" ]
Dovgalyuk/AntiTaint
Epilog/asm/MSVC2015/func-alloca-omitfp-opt.asm
6,209
Assembly
; A135668: a(n) = ceiling(n + sqrt(n)). ; 2,4,5,6,8,9,10,11,12,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,32,33,34,35,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266 mov $1,$0 add $1,2 lpb $0 sub $0,3 trn $0,$2 add $1,1 add $2,2 lpe
85.25
906
0.697947
[ "Apache-2.0" ]
jmorken/loda
programs/oeis/135/A135668.asm
1,023
Assembly
0x00002850 nop; //---------------- 0x00002868 nop; //---------------- 0x00002880 move.l 0x21e0,A0 ; //0, 0x00002898 jsr ix 0x000028b0 move.l 0x21e0,A0 ; //0, 0x000028c8 move.l 0x2210,A1 ; //0, 0x000028e0 move.L (A0),(A1) 0x000028f8 xor.q D0,D0 0x00002910 move.l 0x2140,A0 ; //640, 0x00002928 move.w (A0),D0 0x00002940 move.l 0x2210,A0 ; //0, 0x00002958 move.L (A0),D1 0x00002970 extL.Q D1 0x00002988 mul.Q D0,D1 0x000029a0 move.l 0x2210,A0 ; //0, 0x000029b8 move.Q D1,(A0) 0x000029d0 move.l 0x2220,A0 ; //0, 0x000029e8 jsr iw 0x00002a00 move.l 0x2220,A0 ; //0, 0x00002a18 move.L (A0),D0 0x00002a30 extL.Q D0 0x00002a48 move.l 0x2210,A0 ; //0, 0x00002a60 move.Q (A0),D1 0x00002a78 div.Q D0,D1 0x00002a90 move.l 0x2210,A0 ; //0, 0x00002aa8 move.Q D1,(A0) 0x00002ac0 nop; //---------------- 0x00002ad8 move.l 0x2140,A0 ; //640, 0x00002af0 move.l 0x22b0,A1 ; //0, 0x00002b08 move.w (A0),(A1) 0x00002b20 move.l 0x22c0,A0 ; //0, 0x00002b38 jsr iy 0x00002b50 move.l 0x22c0,A0 ; //0, 0x00002b68 move.L (A0),D0 0x00002b80 extL.Q D0 0x00002b98 xor.q D1,D1 0x00002bb0 move.l 0x22b0,A0 ; //0, 0x00002bc8 move.w (A0),D1 0x00002be0 mul.Q D0,D1 0x00002bf8 move.l 0x22b0,A0 ; //0, 0x00002c10 move.Q D1,(A0) 0x00002c28 move.l 0x22d0,A0 ; //0, 0x00002c40 jsr ih 0x00002c58 move.l 0x22d0,A0 ; //0, 0x00002c70 move.L (A0),D0 0x00002c88 extL.Q D0 0x00002ca0 move.l 0x22b0,A0 ; //0, 0x00002cb8 move.Q (A0),D1 0x00002cd0 div.Q D0,D1 0x00002ce8 move.l 0x22b0,A0 ; //0, 0x00002d00 move.Q D1,(A0) 0x00002d18 nop; //---------------- 0x00002d30 move.l 0x23a0,A0 ; //0, 0x00002d48 jsr ia 0x00002d60 move.l 0x23a0,A0 ; //0, 0x00002d78 move.l 0x23d0,A1 ; //0, 0x00002d90 move.L (A0),(A1) 0x00002da8 xor.q D0,D0 0x00002dc0 move.l 0x2380,A0 ; //1, 0x00002dd8 move.b (A0),D0 0x00002df0 move.l 0x23d0,A0 ; //0, 0x00002e08 move.L (A0),D1 0x00002e20 sub.L D0,D1 0x00002e38 move.l 0x23d0,A0 ; //0, 0x00002e50 move.L D1,(A0) 0x00002e68 nop; //---------------- 0x00002e80 move.l 0x23d0,A0 ; //0, 0x00002e98 move.l 0x2440,A1 ; //0, 0x00002eb0 move.L (A0),(A1) 0x00002ec8 xor.q D0,D0 0x00002ee0 move.l 0x2400,A0 ; //1000, 0x00002ef8 move.w (A0),D0 0x00002f10 move.l 0x2440,A0 ; //0, 0x00002f28 move.L (A0),D1 0x00002f40 extL.Q D1 0x00002f58 mul.Q D0,D1 0x00002f70 move.l 0x2440,A0 ; //0, 0x00002f88 move.Q D1,(A0) 0x00002fa0 move.l 0x2490,A0 ; //0, 0x00002fb8 jsr in 0x00002fd0 move.l 0x2490,A0 ; //0, 0x00002fe8 move.l 0x24c0,A1 ; //0, 0x00003000 move.L (A0),(A1) 0x00003018 xor.q D0,D0 0x00003030 move.l 0x2380,A0 ; //1, 0x00003048 move.b (A0),D0 0x00003060 move.l 0x24c0,A0 ; //0, 0x00003078 move.L (A0),D1 0x00003090 sub.L D0,D1 0x000030a8 move.l 0x24c0,A0 ; //0, 0x000030c0 move.L D1,(A0) 0x000030d8 nop; //---------------- 0x000030f0 move.l 0x24c0,A0 ; //0, 0x00003108 move.l 0x2530,A1 ; //0, 0x00003120 move.L (A0),(A1) 0x00003138 xor.q D0,D0 0x00003150 move.l 0x24f0,A0 ; //10000, 0x00003168 move.w (A0),D0 0x00003180 move.l 0x2530,A0 ; //0, 0x00003198 move.L (A0),D1 0x000031b0 extL.Q D1 0x000031c8 mul.Q D0,D1 0x000031e0 move.l 0x2530,A0 ; //0, 0x000031f8 move.Q D1,(A0) 0x00003210 move.l 0x2540,A0 ; //0, 0x00003228 jsr mlb 0x00003240 move.l 0x2540,A0 ; //0, 0x00003258 move.l 0x2570,A1 ; //0, 0x00003270 move.L (A0),(A1) 0x00003288 move.l 0x2440,A0 ; //0, 0x000032a0 move.Q (A0),D0 0x000032b8 move.l 0x2570,A0 ; //0, 0x000032d0 move.L (A0),D1 0x000032e8 extL.Q D1 0x00003300 add.Q D0,D1 0x00003318 move.l 0x2570,A0 ; //0, 0x00003330 move.Q D1,(A0) 0x00003348 move.l 0x2530,A0 ; //0, 0x00003360 move.Q (A0),D0 0x00003378 move.l 0x2570,A0 ; //0, 0x00003390 move.Q (A0),D1 0x000033a8 add.Q D0,D1 0x000033c0 move.l 0x2570,A0 ; //0, 0x000033d8 move.Q D1,(A0) 0x000033f0 nop; //---------------- 0x00003408 nop; //---------------- 0x00003420 nop; //---------------- 0x00003438 nop; //---------------- 0x00003450 nop; //---------------- 0x00003468 move.q A7,D7 0x00003480 move.l 0x26d0,-(A7) 0x00003498 move.l 0x2180,-(A7) 0x000034b0 move.l 0x2230,-(A7) 0x000034c8 move.l 0x2580,-(A7) 0x000034e0 move.l 0x2720,-(A7) 0x000034f8 move.l 0x2760,A0 ; //-1, 0x00003510 jsr print 0x00003528 move.q D7,A7 0x00003540 nop; //---------------- 0x00003558 nop; //---------------- 0x00003570 nop; //---------------- 0x00003588 nop; //---------------- 0x000035a0 nop; //----------------
30.756944
40
0.644389
[ "MIT" ]
AliveMOon/piMASSpub
Desktop/piMASS/HTML/paint.mass/d3.asm
4,429
Assembly
; This table translates key presses into ascii codes. ; Also used by 'GetKey' and 'LookupKey'. An effort has been made for ; this key translation table to emulate a PC keyboard with the 'CTRL' key SECTION rodata_clib PUBLIC in_keytranstbl .in_keytranstbl ; 48 bytes per table ;Unshifted defb 'r', 'q', 'e', 255, 'w', 't' ; R, Q, E, -, W, T defb 'f', 'a', 'd', 255, 's', 'g' ; F, A, D, CTRL, S, G defb 'v', 'z', 'c', 255, 'x', 'b' ; V, Z, C, SHIFT, X, B defb '4', '1', '3', 255, '2', '5' ; 4, 1, 3, -, 2, 5 defb 'm', ' ', ',', 255, '.', 'n' ; M, SPACE, ',', -, '.', N defb '7', '0', '8', '-', '9', '6' ; 7, 0, 8, '-', 9, 6 defb 'u', 'p', 'i', 13, 'o', 'y' ; u, p, i, return, o, y defb 'j', ';', 'k', ':', 'l', 'h' ; j, ;, k, :, l, h ;Shifted defb 'R', 'Q', 'E', 255, 'W', 'T' ; R, Q, E, -, W, T defb 'F', 'A', 'D', 255, 'S', 'G' ; F, A, D, CTRL, S, G defb 'V', 'Z', 'C', 255, 'X', 'B' ; V, Z, C, SHIFT, X, B defb '$', '!', '#', 255, '\"','%' ; 4, 1, 3, -, 2, 5 defb 'M', ' ', '<', 255, '>', 'N' ; M, SPACE, ',', -, '.', N defb '\'','@', '(', '=', ')', '&' ; 7, 0, 8, '-', 9, 6 defb 'U', 'P', 'I', 13, 'O', 'Y' ; u, p, i, return, o, y defb 'J', '+', 'K', '*', 'L', 'H' ; j, ;, k, :, l, h ;Control defb 18, 17, 5, 255, 23, 20 ; R, Q, E, -, W, T defb 6, 1, 4, 255, 19, 7 ; F, A, D, CTRL, S, G defb 22, 26, 3, 255, 24, 2 ; V, Z, C, SHIFT, X, B defb '$', '!', '#', 255, '\"','%' ; 4, 1, 3, -, 2, 5 defb 8, 10, 9, 255, 11, 14 ; M, SPACE, ',', -, '.', N defb '\'','@', '(', '=', ')', '&' ; 7, 0, 8, '-', 9, 6 defb 21, 16, 9, 13, 15, 25 ; u, p, i, return, o, y defb 10, 12, 11, '*', 12, 13 ; j, ;, k, :, l, h ;Shift + Control defb 'R', 'Q', 'E', 255, 'W', 'T' ; R, Q, E, -, W, T defb 'F', 'A', 'D', 255, 'S', 'G' ; F, A, D, CTRL, S, G defb 'V', 'Z', 'C', 255, 'X', 'B' ; V, Z, C, SHIFT, X, B defb '$', '!', '#', 255, '\"','%' ; 4, 1, 3, -, 2, 5 defb '\\',' ', '<', 255, '>', '^' ; M, SPACE, ',', -, '.', N defb '\'','@', '(', '=', ')', '&' ; 7, 0, 8, '-', 9, 6 defb '{', ']', '}', 13, '[', 'Y' ; u, p, i, return, o, y defb 'J', 127, '/', '*', '?', 'H' ; j, ;, k, :, l, h
39.090909
73
0.374419
[ "BSD-2-Clause" ]
ByteProject/Puddle-BuildTools
FictionTools/z88dk/libsrc/target/vz/input/in_keytranstbl.asm
2,150
Assembly
; A131507: 2n+1 appears n+1 times. ; 1,3,3,5,5,5,7,7,7,7,9,9,9,9,9,11,11,11,11,11,11,13,13,13,13,13,13,13,15,15,15,15,15,15,15,15,17,17,17,17,17,17,17,17,17,19,19,19,19,19,19,19,19,19,19,21,21,21,21,21,21,21,21,21,21,21,23,23,23,23,23,23,23,23,23,23,23,23,25,25,25,25,25,25,25,25,25,25,25,25,25,27,27,27,27,27,27,27,27,27 lpb $0 add $1,1 sub $0,$1 lpe mul $1,2 add $1,1 mov $0,$1
35
286
0.625974
[ "Apache-2.0" ]
ckrause/cm
programs/oeis/131/A131507.asm
385
Assembly
; A095121: Expansion of (1-x+2x^2)/((1-x)(1-2x)). ; 1,2,6,14,30,62,126,254,510,1022,2046,4094,8190,16382,32766,65534,131070,262142,524286,1048574,2097150,4194302,8388606,16777214,33554430,67108862,134217726,268435454,536870910,1073741822,2147483646,4294967294,8589934590,17179869182,34359738366,68719476734,137438953470,274877906942,549755813886,1099511627774,2199023255550,4398046511102,8796093022206,17592186044414,35184372088830,70368744177662,140737488355326,281474976710654,562949953421310,1125899906842622,2251799813685246,4503599627370494,9007199254740990 add $0,1 mov $1,2 pow $1,$0 trn $1,3 add $1,1
67.777778
512
0.837705
[ "Apache-2.0" ]
jmorken/loda
programs/oeis/095/A095121.asm
610
Assembly
; A047850: a(n) = (5^n + 3)/4. ; 1,2,7,32,157,782,3907,19532,97657,488282,2441407,12207032,61035157,305175782,1525878907,7629394532,38146972657,190734863282,953674316407,4768371582032,23841857910157,119209289550782,596046447753907 mov $1,5 pow $1,$0 add $1,5 div $1,4 mov $0,$1
31
199
0.763441
[ "Apache-2.0" ]
ckrause/cm
programs/oeis/047/A047850.asm
279
Assembly
// Create a n x m rectangle by manipulating the screen register // PSEUDO CODE: // addr = SCREEN // n = RAM[0] // i = 0 // LOOP: // if i > n goto END // RAM[addr] = -1 (set pixels to black) // addr = addr + 31 // i = i + 1 // goto LOOP // END: // goto END @SCREEN D=A @addr M=D // addr = 16384 register @R0 D=M @n M=D // n = RAM[0] @i M=0 (LOOP) @i D=M @n D=D-M @END D;JGT // if i > n goto END @addr A=M M=-1 // sets RAM[addr] = 1111111111111111 @i M=M+1 // i = i + 1 @32 D=A @addr M=D+M // addr = addr + 32 @LOOP 0;JMP (END) @END 0;JMP
12.019231
63
0.4848
[ "MIT" ]
UrielX/nand2tetris
projects/04/assembler_programs/draw_rectangle.asm
625
Assembly
.386 _TEXT segment use32 para public 'CODE' public _DivideAsm public _yuzaadd _DivideAsm proc near assume cs:_TEXT mov eax, [esp + 4] mov ebx, [esp + 8] cdq idiv ebx ret _DivideAsm endp _yuzaadd proc near assume cs:_TEXT mov eax, [esp + 4] mov ebx, [esp + 8] add eax, ebx ret _yuzaadd endp _TEXT ends end
15.692308
48
0.556373
[ "BSD-2-Clause" ]
pdpdds/edusample
IDIV6/_divide.asm
408
Assembly
global _start section .text _start: jmp short call_abc abc: pop rdi ; load own address sub rdi,46 ; jump over egghunter code to avoid finding tag for searching mov rax,0x8899AABBCCDDEEFF ; load tag 0xAABBCCDD xor rcx,rcx mov cx,0xFFFF ; search for max 2^16 bytes std ; set direction flag ; -> scasd decrements edi ; -> search towards lower emmory search: ; search for tag at the stack scasq ; compares string (dword) in eax and [edi], and increments/decrements ; Compare RAX with quadword at RDI or EDI then set status flags. jz exec ; jump to shellcode if egg is found add rdi,7 ; search after every byte instead of every 4 bytes to avoid alignment problems loop search exec: ; rdi = position of the start of the tag (88 of 8899AABBCCDDEEFF) - 8 (scasq dec) add rdi,16 ; +8 (scasq) +8 (tag) jmp rdi ; jmp to shellcode call_abc: call abc
33.583333
102
0.523573
[ "Unlicense" ]
91fc7b/SLAE64
3/egghunter.asm
1,209
Assembly
C nettle, low-level cryptographics library C C Copyright (C) 2013 Niels Möller C C The nettle library is free software; you can redistribute it and/or modify C it under the terms of the GNU Lesser General Public License as published by C the Free Software Foundation; either version 2.1 of the License, or (at your C option) any later version. C C The nettle library is distributed in the hope that it will be useful, but C WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY C or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public C License for more details. C C You should have received a copy of the GNU Lesser General Public License C along with the nettle library; see the file COPYING.LIB. If not, write to C the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, C MA 02111-1301, USA. .file "sha256-compress.asm" define(<STATE>, <%rdi>) define(<INPUT>, <%rsi>) define(<K>, <%rdx>) define(<SA>, <%eax>) define(<SB>, <%ebx>) define(<SC>, <%ecx>) define(<SD>, <%r8d>) define(<SE>, <%r9d>) define(<SF>, <%r10d>) define(<SG>, <%r11d>) define(<SH>, <%r12d>) define(<T0>, <%r13d>) define(<T1>, <%edi>) C Overlap STATE define(<COUNT>, <%r14>) define(<W>, <%r15d>) define(<EXPN>, < movl OFFSET($1)(%rsp), W movl OFFSET(eval(($1 + 14) % 16))(%rsp), T0 movl T0, T1 shrl <$>10, T0 roll <$>13, T1 xorl T1, T0 roll <$>2, T1 xorl T1, T0 addl T0, W movl OFFSET(eval(($1 + 1) % 16))(%rsp), T0 movl T0, T1 shrl <$>3, T0 roll <$>14, T1 xorl T1, T0 roll <$>11, T1 xorl T1, T0 addl T0, W addl OFFSET(eval(($1 + 9) % 16))(%rsp), W movl W, OFFSET($1)(%rsp) >) C ROUND(A,B,C,D,E,F,G,H,K) C C H += S1(E) + Choice(E,F,G) + K + W C D += H C H += S0(A) + Majority(A,B,C) C C Where C C S1(E) = E<<<26 ^ E<<<21 ^ E<<<7 C S0(A) = A<<<30 ^ A<<<19 ^ A<<<10 C Choice (E, F, G) = G^(E&(F^G)) C Majority (A,B,C) = (A&B) + (C&(A^B)) define(<ROUND>, < movl $5, T0 movl $5, T1 roll <$>7, T0 roll <$>21, T1 xorl T0, T1 roll <$>19, T0 xorl T0, T1 addl W, $8 addl T1, $8 movl $7, T0 xorl $6, T0 andl $5, T0 xorl $7, T0 addl OFFSET($9)(K,COUNT,4), $8 addl T0, $8 addl $8, $4 movl $1, T0 movl $1, T1 roll <$>10, T0 roll <$>19, T1 xorl T0, T1 roll <$>20, T0 xorl T0, T1 addl T1, $8 movl $1, T0 movl $1, T1 andl $2, T0 xorl $2, T1 addl T0, $8 andl $3, T1 addl T1, $8 >) define(<NOEXPN>, < movl OFFSET($1)(INPUT, COUNT, 4), W bswapl W movl W, OFFSET($1)(%rsp, COUNT, 4) >) C void C _nettle_sha256_compress(uint32_t *state, const uint8_t *input, const uint32_t *k) .text ALIGN(16) PROLOGUE(_nettle_sha256_compress) W64_ENTRY(3, 0) sub $120, %rsp mov %rbx, 64(%rsp) mov STATE, 72(%rsp) C Save state, to free a register mov %rbp, 80(%rsp) mov %r12, 88(%rsp) mov %r13, 96(%rsp) mov %r14, 104(%rsp) mov %r15, 112(%rsp) movl (STATE), SA movl 4(STATE), SB movl 8(STATE), SC movl 12(STATE), SD movl 16(STATE), SE movl 20(STATE), SF movl 24(STATE), SG movl 28(STATE), SH xor COUNT, COUNT ALIGN(16) .Loop1: NOEXPN(0) ROUND(SA,SB,SC,SD,SE,SF,SG,SH,0) NOEXPN(1) ROUND(SH,SA,SB,SC,SD,SE,SF,SG,1) NOEXPN(2) ROUND(SG,SH,SA,SB,SC,SD,SE,SF,2) NOEXPN(3) ROUND(SF,SG,SH,SA,SB,SC,SD,SE,3) NOEXPN(4) ROUND(SE,SF,SG,SH,SA,SB,SC,SD,4) NOEXPN(5) ROUND(SD,SE,SF,SG,SH,SA,SB,SC,5) NOEXPN(6) ROUND(SC,SD,SE,SF,SG,SH,SA,SB,6) NOEXPN(7) ROUND(SB,SC,SD,SE,SF,SG,SH,SA,7) add $8, COUNT cmp $16, COUNT jne .Loop1 .Loop2: EXPN( 0) ROUND(SA,SB,SC,SD,SE,SF,SG,SH,0) EXPN( 1) ROUND(SH,SA,SB,SC,SD,SE,SF,SG,1) EXPN( 2) ROUND(SG,SH,SA,SB,SC,SD,SE,SF,2) EXPN( 3) ROUND(SF,SG,SH,SA,SB,SC,SD,SE,3) EXPN( 4) ROUND(SE,SF,SG,SH,SA,SB,SC,SD,4) EXPN( 5) ROUND(SD,SE,SF,SG,SH,SA,SB,SC,5) EXPN( 6) ROUND(SC,SD,SE,SF,SG,SH,SA,SB,6) EXPN( 7) ROUND(SB,SC,SD,SE,SF,SG,SH,SA,7) EXPN( 8) ROUND(SA,SB,SC,SD,SE,SF,SG,SH,8) EXPN( 9) ROUND(SH,SA,SB,SC,SD,SE,SF,SG,9) EXPN(10) ROUND(SG,SH,SA,SB,SC,SD,SE,SF,10) EXPN(11) ROUND(SF,SG,SH,SA,SB,SC,SD,SE,11) EXPN(12) ROUND(SE,SF,SG,SH,SA,SB,SC,SD,12) EXPN(13) ROUND(SD,SE,SF,SG,SH,SA,SB,SC,13) EXPN(14) ROUND(SC,SD,SE,SF,SG,SH,SA,SB,14) EXPN(15) ROUND(SB,SC,SD,SE,SF,SG,SH,SA,15) add $16, COUNT cmp $64, COUNT jne .Loop2 mov 72(%rsp), STATE addl SA, (STATE) addl SB, 4(STATE) addl SC, 8(STATE) addl SD, 12(STATE) addl SE, 16(STATE) addl SF, 20(STATE) addl SG, 24(STATE) addl SH, 28(STATE) mov 64(%rsp), %rbx mov 80(%rsp), %rbp mov 88(%rsp), %r12 mov 96(%rsp), %r13 mov 104(%rsp),%r14 mov 112(%rsp),%r15 add $120, %rsp W64_EXIT(3, 0) ret EPILOGUE(_nettle_sha256_compress)
22.868687
84
0.632509
[ "BSD-3-Clause" ]
GaloisInc/hacrypto
src/C/nettle/nettle-2.7.1/x86_64/sha256-compress.asm
4,529
Assembly
section .text global ft_strlen ft_strlen: xor rcx, rcx ft_strlen_next: cmp [rdi+rcx], byte 0 jz ft_strlen_null inc rcx jmp ft_strlen_next ft_strlen_null: mov rax, rcx ret
11.375
22
0.752747
[ "MIT" ]
caio-vinicius/libasm
srcs/ft_strlen.asm
182
Assembly
; A169642: a(n) = A005408(n) * A022998(n). ; 0,3,20,21,72,55,156,105,272,171,420,253,600,351,812,465,1056,595,1332,741,1640,903,1980,1081,2352,1275,2756,1485,3192,1711,3660,1953,4160,2211,4692,2485,5256,2775,5852,3081,6480,3403,7140,3741,7832,4095,8556,4465,9312,4851,10100,5253,10920,5671,11772,6105,12656,6555,13572,7021,14520,7503,15500,8001,16512,8515,17556,9045,18632,9591,19740,10153,20880,10731,22052,11325,23256,11935,24492,12561,25760,13203,27060,13861,28392,14535,29756,15225,31152,15931,32580,16653,34040,17391,35532,18145,37056 mov $1,$0 mul $0,2 gcd $1,2 mov $2,$0 mul $2,$1 mul $0,$2 add $0,$2 div $0,2
51.5
496
0.749191
[ "Apache-2.0" ]
ckrause/loda-programs
oeis/169/A169642.asm
618
Assembly
;/* ; Copyright Oliver Kowalke 2009. ; Distributed under the Boost Software License, Version 1.0. ; (See accompanying file LICENSE_1_0.txt or copy at ; http://www.boost.org/LICENSE_1_0.txt) ;*/ ; ******************************************************* ; * * ; * ------------------------------------------------- * ; * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * ; * ------------------------------------------------- * ; * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| * ; * ------------------------------------------------- * ; * | s16 | s17 | s18 | s19 | s20 | s21 | s22 | s23 | * ; * ------------------------------------------------- * ; * ------------------------------------------------- * ; * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | * ; * ------------------------------------------------- * ; * | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| * ; * ------------------------------------------------- * ; * | s24 | s25 | s26 | s27 | s28 | s29 | s30 | s31 | * ; * ------------------------------------------------- * ; * ------------------------------------------------- * ; * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | * ; * ------------------------------------------------- * ; * | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| * ; * ------------------------------------------------- * ; * |deall|limit| base| v1 | v2 | v3 | v4 | v5 | * ; * ------------------------------------------------- * ; * ------------------------------------------------- * ; * | 24 | 25 | 26 | 27 | 28 | | * ; * ------------------------------------------------- * ; * | 0x60| 0x64| 0x68| 0x6c| 0x70| | * ; * ------------------------------------------------- * ; * | v6 | v7 | v8 | lr | pc | | * ; * ------------------------------------------------- * ; * * ; ******************************************************* AREA |.text|, CODE ALIGN 4 EXPORT swoole_make_fcontext IMPORT _exit swoole_make_fcontext PROC ; first arg of swoole_make_fcontext() == top of context-stack ; save top of context-stack (base) A4 mov a4, a1 ; shift address in A1 to lower 16 byte boundary bic a1, a1, #0x0f ; reserve space for context-data on context-stack sub a1, a1, #0x74 ; save top address of context_stack as 'base' str a4, [a1,#0x48] ; second arg of swoole_make_fcontext() == size of context-stack ; compute bottom address of context-stack (limit) sub a4, a4, a2 ; save bottom address of context-stack as 'limit' str a4, [a1,#0x44] ; save bottom address of context-stack as 'dealloction stack' str a4, [a1,#0x40] ; third arg of swoole_make_fcontext() == address of context-function str a3, [a1,#0x70] ; compute abs address of label finish adr a2, finish ; save address of finish as return-address for context-function ; will be entered after context-function returns str a2, [a1,#0x6c] bx lr ; return pointer to context-data finish ; exit code is zero mov a1, #0 ; exit application bl _exit ENDP END
38.022989
72
0.360036
[ "Apache-2.0" ]
10088/swoole-src
thirdparty/boost/asm/make_arm_aapcs_pe_armasm.asm
3,308
Assembly
; A001552: 1^n + 2^n + ... + 5^n. ; 5,15,55,225,979,4425,20515,96825,462979,2235465,10874275,53201625,261453379,1289414505,6376750435,31605701625,156925970179,780248593545,3883804424995,19349527020825,96470431101379,481245667164585,2401809362313955,11991391850823225 mov $4,$0 mov $0,5 mov $2,5 mov $3,$4 lpb $0,1 mov $1,$0 sub $0,1 pow $1,$3 add $2,$1 lpe gcd $0,2 mul $1,2 add $1,5 mul $2,5 add $2,$0 add $1,$2 sub $1,59 div $1,10 mul $1,2 add $1,5
19.166667
232
0.695652
[ "Apache-2.0" ]
karttu/loda
programs/oeis/001/A001552.asm
460
Assembly
SFX_Battle_34_Ch4: dutycycle 237 unknownsfx0x20 8, 255, 248, 3 unknownsfx0x20 15, 255, 0, 4 unknownsfx0x20 15, 243, 0, 4 endchannel SFX_Battle_34_Ch5: dutycycle 180 unknownsfx0x20 8, 239, 192, 3 unknownsfx0x20 15, 239, 192, 3 unknownsfx0x20 15, 227, 192, 3 endchannel SFX_Battle_34_Ch7: unknownnoise0x20 4, 255, 81 unknownnoise0x20 8, 255, 84 unknownnoise0x20 15, 255, 85 unknownnoise0x20 15, 243, 86 endchannel
18.73913
31
0.758701
[ "MIT" ]
ETDV-TheVoid/pokemon-rgb-enhanced
audio/sfx/battle_34.asm
431
Assembly
bits 64 global assembly assembly: mov rbx, 5 mov rcx, 10 lea eax, [rcx + rbx*2 + 5] ret
10.777778
28
0.618557
[ "MIT" ]
ailtonbsj/buffer-overflow-studies
gcc-assembly/02-load-effective-address/assembly.asm
97
Assembly