hexsha stringlengths 40 40 | size int64 6 1.05M | ext stringclasses 3 values | lang stringclasses 1 value | max_stars_repo_path stringlengths 4 232 | max_stars_repo_name stringlengths 7 106 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 7 | max_stars_count int64 1 33.5k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 232 | max_issues_repo_name stringlengths 7 106 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 7 | max_issues_count int64 1 37.5k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 232 | max_forks_repo_name stringlengths 7 106 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 7 | max_forks_count int64 1 12.6k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 6 1.05M | avg_line_length float64 1.16 19.7k | max_line_length int64 2 938k | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8bcc6a5ba823f73922f9fcc4e5681df375b44a4c | 350 | asm | Assembly | oeis/018/A018383.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/018/A018383.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/018/A018383.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A018383: Divisors of 304.
; Submitted by Jon Maiga
; 1,2,4,8,16,19,38,76,152,304
mov $1,1
mov $2,1
lpb $0
mov $3,$2
lpb $3
sub $1,1
add $2,1
mov $4,$1
add $1,2
gcd $4,$2
pow $4,2
div $4,$2
cmp $4,1
cmp $4,0
mul $3,$4
sub $3,$4
lpe
sub $0,1
add $2,1
mul $1,$2
lpe
mov $0,$2
div $0,2
add $0,1
| 12.068966 | 29 | 0.488571 |
d2e025779fcc7d1618250013997a4d9e9f88ff4a | 74,840 | asm | Assembly | Library/Socket/socketLink.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 504 | 2018-11-18T03:35:53.000Z | 2022-03-29T01:02:51.000Z | Library/Socket/socketLink.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 96 | 2018-11-19T21:06:50.000Z | 2022-03-06T10:26:48.000Z | Library/Socket/socketLink.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 73 | 2018-11-19T20:46:53.000Z | 2022-03-29T00:59:26.000Z | COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Geoworks 1994 -- All Rights Reserved
GEOWORKS CONFIDENTIAL
PROJECT: Network Extensions
MODULE: socket library
FILE: socketLink.asm
AUTHOR: Eric Weber, May 17, 1994
ROUTINES:
Name Description
---- -----------
INT RemoveDomainInterrupt Timer interrupt asking to free a domain
INT SocketSpawnThread Create a thread to remove a domain
EXT SocketFindDomain Convert a domain name to a domain handle,
considering only fully open domains
EXT SocketFindDomainLow Convert a domain name to a domain handle
EXT SocketFindLink Given a domain handle and address, return
the offset in the domain info chunk of the
link info for the corresponding link
EXT SocketAddLink Record a link
EXT SocketRemoveConnection Remove a ConnectionInfo
EXT SocketRemoveDomain Remove an unused domain
EXT RemoveDomainThread Remove a domain by request of a timer
INT SocketRemoveDomainLow Remove a domain right now
INT LinkIncRefCount Increment reference count on a link
INT LinkDecRefCount Reduce the reference count of a link and
possibly close link
INT LinkDecRefCountoClose Reduce the reference count of a link
INT SocketCloseLink Close a link
EXT CloseLinkThread Really close a link
INT FindClosingLink Nuke the link which is being opened.
EXT SocketCreateDomain Create a new domain
INT CompareDomains Compare two domain names
INT CompareAddresses Compare two addresses
EXT SocketFreeDomain Free a domain info chunk
EXT SocketFindLinkByHandle Translate a link handle to its offset in
the domain
EXT SocketFindLinkById Translate a link id to its offset in the
domain
INT SocketResetDomain Reset a domain to the standby state
EXT SocketStopDomainTimer Stop the timer in a domain
INT SocketAddDomain Add a new domain
INT SocketRemoveLink Remove a link which was closed by the
driver
INT FindFailedSockets Find all sockets using a link, and mark
them failed
EXT FailedPortCallback Find any failed sockets in this port
EXT FailedSocketCallback See if this socket is using a failed link
INT SocketAddressToLink Given a SocketAddres, find or create a
domain and link
INT SocketLockForCreateLink Lock domain and verify that link really
doesn't exist
INT SocketCreateLink Open an remember a link
INT DestroyOpeningLink Nuke the link which is being opened.
EXT SocketLoadDriver Load the driver for a domain
INT SocketGrabMiscLock Increment the misc counter in a domain
EXT SocketReleaseMiscLock Release a misc lock and possibly close
domain
EXT SocketAddressToDomain Given a SocketAddress, find or create its
domain
INT SocketGetDomainsLow Get a chunk array of domain names
EXT SocketGetDomainsCallback
callback from SocketGetDomains
EXT SocketLinkGetMediumForLink
Query the driver to find the medium used
for a particular link.
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 5/17/94 Initial revision
DESCRIPTION:
Routines pertaining to management of driver-level connections
$Id: socketLink.asm,v 1.1 97/04/07 10:45:59 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
idata segment
;
; the driver semaphore is locked whenever a thread is in the process of
; either loading or unloading a driver
;
driverSem Semaphore <>
nextID word 1
socketCategory char "socket",0
domainsKey char "domains",0
driverKey char "driver",0
typeKey char "driverType",0
driverCloseDelayKey char "driverCloseDelay",0
sendTimeoutKey char "sendTimeout",0
driverPath TCHAR "socket",0
idata ends
udata segment
driverCloseDelay word ; time (in ticks) to wait before
; shutting down a driver when there
; are no more references to it
udata ends
FixedCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RemoveDomainInterrupt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Timer interrupt asking to free a domain
CALLED BY: EXTERNAL SocketRemoveDomain via timer
PASS: ax - domain handle
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
get UI thread
ask it to call FreeDomainCallback
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 1/ 4/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
; We turn off read/write checking for this routine, because
; r/w checking code grabs heap semaphore, which should not occur in
; timer invoked routines. --- AY 3/27/95
.norcheck
.nowcheck
RemoveDomainInterrupt proc far
uses ax,bx,cx,dx,bp,di
.enter
;
; get the UI's thread
;
mov cx,ax ; save domain handle
mov ax, SGIT_UI_PROCESS
call SysGetInfo ; ax = handle, dx destroyed
mov bx,ax
;
; set up parameters to callback
;
sub sp, size ProcessCallRoutineParams
mov bp,sp
mov ss:[bp].PCRP_address.segment, vseg SocketSpawnThread
mov ss:[bp].PCRP_address.offset, offset SocketSpawnThread
mov ss:[bp].PCRP_dataBX, cx ; domain handle
mov ss:[bp].PCRP_dataCX, vseg RemoveDomainThread
mov ss:[bp].PCRP_dataDX, offset RemoveDomainThread
;
; ask UI to call the callback on its thread
;
mov dx, size ProcessCallRoutineParams
mov ax, MSG_PROCESS_CALL_ROUTINE
mov di, mask MF_FORCE_QUEUE or mask MF_STACK
call ObjMessage
add sp, size ProcessCallRoutineParams
.leave
ret
RemoveDomainInterrupt endp
ifdef READ_CHECK
.rcheck
endif
ifdef WRITE_CHECK
.wcheck
endif
FixedCode ends
UtilCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketSpawnThread
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create a thread to remove a domain
CALLED BY: (INTERNAL) SocketCloseLink
PASS: bx - domain handle
cx - segment of routine to run
dx - offset of routine to run
RETURN: nothing
DESTROYED: ax,bx,cx,dx,di,bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
We can't have ProcessCallRoutine call ThreadCreate directly because
we can't pass bp through it.
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 1/ 6/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketSpawnThread proc far
.enter
;
; spawn a thread
;
mov ax, PRIORITY_STANDARD
mov di, DRIVER_CLOSE_STACK
mov bp, handle 0
call ThreadCreate
.leave
ret
SocketSpawnThread endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketFindDomain
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Convert a domain name to a domain handle, considering
only fully open domains
CALLED BY: (EXTERNAL) SocketAddressToDomain, SocketAddressToLink,
SocketCheckMediumConnection, SocketCloseDomainMedium,
SocketGetAddressController, SocketGetAddressMedium,
SocketGetAddressSize, SocketGetDomainMedia,
SocketOpenDomainMedium, SocketResolve
PASS: ds - control segment
dx:bp - domain name
RETURN: carry - set if not found
bx - domain handle
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
If the domain exists, but is OCS_OPENING or OCS_CLOSING, it is treated
as if it didn't exist.
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 5/18/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketFindDomain proc far
uses di
.enter
call SocketFindDomainLow
jc done
mov di, ds:[bx]
cmp ds:[di].DI_state, OCS_OPEN
je done ; z set implies c clear
stc
done:
.leave
ret
SocketFindDomain endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketFindDomainLow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Convert a domain name to a domain handle
CALLED BY: (EXTERNAL) SocketAddDomain, SocketFindDomain,
SocketFindOrCreatePort, SocketLoadDriver,
SocketRemoveLoadOnMsgMem
PASS: ds - control segment
dx:bp - domain name
RETURN: carry - set if not found
bx - domain handle
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 11/20/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketFindDomainLow proc far
uses ax,cx,dx,si,di,bp,es
.enter
EC < Assert segment ds >
EC < Assert fptr dxbp >
;
; get the size of the domain name excluding NULL
; we want the size, not the length, so we can use a strcmp later
;
movdw esdi, dxbp
call LocalStringSize
;
; find the first domain in the domain array
;
mov ax,cx ; ax = size of dx:bp
mov si, offset SocketDomainArray ; *ds:si = domain array
mov di, ds:[si] ; ds:di = domain array
mov cx, ds:[di].CAH_count ; cx = no. of domains
jcxz domainNotFound
add di, ds:[di].CAH_offset ; ds:di = first domain
;
; loop through domains searching for the one the user wants
;
checkDomain:
call CompareDomains
je domainFound
;
; not this one, go on to next
;
inc di
inc di
loop checkDomain
;
; not in the array
;
domainNotFound:
stc
jmp done
domainFound:
mov bx, ds:[di] ; *ds:bx = DomainInfo
clc
done:
.leave
ret
SocketFindDomainLow endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketFindLink
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Given a domain handle and address, return the offset
in the domain info chunk of the link info for
the corresponding link
CALLED BY: (EXTERNAL) SocketAddressToLink, SocketLinkOpened,
SocketLockForCreateLink
PASS: ds - control segment
bx - domain handle
dx:bp - address
cx - size of address
RETURN: carry - set on error
dx - offset of link info in domain chunk
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 5/18/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketFindLink proc far
uses ax,bx,cx,si,di,bp
.enter
;
; search through the addresses in the link info array
;
mov si, bx
clr ax
linkLoop:
push cx
call ChunkArrayElementToPtr ; ds:di = LinkInfo, cx=size
;
; validate link info
;
EC < jc skipValidate >
EC < tst ds:[di].LI_handle >
EC < WARNING_Z WARNING_NULL_CONNECTION_HANDLE >
EC < sub cx, size LinkInfo >
EC < cmp cx, ds:[di].LI_addrSize >
EC < ERROR_NE CORRUPT_DOMAIN >
EC < clc >
skipValidate:
pop cx
jc done
;
; compare the addresses
;
inc ax
call CompareAddresses
jne linkLoop
;
; the link is at ds:di
;
cmp ds:[di].LI_state, OCS_OPEN
jne closing
mov dx, di ; ds:dx = LinkInfo
mov di, ds:[si] ; ds:di = DomainInfo
sub dx, di ; offset of link info
clc
done:
.leave
ret
closing:
stc
jmp done
NEC < ForceRef skipValidate >
SocketFindLink endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketAddLink
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Record a link
CALLED BY: (EXTERNAL) SocketCreateLink, SocketLinkOpened
PASS: dx:bp - address
cx - address size
ax - link handle
bx - domain handle
RETURN: ds:si - LinkInfo
ax - link id
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 10/11/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketAddLink proc far
uses bx,cx,dx,di,bp,es
.enter
;
; stop any timer which is running so domain doesn't shut down
;
push ax
mov si,bx
call SocketStopDomainTimer
;
; Allocate a new link info
;
alloc::
mov ax, size LinkInfo
add ax,cx
call ChunkArrayAppend ; ds:di = LinkInfo
pop ax
;
; set the fixed fields
;
segmov es,ds,si ; es:di = LinkInfo
mov es:[di].LI_state, OCS_OPEN
mov es:[di].LI_handle, ax ; not open yet
clr es:[di].LI_refCount ; no connections yet
mov es:[di].LI_addrSize, cx
;
; copy the address
;
copyAddress::
movdw dssi, dxbp
push es,di
add di, offset LI_address
EC < call ECCheckMovsb >
rep movsb
pop ds,si ; ds:si = LinkInfo
;
; set the link id
;
mov bx, handle dgroup
call MemDerefES
segmov ds:[si].LI_id, es:[nextID], ax
inc es:[nextID]
done::
.leave
ret
SocketAddLink endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketRemoveConnection
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Remove a ConnectionInfo for a data driver
CALLED BY: (EXTERNAL) FreeListenQueueCallback, SocketConnectionClosed,
SocketFullClose
PASS: bx - domain
ax - connection handle
dx - SocketDrError
RETURN: carry set on error (redundent close)
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 11/17/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketRemoveConnection proc far
uses ax,bx,cx,dx,si,di,bp
.enter
;
; find the ConnectionInfo
;
mov cx, bx
xchg dx, ax ; ax = error
call SocketFindLinkByHandle
jc done
mov si, bx
mov di, ds:[bx]
add di, dx
;
; see if anyone is using it
;
tst ds:[di].CI_socket
jz delete
;
; mark socket as closed
;
mov bx, ds:[di].CI_socket
mov bx, ds:[bx]
and ds:[bx].SI_flags, not (mask SF_RECV_ENABLE or mask SF_SEND_ENABLE)
;
; check the state
;
EC < cmp ds:[bx].SI_state, ISS_CONNECTING >
EC < je stateOK >
EC < cmp ds:[bx].SI_state, ISS_CONNECTED >
EC < je stateOK >
EC < cmp ds:[bx].SI_state, ISS_CLOSING >
EC < ERROR_NE UNEXPECTED_SOCKET_STATE >
stateOK::
;
; get the error, if any
;
tst ax
jz wakeup
call SocketMapConnectError
;
; If timing out after already connected, use CONNECTION_FAILED
; instead of SE_TIMED_OUT. This avoids conflict with the use
; of SE_TIMED_OUT to indicate a normal timeout on a recv.
;
cmp al, SE_TIMED_OUT
jne goterr
cmp ds:[bx].SI_state, ISS_CONNECTING
je goterr
mov al, SE_CONNECTION_FAILED
goterr:
mov ds:[bx].SSI_error, ax
ornf ds:[bx].SI_flags, mask SF_FAILED
;
; Clear out the CE_link field so we know the connection to the
; driver is no more. (It's passed on, it's ceased to be!)
;
wakeup:
clr ds:[bx].SSI_connection.CE_link
mov bx, ds:[di].CI_socket
call WakeUpForClose
;
; Check if SocketClose was already called. If so, clean up the socket.
;
push di, si
mov si, ds:[bx]
cmp ds:[si].SI_state, ISS_CLOSING
jne doDelete
call RemoveSocketFromPort
call SocketFreeLow
doDelete:
pop di, si
;
; delete the ConnectionInfo
;
delete:
call ChunkArrayDelete
;
; close domain if needed
;
call SocketRemoveDomain
clc
done::
EC < WARNING_C REDUNDENT_CLOSE >
.leave
ret
SocketRemoveConnection endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketRemoveDomain
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Remove an unused domain
CALLED BY: (EXTERNAL) CloseLinkThread, DestroyOpeningLink,
SocketConnectRequest, SocketConnectionClosed,
SocketFreePort, SocketReleaseMiscLock,
SocketRemoveConnection, SocketRemoveDomainLow,
SocketRemoveLink
PASS: *ds:si - DomainInfo
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 8/24/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketRemoveDomain proc far
uses ax,bx,cx,dx,si,di,bp,ds,es
.enter
EC < mov ax,ds >
EC < mov bx, SCLT_WRITE >
EC < call ECCheckControlSeg >
;
; check counts
;
mov di, ds:[si]
tst ds:[di].CAH_count
jnz done
tst ds:[di].DI_miscCount
jnz done
;
; We should only be in this routine if one of the above counts
; just now reached zero. Therefore the domain should not already
; be closing.
;
EC < tst ds:[di].DI_timer >
EC < ERROR_NZ CORRUPT_DOMAIN >
;
; create a timer
;
; before that, we want to check if the delay==0. because 0 means
; disable this function
;
mov bx, handle dgroup
call MemDerefES
mov cx, es:[driverCloseDelay]
jcxz done
mov dx, si ; domain handle
mov al, TIMER_ROUTINE_ONE_SHOT
mov bx, handle RemoveDomainInterrupt
call MemDerefES
mov bx,es
mov si, offset RemoveDomainInterrupt ; bx:si = handler
mov bp, handle 0 ; owner for timer
call TimerStartSetOwner ; ax=id, bx=handle
mov ds:[di].DI_timer, bx
mov ds:[di].DI_timerID, ax
done:
.leave
ret
SocketRemoveDomain endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RemoveDomainThread
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Remove a domain by request of a timer
CALLED BY: (EXTERNAL) thread created by SocketRemoveDomainInterrupt
PASS: cx - domain handle
es - dgroup
RETURN: parameters for ThreadDestroy
cx - return code (0)
dxbp - object to receive ACK (0)
si - data to pass with ACK (undefined)
DESTROYED: bx, di, ds
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 1/ 4/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RemoveDomainThread proc far
PSem es, driverSem
call SocketControlStartWrite
;
; If there is no timer handle in the domain, it means somebody
; tried to stop us, but were too late. We will honor their
; wishes and do nothing.
;
mov si,cx
mov di, ds:[si]
tst ds:[di].DI_timer
jz skip
clr ds:[di].DI_timer
clr ds:[di].DI_timerID
;
; go ahead and remove the domain
;
call SocketRemoveDomainLow
skip:
call SocketControlEndWrite
VSem es, driverSem
;
; set up parameters for ThreadDestroy
;
clr cx ; exit code 0
clrdw dxbp ; no ACK required
ret
RemoveDomainThread endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketRemoveDomainLow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Remove a domain right now
CALLED BY: (INTERNAL) RemoveDomainThread
PASS: *ds:si - DomainInfo
es - dgroup
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 1/ 4/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketRemoveDomainLow proc near
uses ax,bx,cx,dx,si,di,bp
.enter
;
; check counts
;
mov di, ds:[si]
tst ds:[di].CAH_count
jnz skipClose
tst ds:[di].DI_miscCount
jz countsOK
skipClose:
jmp done
countsOK:
;
; verify domain isn't already being closed
; (we shouldn't be here if it is being opened)
;
cmp ds:[di].DI_state, OCS_OPEN
je pastValidate
EC < cmp ds:[di].DI_state, OCS_CLOSING >
EC < ERROR_NE CORRUPT_DOMAIN >
abortClose::
jmp done
pastValidate::
;
; set state to closing
; this prevents any additional threads from blocking on the
; mutexes
;
mov ds:[di].DI_state, OCS_CLOSING
;
; wait for both mutex queues to clear
;
mov bx, ds:[di].DI_openMutex
mov cx, ds:[di].DI_closeMutex
call SocketControlEndWrite
call ThreadPSem
call ThreadVSem
mov bx,cx
call ThreadPSem
call ThreadVSem
call SocketControlStartWrite
;
; make sure no links were opened, or misc operations started
;
pastMutex::
mov di, ds:[si]
tst ds:[di].CAH_count
jnz lateAbortClose
tst ds:[di].DI_miscCount
jnz lateAbortClose
;
; save some info for freeing driver below
;
mov al, ds:[di].DI_flags
mov cx, ds:[di].DI_driver
;
; unregister the domain
;
pushdw ds:[di].DI_entry
mov bx, ds:[di].DI_client
mov di, DR_SOCKET_UNREGISTER
call SocketControlEndWrite
call PROCCALLFIXEDORMOVABLE_PASCAL
jc refused
;
; remove our reference to the driver, so it can exit
;
mov bx, cx
test al, mask DF_SELF_LOAD
je selfload
call GeodeFreeDriver
jmp reset
selfload:
call GeodeRemoveReference
;
; remove the lock on ourselves created when this driver was
; registered
;
mov bx, handle 0
call GeodeRemoveReference
;
; reset this domain to standby mode, since domain chunks
; are never freed unless the library exits
;
reset:
call SocketControlStartWrite
mov di, ds:[si]
call SocketResetDomain
done:
.leave
ret
;
; Return domain to open state.
;
; If we are aborting, but the domain is still unused, we
; will try to remove it again later. This only happens when
; the driver refuses unregistration.
;
refused:
call SocketControlStartWrite
mov di, ds:[si]
lateAbortClose:
mov ds:[di].DI_state, OCS_OPEN
call SocketRemoveDomain
jmp done
SocketRemoveDomainLow endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LinkIncRefCount
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Increment reference count on a link
CALLED BY: (INTERNAL) ListenQueueAppend, SocketRegisterConnection
PASS: *ds:cx - domain
dx - link offset
RETURN: ax - link handle
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 8/20/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LinkIncRefCount proc far
uses bx,dx,si
.enter
mov si,cx ; *ds:si = DomainInfo
mov si, ds:[si] ; ds:si = DomainInfo
mov bx, dx ; ds:si+bx = LinkInfo
inc ds:[si][bx].LI_refCount ; update count
mov ax, ds:[si][bx].LI_handle
;
; make sure that we just modified a real domain and link
;
EC < cmp ds:[si].DI_type, CCT_DOMAIN_INFO >
EC < ERROR_NE CORRUPT_DOMAIN >
EC < mov dx, ax >
EC < call SocketFindLinkByHandle >
EC < ERROR_C CORRUPT_DOMAIN >
EC < cmp bx,dx >
EC < ERROR_NE CORRUPT_DOMAIN >
.leave
ret
LinkIncRefCount endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LinkDecRefCount
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Reduce the reference count of a link and possibly close link
CALLED BY: (INTERNAL) ConnectionCancel, ConnectionClose, ConnectionRefuse,
ListenQueueDelete, SocketClearConnection
PASS: *ds:cx - DomainInfo
dx - offset of LinkInfo inside domain chunk
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS: may close link and/or free driver
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 10/11/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LinkDecRefCount proc far
call LinkDecRefCountNoClose
jc done
jnz done
call SocketCloseLink
done:
ret
LinkDecRefCount endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LinkDecRefCountNoClose
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Reduce the reference count of a link
CALLED BY: (INTERNAL) FreeListenQueueCallback, LinkDecRefCount,
SocketSendClose
PASS: *ds:cx - DomainInfo
dx - offset of LinkInfo inside domain chunk
RETURN: zero flag - set if link count is now zero
carry flag - set if called on a data driver domain
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 8/18/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LinkDecRefCountNoClose proc far
uses bx,dx,si
.enter
;
; find the counter
;
mov si,cx
mov si,ds:[si] ; ds:di = DomainInfo
mov bx,dx ; ds:di+bx = LinkInfo
cmp ds:[si].DI_driverType, SDT_DATA
stc
je done
;
; validate domain and link
;
EC < push dx >
EC < cmp ds:[si].DI_type, CCT_DOMAIN_INFO >
EC < ERROR_NE CORRUPT_DOMAIN >
EC < mov dx, ds:[si][bx].LI_handle >
EC < call SocketFindLinkByHandle >
EC < ERROR_C CORRUPT_DOMAIN >
EC < cmp bx,dx >
EC < ERROR_NE CORRUPT_DOMAIN >
EC < tst ds:[si][bx].LI_refCount >
EC < ERROR_Z LINK_ALREADY_CLOSED >
EC < pop dx >
;
; decrement the count
;
dec ds:[si][bx].LI_refCount
EC < ERROR_S CORRUPT_DOMAIN >
clc
done::
.leave
ret
LinkDecRefCountNoClose endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketCloseLink
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Close a link
CALLED BY: (INTERNAL) LinkDecRefCount
PASS: *ds:cx - DomainInfo
dx - offset to LinkInfo
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 8/16/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketCloseLink proc far
uses ax,bx,cx,dx,si,di,bp
domain local nptr push cx
id local nptr
.enter
;
; remember the link id
;
mov si,cx
mov di, ds:[si]
mov bx,dx
segmov ss:[id], ds:[di][bx].LI_id, bx
;
; grab exclusive right to manipulate links
;
mov bx, ds:[di].DI_closeMutex
call SocketControlEndWrite
call ThreadPSem
call SocketControlStartWrite
;
; relocate the link, if it still exists
;
findLink::
mov si, ss:[domain]
mov bx, ss:[id]
call SocketFindLinkById
jc unlockDomain
;
; make sure ref count is still zero
; (a connection may have opened while waiting for the lock)
;
mov di, ds:[si]
tst ds:[di][bx].LI_refCount
jnz unlockDomain
mov ds:[di][bx].LI_state, OCS_CLOSING
;
; spawn a thread to really close the link
;
mov bx,si
mov cx, vseg CloseLinkThread
mov dx, offset CloseLinkThread
push bp,si
call SocketSpawnThread
pop bp,si
jmp done
;
; release the exclusive lock on the driver
;
unlockDomain:
mov di, ds:[si] ; ds:di = DomainInfo
mov bx, ds:[di].DI_closeMutex
call ThreadVSem
done:
.leave
ret
SocketCloseLink endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CloseLinkThread
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Really close a link
CALLED BY: (EXTERNAL) thread created by SocketCloseLink
PASS: cx - domain handle
es - dgroup
RETURN: parameters for ThreadDestroy
cx - return code (0)
dxbp - object to receive ACK (0)
si - data to pass with ACK (undefined)
DESTROYED: bx, di, ds
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 2/ 8/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CloseLinkThread proc far
;
; locate the domain
;
call SocketControlStartWrite
EC < call ECCheckDomainLow >
;
; find the closing link
;
mov si,cx
call FindClosingLink
jc unlockDomain
;
; make sure ref count is still zero
; (a connection may have opened while this thread was spawning)
;
mov bx, ds:[si]
tst ds:[di].LI_refCount
jnz unlockDomain
;
; close the actual link
;
callDriver::
pushdw ds:[bx].DI_entry
mov bx, ds:[di].LI_handle
mov di, DR_SOCKET_DISCONNECT_REQUEST
mov ax, SCT_FULL
call SocketControlEndWrite
call PROCCALLFIXEDORMOVABLE_PASCAL
call SocketControlStartWrite
ERROR_C UNEXPECTED_SOCKET_DRIVER_ERROR
;
; verify once again that the link still exists
;
call FindClosingLink
jc unlockDomain
;
; actually delete it from the domain
;
call ChunkArrayDelete
;
; release the exclusive lock on the driver
;
unlockDomain:
mov di, ds:[si] ; ds:di = DomainInfo
mov bx, ds:[di].DI_closeMutex
call ThreadVSem
;
; possibly free the domain
;
call SocketRemoveDomain
call SocketControlEndWrite
done::
;
; set up parameters for ThreadDestroy
;
clr cx ; exit code 0
clrdw dxbp ; no ACK required
ret
CloseLinkThread endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FindClosingLink
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Nuke the link which is being opened.
CALLED BY: (INTERNAL) CloseLinkThread
PASS: *ds:si - DomainInfo
RETURN: ds:di - DomainInfo
carry set if not found
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 2/ 7/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FindClosingLink proc near
uses ax,cx
.enter
;
; start at the end of the array
;
call ChunkArrayGetCount ; cx = # of elements
mov ax,cx
;
; get previous entry and check it's state
;
top:
dec ax
stc
js done
call ChunkArrayElementToPtr ; ds:di = LinkInfo
cmp ds:[di].LI_state, OCS_CLOSING
jne top
;
; we found the link
;
clc
done:
.leave
ret
FindClosingLink endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketCreateDomain
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create a new domain
CALLED BY: (EXTERNAL) SocketAddDomain, SocketFindOrCreatePort,
SocketLoadDriver
PASS: ds - control segment
es - dgroup
dx:bp - domain name
RETURN: carry - set on error
bx - domain handle
DESTROYED: nothing
SIDE EFFECTS:
initial values:
DI_header as per ChunkArrayCreate
DI_type CCT_DOMAIN_INFO
DI_id next unique id
DI_driverType 0
DI_flags 0
DI_driver 0
DI_client 0
DI_entry 0
DI_state OCS_STANDBY
DI_openMutex semaphore handle
DI_closeMutex semaphore handle
DI_miscCount 0
DI_bindCount 0
DI_seqHeaderSize 0
DI_dgramHeaderSize 0
DI_nameSize as passed
DI_name as passed
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 6/ 8/94 Initial version
PT 7/24/96 DBCS'ized
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketCreateDomain proc far
uses ax,cx,dx,si,di,bp,es
.enter
;
; get the size of the domain name in bytes, excluding null
;
movdw esdi, dxbp
call LocalStringSize ; cx = size
;
; locate dgroup
;
mov bx, handle dgroup
call MemDerefES
;
; allocate a new domain info
;
clr bx ; var size array
add cx, size DomainInfo + size TCHAR; header size and null
clr si ; new chunk
clr al ; no flags
call ChunkArrayCreate ; *ds:si = array
LONG jc allocError
sub cx, size DomainInfo + size TCHAR; domain name size
;
; initialize it
;
push ds,si
mov di,ds:[si] ; ds:di = DomainInfo
EC < mov ds:[di].DI_type, CCT_DOMAIN_INFO >
segmov ds:[di].DI_id, es:[nextID], ax
inc es:[nextID]
mov ds:[di].DI_state, OCS_STANDBY
mov ds:[di].DI_nameSize, cx
;
; allocate semaphores owned by library
;
mov bx,1
call ThreadAllocSem ; bx = semaphore
mov ax, handle 0
call HandleModifyOwner
mov ds:[di].DI_openMutex, bx
mov bx,1
call ThreadAllocSem ; bx = semaphore
mov ax, handle 0
call HandleModifyOwner
mov ds:[di].DI_closeMutex, bx
mov bx,1
clr ds:[di].DI_miscCount
; clr ds:[di].DI_bindCount
;
; copy the domain name
;
segmov es,ds
add di, offset DI_name ; es:di = name buffer
movdw dssi, dxbp ; ds:si = name
EC < call ECCheckMovsb >
rep movsb
clr ax ; append a null
LocalPutChar esdi,ax
pop ds,bx ; *ds:bx = DomainInfo
;
; add it to the domain array
;
mov si, offset SocketDomainArray
call ChunkArrayAppend ; ds:di = new elt
jc appendError
mov ds:[di], bx
allocError:
.leave
ret
appendError:
;
; Error occured. Free the chunk array we allocated.
;
mov_tr ax, bx
call LMemFree
stc
jmp allocError
SocketCreateDomain endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CompareDomains
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Compare two domain names
CALLED BY: (INTERNAL) SocketFindDomainLow
PASS: dx:bp = domain name
ax = size of domain name
ds:di = **DomainInfo
RETURN: zero flag - set if equal
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 5/17/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CompareDomains proc near
uses cx,si,di,es
.enter
;
; dereference the string in the domain info
;
mov si, ds:[di] ; *ds:si = DomainInfo
mov si, ds:[si] ; ds:si = DomainInfo
mov cx, ds:[si].DI_nameSize
EC < tst cx >
EC < ERROR_Z INVALID_DOMAIN >
add si, offset DI_name ; ds:si = domain name 1
;
; set up pointer to passed string
;
mov es, dx
mov di, bp ; es:di = domain name 2
cmp cx, ax ; compare sizes
jne done
;
; now compare ds:si to es:di
;
EC < call ECCheckMovsb >
DBCS < shr cx >
call LocalCmpStringsNoCase
done:
.leave
ret
CompareDomains endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CompareAddresses
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Compare two addresses
CALLED BY: (INTERNAL) SocketFindLink
PASS: ds:di - LinkInfo
dx:bp - address
cx - address size
RETURN: zero flag - set if equal
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 5/17/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CompareAddresses proc near
uses cx,si,di,es
.enter
;
; check the sizes
;
EC < tst cx >
EC < ERROR_Z INVALID_ADDRESS >
cmp cx, ds:[di].LI_addrSize ; same size?
jne done
;
; set up registers
;
add di, offset LI_address ; ds:di = address
mov si,di ; ds:si = address 1
movdw esdi, dxbp ; es:di = address 2
;
; now compare ds:si to es:di
;
EC < call ECCheckMovsb >
repe cmpsb
done:
.leave
ret
CompareAddresses endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketFreeDomain
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Free a domain info chunk
CALLED BY: (EXTERNAL) SocketLoadDriver
PASS: *ds:bx - DomainInfo to free
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 6/ 8/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketFreeDomain proc far
uses ax,bx,cx,si,di,es
.enter
;
; get pointer to list of domains
;
mov si, offset SocketDomainArray
mov di, ds:[si] ; ds:di = domain array
mov cx, ds:[di].CAH_count
add di, ds:[di].CAH_offset
;
; search for the target domain
;
segmov es,ds,ax
mov ax,bx
EC < shl cx ; assume # domains < 2^15 >
EC < Assert okForRepScasb >
EC < shr cx >
repne scasw
EC < ERROR_NE DOMAIN_NOT_IN_DOMAIN_ARRAY >
;
; delete the chunk array entry
;
dec di
dec di ; ds:di = matching elt
call ChunkArrayDelete
;
; free the semaphores
;
mov si,ax
mov di,ds:[si]
mov bx, ds:[di].DI_openMutex
call ThreadFreeSem
mov bx, ds:[di].DI_closeMutex
call ThreadFreeSem
;
; free the chunk
;
call LMemFree
.leave
ret
SocketFreeDomain endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketFindLinkByHandle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Translate a link handle to its offset in the domain
CALLED BY: (EXTERNAL) ConnectionCancel, ConnectionClose, ConnectionRefuse,
ECCheckConnectionEndpoint, FreeListenQueueCallback,
ListenQueueAppend, ListenQueueDelete,
ReceiveSequencedDataPacket, ReceiveUrgentDataPacket,
SocketAccept, SocketClearConnection,
SocketConnectionClosed, SocketDataGetInfo, SocketGetLink,
SocketPostDataAccept, SocketRemoveConnection,
SocketRemoveLink, SocketSendClose, SocketConnectConfirm
PASS: *ds:cx - DomainInfo
dx - link handle
RETURN: carry - set if not found
dx - offset of link in domain
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
ignores links which are not OCS_OPEN
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 6/ 7/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketFindLinkByHandle proc far
.assert (offset LI_handle) eq (offset CI_handle)
uses ax,bx,cx,si,di,bp
.enter
EC < call ECCheckDomainLow >
;
; search through the addresses in the link info array
;
mov si, cx ; *ds:si = DomainInfo
mov bx, ds:[si] ; ds:bx = DomainInfo
clr ax ; elmeent 0
linkLoop:
call ChunkArrayElementToPtr ; ds:di = LinkInfo, cx=size
;
; validate link info (link drivers only)
;
EC < jc skipValidate >
EC < cmp ds:[bx].DI_driverType, SDT_DATA >
EC < je skipValidate ; carry clear if z set >
EC < cmp ds:[di].LI_state, OCS_OPEN >
EC < jne handleOK >
EC < tst ds:[di].LI_handle >
EC < WARNING_Z WARNING_NULL_CONNECTION_HANDLE >
handleOK::
EC < sub cx, size LinkInfo >
EC < cmp cx, ds:[di].LI_addrSize >
EC < ERROR_NE CORRUPT_DOMAIN >
EC < clc >
skipValidate::
jc done
inc ax ; next element
cmp dx, ds:[di].LI_handle
jne linkLoop
cmp ds:[bx].DI_driverType, SDT_DATA
je success
cmp ds:[di].LI_state, OCS_OPEN
jne linkLoop
;
; compute offset
;
success:
mov dx, di ; ds:dx = LinkInfo
sub dx, ds:[si] ; dx <- offset from base
clc
done:
.leave
ret
SocketFindLinkByHandle endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketFindLinkById
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Translate a link id to its offset in the domain
CALLED BY: (EXTERNAL) SocketCloseLink, SocketCreateLink
PASS: *ds:si - DomainInfo
bx - link handle
RETURN: bx - offset of link in domain
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 6/ 7/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketFindLinkById proc far
uses ax,cx,dx,si,di,bp
.enter
;
; search through the addresses in the link info array
;
clr ax ; elmeent 0
linkLoop:
call ChunkArrayElementToPtr ; ds:di = LinkInfo, cx=size
;
; validate link info
;
EC < jc skipValidate >
EC < cmp ds:[di].LI_state, OCS_OPEN >
EC < jne handleOK >
EC < tst ds:[di].LI_handle >
EC < WARNING_Z WARNING_NULL_CONNECTION_HANDLE >
handleOK::
EC < sub cx, size LinkInfo >
EC < cmp cx, ds:[di].LI_addrSize >
EC < ERROR_NE CORRUPT_DOMAIN >
EC < clc >
skipValidate::
;
; check the id
;
jc done
inc ax ; next element
cmp bx, ds:[di].LI_id
jne linkLoop
;
; compute offset
;
mov bx, di ; ds:dx = LinkInfo
mov di, ds:[si] ; ds:di = DomainInfo
sub bx,di
clc
done:
.leave
ret
SocketFindLinkById endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketFindLinkBySocket
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Find the ConnectionInfo corresponding to a socket
CALLED BY: SocketDataConnect
PASS: *ds:si - DomainInfo
bx - socket handle
RETURN: ds:di - ConnectionInfo
carry set if not found
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 12/ 7/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketFindLinkBySocket proc far
uses ax,bx,cx,dx,si,bp
.enter
;
; validate parameters
;
EC < mov cx, si >
EC < call ECCheckDomainLow >
EC < mov di, ds:[si] >
EC < cmp ds:[di].DI_driverType, SDT_DATA >
EC < ERROR_NE CORRUPT_DOMAIN >
;
; search through the addresses in the link info array
;
clr ax ; elmeent 0
linkLoop:
call ChunkArrayElementToPtr ; ds:di=ConnectionInfo, cx=size
;
; check for a matching socket pointer
;
jc done
EC < cmp cx, size ConnectionInfo >
EC < ERROR_NE CORRUPT_DOMAIN >
inc ax ; next element
cmp bx, ds:[di].CI_socket
jne linkLoop
clc
done:
.leave
ret
SocketFindLinkBySocket endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketResetDomain
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Reset a domain to the standby state
CALLED BY: (INTERNAL) SocketRemoveDomainLow
PASS: ds:di - DomainInfo
*ds:si - DomainInfo
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
sets the following values:
DI_driverType 0
DI_driver 0
DI_client 0
DI_entry 0
DI_state OCS_STANDBY
DI_seqHeaderSize 0
DI_dgramHeaderSize 0
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 11/20/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketResetDomain proc far
uses ax,cx
.enter
EC < mov cx,si >
EC < call ECCheckDomainLow >
;
; clear data fields
;
mov ds:[di].DI_state, OCS_STANDBY
clr ax
czr ax, \
ds:[di].DI_driver, \
ds:[di].DI_client, \
ds:[di].DI_entry.segment, \
ds:[di].DI_entry.offset
czr al, \
ds:[di].DI_driverType, \
ds:[di].DI_seqHeaderSize, \
ds:[di].DI_dgramHeaderSize
.leave
ret
SocketResetDomain endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketStopDomainTimer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Stop the timer in a domain
CALLED BY: (EXTERNAL) SocketAddLink, SocketConnectRequest,
SocketGrabMiscLock
PASS: *ds:si - DomainInfo
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 1/ 5/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketStopDomainTimer proc far
uses ax,bx,di
.enter
mov di, ds:[si]
tst ds:[di].DI_timer
jz done
clrdw axbx
xchg ax, ds:[di].DI_timerID
xchg bx, ds:[di].DI_timer
call TimerStop
done:
.leave
ret
SocketStopDomainTimer endp
UtilCode ends
StrategyCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketAddDomain
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Add a new domain
CALLED BY: (INTERNAL) SocketAddDomainRaw
PASS: ax - client handle
ch - minimum header size for outgoing sequenced packets
cl - minimum header size for outgoing datagram packets
dl - SocketDriverType
ds:si - domain name (null terminated)
es:bx - driver entry point (fptr)
bp - driver handle
RETURN: bx - domain handle
carry - set if domain already registered or
unable to allocate chunk
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 5/24/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketAddDomain proc near
uses ax,cx,dx,si,di,bp,ds,es
client local word push ax
entry local fptr push es,bx
hdrSizes local word push cx
dtype local word push dx
.enter
;
; get all the appropriate locks
;
push bp
movdw dxbp, dssi
mov bx, handle dgroup
call MemDerefES
PSem es, driverSem
call SocketControlStartWrite
;
; see if the domain is already registered
; if so, return the existing domain handle
;
push es
movdw esdi, dxbp ; es:di = domain name
call LocalStringSize ; cx = size of name
pop es
call SocketFindDomainLow ; bx = domain handle
jc alloc
;
; the domain exists in some form
; if it's only in standby mode, we need to initialize it
;
; If it's OPENING or CLOSING, we have an overlap between
; a driver request and a library request. This is acceptable,
; just return the existing handle.
;
pop bp
mov si, ds:[bx]
cmp ds:[si].SI_state, OCS_STANDBY
je init
clc
jmp done
;
; we need to allocate a new domain record
;
alloc:
call SocketCreateDomain ; bx = domain handle
pop bp
jc done
mov si, ds:[bx]
;
; initialize the domain
;
init:
mov cx, ss:[hdrSizes]
mov ds:[si].DI_state, OCS_OPEN
segmov ds:[si].DI_driver, ss:[bp], ax
segmov ds:[si].DI_driverType, ss:[dtype].low, al
mov ds:[si].DI_flags, mask DF_SELF_LOAD
segmov ds:[si].DI_client, ss:[client], ax
mov ds:[si].DI_seqHeaderSize, ch
mov ds:[si].DI_dgramHeaderSize, cl
movdw ds:[si].DI_entry, ss:[entry], ax
clc
;
; unlock and exit
;
done:
call SocketControlEndWrite
VSem es, driverSem
.leave
ret
SocketAddDomain endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketRemoveLink
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Remove a link which was closed by the driver
CALLED BY: (INTERNAL) SocketLinkClosed
PASS: *ds:bx - domain
ax - link handle
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 10/11/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketRemoveLink proc near
uses ax,bx,cx,dx,si,di,bp
.enter
;
; find the link
;
mov cx,bx
mov_tr dx,ax
call SocketFindLinkByHandle
EC < WARNING_C REDUNDENT_CLOSE >
jc done
;
; delete it from the domain
;
mov si,bx
mov di,ds:[si]
add di,dx
;
; if anybody is using it, mark them as dead
;
tst ds:[di].LI_refCount
jz noSockets
call FindFailedSockets
noSockets:
call ChunkArrayDelete
call SocketRemoveDomain
done:
.leave
ret
SocketRemoveLink endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FindFailedSockets
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Find all sockets using a link, and mark them failed
CALLED BY: (INTERNAL) SocketRemoveLink
PASS: ds:di - LinkInfo
*ds:bx - DomainInfo
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 12/16/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FindFailedSockets proc near
uses ax,bx,si,di
.enter
mov ax,bx
mov dx, ds:[di].LI_handle
mov si, offset SocketPortArray
mov bx, cs
mov di, offset FailedPortCallback
call ChunkArrayEnum
.leave
ret
FindFailedSockets endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FailedPortCallback
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Find any failed sockets in this port
CALLED BY: (EXTERNAL) FindFailedSockets via ChunkArrayEnum
PASS: dx - link handle
ax - domain handle
ds:di - PortArrayEntry
RETURN: nothing
DESTROYED: bx,si,di
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 12/16/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FailedPortCallback proc far
uses ax,bx,cx,dx,si,di,bp
.enter
mov si, ds:[di].PAE_info
EC < call ECCheckPortLow >
mov bx,cs
mov di, offset FailedSocketCallback
call ChunkArrayEnum
clc
.leave
ret
FailedPortCallback endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FailedSocketCallback
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: See if this socket is using a failed link
CALLED BY: (EXTERNAL) FailedPortCallback (via ChunkArrayEnum)
PASS: dx - link handle
ax - domain handle
ds:di - pointer to socket handle
RETURN: nothing
DESTROYED: si,di
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 12/16/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FailedSocketCallback proc far
.enter
mov si, ds:[di] ; *ds:si <- SocketInfo
EC < call ECCheckSocketLow >
mov si, ds:[si] ; ds:si <- SocketInfo
cmp ds:[si].SI_state, ISS_CONNECTED
jne done
cmp ds:[si].SSI_connection.CE_domain, ax
jne done
cmp ds:[si].SSI_connection.CE_link, dx
jne done
;
; this socket has failed and is no longer connected
;
or ds:[si].SI_flags, mask SF_FAILED
and ds:[si].SI_flags, not ( mask SF_SEND_ENABLE or \
mask SF_RECV_ENABLE )
clr ds:[si].SSI_connection.CE_link
done:
clc
.leave
ret
FailedSocketCallback endp
StrategyCode ends
ApiCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketAddressToLink
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Given a SocketAddres, find or create a domain and link
CALLED BY: (INTERNAL) SocketConnect
PASS: ds - control segment
es:di - SocketAddress
ss:ax - timeout
RETURN: cx - domain handle
dx - offset of LinkInfo in domain chunk
carry - set on error
ax - SocketError
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 5/18/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketAddressToLink proc near
uses bx,si,di,bp,es
.enter
;
; extract domain name from SocketAddress
;
movdw dxbp, es:[di].SA_domain ; dx:bp = domain name
;
; search for existing domain
;
call SocketFindDomain ; bx = domain
jc domainNotFound
;
; check domain type
;
domainOK:
mov si, ds:[bx]
cmp ds:[si].DI_driverType, SDT_LINK
je findLink
;
; this is a data driver
; don't try to open a connection here, but do create a ConnectionInfo
;
mov si, bx
mov ax, size ConnectionInfo
call ChunkArrayAppend
mov ax, SE_OUT_OF_MEMORY
jc done
call SocketStopDomainTimer
mov dx, di
sub dx, ds:[si]
clc
jmp done
;
; Extract address string from SocketAddress
;
findLink:
mov cx, es:[di].SA_addressSize ; cx = size of addr
add di, offset SA_address ; es:di = address
;
; look for existing link
;
movdw dxbp, esdi ; dx:bp = address
call SocketFindLink ; dx = offset of addr
jc linkNotFound
mov ax, SE_NO_ERROR
jmp done
linkNotFound::
;
; create a new link
;
sub di, offset SA_address ; es:di =SocketAddress
call SocketCreateLink
jmp done
domainNotFound:
;
; load the driver
;
call SocketLoadDriver ; bx = domain
jnc domainOK
done:
mov cx,bx ; cx = domain handle
.leave
ret
SocketAddressToLink endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketLockForCreateLink
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Lock domain and verify that link really doesn't exist
CALLED BY: (INTERNAL) SocketCreateLink
PASS: *ds:bx - DomainInfo
es:di - SocketAddress
ss:ax - timeout
RETURN: ds - control block (possibly moved)
carry clear if link should not be opened
dx = 0 if timed out
dx = link offset if link already open
carry set if link should be opened
dx destroyed
DESTROYED: see above
SIDE EFFECTS:
may block
returns with DI_openMutex locked if carry set
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 8/25/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketLockForCreateLink proc near
uses ax,bx,cx,si,di,bp,es
.enter
;
; grab both open and close mutexes (mutexen?)
; this guarantees no links are opening or closing
;
push bx,di,es
mov si, ds:[bx] ; ds:si = DomainInfo
mov bx, ds:[si].DI_openMutex ; bx = open sem
mov dx, ds:[si].DI_closeMutex ; dx = close sem
mov cx, ax ; cx = timeout
call SocketControlEndWrite
call SocketPTimedSem ; lock open sem
jc timeout
xchg bx,dx
call SocketPTimedSem ; lock close sem
jc unlockTimeout
pastLocks::
call SocketControlStartWrite
pop bx,di,es
;
; see if link opened while we were waiting
;
findAddress::
mov cx, es:[di].SA_addressSize ; cx = size of addr
movdw dxbp, esdi ; dx:bp = SocketAddress
add bp, offset SA_address ; es:di = address
call SocketFindLink ; dx = link offset
jc unlockClose
;
; unlock open mutex
;
mov si, ds:[bx]
mov bx, ds:[si].DI_openMutex
call ThreadVSem
;
; unlock close mutex (flags preserved)
;
unlockClose:
mov bx, ds:[si].DI_closeMutex
call ThreadVSem
done:
.leave
ret
;
; timed out reading
;
unlockTimeout:
mov bx,dx
call ThreadVSem
timeout:
call SocketControlStartWrite
clr dx ; also clears carry
pop bx,di,es
jmp done
SocketLockForCreateLink endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketCreateLink
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Open an remember a link
CALLED BY: (INTERNAL) SocketAddressToLink
PASS: *ds:bx - DomainInfo
es:di - SocketAddress
ss:ax - timeout
RETURN: carry - set on error
ax - SocketError
dx - offset of LinkInfo
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
lock open mutex
lock close mutex
verify link didn't open while we were waiting
release close mutex
open the link
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 5/24/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketCreateLink proc near
uses bx,cx,si,di,bp,es
timeout local word push ax
info local word push bx
addr local fptr push es,di
id local word
.enter
;
; lock domain and reverify that link doesn't exist
;
call SocketLockForCreateLink
jc storeEntry ; continue creation
tst_clc dx
jnz linkExists
mov ax, SE_TIMED_OUT
stc
linkExists:
jmp done
;
; remember driver entry point
;
storeEntry:
mov bx, ss:[info] ; *ds:bx = DomainInfo
;
; add a new link info entry to the domain
;
push bp
clr ax
mov cx, es:[di].SA_addressSize ; cx = size of addr
movdw dxbp, esdi
add bp, offset SA_address
call SocketAddLink ; ds:si = link
pop bp
;
; remember link
;
mov ds:[si].LI_state, OCS_OPENING
mov ss:[id], ax
;
; setup timeout info
;
mov cx, ss:[timeout]
call SocketGetTimeout
jnc callDriver
;
; we timed out
;
timedOut:
mov si, ss:[info]
call DestroyOpeningLink
mov si, ds:[si]
mov ax, SE_TIMED_OUT
stc
jmp unlockDomain
;
; open the actual link
;
callDriver:
mov bx, ds:[bx] ; ds:bx = DomainInfo
pushdw ds:[bx].DI_entry
mov bx, ds:[bx].DI_client ; client handle
call SocketControlEndWrite
movdw dssi, ss:[addr]
mov ax, ds:[si].SA_addressSize
add si, offset SA_address ; ds:si <- link address
mov di, DR_SOCKET_LINK_CONNECT_REQUEST
call PROCCALLFIXEDORMOVABLE_PASCAL ; ax = link handle,
; carry on error
WARNING_C LINK_CONNECT_REQUEST_FAILED
;
; restore control segment pointers
;
call SocketControlStartWrite
jc timedOut
mov si, ss:[info]
mov bx, ss:[id]
call SocketFindLinkById
;
; record link handle
;
mov si, ds:[si]
mov ds:[si][bx].LI_handle, ax
mov ds:[si][bx].LI_state, OCS_OPEN
mov dx,bx
mov ax, SE_NORMAL
;
; release lock on domain
;
unlockDomain:
mov bx, ds:[si].DI_openMutex
push ax
call ThreadVSem
pop ax
done:
.leave
ret
SocketCreateLink endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DestroyOpeningLink
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Nuke the link which is being opened.
CALLED BY: (INTERNAL) SocketCreateLink
PASS: *ds:si - DomainInfo
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS: may initiate domain shutdown
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 2/ 7/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DestroyOpeningLink proc near
uses ax,cx,di
.enter
;
; start at the end of the array
;
call ChunkArrayGetCount ; cx = # of elements
mov ax,cx
;
; get previous entry and check it's state
;
top:
dec ax
ERROR_S CORRUPT_DOMAIN
call ChunkArrayElementToPtr ; ds:di = LinkInfo
cmp ds:[di].LI_state, OCS_OPENING
jne top
;
; remove this link
;
call ChunkArrayDelete
;
; possibly schedule the domain to be unloaded
;
call SocketRemoveDomain
done::
.leave
ret
DestroyOpeningLink endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketLoadDriver
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Load the driver for a domain
CALLED BY: (EXTERNAL) SocketAddressToDomain, SocketAddressToLink,
SocketGetAddressController, SocketGetAddressMedium,
SocketGetAddressSize, SocketGetDomainMedia,
SocketOpenDomainMedium, SocketResolve
PASS: ds - control segment
dx:bp - domain name
RETURN: carry - set on error
ax - SocketError if carry set, preserved otherwise
bx - domain handle
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 6/ 8/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketLoadDriver proc far
uses cx,dx,si,di,bp,es
passedAX local word push ax
domainSegment local word push dx
driverHandle local hptr
domainHandle local lptr
driverEntry local fptr
driverType local byte
driverName local hptr
.enter
;
; grab the driver semaphore
;
call SocketControlEndWrite
mov bx, handle dgroup
call MemDerefES
PSem es, driverSem
call SocketControlStartWrite
;
; make sure the domain wasn't added while we are waiting
;
push bp
mov bp, ss:[bp]
call SocketFindDomainLow ; bx = domain
pop bp
jc alloc
;
; if the domain exists in STANDBY mode, go ahead and open
; it for real
;
mov di, ds:[bx]
cmp ds:[di].DI_state, OCS_STANDBY
je gotHandle
clc
jmp done
;
; handle errors allocating the domain chunk
;
allocError:
mov ax, SE_OUT_OF_MEMORY
jmp done
;
; allocate a domain
;
alloc:
push bp
mov bp, ss:[bp]
call SocketCreateDomain ; bx = domain
pop bp
jc allocError
;
; record domain handle
;
gotHandle:
mov di, ds:[bx]
mov ds:[di].DI_state, OCS_OPENING
mov ss:[domainHandle], bx
call SocketControlEndWrite
;
; look up the driver name
;
push bp
mov ds, ss:[domainSegment]
mov si, ss:[bp] ; ds:si = domain name
ConvDomainNameToIniCat
mov cx, es
mov dx, offset es:[driverKey] ; cx:dx = key
clr bp ; no flags, alloc block
call InitFileReadString ; ^hbx=name, cx=size
pop bp
mov ss:[driverName], bx
jnc getType
ConvDomainNameDone
mov ax, SE_UNKNOWN_DOMAIN
jmp error
;
; look up the driver type
;
getType:
mov cx,es
mov dx, offset es:[typeKey]
call InitFileReadInteger ; ax = value
jnc checkType
mov al, SDT_LINK ; default value
checkType:
Assert etype, al, SocketDriverType
mov ss:[driverType], al
ConvDomainNameDone
;
; move to the driver directory
;
setPath::
call FilePushDir
mov bx, SP_SYSTEM ; bx = disk
segmov ds,es,ax
mov dx, offset es:[driverPath] ; ds:dx = path
call FileSetCurrentPath
jc cleanup
;
; load the driver
;
useDriver::
mov bx, ss:[driverName]
call MemLock
mov ds,ax
clr si ; ds:si = filename
mov ax, SOCKET_PROTO_MAJOR
mov bx, SOCKET_PROTO_MINOR
call GeodeUseDriver ; bx = driver handle
EC < WARNING_C GEODE_USE_DRIVER_FAILED >
mov ss:[driverHandle], bx
;
; whether we succeed or fail, clean up
;
cleanup:
pushf
call FilePopDir
mov bx, ss:[driverName]
call MemFree
popf
;
; now check the result of GeodeUseDriver
;
mov ax, SE_CANT_LOAD_DRIVER
jc error
;
; find the strategy
;
mov bx, ss:[driverHandle]
call GeodeInfoDriver ; ds:si = DriverInfoStruct
movdw ss:[driverEntry], ds:[si].DIS_strategy, ax
;
; call registration
;
registerDriver::
push bp
pushdw ss:[driverEntry]
mov bx, ss:[domainHandle] ; domain handle
mov ds, ss:[domainSegment]
mov si, ss:[bp] ; ds:si = domain name
mov cl, ss:[driverType] ; SocketDriverType
mov dx, vseg SocketDataStrategy
mov bp, offset SocketDataStrategy ; dx:bp = callback
cmp cl, SDT_DATA
je gotStrategy
mov dx, vseg SocketLinkStrategy
mov bp, offset SocketLinkStrategy
gotStrategy:
mov di, DR_SOCKET_REGISTER
call PROCCALLFIXEDORMOVABLE_PASCAL
pop bp
jc regFailed
;
; lock library into memory.
;
; Please note that this cannot be called while having access to
; SocketControl because other libraries may be unloaded at the same
; time and they can need exclusive access to SocketControl.
;
mov dx, bx ; ^hdx = saved client
mov bx, handle 0
call GeodeAddReference
mov bx, dx ; restore client handle
;
; driver returns
; ax = SocketDrError (SDE_ALREADY_REGISTERED)
; bx = client handle
; ch = min header size for outgoing sequenced packets
; cl = min header size for outgoing datagram packets
;
; if requested header sizes are smaller then those required by
; library, use library requirement instead
;
cmp ch, size SequencedPacketHeader
jge seqOK
mov ch, size SequencedPacketHeader
seqOK:
cmp cl, size DatagramPacketHeader
jge dgramOK
mov cl, size DatagramPacketHeader
dgramOK:
;
; store sizes in domain info
;
storeInfo::
call SocketControlStartWrite
mov si, ss:[domainHandle]
mov di, ds:[si] ; ds:si = DomainInfo
mov ds:[di].DI_client, bx
mov ds:[di].DI_seqHeaderSize, ch
mov ds:[di].DI_dgramHeaderSize, cl
movdw ds:[di].DI_entry, ss:[driverEntry], ax
segmov ds:[di].DI_driver, ss:[driverHandle], ax
segmov ds:[di].DI_driverType, ss:[driverType], al
mov ds:[di].DI_state, OCS_OPEN
;
; set up return values
;
success::
mov bx, si
mov ax, ss:[passedAX]
clc
done:
push bx
mov bx, handle dgroup
call MemDerefES
pop bx
VSem es, driverSem
.leave
ret
;
; unload driver
;
regFailed:
mov bx, ss:[driverHandle]
call GeodeFreeDriver
mov bl, al
mov ax, SE_CANT_LOAD_DRIVER
cmp bl, SDE_MEDIUM_BUSY
jne error
mov ax, SE_MEDIUM_BUSY
error:
;
; destroy the incomplete driver record
;
call SocketControlStartWrite
mov bx, ss:[domainHandle]
call SocketFreeDomain
stc
jmp done
SocketLoadDriver endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketGrabMiscLock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Increment the misc counter in a domain
CALLED BY: (INTERNAL) SocketAddressToDomain,
SocketCheckMediumConnection, SocketCloseDomainMedium,
SocketDataConnect, SocketGetAddressController,
SocketGetAddressMedium, SocketGetAddressSize,
SocketGetDomainMedia, SocketLinkGetMediumForLink,
SocketOpenDomainMedium, SocketPassOption,
SocketQueryAddress, SocketResolve, SocketSendClose
PASS: *ds:si - DomainInfo (may be locked shared)
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 10/12/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketGrabMiscLock proc far
uses di
.enter
;
; increment the ref count
;
mov di, ds:[si]
EC < cmp ds:[di].DI_state, OCS_OPEN >
EC < ERROR_NE UNEXPECTED_DOMAIN_STATE >
inc ds:[di].DI_miscCount
;
; if a shutdown timer is running, kill it
;
call SocketStopDomainTimer
.leave
ret
SocketGrabMiscLock endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketReleaseMiscLock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Release a misc lock and possibly close domain
CALLED BY: (EXTERNAL) SocketCheckMediumConnection, SocketClose,
SocketCloseDomainMedium, SocketConnectDatagram,
SocketDataConnect, SocketGetAddressController,
SocketGetAddressMedium, SocketGetAddressSize,
SocketGetDomainMedia, SocketLinkGetMediumForLink,
SocketOpenDomainMedium, SocketPassOption,
SocketQueryAddress, SocketResolve, SocketSend,
SocketSendClose
PASS: *ds:si - DomainInfo (must be locked exclusive)
RETURN: nothing
DESTROYED: nothing (flags preserved)
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 10/12/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketReleaseMiscLock proc far
uses ax,bx,cx,dx,si,di,bp
pushf
.enter
;
; decrement the misc count
;
mov di, ds:[si]
dec ds:[di].DI_miscCount
jnz done
;
; we are the last misc - check to see if we should close
;
tst ds:[di].CAH_count ; any links?
jnz done
call SocketRemoveDomain
done:
.leave
popf
ret
SocketReleaseMiscLock endp
ApiCode ends
ExtraApiCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketAddressToDomain
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Given a SocketAddress, find or create its domain
CALLED BY: (EXTERNAL) SocketConnectDatagram, SocketSend
PASS: es:di - SocketAddress
ds - control segment (locked for write)
RETURN: dx - domain
ax - SocketError
carry set on error
DESTROYED: nothing
SIDE EFFECTS: increments DI_miscCount
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 6/ 7/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketAddressToDomain proc far
uses bx,cx,si,di,bp
.enter
;
; find the domain
;
movdw dxbp, es:[di].SA_domain
call SocketFindDomain ; bx = domain
jnc gotDomain
call SocketLoadDriver
jc done
gotDomain:
;
; set a misc lock on domain
;
mov si,bx
call SocketGrabMiscLock
clc
done:
mov dx,bx
.leave
ret
SocketAddressToDomain endp
ExtraApiCode ends
InfoApiCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketGetDomainsLow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get a chunk array of domain names
CALLED BY: (INTERNAL) SocketGetDomains
PASS: *ds:si - variable ChunkArray
RETURN: carry - set if ChunkArrayAppend failed
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 10/ 3/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketGetDomainsLow proc near
uses ax,bx,cx,dx,si,di,bp,es
.enter
;
; enumerate all the domains in the ini file
;
segmov es, ds, ax ; *es:si = array
mov bx, handle dgroup
call MemDerefDS ; ds = dgroup
mov bx, si ; *es:bx = array
mov cx,ds
mov dx, offset ds:[domainsKey] ; cx:dx = category
mov si, offset ds:[socketCategory] ; ds:si = key
mov bp, InitFileReadFlags
mov di,cs
mov ax, offset SocketGetDomainsCallback
call InitFileEnumStringSection
segmov ds,es
done::
.leave
ret
SocketGetDomainsLow endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketGetDomainsCallback
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: callback from SocketGetDomains
CALLED BY: (EXTERNAL) SocketGetDomainsLow via InitFileEnumStringSection
PASS: ds:si = string
cx = length of string
es,bx = data
RETURN: carry = set to abort enumeration
DESTROYED: ax,cx,dx,di,si
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 10/ 3/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketGetDomainsCallback proc far
uses bx,ds
data local fptr push ds,si
.enter
;
; add new chunk array entry
;
movdw dssi, esbx
mov ax, cx
call ChunkArrayAppend ; ds:di = elt
jc done
;
; copy string
;
segmov es,ds ; es:di = destination
movdw dssi, ss:[data] ; ds:si = source
LocalCopyNString
clc
done:
.leave
ret
SocketGetDomainsCallback endp
InfoApiCode ends
ApiCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketLinkGetMediumForLink
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Query the driver to find the medium used for a particular
link.
CALLED BY: (EXTERNAL) SocketCheckListen
PASS: *ds:bx = DomainInfo (read access to control segment)
dx = link handle
RETURN: dxax = MediumType
DESTROYED: si, di
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 1/27/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketLinkGetMediumForLink proc near
uses cx
entry local fptr.far
.enter
;
; Grab the misc lock of the domain so the domain continues to exist
; throughout this procedure.
;
mov si, bx
call SocketGrabMiscLock
;
; Fetch the driver entry into our local variable for the calls and
; unlock the control segment, as suggested by Eric.
;
mov si, ds:[bx] ; ds:si <- DomainInfo
movdw ss:[entry], ds:[si].DI_entry, ax
call SocketControlEndRead
push bx ; save domain for
; unlock
;
; First we find the size of an address for the link.
;
mov ax, SGIT_ADDR_SIZE
mov di, DR_SOCKET_GET_INFO
call ss:[entry] ; ax <- addr size
;
; Make room for an address on the stack.
;
inc ax ; word-align the
andnf ax, not 1 ; size, please, so
; as not to dork the
; stack
sub sp, ax
;
; Ask the driver for the local address of the link, on the assumption
; we can use it to find the medium.
;
segmov ds, ss
mov bx, sp ; ds:bx <- buffer
push ax ; save adjustment for
; clearing...
xchg dx, ax ; dx <- buf size
; ax <- conn handle
; (1-byte inst)
mov_tr cx, ax ; cx <- conn handle
mov ax, SGIT_LOCAL_ADDR
mov di, DR_SOCKET_GET_INFO
call ss:[entry] ; ax <- addr size
;
; Pass that address off to the driver to get the medium & unit.
;
mov_tr dx, ax ; dx <- actual size
mov si, bx ; ds:si <- address
mov ax, SGIT_MEDIUM_AND_UNIT
mov di, DR_SOCKET_GET_INFO
push bp
call ss:[entry] ; cxdx <- medium
; bl, bp <- unit info
; (ignored)
pop bp
;
; Clear the address off the stack, please.
;
pop ax ; ax <- buffer size
add sp, ax
;
; Return the medium in dxax on success.
;
mov_tr ax, cx ; ax <- medium.high
xchg ax, dx ; ax <- medium.low,
; dx <- medium.high
;
; Release the misc lock on the domain.
;
call SocketControlStartWrite ; ds <- control seg
pop si ; *ds:si <- domain
call SocketReleaseMiscLock
call SocketControlWriteToRead
.leave
ret
SocketLinkGetMediumForLink endp
ApiCode ends
| 23.841988 | 79 | 0.582215 |
e0ea721a287da4d621468449e705e1ae54a6afcb | 676 | asm | Assembly | src/libYARP_dev/56f807/cotroller_dc/Support/dispatch_x0.asm | robotology-legacy/yarp1 | 21434f5b776edea201b39a9644552dca59339dbc | [
"Artistic-1.0-Perl"
] | null | null | null | src/libYARP_dev/56f807/cotroller_dc/Support/dispatch_x0.asm | robotology-legacy/yarp1 | 21434f5b776edea201b39a9644552dca59339dbc | [
"Artistic-1.0-Perl"
] | null | null | null | src/libYARP_dev/56f807/cotroller_dc/Support/dispatch_x0.asm | robotology-legacy/yarp1 | 21434f5b776edea201b39a9644552dca59339dbc | [
"Artistic-1.0-Perl"
] | null | null | null | ;=============================================================
;=== FILE: dispatch_x0.asm
;===
;=== Copyright (c)1998 Metrowerks, Inc. All rights reserved.
;=============================================================
; Recommended tab stop = 8.
;===============================================================================
; SECTION: the floating point code
SECTION fp_engine
OPT CC
GLOBAL ARTdispatch_x0
; used in floating point library jump tables
ARTdispatch_x0:
; TRICK: Avoid mysterious "add x0,x:(sp-1)", which
; seems to malfunction. It trashes x0 anyway (!)
; and fools the debugger when stepping.
add x:(sp-1),x0
move x0,x:(sp-1)
rts
ENDSEC | 26 | 80 | 0.483728 |
703eada1229fb235539981cdfa948988379882ba | 351 | asm | Assembly | libsrc/_DEVELOPMENT/stdio/c/sdcc_ix/ungetc_unlocked_callee.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/stdio/c/sdcc_ix/ungetc_unlocked_callee.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/stdio/c/sdcc_ix/ungetc_unlocked_callee.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
; int ungetc_unlocked_callee(int c, FILE *stream)
SECTION code_clib
SECTION code_stdio
PUBLIC _ungetc_unlocked_callee, l0_ungetc_unlocked_callee
EXTERN asm_ungetc_unlocked
_ungetc_unlocked_callee:
pop af
pop hl
pop bc
push af
l0_ungetc_unlocked_callee:
push bc
ex (sp),ix
call asm_ungetc_unlocked
pop ix
ret
| 13 | 57 | 0.749288 |
fd85e6b9a79f6404a7b73a85b48f35ae50c8025e | 386 | asm | Assembly | game/data/stages/plateau/plateau.asm | benoitryder/super-tilt-bro | 8d5035f54e906a401d0808c2e104d32fa1fadd7f | [
"WTFPL"
] | 91 | 2017-08-06T18:30:13.000Z | 2022-02-17T00:26:45.000Z | game/data/stages/plateau/plateau.asm | benoitryder/super-tilt-bro | 8d5035f54e906a401d0808c2e104d32fa1fadd7f | [
"WTFPL"
] | 2 | 2018-10-12T04:34:13.000Z | 2021-12-25T17:01:18.000Z | game/data/stages/plateau/plateau.asm | benoitryder/super-tilt-bro | 8d5035f54e906a401d0808c2e104d32fa1fadd7f | [
"WTFPL"
] | 9 | 2016-10-08T21:24:37.000Z | 2022-02-05T00:13:31.000Z | STAGE_PLATEAU_BANK_NUMBER = CURRENT_BANK_NUMBER
stage_plateau_data:
STAGE_HEADER($4000, $a000, $80ff, $80ff, $7000, $6000) ; player_a_x, player_b_x, player_a_y, player_b_y, respawn_x, respawn_y
stage_plateau_elements:
PLATFORM($28, $d0, $80, $ff) ; left, right, top, bot
END_OF_STAGE
#include "game/data/stages/plateau/screen.asm"
#include "game/data/stages/plateau/illustration.asm"
| 35.090909 | 125 | 0.779793 |
ca6073668fb66cf5873e6f7f8c76769d148052ae | 404 | asm | Assembly | presentation/examples/asm-so/ex3/main.asm | sayon/dynamic-libraries-course | 05c229123feb94a7b93ef64aa7c6bfded8e15752 | [
"MIT"
] | 4 | 2017-12-25T11:33:12.000Z | 2022-02-19T12:14:41.000Z | presentation/examples/asm-so/ex3/main.asm | sayon/dynamic-libraries-course | 05c229123feb94a7b93ef64aa7c6bfded8e15752 | [
"MIT"
] | null | null | null | presentation/examples/asm-so/ex3/main.asm | sayon/dynamic-libraries-course | 05c229123feb94a7b93ef64aa7c6bfded8e15752 | [
"MIT"
] | null | null | null | extern _GLOBAL_OFFSET_TABLE_
extern fun1
global commonmsg:data commonmsg.end - commonmsg
global mainfun:function
global _start
section .rodata
commonmsg: db "fun2", 10, 0
.end:
mainfunmsg: db "mainfun", 10, 0
section .text
_start:
call fun1 wrt ..plt
mov rax, 60
mov rdi, 0
syscall
mainfun:
mov rax, 1
mov rdi, 1
mov rsi, mainfunmsg
mov rdx, 8
syscall
ret
| 13.466667 | 47 | 0.675743 |
0f59367cc2a57881b62717be7b1854497f3ef800 | 2,210 | asm | Assembly | chap15/ex36/unroll_reduce.asm | JamesType/optimization-manual | 61cdcebb16e0768a6ab7e85ed535e64e9d8cc31a | [
"0BSD"
] | 374 | 2021-06-08T10:42:01.000Z | 2022-03-29T14:21:45.000Z | chap15/ex36/unroll_reduce.asm | JamesType/optimization-manual | 61cdcebb16e0768a6ab7e85ed535e64e9d8cc31a | [
"0BSD"
] | 1 | 2021-06-11T20:24:02.000Z | 2021-06-11T20:24:02.000Z | chap15/ex36/unroll_reduce.asm | JamesType/optimization-manual | 61cdcebb16e0768a6ab7e85ed535e64e9d8cc31a | [
"0BSD"
] | 39 | 2021-06-08T11:25:29.000Z | 2022-03-05T05:14:17.000Z | ;
; Copyright (C) 2021 by Intel Corporation
;
; Permission to use, copy, modify, and/or distribute this software for any
; purpose with or without fee is hereby granted.
;
; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
; REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
; AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
; INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
; LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
; OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
; PERFORMANCE OF THIS SOFTWARE.
;
; .globl unroll_reduce
; float unroll_reduce(float *a, uint32_t len)
; On entry:
; rcx = a
; edx = len
; xmm0 = retval
.code
unroll_reduce PROC public
push rbx
sub rsp, 32
vmovaps xmmword ptr[rsp], xmm6
vmovaps xmmword ptr[rsp+16], xmm7
mov eax, edx
mov rbx, rcx
vmovups ymm0, ymmword ptr [rbx]
vmovups ymm1, ymmword ptr 32[rbx]
vmovups ymm2, ymmword ptr 64[rbx]
vmovups ymm3, ymmword ptr 96[rbx]
vmovups ymm4, ymmword ptr 128[rbx]
vmovups ymm5, ymmword ptr 160[rbx]
vmovups ymm6, ymmword ptr 192[rbx]
vmovups ymm7, ymmword ptr 224[rbx]
sub eax, 64
loop_start:
add rbx, 256
vaddps ymm0, ymm0, ymmword ptr [rbx]
vaddps ymm1, ymm1, ymmword ptr 32[rbx]
vaddps ymm2, ymm2, ymmword ptr 64[rbx]
vaddps ymm3, ymm3, ymmword ptr 96[rbx]
vaddps ymm4, ymm4, ymmword ptr 128[rbx]
vaddps ymm5, ymm5, ymmword ptr 160[rbx]
vaddps ymm6, ymm6, ymmword ptr 192[rbx]
vaddps ymm7, ymm7, ymmword ptr 224[rbx]
sub eax, 64
jnz loop_start
vaddps ymm0, ymm0, ymm1
vaddps ymm2, ymm2, ymm3
vaddps ymm4, ymm4, ymm5
vaddps ymm6, ymm6, ymm7
vaddps ymm0, ymm0, ymm2
vaddps ymm4, ymm4, ymm6
vaddps ymm0, ymm0, ymm4
vextractf128 xmm1, ymm0, 1
vaddps xmm0, xmm0, xmm1
vpermilps xmm1, xmm0, 0eh
vaddps xmm0, xmm0, xmm1
vpermilps xmm1, xmm0, 1
vaddss xmm0, xmm0, xmm1
; The following instruction is not needed as xmm0 already
; holds the return value.
; movss result, xmm0
vzeroupper
vmovaps xmm7, xmmword ptr[rsp+16]
vmovaps xmm6, xmmword ptr[rsp]
add rsp, 32
pop rbx
ret
unroll_reduce ENDP
end | 26 | 79 | 0.734842 |
581511e561aea5b9218cee209a584d696f71f17b | 2,448 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xca.log_105_1078.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xca.log_105_1078.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xca.log_105_1078.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x8dbe, %rsi
lea addresses_WT_ht+0x16e0e, %rdi
clflush (%rsi)
nop
nop
nop
and $57848, %r9
mov $93, %rcx
rep movsl
nop
inc %r14
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r8
push %r9
push %rax
push %rbp
push %rdi
push %rsi
// Store
lea addresses_UC+0x8552, %rsi
nop
nop
nop
nop
dec %rbp
mov $0x5152535455565758, %rax
movq %rax, (%rsi)
and %rax, %rax
// Store
mov $0x546, %rdi
nop
nop
nop
nop
nop
cmp $5383, %r12
mov $0x5152535455565758, %rbp
movq %rbp, %xmm1
vmovups %ymm1, (%rdi)
nop
nop
xor %r12, %r12
// Store
lea addresses_A+0x9b2e, %r8
xor %r12, %r12
mov $0x5152535455565758, %rbp
movq %rbp, (%r8)
nop
nop
xor %rbp, %rbp
// Store
lea addresses_D+0x57be, %rbp
nop
nop
add %rsi, %rsi
movb $0x51, (%rbp)
nop
cmp $5327, %rbp
// Faulty Load
lea addresses_normal+0x13bbe, %rdi
nop
nop
xor %r9, %r9
movaps (%rdi), %xmm5
vpextrq $0, %xmm5, %r12
lea oracles, %rdi
and $0xff, %r12
shlq $12, %r12
mov (%rdi,%r12,1), %r12
pop %rsi
pop %rdi
pop %rbp
pop %rax
pop %r9
pop %r8
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_P', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_A', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 10}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_normal', 'same': True, 'AVXalign': True, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 9}, 'dst': {'same': True, 'type': 'addresses_WT_ht', 'congruent': 4}}
{'00': 105}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 21.286957 | 314 | 0.647059 |
2dd5950a092af93b81090ccc9725c68bd0dbc54c | 349 | asm | Assembly | programs/oeis/187/A187673.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/187/A187673.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/187/A187673.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A187673: Partial sums of the tricapped prism numbers A005920.
; 1,10,43,125,290,581,1050,1758,2775,4180,6061,8515,11648,15575,20420,26316,33405,41838,51775,63385,76846,92345,110078,130250,153075,178776,207585,239743,275500,315115,358856
add $0,1
mov $2,3
mov $3,1
lpb $0,1
sub $0,1
add $2,4
add $4,$3
add $1,$4
add $3,$2
add $2,5
lpe
| 23.266667 | 174 | 0.704871 |
cbe1243e9db0f31be5ac24edf0c0308d5ad04b68 | 699 | asm | Assembly | programs/oeis/242/A242090.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | null | null | null | programs/oeis/242/A242090.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | null | null | null | programs/oeis/242/A242090.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | null | null | null | ; A242090: Number of triples (a,b,c) with 0 < a < b < c < p and a + b + c == 0 mod p, where 2*b < p = prime(n).
; 0,0,0,1,5,8,16,21,33,56,65,96,120,133,161,208,261,280,341,385,408,481,533,616,736,800,833,901,936,1008,1281,1365,1496,1541,1776,1825,1976,2133,2241,2408,2581,2640,2945,3008,3136,3201,3605,4033,4181,4256,4408,4641,4720,5125,5376,5633,5896,5985,6256,6440,6533,7008,7701,7905,8008,8216,8965,9296,9861,9976,10208,10561,11041,11408,11781,12033,12416,12936,13200,13736,14421,14560,15265,15408,15841,16133,16576,17176,17480,17633,17941,18881,19521,19845,20501,20833,21336,22360,22533,24120
seq $0,6005 ; The odd prime numbers together with 1.
sub $0,3
pow $0,2
add $1,$0
div $1,12
mov $0,$1
| 69.9 | 484 | 0.725322 |
dc00849d7ed83a44a6b3aa73b2122ba71026b080 | 439 | asm | Assembly | src/firmware-tests/Door/Initialisation/InitialisationChainTest.asm | pete-restall/Cluck2Sesame-Prototype | 99119b6748847a7b6aeadc4bee42cbed726f7fdc | [
"MIT"
] | 1 | 2019-12-12T09:07:08.000Z | 2019-12-12T09:07:08.000Z | src/firmware-tests/Door/Initialisation/InitialisationChainTest.asm | pete-restall/Cluck2Sesame-Prototype | 99119b6748847a7b6aeadc4bee42cbed726f7fdc | [
"MIT"
] | null | null | null | src/firmware-tests/Door/Initialisation/InitialisationChainTest.asm | pete-restall/Cluck2Sesame-Prototype | 99119b6748847a7b6aeadc4bee42cbed726f7fdc | [
"MIT"
] | null | null | null | #include "Mcu.inc"
#include "FarCalls.inc"
#include "Door.inc"
#include "TestFixture.inc"
#include "../InitialiseAfterDoorMock.inc"
radix decimal
InitialisationChainTest code
global testArrange
testArrange:
fcall initialiseInitialiseAfterDoorMock
testAct:
fcall initialiseDoor
testAssert:
banksel calledInitialiseAfterDoor
.assert "calledInitialiseAfterDoor != 0, 'Next initialiser in chain was not called.'"
return
end
| 18.291667 | 86 | 0.790433 |
dfd692179ab962ad67d2eb977b181225f8382ef7 | 356 | asm | Assembly | programs/oeis/047/A047515.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/047/A047515.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/047/A047515.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A047515: Numbers that are congruent to {0, 3, 4, 6, 7} mod 8.
; 0,3,4,6,7,8,11,12,14,15,16,19,20,22,23,24,27,28,30,31,32,35,36,38,39,40,43,44,46,47,48,51,52,54,55,56,59,60,62,63,64,67,68,70,71,72,75,76,78,79,80,83,84,86,87,88
mov $2,$0
lpb $2,1
trn $1,$2
add $2,2
add $3,1
add $1,$3
add $1,$2
trn $2,4
trn $3,$2
sub $1,$3
trn $2,3
lpe
| 22.25 | 163 | 0.575843 |
a8fccdd65cef9efdeb592f7eb7602b660400ff27 | 2,560 | asm | Assembly | dino/lcs/base/60F8.asm | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | a4a0c86c200241494b3f1834cd0aef8dc02f7683 | [
"Apache-2.0"
] | 6 | 2020-10-14T15:29:10.000Z | 2022-02-12T18:58:54.000Z | dino/lcs/base/6078.asm | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | a4a0c86c200241494b3f1834cd0aef8dc02f7683 | [
"Apache-2.0"
] | null | null | null | dino/lcs/base/6078.asm | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | a4a0c86c200241494b3f1834cd0aef8dc02f7683 | [
"Apache-2.0"
] | 1 | 2020-12-17T08:59:10.000Z | 2020-12-17T08:59:10.000Z | copyright zengfr site:http://github.com/zengfr/romhack
00042A move.l D1, (A0)+
00042C dbra D0, $42a
0016CC move.l (A0)+, D1 [base+6076, base+60F6, base+6176, base+61F6, base+6276, base+62F6, base+6376, base+63F6, base+6476, base+64F6, base+6576]
0016CE andi.b #$7f, D1 [base+6078, base+607A, base+60F8, base+60FA, base+6178, base+617A, base+61F8, base+61FA, base+6278, base+627A, base+62F8, base+62FA, base+6378, base+637A, base+63F8, base+63FA, base+6478, base+647A, base+64F8, base+64FA, base+6578, base+657A]
07EA74 move.l (A0)+, (A1)+ [base+6076, base+60F6, base+6176, base+61F6, base+6276, base+62F6, base+6376, base+63F6, base+6476, base+64F6]
07EA76 move.w (A0)+, (A1)+ [base+6078, base+607A, base+60F8, base+60FA, base+6178, base+617A, base+61F8, base+61FA, base+6278, base+627A, base+62F8, base+62FA, base+6378, base+637A, base+63F8, base+63FA, base+6478, base+647A, base+64F8, base+64FA]
0AAACA move.l (A0), D2
0AAACC move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, base+6FFE, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAACE move.w D0, ($2,A0)
0AAAD2 cmp.l (A0), D0
0AAAD4 bne $aaafc
0AAAD8 move.l D2, (A0)+
0AAADA cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, base+6FFE, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAAE6 move.l (A0), D2
0AAAE8 move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, base+6FFE, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAAF4 move.l D2, (A0)+
0AAAF6 cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, base+6FFE, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
copyright zengfr site:http://github.com/zengfr/romhack
| 116.363636 | 351 | 0.682813 |
2b0c3adda3bb67fe3c7a93dfffae65e9e848f626 | 800 | asm | Assembly | introcore/agents/windows/agents/removal64.asm | hugmyndakassi/hvmi | fa49a34ba32b327c462224db1cf58d96a076a224 | [
"Apache-2.0"
] | 677 | 2020-07-30T13:59:36.000Z | 2022-03-24T11:02:00.000Z | introcore/agents/windows/agents/removal64.asm | hugmyndakassi/hvmi | fa49a34ba32b327c462224db1cf58d96a076a224 | [
"Apache-2.0"
] | 38 | 2020-08-11T13:59:36.000Z | 2022-02-17T15:03:48.000Z | introcore/agents/windows/agents/removal64.asm | fengjixuchui/hvmi | 72488e8432d26547876a052d24ea44c3e18279a7 | [
"Apache-2.0"
] | 55 | 2020-07-30T14:11:03.000Z | 2022-03-09T05:40:44.000Z | ;-----------------------------------------------------------------------------
; Global symbols
global _start
;-----------------------------------------------------------------------------
; Imports of any kind
extern MessageBoxA
extern ExitProcess
;-----------------------------------------------------------------------------
; Sections
section .data
message db "Hello world from the removal tool!",0
title db "Removal tool",0
section .text
_start:
sub rsp, 0x28
xor rcx, rcx
lea rdx, [message]
lea r8, [title]
xor r9, r9
call MessageBoxA
xor rcx, rcx
call ExitProcess | 27.586207 | 78 | 0.32 |
dd9453a3a46d0a9c1166a84497057837aa1442a7 | 1,890 | asm | Assembly | Driver/Task/TaskMax/taskmaxManager.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 504 | 2018-11-18T03:35:53.000Z | 2022-03-29T01:02:51.000Z | Driver/Task/TaskMax/taskmaxManager.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 96 | 2018-11-19T21:06:50.000Z | 2022-03-06T10:26:48.000Z | Driver/Task/TaskMax/taskmaxManager.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 73 | 2018-11-19T20:46:53.000Z | 2022-03-29T00:59:26.000Z | COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1991 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: taskmaxManager.asm
AUTHOR: Adam de Boor, Sep 19, 1991
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
Adam 9/19/91 Initial revision
DESCRIPTION:
da file what gets compiled.
$Id: taskmaxManager.asm,v 1.1 97/04/18 11:58:09 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
TASKMAX equ TRUE
include taskGeode.def
include taskmaxConstant.def
include taskmaxVariable.def
include taskmax.rdef
include taskStrings.asm ; switcher-independent strings
include taskmaxStrings.asm ; switcher-dependent strings
include taskInit.asm ; switcher-independent initialization
include taskmaxInitExit.asm
include taskSwitch.asm ; switcher-independent system suspend/resume
; code
include taskApplication.asm ; switcher-independent GenApp subclass
include taskmaxApplication.asm ; switcher-dependent methods for same
include taskDriver.asm ; switcher-independent device driver interface
include taskmaxDriver.asm ; switcher-dependent implementation of some
; driver functions
include taskTrigger.asm ; switcher-independent express menu control's
; dos-task list entry
include taskItem.asm ; switcher-independent dos-task list entry
include taskmaxItem.asm ; switcher-dependent methods for same
include taskUtils.asm ; general utility routines
include taskmaxUtils.asm
include taskmaxMain.asm ; switcher-dependent implementation of
; TaskDriverClass methods
include taskmaxSummons.asm ; special control box support specific to this
; switcher.
include taskClipboard.asm
include taskmaxClipboard.asm
| 26.619718 | 79 | 0.684127 |
7dfaffb63cdebfba68b55c4c46d24d721c1746b4 | 144 | asm | Assembly | libsrc/_DEVELOPMENT/adt/wv_stack/c/sdcc_iy/wv_stack_top.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/adt/wv_stack/c/sdcc_iy/wv_stack_top.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/adt/wv_stack/c/sdcc_iy/wv_stack_top.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null |
; void *wv_stack_top(wv_stack_t *s)
SECTION code_adt_wv_stack
PUBLIC _wv_stack_top
EXTERN _w_array_back
defc _wv_stack_top = _w_array_back
| 13.090909 | 35 | 0.826389 |
074c3929d4850f39d98023b98fdfff414d68b268 | 34,150 | asm | Assembly | tests/miaf/invalid-alpha-track-composition-times.asm | y-guyon/ComplianceWarden | 7315f1266b083a1cd958eae9ce7c8f07a8a6ad2d | [
"BSD-3-Clause"
] | 3 | 2020-01-02T17:30:16.000Z | 2021-09-27T18:32:18.000Z | tests/miaf/invalid-alpha-track-composition-times.asm | y-guyon/ComplianceWarden | 7315f1266b083a1cd958eae9ce7c8f07a8a6ad2d | [
"BSD-3-Clause"
] | 34 | 2020-01-22T01:41:22.000Z | 2021-12-09T13:20:33.000Z | tests/miaf/invalid-alpha-track-composition-times.asm | y-guyon/ComplianceWarden | 7315f1266b083a1cd958eae9ce7c8f07a8a6ad2d | [
"BSD-3-Clause"
] | 2 | 2020-11-05T01:41:08.000Z | 2021-11-19T13:12:35.000Z | %define BE(a) ( ((((a)>>24)&0xFF) << 0) + ((((a)>>16)&0xFF) << 8) + ((((a)>>8)&0xFF) << 16) + ((((a)>>0)&0xFF) << 24))
ftyp_start:
dd BE(ftyp_end - ftyp_start)
dd "ftyp"
db 0x61, 0x76, 0x69, 0x73 ; "major_brand(32)" ('avis')
db 0x00, 0x00, 0x00, 0x00 ; "minor_version(32)"
db 0x6D, 0x69, 0x66, 0x31 ; "compatible_brand(32)" ('mif1')
db 0x61, 0x76, 0x69, 0x66 ; "compatible_brand(32)" ('avif')
db 0x61, 0x76, 0x30, 0x31 ; "compatible_brand(32)" ('av01')
db 0x61, 0x76, 0x69, 0x73 ; "compatible_brand(32)" ('avis')
db 0x6D, 0x73, 0x66, 0x31 ; "compatible_brand(32)" ('msf1')
db 0x69, 0x73, 0x6F, 0x38 ; "compatible_brand(32)" ('iso8')
db 0x6D, 0x69, 0x61, 0x66 ; "compatible_brand(32)" ('miaf')
db 0x4D, 0x41, 0x31, 0x42 ; "compatible_brand(32)" ('MA1B')
ftyp_end:
meta_start:
dd BE(meta_end - meta_start)
dd "meta"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
hdlr_start:
dd BE(hdlr_end - hdlr_start)
dd "hdlr"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
db 0x00, 0x00, 0x00, 0x00 ; "pre_defined(32)"
db 0x70, 0x69, 0x63, 0x74 ; "handler_type(32)" ('pict')
db 0x00, 0x00, 0x00, 0x00 ; "reserved1(32)"
db 0x00, 0x00, 0x00, 0x00 ; "reserved2(32)"
db 0x00, 0x00, 0x00, 0x00 ; "reserved3(32)"
db 0x47 ; "name(8)" ('G')
db 0x50 ; "name(8)" ('P')
db 0x41 ; "name(8)" ('A')
db 0x43 ; "name(8)" ('C')
db 0x20 ; "name(8)" (' ')
db 0x70 ; "name(8)" ('p')
db 0x69 ; "name(8)" ('i')
db 0x63 ; "name(8)" ('c')
db 0x74 ; "name(8)" ('t')
db 0x20 ; "name(8)" (' ')
db 0x48 ; "name(8)" ('H')
db 0x61 ; "name(8)" ('a')
db 0x6E ; "name(8)" ('n')
db 0x64 ; "name(8)" ('d')
db 0x6C ; "name(8)" ('l')
db 0x65 ; "name(8)" ('e')
db 0x72 ; "name(8)" ('r')
db 0x00 ; "name(8)"
hdlr_end:
pitm_start:
dd BE(pitm_end - pitm_start)
dd "pitm"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
db 0x00, 0x04 ; "item_ID(16)"
pitm_end:
iloc_start:
dd BE(iloc_end - iloc_start)
dd "iloc"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
db 0x04 ; "offset_size(4)" "length_size(4)"
db 0x40 ; "base_offset_size(4)" ('@') "reserved1(4)" ('@')
db 0x00, 0x02 ; "item_count(16)"
db 0x00, 0x03 ; "item_ID(16)"
db 0x00, 0x00 ; "data_reference_index(16)"
dd BE(mdat_start - ftyp_start + 8) ; "base_offset(32)"
db 0x00, 0x01 ; "extent_count(16)"
db 0x00, 0x00, 0x00, 0x00 ; "extent_length(32)"
db 0x00, 0x04 ; "item_ID(16)"
db 0x00, 0x00 ; "data_reference_index(16)"
dd BE(mdat_start - ftyp_start + 8) ; "base_offset(32)"
db 0x00, 0x01 ; "extent_count(16)"
db 0x00, 0x00, 0x00, 0x00 ; "extent_length(32)"
iloc_end:
iinf_start:
dd BE(iinf_end - iinf_start)
dd "iinf"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
db 0x00, 0x02 ; "entry_count(16)"
infe_start:
dd BE(infe_end - infe_start)
dd "infe"
db 0x02 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
db 0x00, 0x03 ; "item_ID(16)"
db 0x00, 0x00 ; "item_protection_index(16)"
db 0x61, 0x76, 0x30, 0x31 ; "item_type(32)" ('av01')
db 0x41 ; "item_name(8)" ('A')
db 0x6C ; "item_name(8)" ('l')
db 0x70 ; "item_name(8)" ('p')
db 0x68 ; "item_name(8)" ('h')
db 0x61 ; "item_name(8)" ('a')
db 0x00 ; "item_name(8)"
infe_end:
infe2_start:
dd BE(infe2_end - infe2_start)
dd "infe"
db 0x02 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
db 0x00, 0x04 ; "item_ID(16)"
db 0x00, 0x00 ; "item_protection_index(16)"
db 0x61, 0x76, 0x30, 0x31 ; "item_type(32)" ('av01')
db 0x43 ; "item_name(8)" ('C')
db 0x6F ; "item_name(8)" ('o')
db 0x6C ; "item_name(8)" ('l')
db 0x6F ; "item_name(8)" ('o')
db 0x72 ; "item_name(8)" ('r')
db 0x00 ; "item_name(8)"
infe2_end:
iinf_end:
iref_start:
dd BE(iref_end - iref_start)
dd "iref"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
db 0x00, 0x00, 0x00, 0x0E ; "box_size(32)"
db 0x61, 0x75, 0x78, 0x6C ; "box_type(32)" ('auxl')
db 0x00, 0x03 ; "from_item_ID(16)"
db 0x00, 0x01 ; "reference_count(16)"
db 0x00, 0x04 ; "to_item_ID(16)"
iref_end:
iprp_start:
dd BE(iprp_end - iprp_start)
dd "iprp"
ipco_start:
dd BE(ipco_end - ipco_start)
dd "ipco"
ispe_start:
dd BE(ispe_end - ispe_start)
dd "ispe"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
db 0x00, 0x00, 0x02, 0x80 ; "image_width(32)"
db 0x00, 0x00, 0x01, 0xE0 ; "image_height(32)"
ispe_end:
pasp_start:
dd BE(pasp_end - pasp_start)
dd "pasp"
db 0x00, 0x00, 0x00, 0x01 ; "hSpacing(32)"
db 0x00, 0x00, 0x00, 0x01 ; "vSpacing(32)"
pasp_end:
av1C_start:
dd BE(av1C_end - av1C_start)
dd "av1C"
db 0x81 ; marker(1) version(7)
db 0x21 ; seq_profile(3) ('!') seq_level_idx_0(5) ('!')
db 0x00 ; seq_tier_0(1) high_bitdepth(1) twelve_bit(1) monochrome(1) chroma_subsampling_x(1) chroma_subsampling_y(1) chroma_sample_position(2)
db 0x00 ; reserved(3) initial_presentation_delay_present(1) reserved(4)
; configOBUs(0)
av1C_end:
auxC_start:
dd BE(auxC_end - auxC_start)
dd "auxC"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
db 0x75 ; "aux_type(8)" ('u')
db 0x72 ; "aux_type(8)" ('r')
db 0x6E ; "aux_type(8)" ('n')
db 0x3A ; "aux_type(8)" (':')
db 0x6D ; "aux_type(8)" ('m')
db 0x70 ; "aux_type(8)" ('p')
db 0x65 ; "aux_type(8)" ('e')
db 0x67 ; "aux_type(8)" ('g')
db 0x3A ; "aux_type(8)" (':')
db 0x6D ; "aux_type(8)" ('m')
db 0x70 ; "aux_type(8)" ('p')
db 0x65 ; "aux_type(8)" ('e')
db 0x67 ; "aux_type(8)" ('g')
db 0x42 ; "aux_type(8)" ('B')
db 0x3A ; "aux_type(8)" (':')
db 0x63 ; "aux_type(8)" ('c')
db 0x69 ; "aux_type(8)" ('i')
db 0x63 ; "aux_type(8)" ('c')
db 0x70 ; "aux_type(8)" ('p')
db 0x3A ; "aux_type(8)" (':')
db 0x73 ; "aux_type(8)" ('s')
db 0x79 ; "aux_type(8)" ('y')
db 0x73 ; "aux_type(8)" ('s')
db 0x74 ; "aux_type(8)" ('t')
db 0x65 ; "aux_type(8)" ('e')
db 0x6D ; "aux_type(8)" ('m')
db 0x73 ; "aux_type(8)" ('s')
db 0x3A ; "aux_type(8)" (':')
db 0x61 ; "aux_type(8)" ('a')
db 0x75 ; "aux_type(8)" ('u')
db 0x78 ; "aux_type(8)" ('x')
db 0x69 ; "aux_type(8)" ('i')
db 0x6C ; "aux_type(8)" ('l')
db 0x69 ; "aux_type(8)" ('i')
db 0x61 ; "aux_type(8)" ('a')
db 0x72 ; "aux_type(8)" ('r')
db 0x79 ; "aux_type(8)" ('y')
db 0x3A ; "aux_type(8)" (':')
db 0x61 ; "aux_type(8)" ('a')
db 0x6C ; "aux_type(8)" ('l')
db 0x70 ; "aux_type(8)" ('p')
db 0x68 ; "aux_type(8)" ('h')
db 0x61 ; "aux_type(8)" ('a')
db 0x00 ; "aux_type(8)"
auxC_end:
pixi_start:
dd BE(pixi_end - pixi_start)
dd "pixi"
pixi_end:
av1C2_start:
dd BE(av1C2_end - av1C2_start)
dd "av1C"
db 0x81 ; marker(1) version(7)
db 0x01 ; seq_profile(3) seq_level_idx_0(5)
db 0x1C ; seq_tier_0(1) high_bitdepth(1) twelve_bit(1) monochrome(1) chroma_subsampling_x(1) chroma_subsampling_y(1) chroma_sample_position(2)
db 0x00 ; reserved(3) initial_presentation_delay_present(1) reserved(4)
; configOBUs(0)
av1C2_end:
pixi2_start:
dd BE(pixi2_end - pixi2_start)
dd "pixi"
pixi2_end:
ipco_end:
ipma_start:
dd BE(ipma_end - ipma_start)
dd "ipma"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
db 0x00, 0x00, 0x00, 0x02 ; "entry_count(32)"
db 0x00, 0x03 ; "item_ID(16)"
db 0x05 ; "association_count(8)"
db 0x81 ; "essential(1)" "property_index(7)"
db 0x82 ; "essential(1)" "property_index(7)"
db 0x83 ; "essential(1)" "property_index(7)"
db 0x84 ; "essential(1)" "property_index(7)"
db 0x85 ; "essential(1)" "property_index(7)"
db 0x00, 0x04 ; "item_ID(16)"
db 0x03 ; "association_count(8)"
db 0x81 ; "essential(1)" "property_index(7)"
db 0x82 ; "essential(1)" "property_index(7)"
db 0x86 ; "essential(1)" "property_index(7)"
ipma_end:
iprp_end:
meta_end:
moov_start:
dd BE(moov_end - moov_start)
dd "moov"
mvhd_start:
dd BE(mvhd_end - mvhd_start)
dd "mvhd"
mvhd_end:
iods_start:
dd BE(iods_end - iods_start)
dd "iods"
iods_end:
trak_start:
dd BE(trak_end - trak_start)
dd "trak"
tkhd_start:
dd BE(tkhd_end - tkhd_start)
dd "tkhd"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x01 ; "flags(24)"
db 0xD8, 0x7E, 0x5C, 0xEE ; "creation_time(32)"
db 0xD8, 0x7E, 0x5C, 0xEE ; "modification_time(32)"
db 0x00, 0x00, 0x00, 0x01 ; "track_ID(32)"
db 0x00, 0x00, 0x00, 0x00 ; "reserved(32)"
db 0x00, 0x00, 0x04, 0x80 ; "duration(32)"
db 0x00, 0x00, 0x00, 0x00 ; "reserved(32)"
db 0x00, 0x00, 0x00, 0x00 ; "reserved(32)"
db 0x00, 0x00 ; "layer(16)"
db 0x00, 0x00 ; "alternate_group(16)"
db 0x00, 0x00 ; "volume(16)"
db 0x00, 0x00 ; "reserved(16)"
db 0x00, 0x01, 0x00, 0x00 ; "matrix(32)"
db 0x00, 0x00, 0x00, 0x00 ; "matrix(32)"
db 0x00, 0x00, 0x00, 0x00 ; "matrix(32)"
db 0x00, 0x00, 0x00, 0x00 ; "matrix(32)"
db 0x00, 0x01, 0x00, 0x00 ; "matrix(32)"
db 0x00, 0x00, 0x00, 0x00 ; "matrix(32)"
db 0x00, 0x00, 0x00, 0x00 ; "matrix(32)"
db 0x00, 0x00, 0x00, 0x00 ; "matrix(32)"
db 0x40, 0x00, 0x00, 0x00 ; "matrix(32)"
db 0x02, 0x80, 0x00, 0x00 ; "width(32)"
db 0x01, 0xE0, 0x00, 0x00 ; "height(32)"
tkhd_end:
mdia_start:
dd BE(mdia_end - mdia_start)
dd "mdia"
mdhd_start:
dd BE(mdhd_end - mdhd_start)
dd "mdhd"
mdhd_end:
hdlr2_start:
dd BE(hdlr2_end - hdlr2_start)
dd "hdlr"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
db 0x00, 0x00, 0x00, 0x00 ; "pre_defined(32)"
db 0x70, 0x69, 0x63, 0x74 ; "handler_type(32)" ('pict')
db 0x00, 0x00, 0x00, 0x00 ; "reserved1(32)"
db 0x00, 0x00, 0x00, 0x00 ; "reserved2(32)"
db 0x00, 0x00, 0x00, 0x00 ; "reserved3(32)"
db 0x47 ; "name(8)" ('G')
db 0x50 ; "name(8)" ('P')
db 0x41 ; "name(8)" ('A')
db 0x43 ; "name(8)" ('C')
db 0x20 ; "name(8)" (' ')
db 0x61 ; "name(8)" ('a')
db 0x76 ; "name(8)" ('v')
db 0x69 ; "name(8)" ('i')
db 0x66 ; "name(8)" ('f')
db 0x73 ; "name(8)" ('s')
db 0x00 ; "name(8)"
hdlr2_end:
minf_start:
dd BE(minf_end - minf_start)
dd "minf"
vmhd_start:
dd BE(vmhd_end - vmhd_start)
dd "vmhd"
vmhd_end:
dinf_start:
dd BE(dinf_end - dinf_start)
dd "dinf"
dref_start:
dd BE(dref_end - dref_start)
dd "dref"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
db 0x00, 0x00, 0x00, 0x01 ; "entry_count(32)"
url_start:
dd BE(url_end - url_start)
dd "url "
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x01 ; "flags(24)"
url_end:
dref_end:
dinf_end:
stbl_start:
dd BE(stbl_end - stbl_start)
dd "stbl"
stsd_start:
dd BE(stsd_end - stsd_start)
dd "stsd"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
db 0x00, 0x00, 0x00, 0x01 ; "entry_count(32)"
av01_start:
dd BE(av01_end - av01_start)
dd "av01"
db 0x00 ; "reserved1(8)"
db 0x00 ; "reserved2(8)"
db 0x00 ; "reserved3(8)"
db 0x00 ; "reserved4(8)"
db 0x00 ; "reserved5(8)"
db 0x00 ; "reserved6(8)"
db 0x00, 0x01 ; "data_reference_index(16)"
db 0x00, 0x00 ; "pre_defined(16)"
db 0x00, 0x00 ; "reserved7(16)"
db 0x00, 0x00, 0x00, 0x00 ; "pre_defined1(32)"
db 0x00, 0x00, 0x00, 0x00 ; "pre_defined2(32)"
db 0x00, 0x00, 0x00, 0x00 ; "pre_defined3(32)"
db 0x02, 0x80 ; "width(16)"
db 0x01, 0xE0 ; "height(16)"
db 0x00, 0x48, 0x00, 0x00 ; "horizresolution(32)"
db 0x00, 0x48, 0x00, 0x00 ; "vertresolution(32)"
db 0x00, 0x00, 0x00, 0x00 ; "reserved8(32)"
db 0x00, 0x01 ; "frame_count(16)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00, 0x18 ; "depth(16)"
db 0xFF, 0xFF ; "pre_defined4(16)"
av1C3_start:
dd BE(av1C3_end - av1C3_start)
dd "av1C"
db 0x00, 0x00, 0x00, 0x00
av1C3_end:
ccst_start:
dd BE(ccst_end - ccst_start)
dd "ccst"
db 0x00 ; (8)
db 0x00 ; (8)
db 0x00 ; (8)
db 0x00 ; (8)
db 0x7C ; (8) ('|')
db 0x00 ; (8)
db 0x00 ; (8)
db 0x00 ; (8)
ccst_end:
btrt_start:
dd BE(btrt_end - btrt_start)
dd "btrt"
btrt_end:
av01_end:
stsd_end:
stts_start:
dd BE(stts_end - stts_start)
dd "stts"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
db 0x00, 0x00, 0x00, 0x01 ; "entry_count(32)"
db 0x00, 0x00, 0x00, 0x30 ; "sample_count(32)"
db 0x00, 0x00, 0x03, 0xE8 ; "sample_delta(32)"
stts_end:
stss_start:
dd BE(stss_end - stss_start)
dd "stss"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
db 0x00, 0x00, 0x00, 0x01 ; "entry_count(32)"
db 0x00, 0x00, 0x00, 0x01 ; "sample_number(32)"
stss_end:
stsc_start:
dd BE(stsc_end - stsc_start)
dd "stsc"
stsc_end:
stsz_start:
dd BE(stsz_end - stsz_start)
dd "stsz"
stsz_end:
stco_start:
dd BE(stco_end - stco_start)
dd "stco"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
dd 0x00 ; "entry_count(32)"
stco_end:
stbl_end:
minf_end:
mdia_end:
trak_end:
trak2_start:
dd BE(trak2_end - trak2_start)
dd "trak"
tkhd2_start:
dd BE(tkhd2_end - tkhd2_start)
dd "tkhd"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x01 ; "flags(24)"
db 0xD8, 0x7E, 0x5C, 0xEE ; "creation_time(32)"
db 0xD8, 0x7E, 0x5C, 0xEE ; "modification_time(32)"
db 0x00, 0x00, 0x00, 0x02 ; "track_ID(32)"
db 0x00, 0x00, 0x00, 0x00 ; "reserved(32)"
db 0x00, 0x00, 0x04, 0x80 ; "duration(32)"
db 0x00, 0x00, 0x00, 0x00 ; "reserved(32)"
db 0x00, 0x00, 0x00, 0x00 ; "reserved(32)"
db 0x00, 0x00 ; "layer(16)"
db 0x00, 0x00 ; "alternate_group(16)"
db 0x00, 0x00 ; "volume(16)"
db 0x00, 0x00 ; "reserved(16)"
db 0x00, 0x01, 0x00, 0x00 ; "matrix(32)"
db 0x00, 0x00, 0x00, 0x00 ; "matrix(32)"
db 0x00, 0x00, 0x00, 0x00 ; "matrix(32)"
db 0x00, 0x00, 0x00, 0x00 ; "matrix(32)"
db 0x00, 0x01, 0x00, 0x00 ; "matrix(32)"
db 0x00, 0x00, 0x00, 0x00 ; "matrix(32)"
db 0x00, 0x00, 0x00, 0x00 ; "matrix(32)"
db 0x00, 0x00, 0x00, 0x00 ; "matrix(32)"
db 0x40, 0x00, 0x00, 0x00 ; "matrix(32)"
db 0x02, 0x80, 0x00, 0x00 ; "width(32)"
db 0x01, 0xE0, 0x00, 0x00 ; "height(32)"
tkhd2_end:
tref_start:
dd BE(tref_end - tref_start)
dd "tref"
auxl_start:
dd BE(auxl_end - auxl_start)
dd "auxl"
db 0x00, 0x00, 0x00, 0x01 ; "track_IDs(32)"
auxl_end:
tref_end:
mdia2_start:
dd BE(mdia2_end - mdia2_start)
dd "mdia"
mdhd2_start:
dd BE(mdhd2_end - mdhd2_start)
dd "mdhd"
mdhd2_end:
hdlr3_start:
dd BE(hdlr3_end - hdlr3_start)
dd "hdlr"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
db 0x00, 0x00, 0x00, 0x00 ; "pre_defined(32)"
db 0x70, 0x69, 0x63, 0x74 ; "handler_type(32)" ('pict')
db 0x00, 0x00, 0x00, 0x00 ; "reserved1(32)"
db 0x00, 0x00, 0x00, 0x00 ; "reserved2(32)"
db 0x00, 0x00, 0x00, 0x00 ; "reserved3(32)"
db 0x47 ; "name(8)" ('G')
db 0x50 ; "name(8)" ('P')
db 0x41 ; "name(8)" ('A')
db 0x43 ; "name(8)" ('C')
db 0x20 ; "name(8)" (' ')
db 0x61 ; "name(8)" ('a')
db 0x76 ; "name(8)" ('v')
db 0x69 ; "name(8)" ('i')
db 0x66 ; "name(8)" ('f')
db 0x73 ; "name(8)" ('s')
db 0x20 ; "name(8)" (' ')
db 0x61 ; "name(8)" ('a')
db 0x6C ; "name(8)" ('l')
db 0x70 ; "name(8)" ('p')
db 0x68 ; "name(8)" ('h')
db 0x61 ; "name(8)" ('a')
db 0x00 ; "name(8)"
hdlr3_end:
minf2_start:
dd BE(minf2_end - minf2_start)
dd "minf"
vmhd2_start:
dd BE(vmhd2_end - vmhd2_start)
dd "vmhd"
vmhd2_end:
dinf2_start:
dd BE(dinf2_end - dinf2_start)
dd "dinf"
dref2_start:
dd BE(dref2_end - dref2_start)
dd "dref"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
db 0x00, 0x00, 0x00, 0x01 ; "entry_count(32)"
url2_start:
dd BE(url2_end - url2_start)
dd "url "
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x01 ; "flags(24)"
url2_end:
dref2_end:
dinf2_end:
stbl2_start:
dd BE(stbl2_end - stbl2_start)
dd "stbl"
stsd2_start:
dd BE(stsd2_end - stsd2_start)
dd "stsd"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
db 0x00, 0x00, 0x00, 0x01 ; "entry_count(32)"
av012_start:
dd BE(av012_end - av012_start)
dd "av01"
db 0x00 ; "reserved1(8)"
db 0x00 ; "reserved2(8)"
db 0x00 ; "reserved3(8)"
db 0x00 ; "reserved4(8)"
db 0x00 ; "reserved5(8)"
db 0x00 ; "reserved6(8)"
db 0x00, 0x01 ; "data_reference_index(16)"
db 0x00, 0x00 ; "pre_defined(16)"
db 0x00, 0x00 ; "reserved7(16)"
db 0x00, 0x00, 0x00, 0x00 ; "pre_defined1(32)"
db 0x00, 0x00, 0x00, 0x00 ; "pre_defined2(32)"
db 0x00, 0x00, 0x00, 0x00 ; "pre_defined3(32)"
db 0x02, 0x80 ; "width(16)"
db 0x01, 0xE0 ; "height(16)"
db 0x00, 0x48, 0x00, 0x00 ; "horizresolution(32)"
db 0x00, 0x48, 0x00, 0x00 ; "vertresolution(32)"
db 0x00, 0x00, 0x00, 0x00 ; "reserved8(32)"
db 0x00, 0x01 ; "frame_count(16)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00 ; "compressorname(8)"
db 0x00, 0x18 ; "depth(16)"
db 0xFF, 0xFF ; "pre_defined4(16)"
av1C4_start:
dd BE(av1C4_end - av1C4_start)
dd "av1C"
db 0x00, 0x00, 0x00, 0x00
av1C4_end:
ccst2_start:
dd BE(ccst2_end - ccst2_start)
dd "ccst"
db 0x00 ; (8)
db 0x00 ; (8)
db 0x00 ; (8)
db 0x00 ; (8)
db 0x7C ; (8) ('|')
db 0x00 ; (8)
db 0x00 ; (8)
db 0x00 ; (8)
ccst2_end:
auxi_start:
dd BE(auxi_end - auxi_start)
dd "auxi"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
db 0x75 ; "aux_track_type(8)" ('u')
db 0x72 ; "aux_track_type(8)" ('r')
db 0x6E ; "aux_track_type(8)" ('n')
db 0x3A ; "aux_track_type(8)" (':')
db 0x6D ; "aux_track_type(8)" ('m')
db 0x70 ; "aux_track_type(8)" ('p')
db 0x65 ; "aux_track_type(8)" ('e')
db 0x67 ; "aux_track_type(8)" ('g')
db 0x3A ; "aux_track_type(8)" (':')
db 0x6D ; "aux_track_type(8)" ('m')
db 0x70 ; "aux_track_type(8)" ('p')
db 0x65 ; "aux_track_type(8)" ('e')
db 0x67 ; "aux_track_type(8)" ('g')
db 0x42 ; "aux_track_type(8)" ('B')
db 0x3A ; "aux_track_type(8)" (':')
db 0x63 ; "aux_track_type(8)" ('c')
db 0x69 ; "aux_track_type(8)" ('i')
db 0x63 ; "aux_track_type(8)" ('c')
db 0x70 ; "aux_track_type(8)" ('p')
db 0x3A ; "aux_track_type(8)" (':')
db 0x73 ; "aux_track_type(8)" ('s')
db 0x79 ; "aux_track_type(8)" ('y')
db 0x73 ; "aux_track_type(8)" ('s')
db 0x74 ; "aux_track_type(8)" ('t')
db 0x65 ; "aux_track_type(8)" ('e')
db 0x6D ; "aux_track_type(8)" ('m')
db 0x73 ; "aux_track_type(8)" ('s')
db 0x3A ; "aux_track_type(8)" (':')
db 0x61 ; "aux_track_type(8)" ('a')
db 0x75 ; "aux_track_type(8)" ('u')
db 0x78 ; "aux_track_type(8)" ('x')
db 0x69 ; "aux_track_type(8)" ('i')
db 0x6C ; "aux_track_type(8)" ('l')
db 0x69 ; "aux_track_type(8)" ('i')
db 0x61 ; "aux_track_type(8)" ('a')
db 0x72 ; "aux_track_type(8)" ('r')
db 0x79 ; "aux_track_type(8)" ('y')
db 0x3A ; "aux_track_type(8)" (':')
db 0x61 ; "aux_track_type(8)" ('a')
db 0x6C ; "aux_track_type(8)" ('l')
db 0x70 ; "aux_track_type(8)" ('p')
db 0x68 ; "aux_track_type(8)" ('h')
db 0x61 ; "aux_track_type(8)" ('a')
db 0x00 ; "aux_track_type(8)"
auxi_end:
btrt2_start:
dd BE(btrt2_end - btrt2_start)
dd "btrt"
btrt2_end:
av012_end:
stsd2_end:
stts2_start:
dd BE(stts2_end - stts2_start)
dd "stts"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
db 0x00, 0x00, 0x00, 0x01 ; "entry_count(32)"
db 0x00, 0x00, 0x00, 0x30 ; "sample_count(32)"
db 0x00, 0x00, 0x03, 0xE7 ; "sample_delta(32)"
stts2_end:
stss2_start:
dd BE(stss2_end - stss2_start)
dd "stss"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
db 0x00, 0x00, 0x00, 0x01 ; "entry_count(32)"
db 0x00, 0x00, 0x00, 0x01 ; "sample_number(32)"
stss2_end:
stsc2_start:
dd BE(stsc2_end - stsc2_start)
dd "stsc"
stsc2_end:
stsz2_start:
dd BE(stsz2_end - stsz2_start)
dd "stsz"
stsz2_end:
stco2_start:
dd BE(stco2_end - stco2_start)
dd "stco"
db 0x00 ; "version(8)"
db 0x00, 0x00, 0x00 ; "flags(24)"
dd 0x00 ; "entry_count(32)"
stco2_end:
stbl2_end:
minf2_end:
mdia2_end:
trak2_end:
moov_end:
mdat_start:
dd BE(mdat_end - mdat_start)
db "mdat"
db 0x00
mdat_end:
; vim: syntax=nasm
| 46.024259 | 159 | 0.389253 |
1335b1b5df4de30d2512e0d9ab6220d279d22497 | 169 | asm | Assembly | solutions/51 - Identify Yourselves/size-6_speed-44.asm | behrmann/7billionhumans | 36d53daf278ef4f3729bc5cba2f2398d5411bd6d | [
"MIT"
] | 45 | 2018-09-05T04:56:59.000Z | 2021-11-22T08:57:26.000Z | solutions/51 - Identify Yourselves/size-6_speed-44.asm | behrmann/7billionhumans | 36d53daf278ef4f3729bc5cba2f2398d5411bd6d | [
"MIT"
] | 36 | 2018-09-01T11:34:26.000Z | 2021-05-19T23:20:49.000Z | solutions/51 - Identify Yourselves/size-6_speed-44.asm | behrmann/7billionhumans | 36d53daf278ef4f3729bc5cba2f2398d5411bd6d | [
"MIT"
] | 36 | 2018-09-01T07:44:19.000Z | 2021-09-10T19:07:35.000Z | -- 7 Billion Humans (2145) --
-- 51: Identify Yourselves --
-- Author: landfillbaby
-- Size: 6
-- Speed: 44
step s
a:
pickup c
mem1 = calc w + 1
write mem1
drop
jump a | 12.071429 | 29 | 0.64497 |
094bc76a11469c2981c9371e772f313ffa4f88fc | 287 | asm | Assembly | libsrc/fcntl/msxdos2/getwd.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/fcntl/msxdos2/getwd.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/fcntl/msxdos2/getwd.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z | SECTION code_clib
INCLUDE "target/msx/def/msxdos2.def"
PUBLIC getwd
PUBLIC _getwd
EXTERN MSXDOS
EXTERN msxdos_error
; (char *)
getwd:
_getwd:
pop bc
pop de ;64 byte buffer
push de
push bc
ld c,_GETCD
call MSXDOS
ld (msxdos_error),a
ld hl,0
and a
ret z
dec hl
ret
| 10.62963 | 37 | 0.703833 |
b8484d4e96a259edc4feca6249862a00de301cc6 | 2,837 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_1_1434.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_1_1434.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_1_1434.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r8
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x1d64b, %rax
nop
nop
sub %rdi, %rdi
mov $0x6162636465666768, %r8
movq %r8, %xmm5
movups %xmm5, (%rax)
nop
nop
nop
cmp $29215, %rdi
lea addresses_UC_ht+0x13a8b, %rsi
lea addresses_UC_ht+0x37fb, %rdi
clflush (%rdi)
nop
nop
nop
nop
xor $64057, %r12
mov $38, %rcx
rep movsq
nop
nop
nop
nop
nop
dec %rsi
lea addresses_D_ht+0x53fb, %rdi
dec %r8
mov $0x6162636465666768, %rax
movq %rax, %xmm7
movups %xmm7, (%rdi)
xor %rcx, %rcx
lea addresses_UC_ht+0x1dffb, %r12
nop
nop
nop
inc %r9
mov $0x6162636465666768, %rdi
movq %rdi, %xmm1
vmovups %ymm1, (%r12)
nop
nop
inc %rcx
lea addresses_A_ht+0x12849, %rdi
nop
nop
nop
nop
add %r8, %r8
vmovups (%rdi), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $0, %xmm0, %rcx
nop
nop
xor $46016, %r12
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r15
push %r8
push %rbp
push %rcx
push %rdx
push %rsi
// Store
mov $0x821e100000006cf, %rcx
nop
nop
nop
xor %r10, %r10
mov $0x5152535455565758, %r8
movq %r8, %xmm5
vmovups %ymm5, (%rcx)
nop
nop
nop
nop
sub %r15, %r15
// Store
lea addresses_US+0x617b, %rsi
nop
nop
nop
nop
cmp %rbp, %rbp
movl $0x51525354, (%rsi)
nop
nop
nop
nop
add $37964, %rdx
// Faulty Load
lea addresses_normal+0xbffb, %rbp
xor $64629, %r10
vmovups (%rbp), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $0, %xmm7, %rcx
lea oracles, %rdx
and $0xff, %rcx
shlq $12, %rcx
mov (%rdx,%rcx,1), %rcx
pop %rsi
pop %rdx
pop %rcx
pop %rbp
pop %r8
pop %r15
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 6}}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 4}}
{'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 11}}
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'}
{'34': 1}
34
*/
| 18.913333 | 149 | 0.653507 |
0d5c2baf96ae7364c0c23645c27fd39fde078ee0 | 6,376 | asm | Assembly | mt86+_loader.asm | anphsw/memtest86- | 4ee32793ce26a605262186f79b0e4ec6fb0119b6 | [
"Intel"
] | 24 | 2018-09-28T03:08:46.000Z | 2022-03-13T12:11:37.000Z | mt86+_loader.asm | anphsw/memtest86- | 4ee32793ce26a605262186f79b0e4ec6fb0119b6 | [
"Intel"
] | 19 | 2018-02-28T10:25:25.000Z | 2022-01-23T11:30:59.000Z | mt86+_loader.asm | anphsw/memtest86- | 4ee32793ce26a605262186f79b0e4ec6fb0119b6 | [
"Intel"
] | 10 | 2018-04-05T09:43:45.000Z | 2022-01-22T15:26:15.000Z | ; A loader for www.memtest.org images, by Eric Auer 2003.
; This assumes that the image starts with the boot sector,
; which has the size of setup.S in sectors in a byte at offset
; 1f1h (497). Further, I assume setup.S directly after the boot
; sector and the actual memtest head.S after setup.S ...
; This version is derived from memtestL loader, which loads
; memtest.bin from a separate file. This version is meant to
; be used like (DOS / Unix variants):
; copy /b memteste.bin + memtest.bin memtest.exe
; cat memteste.bin memtest.bin > memtest.exe
; The good thing is that you get a single file which can be
; compressed, for example with http://upx.sf.net/ (UPX).
%include "mt86+_loader.inc"
%define fullsize (filesize + buffer - exeh)
%define stacksize 2048
%define stackpara ((stacksize + 15) / 16)
; the trick is that NASM believes the header would be part
; of the loaded image, so we "org 20h bytes too early" to fix:
org 0e0h ; NASM thinks after header we have 100h
; which is what we want it to think.
exeh: db "MZ"
dw fullsize % 512 ; how much to load from
dw (fullsize + 511) / 512 ; .exe to RAM
dw 0 ; no relocations used
dw 2 ; header size is 2 * 16 bytes
dw stackpara ; minimum heap is 128 * 16 bytes, for stack
dw stackpara ; we do not need more heap either
dw (fullsize + 15) / 16 ; SS is after file
; segment offsets are relative to PSPseg+10h
; initial DS and ES point to PSPseg, and file
; except headers is loaded to PSPseg+10h.
dw stacksize-4 ; initial SP value
dw 0 ; no checksum
dw 100h ; initial IP
dw -10h ; initial CS relative to PSPseg+10h
dw 0 ; no relocation table, "offset 0 in file"
dw 0 ; this is not an overlay
db "MEMT" ; padding to a multiple of 16 bytes
; loaded part begins here (set CS so that IP is 100h here)
start: ; entry point ; if you use obj + linker, use "..start:"
mov ah, 01h
mov bh, 00h
mov cx, 2000h
int 10h
mov ax,cs ; ***
mov ds,ax ; ***
mov es,ax ; ***
; test if we have 386 or better:
pushf ; save flags
xor ax,ax
push ax
popf ; try to clear all bits
pushf
pop ax
and ax,0f000h
cmp ax,0f000h
jz noinst1 ; 4 msb stuck to 1: 808x or 80186
mov ax,0f000h
push ax
popf ; try to set 4 msb
pushf
pop ax
test ax,0f000h
jz noinst1 ; 4 msb stuck to 0: 80286
popf ; restore flags
jmp short found386
noinst1:
popf ; restore flags
mov dx,need386
jmp generror
found386: ; now test if the system is in real mode:
smsw ax ; MSW is the low half of CR0
; (smsw is not priv'd, unlike mov eax,cr0)
test al,1 ; if the PE (protected mode) flag on?
%ifndef DEBUG ; ignore findings in debug mode
jnz foundprotected
%endif
jmp foundreal
foundprotected:
mov dx,noreal
jmp generror
; ------------
need386 db "Sorry, you need at least a 386 CPU to use Memtest86+."
db 13,10,"$"
noreal db "You cannot run Memtest86+ if the system already is in"
db " protected mode.",13,10,"$"
; ------------
generror: ; generic error exit
push cs
pop ds
push cs
pop es
mov ah,9
int 21h
mov ax,4c01h
int 21h
; ------------
foundreal:
mov cx,buffer+15
shr cx,4 ; buffer offset in paragraphs
mov ax,cs
add ax,cx ; buffer offset in paragraphs
; now AX is the buffer segment
mov [cs:bufsetup+2],ax ; far pointer to boot sector now
mov cx,20h ; size of boot sector in paragraphs
add [cs:bufsetup+2],cx ; far pointer to setup now
movzx eax,ax
shl eax,4 ; linear buffer offset
mov [cs:buflinear],eax
findpoint: ; now patch the loader!
mov al,[buffer+1f1h] ; size of setup.S in sectors
; should be 4 ...
inc al ; the boot sector itself
movzx eax,al
shl eax,9 ; log 2 of sector size
add [cs:buflinear],eax ; linear address of head.S now
mov ax,[buffer+251h] ; should be jmp far dword (ofs, seg)
cmp ax,0ea66h
jz foundpatch
patchbug: ; could not patch the jump
mov dx,nopatch
jmp generror
gdtbug:
mov dx,nogdt
jmp generror
foundpatch:
mov eax,[cs:buflinear]
mov [buffer+253h],eax ; patch the protected mode entry jump
; (offset only - segment selector unchanged: flat linear CS)
findgdt:
mov eax,[cs:buffer+20ch] ; should be lgdt offset
and eax,00ffffffh
cmp eax,0016010fh ; lgdt ...
jnz gdtbug
mov ax,[cs:buffer+20fh] ; GDTR contents pointer
mov bx,ax
mov eax,[cs:buffer+200h+bx+2] ; GDT linear offset
and eax,1ffh ; assume GDT in first sector of setup.S
; *** WARNING: this is needed because setup.S contains
; *** HARDCODED offset of setup.S on linear 90200h, which
; *** is 90000h + bootsect.S ... flaw in Memtest86!
mov cx,[cs:bufsetup+2] ; setup.S segment
movzx ecx,cx
shl ecx,4 ; linear setup.S address
add eax,ecx ; fixed GDT linear offset
mov [cs:buffer+200h+bx+2],eax ; patch it
;mov dx,trying
;mov ah,9
;int 21h
;xor ax,ax
;int 16h ; wait for a keypress from the user
mov ax,[cs:bufsetup+2] ; setup segment
mov ds,ax ; set nice data segments for setup.S ...
mov es,ax
xor ax,ax
mov fs,ax
mov gs,ax
cli
lss sp,[cs:newstack] ; stack in first 64k now!
movzx esp,sp ; ensure 16bit stack pointer
; Memtest86 head.S assumes that it can just turn SS to
; linear. This would put the stack at 0:200h or so for us
; if we fail to move the stack around ...
%ifdef DEBUG
mov ebp,[cs:buflinear] ; will show up in debugging logs
mov esi,[cs:bufsetup] ; will show up in debugging logs
%endif
jmp far [cs:bufsetup]
; setup.S will enable the A20 (ignoring HIMEM, just using
; the classic 8042 programming trick) and turn on protected
; mode. Then it will jump to head.S, which luckily can run
; from any offset inside the linear 4 GB CS ...
; ------------
buflinear dd 0 ; linear address of head.S entry point
bufsetup dw 0,0 ; far pointer to setup.S entry point
newstack dw 03fch,0 ; beware, stack will overwrite IDT.
; ------------
nopatch db "jmp far dword not found at setup.S offset 37h,",13,10
db "(file offset 237h is not 66h, 0eah)",13,10
db "please adjust and recompile memtestl...",13,10,"$"
nogdt db "lgdt [...] not found at setup.S offset 0ch,",13,10
db "(file offset 20ch is not 0fh, 01h, 16h)",13,10
db "please adjust and recompile memtestl...",13,10,"$"
trying db "Now trying to start Memtest86...",13,10
db "You have to reboot to leave Memtest86 again.",13,10
db "Press a key to go on.",13,10,"$"
; ------------
align 16
buffer: ; a label pointing to where in the file memtest.bin will be.
| 27.364807 | 68 | 0.686637 |
55f71b5ef9872ed59766e3d5d7df1dd235ea1125 | 927 | asm | Assembly | src/shaders/post_processing/gen5_6/Core_Kernels/PA_AVS_IEF_16x8.asm | tizenorg/platform.upstream.libva-intel-driver | 9ffc32731bacbfec2cef3d9fb5eb4c0c43952b90 | [
"MIT"
] | null | null | null | src/shaders/post_processing/gen5_6/Core_Kernels/PA_AVS_IEF_16x8.asm | tizenorg/platform.upstream.libva-intel-driver | 9ffc32731bacbfec2cef3d9fb5eb4c0c43952b90 | [
"MIT"
] | null | null | null | src/shaders/post_processing/gen5_6/Core_Kernels/PA_AVS_IEF_16x8.asm | tizenorg/platform.upstream.libva-intel-driver | 9ffc32731bacbfec2cef3d9fb5eb4c0c43952b90 | [
"MIT"
] | null | null | null | /*
* All Video Processing kernels
* Copyright © <2010>, Intel Corporation.
*
* This program is licensed under the terms and conditions of the
* Eclipse Public License (EPL), version 1.0. The full text of the EPL is at
* http://www.opensource.org/licenses/eclipse-1.0.php.
*
*/
//---------- PA_AVS_IEF_16x8.asm ----------
#include "AVS_IEF.inc"
//------------------------------------------------------------------------------
// 2 sampler reads for 8x8 YUV packed
//------------------------------------------------------------------------------
#include "PA_AVS_IEF_Sample.asm"
//------------------------------------------------------------------------------
// Unpacking sampler reads to 4:4:4 internal planar
//------------------------------------------------------------------------------
#include "PA_AVS_IEF_Unpack_16x8.asm"
//------------------------------------------------------------------------------
| 34.333333 | 80 | 0.391586 |
d20f4c7e38140e856f9f5994a166a91aaaeed2bc | 7,117 | asm | Assembly | Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xca.log_21829_623.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xca.log_21829_623.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xca.log_21829_623.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r14
push %r15
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x7dd3, %r10
nop
nop
nop
cmp $4395, %rdi
movb $0x61, (%r10)
nop
nop
sub %r11, %r11
lea addresses_UC_ht+0x133, %r15
nop
nop
nop
nop
add $11087, %rbx
mov (%r15), %cx
nop
sub $49151, %r10
lea addresses_WC_ht+0xe73, %r10
nop
nop
nop
nop
nop
add %r11, %r11
movw $0x6162, (%r10)
nop
nop
nop
sub $34330, %r14
lea addresses_WT_ht+0xb73, %rsi
lea addresses_A_ht+0x13c3f, %rdi
nop
nop
cmp %r14, %r14
mov $17, %rcx
rep movsw
nop
nop
nop
nop
cmp %r14, %r14
lea addresses_normal_ht+0x1273, %rsi
lea addresses_UC_ht+0x11613, %rdi
clflush (%rsi)
nop
nop
xor $21459, %r10
mov $5, %rcx
rep movsl
nop
nop
nop
nop
nop
inc %rsi
lea addresses_D_ht+0x9403, %rsi
lea addresses_WT_ht+0x15e73, %rdi
nop
nop
dec %r11
mov $16, %rcx
rep movsl
nop
nop
nop
xor %rbx, %rbx
lea addresses_D_ht+0x1775f, %rsi
nop
xor $58830, %r10
movups (%rsi), %xmm4
vpextrq $1, %xmm4, %rcx
xor %rsi, %rsi
lea addresses_WT_ht+0x14873, %r14
cmp %rdi, %rdi
mov (%r14), %r15d
nop
nop
nop
nop
add %r11, %r11
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r15
pop %r14
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r8
push %r9
push %rbp
push %rdi
push %rdx
push %rsi
// Store
lea addresses_A+0x19d33, %rbp
nop
nop
sub %r9, %r9
movl $0x51525354, (%rbp)
nop
nop
nop
nop
and %rsi, %rsi
// Load
lea addresses_PSE+0x100b3, %r8
sub %rdx, %rdx
movups (%r8), %xmm3
vpextrq $0, %xmm3, %rdi
nop
cmp %rdi, %rdi
// Store
lea addresses_UC+0x14673, %r13
nop
nop
nop
add %rdx, %rdx
movl $0x51525354, (%r13)
nop
cmp $9468, %r9
// Store
lea addresses_WT+0x1b1a3, %rdi
nop
nop
cmp %r8, %r8
movb $0x51, (%rdi)
nop
cmp $53718, %rdi
// Store
mov $0xac4880000000673, %rbp
sub $27960, %r8
mov $0x5152535455565758, %rdi
movq %rdi, (%rbp)
and %r9, %r9
// Faulty Load
lea addresses_A+0xf673, %r13
nop
nop
nop
nop
nop
xor $47294, %r9
movups (%r13), %xmm3
vpextrq $1, %xmm3, %r8
lea oracles, %rdx
and $0xff, %r8
shlq $12, %r8
mov (%rdx,%r8,1), %r8
pop %rsi
pop %rdx
pop %rdi
pop %rbp
pop %r9
pop %r8
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_A', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_A', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_WT', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 10}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_A', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_D_ht', 'same': True, 'AVXalign': False, 'congruent': 5}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 8}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 1}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 7}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 5}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 2}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 9}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 34.887255 | 2,999 | 0.651539 |
b094ffa6cdd4505880fc17e5d60ae98917af2345 | 668 | asm | Assembly | oeis/165/A165993.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/165/A165993.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/165/A165993.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A165993: a(n) = sum_{j=1..prime(n)-1} floor (j^2/prime(n)).
; 0,1,4,11,31,44,80,103,157,252,293,420,520,575,695,884,1105,1180,1431,1617,1704,2007,2217,2552,3040,3300,3439,3713,3852,4144,5255,5595,6120,6305,7252,7457,8060,8695,9141,9804,10507,10740,11983,12224,12740,13011,14633,16361,16955,17252,17864,18817,19120,20757,21760,22807,23852,24221,25300,26040,26417,28324,31113,31949,32344,33180,36193,37520,39795,40252,41184,42621,44539,46004,47505,48531,50052,52140,53200,55352,58111,58660,61511,62064,63817,64979,66752,69160,70380,71001,72237,76027,78577,79879
seq $0,40976 ; a(n) = prime(n) - 2.
seq $0,166375 ; a(n) = sum (floor (j^2/n)) taken over 1 <= j <= n-1.
| 111.333333 | 499 | 0.738024 |
d4b8442c82511252fec05cd19a0f82f35ebd6173 | 924 | nasm | Assembly | Projetos/F-Assembly/src/nasm/max.nasm | mariaeduardabicalho/Z01 | a08eb895cb064aad16e512d20b09c3f02704f98d | [
"Unlicense"
] | 2 | 2018-03-21T01:20:58.000Z | 2018-04-16T14:35:51.000Z | Projetos/F-Assembly/src/nasm/max.nasm | mariaeduardabicalho/Z01 | a08eb895cb064aad16e512d20b09c3f02704f98d | [
"Unlicense"
] | 70 | 2018-03-13T12:19:23.000Z | 2018-05-16T20:38:45.000Z | Projetos/F-Assembly/src/nasm/max.nasm | mariaeduardabicalho/Z01 | a08eb895cb064aad16e512d20b09c3f02704f98d | [
"Unlicense"
] | null | null | null | ; Arquivo: Max.nasm
; Curso: Elementos de Sistemas
; Criado por: Luciano Soares
; Data: 27/03/2017
; Log :
; - Rafael Corsi portado para Z01
; Calcula R2 = max(R0, R1) (R0,R1,R2 se referem a RAM[0],RAM[1],RAM[2])
; ou seja, o maior valor que estiver, ou em R0 ou R1 sera copiado para R2
; Estamos considerando número inteiros
;faz o jump direto para o início
leaw $INIT, %A
jmp
nop
;cria função da ram0
RAM0:
leaw $0, %A
movw (%A), %S
leaw $2, %A
movw %S, (%A)
leaw $PARAR, %A
jmp
nop
;cria função da ram1
RAM1:
leaw $1, %A
movw (%A), %S
leaw $2, %A
movw %S, (%A)
leaw $PARAR, %A
jmp
nop
;inicia código passando 0 pra A, armazenando em D,
;e passando 1 pra A
INIT:
leaw $0, %A
movw (%A), %D
leaw $1, %A
;realiza a subtração
subw %D, (%A), %D
;condição "if"
leaw $RAM0, %A
jg %D
nop
;condição "if"
leaw $RAM1, %A
jle %D
nop
;para o código
PARAR:
nop | 15.4 | 74 | 0.606061 |
c76de138d116fb8dcb0bb4609b056822d7ec79d8 | 2,891 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_st_4k_/i9-9900K_12_0xa0.log_4_810.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/AVXALIGN/_st_4k_/i9-9900K_12_0xa0.log_4_810.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/AVXALIGN/_st_4k_/i9-9900K_12_0xa0.log_4_810.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r15
push %rax
push %rbx
push %rcx
push %rdx
lea addresses_UC_ht+0x10c92, %r13
nop
nop
dec %rbx
mov $0x6162636465666768, %rdx
movq %rdx, %xmm2
and $0xffffffffffffffc0, %r13
movntdq %xmm2, (%r13)
nop
nop
xor $52644, %rcx
lea addresses_WT_ht+0xfdd2, %r15
nop
nop
nop
xor %r12, %r12
movb $0x61, (%r15)
nop
nop
nop
nop
xor %rcx, %rcx
lea addresses_normal_ht+0xadf2, %rdx
clflush (%rdx)
nop
nop
cmp $49602, %rbx
movb $0x61, (%rdx)
nop
cmp %rbx, %rbx
lea addresses_normal_ht+0x1ef62, %r15
nop
nop
and %rdx, %rdx
movw $0x6162, (%r15)
nop
and %rdx, %rdx
lea addresses_A_ht+0xc75c, %rax
nop
nop
and %rbx, %rbx
movw $0x6162, (%rax)
and %rax, %rax
pop %rdx
pop %rcx
pop %rbx
pop %rax
pop %r15
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r8
push %rbp
push %rcx
push %rdx
// Store
lea addresses_UC+0x11492, %r11
nop
nop
nop
nop
nop
xor $11070, %rdx
movl $0x51525354, (%r11)
nop
nop
nop
nop
sub %rbp, %rbp
// Store
lea addresses_normal+0xbc92, %rcx
nop
nop
sub %r8, %r8
mov $0x5152535455565758, %r10
movq %r10, %xmm3
movups %xmm3, (%rcx)
nop
nop
nop
inc %rcx
// Load
lea addresses_RW+0x1506f, %rcx
nop
nop
sub %r8, %r8
mov (%rcx), %r11w
nop
nop
and %rcx, %rcx
// Faulty Load
lea addresses_A+0x17c92, %rbp
nop
cmp $22656, %rcx
vmovntdqa (%rbp), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $0, %xmm1, %rdx
lea oracles, %rbp
and $0xff, %rdx
shlq $12, %rdx
mov (%rbp,%rdx,1), %rdx
pop %rdx
pop %rcx
pop %rbp
pop %r8
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_UC', 'AVXalign': False, 'size': 4}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_normal', 'AVXalign': False, 'size': 16}}
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_RW', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': True, 'same': True, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 8, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 3, 'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2}}
{'58': 4}
58 58 58 58
*/
| 19.533784 | 128 | 0.645797 |
2a880da6ace6bc67d55f933226973667db2a14ff | 6,898 | asm | Assembly | maps/VioletCity.asm | Dev727/ancientplatinum | 8b212a1728cc32a95743e1538b9eaa0827d013a7 | [
"blessing"
] | 28 | 2019-11-08T07:19:00.000Z | 2021-12-20T10:17:54.000Z | maps/VioletCity.asm | Dev727/ancientplatinum | 8b212a1728cc32a95743e1538b9eaa0827d013a7 | [
"blessing"
] | 13 | 2020-01-11T17:00:40.000Z | 2021-09-14T01:27:38.000Z | maps/VioletCity.asm | Dev727/ancientplatinum | 8b212a1728cc32a95743e1538b9eaa0827d013a7 | [
"blessing"
] | 22 | 2020-05-28T17:31:38.000Z | 2022-03-07T20:49:35.000Z | object_const_def ; object_event constants
const VIOLETCITY_EARL
const VIOLETCITY_LASS
const VIOLETCITY_SUPER_NERD
const VIOLETCITY_GRAMPS
const VIOLETCITY_YOUNGSTER
const VIOLETCITY_FRUIT_TREE
const VIOLETCITY_POKE_BALL1
const VIOLETCITY_POKE_BALL2
VioletCity_MapScripts:
db 0 ; scene scripts
db 1 ; callbacks
callback MAPCALLBACK_NEWMAP, .FlyPoint
.FlyPoint:
setflag ENGINE_FLYPOINT_VIOLET
return
VioletCityEarlScript:
applymovement VIOLETCITY_EARL, VioletCitySpinningEarl_MovementData
faceplayer
opentext
writetext Text_EarlAsksIfYouBeatFalkner
yesorno
iffalse .FollowEarl
sjump .PointlessJump
.PointlessJump:
writetext Text_VeryNiceIndeed
waitbutton
closetext
end
.FollowEarl:
writetext Text_FollowEarl
waitbutton
closetext
playmusic MUSIC_SHOW_ME_AROUND
follow VIOLETCITY_EARL, PLAYER
applymovement VIOLETCITY_EARL, VioletCityFollowEarl_MovementData
turnobject PLAYER, UP
applymovement VIOLETCITY_EARL, VioletCitySpinningEarl_MovementData
stopfollow
special RestartMapMusic
opentext
writetext Text_HereTeacherIAm
waitbutton
closetext
applymovement VIOLETCITY_EARL, VioletCitySpinningEarl_MovementData
applymovement VIOLETCITY_EARL, VioletCityFinishFollowEarl_MovementData
playsound SFX_ENTER_DOOR
disappear VIOLETCITY_EARL
clearevent EVENT_EARLS_ACADEMY_EARL
waitsfx
end
VioletCityLassScript:
jumptextfaceplayer VioletCityLassText
VioletCitySuperNerdScript:
jumptextfaceplayer VioletCitySuperNerdText
VioletCityGrampsScript:
jumptextfaceplayer VioletCityGrampsText
VioletCityYoungsterScript:
jumptextfaceplayer VioletCityYoungsterText
VioletCitySign:
jumptext VioletCitySignText
VioletGymSign:
jumptext VioletGymSignText
SproutTowerSign:
jumptext SproutTowerSignText
EarlsPokemonAcademySign:
jumptext EarlsPokemonAcademySignText
VioletCityPokecenterSign:
jumpstd pokecentersign
VioletCityMartSign:
jumpstd martsign
VioletCityPPUp:
itemball PP_UP
VioletCityRareCandy:
itemball RARE_CANDY
VioletCityFruitTree:
fruittree FRUITTREE_VIOLET_CITY
VioletCityHiddenHyperPotion:
hiddenitem HYPER_POTION, EVENT_VIOLET_CITY_HIDDEN_HYPER_POTION
VioletCityFollowEarl_MovementData:
big_step DOWN
big_step DOWN
turn_head DOWN
turn_head LEFT
turn_head UP
turn_head RIGHT
turn_head DOWN
turn_head LEFT
turn_head UP
turn_head RIGHT
big_step RIGHT
big_step RIGHT
big_step RIGHT
big_step RIGHT
big_step RIGHT
big_step RIGHT
big_step RIGHT
big_step RIGHT
big_step RIGHT
turn_head RIGHT
turn_head DOWN
turn_head LEFT
turn_head UP
turn_head RIGHT
turn_head DOWN
turn_head LEFT
turn_head UP
turn_head RIGHT
turn_head DOWN
big_step DOWN
turn_head DOWN
turn_head LEFT
turn_head UP
turn_head RIGHT
turn_head DOWN
turn_head LEFT
turn_head UP
turn_head RIGHT
big_step RIGHT
big_step RIGHT
big_step RIGHT
big_step RIGHT
big_step RIGHT
big_step RIGHT
big_step RIGHT
big_step RIGHT
turn_head RIGHT
turn_head DOWN
turn_head LEFT
turn_head UP
turn_head RIGHT
turn_head DOWN
turn_head LEFT
turn_head UP
big_step UP
turn_head DOWN
step_end
VioletCityFinishFollowEarl_MovementData:
step UP
step_end
VioletCitySpinningEarl_MovementData:
turn_head DOWN
turn_head LEFT
turn_head UP
turn_head RIGHT
turn_head DOWN
turn_head LEFT
turn_head UP
turn_head RIGHT
turn_head DOWN
turn_head LEFT
turn_head UP
turn_head RIGHT
turn_head DOWN
step_end
Text_EarlAsksIfYouBeatFalkner:
text "Hello!"
line "You are trainer?"
para "Battle GYM LEADER,"
line "win you did?"
done
Text_VeryNiceIndeed:
text "Ooh, la la!"
line "Very indeed nice!"
done
Text_FollowEarl:
text "Is that so? Then"
line "study shall you!"
cont "Follow me!"
done
Text_HereTeacherIAm:
text "Here, teacher I"
line "am. Good it is"
cont "you study here!"
done
VioletCityLassText:
text "Ghosts are rumored"
line "to appear in"
cont "SPROUT TOWER."
para "They said normal-"
line "type #MON moves"
para "had no effect on"
line "ghosts."
done
VioletCitySuperNerdText:
text "Hey, you're a"
line "#MON trainer?"
para "If you beat the"
line "GYM LEADER here,"
para "you'll be ready"
line "for prime time!"
done
VioletCityGrampsText:
text "FALKNER, from the"
line "VIOLET #MON"
para "GYM, is a fine"
line "trainer!"
para "He inherited his"
line "father's gym and"
para "has done a great"
line "job with it."
done
VioletCityYoungsterText:
text "I saw a wiggly"
line "tree up ahead!"
para "If you touch it,"
line "it squirms and"
cont "dances! Cool!"
done
VioletCitySignText:
text "VIOLET CITY"
para "The City of"
line "Nostalgic Scents"
done
VioletGymSignText:
text "VIOLET CITY"
line "#MON GYM"
cont "LEADER: FALKNER"
para "The Elegant Master"
line "of Flying #MON"
done
SproutTowerSignText:
text "SPROUT TOWER"
para "Experience the"
line "Way of #MON"
done
EarlsPokemonAcademySignText:
text "EARL'S #MON"
line "ACADEMY"
done
VioletCity_MapEvents:
db 0, 0 ; filler
db 9 ; warp events
warp_event 9, 17, VIOLET_MART, 2
warp_event 18, 17, VIOLET_GYM, 1
warp_event 30, 17, EARLS_POKEMON_ACADEMY, 1
warp_event 3, 15, VIOLET_NICKNAME_SPEECH_HOUSE, 1
warp_event 31, 25, VIOLET_POKECENTER_1F, 1
warp_event 21, 29, VIOLET_KYLES_HOUSE, 1
warp_event 23, 5, SPROUT_TOWER_1F, 1
warp_event 39, 24, ROUTE_31_VIOLET_GATE, 1
warp_event 39, 25, ROUTE_31_VIOLET_GATE, 2
db 0 ; coord events
db 7 ; bg events
bg_event 24, 20, BGEVENT_READ, VioletCitySign
bg_event 15, 17, BGEVENT_READ, VioletGymSign
bg_event 24, 8, BGEVENT_READ, SproutTowerSign
bg_event 27, 17, BGEVENT_READ, EarlsPokemonAcademySign
bg_event 32, 25, BGEVENT_READ, VioletCityPokecenterSign
bg_event 10, 17, BGEVENT_READ, VioletCityMartSign
bg_event 37, 14, BGEVENT_ITEM, VioletCityHiddenHyperPotion
db 8 ; object events
object_event 13, 16, SPRITE_FISHER, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_SCRIPT, 0, VioletCityEarlScript, EVENT_VIOLET_CITY_EARL
object_event 28, 28, SPRITE_LASS, SPRITEMOVEDATA_WANDER, 2, 2, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_SCRIPT, 0, VioletCityLassScript, -1
object_event 24, 14, SPRITE_SUPER_NERD, SPRITEMOVEDATA_WANDER, 1, 2, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, VioletCitySuperNerdScript, -1
object_event 17, 20, SPRITE_GRAMPS, SPRITEMOVEDATA_WALK_LEFT_RIGHT, 1, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, VioletCityGrampsScript, -1
object_event 5, 18, SPRITE_YOUNGSTER, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_SCRIPT, 0, VioletCityYoungsterScript, -1
object_event 14, 29, SPRITE_FRUIT_TREE, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, VioletCityFruitTree, -1
object_event 4, 1, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, VioletCityPPUp, EVENT_VIOLET_CITY_PP_UP
object_event 35, 5, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, VioletCityRareCandy, EVENT_VIOLET_CITY_RARE_CANDY
| 22.038339 | 164 | 0.801392 |
3cbf597490d9e82c60d4c10c6b1d89109853b4e0 | 352 | asm | Assembly | programs/oeis/029/A029066.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/029/A029066.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/029/A029066.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A029066: Expansion of 1/((1-x)*(1-x^4)*(1-x^5)*(1-x^9)).
; 1,1,1,1,2,3,3,3,4,6,7,7,8,10,12,13,14,16,19,21,23,25,28,31,34,37,40,44,48,52,56,60,65,70,75,80,86,92,98,104,111,118,125,132,140,149,157,165,174,184,194,203,213,224,236
lpb $0
mov $2,$0
sub $0,4
seq $2,25779 ; Expansion of 1/((1-x)*(1-x^5)*(1-x^9)).
add $1,$2
lpe
add $1,1
mov $0,$1
| 29.333333 | 169 | 0.579545 |
4fdc1108230d686b23b819d8fdc868a410557027 | 7,244 | asm | Assembly | riccardo-negri/01/x.asm | Tommimon/advent-of-code-2020 | e2337c95b87b7368ba34c5dc4e714b1376594beb | [
"MIT"
] | 3 | 2020-11-29T20:44:02.000Z | 2021-11-30T11:30:25.000Z | riccardo-negri/01/x.asm | Tommimon/advent-of-code-2020 | e2337c95b87b7368ba34c5dc4e714b1376594beb | [
"MIT"
] | 2 | 2020-12-02T18:48:22.000Z | 2021-05-11T00:08:49.000Z | riccardo-negri/01/x.asm | Tommimon/advent-of-code-2020 | e2337c95b87b7368ba34c5dc4e714b1376594beb | [
"MIT"
] | null | null | null | # MIPS 32bit Program for Day 1 of Advent Of Code 2020 by Riccardo Negri
# Challenge: https://adventofcode.com/2020/day/1
# Developed using MARS: https://courses.missouristate.edu/KenVollmar/MARS/
# SYSCALL functions available in MARS: https://courses.missouristate.edu/KenVollmar/mars/Help/SyscallHelp.html
# Part one: find two numbers that add up to 2020 and then multiply them together
# My answer for part one: 988771 (833*1187)
# Part two: find three numbers that add up to 2020 and then multiply them together
# My answer for part two: 171933104 (1237*511*272)
.data
.eqv FILE_MAX_SIZE 1000 # used to set buffer size for reading
.eqv NUMBERS_AMOUNT 200
.eqv NUMBERS_AMOUNT_BYTE 800 # 200 * 4 bytes
.eqv BACKSLASH_N 10
NUM_ARRAY: .space NUMBERS_AMOUNT_BYTE
BUFFER: .space FILE_MAX_SIZE
FILE_NAME: .asciiz "input"
WELCOME_STRING: .asciiz "Welcome to my first MIPS program ever attempting to solve day 1 of Advent Of Code 2020!\n"
PARSED_CORRECTLY: .asciiz "Parsed numbers hopefully correctly (I don't check if the file it's opened correctly or if it's not empty).\n"
LOOP_FAIL: .asciiz "My dear friend, I'm sorry to inform you that either you gave me an impossible list of integers or you are not a good programmer!\n"
PART1_LOOP_SUCCESS: .asciiz "My dear friend, you're the best!\n"
PART1_SUCCESS: .asciiz "Here's your result for the first part:\n"
PART2_LOOP_SUCCESS: .asciiz "\nMy dear friend, you're the best! Again ;)\n"
PART2_SUCCESS: .asciiz "Here's your result for the second part:\n"
.text
WELCOME:
li $v0, 4 # 4 --> print_string
la $a0, WELCOME_STRING # $a0 = address of null-terminated string to print
syscall
##### READ FILE TO BUFFER #####
OPEN_FILE:
li $v0, 13 # 13 --> open_file
la $a0, FILE_NAME # $a0 = address of null-terminated string containing filename
li $a1, 0 # $a1 = flags, 0 for read-only
li $a2, 0 # $a2 = mode, mode is ignored
syscall # file descriptor returned in $v0
move $s7, $v0 # save the file descriptor in $s7
READ_FILE:
li $v0, 14 # 14 --> read_file
move $a0, $s7 # $a0 = file descriptor
la $a1, BUFFER # $a1 = address of input buffer
li $a2, FILE_MAX_SIZE # $a2 = maximum number of characters to read
syscall # $v0 contains number of characters read (0 if end-of-file, negative if error).
#PRINT_FOR_DEBUG:
# li $v0, 4 # 4 --> print_string
# la $a0, BUFFER # $a0 = address of null-terminated string to print
# syscall
########## PARSE INPUT ##########
# $t0 the ADDRESS of BUFF
# $t1 the ADDRESS of VECTOR
# $t5 is the '\n' == 10
# $t6 is the multiplier
# $t7 is the thing read and manipulated
# $s1 is the current integer
PARSE_START:
la $t0, BUFFER
la $t1, NUM_ARRAY
li $t5, BACKSLASH_N
li $t6, 1
move $s1, $zero
PARSE_CICLE:
lb $t7, ($t0)
beq $t5, $t7, FOUND_BACKSLASH_N # every number, except the last one, is followed by a '\n'
beq $zero, $t7, END_PARSE_CICLE # '\x00' ends the string to parse
subi $t7, $t7, 48 # value of '0' in ASCII
mult $s1, $t5 # multiply by 10 the prev partial number
mflo $s1
add $s1, $s1, $t7 # add together the partial number and the digit we just got
addi $t0, $t0, 1 # switch to next char
j PARSE_CICLE
FOUND_BACKSLASH_N: # finally it's time to save the full number in the array
sw $s1, ($t1) # save the full integer
# li $v0, 1 # 1 --> print_int
# move $a0, $s1
# syscall # print the item just added
li $t6, 1 # reset to 1 the multiplier
addiu $t0, $t0, 1 # switch to next char
addiu $t1, $t1, 4 # switch to next integer in the array
move $s1, $zero # reset the value in $s1 so it can read a new number
j PARSE_CICLE
END_PARSE_CICLE:
sw $s1, ($t1) # save the LAST INTEGER integer (the last one doen't have a '\n' at the end)
# li $v0, 1 # 1 --> print_int
# move $a0, $s1
# syscall # print the item just added
li $v0, 4 # 4 --> print_string
la $a0, PARSED_CORRECTLY # $a0 = address of null-terminated string to print
syscall
###### FIRST PART ######
# $s0 is the address used in the first iteration
# $s1 is the address used in the second iteration
# $s2 is the address of first element after the array (the condition used in the loop)
# $s3 it actual value to match --> 2020
PART1_INITIALIZE_LOOP:
la $s0, NUM_ARRAY # starting address of the array
addiu $s2, $s0, NUMBERS_AMOUNT_BYTE
li $s3, 2020
PART1_LOOP:
move $s1, $s0 # this way we keep checking only numbers that are after
jal PART1_INNER_LOOP
addiu $s0, $s0, 4 # iterate to next int
beq $s0, $s2, PART1_END_LOOP_FAIL
j PART1_LOOP
PART1_INNER_LOOP:
addiu $s1, $s1, 4 # iterate to next int
lw $t0, ($s0) # load values
lw $t1, ($s1)
add $t2, $t0, $t1
beq $s3, $t2, PART1_END_LOOP_SUCCESS # check if we found the pair we're looking for
bne $s1, $s2, PART1_INNER_LOOP
jr $ra
PART1_END_LOOP_FAIL:
li $v0, 4 # 4 --> print_string
la $a0, LOOP_FAIL # $a0 = address of null-terminated string to print
syscall
li $v0, 10 # End program
syscall
PART1_END_LOOP_SUCCESS:
li $v0, 4 # 4 --> print_string
la $a0, PART1_LOOP_SUCCESS # $a0 = address of null-terminated string to print
syscall
mult $t0, $t1 # multiply the two numbers that sum up to 2020
mflo $t2
li $v0, 4 # 4 --> print_string
la $a0, PART1_SUCCESS # $a0 = address of null-terminated string to print
syscall
li $v0, 1 # 1 --> print_int
move $a0, $t2
syscall # print the answer
###### SECOND PART ######
# $s0 is the address used in the first iteration
# $s1 is the address used in the second iteration
# $s2 is the address used in the third iteration
# $s3 is the address of first element after the array, the condition in the loop
# $s4 it actual value to match --> 2020
PART2_INITIALIZE_LOOP:
la $s0, NUM_ARRAY # starting address of the array
addiu $s3, $s0, NUMBERS_AMOUNT_BYTE
li $s4, 2020
PART2_LOOP:
move $s1, $s0 # this way we keep checking only numbers that are after this
beq $s0, $s3, PART2_END_LOOP_FAIL
j PART2_INNER_LOOP
LAZY: addiu $s0, $s0, 4 # iterate to next int
j PART2_LOOP
PART2_INNER_LOOP:
addiu $s1, $s1, 4 # iterate to next int
beq $s1, $s3, LAZY # I could use jal and jr, but it takes time
move $s2, $s1
j PART2_INNER_INNER_LOOP # this way we keep checking only numbers that are after this
PART2_INNER_INNER_LOOP:
addiu $s2, $s2, 4 # iterate to next int
beq $s2, $s3, PART2_INNER_LOOP
lw $t0, ($s0) # load values
lw $t1, ($s1)
lw $t2, ($s2)
add $t3, $t0, $t1
add $t4, $t3, $t2
beq $s4, $t4, PART2_END_LOOP_SUCCESS # check if we found the pair we're looking for
j PART2_INNER_INNER_LOOP
PART2_END_LOOP_FAIL:
li $v0, 4 # 4 --> print_string
la $a0, LOOP_FAIL # $a0 = address of null-terminated string to print
syscall
li $v0, 10 # End program
syscall
PART2_END_LOOP_SUCCESS:
li $v0, 4 # 4 --> print_string
la $a0, PART2_LOOP_SUCCESS # $a0 = address of null-terminated string to print
syscall
mult $t0, $t1 # multiply the two numbers that sum up to 2020
mflo $t3
mult $t2, $t3
mflo $t4
li $v0, 4 # 4 --> print_string
la $a0, PART2_SUCCESS # $a0 = address of null-terminated string to print
syscall
li $v0, 1 # 1 --> print_int
move $a0, $t4
syscall # print the answer
li $v0, 10 # End program
syscall
| 35.684729 | 151 | 0.686085 |
07a32fae70b7cc5d3e7ac9c97a78c573b4cece31 | 10,600 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_st_sm_/i3-7100_9_0x84_notsx.log_21829_487.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/AVXALIGN/_st_sm_/i3-7100_9_0x84_notsx.log_21829_487.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/AVXALIGN/_st_sm_/i3-7100_9_0x84_notsx.log_21829_487.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x8e34, %r12
nop
nop
nop
nop
cmp %rbx, %rbx
mov $0x6162636465666768, %rdi
movq %rdi, %xmm6
movups %xmm6, (%r12)
nop
xor $58376, %r14
lea addresses_A_ht+0xc5b9, %rsi
lea addresses_D_ht+0x8a34, %rdi
nop
nop
nop
nop
inc %r14
mov $26, %rcx
rep movsw
nop
inc %r12
lea addresses_A_ht+0x18234, %rsi
lea addresses_normal_ht+0x16c34, %rdi
clflush (%rsi)
dec %r14
mov $50, %rcx
rep movsl
nop
nop
nop
nop
nop
xor $9565, %r12
lea addresses_normal_ht+0x17234, %rsi
lea addresses_normal_ht+0x9a34, %rdi
nop
nop
nop
nop
and %rdx, %rdx
mov $64, %rcx
rep movsw
nop
nop
inc %r14
lea addresses_D_ht+0x15490, %rsi
lea addresses_normal_ht+0x16f0c, %rdi
cmp %r14, %r14
mov $60, %rcx
rep movsw
and $12957, %rdi
lea addresses_D_ht+0x14124, %r14
nop
nop
nop
xor %r12, %r12
movb (%r14), %cl
nop
nop
and $21257, %rdi
lea addresses_WC_ht+0x10e6c, %rsi
lea addresses_normal_ht+0x1a2b4, %rdi
nop
nop
xor $45204, %rbp
mov $77, %rcx
rep movsq
nop
nop
nop
add $56067, %rbp
lea addresses_A_ht+0x654d, %rsi
lea addresses_D_ht+0xb1b4, %rdi
nop
inc %rbp
mov $127, %rcx
rep movsq
cmp %rdi, %rdi
lea addresses_normal_ht+0x11634, %rsi
lea addresses_normal_ht+0x175b4, %rdi
and $19755, %r14
mov $43, %rcx
rep movsb
nop
and %r12, %r12
lea addresses_WC_ht+0x12e34, %rsi
lea addresses_UC_ht+0xe274, %rdi
add $30947, %r14
mov $78, %rcx
rep movsq
nop
nop
nop
cmp %rbx, %rbx
lea addresses_WT_ht+0xf3e4, %rdx
nop
nop
sub $43215, %r12
mov (%rdx), %rdi
nop
nop
nop
nop
dec %r12
lea addresses_normal_ht+0x17d34, %r14
nop
nop
sub $56159, %rbx
mov $0x6162636465666768, %rcx
movq %rcx, (%r14)
nop
sub %rbp, %rbp
lea addresses_UC_ht+0x7d90, %rsi
lea addresses_UC_ht+0x6fd, %rdi
add $55150, %r14
mov $110, %rcx
rep movsl
dec %rsi
lea addresses_WT_ht+0x17cf4, %rsi
lea addresses_WC_ht+0x1a734, %rdi
nop
nop
nop
lfence
mov $20, %rcx
rep movsw
nop
nop
nop
nop
nop
add %r14, %r14
lea addresses_WC_ht+0x15b34, %rsi
lea addresses_UC_ht+0x1cc94, %rdi
clflush (%rdi)
dec %r14
mov $3, %rcx
rep movsl
nop
nop
nop
nop
dec %r14
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 %r13
push %r14
push %r8
push %r9
push %rsi
// Store
lea addresses_normal+0xc234, %rsi
nop
nop
nop
add $38101, %r9
movw $0x5152, (%rsi)
nop
nop
dec %r9
// Store
lea addresses_A+0x897a, %rsi
nop
nop
nop
nop
sub $55270, %r11
mov $0x5152535455565758, %r8
movq %r8, %xmm3
vmovups %ymm3, (%rsi)
nop
nop
nop
nop
nop
cmp $21897, %r10
// Load
lea addresses_WC+0x20a4, %r11
nop
sub $44260, %r13
mov (%r11), %r8d
nop
nop
xor %r10, %r10
// Store
mov $0x4b648b0000000d2c, %r10
nop
nop
nop
nop
add $64836, %r14
movb $0x51, (%r10)
nop
nop
nop
nop
add %r13, %r13
// Store
mov $0xb1c, %r14
clflush (%r14)
nop
nop
nop
nop
cmp %r8, %r8
mov $0x5152535455565758, %r13
movq %r13, %xmm5
movups %xmm5, (%r14)
nop
nop
nop
nop
nop
sub %r10, %r10
// Store
mov $0x22bda00000004d4, %rsi
nop
nop
nop
nop
and %r9, %r9
movw $0x5152, (%rsi)
// Exception!!!
nop
nop
nop
nop
nop
mov (0), %rsi
nop
nop
nop
and $50687, %r8
// Store
lea addresses_normal+0xbe94, %rsi
nop
nop
nop
nop
xor %r11, %r11
movb $0x51, (%rsi)
nop
nop
nop
nop
sub %r11, %r11
// Store
lea addresses_PSE+0x11e42, %r10
nop
nop
nop
nop
nop
sub %r13, %r13
mov $0x5152535455565758, %r14
movq %r14, %xmm3
vmovups %ymm3, (%r10)
nop
nop
nop
nop
and $48276, %r14
// Store
lea addresses_D+0x1dc34, %r14
nop
nop
nop
inc %r10
movl $0x51525354, (%r14)
nop
nop
xor %r13, %r13
// Store
lea addresses_US+0x19e2c, %r8
nop
cmp $8227, %rsi
movl $0x51525354, (%r8)
nop
nop
and $2105, %r14
// Faulty Load
lea addresses_normal+0xc234, %r13
nop
sub %r9, %r9
movb (%r13), %r8b
lea oracles, %r14
and $0xff, %r8
shlq $12, %r8
mov (%r14,%r8,1), %r8
pop %rsi
pop %r9
pop %r8
pop %r14
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'same': False, 'size': 8, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_A', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC', 'same': False, 'size': 4, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_NC', 'same': False, 'size': 1, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_P', 'same': False, 'size': 16, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_NC', 'same': False, 'size': 2, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_normal', 'same': False, 'size': 1, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_PSE', 'same': False, 'size': 32, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_D', 'same': False, 'size': 4, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_US', 'same': False, 'size': 4, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 16, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': True}, 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'same': True, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 8, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal_ht', 'same': True, 'size': 8, 'congruent': 7, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'52': 21829}
52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52
*/
| 28.726287 | 2,999 | 0.655849 |
e7087384cc50497243a3c3f792b7a298297c4813 | 2,115 | asm | Assembly | Transynther/x86/_processed/US/_un_/i9-9900K_12_0xa0.log_4_945.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/US/_un_/i9-9900K_12_0xa0.log_4_945.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/US/_un_/i9-9900K_12_0xa0.log_4_945.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r14
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x18230, %r10
add %r11, %r11
mov (%r10), %r13d
nop
nop
cmp %r10, %r10
lea addresses_A_ht+0x1d9a0, %rbx
nop
nop
add $33157, %r10
mov (%rbx), %r14w
nop
nop
nop
nop
dec %r10
lea addresses_A_ht+0x15270, %rsi
lea addresses_WC_ht+0x1c578, %rdi
nop
nop
nop
dec %rbx
mov $87, %rcx
rep movsb
nop
mfence
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r14
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r14
push %rbx
push %rcx
push %rdi
// Store
lea addresses_D+0x1ffb2, %r12
cmp %r14, %r14
movl $0x51525354, (%r12)
nop
nop
nop
nop
sub %r13, %r13
// Store
mov $0x890, %rcx
nop
nop
nop
nop
nop
add %r10, %r10
movw $0x5152, (%rcx)
nop
nop
nop
nop
dec %rdi
// Faulty Load
lea addresses_US+0x5d90, %r14
nop
cmp $38486, %r13
vmovups (%r14), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $0, %xmm1, %r10
lea oracles, %r12
and $0xff, %r10
shlq $12, %r10
mov (%r12,%r10,1), %r10
pop %rdi
pop %rcx
pop %rbx
pop %r14
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_D', 'AVXalign': False, 'size': 4}}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 7, 'type': 'addresses_P', 'AVXalign': False, 'size': 2}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': False, 'same': True, 'congruent': 5, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'src': {'same': True, 'congruent': 4, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 2, 'type': 'addresses_WC_ht'}}
{'7a': 1, 'da': 1, '77': 2}
77 77 7a da
*/
| 18.076923 | 145 | 0.641135 |
9b93bec49819c6a1460e2e16eedb392a9eba40e5 | 2,720 | asm | Assembly | loaders_patches_etc/screen_liquid+.asm | alexanderbazhenoff/zx-spectrum-various | 80cf61cb8cc6f9b5b1cd6ce9b0e394323afe346e | [
"MIT"
] | null | null | null | loaders_patches_etc/screen_liquid+.asm | alexanderbazhenoff/zx-spectrum-various | 80cf61cb8cc6f9b5b1cd6ce9b0e394323afe346e | [
"MIT"
] | null | null | null | loaders_patches_etc/screen_liquid+.asm | alexanderbazhenoff/zx-spectrum-various | 80cf61cb8cc6f9b5b1cd6ce9b0e394323afe346e | [
"MIT"
] | null | null | null | ORG #6000
DI
LD HL,#AE00
LD A,H
LD I,A
INC A
LD B,L
INTR_L LD (HL),A
INC HL
DJNZ INTR_L
LD (HL),A
LD H,A
LD L,A
LD A,#C9
LD (HL),A
IM 2
EI
LD DE,SCREEN
LD HL,#C000+#20
LD BC,#C020
LOOP PUSH BC
PUSH HL
LOOP1 LD A,(DE)
LD (HL),A
INC DE
PUSH BC
LD BC,#20
ADD HL,BC
POP BC
DJNZ LOOP1
POP HL
POP BC
DEC HL
DEC C
JR NZ,LOOP
JMP2 LD HL,ATRIB
LD DE,#D800
LD BC,#300
LDIR
LD HL,#DAE0
LD BC,#1801
EXX
LD DE,#D800
LD HL,#401F
LD BC,#C0C0
PUTLOOP EI
HALT
DI
PUSH BC
LD BC,#0566
PAUS DEC C
JR NZ,PAUS
DJNZ PAUS
POP BC
EXX
DEC C
JR NZ,NOADD
PUSH BC
LD DE,#5800
PUSH HL
PUTL1 PUSH HL
PUSH BC
LD BC,#20
LDIR
POP BC
POP HL
DJNZ PUTL1
POP HL
LD C,#20
OR A
SBC HL,BC
POP BC
DEC B
LD C,8
NOADD EXX
; JR JOPA
CALL STEKPSH
PUSH BC
PUSH DE
PUSH HL
PUTL2 PUSH BC
PUSH HL
INC HL
CALL STEKOUT
POP HL
INC H
LD A,H
AND 7
JR NZ,ASDFG
LD A,L
ADD A,#20
LD L,A
JR C,ASDFG
LD A,H
SUB 8
LD H,A
ASDFG POP BC
DJNZ PUTL2
POP HL
POP DE
EX DE,HL
OR A
LD C,#20
SBC HL,BC
EX DE,HL
POP BC
JOPA
DEC B
DEC C
JR NZ,PUTLOOP
DI
LD A,#3F
LD I,A
IM 1
LD HL,#2758
EXX
EI
RET
STEKOUT LD (STEK+1),SP
LD SP,HL
DUP 16
LD HL,#2121
PUSH HL
EDUP
PUTDATA EQU $-2
LD (REG_HL+1),SP
REG_HL LD HL,#2121
STEK LD SP,#3131
RET
STEKPSH EX DE,HL
PUSH DE
PUSH HL
PUSH BC
LD DE,PUTDATA
DUP 15
LD B,(HL)
DEC HL
LD A,(HL)
DEC HL
LD (DE),A
DEC DE
LD A,B
LD (DE),A
DEC DE
DEC DE
DEC DE
EDUP
LD B,(HL)
DEC HL
LD A,(HL)
DEC HL
LD (DE),A
DEC DE
LD A,B
LD (DE),A
DEC DE
DEC DE
DEC DE
POP BC
POP HL
POP DE
EX DE,HL
RET
SCREEN INCBIN "PICTURE"
ATRIB EQU $-#300
ENDCODE
| 15.280899 | 24 | 0.376838 |
82fada94ea6c2fa287e924e4fa54bf76360cbe70 | 1,138 | asm | Assembly | Assembly/Project/Spc700/pl3.asm | Myself086/Project-Nested | 89153325af8e5e2d443994352eae60ad06ed5922 | [
"MIT"
] | 338 | 2020-07-26T23:26:20.000Z | 2022-03-31T15:26:49.000Z | Assembly/Project/Spc700/pl3-2.asm | Myself086/Project-Nested | 89153325af8e5e2d443994352eae60ad06ed5922 | [
"MIT"
] | 47 | 2020-08-08T10:21:02.000Z | 2022-03-30T16:28:35.000Z | Assembly/Project/Spc700/pl3.asm | Myself086/Project-Nested | 89153325af8e5e2d443994352eae60ad06ed5922 | [
"MIT"
] | 8 | 2020-08-10T19:04:09.000Z | 2021-09-27T07:25:02.000Z |
// Old
//.db 0xB0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44
//.db 0xB0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44
//.db 0xB0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44
//.db 0xB0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44
//.db 0xB0,0xBB,0xBB,0xBB,0xBB,0xBB,0xBB,0xBB,0xBB
//.db 0xB0,0xBB,0xBB,0xBB,0xBB,0xBB,0xBB,0xBB,0xBB
//.db 0xB0,0xBB,0xBB,0xBB,0xBB,0xBB,0xBB,0xBB,0xBB
//.db 0xB3,0xBB,0xBB,0xBB,0xBB,0xBB,0xBB,0xBB,0xBB
// New
// [b0] 5444444444444444
// [b0] 4444444444444444
// [b0] 4444444444444444
// [b0] 4444444444444444
// [b0] abbbbbbbbbbbbbbb
// [b0] bbbbbbbbbbbbbbbb
// [b0] bbbbbbbbbbbbbbbb
// [b3] bbbbbbbbbbbbbbbb
.db 0xb0, 0x54, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44
.db 0xb0, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44
.db 0xb0, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44
.db 0xb0, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44
.db 0xb0, 0xab, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb
.db 0xb0, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb
.db 0xb0, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb
.db 0xb3, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb
| 39.241379 | 57 | 0.666081 |
9655f481717571bbb8ac057aafb57dd8e1f407e7 | 1,959 | asm | Assembly | programs/oeis/017/A017167.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/017/A017167.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/017/A017167.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A017167: a(n) = (9*n)^7.
; 0,4782969,612220032,10460353203,78364164096,373669453125,1338925209984,3938980639167,10030613004288,22876792454961,47829690000000,93206534790699,171382426877952,300124211606973,504189521813376,817215093984375,1283918464548864,1962637152460137,2928229434235008,4275360817613091,6122200320000000,8614550657858229,11930436453209472,16285174563412143,21936950640377856,29192926025390625,38415899085692544,50031545098999707,64536258792112128,82505623639781421,104603532030000000,131591980401875559,164341563462254592,203842691587258713,251217555514897536,307732862434921875,374813367582081024,454056225438947877,547246184654475648,656371650784449951,783641640960000000,931503654590332689,1102662484205853312,1300099990547836683,1527095866010812416,1787249410543828125,2084502344116754304,2423162679857794647,2807929681968365568,3243919932521508681,3736694531250000000,4292287452430319619,4917235082968645632,5618606965795036053,6404037772671962496,7281760530523359375,8260641125390352384,9350214108119830017,10560719825892021888,11903142903693247611,13389252099840000000,15031641559660526349,16843773491440071552,18840022288735946823,21035720123168587776,23447204031794765625,26091864523169115264,28988195726200143987,32155847105906884608,35615676770182356741,39389806391670000000,43501677768859242879,47976111050506371072,52839364647486858993,58119196856185328256,63844929217529296875,70047511635772882944,76759589281136626557,84015571300409593728,91851701359619926071,100306130042880000000,109418989131512359209,119232467787562584192,129790890665805262563,141140797978349223936,153331027535948203125,166412798790123095424,180439798900201967727,195468270849383989248,211557103633933445601,228767924549610000000,247165193599441365339,266816300046944550912,287791661138901847533,310164823021797714816,334012563876022734375,359414999291950792704,386455689911995657497,415221751362753111168,445803966501334805331
pow $0,7
mul $0,4782969
| 326.5 | 1,906 | 0.935681 |
2b1788dea2da7188f7f13c9fc04a38df01965c01 | 357 | asm | Assembly | programs/oeis/070/A070376.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/070/A070376.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/070/A070376.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A070376: a(n) = 5^n mod 26.
; 1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21
mov $1,1
mov $2,$0
lpb $2
mul $1,5
mod $1,52
sub $2,1
lpe
mov $0,$1
| 29.75 | 251 | 0.571429 |
a9b1c4bb9d0f048f29da5d1981b111b0dc337d0d | 388 | asm | Assembly | oeis/103/A103589.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/103/A103589.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/103/A103589.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A103589: 1's complement of A103583.
; Submitted by Christian Krause
; 0,0,1,0,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0
mov $1,$0
seq $1,103583 ; Same as A103582, but read antidiagonals in upward direction.
mov $0,$1
add $0,1
mod $0,2
| 38.8 | 201 | 0.603093 |
eb1dff78ab2eceabdf85487061823e6a3ce97f4b | 5,382 | asm | Assembly | books_and_notes/professional_courses/operating_system/sources/extra_books/Orange'S:自己动手写操作系统光盘源代码/chapter3/f/pmtest6.asm | gxw1/review_the_national_post-graduate_entrance_examination | 8812779a7a4ce185a531d120562d5194b697c0c9 | [
"MIT"
] | 640 | 2019-03-30T11:32:43.000Z | 2022-03-31T14:05:18.000Z | books_and_notes/professional_courses/operating_system/sources/extra_books/Orange'S:自己动手写操作系统光盘源代码/chapter3/f/pmtest6.asm | yyzVegst/review_the_national_post-graduate_entrance_examination | 8812779a7a4ce185a531d120562d5194b697c0c9 | [
"MIT"
] | 6 | 2019-07-22T01:57:24.000Z | 2022-01-20T15:03:16.000Z | books_and_notes/professional_courses/operating_system/sources/extra_books/Orange'S:自己动手写操作系统光盘源代码/chapter3/f/pmtest6.asm | yyzVegst/review_the_national_post-graduate_entrance_examination | 8812779a7a4ce185a531d120562d5194b697c0c9 | [
"MIT"
] | 212 | 2019-04-10T02:31:50.000Z | 2022-03-30T02:32:47.000Z | ; ==========================================
; pmtest6.asm
; 编译方法:nasm pmtest6.asm -o pmtest6.com
; ==========================================
%include "pm.inc" ; 常量, 宏, 以及一些说明
PageDirBase equ 200000h ; 页目录开始地址: 2M
PageTblBase equ 201000h ; 页表开始地址: 2M+4K
org 0100h
jmp LABEL_BEGIN
[SECTION .gdt]
; GDT
; 段基址, 段界限, 属性
LABEL_GDT: Descriptor 0, 0, 0 ; 空描述符
LABEL_DESC_NORMAL: Descriptor 0, 0ffffh, DA_DRW ; Normal 描述符
LABEL_DESC_PAGE_DIR: Descriptor PageDirBase, 4095, DA_DRW;Page Directory
LABEL_DESC_PAGE_TBL: Descriptor PageTblBase, 1023, DA_DRW|DA_LIMIT_4K;Page Tables
LABEL_DESC_CODE32: Descriptor 0, SegCode32Len-1, DA_C+DA_32 ; 非一致代码段, 32
LABEL_DESC_CODE16: Descriptor 0, 0ffffh, DA_C ; 非一致代码段, 16
LABEL_DESC_DATA: Descriptor 0, DataLen-1, DA_DRW ; Data
LABEL_DESC_STACK: Descriptor 0, TopOfStack, DA_DRWA + DA_32 ; Stack, 32 位
LABEL_DESC_VIDEO: Descriptor 0B8000h, 0ffffh, DA_DRW ; 显存首地址
; GDT 结束
GdtLen equ $ - LABEL_GDT ; GDT长度
GdtPtr dw GdtLen - 1 ; GDT界限
dd 0 ; GDT基地址
; GDT 选择子
SelectorNormal equ LABEL_DESC_NORMAL - LABEL_GDT
SelectorPageDir equ LABEL_DESC_PAGE_DIR - LABEL_GDT
SelectorPageTbl equ LABEL_DESC_PAGE_TBL - LABEL_GDT
SelectorCode32 equ LABEL_DESC_CODE32 - LABEL_GDT
SelectorCode16 equ LABEL_DESC_CODE16 - LABEL_GDT
SelectorData equ LABEL_DESC_DATA - LABEL_GDT
SelectorStack equ LABEL_DESC_STACK - LABEL_GDT
SelectorVideo equ LABEL_DESC_VIDEO - LABEL_GDT
; END of [SECTION .gdt]
[SECTION .data1] ; 数据段
ALIGN 32
[BITS 32]
LABEL_DATA:
SPValueInRealMode dw 0
; 字符串
PMMessage: db "In Protect Mode now. ^-^", 0 ; 进入保护模式后显示此字符串
OffsetPMMessage equ PMMessage - $$
DataLen equ $ - LABEL_DATA
; END of [SECTION .data1]
; 全局堆栈段
[SECTION .gs]
ALIGN 32
[BITS 32]
LABEL_STACK:
times 512 db 0
TopOfStack equ $ - LABEL_STACK - 1
; END of [SECTION .gs]
[SECTION .s16]
[BITS 16]
LABEL_BEGIN:
mov ax, cs
mov ds, ax
mov es, ax
mov ss, ax
mov sp, 0100h
mov [LABEL_GO_BACK_TO_REAL+3], ax
mov [SPValueInRealMode], sp
; 初始化 16 位代码段描述符
mov ax, cs
movzx eax, ax
shl eax, 4
add eax, LABEL_SEG_CODE16
mov word [LABEL_DESC_CODE16 + 2], ax
shr eax, 16
mov byte [LABEL_DESC_CODE16 + 4], al
mov byte [LABEL_DESC_CODE16 + 7], ah
; 初始化 32 位代码段描述符
xor eax, eax
mov ax, cs
shl eax, 4
add eax, LABEL_SEG_CODE32
mov word [LABEL_DESC_CODE32 + 2], ax
shr eax, 16
mov byte [LABEL_DESC_CODE32 + 4], al
mov byte [LABEL_DESC_CODE32 + 7], ah
; 初始化数据段描述符
xor eax, eax
mov ax, ds
shl eax, 4
add eax, LABEL_DATA
mov word [LABEL_DESC_DATA + 2], ax
shr eax, 16
mov byte [LABEL_DESC_DATA + 4], al
mov byte [LABEL_DESC_DATA + 7], ah
; 初始化堆栈段描述符
xor eax, eax
mov ax, ds
shl eax, 4
add eax, LABEL_STACK
mov word [LABEL_DESC_STACK + 2], ax
shr eax, 16
mov byte [LABEL_DESC_STACK + 4], al
mov byte [LABEL_DESC_STACK + 7], ah
; 为加载 GDTR 作准备
xor eax, eax
mov ax, ds
shl eax, 4
add eax, LABEL_GDT ; eax <- gdt 基地址
mov dword [GdtPtr + 2], eax ; [GdtPtr + 2] <- gdt 基地址
; 加载 GDTR
lgdt [GdtPtr]
; 关中断
cli
; 打开地址线A20
in al, 92h
or al, 00000010b
out 92h, al
; 准备切换到保护模式
mov eax, cr0
or eax, 1
mov cr0, eax
; 真正进入保护模式
jmp dword SelectorCode32:0 ; 执行这一句会把 SelectorCode32 装入 cs, 并跳转到 Code32Selector:0 处
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LABEL_REAL_ENTRY: ; 从保护模式跳回到实模式就到了这里
mov ax, cs
mov ds, ax
mov es, ax
mov ss, ax
mov sp, [SPValueInRealMode]
in al, 92h ; ┓
and al, 11111101b ; ┣ 关闭 A20 地址线
out 92h, al ; ┛
sti ; 开中断
mov ax, 4c00h ; ┓
int 21h ; ┛回到 DOS
; END of [SECTION .s16]
[SECTION .s32]; 32 位代码段. 由实模式跳入.
[BITS 32]
LABEL_SEG_CODE32:
call SetupPaging
mov ax, SelectorData
mov ds, ax ; 数据段选择子
mov ax, SelectorVideo
mov gs, ax ; 视频段选择子
mov ax, SelectorStack
mov ss, ax ; 堆栈段选择子
mov esp, TopOfStack
; 下面显示一个字符串
mov ah, 0Ch ; 0000: 黑底 1100: 红字
xor esi, esi
xor edi, edi
mov esi, OffsetPMMessage ; 源数据偏移
mov edi, (80 * 10 + 0) * 2 ; 目的数据偏移。屏幕第 10 行, 第 0 列。
cld
.1:
lodsb
test al, al
jz .2
mov [gs:edi], ax
add edi, 2
jmp .1
.2: ; 显示完毕
; 到此停止
jmp SelectorCode16:0
; 启动分页机制 --------------------------------------------------------------
SetupPaging:
; 为简化处理, 所有线性地址对应相等的物理地址.
; 首先初始化页目录
mov ax, SelectorPageDir ; 此段首地址为 PageDirBase
mov es, ax
mov ecx, 1024 ; 共 1K 个表项
xor edi, edi
xor eax, eax
mov eax, PageTblBase | PG_P | PG_USU | PG_RWW
.1:
stosd
add eax, 4096 ; 为了简化, 所有页表在内存中是连续的.
loop .1
; 再初始化所有页表 (1K 个, 4M 内存空间)
mov ax, SelectorPageTbl ; 此段首地址为 PageTblBase
mov es, ax
mov ecx, 1024 * 1024 ; 共 1M 个页表项, 也即有 1M 个页
xor edi, edi
xor eax, eax
mov eax, PG_P | PG_USU | PG_RWW
.2:
stosd
add eax, 4096 ; 每一页指向 4K 的空间
loop .2
mov eax, PageDirBase
mov cr3, eax
mov eax, cr0
or eax, 80000000h
mov cr0, eax
jmp short .3
.3:
nop
ret
; 分页机制启动完毕 ----------------------------------------------------------
SegCode32Len equ $ - LABEL_SEG_CODE32
; END of [SECTION .s32]
; 16 位代码段. 由 32 位代码段跳入, 跳出后到实模式
[SECTION .s16code]
ALIGN 32
[BITS 16]
LABEL_SEG_CODE16:
; 跳回实模式:
mov ax, SelectorNormal
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
mov eax, cr0
and eax, 7FFFFFFEh ; PE=0, PG=0
mov cr0, eax
LABEL_GO_BACK_TO_REAL:
jmp 0:LABEL_REAL_ENTRY ; 段地址会在程序开始处被设置成正确的值
Code16Len equ $ - LABEL_SEG_CODE16
; END of [SECTION .s16code]
| 20.007435 | 87 | 0.645857 |
5826fc70f203f77471c631c20af77ad087d308f0 | 2,902 | asm | Assembly | reverse-linked-list/utils.asm | undead-carbon/fizzy-buzzer | 956afc62cbefb9e373480bed2d42270a8cc49206 | [
"Unlicense"
] | null | null | null | reverse-linked-list/utils.asm | undead-carbon/fizzy-buzzer | 956afc62cbefb9e373480bed2d42270a8cc49206 | [
"Unlicense"
] | null | null | null | reverse-linked-list/utils.asm | undead-carbon/fizzy-buzzer | 956afc62cbefb9e373480bed2d42270a8cc49206 | [
"Unlicense"
] | 1 | 2021-10-30T05:55:47.000Z | 2021-10-30T05:55:47.000Z | ; Utilities for reverselinkedlist.asm
STDIN equ 0
STDOUT equ 1
STDERR equ 2
; 16*8 = 128 bits (64 val + 64 addr)
NODESIZE equ 16
; exit(0)
_exit:
mov rax, 60
mov rdi, 0
syscall
ret
; convert the string in rax to an int & store in number
_atoi:
mov r11, rax
call _clrNum
; used to build up the integer
; rax is the only reg used by mul
xor rax, rax
; constant 10 because mul doesn't allow operand to be a value o.O
mov r13, 10
loop1_:
xor r12, r12
mov r12b, [r11]
cmp r12b, 0
je loop1_end
cmp r12b, 10
je loop1_end
sub r12, 48 ; conversion from ascii
inc r11
mul r13
add rax, r12
jmp loop1_
loop1_end:
mov [number], rax
ret
; clear the number buffer by setting it to all zeros
_clrNum:
push rax
xor rax, rax
mov qword [number], rax
pop rax
ret
; convert value in rax to string and store in buffer
_itoa:
; modulus
mov r10, 10
; number of chars
mov r11, 0
; place digits onto stack
loop2_:
mov rdx, 0
idiv r10
push rdx
inc r11
cmp rax, 0
jne loop2_
; addr of next write loc in buffer
mov r10, buffer
; pop off chars and move to buffer
loop3_:
pop r12
add r12, 48 ; convert to ascii repr
mov [r10], r12 ; write to buffer
inc r10
dec r11
cmp r11, 0
jne loop3_
mov r12, 0
mov [r10], r12 ; the delimiter
ret
; print the text pointed to by rax. Delimited by 0
_print:
push rax ; start of the string
mov r10, 0 ; string length
loop_:
mov bl, [rax]
cmp bl, 0
je loop_end
inc rax
inc r10
jmp loop_
loop_end:
mov rax, 1
mov rdi, 1
pop rsi
mov rdx, r10
syscall
ret
%macro println 0
call _print
mov rax, newline
call _print
%endmacro
%macro movPtr 2
push rbx
mov qword rbx, %2
mov qword %1, rbx
pop rbx
%endmacro
; literally the same thing as movPtr but renamed so that it gives the correct idea to the reader (yes, me)
%macro movVal 2
push rbx
mov qword rbx, %2
mov qword %1, rbx
pop rbx
%endmacro
; specifically to do dst = src->next
%macro movNxt 2
push rbx
mov qword rbx, %2 ; get addr
lea rbx, [rbx+8] ; shift
mov qword rbx, [rbx] ; get loc pointed to by next
mov qword %1, rbx ; put loc into dest
pop rbx
%endmacro
; specifically to do dst->next = src
%macro movNxtAlt 2
push rbx
mov qword rbx, %1
lea rbx, [rbx+8]
push rdx
mov qword rdx, %2
mov qword [rbx], rdx
pop rdx
pop rbx
%endmacro
%macro cmpPtr 2
push r14
push r15
mov r14, %1
mov r15, %2
cmp r14, r15
pop r15
pop r14
%endmacro
; given the address of the node print its value
%macro printNode 1
push rax
push rdx
mov qword rax, %1
mov qword rax, [rax]
call _itoa
mov rax, buffer
call _print
mov rax, space
call _print
pop rdx
pop rax
%endmacro
; clear the buffer by setting it to all zeros
_clrBuf:
push rax
mov al, 0
mov rsi, buffer
mov rdi, buffer
add rdi, 16
stosb
pop rax
ret
; get the number from stdin and store it in buffer
_getInput:
call _clrBuf
mov rax, 0
mov rdi, 0
mov rsi, buffer
syscall
ret
| 15.518717 | 106 | 0.694693 |
108cf2c898e7e180718eea7ed88d7237c9738381 | 591 | asm | Assembly | oeis/271/A271390.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/271/A271390.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/271/A271390.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A271390: a(n) = (2*n + 1)^(2*floor((n-1)/2) + 1).
; 1,3,5,343,729,161051,371293,170859375,410338673,322687697779,794280046581,952809757913927,2384185791015625,4052555153018976267,10260628712958602189,23465261991844685929951,59938945498865420543457,177482997121587371826171875,456487940826035155404146917,1699133621328831977374894383159,4394336169668803158610484050361,20083415214428110320965436874242043,52175039830928973774433135986328125,287243845682065590744605010781602099023,749048330965186233494494102694564493649
mov $1,$0
sub $2,$0
sub $2,1
sub $0,$2
mod $2,2
add $1,$2
pow $0,$1
| 53.727273 | 469 | 0.846024 |
362872094f82bf1f0688506172c5ca9caff501f3 | 1,434 | asm | Assembly | programs/oeis/022/A022386.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/022/A022386.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/022/A022386.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A022386: Fibonacci sequence beginning 4, 26.
; 4,26,30,56,86,142,228,370,598,968,1566,2534,4100,6634,10734,17368,28102,45470,73572,119042,192614,311656,504270,815926,1320196,2136122,3456318,5592440,9048758,14641198,23689956,38331154,62021110,100352264,162373374,262725638,425099012,687824650,1112923662,1800748312,2913671974,4714420286,7628092260,12342512546,19970604806,32313117352,52283722158,84596839510,136880561668,221477401178,358357962846,579835364024,938193326870,1518028690894,2456222017764,3974250708658,6430472726422,10404723435080,16835196161502,27239919596582,44075115758084,71315035354666,115390151112750,186705186467416,302095337580166,488800524047582,790895861627748,1279696385675330,2070592247303078,3350288632978408,5420880880281486,8771169513259894,14192050393541380,22963219906801274,37155270300342654,60118490207143928,97273760507486582,157392250714630510,254666011222117092,412058261936747602,666724273158864694,1078782535095612296,1745506808254476990,2824289343350089286,4569796151604566276,7394085494954655562,11963881646559221838,19357967141513877400,31321848788073099238,50679815929586976638,82001664717660075876,132681480647247052514,214683145364907128390,347364626012154180904,562047771377061309294,909412397389215490198,1471460168766276799492,2380872566155492289690,3852332734921769089182,6233205301077261378872
seq $0,22326 ; a(n) = a(n-1) + a(n-2) + 1, with a(0) = 1 and a(1) = 12.
add $0,1
mul $0,2
| 204.857143 | 1,295 | 0.887029 |
8698b820b0195cd3bf3f6ba66aa0611f1498e87c | 999 | asm | Assembly | programs/oeis/324/A324377.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/324/A324377.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/324/A324377.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A324377: a(0) = 0; for n > 0, a(n) = A000265(A005187(n)).
; 0,1,3,1,7,1,5,11,15,1,9,19,11,23,25,13,31,1,17,35,19,39,41,21,23,47,49,25,53,27,7,57,63,1,33,67,35,71,73,37,39,79,81,41,85,43,11,89,47,95,97,49,101,51,13,105,109,55,7,113,29,117,119,15,127,1,65,131,67,135,137,69,71,143,145,73,149,75,19,153,79,159,161,81,165,83,21,169,173,87,11,177,45,181,183,23,95,191,193,97,197,99,25,201,205,103,13,209,53,213,215,27,221,111,7,225,57,229,231,29,59,237,239,15,243,61,123,247,255,1,129,259,131,263,265,133,135,271,273,137,277,139,35,281,143,287,289,145,293,147,37,297,301,151,19,305,77,309,311,39,159,319,321,161,325,163,41,329,333,167,21,337,85,341,343,43,349,175,11,353,89,357,359,45,91,365,367,23,371,93,187,375,191,383,385,193,389,195,49,393,397,199,25,401,101,405,407,51,413,207,13,417,105,421,423,53,107,429,431,27,435,109,219,439,445,223,7,449,113,453,455,57,115,461,463,29,467,117,235,471,119,477,479,15,483,121,243,487,491,123
mov $2,$0
lpb $2
add $1,$2
div $2,2
lpe
lpb $1
dif $1,2
lpe
| 83.25 | 871 | 0.686687 |
ae1918080f697b7c1505ea58f5d3b93f0b8a720b | 1,881 | asm | Assembly | docs/www.playvectrex.com/designit/chrissalo/dot1.asm | mikepea/vectrex-playground | 0de7d2d6db0914d915f4334402f747ab3bcdc7e6 | [
"0BSD"
] | 5 | 2018-01-14T10:03:50.000Z | 2020-01-17T13:53:49.000Z | docs/www.playvectrex.com/designit/chrissalo/dot1.asm | mikepea/vectrex-playground | 0de7d2d6db0914d915f4334402f747ab3bcdc7e6 | [
"0BSD"
] | null | null | null | docs/www.playvectrex.com/designit/chrissalo/dot1.asm | mikepea/vectrex-playground | 0de7d2d6db0914d915f4334402f747ab3bcdc7e6 | [
"0BSD"
] | null | null | null | ;***************************************************************************
; DEFINE SECTION
;***************************************************************************
INCLUDE "VECTREX.I" ; vectrex function includes
; start of vectrex memory with cartridge name...
ORG 0
;***************************************************************************
; HEADER SECTION
;***************************************************************************
DB "g GCE 1998", $80 ; 'g' is copyright sign
DW music1 ; music from the rom
DB $F8, $50, $20, -$56 ; height, width, rel y, rel x
; (from 0,0)
DB "PLOT A DOT",$80 ; some game information,
; ending with $80
DB 0 ; end of game header
;***************************************************************************
; CODE SECTION
;***************************************************************************
; here the cartridge program starts off
main:
JSR Wait_Recal ; Vectrex BIOS recalibration
JSR Intensity_5F ; Sets the intensity of the
; vector beam to $5f
; special attention here!!!
JSR Dot_here ; Plot a dot at the center of
; the screen
BRA main ; and repeat forever
;***************************************************************************
END main
;***************************************************************************
| 58.78125 | 78 | 0.253589 |
0415a31fd0dff5596ce57659b7540decc6767dc1 | 693 | asm | Assembly | src/core/asm/x86/inst_0x0ff0.asm | Hiroshi123/bin_tools | 95929eb218a82e30c43ee5bd209301a24abebffa | [
"MIT"
] | null | null | null | src/core/asm/x86/inst_0x0ff0.asm | Hiroshi123/bin_tools | 95929eb218a82e30c43ee5bd209301a24abebffa | [
"MIT"
] | 4 | 2019-02-27T05:41:26.000Z | 2020-07-16T00:24:24.000Z | src/core/asm/x86/inst_0x0ff0.asm | Hiroshi123/bin_tools | 95929eb218a82e30c43ee5bd209301a24abebffa | [
"MIT"
] | null | null | null |
default rel
section .text
global _0x0ff0_lddqu
global _0x0ff1_psllw
global _0x0ff2_pslld
global _0x0ff3_psllq
global _0x0ff4_pmuludq
global _0x0ff5_pmaddwd
global _0x0ff6_psadbw
global _0x0ff7_maskmov
global _0x0ff8_psubb
global _0x0ff9_psubw
global _0x0ffa_psubd
global _0x0ffb_psubq
global _0x0ffc_paddb
global _0x0ffd_paddw
global _0x0ffe_paddd
global _0x0fff
%include "extern_for_inst.asm"
_0x0ff0_lddqu:
_0x0ff1_psllw:
_0x0ff2_pslld:
_0x0ff3_psllq:
_0x0ff4_pmuludq:
_0x0ff5_pmaddwd:
_0x0ff6_psadbw:
_0x0ff7_maskmov:
_0x0ff8_psubb:
_0x0ff9_psubw:
_0x0ffa_psubd:
_0x0ffb_psubq:
_0x0ffc_paddb:
_0x0ffd_paddw:
_0x0ffe_paddd:
_0x0fff:
db 0xeb,0xfe
| 15.75 | 30 | 0.822511 |
9bf83348f9dff4388fe95c3e1ff8ac6c9b1a68ca | 465 | asm | Assembly | programs/oeis/123/A123128.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/123/A123128.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/123/A123128.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A123128: Add n to the n-th difference between consecutive primes.
; 2,4,5,8,7,10,9,12,15,12,17,16,15,18,21,22,19,24,23,22,27,26,29,32,29,28,31,30,33,44,35,38,35,44,37,42,43,42,45,46,43,52,45,48,47,58,59,52,51,54,57,54,63,60,61,62,59,64,63,62,71,76,67,66,69,80,73,78,71,74,77,80,79,80,79,82,85,82,87,90,83,92,85,90,89,92,95,92,91,94,103,100,97,102,99,102,109,100,117,106
mov $1,$0
seq $1,46933 ; Number of composites between successive primes.
add $0,$1
add $0,2
| 58.125 | 303 | 0.688172 |
cb5fdcc011d2217828896a5d586ff45cfc66ef46 | 623 | asm | Assembly | oeis/137/A137505.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/137/A137505.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/137/A137505.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A137505: Inverse binomial transform of A007910.
; 1,1,0,2,0,0,4,-4,4,4,-12,20,-12,-12,52,-76,52,52,-204,308,-204,-204,820,-1228,820,820,-3276,4916,-3276,-3276,13108,-19660,13108,13108,-52428,78644,-52428,-52428,209716,-314572,209716,209716,-838860,1258292,-838860,-838860,3355444,-5033164,3355444,3355444,-13421772,20132660,-13421772,-13421772,53687092,-80530636,53687092,53687092,-214748364,322122548,-214748364,-214748364,858993460,-1288490188,858993460,858993460,-3435973836,5153960756,-3435973836,-3435973836,13743895348,-20615843020,13743895348
add $0,2
seq $0,77973 ; Expansion of 1/(1+x-2*x^3).
add $0,3
div $0,4
| 77.875 | 501 | 0.76244 |
9859c2811de0a39bb5bbb340f53e85564445ebec | 711 | asm | Assembly | oeis/100/A100168.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/100/A100168.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/100/A100168.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A100168: Structured pentagonal icositetrahedral numbers (vertex structure 10).
; Submitted by Jamie Morken(s2)
; 1,38,174,472,995,1806,2968,4544,6597,9190,12386,16248,20839,26222,32460,39616,47753,56934,67222,78680,91371,105358,120704,137472,155725,175526,196938,220024,244847,271470,299956,330368,362769,397222,433790,472536,513523,556814,602472,650560,701141,754278,810034,868472,929655,993646,1060508,1130304,1203097,1278950,1357926,1440088,1525499,1614222,1706320,1801856,1900893,2003494,2109722,2219640,2333311,2450798,2572164,2697472,2826785,2960166,3097678,3239384,3385347,3535630,3690296,3849408,4013029
mul $0,6
add $0,2
mov $2,$0
mov $3,$0
add $0,4
mul $0,7
add $0,2
mul $2,$3
mul $0,$2
div $0,144
| 47.4 | 500 | 0.800281 |
9fc3d6ded8b3b8829e339329b15b06cf4d8da2a6 | 1,834 | asm | Assembly | programs/oeis/158/A158479.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/158/A158479.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/158/A158479.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A158479: 36n^2 + 6.
; 42,150,330,582,906,1302,1770,2310,2922,3606,4362,5190,6090,7062,8106,9222,10410,11670,13002,14406,15882,17430,19050,20742,22506,24342,26250,28230,30282,32406,34602,36870,39210,41622,44106,46662,49290,51990,54762,57606,60522,63510,66570,69702,72906,76182,79530,82950,86442,90006,93642,97350,101130,104982,108906,112902,116970,121110,125322,129606,133962,138390,142890,147462,152106,156822,161610,166470,171402,176406,181482,186630,191850,197142,202506,207942,213450,219030,224682,230406,236202,242070,248010,254022,260106,266262,272490,278790,285162,291606,298122,304710,311370,318102,324906,331782,338730,345750,352842,360006,367242,374550,381930,389382,396906,404502,412170,419910,427722,435606,443562,451590,459690,467862,476106,484422,492810,501270,509802,518406,527082,535830,544650,553542,562506,571542,580650,589830,599082,608406,617802,627270,636810,646422,656106,665862,675690,685590,695562,705606,715722,725910,736170,746502,756906,767382,777930,788550,799242,810006,820842,831750,842730,853782,864906,876102,887370,898710,910122,921606,933162,944790,956490,968262,980106,992022,1004010,1016070,1028202,1040406,1052682,1065030,1077450,1089942,1102506,1115142,1127850,1140630,1153482,1166406,1179402,1192470,1205610,1218822,1232106,1245462,1258890,1272390,1285962,1299606,1313322,1327110,1340970,1354902,1368906,1382982,1397130,1411350,1425642,1440006,1454442,1468950,1483530,1498182,1512906,1527702,1542570,1557510,1572522,1587606,1602762,1617990,1633290,1648662,1664106,1679622,1695210,1710870,1726602,1742406,1758282,1774230,1790250,1806342,1822506,1838742,1855050,1871430,1887882,1904406,1921002,1937670,1954410,1971222,1988106,2005062,2022090,2039190,2056362,2073606,2090922,2108310,2125770,2143302,2160906,2178582,2196330,2214150,2232042,2250006
mov $1,2
add $1,$0
mul $1,$0
mul $1,36
add $1,42
| 203.777778 | 1,761 | 0.844602 |
06750df554938a7a74d1bd7285b50e0439bf4d53 | 422 | asm | Assembly | programs/oeis/045/A045930.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/045/A045930.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/045/A045930.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A045930: The generalized Connell sequence C_{3,5}.
; 1,2,5,8,11,14,17,18,21,24,27,30,33,36,39,42,45,48,49,52,55,58,61,64,67,70,73,76,79,82,85,88,91,94,95,98,101,104,107,110,113,116,119,122,125,128,131,134,137,140,143,146,149,152,155,156,159,162,165,168,171,174,177,180
mov $1,$0
seq $1,122799 ; A P_7-stuttered arithmetic progression with a(n+1)=a(n) if n is not a heptagonal number, a(n+1)=a(n)+2 otherwise.
add $0,$1
| 60.285714 | 217 | 0.699052 |
11f1898bbc6bbb505a3bed3f891391c0c7598f65 | 208 | asm | Assembly | COR1.asm | ELASRIYASSINE/DSP-DIGITAL-SIGNAL-PROCESSING-CODES- | 80768861501771c907e78ea37043fe67dffcd974 | [
"Unlicense"
] | null | null | null | COR1.asm | ELASRIYASSINE/DSP-DIGITAL-SIGNAL-PROCESSING-CODES- | 80768861501771c907e78ea37043fe67dffcd974 | [
"Unlicense"
] | null | null | null | COR1.asm | ELASRIYASSINE/DSP-DIGITAL-SIGNAL-PROCESSING-CODES- | 80768861501771c907e78ea37043fe67dffcd974 | [
"Unlicense"
] | null | null | null | .text
x .int 0,1,2,3,4,5,6,7
adr_x .word x
ldi @adr_x,AR0
ldi @adr_x,AR1
addi 1,AR0
ldi 0,R2
ldi 0,R0
ldi 6,RC
Rpts RC
mpyi *AR0++,*AR1++,R0
||addi R0,R2
addi R0,R2
sti R2,@30h
.end | 13.866667 | 23 | 0.572115 |
8bbff9d103d11c766f7976cc2d3de64660c5fb9f | 2,446 | asm | Assembly | source/lessons/lsn14-15/ice/bounce.asm | MarsUniversity/ECE382 | 83d20fe5879567e09a1783a0027db6051f22f757 | [
"MIT"
] | null | null | null | source/lessons/lsn14-15/ice/bounce.asm | MarsUniversity/ECE382 | 83d20fe5879567e09a1783a0027db6051f22f757 | [
"MIT"
] | 3 | 2017-12-24T23:20:03.000Z | 2018-12-05T15:36:27.000Z | source/lessons/lsn14-15/ice/bounce.asm | MarsUniversity/ece382 | 83d20fe5879567e09a1783a0027db6051f22f757 | [
"MIT"
] | null | null | null | ;-------------------------------------------------------------------------------
; Lesson 14 - Polling. Debouncing. Software Delay Routines.
;
; Purpose: Counts button pushes on P1.3. Count stored in R4
;
;-------------------------------------------------------------------------------
.cdecls C,LIST,"msp430.h" ; Include device header file
;-------------------------------------------------------------------------------
.def RESET ; Export program entry-point to
; make it known to linker.
;-------------------------------------------------------------------------------
.text ; Assemble into program memory.
.retain ; Override ELF conditional linking
; and retain current section.
.retainrefs ; And retain any sections that have
; references to current section.
;-------------------------------------------------------------------------------
RESET mov.w #__STACK_END,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW|WDTHOLD,&WDTCTL ; Stop watchdog timer
;-------------------------------------------------------------------------------
; Main loop here
;-------------------------------------------------------------------------------
; Set up active-low button for input
bis.b #BIT3, &P1OUT
bis.b #BIT3, &P1REN
bic.b #BIT3, &P1DIR
clr R4 ; track number Btn pushes
check_btn: bit.b #BIT3, &P1IN
jz btn_pushed
jmp check_btn
btn_pushed: inc R4
wait: bit.b #BIT3, &P1IN ; wait until button release
jz wait
jmp check_btn
;-------------------------------------------------------------------------------
; Stack Pointer definition
;-------------------------------------------------------------------------------
.global __STACK_END
.sect .stack
;-------------------------------------------------------------------------------
; Interrupt Vectors
;-------------------------------------------------------------------------------
.sect ".reset" ; MSP430 RESET Vector
.short RESET
| 42.912281 | 80 | 0.304579 |
61f9564e21393d8168ba7641f8788733876d22b8 | 3,676 | asm | Assembly | libsrc/_DEVELOPMENT/fcntl/z80/asm_vopen.asm | teknoplop/z88dk | bb03fbfd6b2ab0f397a1358559089f9cd3706485 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/fcntl/z80/asm_vopen.asm | teknoplop/z88dk | bb03fbfd6b2ab0f397a1358559089f9cd3706485 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/fcntl/z80/asm_vopen.asm | teknoplop/z88dk | bb03fbfd6b2ab0f397a1358559089f9cd3706485 | [
"ClArtistic"
] | 1 | 2019-12-03T23:57:48.000Z | 2019-12-03T23:57:48.000Z |
; ===============================================================
; October 2014
; ===============================================================
;
; int vopen(const char *path, int oflag, void *arg)
;
; Open a file.
;
; ===============================================================
INCLUDE "clib_cfg.asm"
SECTION code_clib
SECTION code_fcntl
PUBLIC asm_vopen, asm0_vopen
EXTERN asm_target_open_p1, asm_target_open_p2
EXTERN __stdio_heap, asm_heap_alloc, asm_heap_free, asm_memset
EXTERN __fcntl_first_available_fd, __fcntl_fdtbl_size
EXTERN error_einval_mc, error_mc, error_enfile_mc
asm_vopen:
; enter : de = char *path
; bc = int oflag (LSB is mode byte)
; hl = void *arg (0 if no args)
;
; exit : success
;
; hl = int fd
; de = FDSTRUCT *
; c = FILE type (bit 5 = 0 if stdio manages unget from eatc)
; carry reset
;
; fail
;
; hl = -1
; carry set, errno set
;
; uses : all except iy
; check oflag
ld a,c
and $03
jp z, error_einval_mc ; if at least one of RW not set
res 7,c ; set ref_count to one
asm0_vopen:
; target part 1: is path valid ?
; de = char *path
; bc = int oflag (bit 7 = 1 for initial ref_count = 2, else 1)
; hl = void *arg (0 if no args)
call asm_target_open_p1 ; target can place state in exx set
jp c, error_mc ; target reports error
; allocate an FDSTRUCT
; hl = data space required by driver (from target)
; exx set reserved for target
ld de,11 ; sizeof(FDSTRUCT header)
add hl,de ; sizeof(FDSTRUCT)
push hl ; save sizeof(FDSTRUCT)
ld de,__stdio_heap
call asm_heap_alloc ; allocate out of stdio heap
pop bc ; bc = sizeof(FDSTRUCT)
jp c, error_mc ; if memory unavailable
; hl = FDSTRUCT *
; bc = sizeof(FDSTRUCT)
; exx set reserved for target
ld e,0
call asm_memset ; zero the FDSTRUCT
; search for available fd
; hl = FDSTRUCT *
; exx set reserved for target
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
IF __CLIB_OPT_MULTITHREAD & $08
EXTERN __fcntl_lock_fdtbl, __fcntl_unlock_fdtbl
call __fcntl_lock_fdbtl
call critical_section
jp __fcntl_unlock_fdtbl
ENDIF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
critical_section:
ex de,hl ; de = FDSTRUCT *
call __fcntl_first_available_fd
jp nz, error_enfile_mc ; if no fd slot is available
ld a,__fcntl_fdtbl_size
sub b
; target part 2: create the file
; a = fd, carry reset
; hl = & fdtbl[fd] + 1b
; de = FDSTRUCT *
; exx set reserved for target
push af ; save fd
push de ; save FDSTRUCT *
push hl ; save & fdtbl[fd] + 1b
ex de,hl ; hl = FDSTRUCT *
call asm_target_open_p2 ; target creates file, fills FDSTRUCT, return c = FILE type
; (bit 7 of oflag + 1 indicates initial ref_count)
pop hl ; hl = & fdtbl[fd] + 1b
pop de ; de = FDSTRUCT *
jr c, target_error_p2 ; if target reports error
pop af ; a = fd
; make fd entry
ld (hl),d
dec hl
ld (hl),e
ld l,a
ld h,0 ; hl = fd
ret
target_error_p2:
ex de,hl ; hl = FDSTRUCT *
ld de,__stdio_heap
call asm_heap_free
jp error_mc - 1
| 23.716129 | 90 | 0.507073 |
df428ec2c5c0cf7ba15df8600483a1786a72668c | 610 | asm | Assembly | untested/x86/isLeapYear.asm | GabrielRavier/Generic-Assembly-Samples | fbf803960a14307b7fce0165058d0d4048abaf42 | [
"Unlicense"
] | null | null | null | untested/x86/isLeapYear.asm | GabrielRavier/Generic-Assembly-Samples | fbf803960a14307b7fce0165058d0d4048abaf42 | [
"Unlicense"
] | null | null | null | untested/x86/isLeapYear.asm | GabrielRavier/Generic-Assembly-Samples | fbf803960a14307b7fce0165058d0d4048abaf42 | [
"Unlicense"
] | null | null | null | global _isLeapYear
segment .text align=16
_isLeapYear:
mov eax, 0x51EB851F
mov ecx, [esp + 4]
mul ecx
shr edx, 7
imul eax, edx, -400
add eax, ecx
je .return1
mov eax, 0x51EB851F
mul ecx
shr edx, 5
imul eax, edx, -100
add eax, ecx
je .return0
test cl, 3
jne .return0
.return1:
mov eax, 1
ret
align 16
.return0:
xor eax, eax
ret
align 16
_isLeapYearBMI2:
imul edx, [esp + 4], 0xC28F5C29
mov eax, 1
rorx ecx, edx, 4
cmp ecx, 0xA3D70A
jbe .return
xor eax, eax
rorx edx, edx, 2
cmp edx, 0x28F5C28
jbe .return
test byte [esp + 4], 3
sete al
.return:
ret | 10.892857 | 32 | 0.642623 |
c01f3ed758e50c3c235e558ea984df70484abb9d | 363 | asm | Assembly | programs/oeis/087/A087131.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/087/A087131.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/087/A087131.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A087131: a(n) = 2^n*Lucas(n), where Lucas = A000032.
; 2,2,12,32,112,352,1152,3712,12032,38912,125952,407552,1318912,4268032,13811712,44695552,144637952,468058112,1514668032,4901568512,15861809152,51329892352,166107021312,537533612032,1739495309312
seq $0,14335 ; Exponential convolution of Fibonacci numbers with themselves (divided by 2).
mul $0,10
add $0,2
| 51.857143 | 195 | 0.790634 |
608cdd4a6220e1cc2e188f74b428f25eecdf125c | 225 | asm | Assembly | programs/oeis/017/A017661.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/017/A017661.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/017/A017661.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A017661: (12n+11)^9.
; 2357947691,1801152661463,78815638671875,1119130473102767,8662995818654939,45848500718449031,186940255267540403,630249409724609375,1838459212420154507,4785448563124474679
mul $0,12
add $0,11
pow $0,9
| 32.142857 | 171 | 0.844444 |
11ceec4295e0edeb72ff7de54d71f956f88890fe | 633 | asm | Assembly | programs/oeis/171/A171438.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/171/A171438.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/171/A171438.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A171438: a(n) = 0+1+2+...+n in lunar arithmetic in base 3 written in base 10.
; 0,1,2,5,5,5,8,8,8,17,17,17,17,17,17,17,17,17,26,26,26,26,26,26,26,26,26,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80
mov $20,$0
add $20,1
lpb $20,1
clr $0,18
sub $20,1
sub $0,$20
mov $11,$0
mov $0,1
lpb $0,1
mov $0,$11
gcd $0,81
add $2,$11
mul $2,2
mov $3,$0
mov $0,$11
mul $3,4
lpb $2,1
div $0,$3
mov $2,$3
div $2,3
mov $7,$3
lpe
lpe
mov $1,$7
div $1,4
add $19,$1
lpe
mov $1,$19
| 19.78125 | 208 | 0.527646 |
e72bc26c86a2e831eec7b04977d5cd1860efe893 | 335 | asm | Assembly | learn-assembly/asm102/asm102-01.asm | hailehong95/Practice-Coding | 729acdd596f15657b717975bfa54da1e39114f8a | [
"MIT"
] | null | null | null | learn-assembly/asm102/asm102-01.asm | hailehong95/Practice-Coding | 729acdd596f15657b717975bfa54da1e39114f8a | [
"MIT"
] | null | null | null | learn-assembly/asm102/asm102-01.asm | hailehong95/Practice-Coding | 729acdd596f15657b717975bfa54da1e39114f8a | [
"MIT"
] | null | null | null | ; asm102-01: Nhap vao mot ky tu, Xuat ra ky tu do
.model small
.stack 100h
.data
.code
mov ah,1 ; Goi ham 1: Ham nhap du lieu
int 21h
mov dl,al
mov ah,2 ; Goi ham 2: Ham xuat du lieu
int 21h
end
; Ham 1 cua ngat 21 luu du lieu nhap vao thanh ghi AL
; Ham 2 cua ngat 21 xuat du lieu trong thanh ghi DL | 22.333333 | 53 | 0.632836 |
9b8ede0a9111a153f9c9992bf5b88bb2b3f5789a | 7,148 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xca.log_21829_602.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xca.log_21829_602.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xca.log_21829_602.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r14
push %r8
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x17ed8, %r10
xor %r14, %r14
mov $0x6162636465666768, %rbp
movq %rbp, %xmm6
vmovups %ymm6, (%r10)
nop
nop
nop
lfence
lea addresses_WT_ht+0x15976, %r13
nop
nop
sub %r8, %r8
mov $0x6162636465666768, %rdi
movq %rdi, %xmm6
vmovups %ymm6, (%r13)
nop
nop
xor %r8, %r8
lea addresses_UC_ht+0x5ac0, %rbp
nop
nop
nop
nop
cmp %r10, %r10
mov $0x6162636465666768, %r14
movq %r14, %xmm0
movups %xmm0, (%rbp)
xor $63409, %r8
lea addresses_normal_ht+0x7258, %rbp
dec %r8
vmovups (%rbp), %ymm2
vextracti128 $0, %ymm2, %xmm2
vpextrq $0, %xmm2, %r13
nop
nop
nop
nop
nop
cmp %r14, %r14
lea addresses_UC_ht+0x55d8, %r14
nop
add $47442, %r8
movw $0x6162, (%r14)
nop
cmp %rbp, %rbp
lea addresses_UC_ht+0x958, %rdi
nop
nop
nop
nop
and $19124, %rbp
movw $0x6162, (%rdi)
nop
nop
and $16385, %r13
lea addresses_WT_ht+0xfd88, %r8
nop
nop
nop
nop
nop
cmp $20635, %r9
movb (%r8), %r14b
nop
nop
nop
cmp %rbp, %rbp
lea addresses_A_ht+0x165d8, %r9
nop
nop
nop
add $41553, %r10
and $0xffffffffffffffc0, %r9
movntdqa (%r9), %xmm6
vpextrq $0, %xmm6, %r13
nop
and %r10, %r10
lea addresses_A_ht+0x91d8, %rdi
add %rbp, %rbp
movb (%rdi), %r10b
nop
nop
nop
sub $1117, %r13
lea addresses_WT_ht+0x187d8, %r13
nop
nop
nop
nop
inc %rdi
movl $0x61626364, (%r13)
nop
nop
xor %rbp, %rbp
lea addresses_WT_ht+0x164ea, %rsi
lea addresses_WT_ht+0x1b07a, %rdi
clflush (%rsi)
nop
nop
nop
nop
and $27995, %r8
mov $0, %rcx
rep movsb
nop
nop
nop
nop
add %r8, %r8
lea addresses_WT_ht+0x14d18, %rdi
nop
nop
nop
nop
and $21383, %rsi
mov (%rdi), %r8
nop
dec %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r14
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %rax
push %rbp
push %rbx
push %rdi
push %rsi
// Store
lea addresses_D+0x19958, %rax
clflush (%rax)
dec %rbp
movl $0x51525354, (%rax)
nop
nop
nop
nop
xor %rdi, %rdi
// Faulty Load
lea addresses_A+0xe5d8, %rax
nop
nop
nop
inc %r11
mov (%rax), %rbp
lea oracles, %r11
and $0xff, %rbp
shlq $12, %rbp
mov (%r11,%rbp,1), %rbp
pop %rsi
pop %rdi
pop %rbx
pop %rbp
pop %rax
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_A', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 5}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 8, 'NT': True, 'type': 'addresses_A', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_WT_ht', 'same': True, 'AVXalign': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 6}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': True, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 35.039216 | 2,999 | 0.655288 |
b8428d66defbda03debe3f3126c32bcff8515878 | 3,296 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0x84_notsx.log_65_288.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0x84_notsx.log_65_288.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0x84_notsx.log_65_288.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r14
push %r8
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x1dfbf, %r9
nop
nop
sub $63181, %r11
mov $0x6162636465666768, %r8
movq %r8, (%r9)
nop
nop
xor %r8, %r8
lea addresses_WT_ht+0x14835, %r11
nop
nop
nop
nop
nop
sub %r10, %r10
mov $0x6162636465666768, %rsi
movq %rsi, (%r11)
nop
nop
nop
nop
nop
and $58648, %r9
lea addresses_WC_ht+0x193e5, %r14
nop
nop
add $22983, %rdx
mov $0x6162636465666768, %r11
movq %r11, %xmm6
movups %xmm6, (%r14)
nop
xor $13583, %r8
lea addresses_WT_ht+0xbed9, %r9
nop
nop
nop
and %r10, %r10
mov (%r9), %r14w
xor $50322, %r8
lea addresses_normal_ht+0x13899, %rsi
clflush (%rsi)
nop
nop
nop
and $49627, %r10
movb $0x61, (%rsi)
cmp %r14, %r14
lea addresses_UC_ht+0x15499, %rsi
lea addresses_A_ht+0x1eb59, %rdi
nop
nop
nop
cmp $3162, %r8
mov $18, %rcx
rep movsq
nop
nop
nop
nop
nop
and $32299, %r10
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r14
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r15
push %r8
push %r9
push %rax
push %rbx
push %rsi
// Store
mov $0x7ef6920000000511, %r9
nop
dec %r15
movl $0x51525354, (%r9)
nop
nop
xor %rsi, %rsi
// Store
lea addresses_A+0xb499, %r15
nop
nop
nop
nop
and $22495, %rbx
movw $0x5152, (%r15)
and $49739, %rsi
// Store
lea addresses_A+0xb499, %rbx
and $53168, %rax
movw $0x5152, (%rbx)
nop
nop
nop
add $9567, %r9
// Faulty Load
lea addresses_A+0xb499, %r15
nop
sub $25196, %r8
movb (%r15), %bl
lea oracles, %r11
and $0xff, %rbx
shlq $12, %rbx
mov (%r11,%rbx,1), %rbx
pop %rsi
pop %rbx
pop %rax
pop %r9
pop %r8
pop %r15
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_A', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_NC', 'same': False, 'size': 4, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_A', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_A', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_A', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 8, 'congruent': 1, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 8, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 16, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'same': True, 'size': 2, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 1, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': True}, 'OP': 'REPM'}
{'52': 65}
52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52
*/
| 20.6 | 194 | 0.644114 |
07552ac3812ac62025c219df076a3356668eb21c | 3,028 | asm | Assembly | danagy/fwst.asm | DW0RKiN/Floating-point-Library-for-Z80 | 494add6bc20922f4a634fbbacb32d8bd4dd185a7 | [
"MIT"
] | 12 | 2020-02-17T09:07:02.000Z | 2022-02-09T22:15:34.000Z | danagy/fwst.asm | DW0RKiN/Floating-point-Library-for-Z80 | 494add6bc20922f4a634fbbacb32d8bd4dd185a7 | [
"MIT"
] | null | null | null | danagy/fwst.asm | DW0RKiN/Floating-point-Library-for-Z80 | 494add6bc20922f4a634fbbacb32d8bd4dd185a7 | [
"MIT"
] | 1 | 2021-06-21T23:30:28.000Z | 2021-06-21T23:30:28.000Z | if not defined @FWST
include "color_flow_warning.asm"
; Store Word. Convert absolute value of a floating-point number into unsigned 16-bit integer.
; In: HL = floating point to convert
; Out: HL = Word representation, set carry if overflow
; Pollutes: AF, B
@FWST:
if not defined FWST
; *****************************************
FWST ; *
; *****************************************
endif
LD A, H ; 1:4
AND EXP_MASK ; 2:7
CP BIAS + $10 ; 2:7
JR nc, FWST_OVERFLOW ; 2:7/12
SUB BIAS-1 ; 2:7
JR c, FWST_ZERO ; 2:7/12
; A = 0..16
if 0
LD B, A ; 1:4
LD A, L ; 1:4
LD HL, $0000 ; 3:10
JR z, FWST_ROUNDING ; 2:7/12
SCF ; 1:4
ADC HL, HL ; 2:15
ADD A, A ; 1:4
DJNZ $-3 ; 2:13/8
RET nc ; 1:11/5
FWST_ROUNDING:
OR A ; 1:4
RET z ; 1:11/5
INC HL ; 1:6
RET ; 1:10
else
LD H, $01 ; 2:7
SUB $09 ; 2:7
JR nc, FWST_256PLUS ; 2:7
DEC HL ; 1:6 rounding ( 0.5000 down => 0.4999 down )
SRL H ; 2:8
RR L ; 2:8
INC A ; 1:4
JR z, $+7 ; 2:12/7
SRL L ; 2:8
INC A ; 1:4
JR nz, $-3 ; 2:12/7
RET nc ; 1:11/5
INC L ; 1:4
if carry_flow_warning
OR A ; 1:4
endif
RET ; 1:10
FWST_256PLUS:
RET z ; 1:5/11
LD B, A ; 1:4
ADD HL, HL ; 1:11
DJNZ $-1 ; 2:13/8
RET ; 1:10
endif
FWST_OVERFLOW:
if color_flow_warning
CALL OVER_COL_WARNING ; 3:17
endif
LD HL, $FFFF ; 3:10
if carry_flow_warning
SCF ; 1:4
endif
RET ; 1:10 RET with carry
FWST_ZERO:
if carry_flow_warning
XOR A ; 1:4
LD H, A ; 1:4
LD L, A ; 1:4
else
LD HL, $0000 ; 3:10
endif
RET ; 1:10 RET with carry
endif
| 31.541667 | 93 | 0.285007 |
cb4066c5d968dafd2edc9d02499c3066caafacd2 | 2,605 | asm | Assembly | Kernel/asm/interrupts.asm | inesmarca/2TP_SO | 7174f27d68e7fc381dff00207a7ae0e1d5b09aed | [
"BSD-3-Clause"
] | null | null | null | Kernel/asm/interrupts.asm | inesmarca/2TP_SO | 7174f27d68e7fc381dff00207a7ae0e1d5b09aed | [
"BSD-3-Clause"
] | null | null | null | Kernel/asm/interrupts.asm | inesmarca/2TP_SO | 7174f27d68e7fc381dff00207a7ae0e1d5b09aed | [
"BSD-3-Clause"
] | null | null | null |
GLOBAL _cli
GLOBAL _sti
GLOBAL picMasterMask
GLOBAL picSlaveMask
GLOBAL haltcpu
GLOBAL _hlt
GLOBAL _irq00Handler
GLOBAL _irq01Handler
GLOBAL _irq02Handler
GLOBAL _irq03Handler
GLOBAL _irq04Handler
GLOBAL _irq05Handler
GLOBAL _irq80Handler
GLOBAL _exception0Handler
GLOBAL _exception6Handler
EXTERN irqDispatcher
EXTERN exceptionDispatcher
EXTERN sysHandler
SECTION .text
%macro pushState 0
push rax
push rbx
push rcx
push rdx
push rbp
push rdi
push rsi
push r8
push r9
push r10
push r11
push r12
push r13
push r14
push r15
%endmacro
%macro popState 0
pop r15
pop r14
pop r13
pop r12
pop r11
pop r10
pop r9
pop r8
pop rsi
pop rdi
pop rbp
pop rdx
pop rcx
pop rbx
pop rax
%endmacro
%macro pushReg 0
push rbx
push rcx
push rdx
push rbp
push rdi
push rsi
push r8
push r9
push r10
push r11
push r12
push r13
push r14
push r15
%endmacro
%macro popReg 0
pop r15
pop r14
pop r13
pop r12
pop r11
pop r10
pop r9
pop r8
pop rsi
pop rdi
pop rbp
pop rdx
pop rcx
pop rbx
%endmacro
%macro irqHandlerMaster 1
pushState
mov rdi, %1 ; pasaje de parametro
mov rsi, rsp ; pasaje del stack frame
call irqDispatcher
mov rsp, rax ; cambio el rsp al que me retorno el scheduler
; signal pic EOI (End of Interrupt)
mov al, 20h
out 20h, al
popState
iretq
%endmacro
%macro sysCallHandler 0
push rbp
mov rbp, rsp
pushReg
push rax
mov rax, [rbp + 56]
push rax
call sysHandler
add rsp, 2*8
push rax
; signal pic EOI (End of Interrupt)
mov al, 20h
out 20h, al
pop rax
popReg
mov rsp, rbp
pop rbp
iretq
%endmacro
%macro exceptionHandler 1
pushState
mov rdi, %1 ; pasaje de parametro
mov rsi, rsp ; puntero del stack para poder retornar
call exceptionDispatcher
popState
iretq
%endmacro
_hlt:
sti
hlt
ret
_cli:
cli
ret
_sti:
sti
ret
picMasterMask:
push rbp
mov rbp, rsp
mov ax, di
out 21h,al
pop rbp
retn
picSlaveMask:
push rbp
mov rbp, rsp
mov ax, di ; ax = mascara de 16 bits
out 0A1h,al
pop rbp
retn
;8254 Timer (Timer Tick)
_irq00Handler:
irqHandlerMaster 0
;Keyboard
_irq01Handler:
irqHandlerMaster 1
;Cascade pic never called
_irq02Handler:
irqHandlerMaster 2
;Serial Port 2 and 4
_irq03Handler:
irqHandlerMaster 3
;Serial Port 1 and 3
_irq04Handler:
irqHandlerMaster 4
;USB
_irq05Handler:
irqHandlerMaster 5
;INT 80h
_irq80Handler:
sysCallHandler
;Zero Division Exception
_exception0Handler:
exceptionHandler 0
;Invalid Opcode Exception
_exception6Handler:
exceptionHandler 6
haltcpu:
cli
hlt
ret
SECTION .bss
aux resq 1 | 11.734234 | 60 | 0.733973 |
cf8c3b7a626efab285171623a4a9cb2a2f78c6c8 | 605 | asm | Assembly | oeis/157/A157651.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/157/A157651.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/157/A157651.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A157651: a(n) = 100*n^2 - 49*n + 6.
; 57,308,759,1410,2261,3312,4563,6014,7665,9516,11567,13818,16269,18920,21771,24822,28073,31524,35175,39026,43077,47328,51779,56430,61281,66332,71583,77034,82685,88536,94587,100838,107289,113940,120791,127842,135093,142544,150195,158046,166097,174348,182799,191450,200301,209352,218603,228054,237705,247556,257607,267858,278309,288960,299811,310862,322113,333564,345215,357066,369117,381368,393819,406470,419321,432372,445623,459074,472725,486576,500627,514878,529329,543980,558831,573882,589133
mov $1,$0
mul $0,10
pow $0,2
add $0,57
mov $2,$1
mul $2,151
add $0,$2
| 55 | 495 | 0.783471 |
cd4e63f9ca768f06ec003ebf84c3f58a97e2221a | 2,494 | asm | Assembly | libsrc/net/IPHeaderCheck.asm | andydansby/z88dk-mk2 | 51c15f1387293809c496f5eaf7b196f8a0e9b66b | [
"ClArtistic"
] | 1 | 2020-09-15T08:35:49.000Z | 2020-09-15T08:35:49.000Z | libsrc/net/IPHeaderCheck.asm | dex4er/deb-z88dk | 9ee4f23444fa6f6043462332a1bff7ae20a8504b | [
"ClArtistic"
] | null | null | null | libsrc/net/IPHeaderCheck.asm | dex4er/deb-z88dk | 9ee4f23444fa6f6043462332a1bff7ae20a8504b | [
"ClArtistic"
] | null | null | null | ;
; Do the checksum for an IP packet
;
; Assumes packet is fully built etc, fills in the appropriate field
;
; djm 12/2/2001
;
XLIB IPHeaderCheck
; void IPHeaderSum(ipheader_t *pkt)
.IPHeaderCheck
pop de
pop hl
push hl
push de
ld bc,10
add hl,bc
xor a
ld (hl),a
inc hl
ld (hl),a ; Set checksum to zero
push hl
scf
sbc hl,bc
ld a,(hl)
and $0f
rlca
rlca
ld c,a
ld b,0
pop hl
ld (hl),c
dec hl
ld (hl),b
ret
.FastCSum push hl
push de
ld a,c
ld c,b ; swap b,c
srl c
rra ; adjust counter for words
ld b,a ; (cb=#words)
push af ; save cary for a single byte
ld de,0 ; de=sum
or c ; check for zero also clear carry
jr z,FastCsum_2 ; Only one or less bytes
inc c
ld a,b
or a
jr z,FastCsum_1b
.FastCsum_1 ; use counter c for outer loop
ld a,(hl)
inc hl
adc a,d
ld d,a
ld a,(hl)
inc hl
adc a,e
ld e,a
djnz FastCsum_1 ; inner loop
.FastCsum_1b
dec c
jr nz,FastCsum_1 ; outer loop
ld a,d
adc a,0
ld d,a
ld a,e
adc a,0
ld e,a
ld a,d
adc a,0
ld d,a
.FastCsum_2
pop af ; check for single byte
jr nc,FastCsum_3
ld a,(hl)
add a,d
ld d,a
ld a,e
adc a,0
ld e,a
ld a,d
adc a,0
ld d,a
ld a,e
adc a,0
ld e,a
.FastCsum_3
ld a,d
cpl
ld b,a
ld a,e
cpl
ld c,a
pop de
pop hl
ret
| 23.980769 | 67 | 0.319166 |
2339fed902bd4354e044822fcbcc50b4ee26f727 | 661 | asm | Assembly | data/pokemon/base_stats/pinsir.asm | pokeachromicdevs/pokeoctober | db74bb68bbfceac07eec6d64674bc24fd4c0b67f | [
"blessing"
] | 1 | 2021-07-05T23:48:37.000Z | 2021-07-05T23:48:37.000Z | data/pokemon/base_stats/pinsir.asm | pokeachromicdevs/pokeoctober | db74bb68bbfceac07eec6d64674bc24fd4c0b67f | [
"blessing"
] | 1 | 2020-12-16T01:11:20.000Z | 2020-12-16T22:53:56.000Z | data/pokemon/base_stats/pinsir.asm | pokeachromicdevs/pokeoctober | db74bb68bbfceac07eec6d64674bc24fd4c0b67f | [
"blessing"
] | 1 | 2021-07-05T23:33:22.000Z | 2021-07-05T23:33:22.000Z | db 0 ; species ID placeholder
db 65, 125, 100, 85, 55, 70
; hp atk def spd sat sdf
db BUG, BUG ; type
db 45 ; catch rate
db 200 ; base exp
db NO_ITEM, SHARP_HORN ; items
db GENDER_F50 ; gender ratio
db 100 ; unknown 1
db 25 ; step cycles to hatch
db 5 ; unknown 2
INCBIN "gfx/pokemon/pinsir/front.dimensions"
db 0, 0, 0, 0 ; padding
db GROWTH_SLOW ; growth rate
dn EGG_BUG, EGG_BUG ; egg groups
; tm/hm learnset
tmhm HEADBUTT, CURSE, TOXIC, ROCK_SMASH, HIDDEN_POWER, SUNNY_DAY, SNORE, HYPER_BEAM, PROTECT, ENDURE, FRUSTRATION, RETURN, DOUBLE_TEAM, SWAGGER, SLEEP_TALK, REST, ATTRACT, THIEF, FURY_CUTTER, UPROOT, STRONG_ARM
; end
| 30.045455 | 211 | 0.706505 |
02931afde855fd229f27ec8e95a9cb78928c17b0 | 1,201 | asm | Assembly | programs/oeis/286/A286687.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/286/A286687.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/286/A286687.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A286687: Positions of 1 in A286685; complement of A286686.
; 2,4,5,8,10,11,14,16,18,19,22,24,25,28,30,32,33,36,38,39,42,44,45,48,50,52,53,56,58,59,62,64,66,67,70,72,73,76,78,79,82,84,86,87,90,92,93,96,98,100,101,104,106,107,110,112,114,115,118,120,121,124,126,127,130,132,134,135,138,140,141,144,146,148,149,152,154,155,158,160,161,164,166,168,169,172,174,175,178,180,182,183,186,188,189,192,194,196,197,200,202,203,206,208,209,212,214,216,217,220,222,223,226,228,230,231,234,236,237,240,242,243,246,248,250,251,254,256,257,260,262,264,265,268,270,271,274,276,277,280,282,284,285,288,290,291,294,296,298,299,302,304,305,308,310,312,313,316,318,319,322,324,325,328,330,332,333,336,338,339,342,344,346,347,350,352,353,356,358,359,362,364,366,367,370,372,373,376,378,380,381,384,386,387,390,392,394,395,398,400,401,404,406,407,410,412,414,415,418,420,421,424,426,428,429,432,434,435,438,440,441,444,446,448,449,452,454,455,458,460,462,463,466,468,469,472,474,475,478,480,482,483,486,488,489,492,494,496,497,500
mov $2,$0
cal $0,171588 ; The Pell word: Fixed point of the morphism 0->001, 1->0.
cal $0,7 ; The characteristic function of {0}: a(n) = 0^n.
mov $1,$0
mov $3,$2
mul $3,2
add $1,$3
add $1,1
| 100.083333 | 948 | 0.716903 |
2b8cd75caba30cdbbd4e3e7fc59e1b559ff80322 | 7,030 | asm | Assembly | Transynther/x86/_processed/NONE/_ht_zr_/i7-7700_9_0xca.log_21829_1380.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_ht_zr_/i7-7700_9_0xca.log_21829_1380.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_ht_zr_/i7-7700_9_0xca.log_21829_1380.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r8
push %rax
push %rbx
push %rcx
push %rdx
lea addresses_normal_ht+0xf6f, %r12
nop
nop
nop
xor %r8, %r8
movb (%r12), %dl
nop
nop
nop
nop
cmp %rax, %rax
lea addresses_A_ht+0x39bf, %rbx
nop
nop
sub %rdx, %rdx
mov $0x6162636465666768, %r11
movq %r11, %xmm4
vmovups %ymm4, (%rbx)
nop
nop
nop
cmp $36885, %r11
lea addresses_WT_ht+0x1516f, %r11
nop
nop
nop
nop
add %rcx, %rcx
movb $0x61, (%r11)
nop
nop
nop
nop
nop
add %rbx, %rbx
lea addresses_WT_ht+0x16ae3, %rdx
nop
nop
sub $43349, %rbx
mov $0x6162636465666768, %r12
movq %r12, %xmm7
movups %xmm7, (%rdx)
nop
nop
xor %r12, %r12
lea addresses_WC_ht+0x98ef, %rbx
nop
nop
nop
nop
add $41450, %rcx
mov (%rbx), %rdx
nop
nop
nop
and $34510, %r8
lea addresses_WT_ht+0xbec7, %rbx
nop
nop
nop
nop
inc %rax
mov (%rbx), %r8d
nop
nop
nop
nop
dec %r11
lea addresses_A_ht+0x105db, %rbx
nop
and %r12, %r12
vmovups (%rbx), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $0, %xmm0, %rax
nop
cmp %rax, %rax
pop %rdx
pop %rcx
pop %rbx
pop %rax
pop %r8
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r8
push %r9
push %rax
push %rbx
push %rcx
push %rdi
push %rdx
// Store
lea addresses_WC+0x936f, %rcx
nop
nop
sub $49511, %rdi
mov $0x5152535455565758, %r8
movq %r8, %xmm0
movaps %xmm0, (%rcx)
nop
sub $7288, %rax
// Store
lea addresses_UC+0x236f, %rdx
nop
nop
nop
nop
nop
add $4956, %r9
mov $0x5152535455565758, %r8
movq %r8, %xmm3
vmovaps %ymm3, (%rdx)
nop
nop
nop
xor $51183, %rax
// Store
lea addresses_US+0x676f, %r8
nop
nop
nop
nop
dec %rdi
mov $0x5152535455565758, %rcx
movq %rcx, %xmm4
vmovups %ymm4, (%r8)
nop
nop
nop
nop
dec %rax
// Store
mov $0x5eefcc000000078d, %rbx
nop
nop
nop
nop
nop
xor $49973, %r8
mov $0x5152535455565758, %rcx
movq %rcx, %xmm0
vmovups %ymm0, (%rbx)
nop
nop
nop
xor %rdi, %rdi
// Store
lea addresses_A+0x821f, %rax
sub $8782, %rbx
movw $0x5152, (%rax)
nop
nop
sub %rdi, %rdi
// Faulty Load
lea addresses_WC+0x10f6f, %r9
nop
dec %rbx
vmovups (%r9), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $1, %xmm1, %rax
lea oracles, %rdx
and $0xff, %rax
shlq $12, %rax
mov (%rdx,%rax,1), %rax
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r9
pop %r8
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': True, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WC'}}
{'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': True, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_UC'}}
{'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_US'}}
{'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_NC'}}
{'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_A'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WT_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'00': 8540, '45': 13289}
45 45 45 45 00 45 00 45 45 45 00 45 45 45 00 45 45 45 45 45 00 45 00 45 45 45 00 45 00 45 00 45 45 00 45 45 00 45 45 45 45 00 45 00 45 00 45 45 45 00 45 00 45 00 45 00 45 00 45 45 00 45 45 45 45 45 00 45 45 00 45 00 45 00 45 00 45 00 45 00 45 45 00 45 45 45 45 00 45 45 45 00 45 00 45 45 00 45 00 45 45 45 00 45 00 45 45 45 45 45 00 45 00 45 45 45 00 45 00 45 45 45 45 45 00 45 45 00 45 45 45 00 45 00 45 00 45 00 45 45 45 45 00 45 45 00 45 00 45 00 45 00 45 45 00 45 00 45 45 00 45 45 00 45 00 45 00 45 00 45 00 45 45 45 00 45 00 45 00 00 45 00 45 45 45 00 45 45 45 00 45 45 00 45 00 45 00 45 45 45 45 45 00 00 45 00 45 00 45 00 45 45 00 45 45 00 45 00 45 45 45 45 00 45 00 45 45 45 45 45 00 45 00 45 45 00 45 45 45 00 45 45 45 00 45 00 45 45 00 45 45 00 45 00 45 45 00 45 00 45 45 00 45 00 45 00 45 00 45 00 45 00 45 00 45 00 45 00 45 45 00 45 45 45 00 45 00 45 00 45 00 45 45 00 45 00 45 45 00 45 45 45 00 45 45 45 45 45 45 00 45 00 45 00 45 45 45 00 45 45 00 45 45 45 45 00 45 00 45 00 45 00 45 00 45 45 00 45 45 45 45 00 45 00 45 45 00 45 00 45 45 00 45 00 45 45 45 45 00 45 00 45 00 45 45 00 45 00 45 45 00 45 45 45 45 00 45 45 00 45 00 00 45 45 00 45 00 45 45 45 45 00 45 00 45 00 45 45 00 45 00 45 00 45 00 45 00 45 45 00 45 00 45 45 00 45 45 00 45 45 45 00 45 45 45 45 00 45 00 45 45 00 45 45 00 45 45 00 45 00 45 00 45 45 00 45 00 45 45 00 45 45 00 45 45 00 45 00 45 00 45 00 45 45 00 45 00 45 45 00 45 00 45 45 45 45 00 45 00 45 00 45 00 45 00 45 45 00 45 45 00 45 00 45 00 45 00 45 45 00 45 00 45 00 45 00 45 00 45 00 45 00 45 45 45 00 45 00 45 45 00 45 00 45 45 45 00 45 00 45 45 00 45 45 00 45 45 00 45 45 45 00 45 45 00 45 00 00 45 45 45 00 45 00 45 00 45 00 45 00 45 00 45 00 45 00 45 00 45 00 45 45 00 45 45 00 45 45 45 00 45 45 00 45 45 00 45 00 45 00 45 00 45 00 45 00 00 45 00 45 45 00 45 00 45 00 45 45 00 45 45 00 45 00 45 00 45 00 45 00 45 00 45 00 45 45 00 45 00 45 45 00 45 45 45 00 45 00 45 00 45 45 00 45 45 45 45 45 45 00 45 45 45 00 45 00 45 00 45 00 45 45 00 45 45 00 45 45 00 45 00 45 00 45 00 45 45 45 00 45 00 45 00 45 00 45 45 00 45 00 45 45 00 45 45 00 45 00 45 00 45 00 45 45 45 00 45 00 45 00 45 45 00 45 45 00 45 45 00 45 45 00 45 45 00 45 00 45 45 45 45 45 00 45 00 45 45 45 00 45 00 45 45 00 45 45 00 45 00 45 45 00 45 00 45 00 45 00 45 45 00 45 00 45 45 00 45 45 45 00 45 00 45 00 45 45 45 00 45 00 45 00 45 45 00 45 00 45 45 00 45 00 45 45 45 00 45 00 45 00 45 45 00 45 45 45 00 45 00 45 45 00 45 00 45 00 45 45 00 45 00 45 00 45 45 00 45 00 45 00 45 45 00 45 00 45 00 45 45 00 45 00 45 45 00 45 00 45 00 45 00 45 00 45 00 45 00 45 00 45 00 45 00 45 00 45 45 00 45 00 45 45 00 45 45 00 45 45 00 45 00 45 00 45 00 45 45 45 45 00 45 45 45 45 45 00 45 00 45 00 45 00 45 00 45 00 45 00 45 00 45 45 45 00 45 45 45 45 45 00 45 45 00 45 00 45 00 45 00 45 45 00 45 45 00 45 00 45 45 00 45 45 00 45 45 00 45 00 45 00 45 45 00 45 00 45 45 45 45 45 45 45 00 45 00 45 45 45 00 45 00 45 00 45 45 00 45 00 45 00 45 00 45 00 45 00 45 00 45 45 45 00 45 45 00 45 00 45 45 45
*/
| 32.850467 | 2,999 | 0.654054 |
6bd1bdb35d95fbe7112939d4f2b38ef8c6b32c68 | 159 | asm | Assembly | libsrc/_DEVELOPMENT/threads/context/__thread_critical_section_begin.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/threads/context/__thread_critical_section_begin.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/threads/context/__thread_critical_section_begin.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z | SECTION code_clib
SECTION code_threads
PUBLIC __thread_critical_section_begin
EXTERN asm_cpu_push_di
defc __thread_critical_section_begin = asm_cpu_push_di
| 17.666667 | 54 | 0.899371 |
f33d2de99937aa4158bc4cdb0019aec649ec7a92 | 1,867 | asm | Assembly | libsrc/_DEVELOPMENT/math/float/am9511/z80/am32_stack/am32_1_popi.asm | ahjelm/z88dk | c4de367f39a76b41f6390ceeab77737e148178fa | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/math/float/am9511/z80/am32_stack/am32_1_popi.asm | C-Chads/z88dk | a4141a8e51205c6414b4ae3263b633c4265778e6 | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/math/float/am9511/z80/am32_stack/am32_1_popi.asm | C-Chads/z88dk | a4141a8e51205c6414b4ae3263b633c4265778e6 | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z | ;
; Copyright (c) 2020 Phillip Stevens
;
; This Source Code Form is subject to the terms of the Mozilla Public
; License, v. 2.0. If a copy of the MPL was not distributed with this
; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;
; feilipu, August 2020
;
;-------------------------------------------------------------------------
; asm_am9511_1_popi - am9511 APU pop integer
;-------------------------------------------------------------------------
;
; Load integer from Am9511 APU stack
;
;-------------------------------------------------------------------------
SECTION code_fp_am9511
EXTERN __IO_APU1_STATUS, __IO_APU1_DATA
PUBLIC asm_am9511_1_popi_hl
PUBLIC asm_am9511_1_popi
.am9511_1_popi_hl_wait
ex (sp),hl
ex (sp),hl
.asm_am9511_1_popi_hl
; float primitive
; pop an integer from the Am9511 stack.
;
; enter : stack = ret1, ret0
; : hl = pointer to integer
;
; exit : stack = long, ret1
;
; uses : af, bc, hl
in a,(__IO_APU1_STATUS) ; read the APU status register
rlca ; busy? __IO_APU_STATUS_BUSY
jr C,am9511_1_popi_hl_wait
ld bc,__IO_APU1_DATA ; the address of the APU data port in bc
inc hl
ind ; load LSW into APU
inc b
ind
ret
.am9511_1_popi_wait
ex (sp),hl
ex (sp),hl
.asm_am9511_1_popi
; float primitive
; pop an integer from the Am9511 stack.
;
; enter : stack = ret0
;
; exit : dehl = integer
;
; uses : af, bc, hl
in a,(__IO_APU1_STATUS) ; read the APU status register
rlca ; busy? and __IO_APU_STATUS_BUSY
jr C,am9511_1_popi_wait
ld bc,__IO_APU1_DATA ; the address of the APU data port in bc
in h,(c) ; load LSW from APU
in l,(c)
ret
| 24.565789 | 74 | 0.532405 |
a181f8980ff04cc1c92bdb0344da99433ca5bee4 | 6,810 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1271.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1271.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1271.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r15
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x2f9b, %rax
nop
nop
nop
nop
inc %rbx
movl $0x61626364, (%rax)
nop
nop
cmp $34780, %r12
lea addresses_D_ht+0x143a3, %rdi
nop
nop
nop
inc %rbx
movups (%rdi), %xmm4
vpextrq $1, %xmm4, %rax
nop
xor $55257, %r12
lea addresses_WT_ht+0x493f, %rsi
lea addresses_UC_ht+0x96a5, %rdi
clflush (%rdi)
nop
add $3316, %r15
mov $88, %rcx
rep movsq
nop
nop
nop
nop
xor %rcx, %rcx
lea addresses_UC_ht+0x4e23, %rsi
lea addresses_UC_ht+0x1a043, %rdi
clflush (%rsi)
nop
nop
nop
inc %rbx
mov $121, %rcx
rep movsl
nop
dec %rcx
lea addresses_WT_ht+0x3083, %rax
nop
nop
nop
nop
xor %rcx, %rcx
vmovups (%rax), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $1, %xmm5, %rsi
nop
nop
nop
nop
nop
and %rsi, %rsi
lea addresses_UC_ht+0x7e23, %rcx
nop
nop
nop
add $41727, %r15
movw $0x6162, (%rcx)
inc %rsi
lea addresses_normal_ht+0x170e3, %rsi
nop
nop
nop
nop
nop
sub %r12, %r12
mov $0x6162636465666768, %rax
movq %rax, %xmm3
vmovups %ymm3, (%rsi)
and $2202, %rbx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r15
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r15
push %r8
push %rdx
push %rsi
// Store
lea addresses_RW+0x1b0a3, %r10
nop
nop
nop
xor $5408, %rsi
movw $0x5152, (%r10)
add %rsi, %rsi
// Store
mov $0x643, %rdx
nop
nop
nop
nop
nop
xor %r15, %r15
movw $0x5152, (%rdx)
nop
nop
nop
nop
cmp $41868, %r11
// Store
lea addresses_normal+0x14a23, %r10
nop
cmp $61854, %r11
mov $0x5152535455565758, %r12
movq %r12, %xmm4
vmovaps %ymm4, (%r10)
nop
nop
nop
nop
sub $13627, %rsi
// Store
mov $0x140b8d0000000623, %rsi
nop
nop
nop
nop
sub %r8, %r8
mov $0x5152535455565758, %r12
movq %r12, (%rsi)
nop
nop
nop
nop
dec %r12
// Faulty Load
lea addresses_D+0x14e23, %r8
nop
nop
nop
nop
nop
and %rdx, %rdx
vmovups (%r8), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $1, %xmm5, %r10
lea oracles, %r11
and $0xff, %r10
shlq $12, %r10
mov (%r11,%r10,1), %r10
pop %rsi
pop %rdx
pop %r8
pop %r15
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_D'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 7, 'same': False, 'type': 'addresses_RW'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 4, 'same': False, 'type': 'addresses_P'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 9, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 11, 'same': False, 'type': 'addresses_NC'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': True, 'type': 'addresses_D'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 3, 'same': True, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 1, 'same': True, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 1, 'same': False, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 0, 'same': True, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 9, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 1, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 11, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 2, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'}
{'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
*/
| 33.880597 | 2,999 | 0.656681 |
e3763be98e51d6fed210f911cc1b823ae1d555b2 | 1,053 | asm | Assembly | src/samples.asm | headkaze/zxnext_dma_sample | 520a6dcbe357d8cc06d4d19ab751cc83d6109cd6 | [
"MIT"
] | null | null | null | src/samples.asm | headkaze/zxnext_dma_sample | 520a6dcbe357d8cc06d4d19ab751cc83d6109cd6 | [
"MIT"
] | null | null | null | src/samples.asm | headkaze/zxnext_dma_sample | 520a6dcbe357d8cc06d4d19ab751cc83d6109cd6 | [
"MIT"
] | null | null | null | PUBLIC _mothership_start
PUBLIC _mothership_end
PUBLIC _steam_start
PUBLIC _steam_end
PUBLIC _explode_start
PUBLIC _explode_end
PUBLIC _zapzapdii_start
PUBLIC _zapzapdii_end
PUBLIC _dub1_start
PUBLIC _dub1_end
PUBLIC _dub2_start
PUBLIC _dub2_end
PUBLIC _dub3_start
PUBLIC _dub3_end
PUBLIC _dub4_start
PUBLIC _dub4_end
PUBLIC _wawawawa_start
PUBLIC _wawawawa_end
PUBLIC _zzzzrrrttt_start
PUBLIC _zzzzrrrttt_end
SECTION BANK_15
_mothership_start:
BINARY "binary/mothership.pcm"
_mothership_end:
_steam_start:
BINARY "binary/steam.pcm"
_steam_end:
SECTION BANK_16
_explode_start:
BINARY "binary/explode.pcm"
_explode_end:
SECTION BANK_17
_zapzapdii_start:
BINARY "binary/zapzapdii.pcm"
_zapzapdii_end:
_dub1_start:
BINARY "binary/dub1.pcm"
_dub1_end:
_dub2_start:
BINARY "binary/dub2.pcm"
_dub2_end:
_dub3_start:
BINARY "binary/dub3.pcm"
_dub3_end:
_dub4_start:
BINARY "binary/dub4.pcm"
_dub4_end:
_wawawawa_start:
BINARY "binary/wawawawa.pcm"
_wawawawa_end:
SECTION BANK_18
_zzzzrrrttt_start:
BINARY "binary/zzzzrrrttt.pcm"
_zzzzrrrttt_end:
| 15.26087 | 30 | 0.846154 |
929719ae7bba640ef61296db8558f3d573ce0bce | 4,245 | asm | Assembly | project.asm | AbdullahADhaim/AssemblyPaint | c57999c23d832ba46dc0ce905a62100d25382bd2 | [
"MIT"
] | null | null | null | project.asm | AbdullahADhaim/AssemblyPaint | c57999c23d832ba46dc0ce905a62100d25382bd2 | [
"MIT"
] | null | null | null | project.asm | AbdullahADhaim/AssemblyPaint | c57999c23d832ba46dc0ce905a62100d25382bd2 | [
"MIT"
] | null | null | null | ; Keyboard Commands : e -> Eraser Mode , g -> Green Color , w -> White Color , y -> Yellow Color
.data
n db 8 ; 320/40 & 200/25 both equals 8
temp DB 1
COLOR DB 1
BRUSH DB 1
.code
mov al, 13h
mov ah, 0
int 10h ; Setup Graphics
mov ax, 0
int 33h ;init mouse
mov BH , 0
;------------ SOME RUBUSH TO GIVE TIME TO MAXIMIZE THE SCREEN
mov cx , 10
LBL:
push CX
mov al , '.'
mov ah, 09h
mov BH , 0
MOV cx , 2
int 10h
POP CX
loop LBL
;------------ SOME RUBUSH TO GIVE TIME TO MAXIMIZE THE SCREEN END
mov cx ,4
mov dh , 2
mov COLOR , 1111b ; Set Default Color
mov BRUSH , '*' ; Set Default Brush
GREEN: MOV BL , 0010b ;Green
call DrawColorBoxex
loop GREEN
mov cx ,4
add dh , 3
WHITE: MOV BL , 1111b ;White
call DrawColorBoxex
loop WHITE
mov cx ,4
add dh , 3
Yellow: MOV BL , 1110b ;Yellow
call DrawColorBoxex
loop Yellow
MOV BL , 1111b ;White
add dh ,1
MOV AL , '/'
Call DrawBrush
MOV AL , '*'
Call DrawBrush
MOV AL , '$'
Call DrawBrush
L1:
mov AH ,01h
int 16h
jz p2 ;If nothing pressed by user continue
cmp AL , 'g'
jne ChangeToWhite
mov COLOR , 0010b
ChangeToWhite:
cmp AL , 'w'
jne ChangeYellow
mov COLOR , 1111b
ChangeYellow:
cmp AL , 'y'
jne MakeEraser
mov COLOR , 1110b
MakeEraser:
cmp AL , 'e'
jne Flush
mov COLOR , 0
Flush:
mov AH ,0ch
int 21h ;FLush KeyBoard
p2:
push DX
mov ax , 3
int 33h
CMP BX , 1
JNE NEXT ; if mouse is not clicked dont draw
push CX
push DX
shr CX , 4
shr DX , 3
; ----- Check Color Changed -------------
cmp CX , 3 ; If Exceeded Column 3 Color Won't Be Changed
ja ColornotChanged
CheckGreen:
cmp DX , 2 ;Check If Green Clicked From 2 til 5
jb CheckWhite
cmp DX , 5
ja CheckWhite
mov BL , 0010b ;Change Color To Green
jmp AFTER_COLOR_CHANGED
CheckWhite:
cmp DX , 9 ;Check IfWhite Clicked From 9 til 12
jb CheckYellow
cmp DX , 12
ja CheckYellow
mov BL , 1111b ;Change Color To WHITE
jmp AFTER_COLOR_CHANGED
CheckYellow:
cmp DX , 16 ;Check If Yellow Clicked From 16 til 19
jb CheckSlash
cmp DX , 19
ja CheckSlash
mov BL , 1110b ;Change Color To Yellow
jmp AFTER_COLOR_CHANGED
; ----- Check Brush Changed -------------
CheckSlash:
cmp DX , 21 ;Check / On Line 21
jne CheckASterisk
mov BRUSH , '/'
jmp NEXT
CheckASterisk:
cmp DX , 22 ;Check * On Line 22
jne CheckDollar
mov BRUSH , '*'
jmp NEXT
CheckDollar:
cmp DX , 23 ;Check $ On Line 23
jne ColornotChanged
mov BRUSH , '$'
jmp NEXT
AFTER_COLOR_CHANGED:
mov COLOR , BL
jmp NEXT
ColornotChanged:POP DX
POP CX
Call DrawChar
NEXT: jmp L1
proc DrawChar
mov bh , 0 ; PAGE NUMBER
shr cx , 1 ; CX is Doubled , DIV by 2
mov AX , CX
div n
mov temp , al ; not to loose data after the second division
mov ax , dx
div n
; After Converting X & Y to their corresponding ROW AND COL assign them for drawing
mov dh , al
mov dl , temp
mov ah, 2
int 10h ; Set Cursor Position
mov al , BRUSH ;CHAR
MOV BL , COLOR ;COLOR
;MOV BL , 1100b ;COLOR
MOV cx , 1
mov ah , 09h
int 10h
ret
endP DrawChar
proc DrawColorBoxex USES CX ;Parameters BL -> Color
push CX
mov ah, 2
mov dl , 0
int 10h ; Set Cursor Position
mov al , '*' ;CHAR
MOV cx , 4
mov ah , 09h
int 10h
add dh , 1
pop CX
ret
endP DrawColorBoxex
proc DrawBrush ;Parameters AL -> BRUSH
push CX
mov ah, 2
mov dl , 0
int 10h ; Set Cursor Position
MOV cx , 1
mov ah , 09h
int 10h
add dh , 1
pop CX
ret
endP DrawBrush | 19.836449 | 97 | 0.532627 |
03d68316148a58f7ee168cefcb7645fb0b3f5e1b | 636 | asm | Assembly | unittests/ASM/H0F38/66_F1_3.asm | fengjixuchui/FEX | 287c65dc6414523ec74303c4b1d03123ae720d6b | [
"MIT"
] | null | null | null | unittests/ASM/H0F38/66_F1_3.asm | fengjixuchui/FEX | 287c65dc6414523ec74303c4b1d03123ae720d6b | [
"MIT"
] | null | null | null | unittests/ASM/H0F38/66_F1_3.asm | fengjixuchui/FEX | 287c65dc6414523ec74303c4b1d03123ae720d6b | [
"MIT"
] | null | null | null | %ifdef CONFIG
{
"RegData": {
"RAX": "0x000000005c3bc5b0",
"RBX": "0x000000001dd5b1e5",
"RCX": "0x0000000015d1c92d"
}
}
%endif
mov rax, 0x41424344454647
mov rbx, 0x51525354555657
mov rcx, 0x61626364656667
mov rdx, 0x71727374757677
; crc32 rax, rbx
db 0x66 ; Override, Should be ignored
db 0xf2 ; Prefix
db 0x48 ; REX.W
db 0x0f, 0x38, 0xf1, 0xc3
; crc32 rbx, rcx
db 0xf2 ; Prefix
db 0x66 ; Override, Should be ignored
db 0x48 ; REX.W
db 0x0f, 0x38, 0xf1, 0xd9
; crc32 rcx, rdx
db 0x66 ; Override, Should be ignored
db 0xf2 ; Prefix
db 0x66 ; Override, Should be ignored
db 0x48 ; REX.W
db 0x0f, 0x38, 0xf1, 0xca
hlt
| 17.189189 | 37 | 0.701258 |
91792d3a363ff8b1ef98dbc1a07ad9d229def189 | 8,827 | asm | Assembly | MasmEd/Addins/Project/Sniplets.asm | CherryDT/FbEditMOD | beb0eb22cae1b8f7203d55bd6b293d8ec88231ca | [
"Unlicense"
] | 11 | 2016-12-03T16:35:42.000Z | 2022-03-26T06:02:53.000Z | MasmEd/Addins/Project/Sniplets.asm | CherryDT/FbEditMOD | beb0eb22cae1b8f7203d55bd6b293d8ec88231ca | [
"Unlicense"
] | 1 | 2018-02-24T20:17:46.000Z | 2018-03-02T08:57:40.000Z | MasmEd/Addins/Project/Sniplets.asm | CherryDT/FbEditMOD | beb0eb22cae1b8f7203d55bd6b293d8ec88231ca | [
"Unlicense"
] | 4 | 2018-10-19T01:14:55.000Z | 2021-09-11T18:51:48.000Z |
FBM_GETIMAGELIST equ WM_USER+13 ;wParam=0, lParam=0
REM_BASE equ WM_USER+1000
REM_SETFONT equ REM_BASE+1 ;wParam=nLineSpacing, lParam=lpRAFONT
REM_GETFONT equ REM_BASE+2 ;wParam=0, lParam=lpRAFONT
REM_SETCOLOR equ REM_BASE+3 ;wParam=0, lParam=lpRACOLOR
REM_GETCOLOR equ REM_BASE+4 ;wParam=0, lParam=lpRACOLOR
RAFONT struct
hFont dd ? ;Code edit normal
hIFont dd ? ;Code edit italics
hLnrFont dd ? ;Line numbers
RAFONT ends
RACOLOR struct
bckcol dd ? ;Back color
txtcol dd ? ;Text color
selbckcol dd ? ;Sel back color
seltxtcol dd ? ;Sel text color
cmntcol dd ? ;Comment color
strcol dd ? ;String color
oprcol dd ? ;Operator color
hicol1 dd ? ;Line hilite 1
hicol2 dd ? ;Line hilite 2
hicol3 dd ? ;Line hilite 3
selbarbck dd ? ;Selection bar
selbarpen dd ? ;Selection bar pen
lnrcol dd ? ;Line numbers color
numcol dd ? ;Numbers & hex color
cmntback dd ? ;Comment back color
strback dd ? ;String back color
numback dd ? ;Numbers & hex back color
oprback dd ? ;Operator back color
changed dd ? ;Line changed indicator
changesaved dd ? ;Line saved chane indicator
RACOLOR ends
;Sniplets.dlg
IDD_DLGSNIPLETS equ 4000
IDC_TRVSNIPLET equ 1001
IDC_RAECODE equ 1002
IDC_BTNOUTPUT equ 1003
.data?
szFile db MAX_PATH dup(?)
.code
TrvAddNode proc hTrv:HWND,hPar:DWORD,lpPth:DWORD,nImg:DWORD
LOCAL tvins:TV_INSERTSTRUCT
mov eax,hPar
mov tvins.hParent,eax
mov tvins.item.lParam,eax
mov tvins.hInsertAfter,0
mov tvins.item._mask,TVIF_TEXT or TVIF_PARAM or TVIF_IMAGE or TVIF_SELECTEDIMAGE
mov eax,lpPth
mov tvins.item.pszText,eax
mov eax,nImg
mov tvins.item.iImage,eax
mov tvins.item.iSelectedImage,eax
invoke SendMessage,hTrv,TVM_INSERTITEM,0,addr tvins
ret
TrvAddNode endp
GetFileImg proc uses esi,lpFile:DWORD
mov esi,lpFile
invoke lstrlen,esi
.while eax
.if byte ptr [esi+eax-1]=='.'
.break
.endif
dec eax
.endw
lea esi,[esi+eax]
invoke lstrcmpi,esi,offset szAsmFile
.if !eax
mov eax,2
.else
invoke lstrcmpi,esi,offset szIncFile
.if !eax
mov eax,3
.else
invoke lstrcmpi,esi,offset szRcFile
.if !eax
mov eax,4
.else
mov eax,5
.endif
.endif
.endif
ret
GetFileImg endp
TrvDir proc hTrv:HWND,hPar:DWORD,lpPth:DWORD
LOCAL buffer[MAX_PATH]:BYTE
LOCAL hwfd:DWORD
LOCAL hpar:DWORD
LOCAL ftp:DWORD
;Make the path local
invoke lstrcpy,addr buffer,lpPth
;Check if path ends with '\'. If not add.
invoke lstrlen,addr buffer
dec eax
mov al,buffer[eax]
.if al!='\'
invoke lstrcat,addr buffer,addr szBS
.endif
;Add '*.*'
invoke lstrcat,addr buffer,addr szAPA
;Find first match, if any
invoke FindFirstFile,addr buffer,addr wfd
.if eax!=INVALID_HANDLE_VALUE
;Save returned handle
mov hwfd,eax
Next:
;Check if found is a dir
mov eax,wfd.dwFileAttributes
and eax,FILE_ATTRIBUTE_DIRECTORY
.if eax
;Do not include '.' and '..'
mov al,wfd.cFileName
.if al!='.'
invoke TrvAddNode,hTrv,hPar,addr wfd.cFileName,1
mov hpar,eax
invoke lstrlen,addr buffer
mov edx,eax
push edx
sub edx,3
;Do not remove the '\'
mov al,buffer[edx]
.if al=='\'
inc edx
.endif
;Add new dir to path
invoke lstrcpy,addr buffer[edx],addr wfd.cFileName
;Call myself again, thats recursive!
invoke TrvDir,hTrv,hpar,addr buffer
pop edx
;Remove what was added
mov buffer[edx],0
.endif
.else
;Add file
;Some file filtering could be done here
invoke GetFileImg,addr wfd.cFileName
invoke TrvAddNode,hTrv,hPar,addr wfd.cFileName,eax
.endif
;Any more matches?
invoke FindNextFile,hwfd,addr wfd
or eax,eax
jne Next
;No more matches, close find
invoke FindClose,hwfd
.endif
;Sort the children
invoke SendMessage,hTrv,TVM_SORTCHILDREN,0,hPar
;Expand the tree
invoke SendMessage,hTrv,TVM_EXPAND,TVE_EXPAND,hPar
ret
TrvDir endp
StreamInProc proc hFile:DWORD,pBuffer:DWORD,NumBytes:DWORD,pBytesRead:DWORD
invoke ReadFile,hFile,pBuffer,NumBytes,pBytesRead,0
xor eax,1
ret
StreamInProc endp
SnipletsProc proc uses ebx,hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
LOCAL rafnt:RAFONT
LOCAL racol:RACOLOR
LOCAL hTrv:HWND
LOCAL hREd:HWND
LOCAL buffer[MAX_PATH]:BYTE
LOCAL buffer1[MAX_PATH]:BYTE
LOCAL hFile:HANDLE
LOCAL editstream:EDITSTREAM
LOCAL chrg:CHARRANGE
mov eax,uMsg
.if eax==WM_INITDIALOG
mov ebx,lpHandles
invoke SendMessage,[ebx].ADDINHANDLES.hBrowse,FBM_GETIMAGELIST,0,0
invoke SendDlgItemMessage,hWin,IDC_TRVSNIPLET,TVM_SETIMAGELIST,TVSIL_NORMAL,eax
invoke SendMessage,[ebx].ADDINHANDLES.hOut,REM_GETFONT,0,addr rafnt
invoke SendDlgItemMessage,hWin,IDC_RAECODE,REM_SETFONT,0,addr rafnt
invoke SendMessage,[ebx].ADDINHANDLES.hOut,REM_GETCOLOR,0,addr racol
invoke SendDlgItemMessage,hWin,IDC_RAECODE,REM_SETCOLOR,0,addr racol
invoke GetDlgItem,hWin,IDC_TRVSNIPLET
mov hTrv,eax
invoke SendMessage,[ebx].ADDINHANDLES.hBrowse,FBM_GETIMAGELIST,0,0
invoke SendMessage,hTrv,TVM_SETIMAGELIST,TVSIL_NORMAL,eax
invoke TrvDir,hTrv,0,offset SnipletPath
.elseif eax==WM_COMMAND
mov ebx,lpHandles
mov edx,wParam
movzx eax,dx
shr edx,16
.if edx==BN_CLICKED
.if eax==IDOK
call GetText
invoke SendMessage,[ebx].ADDINHANDLES.hREd,EM_REPLACESEL,TRUE,offset tempbuff
.elseif eax==IDC_BTNOUTPUT
call GetText
invoke SendMessage,[ebx].ADDINHANDLES.hOut,WM_SETTEXT,0,offset tempbuff
.elseif eax==IDCANCEL
invoke SendMessage,hWin,WM_CLOSE,NULL,NULL
.endif
.endif
.elseif eax==WM_NOTIFY
.if wParam==IDC_TRVSNIPLET
mov edx,lParam
mov eax,(NMTREEVIEW ptr [edx]).hdr.code
.if eax==TVN_SELCHANGED
lea edx,(NMTREEVIEW ptr [edx]).itemNew
mov (TV_ITEMEX ptr [edx]).imask,TVIF_PARAM or TVIF_TEXT
lea eax,buffer
mov (TV_ITEMEX ptr [edx]).pszText,eax
mov (TV_ITEMEX ptr [edx]).cchTextMax,sizeof buffer
mov buffer1[0],0
mov buffer1[1],0
@@:
push edx
invoke SendDlgItemMessage,hWin,IDC_TRVSNIPLET,TVM_GETITEM,0,edx
invoke lstrcat,addr buffer,addr buffer1
invoke lstrcpy,addr buffer1[1],addr buffer
mov buffer1[0],'\'
pop edx
mov eax,(TV_ITEMEX ptr [edx]).lParam
.if eax
mov (TV_ITEMEX ptr [edx]).hItem,eax
jmp @b
.endif
invoke lstrcpy,addr buffer,offset SnipletPath
invoke lstrcat,addr buffer,addr buffer1
invoke lstrcmp,addr buffer,addr szFile
.if eax
invoke GetDlgItem,hWin,IDC_RAECODE
mov hREd,eax
invoke SendMessage,hREd,WM_SETTEXT,0,0
invoke lstrcpy,addr szFile,addr buffer
invoke CreateFile,addr buffer,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0
.if eax!=INVALID_HANDLE_VALUE
mov hFile,eax
invoke SendMessage,hREd,WM_SETTEXT,0,0
;stream the text into the richedit control
m2m editstream.dwCookie,hFile
mov editstream.pfnCallback,offset StreamInProc
invoke SendMessage,hREd,EM_STREAMIN,SF_TEXT,addr editstream
invoke CloseHandle,hFile
invoke SendMessage,hREd,EM_SETMODIFY,FALSE,0
invoke SendMessage,hREd,EM_SETSEL,0,0
mov ebx,lpHandles
.if [ebx].ADDINHANDLES.hREd
invoke GetWindowLong,[ebx].ADDINHANDLES.hREd,GWL_ID
mov edx,FALSE
.if eax==IDC_RAE
mov edx,TRUE
.endif
.else
mov edx,FALSE
.endif
mov eax,IDOK
call EnableBtn
mov eax,IDC_BTNOUTPUT
mov edx,TRUE
call EnableBtn
.else
mov eax,IDOK
mov edx,FALSE
call EnableBtn
mov eax,IDC_BTNOUTPUT
mov edx,FALSE
call EnableBtn
.endif
.endif
.endif
.endif
.elseif eax==WM_CLOSE
invoke EndDialog,hWin,NULL
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
EnableBtn:
push edx
invoke GetDlgItem,hWin,eax
pop edx
invoke EnableWindow,eax,edx
retn
GetText:
invoke SendDlgItemMessage,hWin,IDC_RAECODE,EM_EXGETSEL,0,addr chrg
mov eax,chrg.cpMax
.if eax==chrg.cpMin
invoke GetDlgItemText,hWin,IDC_RAECODE,offset tempbuff,sizeof tempbuff-1
.else
sub eax,chrg.cpMin
.if eax>sizeof tempbuff-1
mov eax,sizeof tempbuff-1
add eax,chrg.cpMin
mov chrg.cpMax,eax
invoke SendDlgItemMessage,hWin,IDC_RAECODE,EM_EXSETSEL,0,addr chrg
.endif
invoke SendDlgItemMessage,hWin,IDC_RAECODE,EM_GETSELTEXT,0,offset tempbuff
.endif
retn
SnipletsProc endp
| 27.413043 | 107 | 0.68551 |
bf4c27339196df5d3bf82293b18d9316835ba8a0 | 552 | asm | Assembly | oeis/017/A017500.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/017/A017500.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/017/A017500.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A017500: a(n) = (11*n + 9)^4.
; 6561,160000,923521,3111696,7890481,16777216,31640625,54700816,88529281,136048896,200533921,285610000,395254161,533794816,705911761,916636176,1171350625,1475789056,1836036801,2258530576,2750058481,3317760000,3969126001,4711998736,5554571841,6505390336,7573350625,8767700496,10098039121,11574317056,13206836241,15006250000,16983563041,19150131456,21517662721,24098215696,26904200625,29948379136,33243864241,36804120336,40642963201,44774560000,49213429281,53974440976,59072816401,64524128256
mul $0,11
add $0,9
pow $0,4
| 78.857143 | 490 | 0.856884 |
d7368dd7f76bb62f3d049cf9dd8ef4e403437072 | 5,086 | asm | Assembly | Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_16016_610.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_16016_610.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_16016_610.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r13
push %r14
push %r15
push %rbx
lea addresses_WT_ht+0x14fb3, %r10
sub %r12, %r12
mov (%r10), %bx
nop
nop
inc %r11
lea addresses_A_ht+0x1dbb3, %r14
clflush (%r14)
nop
nop
nop
add $28792, %r13
movb $0x61, (%r14)
nop
nop
nop
add %r13, %r13
pop %rbx
pop %r15
pop %r14
pop %r13
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %r15
push %r8
push %r9
push %rbp
push %rdi
push %rsi
// Store
lea addresses_US+0x5409, %rdi
nop
nop
nop
nop
nop
cmp %rbp, %rbp
mov $0x5152535455565758, %r15
movq %r15, (%rdi)
nop
nop
nop
nop
nop
and %r14, %r14
// Load
lea addresses_PSE+0x1b3b3, %r15
nop
nop
nop
inc %r8
mov (%r15), %rdi
xor %r9, %r9
// Store
lea addresses_UC+0x53b3, %r8
nop
nop
nop
nop
nop
and %r14, %r14
movw $0x5152, (%r8)
sub %rdi, %rdi
// Faulty Load
lea addresses_UC+0x53b3, %r8
nop
nop
nop
nop
nop
and %rsi, %rsi
vmovups (%r8), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $1, %xmm5, %rdi
lea oracles, %r9
and $0xff, %rdi
shlq $12, %rdi
mov (%r9,%rdi,1), %rdi
pop %rsi
pop %rdi
pop %rbp
pop %r9
pop %r8
pop %r15
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'00': 16016}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 41.688525 | 2,999 | 0.655525 |
e8807696a409e21b0c10713b3fd160b46e8e2760 | 147,331 | asm | Assembly | Library/SpecUI/CommonUI/CWin/cwinMenu.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 504 | 2018-11-18T03:35:53.000Z | 2022-03-29T01:02:51.000Z | Library/SpecUI/CommonUI/CWin/cwinMenu.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 96 | 2018-11-19T21:06:50.000Z | 2022-03-06T10:26:48.000Z | Library/SpecUI/CommonUI/CWin/cwinMenu.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 73 | 2018-11-19T20:46:53.000Z | 2022-03-29T00:59:26.000Z | COMMENT @----------------------------------------------------------------------
Copyright (c) GeoWorks 1988 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: CommonUI/CWin (common code for several specific ui's)
FILE: cwinMenu.asm
ROUTINES:
Name Description
---- -----------
GLB OLMenuWinClass Open Look/CUA/Motif window class
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 2/89 Initial version
Doug 6/89 Moved to winMenu.asm from openMenuWin.asm
Eric 7/89 Motif extensions, more documentation
Joon 9/92 PM extensions
DESCRIPTION:
$Id: cwinMenu.asm,v 1.2 98/05/04 07:35:25 joon Exp $
------------------------------------------------------------------------------@
;
; For documentation of the OLMenuWinClass see:
; /staff/pcgeos/Spec/olMenuWinClass.doc
;
CommonUIClassStructures segment resource
OLMenuWinClass mask CLASSF_DISCARD_ON_SAVE or \
mask CLASSF_NEVER_SAVED
MenuWinScrollerClass mask CLASSF_DISCARD_ON_SAVE or \
mask CLASSF_NEVER_SAVED
CommonUIClassStructures ends
;---------------------------------------------------
MenuBuild segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinInitialize -- MSG_META_INITIALIZE for OLMenuWinClass
DESCRIPTION: Initialize an OLMenuWin object for the GenInteraction.
PASS: *ds:si - instance data
es - segment of OlMenuClass
ax - MSG_META_INITIALIZE
cx, dx, bp - ?
RETURN: ax, cx, dx, bp - ?
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 2/89 Initial version
------------------------------------------------------------------------------@
OLMenuWinInitialize method dynamic OLMenuWinClass, MSG_META_INITIALIZE
;Do superclass initialization
mov di, offset OLMenuWinClass
CallSuper MSG_META_INITIALIZE
;Setup our geometry preferences before calling superclass which will
;process hints
;set menu attributes (SAVE BYTES here)
call MenuBuild_DerefVisSpec_DI
ORNF ds:[di].OLWI_fixedAttr, mask OWFA_IS_MENU
OLS < mov ds:[di].OLWI_attrs, mask OWA_SHADOW or mask OWA_FOCUSABLE >
CUAS < ORNF ds:[di].OLWI_attrs, mask OWA_THICK_LINE_BORDER \
or mask OWA_KIDS_INSIDE_BORDER or mask OWA_FOCUSABLE \
or mask OWA_CLOSABLE >
if _MENUS_PINNABLE ;------------------------------------------------------
;CUA/MOTIF: only allow pinnable menus if not in strict-compatibility mde
CUAS < call FlowGetUIButtonFlags ;get args from geosec.ini file >
CUAS < test al, mask UIBF_SPECIFIC_UI_COMPATIBLE >
CUAS < jnz noLawsuit >
OLS < ORNF ds:[di].OLWI_attrs, mask OWA_PINNABLE or mask OWA_HEADER >
CUAS < ORNF ds:[di].OLWI_attrs, mask OWA_PINNABLE >
noLawsuit:
;
; If keyboard-only, or UI concept of Pinnable menus isn't allowed,
; turn off pinnable menus altogether.
;
call OpenCheckIfKeyboardOnly ; carry set if so
jc notPinnable
push es, cx
segmov es, dgroup, cx
test es:[olWindowOptions], mask UIWO_PINNABLE_MENUS
pop es, cx
jnz afterNotPinnable
notPinnable:
andnf ds:[di].OLWI_attrs, not mask OWA_PINNABLE ; clear flag
afterNotPinnable:
endif ;------------------------------------------------------
;now set menu type
OLS < mov ds:[di].OLWI_type, OLWT_MENU >
CUAS < mov ds:[di].OLWI_type, MOWT_MENU ;set window type = MENU >
if _SUB_MENUS ;--------------------------------------------------------------
mov cx, ds:[di].OLCI_buildFlags
and cx, mask OLBF_REPLY
cmp cx, OLBR_SUB_MENU shl offset OLBF_REPLY
jnz winPosSize
OLS < mov ds:[di].OLWI_type, OLWT_SUBMENU >
CUAS < mov ds:[di].OLWI_type, MOWT_SUBMENU >
endif ;--------------------------------------------------------------
winPosSize:
;do geometry handling
call OLMenuWinScanGeometryHints
;Process hints from GenInteraction object. We want to know if the
;CUA/Motif - specific hint HINT_SYSTEM_MENU was specified.
;setup es:di to be ptr to
;Hint handler table
segmov es, cs, di
mov di, offset cs:OLMenuWinHintHandlers
mov ax, length (cs:OLMenuWinHintHandlers)
call ObjVarScanData
ret
OLMenuWinInitialize endp
;Hint handler table
OLMenuWinHintHandlers VarDataHandler \
<HINT_INFREQUENTLY_USED, offset HintNotPinnable>,
<HINT_SYS_MENU, offset OLMenuWinHintIsSystemMenu>,
<HINT_IS_EXPRESS_MENU,offset OLMenuWinHintIsExpressMenu>,
<HINT_CUSTOM_SYS_MENU, offset OLMenuWinHintCustomSysMenu>,
<HINT_INTERACTION_INFREQUENT_USAGE,offset OLMenuWinHintInfrequentUsage>
HintNotPinnable proc far
class OLMenuWinClass
call MenuBuild_DerefVisSpec_DI
OLS < ANDNF ds:[di].OLWI_attrs, not (mask OWA_PINNABLE or mask OWA_HEADER)>
CUAS < ANDNF ds:[di].OLWI_attrs, not mask OWA_PINNABLE >
ret
HintNotPinnable endp
OLMenuWinHintCustomSysMenu proc far
class OLMenuWinClass
call MenuBuild_DerefVisSpec_DI
ORNF ds:[di].OLMWI_specState, mask OMWSS_CUSTOM_SYS_MENU
ret
OLMenuWinHintCustomSysMenu endp
OLMenuWinHintInfrequentUsage proc far
class OLMenuWinClass
call MenuBuild_DerefVisSpec_DI
ORNF ds:[di].OLMWI_specState, mask OMWSS_INFREQUENT_USAGE
ret
OLMenuWinHintInfrequentUsage endp
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinScanGeometryHints --
MSG_SPEC_SCAN_GEOMETRY_HINTS for OLMenuWinClass
DESCRIPTION: Scans geometry hints.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_SPEC_SCAN_GEOMETRY_HINTS
RETURN: nothing
ax, cx, dx, bp - destroyed
ALLOWED TO DESTROY:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chris 2/ 5/92 Initial Version
------------------------------------------------------------------------------@
OLMenuWinScanGeometryHints method static OLMenuWinClass, \
MSG_SPEC_SCAN_GEOMETRY_HINTS
uses bx, di, es ; To comply w/static call requirements
.enter ; that bx, si, di, & es are preserved.
; NOTE that es is NOT segment of class
mov di, segment OLMenuWinClass
mov es, di
;handle superclass geometry stuff first
mov di, offset OLMenuWinClass
CallSuper MSG_SPEC_SCAN_GEOMETRY_HINTS
;Setup our geometry preferences before calling superclass which will
;process hints
;Make all buttons the width of the smallest
call MenuBuild_DerefVisSpec_DI
;override OLWinClass positioning/sizing behavior
;(We set the PERSIST flags so that if this menu is pinned, and then
;closed, PrepForReOpen does not set anything invalid.)
mov ds:[di].OLWI_winPosSizeFlags, \
mask WPSF_PERSIST \
or (WCT_KEEP_VISIBLE shl offset WPSF_CONSTRAIN_TYPE) \
or (WPT_AS_REQUIRED shl offset WPSF_POSITION_TYPE) \
or (WST_AS_DESIRED shl offset WPSF_SIZE_TYPE)
;process positioning and sizing hints - might not allow this
clr cx ;pass flag: no icon for this window
call OpenWinProcessHints
.leave
ret
OLMenuWinScanGeometryHints endm
COMMENT @----------------------------------------------------------------------
FUNCTION: OLMenuWinHintIsSystemMenu
DESCRIPTION: Hint handler for HINT_SYS_MENU. Internal hint to indicate
that this generic interaction group was actually created by
the specific UI, & should be turned into the CUA system
menu.
CALLED BY: INTERNAL
PASS:
*ds:si - window object
ds:bx - ptr to hint structure
ax - hint = (ds:bx).HE_type
RETURN:
ds - new segment of object block
OK TO DESTROY in hint handler:
ax, bx, si, di, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric Initial version
Doug 10/89 Added header
Eric 6/90 Added OLMenuWinHintIsExpressMenu.
------------------------------------------------------------------------------@
OLMenuWinHintIsExpressMenu proc far
FALL_THRU OLMenuWinHintIsSystemMenu ;for now, no diff.
OLMenuWinHintIsExpressMenu endp
OLMenuWinHintIsSystemMenu proc far
class OLMenuWinClass
;set the OMWA_IS_SYSTEM_MENU attribute bit for this menu window
call MenuBuild_DerefVisSpec_DI
;SAVE BYTES: may not be necessary
ORNF ds:[di].OLWI_fixedAttr, mask OWFA_IS_MENU
OLS < mov ds:[di].OLWI_type, OLWT_SYSTEM_MENU >
CUAS < mov ds:[di].OLWI_type, MOWT_SYSTEM_MENU >
;set window type = SYSTEM_MENU
ret
OLMenuWinHintIsSystemMenu endp
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinUpdateSpecBuild -- MSG_SPEC_BUILD_BRANCH
DESCRIPTION: We intercept UPDATE_SPEC_BUILD here so that menus which are
pinnable can add a PIN button. (CUA style only).
PASS:
*ds:si - instance data
es - segment of OLMenuWinClass
ax - MSG_SPEC_BUILD_BRANCH
cx - ?
dx - ?
bp - SpecBuildFlags (SBF_WIN_GROUP, etc)
RETURN:
carry - ?
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 12/89 Initial version
------------------------------------------------------------------------------@
OLMenuWinUpdateSpecBuild method dynamic OLMenuWinClass,
MSG_SPEC_BUILD_BRANCH
if ALLOW_ACTIVATION_OF_DISABLED_MENUS
;
; Make sure this is set. System menus are always enabled regardless
; of their parent's status. (Changed to always enable menus of
; any kind. -cbh 12/10/92)
;
;OLS < cmp ds:[di].OLWI_type, OLWT_SYSTEM_MENU >
;CUAS < cmp ds:[di].OLWI_type, MOWT_SYSTEM_MENU >
; jne 10$
or bp, mask SBF_VIS_PARENT_FULLY_ENABLED
;10$:
endif
if _MENUS_PINNABLE ;------------------------------------------------------
if _CUA_STYLE ;------------------------------------------------------
mov di, ds:[di].OLCI_buildFlags
and di, mask OLBF_TARGET
cmp di, OLBT_IS_POPUP_LIST shl offset OLBF_TARGET
je callSuper ;popup list, cannot pin (for now)
;first test if this MSG_SPEC_BUILD_BRANCH has been recursively
;descending the visible tree. If not, it means we are opening this menu
test bp, mask SBF_WIN_GROUP ;at top of tree?
jz callSuper ;skip if not...
push bp
call OLMenuWinEnsurePinTrigger
pop bp
endif ;--------------------------------------------------------------
endif ;--------------------------------------------------------------
callSuper:
mov ax, MSG_SPEC_BUILD_BRANCH
push bp
mov di, offset OLMenuWinClass
call ObjCallSuperNoLock
pop bp
alreadyBuilt:
;get our orientation correct. We'll be horizontal if our button
;desires it.
call MenuBuild_DerefVisSpec_DI
or ds:[di].VCI_geoAttrs, mask VCGA_ORIENT_CHILDREN_VERTICALLY
mov ax, ds:[di].OLCI_buildFlags
and ax, mask OLBF_TARGET
cmp ax, OLBT_IS_POPUP_LIST shl offset OLBF_TARGET
jne 20$ ;not popup list, leave vertical
push si
mov si, ds:[di].OLPWI_button
tst si
clc ;assume no button, choose vertical
jz 15$ ;no button, skip this, after popping si
mov ax, MSG_OL_MENU_BUTTON_INIT_POPUP_ORIENTATION
call ObjCallInstanceNoLock ;returns carry set if horizontal
15$:
pop si
jnc 20$ ;button wants us vertical, branch
call MenuBuild_DerefVisSpec_DI
and ds:[di].VCI_geoAttrs, not mask VCGA_ORIENT_CHILDREN_VERTICALLY
20$:
;if File menu, ensure File:Exit exists and has moniker
test bp, mask SBF_WIN_GROUP
jz noFileExitYet
call EnsureFileExit
noFileExitYet:
;update separators in this menu
mov ax, MSG_SPEC_UPDATE_MENU_SEPARATORS
GOTO ObjCallInstanceNoLock
OLMenuWinUpdateSpecBuild endp
MenuBuild_DerefVisSpec_DI proc near
mov di, ds:[si]
add di, ds:[di].Vis_offset
ret
MenuBuild_DerefVisSpec_DI endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CheckForCustomSystemMenu
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Checks to see if the application has provided a custom
system menu. If yes, we use it as the system menu.
The standard system menu becomes a submenu of the app
provided sys menu.
CALLED BY: OLMenuWinUpdateSpecBuild
PASS: *ds:si - Instance data
bp - SpecBuildFlags
RETURN: carry set if we called our superclass to do SPEC_BUILD_BRANCH
DESTROYED: ax, bx, cx, dx, di
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JS 8/24/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MenuBuild_DerefGen_DI proc near
mov di, ds:[si]
add di, ds:[di].Gen_offset
ret
MenuBuild_DerefGen_DI endp
if not (_DISABLE_APP_EXIT_UI)
MenuBuild_ObjMessageCallFixupDS proc near
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
ret
MenuBuild_ObjMessageCallFixupDS endp
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinVisAddChild
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Intercept MSG_VIS_ADD_CHILD to place the standard system
menu at the correct position in the app provided sys menu
CALLED BY: MSG_VIS_ADD_CHILD
PASS: *ds:si = OLMenuWinClass object
ds:di = OLMenuWinClass instance data
ds:bx = OLMenuWinClass object (same as *ds:si)
es = segment of OLMenuWinClass
ax = message #
RETURN: cx, dx = unchanged
DESTROYED: ax, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JS 8/30/92 Initial version
brianc 10/8/92 force Exit to end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLMenuWinVisAddChild method dynamic OLMenuWinClass, MSG_VIS_ADD_CHILD
uses bp
.enter
mov di, offset OLMenuWinClass
call ObjCallSuperNoLock
;
; after adding whatever it was we added, make sure the Exit trigger
; is last
; *ds:si = OLMenuWin
; ^lcx:dx = child added
;
call MenuBuild_DerefVisSpec_DI
test ds:[di].OLMWI_specState, mask OMWSS_EXIT_CREATED
jz noExit
mov ax, ATTR_OL_MENU_WIN_EXIT_TRIGGER
call ObjVarFindData ; carry set if found
jnc noExit
push cx, dx ; save child for exit
mov cx, ({optr} ds:[bx]).handle ; ^lcx:dx = exit trigger if any
mov dx, ({optr} ds:[bx]).chunk
mov ax, MSG_VIS_MOVE_CHILD
mov bp, CCO_LAST ; move to end, not dirty
call ObjCallInstanceNoLock
pop cx, dx ; restore child for return
noExit:
.leave
ret
OLMenuWinVisAddChild endm
if _MENUS_PINNABLE ;------------------------------------------------------
if _CUA_STYLE ;------------------------------------------------------
COMMENT @----------------------------------------------------------------------
FUNCTION: OLMenuWinEnsurePinTrigger
DESCRIPTION: Create a pushpin trigger, if one is needed & doesn't yet
exist.
CALLED BY: INTERNAL
OLMenuWinUpdateSpecBuild
PASS: *ds:si - OLMenuWin objec
RETURN: nothing
DESTROYED: ax, bx, cx, dx, bp, di
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 5/92 Added header
------------------------------------------------------------------------------@
OLMenuWinEnsurePinTrigger proc far
class OLMenuWinClass
.enter
;see if we already have a PinTrigger object for this menu
call MenuBuild_DerefVisSpec_DI
test ds:[di].OLWI_attrs, mask OWA_PINNABLE
jz done ;skip if not pinnable...
test ds:[di].OLWI_specState, mask OLWSS_PINNED
jnz done ;skip if already pinned...
tst ds:[di].OLPWI_pinTrigger ;See if already created
jnz done ;skip to end if so...
;create a group to hold pin trigger
push es, si
mov cx, ds:[LMBH_handle]
mov dx, si ; add to ourselves
mov di, segment GenInteractionClass
mov es, di
mov di, offset GenInteractionClass
mov ax, -1 ; init USABLE, one-way up link
mov bx, 0 ; no hints
mov bp, 0 ; ignore dirty
call OpenCreateChildObject ; ^lcx:dx = new object
pop es, si
call MenuBuild_DerefVisSpec_DI
mov ds:[di].OLPWI_pinTrigger, dx ; save chunk handle, so we
; can find it later.
push dx ; save again for short term use
push si ; save OLMenuWin chunk
EC < cmp cx, ds:[LMBH_handle] >
EC < ERROR_NE OL_ERROR >
mov si, dx ; *ds:si = pin group
mov bp, mask SBF_IN_UPDATE_WIN_GROUP or mask SBF_TREE_BUILD or \
mask SBF_VIS_PARENT_FULLY_ENABLED or VUM_NOW
mov ax, MSG_SPEC_BUILD_BRANCH
call ObjCallInstanceNoLock
;create a GenTrigger object, and place at the top of this menu
; *ds:si = pin group (parent for pin trigger)
mov cx, ds:[LMBH_handle]
pop dx ; ^lcx:dx = *ds:dx = OLMenuWin
; (destination of message)
push dx ; save OLMenuWin chunk again
mov ax, MSG_OL_POPUP_TOGGLE_PUSHPIN ; action message
mov di, handle PinMoniker ; VisualMoniker to use
mov bp, offset PinMoniker
mov bx, ATTR_GEN_TRIGGER_IMMEDIATE_ACTION ; hint to add
clc ; full gen linkage
; (we use this when we destroy
; the pin group/trigger)
call OpenCreateChildTrigger ; ^lcx:dx = new trigger
;now since we had virtually no control over where this object
;was placed in the visible tree, move it to be the first child now.
pop si ; *ds:si = OLMenuWin
mov cx, ds:[LMBH_handle] ; ^lcx:dx = pin group
pop dx
mov bp, CCO_FIRST ;make it the first child
mov ax, MSG_VIS_MOVE_CHILD
call ObjCallInstanceNoLock
done:
.leave
ret
OLMenuWinEnsurePinTrigger endp
endif ;--------------------------------------------------------------
endif ;--------------------------------------------------------------
COMMENT @----------------------------------------------------------------------
FUNCTION: EnsureFileExit
DESCRIPTION: If this is GenInteraction is marked with
ATTR_GEN_INTERACTION_GROUP_TYPE {GIGT_FILE_MENU},
make sure we have an Exit item.
CALLED BY: INTERNAL
OLMenuWinUpdateSpecBuild
PASS:
*ds:si - OLDialogWin object
RETURN:
nothing
DESTROYED:
ax, bx, cx, dx, di, bp
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 5/13/92 Initial version
VL 7/11/95 Comment out this proc if
_DISABLE_APP_EXIT_UI if true.
------------------------------------------------------------------------------@
EnsureFileExit proc near
; Don't want a File Exit if _DISABLE_APP_EXIT_UI is true.
if not (_DISABLE_APP_EXIT_UI) ;-----------------------------------------------
uses si
.enter
call MenuBuild_DerefVisSpec_DI
test ds:[di].OLMWI_specState, mask OMWSS_FILE_MENU
LONG jz done
;
; do not create Exit trigger if we are running in UILM_TRANSPARENT
; mode and we are not a Desk Accessory
; Changed to allow .ini-file override via UILO_CLOSABLE_APPS flag
; (9/9/93 -atw)
call UserGetLaunchModel ; ax = UILaunchModel
cmp ax, UILM_TRANSPARENT
jne addExit ; not UILM_TRANSPARENT, add
call UserGetLaunchOptions
test ax, mask UILO_CLOSABLE_APPS ;In transparent mode, but
jnz addExit ; override flag present, so add
; exit trigger.
mov ax, MSG_GEN_APPLICATION_GET_LAUNCH_FLAGS
call GenCallApplication ; al = AppLaunchFlags
test al, mask ALF_DESK_ACCESSORY
LONG jz done ; not DA, no Exit item
addExit:
;
; this is file menu and we want to add Exit trigger
;
mov ax, ATTR_OL_MENU_WIN_EXIT_TRIGGER
call ObjVarFindData ; carry set if found
mov cx, ({optr} ds:[bx]).handle ; ^lcx:dx = exit trigger if any
mov dx, ({optr} ds:[bx]).chunk
jc haveTrigger
push es
mov cx, ds:[LMBH_handle] ; add to this object
mov dx, si
mov di, segment GenTriggerClass
mov es, di
mov di, offset GenTriggerClass
mov al, -1 ; init USABLE
mov ah, -1 ; one-way upward generic link
clr bx
mov bp, CCO_LAST ; (not dirty)
call OpenCreateChildObject ; ^lcx:dx = new trigger
pop es
push si, cx, dx ; save OLMenuWin
mov si, dx ; *ds:si = new trigger
mov ax, ATTR_GEN_TRIGGER_INTERACTION_COMMAND or \
mask VDF_SAVE_TO_STATE
mov cx, size InteractionCommand
call ObjVarAddData ; ds:dx = pointer to extra data
mov {InteractionCommand} ds:[bx], IC_EXIT
mov ax, si ; *ds:ax = exit trigger
mov bx, mask OCF_DIRTY shl 8
call ObjSetFlags ; undo dirtying by ObjVarAddData
clr bp ; basic build
call VisSendSpecBuild ; build it
pop si, cx, dx ; *ds:si = OLMenuWin
call SaveExitTriggerInfo ; preserves cx, dx
call MenuBuild_DerefVisSpec_DI
ornf ds:[di].OLMWI_specState, mask OMWSS_EXIT_CREATED
haveTrigger:
;
; ^lcx:dx = exit trigger
;
mov bx, cx
mov si, dx
mov ax, MSG_GEN_GET_VIS_MONIKER
call MenuBuild_ObjMessageCallFixupDS ; ax = moniker (if any)
tst ax
LONG jnz done ; have moniker already
if _MOTIF or _ISUI
mov dx, -1 ; get appname from app
mov bp, (VMS_TEXT shl offset VMSF_STYLE) or mask VMSF_COPY_CHUNK
mov cx, ds:[LMBH_handle] ; copy into menu block
mov ax, MSG_GEN_FIND_MONIKER
call MenuBuild_ObjMessageCallFixupDS ; ^lcx:dx = moniker (call trig.)
LONG jcxz exitDone ; not found leave plain "Exit" moniker
mov di, dx
mov di, ds:[di] ; ds:di = app name moniker
test ds:[di].VM_type, mask VMT_GSTRING
jnz monikerDone ; carry clear
push si, es, bx
mov bx, handle StandardMonikers
call ObjLockObjBlock
mov es, ax
mov di, offset FileExitMoniker
mov di, es:[di]
mov bl, es:[di].VM_data.VMT_mnemonicOffset
add di, offset VM_data.VMT_text
push bx
push di
LocalStrLength includeNull ; cx = length w/null (for separator)
pop di
mov ax, dx
mov bx, offset VM_data.VMT_text
DBCS < shl cx, 1 >
call LMemInsertAt ; insert space in app name chunk for Exit
DBCS < shr cx, 1 >
pop bx ; bl = mnemonic offset
mov si, di
mov di, dx
mov di, ds:[di]
mov ds:[di].VM_width, 0 ; recompute size
mov ds:[di].VM_data.VMT_mnemonicOffset, bl
add di, offset VM_data.VMT_text
segxchg ds, es ; ds:si = "Exit" es:di = app name
LocalCopyString ; insert "Exit" before app name
segmov ds, es ; ds:di = app name
mov {TCHAR}ds:[di-(size TCHAR)], C_SPACE ; separator
mov bx, handle StandardMonikers
call MemUnlock ; unlock moniker resource
pop si, es, bx
mov cx, ds:[LMBH_handle]
mov bp, VUM_MANUAL
push dx
mov ax, MSG_GEN_REPLACE_VIS_MONIKER_OPTR
call MenuBuild_ObjMessageCallFixupDS
pop dx
stc ; moniker already set
monikerDone:
pushf
mov ax, dx
call LMemFree
popf
jc short afterExit
exitDone:
endif
mov cx, handle StandardMonikers
mov dx, offset FileExitMoniker
setMoniker::
mov bp, VUM_MANUAL
mov ax, MSG_GEN_REPLACE_VIS_MONIKER_OPTR
call MenuBuild_ObjMessageCallFixupDS
afterExit::
;
; do keyboard shortcut
;
mov ax, MSG_GEN_GET_KBD_ACCELERATOR
call MenuBuild_ObjMessageCallFixupDS
tst cx
jnz done ; something set already
if DBCS_PCGEOS
mov cx, KeyboardShortcut <0, 0, 0, 0, C_SYS_F3 and mask KS_CHAR>
else
mov cx, KeyboardShortcut <0, 0, 0, 0, 0xf, VC_F3>
endif
mov dl, VUM_MANUAL
mov ax, MSG_GEN_SET_KBD_ACCELERATOR
call MenuBuild_ObjMessageCallFixupDS
done:
.leave
endif ;not (_DISABLE_APP_EXIT_UI) -------------------------------------------
ret
EnsureFileExit endp
;
; pass:
; *ds:si = OLMenuWin
; ^lcx:dx = exit trigger
; return:
; nothing
; destroy:
; ax, bx
;
SaveExitTriggerInfo proc near
mov ax, ATTR_OL_MENU_WIN_EXIT_TRIGGER ; don't save to state
push cx
mov cx, size optr
call ObjVarAddData ; ds:bx = extra data
pop cx ; restore handle (returned)
mov ({optr} ds:[bx]).handle, cx
mov ({optr} ds:[bx]).chunk, dx
done:
ret
SaveExitTriggerInfo endp
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinSpecBuild -- MSG_SPEC_BUILD
DESCRIPTION: Ensure moniker if ATTR_GEN_INTERACTION_GROUP_TYPE set.
PASS:
*ds:si - instance data
es - segment of OLMenuWinClass
ax - MSG_SPEC_BUILD
cx - ?
dx - ?
bp - SpecBuildFlags (SBF_WIN_GROUP, etc)
RETURN:
carry - ?
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
Moniker must be set before calling superclass as the moniker is needed
at that time. Don't care whether SBF_WIN_GROUP or not, we need to do
this the first time through.
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 5/12/92 Initial version
------------------------------------------------------------------------------@
OLMenuWinSpecBuild method OLMenuWinClass, MSG_SPEC_BUILD
if ALLOW_ACTIVATION_OF_DISABLED_MENUS
;
; Enable menus of any kind. -cbh 12/10/92 (Actually, only those in
; a menu bar. -cbh 12/17/92)
;
mov di, ds:[di].OLCI_buildFlags
test di, mask OLBF_AVOID_MENU_BAR
jz notInMenuBar
and di, mask OLBF_TARGET
cmp di, OLBT_IS_POPUP_LIST shl offset OLBF_TARGET
jne notInMenuBar
or bp, mask SBF_VIS_PARENT_FULLY_ENABLED
notInMenuBar:
endif
;
; ensure moniker if ATTR_GEN_INTERACTION_GROUP_TYPE set
;
push ax, bp
mov ax, ATTR_GEN_INTERACTION_GROUP_TYPE
call ObjVarFindData ; ds:bx = data, if found
LONG jnc done ; not found, done
EC < VarDataSizePtr ds, bx, ax >
EC < cmp ax, size GenInteractionGroupType >
EC < ERROR_NE OL_ERROR_BAD_GEN_INTERACTION_GROUP_TYPE >
mov bl, ds:[bx] ; bl = GenInteractionGroupType
EC < cmp bl, GenInteractionGroupType >
EC < ERROR_AE OL_ERROR_BAD_GEN_INTERACTION_GROUP_TYPE >
;
; if GIGT_FILE_MENU, set flag so we know this fact later
;
cmp bl, GIGT_FILE_MENU
jne notFileMenu
call MenuBuild_DerefVisSpec_DI
ornf ds:[di].OLMWI_specState, mask OMWSS_FILE_MENU
; set this so OLPopupWinClass
; can know this
ornf ds:[di].OLPWI_flags, mask OLPWF_FILE_MENU
;
; let GenPrimary know about us
;
push es, bx, si ; save "File" menu chunk
call GenSwapLockParent ; *ds:si = parent
; bx = "File" menu block
mov di, segment GenPrimaryClass
mov es, di
mov di, offset GenPrimaryClass
call ObjIsObjectInClass ; carry set if so
call ObjSwapUnlock ; *ds - this block
; (preserves flags)
pop es, bx, si ; restore "File" menu chunk
jnc notFileMenu ; not under GenPrimary, ignore
; as "File" menu
mov cx, ds:[LMBH_handle] ; ^lcx:dx = "File" menu
mov dx, si
mov ax, MSG_OL_BASE_WIN_NOTIFY_OF_FILE_MENU
call GenCallParent ; let GenPrimary know of us
notFileMenu:
;
; check if moniker exists
; *ds:si = OLMenuWin
;
call MenuBuild_DerefGen_DI ; ds:di = gen instance
tst ds:[di].GI_visMoniker ; have vis moniker?
jnz done ; yes, leave alone
;
; add moniker based on GenInteractionGroupType
; bl = GenInteractionGroupType
;
clr bh
shl bx, 1 ; convert to word table offset
mov dx, cs:[groupTypeMonikerTable][bx] ; dx = moniker
mov cx, handle StandardMonikers ; ^lcx:dx = moniker
mov bp, VUM_MANUAL
mov ax, MSG_GEN_REPLACE_VIS_MONIKER_OPTR
call ObjCallInstanceNoLock
;
; let superclass finish up
;
done:
pop ax, bp
mov di, offset OLMenuWinClass
GOTO ObjCallSuperNoLock
OLMenuWinSpecBuild endm
groupTypeMonikerTable label word
word offset GroupTypeFileMoniker ; GIGT_FILE_MENU
word offset GroupTypeEditMoniker ; GIGT_EDIT_MENU
word offset GroupTypeViewMoniker ; GIGT_VIEW_MENU
word offset GroupTypeOptionsMoniker ; GIGT_OPTIONS_MENU
word offset GroupTypeWindowMoniker ; GIGT_WINDOW_MENU
word offset GroupTypeHelpMoniker ; GIGT_HELP_MENU
word offset GroupTypePrintMoniker ; GIGT_PRINT_GROUP
GROUP_TYPE_MONIKER_TABLE_SIZE equ $-groupTypeMonikerTable
.assert (((GIGT_PRINT_GROUP+1)*2) eq GROUP_TYPE_MONIKER_TABLE_SIZE)
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinNotifyOfInteractionCommand --
MSG_OL_WIN_NOTIFY_OF_INTERACTION_COMMAND for OLMenuWinClass
DESCRIPTION: Respond to MSG_OL_WIN_NOTIFY_OF_INTERACTION_COMMAND.
PASS: *ds:si = instance data for object
ds:di = specific instance (OLMenuWin)
dx:bp = NotifyOfInteractionCommandStruct
RETURN: nothing
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 4/90 initial version
------------------------------------------------------------------------------@
OLMenuWinNotifyOfInteractionCommand method dynamic OLMenuWinClass,
MSG_OL_WIN_NOTIFY_OF_INTERACTION_COMMAND
;
; notification of MSG_GEN_TRIGGER_INTERACTION_COMMAND
;
mov es, dx ; es:bp = NOICS_
cmp es:[bp].NOICS_ic, IC_EXIT
jne done ; if non-EXIT IC trigger in
; menu, ignore it
; did we create one?
test ds:[di].OLMWI_specState, mask OMWSS_EXIT_CREATED
jnz done ; yes, don't save again
mov cx, es:[bp].NOICS_optr.handle
mov dx, es:[bp].NOICS_optr.chunk
call SaveExitTriggerInfo
done:
ret
OLMenuWinNotifyOfInteractionCommand endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinECCheckCascadeData
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: EC only code which checks consistency of the IS_CASCADING
bit and ATTR_OL_MENU_WIN_CASCADED_MENU vardata.
CALLED BY: Cascade menu code
PASS: *ds:si = object ptr
RETURN: nothing
DESTROYED: nothing, even flags are maintained.
SIDE EFFECTS: Dies if inconsistent.
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JimG 4/27/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _CASCADING_MENUS and ERROR_CHECK
OLMenuWinECCheckCascadeData proc far
uses ax,bx,cx,dx,di,ds,es
.enter
pushf
mov ax, ATTR_OL_MENU_WIN_CASCADED_MENU
call ObjVarFindData ; if data, ds:bx = ptr
mov dl, TRUE ; found var data?
jc lookAtBit
mov dl, FALSE ; no.. didn't find it
lookAtBit:
mov di, ds:[si]
add di, ds:[di].Vis_offset
test ds:[di].OLMWI_moreSpecState, mask OMWMSS_IS_CASCADING
mov dh, TRUE ; bit set?
jnz doTests
mov dh, FALSE ; no, bit clear
doTests:
; dl = is there var data? TRUE/FALSE
; dh = is the CASCADING bit set? TRUE/FALSE
cmp dl, dh
ERROR_NE OL_ERROR ; INCONSISTENT dl & dh
tst dl
jz done
; check var data's contents -- should be valid optr
push si
mov si, ds:[bx].offset
mov bx, ds:[bx].handle
call ECCheckLMemOD
pop si
done:
popf
.leave
ret
OLMenuWinECCheckCascadeData endp
endif ;_CASCADING_MENUS and ERROR_CHECK
MenuBuild ends
WinClasses segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinGupQuery -- MSG_SPEC_GUP_QUERY for OLMenuWinClass
DESCRIPTION: Respond to a query traveling up the generic composite tree -
see OLMapGroup (in CSpec/cspecInteraction.asm) for info.
PASS: *ds:si - instance data
es - segment of OLMenuWinClass
ax - MSG_SPEC_GUP_QUERY
cx - Query type (GenQueryType or SpecGenQueryType)
dx -?
bp - OLBuildFlags
RETURN: carry - set if query acknowledged, clear if not
bp - OLBuildFlags
cx:dx - vis parent
DESTROYED: ?
PSEUDO CODE/STRATEGY:
see OLMapGroup for details
if (query = SGQT_BUILD_INFO) {
respond:
TOP_MENU = 0
SUB_MENU = 1
visParent = this object
} else {
send query to superclass (will send to generic parent)
}
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 7/89 Adapted from Tony's new handler.
------------------------------------------------------------------------------@
OLMenuWinGupQuery method dynamic OLMenuWinClass, MSG_SPEC_GUP_QUERY
cmp cx, SGQT_BUILD_INFO ;can we answer this query?
jne noAnswer ;skip if so...
EC < test bp, mask OLBF_REPLY >
EC < ERROR_NZ OL_BUILD_FLAGS_MULTIPLE_REPLIES >
or bp, OLBR_SUB_MENU shl offset OLBF_REPLY
;
; We'll return ourselves, but if an OLCtrl was the generic parent
; of the querying object, it will set itself as the visual parent
; rather than this object. -cbh 5/11/92
;
call WinClasses_Mov_CXDX_Self
stc ;return query acknowledged
ret
noAnswer:
FALL_THRU WinClasses_ObjCallSuperNoLock_OLMenuWinClass_Far
OLMenuWinGupQuery endp
WinClasses_ObjCallSuperNoLock_OLMenuWinClass_Far proc far
call WinClasses_ObjCallSuperNoLock_OLMenuWinClass
ret
WinClasses_ObjCallSuperNoLock_OLMenuWinClass_Far endp
WinClasses ends
;-------------------------------
MenuSepQuery segment resource
COMMENT @----------------------------------------------------------------------
FUNCTION: OLMenuWinUpdateMenuSeparators --
MSG_SPEC_UPDATE_MENU_SEPARATORS handler
DESCRIPTION: This method is sent when an object in the menu decides that
a separator in the menu might need to change. We start a
wandering query, which updates the appropriate items
in the menu.
PASS: *ds:si = instance data for object
RETURN: nothing
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 3/90 initial version
------------------------------------------------------------------------------@
OLMenuWinUpdateMenuSeparators method dynamic OLMenuWinClass, \
MSG_SPEC_UPDATE_MENU_SEPARATORS
clr ch ;pass flags: initiate query
mov ax, MSG_SPEC_MENU_SEP_QUERY
GOTO ObjCallInstanceNoLock
OLMenuWinUpdateMenuSeparators endm
COMMENT @----------------------------------------------------------------------
FUNCTION: OLMenuWinSpecMenuSepQuery -- MSG_SPEC_MENU_SEP_QUERY handler
DESCRIPTION: This method travels the visible tree within a menu,
to determine which OLMenuItemGroups need top and bottom
separators to be drawn.
PASS: *ds:si = instance data for object
ch = MenuSepFlags
RETURN: ch = MenuSepFlags (updated)
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 3/90 initial version
------------------------------------------------------------------------------@
OLMenuWinSpecMenuSepQuery method dynamic OLMenuWinClass, \
MSG_SPEC_MENU_SEP_QUERY
;see if we are initiating this query, or if it has travelled the
;entire visible tree in the menu already.
test ch, mask MSF_FROM_CHILD
jnz fromChild ;skip if reached end of visible tree...
GOTO VisCallFirstChild
fromChild:
;this method has travelled the entire visible tree in the menu,
;and was sent by the last child to this root node. Begin the
;process of un-recursing.
ANDNF ch, not (mask MSF_SEP or mask MSF_USABLE or mask MSF_FROM_CHILD)
;indicate no need for separator yet
stc
ret
OLMenuWinSpecMenuSepQuery endm
MenuSepQuery ends
;-------------------------------
WinClasses segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinActivate -- MSG_OL_POPUP_ACTIVATE for OLMenuWinClass
DESCRIPTION: Open this menu, allowing it to be active
PASS: *ds:si - instance data
es - segment of OlMenuClass
ax - MSG_ACTIVATE_MENU
cx, dx - location to make active (field coordinates)
bp - ?
RETURN: ax, cx, dx, bp - ?
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 2/89 Initial version
------------------------------------------------------------------------------@
OLMenuWinActivate method dynamic OLMenuWinClass, MSG_OL_POPUP_ACTIVATE
mov bp, VUM_MANUAL ;assume menu is not visible
if _MENUS_PINNABLE ;------------------------------------------------------
;if menu is pinned, un-pin it
test ds:[di].OLWI_specState, mask OLWSS_PINNED
jz afterPinned ;skip if not pinned (not visible)...
;first save menu's current position so that it can be restored when
;the menu button is released. Start by stuffing the desired location
;of the menu into our "OLWI_prevWinBounds" variable, so the Swap
;routine stuffs them into the visible bounds.
push cx, dx
call WinClasses_DerefVisSpec_DI
clr ds:[di].OLWI_prevWinBounds.R_left
clr ds:[di].OLWI_prevWinBounds.R_top
mov ds:[di].OLWI_prevWinBounds.R_right, -1
mov ds:[di].OLWI_prevWinBounds.R_bottom, -1
ORNF ds:[di].OLMWI_specState, mask OMWSS_WAS_PINNED
;indicate was pinned, so want to
;restore to old location when closes
push ds:[di].OLWI_attrs
call OpenWinSwapState ;swap attributes, position and size
;flags, and visible bounds
;restore attributes trashed during swap
call WinClasses_DerefVisSpec_DI
pop ds:[di].OLWI_attrs
OLS < ANDNF ds:[di].OLWI_attrs, not (mask OWA_PINNABLE or mask OWA_HEADER) >
CUAS < ANDNF ds:[di].OLWI_attrs, not (mask OWA_PINNABLE) >
;set temporarily not pinnable
;make menu unpinned, but DO NOT CLOSE IT!
clr bp ;pass FALSE flag
mov ax, MSG_OL_POPUP_TOGGLE_PUSHPIN
call WinClasses_ObjCallSuperNoLock_OLMenuWinClass
;borders and header attributes have been updated, and children
;marked as invalid if necessary. Now resize window to desired size
;again, and update it.
mov cx, mask RSA_CHOOSE_OWN_SIZE ;set win group to desired size
mov dx, mask RSA_CHOOSE_OWN_SIZE ;(just changes bounds)
call VisSetSize
mov cl, mask VOF_GEOMETRY_INVALID ;set geometry invalid here
call WinClasses_VisMarkInvalid_MANUAL
pop cx, dx
mov bp, VUM_NOW ;force an update below
endif ;------------------------------------------------------
afterPinned:
;enforce positioning behavior: keep menu visible, and place below
;our menu button. (bp = VisUpdateMode)
;Preserve WPSF_SHRINK_DESIRED_SIZE_TO_FIT_IN_PARENT flag when setting
;this stuff up. -cbh 1/18/93
call WinClasses_DerefVisSpec_DI
and ds:[di].OLWI_winPosSizeFlags, \
mask WPSF_SHRINK_DESIRED_SIZE_TO_FIT_IN_PARENT
or ds:[di].OLWI_winPosSizeFlags, \
mask WPSF_PERSIST \
or (WCT_KEEP_VISIBLE shl offset WPSF_CONSTRAIN_TYPE) \
or (WPT_AS_REQUIRED shl offset WPSF_POSITION_TYPE) \
or (WST_AS_DESIRED shl offset WPSF_SIZE_TYPE)
;make popup lists redo their geometry, if necessary, to stay onscreen
;(No, let's do this for all menus. We can't have menus trailing off
; the screen!)
; push cx
; mov cx, ds:[di].OLCI_buildFlags
; and cx, mask OLBF_TARGET
; cmp cx, OLBT_IS_POPUP_LIST shl offset OLBF_TARGET
; jne 10$ ;not popup list, branch
or ds:[di].OLWI_winPosSizeFlags, \
mask WPSF_SHRINK_DESIRED_SIZE_TO_FIT_IN_PARENT
;10$:
; pop cx
;not yet in stay-up mode
ANDNF ds:[di].OLMWI_specState, not (mask OMWSS_IN_STAY_UP_MODE)
;Position menu based on cx, dx passed
push bp
call VisSetPosition
pop dx ;set dl = VisUpdateMode
; Mark window as invalid, from move
mov cl, mask VOF_WINDOW_INVALID ;set this flag
call WinClasses_VisMarkInvalid
;Send method to do vis update, bring to top.
mov ax, MSG_GEN_INTERACTION_INITIATE
call WinClasses_ObjCallSuperNoLock_OLMenuWinClass
;start SelectMyControlsOnly mechanism for menu window.
;(See documentation for OLWinClass)
mov ax, MSG_OL_WIN_STARTUP_GRAB
call WinClasses_ObjCallInstanceNoLock
;if this is a popup-menu (no menu button), then grab the Gadget
;exclusive from the parent window, so that we know to close
;if the parent closes unexpectedly.
call WinClasses_DerefVisSpec_DI
tst ds:[di].OLPWI_button ;do we have a menu button?
jnz done ;skip if so...
call OLMenuWinGrabRemoteGadgetExcl
done:
ret
OLMenuWinActivate endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinInitiate
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Startup a menu window in stay-up-mode.
CALLED BY: MSG_GEN_INTERACTION_INITIATE
PASS: *ds:si = OLMenuWinClass object
ds:di = OLMenuWinClass instance data
ds:bx = OLMenuWinClass object (same as *ds:si)
es = segment of OLMenuWinClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JS 9/18/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLMenuWinInitiate method dynamic OLMenuWinClass,
MSG_GEN_INTERACTION_INITIATE
;not yet in stay-up mode
ANDNF ds:[di].OLMWI_specState, not (mask OMWSS_IN_STAY_UP_MODE)
;Send method to do vis update, bring to top.
mov ax, MSG_GEN_INTERACTION_INITIATE
call WinClasses_ObjCallSuperNoLock_OLMenuWinClass
;start SelectMyControlsOnly mechanism for menu window.
;(See documentation for OLWinClass)
mov ax, MSG_OL_WIN_STARTUP_GRAB
call WinClasses_ObjCallInstanceNoLock
;enter stay-up mode
mov ax, MSG_MO_MW_ENTER_STAY_UP_MODE
mov cx, TRUE ; grab gadget exclusive
GOTO ObjCallInstanceNoLock
OLMenuWinInitiate endm
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinInteractionCommand
DESCRIPTION: If IC_DISMISS, dismiss the menu. If IC_EXIT, exit the app.
PASS:
*ds:si - instance data
es - segment of OLMenuWinClass
ax - MSG_GEN_GUP_INTERACTION_COMMAND
cx - InteractionCommand
RETURN:
carry - set (query answered)
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 8/89 Initial version
------------------------------------------------------------------------------@
OLMenuWinInteractionCommand method dynamic OLMenuWinClass,
MSG_GEN_GUP_INTERACTION_COMMAND
;
; handle only IC_DISMISS and IC_EXIT
;
cmp cx, IC_DISMISS
je dismiss
cmp cx, IC_EXIT
je exit
; else, let superclass handle
mov di, offset OLMenuWinClass
GOTO ObjCallSuperNoLock ; need tail recurse here
dismiss:
;first: see if this menu is transitioning from pinned & opened from
;menu button to just pinned. If so, abort - there is already
;a MSG_OL_POPUP_TOGGLE_PUSHPIN in progress; we arrived here
;because the toggle operation restores the focus to an object which
;grabs the gadget exclusive from the menu button, and so the menu button
;is asking the menu to close. Just ignore it.
test ds:[di].OLMWI_specState, mask OMWSS_RE_PINNING
jnz done ;skip to abort...
notRePinning:
ForceRef notRePinning
;If this menu is pinned, toggle its pushpin status.
test ds:[di].OLWI_specState, mask OLWSS_PINNED
jz notPinned ;skip if not pinned...
isPinnedSoToggle:
ForceRef isPinnedSoToggle
;menu is pinned: toggle the pinned status: this will
;send a MSG_GEN_GUP_INTERACTION_COMMAND {IC_DISMISS} to the menu.
mov bp, TRUE ;pass flag: dismiss menu
mov ax, MSG_OL_POPUP_TOGGLE_PUSHPIN
call WinClasses_ObjCallInstanceNoLock
jmp short done
notPinned: ;if this menu was pinned before it was opened under the menu button,
;then restore it to that state now. (Keeps the focus)
test ds:[di].OLMWI_specState, mask OMWSS_WAS_PINNED
jz notPinnedWasNotPinned ;skip if was not pinned...
;notPinnedButWasPinned:
;HACK: the toggle pushpin code is going to release the FOCUS exclusive
;from this window, and so the base window may restore the FOCUS
;to an object on the base window which will take the gadget exclusive,
;such as a GenTrigger. The menu button which opens this menu will
;lose the gadget exclusive, and tell this menu to close. To prevent the
;menu from closing, set OMWSS_RE_PINNING)
ANDNF ds:[di].OLMWI_specState, not (mask OMWSS_WAS_PINNED)
ORNF ds:[di].OLMWI_specState, mask OMWSS_RE_PINNING
call OpenWinSwapState ;restore old attrs, position flags,
;and position
mov ax, MSG_OL_POPUP_TOGGLE_PUSHPIN
call WinClasses_ObjCallInstanceNoLock
call WinClasses_DerefVisSpec_DI
ANDNF ds:[di].OLMWI_specState, not (mask OMWSS_RE_PINNING)
;
;DO NOT call superclass- OLPopupWinClass will close this window!
;
jmp short done
exit:
;
; exit associated application
;
mov ax, MSG_META_QUIT
call GenCallApplication
jmp short done
notPinnedWasNotPinned:
;menu is NOT pinned, and WAS NOT pinned.
mov di, 500
call ThreadBorrowStackSpace
push di
;Call superclass so that window is CLOSED (set not REALIZABLE)
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
mov cx, IC_DISMISS
call WinClasses_ObjCallSuperNoLock_OLMenuWinClass
;tell our menu button to make sure that it is reset visually
mov ax, MSG_OL_MENU_BUTTON_NOTIFY_MENU_DISMISSED
call OLPopupWinSendToButton
pop di
call ThreadReturnStackSpace
done:
stc ; gup query handled
ret
OLMenuWinInteractionCommand endp
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinPrePassiveButton -- MSG_META_PRE_PASSIVE_BUTTON
DESCRIPTION: Handler for mouse button being pressed while we have a
passive mouse grab. This grab is set up when the menu
window is told by the menu button that it is in stay-up mode.
First we tell the base window that we are leaving
stay-up mode, and reset our own state bits, so that the
SelectMyControlsOnly mechanism in the base window and here
will take the menu down.
PASS: *ds:si - instance data
es - segment of OLMenuWinClass
ax - method
cx, dx - ptr position
bp - [ UIFunctionsActive | buttonInfo ]
(for menu window - indicates if pointer is inside menu)
RETURN: ax, cx, dx, bp - ?
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 8/89 Initial version
Joon 9/92 Added check for scrollable popup list
------------------------------------------------------------------------------@
OLMenuWinPrePassiveButton method dynamic OLMenuWinClass, \
MSG_META_PRE_PASSIVE_BUTTON
;if we were in stay-up mode, send MSG_MO_MW_LEAVE_STAY_UP_MODE
;to self, so will send to menu button and base window.
test ds:[di].OLMWI_specState, mask OMWSS_IN_STAY_UP_MODE
jz done ;skip if not...
ifdef ALLOW_SCROLLABLE_POPUP_LISTS
;if this is a popup list and the ptr is in bounds, then just return
;processed. Mouse interactions needs to be handled by the items in
;the popup list.
mov di, ds:[di].OLCI_buildFlags
and di, mask OLBF_TARGET
cmp di, OLBT_IS_POPUP_LIST shl offset OLBF_TARGET
jne notPopupList
call VisTestPointInBounds
jc returnProcessed
notPopupList:
endif
; don't leave stay up mode if press is not UIFA_IN and
; VisTestPointInBounds is true
test bp, (mask UIFA_IN) shl 8
jnz continue
call VisTestPointInBounds
jc returnProcessed
continue:
;we are in stay-up mode. Send method to self so will be sent
;to BaseWindow and MenuButton. MenuButton will return cx = TRUE/FALSE
;telling us if we should keep menu up.
;Pass: cx, dx = mouse position (in window coords)
; bp = [ UIFunctionsActive | buttonInfo ]
test bp, mask BI_PRESS ;any button pressed?
jz done ;skip if not...
if BUBBLE_HELP
test bp, (mask UIFA_IN) shl 8
jz leaveStayUpMode
; button press inside menu
mov ax, bp
andnf ax, mask BI_BUTTON ;is it BUTTON_2?
cmp ax, BUTTON_2 shl offset BI_BUTTON
je done ;skip if so...
leaveStayUpMode:
endif ; BUBBLE_HELP
mov ax, cx
mov bx, dx
call VisQueryWindow ; get window we're on
EC < push bx >
EC < mov bx, di >
EC < call ECCheckWindowHandle ; ensure good window >
EC < pop bx >
call WinTransform ; get screen coords
mov cx, ax ; cx, dx = ptr position in screen coords
mov dx, bx
push bp ;save UIFA_IN flags from Flow
;pass bp...
mov ax, MSG_MO_MW_LEAVE_STAY_UP_MODE
call WinClasses_ObjCallInstanceNoLock ;send to self
;returns cx = TRUE if mouse
;over menu button AND is correct
;mouse button for this specific
;UI. (Will restart base window
;grab if over mouse button)
pop bp
;If mouse is pressed outside of menu window AND menu button
;bounds, kill menu immediately.
test bp, (mask UIFA_IN) shl 8 ;is mouse ptr in menu window?
jnz returnProcessed ;skip if so...
;notInBounds: ;Mouse pointer is not over menu window.
tst cx ;over menu button?
jnz returnProcessed ;skip if so...
;kill menu immediately (if not pinned)! Send method to self.
;Cascading menus cannot have the pre-passive grab forcing the
;closure of the menus. The bad case is where two or more menus are
;open, and the user clicks on a menu that is not the "top" menu (the
;one that has the pre-passive grab). This will get called first,
;bringing down the "top" menu, which will cause the other menus to
;go down since the "top" menu will send a SUBMENU_REQUESTS_CLOSE
;message up the gen tree. But this is not desired since the user
;may have clicked on another menu button. The other mechanisms,
;post-passive grab and gadget exclusive, will do the work.
; --JimG 4/29/94
if not _CASCADING_MENUS
push bp ;save UIFunctionsActive etc
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
mov cx, IC_INTERACTION_COMPLETE
call WinClasses_ObjCallInstanceNoLock ;send to self
pop bp
endif ;not _CASCADING_MENUS
; Replay button, just in case the pre-passive list has changed as a
; result of the above
mov ax, mask MRF_REPLAY
ret
returnProcessed: ;return with ax = MRF_*** flag
mov ax, mask MRF_PROCESSED
ret
done: ;send event to superclass (OLWinClass) so that its
;mechanisms operate properly.
GOTO WinClasses_ObjCallSuperNoLock_OLMenuWinClass_Far
OLMenuWinPrePassiveButton endp
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinPostPassiveButton -- MSG_META_POST_PASSIVE_BUTTON
DESCRIPTION: See OLWinClass for complete description of how this
fits into the SelectMyConrolsOnly mechanism. We have
subclassed this method here so that a menu can decide
whether to kill itself when leaving stay-up mode.
IMPORTANT: we are concerned with the button PRESS here,
not the release. We want the press because we may want the
menu to close the instant we leave stay-up mode.
PASS: *ds:si - instance data
es - segment of OLMenuWinClass
ax - method
cx, dx - ptr position
bp - [ UIFunctionsActive | buttonInfo ]
RETURN: ax, cx, dx, bp - ?
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 8/89 Initial version
------------------------------------------------------------------------------@
OLMenuWinPostPassiveButton method dynamic OLMenuWinClass, \
MSG_META_POST_PASSIVE_BUTTON
push ax, bp ;save method and flags
;for superclass call
;are any buttons pressed?
test bp, mask BI_PRESS ;any button pressed?
jnz callSuper ;skip if so...
;are any buttons pressed?
test bp, mask BI_B3_DOWN or mask BI_B2_DOWN or \
mask BI_B1_DOWN or mask BI_B0_DOWN
jnz callSuper ;skip if so...
;all buttons released: if not in stay-up-mode or pinned, close menu now.
test ds:[di].OLMWI_specState, mask OMWSS_IN_STAY_UP_MODE
jnz callSuper ;skip if so...
;If using cascading menus, call OLMenuWinCloseOrCascade which will
;take care of checking if this menu is currently cascading.
if _CASCADING_MENUS
call OLMenuWinCloseOrCascade ;destroys:ax,bx,cx,dx,bp,di
else ;_CASCADING_MENUS is FALSE
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
mov cx, IC_INTERACTION_COMPLETE
call WinClasses_ObjCallInstanceNoLock ;send to self
endif ;_CASCADING_MENUS
callSuper:
pop ax, bp ;get method and flags
;call superclass to handle remainder of work (EndGrab, etc)
GOTO WinClasses_ObjCallSuperNoLock_OLMenuWinClass_Far
OLMenuWinPostPassiveButton endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinEnterStayUpMode
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
METHOD: MSG_MO_MW_ENTER_STAY_UP_MODE
DESCRIPTION: This is sent by the MOMenuButton object when it realizes
that we are entering stay-up mode. This procedure sets some
state flags in this object.
PASS: *ds:si - instance data
es - segment of OLMenuWinClass
ax - method
cx = TRUE to force release of current GADGET EXCL owner,
so that higher-level menus close.
RETURN: ds:*si, es = same
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
eric 8/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLMenuWinEnterStayUpMode method dynamic OLMenuWinClass,
MSG_MO_MW_ENTER_STAY_UP_MODE
EC < cmp cx, TRUE >
EC < je 1$ >
EC < cmp cx, FALSE >
EC < ERROR_NE OL_ERROR >
EC <1$: >
;is ENTER_STAY_UP_MODE: set our state info, and start a pre-passive
;mouse grab so that we can exit stay-up mode when the button is
;next pressed.
ORNF ds:[di].OLMWI_specState, mask OMWSS_IN_STAY_UP_MODE
;inform our parent window that it has a menu in stay-up mode.
;(If this is a menu or sub-menu, inform GenPrimary/GenDisplay/
;GenSummons, etc. If is a sys-menu for a pinned menu, inform
;the menu.) This will cause OpenWinEndGrab to NOT force the release
;of the gadget exclusive as the mouse button is released.
push cx
mov ax, MSG_VIS_VUP_QUERY
mov cx, SVQT_HAS_MENU_IN_STAY_UP_MODE
call OLMenuWinCallButtonOrGenParent
pop cx
;if we want to force the release of high-level menus, send a VUP
;query through our menu button, so that 1) this menu gets the GADGET
;exclusive directly from the parent window (GenPrimary), and
;2) so that as the high-level menus close, our menu button does not
;force this menu to close.
tst cx
jz 10$
call OLMenuWinGrabRemoteGadgetExcl
10$: ;tell the Flow Object that we want to be notified of ANY button press,
;even if not on menu.
call VisAddButtonPrePassive
if _KBD_NAVIGATION and _MENU_NAVIGATION ;------------------------------
;CUA/Motif: set focus to first object in menu (is currently 0:0).
mov ax, MSG_GEN_NAVIGATE_TO_NEXT_FIELD
call WinClasses_ObjCallInstanceNoLock
endif ;--------------------------------------------------------------
ret
OLMenuWinEnterStayUpMode endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinLeaveStayUpMode
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
METHOD: MSG_MO_MW_LEAVE_STAY_UP_MODE
DESCRIPTION: This method is sent by this object to itself when
a pre-passive button event is received, indicating that
we should exit stay-up mode.
PASS: *ds:si - instance data
es - segment of OLMenuWinClass
ax - method
cx, dx - mouse position in screen coordinates
bp - [ UIFunctionsActive | buttonInfo ]
(for menu window - indicates if pointer is inside menu)
RETURN: ds:*si, es = same
cx = TRUE if mouse over menu button
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
eric 8/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLMenuWinLeaveStayUpMode method dynamic OLMenuWinClass,
MSG_MO_MW_LEAVE_STAY_UP_MODE
EC < call VisCheckVisAssumption ;make sure ds:*si ok >
;FIRST: make sure that we are in stay-up-mode, so that we don't
;mess up the state of the parent window (GenPrimary) by telling it
;that we are leaving stay-up-mode when we aren't.
;Do we ever have a case where the OMWSS_IN_STAY_UP_MODE has been reset already,
;so that we don't release our VisRemoveButtonPrePassive before the window
;goes away??? Seems to happen 1/100 times that menu navigation is used.
;
;Should not be a problem, as VisRemoveButtonPrePasive is called from VisClose,
;just to make sure that it is gene -- Doug
;
test ds:[di].OLMWI_specState, mask OMWSS_IN_STAY_UP_MODE
jz done ;skip if not in stay-up mode...
;reset state bit, remove passive grab, ;and send
;MSG_MO_MB_LEAVE_STAY_UP_MODE to OLMenuButton, so it knows to set
;closing = TRUE
ANDNF ds:[di].OLMWI_specState, not (mask OMWSS_IN_STAY_UP_MODE)
call VisRemoveButtonPrePassive
;inform our parent window that it has no menu in stay-up mode.
;(If this is a menu or sub-menu, inform GenPrimary/GenDisplay/
;GenSummons, etc. If is a sys-menu for a pinned menu, inform
;the menu.)
push cx, dx, bp
mov ax, MSG_VIS_VUP_QUERY
mov cx, SVQT_NO_MENU_IN_STAY_UP_MODE
call OLMenuWinCallButtonOrGenParent
pop cx, dx, bp
;First: send method to menu button which opens this menu,
;so it will reset its state bit
;Pass: bp - [ UIFunctionsActive | buttonInfo ]
; (for menu window - indicates if pointer is inside menu)
tst ds:[di].OLPWI_button ;make sure we have a button
jnz sendToButton ;if yes, send to button
clr cx ;else return cx = FALSE
ret
sendToButton:
mov ax, MSG_MO_MB_LEAVE_STAY_UP_MODE
call OLPopupWinSendToButton
done:
ret
OLMenuWinLeaveStayUpMode endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinCascadeMode
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Enables/disables cascade mode.
Will cause submenu's to be killed if disabling cascade mode
or cascading with a different submenu optr.
Will automatically start the grab for this window if the
result of this call closes a menu.
CALLED BY: MSG_MO_MW_CASCADE_MODE
PASS: *ds:si = OLMenuWinClass object
ds:di = OLMenuWinClass instance data
ds:bx = OLMenuWinClass object (same as *ds:si)
es = segment of OLMenuWinClass
ax = message #
cl = OLMenuWinCascadeModeOptions
OMWCMO_CASCADE
True=Enable/False=Disable cascade mode.
OMWCMO_START_GRAB
If TRUE, will take the grabs and take the gadget
exclusive after setting the cascade mode.
if OMWCMO_CASCADE = TRUE
^ldx:bp = optr to submenu
else
dx, bp are ignored
RETURN: Nothing
DESTROYED: ax, cx
SIDE EFFECTS:
If cascade mode is enabled, the menu will NOT be closed when a
lost gadget exclusive is received, nor when the passive grab wants
to close it. It will, however, still be closed by a
MSG_MO_MW_GUP_SUBMENU_REQUESTS_CLOSE message if the ignore bit
is not set.
PSEUDO CODE/STRATEGY:
None
REVISION HISTORY:
Name Date Description
---- ---- -----------
JimG 4/21/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _CASCADING_MENUS
OLMenuWinCascadeMode method dynamic OLMenuWinClass,
MSG_MO_MW_CASCADE_MODE
.enter
push cx ; save for last (cl)
; set cascading information based upon argument
; ensure original cascade data is correct before changing (EC)
EC < call OLMenuWinECCheckCascadeData >
mov ch, ds:[di].OLMWI_moreSpecState ; save original state
clr ax ; use ah to keep cascade bit
; Here we put the new cascade bit into ah, later into ch.
; This value is or'ed back into instance data after the "done"
; label. This is done this way because some routines called below
; depend upon the moreSpecState's CASCADE bit to be consistent with
; the vardata which hasn't been changed yet.
test cl, mask OMWCMO_CASCADE
jz handleVarData
ornf ah, mask OMWMSS_IS_CASCADING
handleVarData:
; check to see if the cascading bit changed
xor ch, ah
test ch, mask OMWMSS_IS_CASCADING ; test if bit changed
push cx ; case "changed" info (ch)
mov ch, ah ; new state is now in ch
mov ax, ATTR_OL_MENU_WIN_CASCADED_MENU
jnz updateVarData ; bit changed - fix var data
; cascade bit hasn't change. Check to see if the bit is true.
test cl, mask OMWCMO_CASCADE
jz done ; not cascading, we're done
; We are cascading. Make sure that the handle passed is the same as
; the handle stored.
call ObjVarFindData ; ds:bx = ptr to data
EC < ERROR_NC OL_ERROR ; SHOULD HAVE VAR DATA >
; compare handle already in var data with ^ldx:bp (handle passed in)
cmp ds:[bx].handle, dx ; ^ldx:bp = handle passed in
jne changeVarData ; nope, need to change vardata
cmp ds:[bx].offset, bp
je done ; handle is the same, we're done
changeVarData:
; handle not the same. we need to force the close of the submenu
; tree starting with the old handle, and then update the stored handle.
; Close "old" submenus below this menu
push ax, cx, dx, bp, bx
mov cx, TRUE
call OLMenuWinSendCloseRequestToLastMenu ; destroy:ax,bx,cx,dx,bp
pop ax, cx, dx, bp, bx
; change var data to reflect the new submenu. Then we're done.
call ObjVarFindData ; may have moved
movdw ds:[bx], dxbp
jmp short done
updateVarData:
; the bit has changed.. adjust the var data accordingly
test cl, mask OMWCMO_CASCADE
jz deleteVarData
; add var data
push cx
mov cx, size optr ; size of data
call ObjVarAddData ; ds:bx = ptr to data
movdw ds:[bx], dxbp ; ^ldx:bp = handle passed in
pop cx
jmp short done
deleteVarData:
; Close all submenus below current menu
push ax, cx
mov cx, TRUE
call OLMenuWinSendCloseRequestToLastMenu
pop ax, cx
; Delete the var data
call ObjVarDeleteData
EC < ERROR_C OL_ERROR ; nothing deleted? should have var data!>
done:
; ONLY the cascade bit should be set in ch.
EC < test ch, not (mask OMWMSS_IS_CASCADING) >
EC < ERROR_NZ OL_ERROR ;ch got trashed >
mov di, ds:[si]
add di, ds:[di].Vis_offset
; store new cascade bit
andnf ds:[di].OLMWI_moreSpecState, not mask OMWMSS_IS_CASCADING
ornf ds:[di].OLMWI_moreSpecState, ch
; check to make sure that we didn't screw up the data consistency
EC < call OLMenuWinECCheckCascadeData >
; Decide to start up grabs and/or enter stay up mode.
pop cx ; "change" info (ch)
pop ax ; get passed flags (al)
; If we are cascading, then don't do any of this.. we don't want to
; take the gadget exclusive away from someone else...
test al, mask OMWCMO_CASCADE ; cascading?
jnz dontGrab ; yes.. done
; ch = the OLMWI_moreSpecState cascading information that has changed.
; We know that we aren't currently cascading. So, IF we were
; cascading (i.e. we closed submenus) OR we were told to start the
; grab, then ask the window to startup grab.
mov cl, al
test cx, (mask OMWMSS_IS_CASCADING shl 8) or mask OMWCMO_START_GRAB
jz dontGrab ; nope.. done
push ax ; preserve passed flags
mov ax, MSG_OL_WIN_STARTUP_GRAB
call ObjCallInstanceNoLock
pop ax
; Were we told to start grab? If so, then we also enter stay up
; mode. Otherwise, we just bail.
test al, mask OMWCMO_START_GRAB
jz dontGrab ; skip stay up mode...
mov cx, TRUE ; grab gadget exclusive
mov ax, MSG_MO_MW_ENTER_STAY_UP_MODE
call ObjCallInstanceNoLock
dontGrab:
.leave
ret
OLMenuWinCascadeMode endm
endif ;_CASCADING_MENUS
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinMoveResizeWin -- MSG_VIS_MOVE_RESIZE_WIN for OLWinClass
DESCRIPTION: Intercepts the method which does final positioning & resizing
of a window, in order to allow pinned menu to be moved
off-screen.
PASS: *ds:si - instance data
es - segment of OLMenuWinClass
ax - MSG_VIS_MOVE_RESIZE_WIN
RETURN: nothing
DESTROYED: ?
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 1/90 Initial version
------------------------------------------------------------------------------@
OLMenuWinMoveResizeWin method dynamic OLMenuWinClass, MSG_VIS_MOVE_RESIZE_WIN
test ds:[di].OLWI_specState, mask OLWSS_PINNED
jz callSuper ;skip if not...
;relax positioning behavior somewhat - allow menu to be
;partially obscured.
ANDNF ds:[di].OLWI_winPosSizeFlags, not (mask WPSF_CONSTRAIN_TYPE)
ORNF ds:[di].OLWI_winPosSizeFlags, \
WCT_KEEP_PARTIALLY_VISIBLE shl offset WPSF_CONSTRAIN_TYPE
callSuper:
;finally, call superclass to do move/resize
call WinClasses_ObjCallSuperNoLock_OLMenuWinClass_Far
;and update scrollers if needed
call ImGetButtonState ; non-zero if pressed
call OLMenuWinUpdateUpDownScrollers
ret
OLMenuWinMoveResizeWin endp
COMMENT @----------------------------------------------------------------------
FUNCTION: OLMenuWinVisClose -- MSG_VIS_CLOSE for OLMenuWinClass
DESCRIPTION: We intercept this method here so that we can release
any remote gadget exclusives that we might have.
PASS: *ds:si - instance data
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 6/90 initial version
------------------------------------------------------------------------------@
OLMenuWinVisClose method dynamic OLMenuWinClass, MSG_VIS_CLOSE
;send query to generic parent (do not send to self, in the hope
;of deciding whether to send to button or genparent, because self
;will handle as if a child had called!)
push ax, cx, dx, bp
call OLMenuWinReleaseRemoteGadgetExcl
pop ax, cx, dx, bp
;call superclass (OLPopupWinClass) for default handling
call WinClasses_ObjCallSuperNoLock_OLMenuWinClass_Far
; Update up/down scrollers as needed
mov al, 0
call OLMenuWinUpdateUpDownScrollers
ret
OLMenuWinVisClose endp
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinEnsureNoMenusInStayUpMode
DESCRIPTION: This method is sent from the Flow object to all objects
which have active or passive mouse grabs.
PASS: *ds:si - instance data
es - segment of OLWinClass
cx:dx - EnsureNoMenusInStayUpModeParams, of null if no buffer
passed
RETURN: ax = 0 (due to byte-saving measure in FlowObject)
DESTROYED:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 6/90 Initial version
------------------------------------------------------------------------------@
OLMenuWinEnsureNoMenusInStayUpMode method dynamic OLMenuWinClass, \
MSG_META_ENSURE_NO_MENUS_IN_STAY_UP_MODE
;if PINNED = TRUE, it means that we are entering pinned mode.
;Do not close menu if so.
test ds:[di].OLWI_specState, mask OLWSS_PINNED
jnz done
;Otherwise, if the menu is in stay-up-mode, force it to close now.
test ds:[di].OLMWI_specState, mask OMWSS_IN_STAY_UP_MODE
jz done ;exit if not stay up mode
tst cx
jnz incDismissCount
push cx, dx, bp
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
mov cx, IC_DISMISS
call WinClasses_ObjCallInstanceNoLock
pop cx, dx, bp
jmp short sendToKids
incDismissCount:
tst cx ;no buffer, branch
jz sendToKids
EC < push ds, si >
EC < movdw dssi, cxdx >
EC < call ECCheckBounds >
EC < pop ds, si >
mov es, cx
mov bx, dx
inc es:[bx].ENMISUMP_menuCount ;increment menu count
sendToKids:
;
; Now, to close any of our submenus, send to our children
;
mov ax, MSG_META_ENSURE_NO_MENUS_IN_STAY_UP_MODE
call GenSendToChildren
done:
clr ax ;Return "MouseFlags" null
ret
OLMenuWinEnsureNoMenusInStayUpMode endm
WinClasses ends
KbdNavigation segment resource
COMMENT @----------------------------------------------------------------------
FUNCTION: OLMenuWinFupKbdChar - MSG_META_FUP_KBD_CHAR handler
for OLMenuWinClass
DESCRIPTION: This method is sent by child which 1) is the focused object
and 2) has received a MSG_META_FUP_KBD_CHAR
which is does not care about. Since we also don't care
about the character, we forward this method up to the
parent in the focus hierarchy.
PASS: *ds:si = instance data for object
cx = character value
dl = CharFlags
dh = ShiftState (ModBits)
bp low = ToggleState
bp high = scan code
RETURN: carry set if handled
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 2/90 initial version
------------------------------------------------------------------------------@
if _KBD_NAVIGATION ;------------------------------------------------------
OLMenuWinFupKbdChar method dynamic OLMenuWinClass, MSG_META_FUP_KBD_CHAR
push ax ;save method
test dl, mask CF_FIRST_PRESS or mask CF_REPEAT_PRESS
LONG jz callSuper ;skip if not press event...
;ADDED 10/23/90 by Eric to prevent pinned menus from interpreting keyboard
;navigation keys which would try to close the menu.
;if this menu is pinned (the user must have pinned it using
;keyboard navigation, for the focus to be inside the menu),
;then ignore key at this class level.
test ds:[di].OLWI_specState, mask OLWSS_PINNED
jnz checkControlMenuNavigationThenInternalKeys ;skip if is pinned...
;if this menu has a menu button (i.e. is not a popup menu), then
;first check for the keys which cause us to send methods to the button.
tst ds:[di].OLPWI_button ;is there a menu button?
jz checkInternalKeys ;skip if not...
;we will check these keys using two tables: one for menus, one
;for sub-menus.
mov bx, ds:[di].OLCI_buildFlags
ANDNF bx, mask OLBF_REPLY
cmp bx, OLBR_SUB_MENU shl offset OLBF_REPLY
push es ;set es:di = table of shortcuts
segmov es, cs
mov di, offset cs:OLMenuWinKbdBindings
jne 10$ ;skip if is menu...
;is a sub-menu
mov di, offset cs:OLMenuWinKbdBindings2
10$:
call ConvertKeyToMethod
pop es
jnc checkInternalKeys ;skip if none found...
cmp ax, MSG_META_DUMMY ;left-arrow in sub-menu?
je closeSubMenuToParentMenu ;skip if so...
sendToButton:
ForceRef sendToButton
;
; Code put in here to do nothing with left and right arrows for express
; menus, so we won't have complicated deaths in express submenus.
; There's probably a cleaner solution than this. -cbh 11/ 4/92
;
if EVENT_MENU
push ax
mov ax, HINT_EVENT_MENU
call ObjVarFindData
pop ax
jc 19$
endif
push ax
mov ax, HINT_EXPRESS_MENU
call ObjVarFindData
pop ax
jnc 20$
19$::
SBCS < mov cx, (CS_CONTROL shl 8) or VC_ESCAPE ;make an escape key >
DBCS < mov cx, C_SYS_ESCAPE ;make an escape key >
mov ax, MSG_META_FUP_KBD_CHAR
20$:
call OLMenuWinFocusAndCallButton ;trashes si
popExit:
pop ax
stc ;say handled
ret
closeSubMenuToParentMenu:
call OLMenuWinKbdCloseSubMenuToParentMenu ;trashes si
pop ax
stc ;say handled
ret
;ADDED 10/23/90 by Eric to allow usage of the System Menu Button in a
;pinned menu.
checkControlMenuNavigationThenInternalKeys:
;pass ds:di = instance data
call HandleMenuNavigation ;do menu navigation, if needed
jnc checkInternalKeys ;skip if not handled...
pop ax
ret
checkInternalKeys:
;now check for keys which we can handle by navigating within
;this menu.
push es ;set es:di = table of shortcuts
segmov es, cs
mov di, offset cs:OLMenuWinKbdBindings3
call ConvertKeyToMethod
pop es
jnc callSuper ;skip if none found...
sendToSelf::
push ds ;save KBD char in idata so that when
mov bp, segment idata
segmov ds, bp ;new child item (possibly a genlist)
mov ds:[lastKbdCharCX], cx ;gains focus, it knows whether to start
pop ds ;at top or bottom item in list.
mov cx, IC_INTERACTION_COMPLETE ;in case we send
;MSG_GEN_GUP_INTERACTION_COMMAND
call ObjCallInstanceNoLock
push ds ;reset our saved KBD char to "none"
mov bp, segment idata ;so that if a genlist gains the focus
segmov ds, bp
clr ds:[lastKbdCharCX] ;because the menu regains focus,
pop ds ;it starts at the top item in the list
handled::
pop ax
stc ;say handled
ret
callSuper:
;we don't care about this keyboard event. Call our superclass
;so it will be forwarded up the focus hierarchy.
pop ax ;get method
mov di, offset OLMenuWinClass
GOTO ObjCallSuperNoLock
OLMenuWinFupKbdChar endm
;Keyboard shortcut bindings for OLMenuWinClass (do not separate tables)
;*** KEYS FOR MENU, WHICH WILL SEND METHODS TO THE MENU BUTTON ***
OLMenuWinKbdBindings label word
word length OLMWShortcutList
;P C S C
;h A t h S h
;y l r f e a
;s t l t t r
if DBCS_PCGEOS
OLMWShortcutList KeyboardShortcut \
<0, 0, 0, 0, C_SYS_LEFT and mask KS_CHAR>, ;previous menu
<0, 0, 0, 0, C_SYS_RIGHT and mask KS_CHAR>, ;next menu
<0, 0, 0, 0, C_SYS_ESCAPE and mask KS_CHAR> ;close menu, go up
else
OLMWShortcutList KeyboardShortcut \
<0, 0, 0, 0, 0xf, VC_LEFT>, ;NAVIGATE TO PREVIOUS (MENU)
<0, 0, 0, 0, 0xf, VC_RIGHT>, ;NAVIGATE TO NEXT (MENU)
<0, 0, 0, 0, 0xf, VC_ESCAPE> ;CLOSE MENU (will continue up tree)
endif
;insert additional shortcuts here.
;OLMWMethodList label word
word MSG_SPEC_NAVIGATE_TO_PREVIOUS_FIELD
word MSG_SPEC_NAVIGATE_TO_NEXT_FIELD
;use SPEC instead of GEN method since
;we are sending to non-generic objects.
word MSG_META_FUP_KBD_CHAR ;will send cx, dx, bp up to menu button
;disguised as MSG_META_FUP_KBD_CHAR.
;Button will close this menu and those
;above it.
;*** KEYS FOR SUB-MENU, WHICH WILL SEND METHODS TO THE MENU BUTTON ***
OLMenuWinKbdBindings2 label word
word length OLMWShortcutList2
;P C S C
;h A t h S h
;y l r f e a
;s t l t t r
if DBCS_PCGEOS
OLMWShortcutList2 KeyboardShortcut \
<0, 0, 0, 0, C_SYS_LEFT and mask KS_CHAR>, ;close sub-menu
<0, 0, 0, 0, C_SYS_RIGHT and mask KS_CHAR>, ;close, go to next
<0, 0, 0, 0, C_SYS_ESCAPE and mask KS_CHAR> ;close menu, go up
else
OLMWShortcutList2 KeyboardShortcut \
<0, 0, 0, 0, 0xf, VC_LEFT>, ;CLOSE THIS SUB-MENU (ONLY)
<0, 0, 0, 0, 0xf, VC_RIGHT>, ;CLOSE THIS SUB-MENU AND THE PARENT
;MENU, OPEN THE NEXT TOP-LEVEL MENU.
<0, 0, 0, 0, 0xf, VC_ESCAPE> ;CLOSE MENU (will continue up tree)
endif
;insert additional shortcuts here.
;OLMWMethodList2 label word
word MSG_META_DUMMY ;we will handle this specially: see
;OLMenuWinKbdCloseSubMenuToParentMenu
word MSG_OL_MENU_BUTTON_SEND_RIGHT_ARROW_TO_PARENT_MENU
;send method to menu button, so it will
;send a MSG_META_FUP_KBD_CHAR to the
;menu it is in, simulating the RIGHT
;arrow being pressed. Will close parent
;menu, and open next top-level menu.
word MSG_META_FUP_KBD_CHAR ;will send cx, dx, bp up to menu button
;disguised as MSG_META_FUP_KBD_CHAR.
;Button will close this menu and those
;above it.
;*** KEYS FOR MENU, WHICH ARE SENT TO THIS MENU ***
OLMenuWinKbdBindings3 label word
word length OLMWShortcutList3
;P C S C
;h A t h S h
;y l r f e a
;s t l t t r
if DBCS_PCGEOS
OLMWShortcutList3 KeyboardShortcut \
<0, 0, 0, 0, C_SYS_UP and mask KS_CHAR>, ;previous menu item
<0, 0, 0, 0, C_SYS_DOWN and mask KS_CHAR>, ;next menu item
<0, 0, 0, 0, C_SYS_ESCAPE and mask KS_CHAR> ;close popup
else
OLMWShortcutList3 KeyboardShortcut \
<0, 0, 0, 0, 0xf, VC_UP>, ;NAVIGATE TO PREVIOUS menu item
<0, 0, 0, 0, 0xf, VC_DOWN>, ;NAVIGATE TO NEXT menu item
<0, 0, 0, 0, 0xf, VC_ESCAPE> ;CLOSE THIS POPUP MENU (has no button)
endif
;insert additional shortcuts here.
;OLMWMethodList3 label word
word MSG_GEN_NAVIGATE_TO_PREVIOUS_FIELD
word MSG_GEN_NAVIGATE_TO_NEXT_FIELD
word MSG_GEN_GUP_INTERACTION_COMMAND
;ODIE: adding items here requires change in code above
endif ;----------------------------------------------------------------------
COMMENT @----------------------------------------------------------------------
ROUTINE: OLMenuWinFocusAndCallButton
SYNOPSIS: Places the FOCUS exclusive on the menu button, and then
forwards the passed method on to it.
IMPORTANT: this is not called for popup menus, since they
DO NOT have a menu button!
CALLED BY: OLMenuWinFupKbdChar
PASS: *ds:si -- handle
ax -- navigation method to call button's parent with
RETURN: nothing
DESTROYED: ax, cx, dx, bp, di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 5/ 2/90 Initial version
Eric 6/90 update, more doc.
------------------------------------------------------------------------------@
OLMenuWinFocusAndCallButton proc near
class OLMenuWinClass
;set *ds:si = OLMenuButtonClass object, and send some methods to it.
call KN_DerefVisSpec_DI
mov si, ds:[di].OLPWI_button ;set *ds:si = menu button
EC < tst si >
EC < ERROR_Z OL_ERROR ;we MUST have a button >
EC < call VisCheckVisAssumption ;make sure everything's OK >
;
; skip giving focus to menu button if kbd-char (ESCAPE)
;
cmp ax, MSG_META_FUP_KBD_CHAR
je afterFocus
;first move the focus inside the Primary to the menu button.
;(must indicate that is MENU_RELATED!)
push ax, cx, dx, bp
mov bp, mask MAEF_OD_IS_MENU_RELATED or \
mask MAEF_GRAB or mask MAEF_FOCUS or mask MAEF_NOT_HERE
mov cx, ds:[LMBH_handle]
mov dx, si
mov ax, MSG_META_MUP_ALTER_FTVMC_EXCL
call ObjCallInstanceNoLock
pop ax, cx, dx, bp ;restore method args
afterFocus:
;Do whatever navigation is called for at the menu bar level.
;(send to menu button, not its parent, since we might be sending
;MSG_META_FUP_KBD_CHAR.)
push ax
call ObjCallInstanceNoLock ;navigate / handle ESCAPE
pop ax
cmp ax, MSG_OL_MENU_BUTTON_SEND_RIGHT_ARROW_TO_PARENT_MENU
je exit ;skip if not navigating...
cmp ax, MSG_META_FUP_KBD_CHAR ;if not navigating,
je exit ;skip to end...
;else, was navigating: Find out which object in the window
;was navigated to, and send a method which will only activate
;menu buttons. Standard OLButtonClass objects will ignore.
mov ax, MSG_VIS_VUP_QUERY_FOCUS_EXCL
call VisCallParent ;returns focus in cx:dx
mov bx, cx ;set up focus in ^lbx:si
mov si, dx
mov ax, MSG_OL_MENU_BUTTON_KBD_ACTIVATE
mov di, mask MF_FIXUP_DS
call ObjMessage
exit:
ret
OLMenuWinFocusAndCallButton endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinSendCloseRequestToParentMenu
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Looks up the generic tree to find an object of class
OLMenuWinClass. The search is continued until an
object that is not a subclass of GenInteractionClass is
found. If it finds the menu window, the message
MSG_MO_MW_CASCADE_MODE(OMWCMO_START_GRAB) is called.
The menu window object's vis part MUST already be built.
CALLED BY: OLMenuWinKbdCloseSubMenuToParentMenu
PASS: *ds:si = menu object
RETURN: *ds:si = current menu object. (ds is fixed up).
DESTROYED: ax, bx, cx, dx, bp, di
SIDE EFFECTS:
WARNING: This routine MAY resize LMem and/or object blocks, moving
them on the heap and invalidating stored segment pointers
and current register or stored offsets to them.
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 8/6/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _CASCADING_MENUS
OLMenuWinSendCloseRequestToParentMenu proc near
uses si, es
.enter
mov bx, ds:[LMBH_handle]
mov di, ds:[si]
add di, ds:[di].Vis_offset
mov si, ds:[di].OLPWI_button ; ^lbx:si = menu button
tst si
jz done
searchLoop:
mov ax, MSG_VIS_FIND_PARENT
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
jcxz done
movdw bxsi, cxdx ; ^lbx:si = parent
call ObjSwapLock
segmov es, <segment GenInteractionClass>, di
mov di, offset GenInteractionClass
call ObjIsObjectInClass
jnc unlock ; break out of loop
segmov es, <segment OLMenuWinClass>, di
mov di, offset OLMenuWinClass
call ObjIsObjectInClass
cmc
jc unlock ; continue up tree
mov cl, mask OMWCMO_START_GRAB
mov ax, MSG_MO_MW_CASCADE_MODE
call ObjCallInstanceNoLock
clc
unlock:
call ObjSwapUnlock
jc searchLoop ; continue if carry set
done:
.leave
ret
OLMenuWinSendCloseRequestToParentMenu endp
endif ;_CASCADING_MENUS
COMMENT @----------------------------------------------------------------------
FUNCTION: OLMenuWinKbdCloseSubMenuToParentMenu
DESCRIPTION: This procedure is used when the left-arrow key is pressed
inside the menu. If this menu is not pinned, we close this
menu, and place the focus on our menu button,
inside the parent menu.
CALLED BY: OLMenuWinFupKbdChar
PASS: *ds:si = instance data for object
RETURN: nothing
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 6/90 initial version
------------------------------------------------------------------------------@
OLMenuWinKbdCloseSubMenuToParentMenu proc far
class OLMenuWinClass
call KN_DerefVisSpec_DI
test ds:[di].OLWI_specState, mask OLWSS_PINNED
LONG jnz done
if ERROR_CHECK
;Do NOT test for WAS_PINNED case.
; fail case: pin a sub-menu, then try to navigate to it by going through
; the parent menu. Once the sub-menu is visible, press left-arrow to
; get back to parent.
;
; test ds:[di].OLMWI_specState, mask OMWSS_WAS_PINNED
; ERROR_NZ OL_ERROR
;make sure this menu is a sub-menu
mov bx, ds:[di].OLCI_buildFlags ;will be used below
ANDNF bx, mask OLBF_REPLY ;see if we are sub-menu or menu
cmp bx, OLBR_SUB_MENU shl offset OLBF_REPLY
ERROR_NE OL_ERROR
endif
;set *ds:si = OLMenuButtonClass object, and send some methods to it.
push si ;save *ds:si = submenu
mov si, ds:[di].OLPWI_button ;set *ds:si = menu button
push si ;save menu button
call KN_DerefVisSpec_DI ;set ds:di = menu button
;make sure that we have a valid menu button, and that it thinks
;this menu is opened
EC < tst si >
EC < ERROR_Z OL_ERROR ;we MUST have a button >
EC < call VisCheckVisAssumption ;make sure everything's OK >
EC < test ds:[di].OLMBI_specState, mask OLMBSS_POPUP_OPEN >
EC < ERROR_Z OL_ERROR >
;reset OLButton and OLMenuButton state flags for this menu button
.warn -private
ANDNF ds:[di].OLMBI_specState, not (mask OLMBSS_POPUP_OPEN)
.warn @private
;hack: force the button to reset itself visually (without redrawing),
;so that when it gains the focus, it can save this state again.
;pass ds:di = instance data
call OLButtonRestoreBorderedAndDepressedStatus
;now make sure that the parent menu that this menu button is inside
;gets the focus window exclusive from the GenPrimary.
mov ax, MSG_META_GRAB_FOCUS_EXCL
call CallOLWin
pop si ;restore *ds:si = menu button
;dismiss this menu. It has already lost the focus. This will
;cause the menu button to redraw properly.
pop di ;set *ds:si = submenu
xchg si, di ;set *ds:di = menu button, *ds:si=menu
push si
push di
if _CASCADING_MENUS
;
; close last menu only
;
call OLMenuWinSendCloseRequestToParentMenu
else
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
mov cx, IC_DISMISS
call ObjCallInstanceNoLock
endif
pop si ;set *ds:si = menu button
;now move the focus inside the parent menu to the menu button.
;(DO NOT pass IS_MENU_RELATED flag!) This will cause the menu button
;to draw properly. (*ds:si = menu button)
call MetaGrabFocusExclLow
afterGrab:
pop si ;restore *ds:si = menu
done:
ret
OLMenuWinKbdCloseSubMenuToParentMenu endp
KbdNavigation ends
WinClasses segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinBringToTop
DESCRIPTION: Intercepts default handler to check to see if this is an
app modal window. If it is, & it is coming to the top of
the screen, then it should be made THE modal window within
the application.
PASS:
*ds:si - instance data
es - segment of MetaClass
ax - MSG_GEN_BRING_TO_TOP
cx, dx, bp - ?
RETURN:
carry - ?
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 3/90 Initial version
------------------------------------------------------------------------------@
;IMPORTANT: this method handler must match OpenWinBringToTop in functionality,
;except for FOCUS handling.
OLMenuWinBringToTop method dynamic OLMenuWinClass, MSG_GEN_BRING_TO_TOP
;if this window is not opened then abort: the user or application
;caused the window to close before this method arrived via the queue.
call VisQueryWindow
tst di
jz setGenState ; Skip if window not opened...
;Raise window to top of window group
clr ax
clr dx ; Leave LayerID unchanged
call WinChangePriority
call MenuWinScrollerEnsureOnTop
;if this menu is pinned, DO NOT grab the FOCUS exclusive.
;During MSG_META_START_BUTTON, we will determine if a menu item is
;being pressed on, and will decide whether to grab the focus.
;Note: no need to grab the target exclusive.
call WinClasses_DerefVisSpec_DI
test ds:[di].OLWI_specState, mask OLWSS_PINNED
jnz setGenState ;skip if is pinned...
call OpenCheckIfMenusTakeFocus
jnc setGenState
;
; Let's try grabbing the mouse. The problem is that when this menu
; comes up, the menu button that created it gets a MSG_META_PTR out
; of its bounds, which causes it to release the mouse, and realizing
; that it did have the mouse beforehand, causes it to give the focus
; back to its parent window. So submenus never get the focus.
; -cbh 6/22/92 (Removed -- causes problems when clicking and
; releasing on the left-edge of submenu menu buttons -- the submenu
; goes away without doing anyway when you click on it. -cbh 10/13/92)
;
; call VisGrabMouse
mov ax, MSG_META_GRAB_FOCUS_EXCL
call WinClasses_ObjCallInstanceNoLock
;Make it the focus window, if posible
setGenState:
; Raise the active list entry to
; the top, to reflect new/desired
; position in window hierarchy.
; (If no active list entry, window
; isn't up & nothing will be done)
mov cx, ds:[LMBH_handle]
mov dx, si
mov ax, MSG_GEN_APPLICATION_BRING_WINDOW_TO_TOP
call GenCallApplication
ret
OLMenuWinBringToTop endm
MenuWinScrollerEnsureOnTop proc near
uses bx, si, di
.enter
mov ax, TEMP_OL_MENU_WIN_SCROLLERS
call ObjVarFindData
jnc done
push ds:[bx].MWSS_downScroller
mov si, ds:[bx].MWSS_upScroller
call ensureScrollerOnTop
pop si
call ensureScrollerOnTop
done:
.leave
ret
ensureScrollerOnTop label near
tst si
jz ensureDone
mov di, ds:[si]
mov di, ds:[di].MWSI_window
tst di
jz ensureDone
clr ax, dx ; just bring to top of layer
call WinChangePriority
ensureDone:
retn
MenuWinScrollerEnsureOnTop endp
COMMENT @----------------------------------------------------------------------
FUNCTION: OLMenuWinGrabGadgetExcl
DESCRIPTION: This routine ensures that the gadget exclusive mechanism
is set up to that it will close this menu if the parent
window (GenPrimary) suddenly goes away. Note that this routine
works according to whether the mouse or keyboard was used
to place the menu in stay-up-mode:
MOUSE: we send a VUP query through our menu button, so that
it will eventually reach the GenPrimary. We grab the gadget
exclusive directly from the primary, forcing any higher-level
or same-level menus to close.
KBD: we do absolutely nothing. Since this menu was placed
in stay-up mode via the keyboard, the user must have of
activated our menu button. Therefore that button has the
gadget exclusive, and will close this menu if the button
loses the gadget.
PASS: *ds:si = instance data for object
RETURN: nothing
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 3/90 initial version
------------------------------------------------------------------------------@
OLMenuWinGrabRemoteGadgetExcl proc far ; uses GOTO
;send query to button or generic parent (do not send to self, in the
;hope of deciding whether to send to button or genparent, because self
;will handle as if a child had called!) If this query passes through
;our menu button, it will reset a state flag and then be sent up the
;tree as a standard SVQT_REMOTE_GRAB_GADGET_EXCL query.
mov cx, SVQT_NOTIFY_MENU_BUTTON_AND_REMOTE_GRAB_GADGET_EXCL
mov ax, MSG_VIS_VUP_QUERY
mov bp, ds:[LMBH_handle] ;pass ^lbp:dx = this object
mov dx, si
GOTO OLMenuWinCallButtonOrGenParent
OLMenuWinGrabRemoteGadgetExcl endp
OLMenuWinReleaseRemoteGadgetExcl proc far ; uses GOTO
mov cx, SVQT_REMOTE_RELEASE_GADGET_EXCL
mov ax, MSG_VIS_VUP_QUERY
mov bp, ds:[LMBH_handle] ;pass ^lbp:dx = this object
mov dx, si
GOTO OLMenuWinCallButtonOrGenParent
OLMenuWinReleaseRemoteGadgetExcl endp
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinVupQuery -- MSG_VIS_VUP_QUERY for OLMenuWinClass
DESCRIPTION: Respond to MSG_VIS_VUP_QUERY.
PASS: *ds:si = instance data for object
ds:di = specific instance (OLMenuWin)
cx = SpecVisQueryType (see cConstant.def)
RETURN: carry set if answered query
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 4/90 initial version
------------------------------------------------------------------------------@
OLMenuWinVupQuery method dynamic OLMenuWinClass, MSG_VIS_VUP_QUERY
cmp cx, SVQT_HAS_MENU_IN_STAY_UP_MODE
je callSuperIfPinned
cmp cx, SVQT_NO_MENU_IN_STAY_UP_MODE
je callSuperIfPinned ;Both changed from callSuperIfPinned
; so this function actually does
; what it's supposed to in non-pinned
; menus. -cbh 12/30/93
;Changed back to callSuperIfPinned
; to fix problem with submenus not
; staying up if parent menu is not in
; stay up mode. - Joon (7/28/94)
cmp cx, SVQT_REMOTE_GRAB_GADGET_EXCL
je callSuperIfPinned ;skip if cannot handle query...
cmp cx, SVQT_REMOTE_RELEASE_GADGET_EXCL
je callSuperIfPinned
callSuper:
GOTO WinClasses_ObjCallSuperNoLock_OLMenuWinClass_Far
callSuperIfPinned:
;if this is a pinned menu (or will revert back to being a pinned
;menu shortly), behave as a base window: call superclass,
;so that OLWinClass handles this query as if this window was
;a GenPrimary. Otherwise (is normal menu), send query up tree.
FALL_THRU OLMenuWinCallSuperIfPinned
OLMenuWinVupQuery endm
COMMENT @----------------------------------------------------------------------
FUNCTION: OLMenuWinCallSuperIfPinned
DESCRIPTION: If this menu is pinned (or will shortly revert back to being
pinned), then behave as a base window: call superclass,
so that OLWinClass handles this query as if this window was
a GenPrimary.
CALLED BY: OLMenuWinVupQuery, OLMenuWinVupGrabFocusWinExcl
PASS: *ds:si = instance data for object
es = segment of OLMenuWinClass
ax = method to send
cx, dx, bp = data to send with method
RETURN: nothing
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 6/90 initial version
------------------------------------------------------------------------------@
OLMenuWinCallSuperIfPinned proc far
class OLMenuWinClass
call WinClasses_DerefVisSpec_DI
test ds:[di].OLWI_specState, mask OLWSS_PINNED
jnz callSuper ;skip if pinned (cy=0)...
test ds:[di].OLMWI_specState, mask OMWSS_WAS_PINNED
jnz callSuper ;skip if pinned (cy=0)...
;this menu is not pinned: is an intermediate menu inbetween the
;requesting submenu, and the base window. Forward up the tree:
;if has a menu button, send VUP_QUERY from that button. Otherwise,
;send to generic parent and pray!
GOTO OLMenuWinCallButtonOrGenParent
callSuper:
GOTO WinClasses_ObjCallSuperNoLock_OLMenuWinClass_Far
OLMenuWinCallSuperIfPinned endp
OLMenuWinCallButtonOrGenParent proc far ;called via GOTO
class OLMenuWinClass
;this menu is not pinned: is an intermediate menu inbetween the
;requesting submenu, and the base window. Forward up the tree:
;if has a menu button, send VUP_QUERY from that button. Otherwise,
;send to generic parent and pray!
call WinClasses_DerefVisSpec_DI
.warn -private
tst ds:[di].OLPWI_button ;do we have a menu button?
.warn @private
jz callGenParent ;skip if not...
call OLPopupWinSendToButton ; (is movable, so no GOTO)
ret
callGenParent:
GOTO GenCallParent
OLMenuWinCallButtonOrGenParent endp
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinAlterFTVMCExcl
DESCRIPTION: We intercept this method here so that if a sub-menu requests
the focus window exclusive from an un-pinned menu,
we forward the request on up to the parent window (GenPrimary
or GenDisplay).
PASS: *ds:si - instance data
ax - MSG_VIS_VUP_ALTER_FTVMC_Excl
^lcx:dx - OD of object
bp - MetaAlterFTVMCExclFlags for object
RETURN:
DESTROYED: bx, si, di, ds, es
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 6/90 initial version
Doug 10/91 merged VUP_GRAB & VUP_RELEASE handlers here
------------------------------------------------------------------------------@
OLMenuWinAlterFTVMCExcl method dynamic OLMenuWinClass, \
MSG_META_MUP_ALTER_FTVMC_EXCL
test bp, mask MAEF_NOT_HERE ; if asking for exclusive ourself,
jnz callSuper ; let superclass do right thing
; If a child object, however, decide what to do with request
;
test bp, mask MAEF_FOCUS ; If not focus,
jz callSuper ; send request to superclass
; Otherwise, figure out if we should redirect request
;
test bp, mask MAEF_GRAB
jz release
;grab:
; First, see if sub-menu requesting grab. If not, just pass on
; request to superclass for normal handling
;
test bp, mask MAEF_OD_IS_WINDOW
jz callSuper
test bp, mask MAEF_OD_IS_MENU_RELATED
jz callSuper
;if this is a pinned menu (or will revert back to being a pinned
;menu shortly), behave as a base window: call superclass,
;so that OLWinClass handles this query as if this window was
;a GenPrimary. Otherwise (is normal menu), send query up tree.
GOTO OLMenuWinCallSuperIfPinned
release:
;Typically, we could just call OLMenuWinCallSuperIfPinned, and
;it would decide whether this menu should handle this VUP, or if it
;should forward it up to the Primary. But we have a situation where
;as this pinned menu is CLOSING, its system menu closes, and releases
;the focus window exclusive from this pinned menu. The problem is that
;since this menu is closing, the PINNED flag has been reset,
;and so we would forward this VUP to the Primary, when in fact we
;should handle it here, since this menu was recently pinned.
test ds:[di].OLWI_specState, mask OLWSS_PINNED
jnz callSuper ;skip if pinned (cy=0)...
test ds:[di].OLMWI_specState, mask OMWSS_WAS_PINNED
jnz callSuper ;skip if pinned (cy=0)...
;If not pinned, might have been recently pinned, or object releasing
;is not a sub-menu which grabbed the focus from the primary, so
;check to see if object actually does have grab here before sending
;on to primary.
cmp cx, ds:[di].OLWI_focusExcl.FTVMC_OD.handle
jne 10$
cmp dx, ds:[di].OLWI_focusExcl.FTVMC_OD.chunk
je callSuper ;skip to release exclusive from THIS
;windowed object...
;(no need to check the OLWI_prevFocusExcl, since menu ODs are not
;stored there: just gadgets, and they don't send RELEASE_FOCUS_EXCL)
10$: ;this menu is not pinned: is an intermediate menu inbetween the
;requesting submenu, and the base window. Forward up the tree:
;if has a menu button, send VUP_QUERY from that button. Otherwise,
;send to generic parent and pray!
GOTO OLMenuWinCallButtonOrGenParent
callSuper:
;
; fix problem of opening and pinning a submenu from a pinned menu
; resulting in the focus being returned to the pinned menu instead
; of the previous focus in the Primary -- if after release the focus
; for the becoming-pinned sub-menu, we are focus-less, then release
; the focus from ourselves. We will still have a focus if you open
; the submenu, then close it via kbd navigation. - brianc 1/22/93
;
push bp
call WinClasses_ObjCallSuperNoLock_OLMenuWinClass
pop bp
test bp, mask MAEF_GRAB or mask MAEF_NOT_HERE
jnz done ; not submenu release
test bp, mask MAEF_FOCUS
jz done ; not focus
call WinClasses_DerefVisSpec_DI
tst ds:[di].OLWI_focusExcl.FTVMC_OD.handle
jnz done ; have focus
; Should we do this test also - brianc 1/22/93
; Yes. 2/24/94 cbh (
test ds:[di].OLWI_specState, mask OLWSS_PINNED
jz done ; wasn't pinned
; )
call MetaReleaseFocusExclLow
;
; Give focus to next best window (will usually turn out to be the
; current target window)
;
mov ax, MSG_META_ENSURE_ACTIVE_FT
call GenCallApplication
done:
ret
OLMenuWinAlterFTVMCExcl endm
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinRecalcSize --
MSG_VIS_RECALC_SIZE for OLMenuWinClass
DESCRIPTION: Recalc's size.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_VIS_RECALC_SIZE
cx, dx - size suggestions
RETURN: cx, dx - size to use
ax, bp - destroyed
ALLOWED TO DESTROY:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chris 5/ 1/92 Initial Version
------------------------------------------------------------------------------@
OLMenuWinRecalcSize method dynamic OLMenuWinClass, MSG_VIS_RECALC_SIZE
call MenuWinPassMarginInfo
call OpenRecalcCtrlSize
ret
OLMenuWinRecalcSize endm
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinVisPositionBranch --
MSG_VIS_POSITION_BRANCH for OLMenuWinClass
DESCRIPTION: Positions the object.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_VIS_POSITION_BRANCH
cx, dx - position
RETURN: nothing
ax, cx, dx, bp - destroyed
ALLOWED TO DESTROY:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chris 5/ 1/92 Initial Version
------------------------------------------------------------------------------@
OLMenuWinVisPositionBranch method dynamic OLMenuWinClass, \
MSG_VIS_POSITION_BRANCH
call MenuWinPassMarginInfo
call VisCompPosition
ret
OLMenuWinVisPositionBranch endm
COMMENT @----------------------------------------------------------------------
ROUTINE: MenuWinPassMarginInfo
SYNOPSIS: Passes margin info for OpenRecalcCtrlSize.
CALLED BY: OLMenuWinRecalcSize, OLMenuWinPositionBranch
PASS: *ds:si -- MenuWin bar
RETURN: bp -- VisCompMarginSpacingInfo
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 5/ 1/92 Initial version
------------------------------------------------------------------------------@
MenuWinPassMarginInfo proc near uses cx, dx
.enter
call OLMenuWinGetSpacing ;first, get spacing
push cx, dx ;save spacing
call OpenWinGetMargins ;margins in ax/bp/cx/dx
pop di, bx
call OpenPassMarginInfo
exit:
.leave
ret
MenuWinPassMarginInfo endp
WinClasses ends
;-------------------------------
WinMethods segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinGetSpacing --
MSG_VIS_COMP_GET_CHILD_SPACING for OLMenuWinClass
DESCRIPTION: Handles spacing for the OLMenuWinClass. Makes very small
spacing between the non-outlined buttons in unpinned menus.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_VIS_COMP_GET_CHILD_SPACING
RETURN: cx - spacing between children
dx - spacing between lines of wrapped children
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/18/89 Initial version
------------------------------------------------------------------------------@
OLMenuWinGetSpacing method OLMenuWinClass, MSG_VIS_COMP_GET_CHILD_SPACING
;
; Do normal window stuff.
;
mov cx, MENU_SPACING ;no spacing between menu items
mov dx, cx
if _MENUS_PINNABLE ;------------------------------------------------------
if _OL_STYLE ;START of OPEN_LOOK specific code -----------------------------
mov di, ds:[si] ;point to instance
add di, ds:[di].Vis_offset ;ds:[di] -- SpecInstance
test ds:[di].OLWI_specState, mask OLWSS_PINNED ;if pinned, exit
jnz OLMWGS_exit
mov cx, 1 ;else very minimal spacing
endif
endif
ret
OLMenuWinGetSpacing endp
WinMethods ends
;-------------------------------
KbdNavigation segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinFindKbdAccelerator --
MSG_GEN_FIND_KBD_ACCELERATOR for OLMenuWinClass
DESCRIPTION: Looks for keyboard accelerator. The only reason this is
subclassed is to set the gadget exclusive when we activate
the menu button.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_GEN_FIND_KBD_ACCELERATOR
same as MSG_META_KBD_CHAR:
cl - Character (Chars or VChar)
ch - CharacterSet (CS_BSW or CS_CONTROL)
dl - CharFlags
dh - ShiftState (left from conversion)
bp low - ToggleState
bp high - scan code
RETURN: carry set if accelerator found and dealt with
DESTROYED: bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 5/ 4/90 Initial version
------------------------------------------------------------------------------@
OLMenuWinFindKbdAccelerator method OLMenuWinClass, \
MSG_GEN_FIND_KBD_ACCELERATOR
call GenCheckKbdAccelerator ;see if we have a match
jnc exit ;nope, exit
call KN_DerefVisSpec_DI
mov si, ds:[di].OLPWI_button ;application releasing the
tst si ;no button, exit
jz exit
mov bx, ds:[LMBH_handle]
mov ax, MSG_OL_BUTTON_KBD_ACTIVATE
mov di, mask MF_FORCE_QUEUE
call ObjMessage
stc
exit:
ret
OLMenuWinFindKbdAccelerator endm
KbdNavigation ends
WinMethods segment resource
COMMENT @----------------------------------------------------------------------
FUNCTION: OLMenuWinLostGadgetExcl
DESCRIPTION: This method is sent when some other object in the parent window
(GenPrimary or pinned parent menu) grabs the gadget exclusive.
NOTE: if we get this method, it means that we HAVE the
gadget exclusive; so therefore this menu is in stay-up-mode,
or is a popup menu which is being held open.
If the menu button which opens this menu is grabbing the
gadget exclusive, we ignore this loss, because we know
this button is going to open this menu shortly.
PASS: *ds:si = instance data for object
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 5/90 initial version
------------------------------------------------------------------------------@
OLMenuWinLostGadgetExcl method dynamic OLMenuWinClass, MSG_VIS_LOST_GADGET_EXCL
mov di, ds:[di].OLPWI_button
tst di ;do we have a menu button?
jz genDismissInteraction ;skip if not (is popup menu)...
;this is a standard menu: if menu button is going to open menu,
;DO NOT close menu now! (*ds:di = OLMenuButtonClass object)
.warn -private
mov di, ds:[di] ;set ds:di = Spec instance data for
add di, ds:[di].Vis_offset ;the OLMenuButtonClass object
test ds:[di].OLBI_specState, mask OLBSS_HAS_MOUSE_GRAB
.warn @private
jz genDismissInteraction ;skip if button not pressed...
;ignore this LOST_GADGET event, since the button will shortly
;open this menu again.
ret
genDismissInteraction:
;if this menu is not PINNED, will send MSG_GEN_GUP_INTERACTION_COMMAND
;with IC_DISMISS to self.
;If using cascading menus, call OLMenuWinCloseOrCascade which will
;take care of checking if this menu is currently cascading.
if _CASCADING_MENUS
call OLMenuWinCloseOrCascade ;destroys:ax,bx,cx,dx,bp,di
else ;_CASCADING_MENUS is FALSE
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
mov cx, IC_INTERACTION_COMPLETE
call ObjCallInstanceNoLock
endif ;_CASCADING_MENUS
ret
OLMenuWinLostGadgetExcl endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuMarkForCloseOneLevel
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: used to close last menu in cascading set
CALLED BY: MSG_OL_MENU_MARK_FOR_CLOSE_ONE_LEVEL
PASS: *ds:si = OLMenuWinClass object
ds:di = OLMenuWinClass instance data
ds:bx = OLMenuWinClass object (same as *ds:si)
es = segment of OLMenuWinClass
ax = message #
RETURN:
DESTROYED:
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 6/21/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinGupSubmenuRequestsClose
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Checks the OMWMSS_IGNORE_SUBMENU_CLOSE_REQUEST flag.
If the flag is true, then the flag is cleared, and the
method returns. If the flag is false, then this menu
is closed, and the message is sent to the Gen parent
if the parent's vis part is an OLMenuWinClass.
CALLED BY: MSG_MO_MW_GUP_SUBMENU_REQUESTS_CLOSE
PASS: *ds:si = OLMenuWinClass object
ds:di = OLMenuWinClass instance data
ds:bx = OLMenuWinClass object (same as *ds:si)
es = segment of OLMenuWinClass
ax = message #
RETURN: Nothing
DESTROYED: ax
SIDE EFFECTS: None.
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JimG 4/21/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _CASCADING_MENUS
OLMenuWinGupSubmenuRequestsClose method dynamic OLMenuWinClass,
MSG_MO_MW_GUP_SUBMENU_REQUESTS_CLOSE
; check this before saving the passed args since it would be a waste
; of time if the jump was followed.
test ds:[di].OLMWI_moreSpecState, \
mask OMWMSS_IGNORE_SUBMENU_CLOSE_REQUEST
jnz done
push cx, dx, bp ; save args
; ensure cascade data is consistent
EC < call OLMenuWinECCheckCascadeData >
; since this menu is going down, disable the cascading bit.
test ds:[di].OLMWI_moreSpecState, mask OMWMSS_IS_CASCADING
jz notCascading
andnf ds:[di].OLMWI_moreSpecState, not (mask OMWMSS_IS_CASCADING)
; Delete the cascaded var data
mov ax, ATTR_OL_MENU_WIN_CASCADED_MENU
call ObjVarDeleteData
EC < ERROR_C OL_ERROR ; no var data-inconsistent >
notCascading:
; prevent this message from being resent by lost_gadget_excl handler.
ornf ds:[di].OLMWI_moreSpecState, mask OMWMSS_DONT_SEND_REQUEST
; close this menu
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
mov cx, IC_INTERACTION_COMPLETE
call ObjCallInstanceNoLock
call OLMenuWinSendCloseRequest ; Destroys ax, bx, cx, dx, bp
mov di, ds:[si]
add di, ds:[di].Vis_offset
donePop::
pop cx, dx, bp ; restore args
; ONLY JUMP HERE FROM BEFORE PUSHING THE ARGS
done:
; the ignore is only valid for one request at a time. also,
; allow this request to be sent again.
andnf ds:[di].OLMWI_moreSpecState, \
not (mask OMWMSS_IGNORE_SUBMENU_CLOSE_REQUEST or \
mask OMWMSS_DONT_SEND_REQUEST)
ret
OLMenuWinGupSubmenuRequestsClose endm
endif ;_CASCADING_MENUS
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinCloseOrCascade
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Closes the current menu and sends the submenu close request
message to the parent if the current menu is not cascading.
CALLED BY: OLMenuWinLostGadgetExcl, OLMenuWinPostPassiveButton
PASS: *ds:si = menu object
RETURN: None.
DESTROYED: ax, bx, cx, dx, bp, di
SIDE EFFECTS:
WARNING: This routine MAY resize LMem and/or object blocks, moving
them on the heap and invalidating stored segment pointers
and current register or stored offsets to them.
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JimG 4/21/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _CASCADING_MENUS
OLMenuWinCloseOrCascade proc far
class OLMenuWinClass
.enter
mov di, ds:[si]
add di, ds:[di].Vis_offset
test ds:[di].OLMWI_moreSpecState, mask OMWMSS_IS_CASCADING
jnz done ; menu is cascading..
; don't close
; be sure to always clear this flag if the menu is going down
andnf ds:[di].OLMWI_moreSpecState, \
not mask OMWMSS_IGNORE_SUBMENU_CLOSE_REQUEST
; prevent close request from being resent by lost_gadget_excl handler.
mov bl, ds:[di].OLMWI_moreSpecState ; store original state for later
ornf ds:[di].OLMWI_moreSpecState, mask OMWMSS_DONT_SEND_REQUEST
; close this menu
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
mov cx, IC_INTERACTION_COMPLETE
call ObjCallInstanceNoLock
; okay, send the request. restore the flag first.
mov di, ds:[si]
add di, ds:[di].Vis_offset
andnf ds:[di].OLMWI_moreSpecState, not mask OMWMSS_DONT_SEND_REQUEST
; told not to send request.. skip to end.
test bl, mask OMWMSS_DONT_SEND_REQUEST
jnz done
; send close request to menu parents, if they exists.
call OLMenuWinSendCloseRequest ; destroys: ax,bx,cx,dx,bp
done:
.leave
ret
OLMenuWinCloseOrCascade endp
endif ;_CASCADING_MENUS
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinSendCloseRequest
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Looks up the generic tree to find an object of class
OLMenuWinClass. The search is continued until an
object that is not a subclass of GenInteractionClass is
found. If it finds the menu window, the message
MSG_MO_MW_GUP_SUBMENU_REQUESTS_CLOSE is sent.
The menu window object's vis part MUST already be built.
CALLED BY: OLMenuWinCloseOrCascade and OLMenuWinGupSubmenuRequestClose
PASS: *ds:si = menu object
RETURN: *ds:si = current menu object. (ds is fixed up).
DESTROYED: ax, bx, cx, dx, bp, di
SIDE EFFECTS:
WARNING: This routine MAY resize LMem and/or object blocks, moving
them on the heap and invalidating stored segment pointers
and current register or stored offsets to them.
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JimG 4/21/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _CASCADING_MENUS
OLMenuWinSendCloseRequest proc near
uses si, es
.enter
mov bx, ds:[LMBH_handle]
mov di, ds:[si]
add di, ds:[di].Vis_offset
mov si, ds:[di].OLPWI_button ; ^lbx:si = menu button
tst si
jz done
searchLoop:
mov ax, MSG_VIS_FIND_PARENT
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
jcxz done
movdw bxsi, cxdx ; ^lbx:si = parent
call ObjSwapLock
segmov es, <segment GenInteractionClass>, di
mov di, offset GenInteractionClass
call ObjIsObjectInClass
jnc unlock ; break out of loop
segmov es, <segment OLMenuWinClass>, di
mov di, offset OLMenuWinClass
call ObjIsObjectInClass
cmc
jc unlock ; continue up tree
mov ax, MSG_MO_MW_GUP_SUBMENU_REQUESTS_CLOSE
call ObjCallInstanceNoLock ; Destroys: ax
clc
unlock:
call ObjSwapUnlock
jc searchLoop ; continue if carry set
done:
.leave
ret
OLMenuWinSendCloseRequest endp
endif ;_CASCADING_MENUS
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinSendCloseRequestToLastMenu
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Sends a MSG_MO_MW_GUP_SUBMENU_REQUESTS_CLOSE to the last
menu of the currently cascaded menus. May close all menus
in the this chain of menus or may close only the menus BELOW
the current menu depending upon the value of cx.
CALLED BY:
PASS: *ds:si = current menu object
cx = Preserve current menu and those above it
TRUE: Only close menus BELOW the current menu
FALSE: Close all menus in this chain
RETURN: *ds:si = current menu object. (ds is fixed up).
DESTROYED: ax, bx, cx, dx, bp, di
SIDE EFFECTS:
WARNING: This routine MAY resize LMem and/or object blocks, moving
them on the heap and invalidating stored segment pointers
and current register or stored offsets to them.
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JimG 4/27/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _CASCADING_MENUS
OLMenuWinSendCloseRequestToLastMenu proc far
.enter
; Set ignore bit to preserve the current menu based upon cx.
mov di, ds:[si]
add di, ds:[di].Vis_offset
; Assume we close all menus.
andnf ds:[di].OLMWI_moreSpecState, \
not (mask OMWMSS_IGNORE_SUBMENU_CLOSE_REQUEST)
jcxz beginLoop
; Nope, preserve current menu.
ornf ds:[di].OLMWI_moreSpecState, \
mask OMWMSS_IGNORE_SUBMENU_CLOSE_REQUEST
beginLoop:
; Add extra lock to original object to make loop work correctly.
mov bx, ds:[LMBH_handle] ; ^lbx = orig obj handle
push bx, si ; SAVE original object OPTR
call ObjLockObjBlock ; ax = segment
EC < mov dx, ds >
EC < cmp ax, dx >
EC < ERROR_NE OL_ERROR ; SHOULD BE EQUAL! >
tryAgain:
; *ds:si = current menu, locked
; ensure cascade data consistency
EC < call OLMenuWinECCheckCascadeData >
; Ensure the object's vis part is built!
EC < call VisCheckVisAssumption >
; Check if the object is of class OLMenuWinClass
EC < mov cx, segment OLMenuWinClass >
EC < mov dx, offset OLMenuWinClass >
EC < mov ax, MSG_META_IS_OBJECT_IN_CLASS >
EC < call ObjCallInstanceNoLock ; Destroys: ax, cx, dx, bp>
EC < ERROR_NC OL_ERROR ; NOT OLMenuWinClass !! >
; Is this the last child?
mov di, ds:[si]
add di, ds:[di].Vis_offset
test ds:[di].OLMWI_moreSpecState, mask OMWMSS_IS_CASCADING
jz sendMessage ; Yes -- send message
; No -- find next child in cascade.
mov ax, ATTR_OL_MENU_WIN_CASCADED_MENU
call ObjVarFindData ; if data, ds:bx = ptr
; (ds still ptr to our block)
EC < ERROR_NC OL_ERROR ; no var data - that's bad >
; Get optr from vardata of next child.
mov si, ds:[bx].offset
mov bx, ds:[bx].handle ; ^lbx:si = next child menu
call ObjLockObjBlock ; *ax:si = next child, locked
mov bx, ds:[LMBH_handle] ; ^lbx = parent menu handle
call MemUnlock ; unlock parent menu
mov ds, ax ; *ds:si = next child, locked
; Continue looking for child
jmp tryAgain
sendMessage:
; *ds:si = correct object to send message to, locked.
mov ax, MSG_MO_MW_GUP_SUBMENU_REQUESTS_CLOSE
call ObjCallInstanceNoLock
; unlock last block
mov bx, ds:[LMBH_handle]
call MemUnlock
pop bx, si ; ^lbx:si = original obj optr
call MemDerefDS ; fixup ds.. *ds:si = orig obj
.leave
ret
OLMenuWinSendCloseRequestToLastMenu endp
endif ;_CASCADING_MENUS
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinCloseAllMenusInCascade
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: All the menus in the cascade that the destination menu
belongs to will be closed. Basically just calls
OLMenuWinSendCloseRquestToLastMenu.
CALLED BY: MSG_MO_MW_CLOSE_ALL_MENUS_IN_CASCADE
PASS: *ds:si = OLMenuWinClass object
ds:di = OLMenuWinClass instance data
ds:bx = OLMenuWinClass object (same as *ds:si)
es = segment of OLMenuWinClass
ax = message #
RETURN: None
DESTROYED: ax, cx, bp
SIDE EFFECTS:
May close all menus in cascade!
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JimG 6/10/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _CASCADING_MENUS
OLMenuWinCloseAllMenusInCascade method dynamic OLMenuWinClass,
MSG_MO_MW_CLOSE_ALL_MENUS_IN_CASCADE
uses dx
.enter
; send close request to last menu. do not preserve the current menu.
clr cx
call OLMenuWinSendCloseRequestToLastMenu
.leave
ret
OLMenuWinCloseAllMenusInCascade endm
endif ;_CASCADING_MENUS
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinVisOpen
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Sets up some flags used for cascading menus, calls superclass.
CALLED BY: MSG_VIS_OPEN
PASS: *ds:si = OLMenuWinClass object
ds:di = OLMenuWinClass instance data
ds:bx = OLMenuWinClass object (same as *ds:si)
es = segment of OLMenuWinClass
ax = message #
bp = 0 if top window, else window for obejct to open on
RETURN: Nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JimG 4/21/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLMenuWinVisOpen method dynamic OLMenuWinClass,
MSG_VIS_OPEN
.enter
if _CASCADING_MENUS
; ensure cascade data is consistent
EC < call OLMenuWinECCheckCascadeData >
; clear cascade var data, if any remaining.
test ds:[di].OLMWI_moreSpecState, mask OMWMSS_IS_CASCADING
jz notCascading
; Delete the cascaded var data
push ax
mov ax, ATTR_OL_MENU_WIN_CASCADED_MENU
call ObjVarDeleteData
EC < ERROR_C OL_ERROR ; no var data-inconsistent >
pop ax
notCascading:
; Clears all cascade state bits
clr ds:[di].OLMWI_moreSpecState
endif ;_CASCADING_MENUS
; Call superclass
mov di, offset OLMenuWinClass
call ObjCallSuperNoLock
; Update up/down scrollers as needed
mov al, 0
call OLMenuWinUpdateUpDownScrollers
.leave
ret
OLMenuWinVisOpen endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinUpdateUpDownScrollers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Update up/down scrollers for menu window
CALLED BY: OLMenuWinVisOpen, OLMenuWinVisClose, OLMenuWinMoveResizeWin
PASS: *ds:si = OLMenuWinClass object
al = non-zero to delay closing until END_SELECT
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
joon 3/02/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MENU_WIN_SCROLL_DELTA equ 23
OLMenuWinUpdateUpDownScrollers proc far
delayClose local word push ax ; only al used
scrollers local word push 0 ; assume no scrollers needed
upScroller local lptr push 0 ; assume no up scroller exists
downScroller local lptr push 0 ; assume no dn scroller exists
parent local Rectangle
parentWin local hptr
menu local Rectangle
menuWin local hptr
uses ax,bx,cx,dx,si,di,bp,es
.enter
; not needed for pinned menus
mov di, ds:[si]
add di, ds:[di].Vis_offset
test ds:[di].OLWI_specState, mask OLWSS_PINNED
LONG jnz done
; first figure out what needs to be updated
call VisQueryParentWin ; di = window handle
tst di
jz checkUpdate
call WinGetWinScreenBounds
mov ss:[parent].R_top, bx
mov ss:[parent].R_bottom, dx
mov ss:[parentWin], di
if TOOL_AREA_IS_TASK_BAR
call OLWinGetToolAreaSize ; dx = height
push ds
segmov ds, dgroup
tst ds:[taskBarAutoHide]
jnz doneTaskBar
tst ds:[taskBarPosition]
jg atBottom
add ss:[parent].R_top, dx
jmp short doneTaskBar
atBottom:
sub ss:[parent].R_bottom, dx
doneTaskBar:
pop ds
endif
call VisQueryWindow ; di = window handle
tst di
jz checkUpdate
call WinGetWinScreenBounds
add ax, 2
sub cx, 2
mov ss:[menu].R_left, ax
mov ss:[menu].R_top, bx
mov ss:[menu].R_right, cx
mov ss:[menu].R_bottom, dx
mov ss:[menuWin], di
cmp bx, ss:[parent].R_top
jge checkDown
mov ss:[scrollers].high, TRUE ; need up scroller
checkDown:
cmp dx, ss:[parent].R_bottom
jle checkUpdate
mov ss:[scrollers].low, TRUE ; need down scroller
; now update the scrollers
checkUpdate:
tst ss:[scrollers]
jnz update
mov ax, TEMP_OL_MENU_WIN_SCROLLERS ; if no hint and no scrollers
call ObjVarFindData ; are needed, then we're done
jnc done
update:
call EnsureMenuWinUpDownScrollers
handleUpScroller:
mov si, ss:[upScroller]
tst ss:[scrollers].high
call openClose
mov si, ss:[downScroller]
tst ss:[scrollers].low
call openClose
done:
.leave
ret
openClose:
jz close
call OpenMenuWinScrollerWindow
retn
close:
call CloseMenuWinScrollerWindow
retn
OLMenuWinUpdateUpDownScrollers endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EnsureMenuWinUpDownScrollers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Ensure up/down scroller objects exist
CALLED BY: OLMenuWinUpdateUpDownScrollers
PASS: *ds:si = OLMenuWinClass object
OLMenuWinUpdateUpDownScrollers stack frame
RETURN: nothing
DESTROYED: ax,bx,cx,dx,di,es
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Joon 3/2/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
EnsureMenuWinUpDownScrollers proc near
.enter inherit OLMenuWinUpdateUpDownScrollers
mov ax, TEMP_OL_MENU_WIN_SCROLLERS
call ObjVarFindData
jnc createScrollers
mov ax, ds:[bx].MWSS_upScroller
mov ss:[upScroller], ax
mov ax, ds:[bx].MWSS_downScroller
mov ss:[downScroller], ax
jmp done
createScrollers:
mov ax, MENU_WIN_SCROLL_DELTA
mov dx, offset menuWinScrollerUpBitmap
call createScroller
mov ss:[upScroller], ax
mov ax, -MENU_WIN_SCROLL_DELTA
mov dx, offset menuWinScrollerDownBitmap
call createScroller
mov ss:[downScroller], ax
mov ax, TEMP_OL_MENU_WIN_SCROLLERS
mov cx, size MenuWinScrollerStruct
call ObjVarAddData
mov ax, ss:[upScroller]
mov ds:[bx].MWSS_upScroller, ax
mov ax, ss:[downScroller]
mov ds:[bx].MWSS_downScroller, ax
done:
.leave
ret
createScroller:
push si
segmov es, <segment MenuWinScrollerClass>
mov di, offset MenuWinScrollerClass
mov bx, ds:[LMBH_handle]
call GenInstantiateIgnoreDirty
mov di, ds:[si]
mov ds:[di].MWSI_delta, ax
mov ds:[di].MWSI_bitmap, dx
mov ax, si
pop si
mov ds:[di].MWSI_menu, si
retn
EnsureMenuWinUpDownScrollers endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OpenMenuWinScrollerWindow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Open menu window up/down scroller
CALLED BY: OLMenuWinUpdateUpDownScrollers
PASS: *ds:si = MenuWinScrollerClass object
OLMenuWinUpdateUpDownScrollers stack frame
RETURN: nothing
DESTROYED: ax,bx,cx,dx,di
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Joon 3/3/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OpenMenuWinScrollerWindow proc near
.enter inherit OLMenuWinUpdateUpDownScrollers
EC < push es, di >
EC < segmov es, <segment MenuWinScrollerClass> >
EC < mov di, offset MenuWinScrollerClass >
EC < call ObjIsObjectInClass >
EC < ERROR_NC OL_ERROR ; not a MenuWinScroller >
EC < pop es, di >
mov di, ds:[si]
tst ds:[di].MWSI_window
jnz done
if (0)
push si, bp
mov bx, si
mov di, ss:[menuWin]
mov si, WIT_LAYER_ID
call WinGetInfo
mov si, bx
push ax ; layer ID to use
call GeodeGetProcessHandle ; Get owner for window
push bx ; owner to use
push ss:[parentWin] ; parent window handle
push 0 ; window region segment
push 0 ; window region offset
mov bx, ss:[parent].R_top
mov dx, bx
add dx, MENU_WIN_SCROLL_DELTA
mov di, ds:[si]
tst ds:[di].MWSI_delta
jg gotBounds
mov dx, ss:[parent].R_bottom
mov bx, dx
sub bx, MENU_WIN_SCROLL_DELTA
gotBounds:
push dx ; window bottom
push ss:[menu].R_right ; window right
push bx ; window top
push ss:[menu].R_left ; window left
mov di, ss:[menuWin] ; ^hdi = menu Window
mov bp, si ; *ds:bp = expose OD
mov si, WIT_PRIORITY
call WinGetInfo ; al = WinPriorityData
clr ah ; ax = WinPassFlags
push ax ; save WinPassFlags
mov si, WIT_COLOR
call WinGetInfo ; ax,bx = color
pop si ; si = WinPassFlags
mov di, ds:[LMBH_handle] ; ^ldi:bp = expose OD
movdw cxdx, dibp ; ^lcx:dx = mouse OD
call WinOpen
pop si, bp
else
mov ax, ss:[parent].R_top
mov cx, ax
add cx, MENU_WIN_SCROLL_DELTA
tst ds:[di].MWSI_delta
jg createWindow
mov cx, ss:[parent].R_bottom
mov ax, cx
sub ax, MENU_WIN_SCROLL_DELTA
createWindow:
push si, bp
call GeodeGetProcessHandle ; Get owner for window
push bx ; layer ID to use
push bx ; owner to use
push ss:[parentWin] ; parent window handle
push 0 ; window region segment
push 0 ; window region offset
push cx ; window bottom
mov ss:[menu].R_bottom, cx ; store for later
push ss:[menu].R_right ; window right
push ax ; window top
mov ss:[menu].R_top, ax ; store for later
push ss:[menu].R_left ; window left
mov di, ss:[menuWin] ; ^hdi = menu Window
mov bp, si ; *ds:bp = expose OD
mov si, WIT_PRIORITY
call WinGetInfo ; al = WinPriorityData
clr ah ; ax = WinPassFlags
push ax ; save WinPassFlags
mov si, WIT_COLOR
call WinGetInfo ; ax,bx = color
pop si ; si = WinPassFlags
mov di, ds:[LMBH_handle] ; ^ldi:bp = expose OD
movdw cxdx, dibp ; ^lcx:dx = mouse OD
call WinOpen
pop si, bp
endif
mov di, ds:[si]
mov ds:[di].MWSI_window, bx
mov ax, ss:[menu].R_top
mov ds:[di].MWSI_top, ax
mov ax, ss:[menu].R_bottom
mov ds:[di].MWSI_bottom, ax
done:
.leave
ret
OpenMenuWinScrollerWindow endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CloseMenuWinScrollerWindow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Close menu window up/down scroller
CALLED BY: INTERNAL
PASS: *ds:si = MenuWinScrollerClass
RETURN: nothing
DESTROYED: ax,di
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Joon 3/3/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CloseMenuWinScrollerWindow proc near
.enter inherit OLMenuWinUpdateUpDownScrollers
EC < push es, di >
EC < segmov es, <segment MenuWinScrollerClass> >
EC < mov di, offset MenuWinScrollerClass >
EC < call ObjIsObjectInClass >
EC < ERROR_NC OL_ERROR ; not a MenuWinScroller >
EC < pop es, di >
tst ss:[delayClose].low
jnz done
clr ax
mov di, ds:[si]
xchg ax, ds:[di].MWSI_window
tst ax
jz done
mov di, ax
call WinClose ; close the MenuWinScroller window
done:
.leave
ret
CloseMenuWinScrollerWindow endp
WinMethods ends
LessUsedGeometry segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinUpdateGeometry --
MSG_VIS_UPDATE_GEOMETRY for OLMenuWinClass
DESCRIPTION: Updates geometry.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_VIS_UPDATE_GEOMETRY
RETURN: nothing
ax, cx, dx, bp - destroyed
ALLOWED TO DESTROY:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chris 4/21/92 Initial Version
------------------------------------------------------------------------------@
OLMenuWinUpdateGeometry method dynamic OLMenuWinClass, MSG_VIS_UPDATE_GEOMETRY
push ax, es
test ds:[di].VI_optFlags, mask VOF_GEO_UPDATE_PATH or \
mask VOF_GEOMETRY_INVALID
jz callSuper
call OLMenuCalcCenters
jnc callSuper ;nothing to do, branch
test bp, mask SGMCF_NEED_TO_RESET_GEO ;any item have valid geometry?
jz callSuper ;no, no need to reset stuff.
mov dl, VUM_MANUAL
mov ax, MSG_VIS_RESET_TO_INITIAL_SIZE
call ObjCallInstanceNoLock
callSuper:
pop ax, es
mov di, offset OLMenuWinClass
CallSuper MSG_VIS_UPDATE_GEOMETRY
ret
OLMenuWinUpdateGeometry endm
COMMENT @----------------------------------------------------------------------
ROUTINE: OLMenuCalcCenters
SYNOPSIS: Calculates left and right portions of a menu.
CALLED BY: OLMenuWinUpdateGeometry, OLMenuWinResetSizeToStayOnscreen
PASS: *ds:si -- menu
RETURN: carry set if values changed
bp -- SpecGetMenuCenterFlags
DESTROYED: cx, dx, di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 2/ 4/93 Initial version
------------------------------------------------------------------------------@
OLMenuCalcCenters proc near
;
; Before we do geometry, we'll go through all the child menu items and
; determinate who is the biggest one. (We'll make two passes if the
; first pass yields an object allowing wrapping, so that all the
; children can clear their optimization bits and set expand-width-to-fit
; bits correctly. -cbh 1/18/93)
;
; If this is a pinned menu, we need the items to expand to fit whatever
; minimum width might be needed for the menu, so we'll set the ALLOWING_
; WRAPPING flag now, which effectively turns off geometry optizations.
; -cbh 2/12/93
;
clr bp
mov di, ds:[si]
add di, ds:[di].Vis_offset
test ds:[di].OLWI_specState, mask OLWSS_PINNED
jz 5$
or bp, mask SGMCF_ALLOWING_WRAPPING
5$:
call GetMenuCenter
test bp, mask SGMCF_ALLOWING_WRAPPING
jz 10$
call GetMenuCenter
10$:
cmp cx, ds:[di].OLMWI_monikerSpace
jne sizesChanged
cmp dx, ds:[di].OLMWI_accelSpace
clc ;assume sizes not changing
je exit ;nope, exit
sizesChanged:
;
; If the menu item sizes changed, we'll store the new values and
; reset the geometry of all the objects in the window, so the menus
; will get their sizes recalculated. (We could also do this via
; VGA_ALWAYS_RECALC_SIZE in the buttons, but this will be more efficient
; for most situations.)
;
mov di, ds:[si]
add di, ds:[di].Vis_offset
mov ds:[di].OLMWI_monikerSpace, cx
mov ds:[di].OLMWI_accelSpace, dx
stc
exit:
ret
OLMenuCalcCenters endp
GetMenuCenter proc near
clr cx ;moniker space
mov dx, cx ;accelerator space
mov ax, MSG_SPEC_GET_MENU_CENTER
call ObjCallInstanceNoLock
ret
GetMenuCenter endp
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinConvertDesiredSizeHint --
MSG_SPEC_CONVERT_DESIRED_SIZE_HINT for OLMenuWinClass
DESCRIPTION: Converts desired size for this object.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_SPEC_CONVERT_DESIRED_SIZE_HINT
cx - SpecSizeSpec: width
dx - SpecSizeSpec: height
bp - number of childre
RETURN: cx, dx - converted size
ax, bp - destroyed
ALLOWED TO DESTROY:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chris 5/20/92 Initial Version
------------------------------------------------------------------------------@
OLMenuWinConvertDesiredSizeHint method dynamic OLMenuWinClass, \
MSG_SPEC_CONVERT_DESIRED_SIZE_HINT
;
; Hack to get the buttons of popup lists to get correct desired size
; calculations (it derives its hint from this object).
; (Changed 11/11/92 cbh to do the conversion at the button.)
;
mov bx, ds:[di].OLCI_buildFlags
and bx, mask OLBF_TARGET
cmp bx, OLBT_IS_POPUP_LIST shl offset OLBF_TARGET
je isPopupList
callSuper:
mov di, offset OLMenuWinClass
GOTO ObjCallSuperNoLock ;do normal OLCtrl stuff
isPopupList:
mov di, ds:[di].OLPWI_button
tst di
jz callSuper ;no button, call superclass
; (why, I don't know.)
mov si, di
call ObjCallInstanceNoLock ;send to the button
if not SELECTION_BOX
tst cx ;no width hint, exit
jz exit
add cx, OL_DOWN_MARK_WIDTH + OL_MARK_SPACING
endif
exit:: ;add width of arrow plus margin
ret
OLMenuWinConvertDesiredSizeHint endm
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinResetSizeToStayOnscreen --
MSG_SPEC_RESET_SIZE_TO_STAY_ONSCREEN for OLMenuWinClass
DESCRIPTION: Resets size to keep itself onscreen.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_SPEC_RESET_SIZE_TO_STAY_ONSCREEN
dl - VisUpdateMode
RETURN: nothing
ax, cx, dx, bp - destroyed
ALLOWED TO DESTROY:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chris 2/ 4/93 Initial Version
------------------------------------------------------------------------------@
OLMenuWinResetSizeToStayOnscreen method dynamic OLMenuWinClass, \
MSG_SPEC_RESET_SIZE_TO_STAY_ONSCREEN
;
; Wrap the puppy if it doesn't fit, and hope for the best. -2/ 5/93
; (Not working yet. -cbh 2/ 6/93)
;
; or ds:[di].VCI_geoAttrs, mask VCGA_ALLOW_CHILDREN_TO_WRAP
mov di, offset OLMenuWinClass
call ObjCallSuperNoLock
call OLMenuCalcCenters ;this needs to be redone now,
; mainly so that the ONE_PASS
; OPTIMIZATION flag is cleared.
ret
OLMenuWinResetSizeToStayOnscreen endm
LessUsedGeometry ends
WinMethods segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MenuWinScrollerStartSelect
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Handle start select on scroller
CALLED BY: MSG_META_START_SELECT
PASS: *ds:si = MenuWinScrollerClass object
ds:di = MenuWinScrollerClass instance data
ds:bx = MenuWinScrollerClass object (same as *ds:si)
es = segment of MenuWinScrollerClass
ax = message #
cx = X position of mouse
dx = X position of mouse
bp low = ButtonInfo (In input.def)
bp high = UIFunctionsActive (In Objects/uiInputC.def)
RETURN: ax = MouseReturnFlags (In Objects/uiInputC.def)
DESTROYED: bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
joon 3/03/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MenuWinScrollerStartSelect method dynamic MenuWinScrollerClass,
MSG_META_START_SELECT
MenuWinScrollerScroll label far
push si
call MenuWinScrollerScrollOnly
call ImGetButtonState
call OLMenuWinUpdateUpDownScrollers
pop si
call MenuWinScrollerStartTimer
mov ax, mask MRF_PROCESSED
ret
MenuWinScrollerStartSelect endm
;
; returns: C set if actually scrolled
;
MenuWinScrollerScrollOnly proc near
mov di, ds:[si]
mov bp, ds:[di].MWSI_delta
mov si, ds:[di].MWSI_menu
;
; check if already at top or bottom
;
call VisQueryParentWin ; di = window handle
tst di
jz update
call WinGetWinScreenBounds
if TOOL_AREA_IS_TASK_BAR
; bx = top, dx = bottom
mov ax, dx ; ax = bottom
call OLWinGetToolAreaSize ; cx = width, dx = height
push ds
segmov ds, dgroup
tst ds:[taskBarAutoHide]
jnz doneTaskBar
tst ds:[taskBarPosition]
jg atBottom
add bx, dx
jmp short doneTaskBar
atBottom:
sub ax, dx
doneTaskBar:
pop ds
push bx, ax ; save top, bottom
else
push bx, dx ; save top, bottom
endif
call VisQueryWindow ; di = window handle
tst di
jz update
call WinGetWinScreenBounds
pop ax, cx ; ax = scrn top, cx = scrn bot
tst bp
jns scrollDown
cmp dx, cx
jle update
jmp short moveIt
scrollDown:
cmp bx, ax
jge update
moveIt:
call VisGetBounds
mov cx, ax
mov dx, bx
add dx, bp
call VisSetPosition
mov ax, MSG_VIS_MOVE_RESIZE_WIN
mov di, offset OLWinClass
call ObjCallSuperNoLock
stc
jmp short exit
update:
clc
exit:
ret
MenuWinScrollerScrollOnly endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MenuWinScrollerEndSelect
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Handle end select on scroller
CALLED BY: MSG_META_END_SELECT
PASS: *ds:si = MenuWinScrollerClass object
ds:di = MenuWinScrollerClass instance data
ds:bx = MenuWinScrollerClass object (same as *ds:si)
es = segment of MenuWinScrollerClass
ax = message #
cx = X position of mouse
dx = X position of mouse
bp low = ButtonInfo (In input.def)
bp high = UIFunctionsActive (In Objects/uiInputC.def)
RETURN: ax = MouseReturnFlags (In Objects/uiInputC.def)
DESTROYED: bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
joon 3/03/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MenuWinScrollerEndSelect method dynamic MenuWinScrollerClass,
MSG_META_END_SELECT, MSG_META_END_OTHER
call MenuWinScrollerStopTimer
;
; update pending close
;
mov di, ds:[si]
mov si, ds:[di].MWSI_menu
mov al, 0
call OLMenuWinUpdateUpDownScrollers
mov ax, mask MRF_PROCESSED
ret
MenuWinScrollerEndSelect endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MenuWinScrollerRawUnivEnter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Mouse pointer entered scroller window
CALLED BY: MSG_META_RAW_UNIV_ENTER
PASS: *ds:si = MenuWinScrollerClass object
ds:di = MenuWinScrollerClass instance data
ds:bx = MenuWinScrollerClass object (same as *ds:si)
es = segment of MenuWinScrollerClass
ax = message #
^lcx:dx = InputObj of window method refers to
^hbp = Window that method refers to
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
joon 3/03/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MenuWinScrollerRawUnivEnter method dynamic MenuWinScrollerClass,
MSG_META_RAW_UNIV_ENTER
mov di, offset MenuWinScrollerClass
call ObjCallSuperNoLock
call ImGetButtonState
test al, mask BI_B0_DOWN
jz done
MenuWinScrollerStartTimer label far
push ds
segmov ds, <segment idata>
mov cx, ds:[olGadgetRepeatDelay]
pop ds
mov al, TIMER_EVENT_ONE_SHOT
mov bx, ds:[LMBH_handle]
mov dx, MSG_MENU_WIN_SCROLLER_TIMER_EXPIRED
call TimerStart
mov di, ds:[si]
mov ds:[di].MWSI_timerID, ax
mov ds:[di].MWSI_timerHandle, bx
done:
ret
MenuWinScrollerRawUnivEnter endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MenuWinScrollerRawUnivLeave
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Mouse pointer left scroller window
CALLED BY: MSG_META_RAW_UNIV_LEAVE
PASS: *ds:si = MenuWinScrollerClass object
ds:di = MenuWinScrollerClass instance data
ds:bx = MenuWinScrollerClass object (same as *ds:si)
es = segment of MenuWinScrollerClass
ax = message #
^lcx:dx = InputObj of window method refers to
^hbp = Window that method refers to
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
joon 3/03/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MenuWinScrollerRawUnivLeave method dynamic MenuWinScrollerClass,
MSG_META_RAW_UNIV_LEAVE
mov di, offset MenuWinScrollerClass
call ObjCallSuperNoLock
MenuWinScrollerStopTimer label far
clr ax, bx
mov di, ds:[si]
xchg ax, ds:[di].MWSI_timerID
xchg bx, ds:[di].MWSI_timerHandle
tst bx
jz done
call TimerStop
done:
;
; update pending close
;
mov di, ds:[si]
push si
mov si, ds:[di].MWSI_menu
mov al, 0
call OLMenuWinUpdateUpDownScrollers
pop si
ret
MenuWinScrollerRawUnivLeave endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MenuWinScrollerTimerExpired
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Handle timer expired
CALLED BY: MSG_MENU_WIN_SCROLLER_TIMER_EXPIRED
PASS: *ds:si = MenuWinScrollerClass object
ds:di = MenuWinScrollerClass instance data
ds:bx = MenuWinScrollerClass object (same as *ds:si)
es = segment of MenuWinScrollerClass
ax = message #
RETURN:
DESTROYED:
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
joon 3/03/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MenuWinScrollerTimerExpired method dynamic MenuWinScrollerClass,
MSG_MENU_WIN_SCROLLER_TIMER_EXPIRED
clr ax, bx
xchg ax, ds:[di].MWSI_timerID
xchg bx, ds:[di].MWSI_timerHandle
cmp ax, bp
jne done
tst bx
jz done
call ImGetButtonState
test al, mask BI_B0_DOWN
jz done
call MenuWinScrollerScroll
call MenuWinScrollerStartTimer
done:
ret
MenuWinScrollerTimerExpired endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MenuWinScrollerExposed
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Draw
CALLED BY: MSG_META_EXPOSED
PASS: *ds:si = MenuWinScrollerClass object
ds:di = MenuWinScrollerClass instance data
ds:bx = MenuWinScrollerClass object (same as *ds:si)
es = segment of MenuWinScrollerClass
ax = message #
^hcx = Window
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
joon 3/03/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MenuWinScrollerExposed method dynamic MenuWinScrollerClass,
MSG_META_EXPOSED
mov di, cx
call GrCreateState
call GrBeginUpdate
call GrGetWinBounds
sub cx, ax
sub cx, 7
shr cx, 1
mov ax, cx
sub dx, bx
sub dx, 4
shr dx, 1
mov bx, dx
mov si, ds:[si]
mov si, ds:[si].MWSI_bitmap
segmov ds, cs
clr dx
call GrFillBitmap
call GrEndUpdate
call GrDestroyState
ret
MenuWinScrollerExposed endm
menuWinScrollerUpBitmap Bitmap <7, 4, 0, BMF_MONO>
db 00010000b
db 00111000b
db 01111100b
db 11111110b
menuWinScrollerDownBitmap Bitmap <7, 4, 0, BMF_MONO>
db 11111110b
db 01111100b
db 00111000b
db 00010000b
;
; ensure keyboard navigation item remains on-screen
;
OLMenuWinNavigate method dynamic OLMenuWinClass, MSG_SPEC_NAVIGATE_TO_NEXT_FIELD, MSG_SPEC_NAVIGATE_TO_PREVIOUS_FIELD, MSG_OL_MENU_WIN_UPDATE_SCROLLABLE_MENU
cmp ax, MSG_OL_MENU_WIN_UPDATE_SCROLLABLE_MENU
je checkAgain
mov di, offset OLMenuWinClass
call ObjCallSuperNoLock
checkAgain:
mov ax, TEMP_OL_MENU_WIN_SCROLLERS
call ObjVarFindData
jnc done ; no scrollers
mov di, ds:[si]
add di, ds:[di].Vis_offset
mov ax, ds:[di].OLWI_focusExcl.FTVMC_OD.handle
tst ax
jz done ; no focus
mov si, ds:[di].VCI_window
tst si
jz done ; no menu window
push bx ; save vardata
push si ; save window
mov bx, ax
mov si, ds:[di].OLWI_focusExcl.FTVMC_OD.chunk
mov ax, MSG_VIS_GET_BOUNDS
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; bp = top, dx = bottom
pop di ; di = window
mov bx, bp
call WinTransform
push ax, bx
movdw axbx, cxdx
call WinTransform
movdw cxdx, axbx ; dx = bottom (scr)
pop bx, ax ; ax = top (scr)
pop bx ; ds:bx = vardata
mov si, ds:[bx].MWSS_upScroller
mov di, ds:[si]
tst ds:[di].MWSI_window
jz doneUp
cmp ax, ds:[di].MWSI_bottom
jge doneUp
scrollMenu:
push si ; save scroller
call MenuWinScrollerScrollOnly ; *ds:si = menu win
pushf ; save scroll result
clr al ; update immediately
call OLMenuWinUpdateUpDownScrollers
popf ; C set if scrolled
pop si ; *ds:si = scroller
jnc done ; no scroll, done
mov di, ds:[si]
mov si, ds:[di].MWSI_menu
jmp checkAgain
doneUp:
mov si, ds:[bx].MWSS_downScroller
mov di, ds:[si]
tst ds:[di].MWSI_window
jz done
cmp dx, ds:[di].MWSI_top
jg scrollMenu
done:
ret
OLMenuWinNavigate endm
WinMethods ends
| 27.46151 | 158 | 0.655151 |
140f297379d33533c229e9beb97c57307b92a7ea | 1,827 | asm | Assembly | externals/mpir-3.0.0/mpn/x86_64w/skylake/popcount.asm | JaminChan/eos_win | c03e57151cfe152d0d3120abb13226f4df74f37e | [
"MIT"
] | 12 | 2021-09-29T14:50:06.000Z | 2022-03-31T15:01:21.000Z | externals/mpir-3.0.0/mpn/x86_64w/skylake/popcount.asm | JaminChan/eos_win | c03e57151cfe152d0d3120abb13226f4df74f37e | [
"MIT"
] | 15 | 2021-12-24T22:53:49.000Z | 2021-12-25T10:03:13.000Z | LibSource/mpir/mpn/x86_64w/skylake/popcount.asm | ekzyis/CrypTool-2 | 1af234b4f74486fbfeb3b3c49228cc36533a8c89 | [
"Apache-2.0"
] | 10 | 2021-10-17T19:46:51.000Z | 2022-03-18T02:57:57.000Z | ; PROLOGUE(mpn_popcount)
; AMD64 mpn_popcount
; Copyright 2009 Jason Moxham
; This file is part of the MPIR Library.
; The MPIR Library is free software; you can redistribute it and/or modify
; it under the terms of the GNU Lesser General Public License as published
; by the Free Software Foundation; either verdxon 2.1 of the License, or (at
; your option) any later verdxon.
; The MPIR Library is distributed in the hope that it will be useful, but
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
; License for more details.
; You should have received a copy of the GNU Lesser General Public License
; along with the MPIR Library; see the file COPYING.LIB. If not, write
; to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
; Boston, MA 02110-1301, USA.
; mpn_limb_t mpn_popcount(mp_ptr,mp_size_t)
; rax rdi, rsi
; eax rcx, rdx
%include 'yasm_mac.inc'
CPU nehalem
BITS 64
LEAF_PROC mpn_popcount
mov r8, 5
lea rcx, [rcx+rdx*8-40]
xor eax, eax
sub r8, rdx
jnc .1
xalign 16
.0:
popcnt r9, [rcx+r8*8]
popcnt r10, [rcx+r8*8+8]
popcnt r11, [rcx+r8*8+16]
popcnt rdx, [rcx+r8*8+24]
add rax, r9
add rax, rdx
add rax, r10
popcnt r9, [rcx+r8*8+32]
popcnt r10, [rcx+r8*8+40]
add rax, r9
add rax, r11
add rax, r10
add r8, 6
jnc .0
.1:
lea rdx, [rel .2]
lea r8, [r8+r8*8]
add rdx, r8
jmp rdx
.2:
nop
popcnt r9, [rcx]
add rax, r9
.3:
popcnt r10, [rcx+8]
add rax, r10
.4: popcnt r11, [rcx+16]
add rax, r11
.5: popcnt rdx, [rcx+24]
add rax, rdx
.6: popcnt r9, [rcx+32]
add rax, r9
.7: ret
end
| 25.732394 | 77 | 0.634921 |
52a3afb7576d1baa6be3a65a8f568d5ca4592018 | 50,158 | asm | Assembly | Driver/Video/Dumb/VidMem/CMYK/cmykColorRaster.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 504 | 2018-11-18T03:35:53.000Z | 2022-03-29T01:02:51.000Z | Driver/Video/Dumb/VidMem/CMYK/cmykColorRaster.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 96 | 2018-11-19T21:06:50.000Z | 2022-03-06T10:26:48.000Z | Driver/Video/Dumb/VidMem/CMYK/cmykColorRaster.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 73 | 2018-11-19T20:46:53.000Z | 2022-03-29T00:59:26.000Z | COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1991 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: VidMem video driver
FILE: cmykColorRaster.asm
AUTHOR: Jim DeFrisco, Mar 4, 1992
ROUTINES:
Name Description
---- -----------
INT PutColor24Mask Write a 24-bit/pixel scan line
INT PutColor24 Write a 24-bit/pixel scan line
INT WriteClr24Byte Build and write a 24-bit/pixel byte to all
4 CMYK planes
INT PutColor8Mask Write a 8-bit/pixel scan line
INT PutColor8 Write a 8-bit/pixel scan line
INT WriteClr8Byte Build and write a 8-bit/pixel byte to all 4
CMYK planes
INT PutColor4Mask Write a 4-bit/pixel scan line
INT PutColor4 Write a 4-bit/pixel scan line
INT WriteClr4Byte Build and write a 4-bit/pixel byte to all 4
CMYK planes
INT PickDitherBits Given a bit mask and the dither matrices
setup, set the appropriate bits in the
output plane bytes
INT SetDitherIndex Setup the "current" dither, given a color
index
INT SetDitherRGB Set new bitmap color, pass it an RGB value
(used for 24-bit)
INT CalcCacheEntry Calculate the dither offsets for the cache
entry
INT CopyShiftCyan Copy a cyan/magenta dither matrix and shift
it
INT CopyShiftBlack Copy and shift a black dither matrix
REVISION HISTORY:
Name Date Description
---- ---- -----------
Jim 3/ 4/92 Initial revision
DESCRIPTION:
Color bitmap routines for CMYK module
$Id: cmykColorRaster.asm,v 1.1 97/04/18 11:43:05 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VidSegment ClrBitmap
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PutColor24Mask
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Write a 24-bit/pixel scan line
CALLED BY: PutBitsSimple
PASS: ds:si - pointer into bitmap data
es:di - pointer into frame buffer
plus - all kinds of nice things setup by PutLineSetup
RETURN: nothing
DESTROYED: all
PSEUDO CODE/STRATEGY:
we have a bitmap mask, and a user-specified draw mask
KNOWN BUGS/SIDE EFFECTS/IDEAS:
register usage:
ds:si - points to bitmap picture data
ds:bx - points to bitmap mask data
es:di - points into frame buffer
ax - scratch registerr
ch - mask for bit that we are working on
cl - #bit shifts for mask
dh - mask shift out bits
bp - #bytes to do
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 3/ 2/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PutColor24Mask proc far
uses bp
.enter
; intialize some of our dither stuff
mov cs:[colorWriteByte], offset WriteClr24Byte
InitDitherIndex <ss:[yellowBase]>
; since there is a mask, compute where it is...
mov bx, si ; ds:bx -> picture data
sub bx, ss:[bmMaskSize] ; ds:bx -> mask data
; next, calculate the offsets into the source and destination
; scan lines.
mov cl, 3 ; dividing by 8 for msk
mov ax, ss:[bmLeft] ; get left side
mov bp, ax ; dx = #bits into image
sub bp, ss:[d_x1] ; get left bm coord
shr ax, cl ; ax = #bytes to left
add di, ax ; es:di -> left byte
add si, bp ; ds:si -> left bm byte
shl bp, 1 ; 3 bytes/pixel
add si, bp
shr bp, 1 ; divide by 8 for mask
shr bp, 1 ; shift over for mask
shr bp, 1
shr bp, 1 ; continue divide for
add bx, bp ; index into mask
mov bp, ss:[bmRight] ; need #bytes wide
shr bp, cl ; bp = #bytes to right
sub bp, ax ; bp=#bytes - 1
jmp colorMaskCommon
.leave .UNREACHED
PutColor24Mask endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PutColor24
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Write a 24-bit/pixel scan line
CALLED BY: PutBitsSimple
PASS: ds:si - pointer into bitmap data
es:di - pointer into frame buffer
plus - all kinds of nice things setup by PutLineSetup
RETURN: nothing
DESTROYED: all
PSEUDO CODE/STRATEGY:
we don't have a bitmap mask, just a user-specified draw mask
KNOWN BUGS/SIDE EFFECTS/IDEAS:
register usage:
ds:si - points to bitmap picture data
es:di - points into frame buffer
ax - scratch registerr
ch - mask for bit that we are working on
bx - #bytes to do
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 3/ 2/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PutColor24 proc far
.enter
; intialize some of our dither stuff
mov cs:[colorWriteByte], offset WriteClr24Byte
InitDitherIndex <ss:[yellowBase]>
; next, calculate the offsets into the source and destination
; scan lines.
mov cl, 3 ; dividing by 8 for msk
mov ax, ss:[bmLeft] ; get left side
mov bp, ax ; dx = #bits into image
sub bp, ss:[d_x1] ; get left bm coord
shr ax, cl ; ax = #bytes to left
add di, ax ; es:di -> left byte
add si, bp ; ds:si -> left bm byte
shl bp, 1 ; 3 bytes/pixel
add si, bp
mov bx, ss:[bmRight] ; need #bytes wide
shr bx, cl ; bp = #bytes to right
sub bx, ax ; bp=#bytes - 1
GOTO colorCommon
.leave .UNREACHED
PutColor24 endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
WriteClr24Byte
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Build and write a 24-bit/pixel byte to all 4 CMYK planes
CALLED BY: INTERNAL
PutColor8Mask, PutColor8
PASS: al - mask to use
ch - bit mask for bit to start on
(pass 80h to build the whole byte)
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
for each bit that is set in the mask:
setup the dither matrices for that color;
set the appropriate pixels in the output bytes;
write the byte;
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 3/ 5/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
WriteClr24Byte proc near
; we need some room to work, so save a few values that we
; won't be using here.
push bx, bp ; save mask ptr, byte count
xchg ch, dh ; dh = single bit mask
push cx ; save shift, xtra mask bits
push di ; need another register
; ds:si - bitmap data
; dh - single bit mask
; bl - yellow; bh - cyan; cl - magenta; ch - black
; bp - copy of byte mask
mov bp, ax ; save copy
clr cx ; init color bytes
clr bx
; start processing picture bytes
pixelLoop:
lodsw ; get next data byte
mov di, ax
lodsb
mov ah, al ; RGB in cl,ch,ah
xchg bp, cx ; get mask in cl
mov ch, cl ; make copy of byte mask
and ch, dh ; see if need to do this pixel
xchg bp, cx ; restore magenta/black
jz nextPixel
xchg di, cx
call SetDitherRGB ; make sure color is OK
xchg di, cx
call PickDitherBits ; set the appropriate bits
nextPixel:
shr dh, 1
jnc pixelLoop
; done with byte. Store flag for next time and write byte
pop di ; restore dest ptr
mov ax, bp ; al = byte mask
mov ah, al
mov al, bl ; do yellow
mov bp, di ; save di
call ss:[modeRoutine]
mov al, bh ; do cyan
mov bx, ss:[bm_bpMask] ; get offset to next plane
add di, bx
call ss:[modeRoutine]
add di, bx
mov al, cl ; do magenta
call ss:[modeRoutine]
add di, bx
mov al, ch ; do black
call ss:[modeRoutine]
mov di, bp ; restore original ptr
inc di
pop cx
xchg ch, dh
BumpDitherIndex ; set indices for next byte
pop bx, bp
ret
WriteClr24Byte endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PutColor8Mask
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Write a 8-bit/pixel scan line
CALLED BY: PutBitsSimple
PASS: ds:si - pointer into bitmap data
es:di - pointer into frame buffer
plus - all kinds of nice things setup by PutLineSetup
RETURN: nothing
DESTROYED: all
PSEUDO CODE/STRATEGY:
we have a bitmap mask, and a user-specified draw mask
KNOWN BUGS/SIDE EFFECTS/IDEAS:
register usage:
ds:si - points to bitmap picture data
ds:bx - points to bitmap mask data
es:di - points into frame buffer
ax - scratch registerr
ch - mask for bit that we are working on
cl - #bit shifts for mask
dh - mask shift out bits
bp - #bytes to do
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 3/ 2/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PutColor8Mask proc far
uses bp
.enter
; intialize some of our dither stuff
mov cs:[colorWriteByte], offset WriteClr8Byte
InitDitherIndex <ss:[yellowBase]>
; since there is a mask, compute where it is...
mov bx, si ; ds:bx -> picture data
sub bx, ss:[bmMaskSize] ; ds:bx -> mask data
; next, calculate the offsets into the source and destination
; scan lines.
mov cl, 3 ; dividing by 8 for msk
mov ax, ss:[bmLeft] ; get left side
mov bp, ax ; dx = #bits into image
sub bp, ss:[d_x1] ; get left bm coord
shr ax, cl ; ax = #bytes to left
add di, ax ; es:di -> left byte
add si, bp ; ds:si -> left bm byte
shr bp, 1 ; shift over for mask
shr bp, 1
shr bp, 1 ; continue divide for
add bx, bp ; index into mask
mov bp, ss:[bmRight] ; need #bytes wide
shr bp, cl ; bp = #bytes to right
sub bp, ax ; bp=#bytes - 1
jmp colorMaskCommon
.leave .UNREACHED
PutColor8Mask endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PutColor8
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Write a 8-bit/pixel scan line
CALLED BY: PutBitsSimple
PASS: ds:si - pointer into bitmap data
es:di - pointer into frame buffer
plus - all kinds of nice things setup by PutLineSetup
RETURN: nothing
DESTROYED: all
PSEUDO CODE/STRATEGY:
we don't have a bitmap mask, but we have can a user-specified
draw mask
KNOWN BUGS/SIDE EFFECTS/IDEAS:
register usage:
ds:si - points to bitmap picture data
es:di - points into frame buffer
ax - scratch registerr
ch - mask for bit that we are working on
bx - #bytes to do
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 3/ 2/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PutColor8 proc far
.enter
; intialize some of our dither stuff
mov cs:[colorWriteByte], offset WriteClr8Byte
InitDitherIndex <ss:[yellowBase]>
; next, calculate the offsets into the source and destination
; scan lines.
mov cl, 3 ; dividing by 8 for msk
mov ax, ss:[bmLeft] ; get left side
mov bp, ax
sub bp, ss:[d_x1] ; get left bm coord
shr ax, cl ; ax = #bytes to left
add di, ax ; es:di -> left byte
add si, bp ; ds:si -> left bm byte
mov bx, ss:[bmRight] ; need #bytes wide
shr bx, cl ; bp = #bytes to right
sub bx, ax ; bp=#bytes - 1
GOTO colorCommon
.leave .UNREACHED
PutColor8 endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
WriteClr8Byte
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Build and write a 8-bit/pixel byte to all 4 CMYK planes
CALLED BY: INTERNAL
PutColor8Mask, PutColor8
PASS: al - mask to use
ch - bit mask for bit to start on
(pass 80h to build the whole byte)
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
for each bit that is set in the mask:
setup the dither matrices for that color;
set the appropriate pixels in the output bytes;
write the byte;
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 3/ 5/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
WriteClr8Byte proc near
; we need some room to work, so save a few values that we
; won't be using here.
push bx, bp ; save mask ptr, byte count
xchg ch, dh ; dh = single bit mask
push cx ; save shift, xtra mask bits
; ds:si - bitmap data
; dh - single bit mask
; bl - yellow; bh - cyan; cl - magenta; ch - black
; bp - copy of byte mask
mov bp, ax ; save copy
clr cx ; init color bytes
clr bx
; start processing picture bytes
pixelLoop:
lodsb ; get next data byte
xchg bp, cx ; get mask in cl
mov ch, cl ; make copy of byte mask
and ch, dh ; see if need to do this pixel
xchg bp, cx ; restore magenta/black
jz nextPixel
call SetDitherIndex ; make sure color is OK
call PickDitherBits ; set the appropriate bits
nextPixel:
shr dh, 1
jnc pixelLoop
; done with byte. Store flag for next time and write byte
mov ax, bp ; al = byte mask
mov ah, al
mov al, bl ; do yellow
mov bp, di ; save di
call ss:[modeRoutine]
mov al, bh ; do cyan
mov bx, ss:[bm_bpMask] ; get offset to next plane
add di, bx
call ss:[modeRoutine]
add di, bx
mov al, cl ; do magenta
call ss:[modeRoutine]
add di, bx
mov al, ch ; do black
call ss:[modeRoutine]
mov di, bp ; restore original ptr
inc di
pop cx
xchg ch, dh
BumpDitherIndex ; set indices for next byte
pop bx, bp
ret
WriteClr8Byte endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PutColor4Mask
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Write a 4-bit/pixel scan line
CALLED BY: PutBitsSimple
PASS: ds:si - pointer into bitmap data
es:di - pointer into frame buffer
plus - all kinds of nice things setup by PutLineSetup
RETURN: nothing
DESTROYED: all
PSEUDO CODE/STRATEGY:
we have a bitmap mask, and a user-specified draw mask
KNOWN BUGS/SIDE EFFECTS/IDEAS:
register usage:
ds:si - points to bitmap picture data
ds:bx - points to bitmap mask data
es:di - points into frame buffer
ax - scratch registerr
ch - mask for bit that we are working on
cl - #bit shifts for mask
dh - mask shift out bits
dl - picture shift out bits
bp - #bytes to do
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 3/ 2/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PutColor4Mask proc far
uses bp
.enter
; intialize some of our dither stuff
mov cs:[colorWriteByte], offset WriteClr4Byte
InitDitherIndex <ss:[yellowBase]>
; since there is a mask, compute where it is...
mov bx, si ; ds:bx -> picture data
sub bx, ss:[bmMaskSize] ; ds:bx -> mask data
; next, calculate the offsets into the source and destination
; scan lines.
mov cl, 3 ; dividing by 8 for msk
mov ax, ss:[bmLeft] ; get left side
mov bp, ax
sub bp, ss:[d_x1] ; get left bm coord
shr ax, cl ; ax = #bytes to left
add di, ax ; es:di -> left byte
mov cs:[oddOrEven], READ4_LOAD_NEW_PIXEL
mov dx, bp ; save low bit
shr bp, 1 ; dx = #bytes into bm
add si, bp ; ds:si -> left bm byte
test dx, 1 ; if low bit is set...
mov dl, 0
jz oddEvenSettled
mov cx, ax ; save x value
lodsb ; get first data value
and al, 0xf ; need 2nd pixel
mov dl, al ; store it
mov cs:[oddOrEven], READ4_HAVE_ONE_PIXEL
mov ax, cx ; restore x value
mov cl, 3 ; reload shift count
oddEvenSettled:
shr bp, 1
shr bp, 1 ; continue divide for
add bx, bp ; index into mask
mov bp, ss:[bmRight] ; need #bytes wide
shr bp, cl ; bp = #bytes to right
sub bp, ax ; bp=#bytes - 1
; figure mask for starting pixel
colorMaskCommon label far
mov cl, ss:[bmLeft].low
and cl, 7
mov ch, 80h ; shift bit into right
shr ch, cl ; position
; check preload bit, and preload mask data if needed
clr dh
mov cl, ss:[bmShift] ; load shift amount
tst ss:[bmPreload] ; if we need to preload
jns preloadDone
mov al, ds:[bx-1] ; do mask byte
clr ah
ror ax, cl
mov dh, ah ; save shift out bits
; LEFT SIDE
; do mask first, then get picture data
preloadDone:
mov al, ds:[bx] ; do mask from bitmap
inc bx
clr ah
ror ax, cl
or al, dh ; combine from preload
mov dh, ah ; save new shift out
and al, ss:[bmLMask] ; do mask thing
and al, ss:[lineMask] ; combine user mask
; see if we're doing a narrow band. If so, combine left and
; right sides to do the single byte
tst bp ; if zero, only 1 byte
jz narrowBM ; yep, do it small
call cs:[colorWriteByte]
; MIDDLE BYTES
; check if we need to do any first
dec bp
jz doRightSide
midLoop:
mov al, ds:[bx] ; next mask byte
inc bx
clr ah
ror ax, cl
or al, dh
and al, ss:[lineMask]
mov dh, ah
mov ch, 80h ; start at left pixel
call cs:[colorWriteByte]
dec bp
jnz midLoop
; RIGHT SIDE
doRightSide:
mov al, ds:[bx] ; next mask byte
inc bx
clr ah
ror ax, cl
or al, dh
and al, ss:[lineMask]
and al, ss:[bmRMask]
mov dh, ah
mov ch, 80h ; start at left pixel
doLastByte:
call cs:[colorWriteByte]
.leave
ret
; bitmap is only a byte wide. Combine left/right masks
narrowBM:
and al, ss:[bmRMask]
jmp doLastByte
PutColor4Mask endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PutColor4
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Write a 4-bit/pixel scan line
CALLED BY: PutBitsSimple
PASS: ds:si - pointer into bitmap data
es:di - pointer into frame buffer
plus - all kinds of nice things setup by PutLineSetup
RETURN: nothing
DESTROYED: all
PSEUDO CODE/STRATEGY:
we can have a user-specified draw mask
KNOWN BUGS/SIDE EFFECTS/IDEAS:
register usage:
ds:si - points to bitmap picture data
es:di - points into frame buffer
ax - scratch registerr
ch - mask for bit that we are working on
dl - picture shift out bits
cx - #bytes to do
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 3/ 2/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PutColor4 proc far
.enter
; intialize some of our dither stuff
mov cs:[colorWriteByte], offset WriteClr4Byte
InitDitherIndex <ss:[yellowBase]>
; calculate the offsets into the source and destination
; scan lines.
mov cl, 3 ; dividing by 8 for msk
mov ax, ss:[bmLeft] ; get left side
mov bx, ax ; bx = #bits into image
sub bx, ss:[d_x1] ; get left bm coord
shr ax, cl ; ax = #bytes to left
add di, ax ; es:di -> left byte
mov cs:[oddOrEven], READ4_LOAD_NEW_PIXEL
mov dx, bx ; save low bit
shr bx, 1 ; bx = #bytes into bm
add si, bx ; ds:si -> left bm byte
test dx, 1 ; if low bit is set...
mov dl, 0
jz oddEvenSettled
mov cx, ax ; save x1 value
lodsb ; get first data value
and al, 0xf ; need 2nd pixel
mov dl, al ; store it
mov cs:[oddOrEven], READ4_HAVE_ONE_PIXEL
mov ax, cx
mov cl, 3 ; reload shift count
oddEvenSettled:
mov bx, ss:[bmRight] ; need #bytes wide
shr bx, cl ; bx = #bytes to right
sub bx, ax ; bx=#bytes - 1
; figure mask for starting pixel
colorCommon label far
mov cl, ss:[bmLeft].low
and cl, 7
mov ch, 80h ; shift bit into right
shr ch, cl ; position
; LEFT SIDE
; no mask, just get picture data
mov al, ss:[bmLMask] ; do mask thing
and al, ss:[lineMask] ; combine user mask
; see if we're doing a narrow band. If so, combine left and
; right sides to do the single byte
tst bx
jz narrowBM ; yep, do it small
call cs:[colorWriteByte]
; MIDDLE BYTES
; check if we need to do any first
dec bx
jz doRightSide
midLoop:
mov al, ss:[lineMask]
mov ch, 80h ; start at left pixel
call cs:[colorWriteByte]
dec bx
jnz midLoop
; RIGHT SIDE
doRightSide:
mov al, ss:[lineMask]
and al, ss:[bmRMask]
mov ch, 80h ; start at left pixel
doLastByte:
call cs:[colorWriteByte]
.leave
ret
; bitmap is only a byte wide. Combine left/right masks
narrowBM:
and al, ss:[bmRMask]
jmp doLastByte
PutColor4 endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
WriteClr4Byte
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Build and write a 4-bit/pixel byte to all 4 CMYK planes
CALLED BY: INTERNAL
PutColor4Mask, PutColor4
PASS: al - mask to use
ch - bit mask for bit to start on
(pass 80h to build the whole byte)
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
for each bit that is set in the mask:
setup the dither matrices for that color;
set the appropriate pixels in the output bytes;
write the byte;
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 3/ 5/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
; one of the following is stored below
READ4_LOAD_NEW_PIXEL equ 0xf9 ; opcode for stc
READ4_HAVE_ONE_PIXEL equ 0xf8 ; opcode for clc
WriteClr4Byte proc near
; we need some room to work, so save a few values that we
; won't be using here.
push bx, bp ; save mask ptr, byte count
xchg ch, dh ; dh = single bit mask
push cx ; save shift, xtra mask bits
; ds:si - bitmap data
; dh - single bit mask
; dl - xtra data pixel
; bl - yellow; bh - cyan; cl - magenta; ch - black
; bp - copy of byte mask
mov bp, ax ; save copy
clr cx ; init color bytes
clr bx
; this jump is modified depending on if we have a pixel loaded
; in dl already or if we need to load more from the bitmap.
oddOrEven equ (this byte)
stc ; alternates between set and
jc loadMoreData ; clear
doStoredPixel:
mov al, dl ; set color dithers
xchg bp, cx ; get mask in cl
mov ch, cl ; make copy of byte mask
and ch, dh ; see if need to do this pixel
xchg bp, cx ; restore magenta/black
jz nextPixelOdd
call SetDitherIndex ; load up dither if needed
call PickDitherBits
nextPixelOdd:
shr dh, 1 ; onto next pixel
LONG jc finishedLoad ; if we hit the end...
loadMoreData:
lodsb ; get next data byte
mov ah, al ; make it two pixels
and ah, 0xf ; isolate right pixel
shr al, 1 ; shift down left pixel
shr al, 1
shr al, 1
shr al, 1
mov dl, ah ; save right pixel for next...
xchg bp, cx ; get mask in cl
mov ch, cl ; make copy of byte mask
and ch, dh ; see if need to do this pixel
xchg bp, cx ; restore magenta/black
jz nextPixelEven
call SetDitherIndex ; make sure color is OK
call PickDitherBits ; set the appropriate bits
nextPixelEven:
shr dh, 1
jnc doStoredPixel
; done with byte. Store flag for next time and write byte
mov cs:[oddOrEven], READ4_HAVE_ONE_PIXEL
writeBytes:
mov ax, bp ; al = byte mask
mov ah, al
mov al, bl ; do yellow
mov bp, di ; save di
call ss:[modeRoutine]
mov al, bh ; do cyan
mov bx, ss:[bm_bpMask] ; get offset to next plane
add di, bx
call ss:[modeRoutine]
add di, bx
mov al, cl ; do magenta
call ss:[modeRoutine]
add di, bx
mov al, ch ; do black
call ss:[modeRoutine]
mov di, bp ; restore original ptr
inc di
pop cx
xchg ch, dh
BumpDitherIndex ; set indices for next byte
pop bx, bp
ret
; done with this pixel. Set flag for next entry and write..
finishedLoad:
mov cs:[oddOrEven], READ4_LOAD_NEW_PIXEL
jmp writeBytes
WriteClr4Byte endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PickDitherBits
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Given a bit mask and the dither matrices setup, set
the appropriate bits in the output plane bytes
CALLED BY: WriteClr4Byte
PASS: current color setup up (for dithers)
dh - one bit set for pixel we're doing
bl,bh - yellow,cyan bytes
cl,ch - magenta,black bytes
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 3/ 6/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PickDitherBits proc near
curYellow equ (this word) + 2
mov al, cs:[1234h] ; grab yellow dither byte
and al, dh ; isolate bit
or bl, al ; accumulate yellow bits
curCyan equ (this word) + 2
mov al, cs:[1234h] ; grab cyan dither byte
and al, dh
or bh, al
curMagenta equ (this word) + 2
mov al, cs:[1234h] ; grab magenta dither byte
and al, dh
or cl, al
curBlack equ (this word) + 2
mov al, cs:[1234h] ; grab black dither byte
and al, dh
or ch, al
ret
PickDitherBits endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ModeRoutines
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Routines to combine pixel data with screen content
CALLED BY: INTERNAL
WriteClr4Byte, WriteClr8Byte, WriteClr24Byte
PASS: es:[di] - points at frame buffer byte
al - data to store
ah - mask to use
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 3/ 4/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CMYKCOPY label near
and al, ah ; isolate bits
not ah
and es:[di], ah
not ah
or es:[di], al
CMYKNOP label near
retn
CMYKCLEAR label near
mov al, ah
and al, byte ptr ss:[resetColor]
not ah
and es:[di], ah
not ah
or es:[di], al
retn
CMYKAND label near
and al, ah
not ah
or al, ah
not ah
and es:[di], al
retn
CMYKINV label near
xor es:[di], ah
retn
CMYKXOR label near
and al, ah
xor es:[di], al
retn
CMYKSET label near
not ah
and es:[di], ah
not ah
and al, byte ptr ss:[setColor]
or es:[di], al
retn
CMYKOR label near ; screenv(data^mask^pattern)
and al, ah
or es:[di], al
retn
CMYKModeRout label word
nptr CMYKCLEAR
nptr CMYKCOPY
nptr CMYKNOP
nptr CMYKAND
nptr CMYKINV
nptr CMYKXOR
nptr CMYKSET
nptr CMYKOR
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SetDitherIndex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Setup the "current" dither, given a color index
CALLED BY: Color bitmap drawing routines
PASS: al - color to set
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
check to see if the desired color is in the cache;
if so, make it the current one;
if not, throw out the least recently used entry and calculate
the new value;
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 3/ 3/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MAX_USAGE_COUNT equ 0x7fff
SetDitherIndex proc near
uses bx, si
.enter
; first see if we're doing the same color
mov bx, cs:[curCacheEntry]
tst bx ; check for uninit table
jz findNewIndex
cmp al, cs:[bx].CCE_color
jne findNewIndex
mov si, bx
call SetDitherPointers ; setup indices into dithers
done:
inc cs:[bx].CCE_usage
.leave
ret
checkBogus:
tst cs:[si].CCE_usage ; if bogus, continue
jns foundIt
jmp nextEntry ; bogus, keep looking
; check the cache for the color we want
findNewIndex:
push cx, dx, ax
mov si, offset cs:colorCache
mov bx, si
tst cs:[curCacheEntry] ; if not init, go dir to fillit
jz haveEmptySlot
mov cx, length colorCache
mov dx, MAX_USAGE_COUNT
searchLoop:
cmp al, cs:[si].CCE_color
je checkBogus ; make sure valid entry
cmp dx, cs:[si].CCE_usage ; found new most-unpopular ?
jl nextEntry ; no, continue
mov bx, si ; save entry as least used
mov dx, cs:[si].CCE_usage
tst dx ; if negative, bogus entry
js haveEmptySlot
nextEntry:
add si, size ColorCacheEntry
loop searchLoop
; didn't find it in the cache, have pointer to one to get
; rid of.
haveEmptySlot:
mov si, bx
mov cs:[si].CCE_color, al
mov bl, al
clr bh
shl bx, 1 ; * 2
add bl, al
adc bh, 0 ; index into palette
push ds
lds dx, ss:[bmPalette]
xchg dx, si
mov cx, {word} ds:[si][bx].RGB_red
xchg dx, si
mov {word} cs:[si].CCE_rgb.RGB_red, cx
xchg dx, si
mov ah, ds:[si][bx].RGB_blue
xchg dx, si
mov cs:[si].CCE_rgb.RGB_blue, ah
pop ds
clr cs:[si].CCE_usage
; now calculate the CMYK dither offsets.
call CalcCacheEntry
; entry all set, cs:si -> entry. Set current offsets
foundIt:
call SetDitherPointers
pop cx, dx, ax
jmp done
SetDitherIndex endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SetDitherPointers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Setup the dither pointers based on current indices.
CALLED BY: INTERNAL
SetDitherIndex
PASS: cs:[si] - points at ColorCacheEntry structure
RETURN: cs:[bx] - points at ColorCacheEntry
DESTROYED: ax
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 9/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SetDitherPointers proc near
.enter
mov ax, cs:[si].CCE_dither ; get dither pointer
mov bx, ss:[yellowBase]
add bx, ax
mov cs:[curYellow], bx
mov bx, ss:[cyanBase]
add bx, CYAN_OFFSET
add bl, ss:[cyanIndex]
adc bh, 0
add bx, ax
mov cs:[curCyan], bx
add bx, MAGENTA_OFFSET-CYAN_OFFSET
mov cs:[curMagenta], bx
mov bx, ss:[blackBase]
add bl, ss:[blackIndex]
adc bh, 0
add bx, BLACK_OFFSET
add ax, bx
mov cs:[curBlack], ax
mov cs:[curCacheEntry], si ; record for next time
mov bx, si ; pass on index
.leave
ret
SetDitherPointers endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SetDitherRGB
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set new bitmap color, pass it an RGB value (used for 24-bit)
CALLED BY: INTERNAL
PutColor24Scan
PASS: cl - red
ch - green
ah - blue
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 3/ 3/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SetDitherRGB proc near
uses bx, si
.enter
; first see if we're doing the same color
mov bx, cs:[curCacheEntry]
tst bx ; if no entries
jz findNewIndex
cmp cx, {word} cs:[bx].CCE_rgb.RGB_red
jne findNewIndex
cmp ah, cs:[bx].CCE_rgb.RGB_blue
jne findNewIndex
mov si, bx
call SetDitherPointers
done:
inc cs:[bx].CCE_usage
.leave
ret
; check the cache for the color we want
findNewIndex:
push di, cx, dx, ax
mov si, offset cs:colorCache
mov bx, si
mov di, cx ; save red/green here
mov cx, length colorCache
mov dx, MAX_USAGE_COUNT ; start at max
searchLoop:
cmp di, {word} cs:[si].CCE_rgb.RGB_red
je foundIt
cmp ah, cs:[si].CCE_rgb.RGB_blue
je foundIt
cmp dx, cs:[si].CCE_usage
jl nextEntry
mov bx, si ; save entry as least used
mov dx, cs:[si].CCE_usage
tst dx ; if negative, then invalide
js haveEmptySlot
nextEntry:
add si, size ColorCacheEntry
loop searchLoop
; didn't find it in the cache, have pointer to one to get
; rid of.
haveEmptySlot:
mov si, bx
mov {word} cs:[si].CCE_rgb.RGB_red, di
mov cs:[si].CCE_rgb.RGB_blue, ah
clr cs:[si].CCE_usage
; now calculate the CMYK dither offsets.
call CalcCacheEntry
; entry all set, cs:si -> entry. Set current offsets
foundIt:
call SetDitherPointers
pop di, cx, dx, ax
jmp done
SetDitherRGB endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CalcCacheEntry
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Calculate the dither offsets for the cache entry
CALLED BY: SetDither{Index,RGB}
PASS: cs:si - points to ColorCacheEntry
cl - red
ch - green
ah - blue
RETURN: nothing
DESTROYED: ax,bx,cx, dx
PSEUDO CODE/STRATEGY:
calculate the offsets into the CMYKDither resource to the
dithers for the passed color, and set the cache entry.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 3/ 3/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CalcCacheEntry proc near
uses ds,es,si,di
cyanBlack local word
magentaYellow local word
.enter
; There may be some color correction table stored in the
; printer driver. If so, fetch it and do the correction.
; no correction needed for black or white. Handle those
; specially to avoid the pain of interpolation.
tst ss:colorTransferSeg ; if table non-zero...
jz convertToCMYK
; don't color correct black, except if we are on a CMY printer
; (no black ribbon).
mov al, ss:[bm_cacheType]
and al, mask BMT_FORMAT
cmp al, BMF_3CMY ; do UC removal ?
LONG je doColorTransfer
tst cx
LONG jnz doColorTransfer
tst ah
LONG jnz doColorTransfer
convertToCMYK:
mov al, 255
mov bh, al
mov bl, al
sub al, cl
sub bl, ch
sub bh, ah
mov ah, ss:[bm_cacheType]
and ah, mask BMT_FORMAT
cmp ah, BMF_3CMY ; do UC removal ?
mov ah, 0 ; don't use CLR
je haveK
mov ah, al ; assume red is min
cmp bl, ah ; find minimum
ja tryBlue
mov ah, bl
tryBlue:
cmp bh, ah
ja haveK
mov ah, bh
; do undercolor removal
haveK:
sub al, ah ; al = new cyan
sub bl, ah ; bl = new magenta
sub bh, ah ; bh = new yellow
mov cyanBlack, ax ; save results
mov magentaYellow, bx
; OK, we have valid CMYK values. Do the dither lookup.
mov ds, ss:colorDitherSeg ; ds -> dither resrce
segmov es, cs, di ; es -> our dithers
mov di, es:[si].CCE_dither ; get ptr to buffer
assume ds:CMYKDither
mov dx, ss:[resetColor] ; xor with this
mov cl, ss:[ditherRotX] ; need to rotate them
clr bh
mov bl, magentaYellow.high ; get yellow value
shr bx, 1
shr bx, 1
shr bx, 1
adc bx, 0 ; round up
shl bx, 1 ; word table
mov si, ds:[ditherYellow][bx] ; get offset to dither
lodsb ; just do all four
ror al, cl ; bytes inline.
stosb
lodsb
ror al, cl
stosb
lodsb
ror al, cl
stosb
lodsb
ror al, cl
stosb
clr bh
mov bl, cyanBlack.low ; get cyan value
shr bx, 1
shr bx, 1
shr bx, 1
adc bx, 0 ; round up
shl bx, 1 ; word table
mov si, ds:[ditherCyan][bx] ; get offset to dither
call CopyShiftCyan
clr bh
mov bl, magentaYellow.low ; get magenta value
shr bx, 1
shr bx, 1
shr bx, 1
adc bx, 0 ; round up
shl bx, 1 ; word table
mov si, ds:[ditherMagenta][bx] ; get offset to dither
call CopyShiftCyan
clr bh
mov bl, cyanBlack.high ; get black value
shr bx, 1
shr bx, 1
shr bx, 1
adc bx, 0 ; round up
shl bx, 1 ; word table
mov si, ds:[ditherBlack][bx] ; get offset to dither
call CopyShiftBlack
.leave
ret
assume ds:nothing
;---------------------------------------
; Color Correction Code
;---------------------------------------
; there are color transfer tables defined. use them.
; cl, ch, ah = red, green, blue components
doColorTransfer:
cmp cx, 0xffff ; check white
jne doTransfer
cmp ah, 0xff ; if done, go
LONG je convertToCMYK
if _INDEX_RGB_CORRECTION ;16 RGB value palette.....
;added for systems that only use 16 colors ....ever....
;DJD 6/14/95
doTransfer:
push di,si,bp ;save stuff
;Entry:
;cl = red
;ch = green
;ah = blue
;
; We want to obtain any exact match for the RGB triple that may
; exist. we look at the incoming triples for a match to the VGA
; palette triples.
clr bh
;
; Do blue first
;
mov bl, ah
and bl, 0x03
cmp ah, cs:[validRGBTable2][bx]
jne slowWay
mov dl, bl ; else accumulate bits in DL
;
; Now work on the green
;
mov bl, ch
and bl, 0x03
cmp ch, cs:[validRGBTable2][bx]
jne slowWay
shl dl
shl dl
or dl, bl ; accumulate bits in DL
;
; Finally do the red
;
mov bl, cl
and bl, 0x03
cmp cl, cs:[validRGBTable2][bx]
jne slowWay
shl dl
shl dl
or bl, dl ; accumulate bits in BL
;
; Look up our index value
;
mov al, cs:[colorRGBIndexTable2][bx]
cmp al, 0xff ; not a standard color
je slowWay
clr ah ;Get the index into
mov bp,ax ;BP, and
jmp getTransfer ;start the lookup for the new triple
slowWay:
;Entry:
;cl = red
;ch = green
;ah = blue
;
; We want to obtain the closest match to the passed RGB triple
; contained in the standard VGA pallette. We simply choose the
; closest sum of the RGB values
mov di,16000 ;initialize to something big.
mov si,15 ;check 16 VGA values
getRGBDifference:
mov bl,cs:redTable2.[si]
mov bh,cs:greenTable2.[si]
mov dl,cs:blueTable2.[si]
sub bl,cl ;get red difference.
jnc getGreenDiff ;if no neg result
neg bl
getGreenDiff:
sub bh,ch ;get green difference.
jnc getBlueDiff
neg bh
getBlueDiff:
sub dl,ah ;get blue difference.
jnc sumDiff
neg dl
sumDiff:
clr dh ;add the three differences together.
add dl,bh
adc dh,0
add dl,bl
adc dh,0
;now check totals to see if less than
;stored total.
cmp di,dx
jle newTotal
mov di,dx ;save total for future compare.
mov bp,si ;save index for this set of values.
tst dx ;see if exact hit.
jz getTransfer ;shortcut....
newTotal:
dec si ;new index to try.
jns getRGBDifference ;next try...
getTransfer:
push ds
mov ds, ss:[colorTransferSeg] ; get correction blk
mov si,bp ;get index of corrected RGB triple
add si,bp
add si,bp ;three byte index
lodsw ;get R and G
mov cx,ax ; cl = red, ch = green
lodsb ;get B
mov ah,al ; ah = blue
pop ds
pop di,si,bp ;restore stuff.
;Exit:
;cl = corrected red
;ch = corrected green
;ah = corrected blue
jmp convertToCMYK
redTable2 label byte
byte 0,0,0,0,170,170,170,170,85,85,85,85,255,255,255,255
greenTable2 label byte
byte 0,0,170,170,0,0,85,170,85,85,255,255,85,85,255,255
blueTable2 label byte
byte 0,170,0,170,0,170,0,170,85,255,85,255,85,255,85,255
validRGBTable2 byte 0, 85, 170, 255
colorRGBIndexTable2 label byte
;R G B
byte 0 ;0 0 0
byte 0xff ;85 0 0
byte 4 ;170 0 0
byte 0xff ;255 0 0
byte 0xff ;0 85 0
byte 0xff ;85 85 0
byte 6 ;170 85 0
byte 0xff ;255 85 0
byte 2 ;0 170 0
byte 0xff ;85 170 0
byte 0xff ;170 170 0
byte 0xff ;255 170 0
byte 0xff ;0 255 0
byte 0xff ;85 255 0
byte 0xff ;170 255 0
byte 0xff ;255 255 0
byte 0xff ;0 0 85
byte 0xff ;85 0 85
byte 0xff ;170 0 85
byte 0xff ;255 0 85
byte 0xff ;0 85 85
byte 8 ;85 85 85
byte 0xff ;170 85 85
byte 12 ;255 85 85
byte 0xff ;0 170 85
byte 0xff ;85 170 85
byte 0xff ;170 170 85
byte 0xff ;255 170 85
byte 0xff ;0 255 85
byte 10 ;85 255 85
byte 0xff ;170 255 85
byte 14 ;255 255 85
byte 1 ;0 0 170
byte 0xff ;85 0 170
byte 5 ;170 0 170
byte 0xff ;255 0 170
byte 0xff ;0 85 170
byte 0xff ;85 85 170
byte 0xff ;170 85 170
byte 0xff ;255 85 170
byte 3 ;0 170 170
byte 0xff ;85 170 170
byte 7 ;170 170 170
byte 0xff ;255 170 170
byte 0xff ;0 255 170
byte 0xff ;85 255 170
byte 0xff ;170 255 170
byte 0xff ;255 255 170
byte 0xff ;0 0 255
byte 0xff ;85 0 255
byte 0xff ;170 0 255
byte 0xff ;255 0 255
byte 0xff ;0 85 255
byte 9 ;85 85 255
byte 0xff ;170 85 255
byte 13 ;255 85 255
byte 0xff ;0 170 255
byte 0xff ;85 170 255
byte 0xff ;170 170 255
byte 0xff ;255 170 255
byte 0xff ;0 255 255
byte 11 ;85 255 255
byte 0xff ;170 255 255
byte 15 ;255 255 255
else ;_INDEX_RGB_CORRECTION
doTransfer:
mov dx, ax ; dh = blue
xchg dx, cx ; dl = red,dh = green
; ch = blue
push ds, si
mov ds, ss:[colorTransferSeg] ; get correction blk
;
; dl = red, dh = green, ch = blue
; cl = shift amount
; si = offset into RGBDelta table (base value)
; bx = offset into RGBDelta table (for interpolation)
; al = 6 saved bits to use for interp (2 bits x 3 colors)
push cx, dx
clr al, bh ; use al for interpBits
mov cl, 4 ; need six, but start4
shr ch, cl ; do blue first
adc ch, 0 ; round up
mov ah, ch
shr ax, 1
shr ax, 1 ; al = BBxxxxxx
mov bl, ah ; build base value
shr dh, cl ; now do GREEN
adc dh, 0 ; round up
mov ah, dh
shr ax, 1 ; save interp bits
shr ax, 1 ; al = GGBBxxxx
add bl, ah ; need green *5
shl ah, 1 ; *2
shl ah, 1 ; *4
add bl, ah ; *5
shr dl, cl ; now do RED
adc dl, 0 ; round up
mov ah, dl
shr ax, 1
shr ax, 1 ; al = RRGGBBxx
add bl, ah ; need red *25
mov cl, 3
shl ah, cl
add bl, ah
shl ah, 1
add bl, ah
; now see about offset to interp value
; for each of the two bits that we saved above (the fractional
; bits, if you will), we test and add either 1/2, 1/4 or
; both of the difference between the base adjustment value
; and the secondary value used to interpolate between.
; Do this for each of red, green and blue.
mov si, bx ; save base offset
test al, 0x0c ; test blue bits
jz checkGreen
inc bx
checkGreen:
test al, 0x30 ; test green interpBits
jz checkRed
add bx, 5
checkRed:
test al, 0xc0 ; test red bits
jz haveInterpOffset
add bx, 25
haveInterpOffset:
mov dx, bx ; *3 (RGVDelta values)
shl bx, 1 ; (interp value)
add bx, dx
mov dx, si ; *3 (RGVDelta values)
shl si, 1 ; (base value)
add si, dx
pop cx, dx ; restore original clrs
mov ah, ds:[si].RGBD_red ; al = red base adjust
test al, 0xc0 ; red interp ?
jz bumpRed
mov cl, ds:[bx].RGBD_red ; get other interp valu
sub cl, ah ; calc difference
sar cl, 1 ; at least this
test al, 0x80 ; check each bit
jz addRed4
add ah, cl
test al, 0x40
jz bumpRed
addRed4:
sar cl, 1
add ah, cl
bumpRed:
add dl, ah
jc checkRedOverflow
adjustGreen:
mov ah, ds:[si].RGBD_green ; al = red base adjust
test al, 0x30 ; green interp ?
jz bumpGreen
mov cl, ds:[bx].RGBD_green ; get other interp valu
sub cl, ah ; calc difference
sar cl, 1 ; at least this
test al, 0x20 ; check each bit
jz addGreen4
add ah, cl
test al, 0x10
jz bumpGreen
addGreen4:
sar cl, 1
add ah, cl
bumpGreen:
add dh, ah
jc checkGreenOverflow
adjustBlue:
mov ah, ds:[si].RGBD_blue
test al, 0x0c ; blue interp ?
jz bumpBlue
mov cl, ds:[bx].RGBD_blue ; get other interp valu
sub cl, ah ; calc difference
sar cl, 1 ; at least this
test al, 0x08 ; check each bit
jz addBlue4
add ah, cl
test al, 0x04
jz bumpBlue
addBlue4:
sar cl, 1
add ah, cl
bumpBlue:
add ch, ah
jc checkBlueOverflow
colorAdjusted:
mov ah, ch ; ah = blue
mov cx, dx ; cl = red, ch = green
pop ds, si
jmp convertToCMYK
; we need to catch wrapping of each component value past
; 0xff (or past 0x00 for negative adjustment values).
; We get here via the addition of the adjustment value
; generating a carry. If the adjustment value was negative
; and the result positive, we are OK. Otherwise there was
; a bad wrapping of the value. Use the resulting sign of
; the component value to determine if we need to clamp the
; value to 0x00 or 0xff.
checkRedOverflow:
tst ah ; check adjust value
js adjustGreen
mov dl, 0xff ; limit value
jmp adjustGreen
checkGreenOverflow:
tst ah ; check adjust value
js adjustBlue
mov dh, 0xff ; limit value
jmp adjustBlue
checkBlueOverflow:
tst ah
js colorAdjusted
mov ch, 0xff ; limit value
jmp colorAdjusted
endif ;_INDEX_RGB_CORRECTION
CalcCacheEntry endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CopyShiftCyan
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Copy a cyan/magenta dither matrix and shift it
CALLED BY: CalcCacheEntry
PASS: ds:si - pointer to unshifted dither
es:di - pointer to buffer to store shifted one
cl - shift count
RETURN: es:di - points to after dither
DESTROYED: si, ax, cx, bx
PSEUDO CODE/STRATEGY:
shift each scan line
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 3/ 4/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CopyShiftCyan proc near
mov ch, CMYK_DITHER_HEIGHT
; use ax to rotate each byte
scanLoop:
clr bl
mov bh, CMYK_DITHER_WIDTH-1
byteLoop:
clr ah
lodsb
ror ax, cl ; last byte = first
xchg bl, ah ; save shift out bits
or al, ah
stosb
dec bh
jnz byteLoop
or es:[di-(CMYK_DITHER_WIDTH-1)], bl
dec ch
jnz scanLoop
ret
CopyShiftCyan endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CopyShiftBlack
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Copy and shift a black dither matrix
CALLED BY: CalcCacheEntry
PASS: ds:si - points to unshifted dither
es:di - points to buffer to hold shifted dither
cl - shift count
RETURN: es:di - points after dither
DESTROYED: si, cx, bx,ax
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 3/ 4/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CopyShiftBlack proc near
mov ch, BLACK_DITHER_HEIGHT
; use ax to rotate each byte
scanLoop:
mov bh, BLACK_DITHER_WIDTH-2
clr ah
lodsb
ror ax, cl ; last byte = first
mov bl, ah
mov dh, al ; save first byte...
inc di ; bump to 2nd byte
byteLoop:
lodsb
clr ah
ror ax, cl
xchg bl, ah
or al, ah
stosb
dec bh
jnz byteLoop
or dh, bl
mov es:[di-(BLACK_DITHER_WIDTH-1)], dh
dec ch
jnz scanLoop
ret
CopyShiftBlack endp
; this structure holds all the info needed to cache pointers
; to the dither matrices.
ColorCacheEntry struct
CCE_color byte ; color index
CCE_rgb RGBValue ; RGB value for that index
CCE_dither nptr ; offset to dither matrix
CCE_usage word ; incremented each time used
ColorCacheEntry ends
; these offsets are the ones for the current color
curCacheEntry nptr 0 ; another optimization
colorWriteByte nptr 0 ; routine vector
; allocate a few of these cached color dithering entries
colorCache ColorCacheEntry 16 dup(<>)
; now we allocate space for the actual dithers. These are
; a little smaller than the dither matrix that we store in
; cmykgroup, since that is used to word-wide operations while
; we only need one to do bytes (so these are a byte narrower)
YELLOW_SIZE equ 4
CYAN_SIZE equ 50
BLACK_SIZE equ 18
BM_DITHER_SIZE equ YELLOW_SIZE + 2*CYAN_SIZE + BLACK_SIZE
YELLOW_OFFSET equ 0
CYAN_OFFSET equ YELLOW_OFFSET + YELLOW_SIZE
MAGENTA_OFFSET equ CYAN_OFFSET + CYAN_SIZE
BLACK_OFFSET equ MAGENTA_OFFSET + CYAN_SIZE
dither0 byte BM_DITHER_SIZE dup (0)
dither1 byte BM_DITHER_SIZE dup (0)
dither2 byte BM_DITHER_SIZE dup (0)
dither3 byte BM_DITHER_SIZE dup (0)
dither4 byte BM_DITHER_SIZE dup (0)
dither5 byte BM_DITHER_SIZE dup (0)
dither6 byte BM_DITHER_SIZE dup (0)
dither7 byte BM_DITHER_SIZE dup (0)
dither8 byte BM_DITHER_SIZE dup (0)
dither9 byte BM_DITHER_SIZE dup (0)
ditherA byte BM_DITHER_SIZE dup (0)
ditherB byte BM_DITHER_SIZE dup (0)
ditherC byte BM_DITHER_SIZE dup (0)
ditherD byte BM_DITHER_SIZE dup (0)
ditherE byte BM_DITHER_SIZE dup (0)
ditherF byte BM_DITHER_SIZE dup (0)
VidEnds ClrBitmap
| 25.028942 | 79 | 0.584672 |
b325a2790cdc18d70d09a9e66e1a7c804bca4d2b | 69 | asm | Assembly | Src/Ant32/Tests/ant32/special/info-null-super-info-9.autotest.asm | geoffthorpe/ant-architecture | d85952e3050c352d5d715d9749171a335e6768f7 | [
"BSD-3-Clause"
] | null | null | null | Src/Ant32/Tests/ant32/special/info-null-super-info-9.autotest.asm | geoffthorpe/ant-architecture | d85952e3050c352d5d715d9749171a335e6768f7 | [
"BSD-3-Clause"
] | null | null | null | Src/Ant32/Tests/ant32/special/info-null-super-info-9.autotest.asm | geoffthorpe/ant-architecture | d85952e3050c352d5d715d9749171a335e6768f7 | [
"BSD-3-Clause"
] | 1 | 2020-07-15T04:09:05.000Z | 2020-07-15T04:09:05.000Z | info r5, 9
halt
#@expected values
#pc = 0x80000008
#r5 = 0
| 8.625 | 17 | 0.57971 |
5e0d500a99b7f811ab8fc9cf96895fa8a57b9332 | 449 | asm | Assembly | programs/oeis/111/A111859.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/111/A111859.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/111/A111859.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A111859: Number of numbers m <= n such that 9 equals the first digit after decimal point of square root of n in decimal representation.
; 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5
add $0,3
lpb $0,1
sub $0,$2
trn $0,1
mov $1,$2
add $2,2
add $3,1
lpe
sub $1,$3
trn $1,4
| 32.071429 | 211 | 0.579065 |
22f40b675edfd89781717b731c70d378e8772794 | 222 | asm | Assembly | programs/oeis/107/A107973.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/107/A107973.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/107/A107973.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A107973: Numbers of the form a^2 + b for a= 21 to 40 and b= 20 to 1 step -1.
; 461,503,547,593,641,691,743,797,853,911,971,1033,1097,1163,1231,1301,1373,1447,1523,1601
mov $1,41
add $1,$0
mul $1,$0
add $1,461
mov $0,$1
| 24.666667 | 90 | 0.662162 |
e8399f6b1a8d3184fbecb523930b86bad2914f27 | 2,798 | asm | Assembly | dimmer.asm | froller/dimmer | e71c110f12e39e4505b5fe0622c9d13fa0de6ec6 | [
"WTFPL"
] | null | null | null | dimmer.asm | froller/dimmer | e71c110f12e39e4505b5fe0622c9d13fa0de6ec6 | [
"WTFPL"
] | null | null | null | dimmer.asm | froller/dimmer | e71c110f12e39e4505b5fe0622c9d13fa0de6ec6 | [
"WTFPL"
] | null | null | null | #include "tn13def.inc"
.CSEG
rjmp RESET ; Reset Handler
reti ; IRQ0 Handler
reti ; PCINT0 Handler
rjmp TIMER ; Timer0 Overflow Handler
reti ; EEPROM Ready Handler
reti ; Analog Comparator Handler
reti ; Timer0 CompareA Handler
reti ; Timer0 CompareB Handler
rjmp WATCHDOG ; Watchdog Interrupt Handler
reti ; ADC Conversion Handler
.CSEG
RESET: ldi r16, low(RAMEND) ; Main program start
out SPL, r16 ; Set Stack Pointer to top of RAM
; Set up pins
ldi r16, 0b00000011 ; Set PORTB[1:0] for output
out DDRB, r16
ldi r16, 0b00011100 ; Enable pull-up on PORTB[4:2]
out PORTB, r16
; Set up CLK prescaler
ldi r16, (1 << CLKPCE)
out CLKPR, r16
ldi r16, (0 << CLKPS3) | (0 << CLKPS2) | (0 << CLKPS1) | (0 << CLKPS0)
out CLKPR, r16
; Set up watchdog
in r16, WDTCR
ori r16, (1 << WDCE)
out WDTCR, r16
; 4 clock cycles to set WDT
ldi r16, (1 << WDTIE) | (1 << WDP2) | (1 << WDP0) ; 0.5 s
out WDTCR, r16
wdr
; Set up timer0
ldi r19, (1 << COM0A1) | (0 << COM0A0) | (0 << COM0B1) | (0 << COM0B0) | (1 << WGM01) | (1 << WGM00) ; Fast PWM with OCR0A
ldi r18, (0 << COM0A1) | (0 << COM0A0) | (0 << COM0B1) | (0 << COM0B0) | (0 << WGM01) | (0 << WGM00) ; Normal mode
out TCCR0A, r18
ldi r16, 0x00 ; 0 PWM
out OCR0A, r16
mov r20, r16
ldi r16, (1 << TOIE0) ; Enable timer interrupt
out TIMSK0, r16
;ldi r16, (0 << WGM02) | (1 << CS02) | (0 << CS01) | (0 << CS00) ; 1/256 CLK for 146 Hz PWM @ 9.6 MHz CLK
ldi r16, (0 << WGM02) | (0 << CS02) | (1 << CS01) | (1 << CS00) ; 1/64 CLK for 586 Hz PWM @ 9.6 MHz CLK
out TCCR0B, r16
LOOP:
B0: in r16, PINB
andi r16, (1 << PORTB3) ; Pin 2
brne B1
ldi r20, 0x40
rjmp B3
B1: in r16, PINB
andi r16, (1 << PORTB4) ; Pin 3
brne B2
ldi r20, 0x80
rjmp B3
B2: in r16, PINB
andi r16, (1 << PORTB2) ; Pin 7
brne B3
ldi r20, 0xFF
B3: sei
sleep
cli
rjmp LOOP
WATCHDOG: in r21, PORTB
ldi r22, (1 << PORTB1)
eor r21, r22
out PORTB, r21
reti
TIMER: inc r23 ; Used for divider by 4
mov r24, r23
andi r24, 0xFC
in r17, PORTB ; Read PORTB for special cases
in r16, OCR0A ; Read current OCR0A value
cp r16, r20 ; Compare OCR0A with R20
breq WRITE ; They are equal, nothing left to do
brlo INCREASE ; brlo (unsigned) instead of brlt (signed)
DECREASE: cpse r23, r24 ; Divider by 4
dec r16 ; Decrease OCR0A
rjmp WRITE
INCREASE: cpse r23, r24 ; Divider by 4
inc r16 ; Increase OCR0A
WRITE: out OCR0A, r16 ; Write OCR0A
cpi r16, 0x00 ; Special case ZERO
breq SET_ZERO
cpi r16, 0xFF ; Special case FULL
breq SET_FULL
out TCCR0A, r19 ; Start fast PWM
reti
SET_ZERO: andi r17, ~(1 << PORTB0)
rjmp SET_OUT
SET_FULL: ori r17, (1 << PORTB0)
SET_OUT: out TCCR0A, r18 ; Stop fast PWM
out PORTB, r17
reti
| 24.761062 | 124 | 0.62223 |
de8ab1cb5c5f3bda333f30f71f56c56dcf91c0a0 | 652 | asm | Assembly | oeis/065/A065982.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/065/A065982.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/065/A065982.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A065982: a(n) = (n+1)*binomial(2*n,n) - 2^(2*n-1).
; Submitted by Christian Krause
; 2,10,48,222,1000,4420,19264,83062,355128,1508028,6368032,26765420,112053968,467531272,1945009408,8070882982,33414977368,138067832332,569466322528,2345021291332,9642649982128,39598183143352,162417965373568,665452603722172,2723725813960240,11138000575913560,45507104663406144,185783230403088792,757902806910375328,3089741276207280656,12587864294954660864,51253224614250711814,208567078609133931928,848282499043743772972,3448410191041156783840,14011780748808138223700,56908228479014505546224
mov $1,$0
add $1,1
seq $1,296665 ; Row sums of A296666.
mov $0,$1
div $0,2
| 65.2 | 490 | 0.843558 |
f48cbebbab46e95f1e048def31596ad9b2b7c545 | 491 | asm | Assembly | Bloc2/Micro/Project 6/projet_10.asm | MrGunnery/Helha | 553a73bd95bcda6c5fd329b76b39fde2df5bfd22 | [
"MIT"
] | 1 | 2018-02-07T12:18:52.000Z | 2018-02-07T12:18:52.000Z | Bloc2/Micro/Project 6/projet_10.asm | MrGunnery/Helha | 553a73bd95bcda6c5fd329b76b39fde2df5bfd22 | [
"MIT"
] | null | null | null | Bloc2/Micro/Project 6/projet_10.asm | MrGunnery/Helha | 553a73bd95bcda6c5fd329b76b39fde2df5bfd22 | [
"MIT"
] | null | null | null | DD equ 10
DV equ 11
RESTE equ 12
QUOTIENT equ 13
status equ 03
;*************Programation**************
Start movlw d'22'
movwf DD
movlw d'5'
movwf DV
movlw d'0'
movwf QUOTIENT
zero movf DV,f ;
btfsc status,2
goto Start
goto division
division movf DV,w
subwf DD,w
btfsc status,0
goto suivant
goto fin
suivant movfw DV
subwf DD,1
incf QUOTIENT
goto division
fin movfw DD
movwf RESTE
end
| 12.589744 | 41 | 0.570265 |
874827ad3a209b2a2d332a10b965f373e756c090 | 1,394 | asm | Assembly | data/phone/text/stanley_overworld.asm | pokeachromicdevs/pokeoctober | db74bb68bbfceac07eec6d64674bc24fd4c0b67f | [
"blessing"
] | 1 | 2021-07-05T23:48:37.000Z | 2021-07-05T23:48:37.000Z | data/phone/text/stanley_overworld.asm | AtmaBuster/pokeoctober | 12652b84eb2df1a0ed2f654a0ffcfb78202e515f | [
"blessing"
] | 1 | 2020-12-16T01:11:20.000Z | 2020-12-16T22:53:56.000Z | data/phone/text/stanley_overworld.asm | AtmaBuster/pokeoctober | 12652b84eb2df1a0ed2f654a0ffcfb78202e515f | [
"blessing"
] | 1 | 2021-07-05T23:33:22.000Z | 2021-07-05T23:33:22.000Z | StanleyAskNumber1Text:
text "During these"
line "trips, I usually"
para "find so many"
line "BERRIES scattered"
para "along the ground."
line "Too many, in fact."
para "If you want, you"
line "could give me your"
cont "phone number, and"
para "I can call you"
line "whenever I have"
cont "too many BERRIES."
para "How about it?"
done
StanleyAskNumber2Text:
text "find so many"
line "BERRIES"
para "scattered along"
line "the ground. Too"
cont "many, in fact."
para "If you want, you"
line "could give me your"
cont "phone number, and"
para "I can call you"
line "whenever I have"
cont "too many BERRIES."
para "How about it?"
done
StanleyNumberAcceptedText:
text "Excellent! Now I"
line "won't have a house"
para "full of berries,"
line "hehehe…"
done
StanleyNumberDeclinedText:
text "No? But BERRIES"
line "are very useful!"
done
StanleyPhoneFullText:
text "Hmmm…doesn't"
line "look like you have"
cont "room for my number."
done
StanleyRematchText:
text "Ah, there you are."
line "Let's see how your"
cont "tactics have"
para "improved since"
line "last time."
done
StanleyGiftText:
text "Ah, there you are!"
line "Here are some of"
para "the extra BERRIES"
line "I promised."
done
StanleyPackFullText:
text "Oops, your PACK's"
line "full. Too bad."
para "You should come"
line "back for them"
cont "later."
done
| 16.4 | 27 | 0.694405 |
f20e2e92e49f58fe510ca00bf05ce15b5b94a475 | 510 | asm | Assembly | programs/oeis/164/A164131.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/164/A164131.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/164/A164131.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A164131: Numbers n such that n^2 == 2 (mod 31).
; 8,23,39,54,70,85,101,116,132,147,163,178,194,209,225,240,256,271,287,302,318,333,349,364,380,395,411,426,442,457,473,488,504,519,535,550,566,581,597,612,628,643,659,674,690,705,721,736,752,767,783,798,814,829,845,860,876,891,907,922,938,953,969,984,1000,1015,1031,1046,1062,1077,1093,1108,1124,1139,1155,1170,1186,1201,1217,1232,1248,1263,1279,1294,1310,1325,1341,1356,1372,1387,1403,1418,1434,1449,1465,1480,1496,1511,1527,1542
mul $0,31
div $0,2
add $0,8
| 72.857143 | 430 | 0.737255 |
ab9ba1b16aa05d68eb785e67f4ab02252b14d6bd | 977 | asm | Assembly | programs/oeis/002/A002299.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/002/A002299.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/002/A002299.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A002299: Binomial coefficients C(2*n+5,5).
; 1,21,126,462,1287,3003,6188,11628,20349,33649,53130,80730,118755,169911,237336,324632,435897,575757,749398,962598,1221759,1533939,1906884,2349060,2869685,3478761,4187106,5006386,5949147,7028847,8259888,9657648,11238513,13019909,15020334,17259390,19757815,22537515,25621596,29034396,32801517,36949857,41507642,46504458,51971283,57940519,64446024,71523144,79208745,87541245,96560646,106308566,116828271,128164707,140364532,153476148,167549733,182637273,198792594,216071394,234531275,254231775,275234400,297602656,321402081,346700277,373566942,402073902,432295143,464306843,498187404,534017484,571880029,611860305,654045930,698526906,745395651,794747031,846678392,901289592,958683033,1018963693,1082239158,1148619654,1218218079,1291150035,1367533860,1447490660,1531144341,1618621641,1710052162,1805568402,1905305787,2009402703,2118000528,2231243664,2349279569,2472258789,2600334990,2733664990
mul $0,2
mov $1,-6
bin $1,$0
mov $0,$1
| 122.125 | 891 | 0.861822 |
3ffeab9076fe017f8acd978a72e9f40376561a46 | 27,570 | asm | Assembly | target/cos_117/disasm/iop_overlay1/ENDCONC.asm | jrrk2/cray-sim | 52c9639808d6890517092637b188282c00cce4f7 | [
"BSL-1.0"
] | 49 | 2020-10-09T12:29:16.000Z | 2022-03-12T02:33:35.000Z | target/cos_117/disasm/iop_overlay1/ENDCONC.asm | jrrk2/cray-sim | 52c9639808d6890517092637b188282c00cce4f7 | [
"BSL-1.0"
] | 1 | 2021-12-29T15:59:25.000Z | 2021-12-29T15:59:25.000Z | target/cos_117/disasm/iop_overlay1/ENDCONC.asm | jrrk2/cray-sim | 52c9639808d6890517092637b188282c00cce4f7 | [
"BSL-1.0"
] | 6 | 2021-04-12T06:10:32.000Z | 2022-02-08T23:11:19.000Z | 0x0000 (0x000000) 0x2118- f:00020 d: 280 | A = OR[280]
0x0001 (0x000002) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x0002 (0x000004) 0x2908- f:00024 d: 264 | OR[264] = A
0x0003 (0x000006) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0004 (0x000008) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x0005 (0x00000A) 0x8405- f:00102 d: 5 | P = P + 5 (0x000A), A = 0
0x0006 (0x00000C) 0x2118- f:00020 d: 280 | A = OR[280]
0x0007 (0x00000E) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x0008 (0x000010) 0x1630- f:00013 d: 48 | A = A - 48 (0x0030)
0x0009 (0x000012) 0x2918- f:00024 d: 280 | OR[280] = A
0x000A (0x000014) 0x2118- f:00020 d: 280 | A = OR[280]
0x000B (0x000016) 0x1403- f:00012 d: 3 | A = A + 3 (0x0003)
0x000C (0x000018) 0x2919- f:00024 d: 281 | OR[281] = A
0x000D (0x00001A) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x000E (0x00001C) 0x291F- f:00024 d: 287 | OR[287] = A
0x000F (0x00001E) 0x2119- f:00020 d: 281 | A = OR[281]
0x0010 (0x000020) 0x290D- f:00024 d: 269 | OR[269] = A
0x0011 (0x000022) 0x210D- f:00020 d: 269 | A = OR[269]
0x0012 (0x000024) 0x1607- f:00013 d: 7 | A = A - 7 (0x0007)
0x0013 (0x000026) 0x8002- f:00100 d: 2 | P = P + 2 (0x0015), C = 0
0x0014 (0x000028) 0x8602- f:00103 d: 2 | P = P + 2 (0x0016), A # 0
0x0015 (0x00002A) 0x7002- f:00070 d: 2 | P = P + 2 (0x0017)
0x0016 (0x00002C) 0x700F- f:00070 d: 15 | P = P + 15 (0x0025)
0x0017 (0x00002E) 0x210D- f:00020 d: 269 | A = OR[269]
0x0018 (0x000030) 0x8602- f:00103 d: 2 | P = P + 2 (0x001A), A # 0
0x0019 (0x000032) 0x700C- f:00070 d: 12 | P = P + 12 (0x0025)
0x001A (0x000034) 0x2048- f:00020 d: 72 | A = OR[72]
0x001B (0x000036) 0x1402- f:00012 d: 2 | A = A + 2 (0x0002)
0x001C (0x000038) 0x290E- f:00024 d: 270 | OR[270] = A
0x001D (0x00003A) 0x210D- f:00020 d: 269 | A = OR[269]
0x001E (0x00003C) 0x1601- f:00013 d: 1 | A = A - 1 (0x0001)
0x001F (0x00003E) 0x8405- f:00102 d: 5 | P = P + 5 (0x0024), A = 0
0x0020 (0x000040) 0x1007- f:00010 d: 7 | A = 7 (0x0007)
0x0021 (0x000042) 0x2B0E- f:00025 d: 270 | OR[270] = A + OR[270]
0x0022 (0x000044) 0x2F0D- f:00027 d: 269 | OR[269] = OR[269] - 1
0x0023 (0x000046) 0x7206- f:00071 d: 6 | P = P - 6 (0x001D)
0x0024 (0x000048) 0x7003- f:00070 d: 3 | P = P + 3 (0x0027)
0x0025 (0x00004A) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0026 (0x00004C) 0x290E- f:00024 d: 270 | OR[270] = A
0x0027 (0x00004E) 0x210E- f:00020 d: 270 | A = OR[270]
0x0028 (0x000050) 0x291F- f:00024 d: 287 | OR[287] = A
0x0029 (0x000052) 0x211F- f:00020 d: 287 | A = OR[287]
0x002A (0x000054) 0x8402- f:00102 d: 2 | P = P + 2 (0x002C), A = 0
0x002B (0x000056) 0x7007- f:00070 d: 7 | P = P + 7 (0x0032)
0x002C (0x000058) 0x1800-0x00FD f:00014 d: 0 | A = 253 (0x00FD)
0x002E (0x00005C) 0x291A- f:00024 d: 282 | OR[282] = A
0x002F (0x00005E) 0x1010- f:00010 d: 16 | A = 16 (0x0010)
0x0030 (0x000060) 0x291B- f:00024 d: 283 | OR[283] = A
0x0031 (0x000062) 0x7044- f:00070 d: 68 | P = P + 68 (0x0075)
0x0032 (0x000064) 0x311F- f:00030 d: 287 | A = (OR[287])
0x0033 (0x000066) 0x080D- f:00004 d: 13 | A = A > 13 (0x000D)
0x0034 (0x000068) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x0035 (0x00006A) 0x2922- f:00024 d: 290 | OR[290] = A
0x0036 (0x00006C) 0x311F- f:00030 d: 287 | A = (OR[287])
0x0037 (0x00006E) 0x080F- f:00004 d: 15 | A = A > 15 (0x000F)
0x0038 (0x000070) 0x2923- f:00024 d: 291 | OR[291] = A
0x0039 (0x000072) 0x311F- f:00030 d: 287 | A = (OR[287])
0x003A (0x000074) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x003B (0x000076) 0x2924- f:00024 d: 292 | OR[292] = A
0x003C (0x000078) 0x2122- f:00020 d: 290 | A = OR[290]
0x003D (0x00007A) 0x8604- f:00103 d: 4 | P = P + 4 (0x0041), A # 0
0x003E (0x00007C) 0x2123- f:00020 d: 291 | A = OR[291]
0x003F (0x00007E) 0x8402- f:00102 d: 2 | P = P + 2 (0x0041), A = 0
0x0040 (0x000080) 0x7004- f:00070 d: 4 | P = P + 4 (0x0044)
0x0041 (0x000082) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x0042 (0x000084) 0x2925- f:00024 d: 293 | OR[293] = A
0x0043 (0x000086) 0x7003- f:00070 d: 3 | P = P + 3 (0x0046)
0x0044 (0x000088) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0045 (0x00008A) 0x2925- f:00024 d: 293 | OR[293] = A
0x0046 (0x00008C) 0x2125- f:00020 d: 293 | A = OR[293]
0x0047 (0x00008E) 0x8605- f:00103 d: 5 | P = P + 5 (0x004C), A # 0
0x0048 (0x000090) 0x2124- f:00020 d: 292 | A = OR[292]
0x0049 (0x000092) 0x161E- f:00013 d: 30 | A = A - 30 (0x001E)
0x004A (0x000094) 0x8602- f:00103 d: 2 | P = P + 2 (0x004C), A # 0
0x004B (0x000096) 0x701A- f:00070 d: 26 | P = P + 26 (0x0065)
0x004C (0x000098) 0x2122- f:00020 d: 290 | A = OR[290]
0x004D (0x00009A) 0x8602- f:00103 d: 2 | P = P + 2 (0x004F), A # 0
0x004E (0x00009C) 0x7008- f:00070 d: 8 | P = P + 8 (0x0056)
0x004F (0x00009E) 0x1800-0x010E f:00014 d: 0 | A = 270 (0x010E)
0x0051 (0x0000A2) 0x2403- f:00022 d: 3 | A = A + OR[3]
0x0052 (0x0000A4) 0x291A- f:00024 d: 282 | OR[282] = A
0x0053 (0x0000A6) 0x1015- f:00010 d: 21 | A = 21 (0x0015)
0x0054 (0x0000A8) 0x291B- f:00024 d: 283 | OR[283] = A
0x0055 (0x0000AA) 0x700F- f:00070 d: 15 | P = P + 15 (0x0064)
0x0056 (0x0000AC) 0x2123- f:00020 d: 291 | A = OR[291]
0x0057 (0x0000AE) 0x8402- f:00102 d: 2 | P = P + 2 (0x0059), A = 0
0x0058 (0x0000B0) 0x7007- f:00070 d: 7 | P = P + 7 (0x005F)
0x0059 (0x0000B2) 0x1800-0x0123 f:00014 d: 0 | A = 291 (0x0123)
0x005B (0x0000B6) 0x291A- f:00024 d: 282 | OR[282] = A
0x005C (0x0000B8) 0x1010- f:00010 d: 16 | A = 16 (0x0010)
0x005D (0x0000BA) 0x291B- f:00024 d: 283 | OR[283] = A
0x005E (0x0000BC) 0x7006- f:00070 d: 6 | P = P + 6 (0x0064)
0x005F (0x0000BE) 0x1800-0x0132 f:00014 d: 0 | A = 306 (0x0132)
0x0061 (0x0000C2) 0x291A- f:00024 d: 282 | OR[282] = A
0x0062 (0x0000C4) 0x1015- f:00010 d: 21 | A = 21 (0x0015)
0x0063 (0x0000C6) 0x291B- f:00024 d: 283 | OR[283] = A
0x0064 (0x0000C8) 0x7011- f:00070 d: 17 | P = P + 17 (0x0075)
0x0065 (0x0000CA) 0x311F- f:00030 d: 287 | A = (OR[287])
0x0066 (0x0000CC) 0x1A00-0xBFFF f:00015 d: 0 | A = A & 49151 (0xBFFF)
0x0068 (0x0000D0) 0x391F- f:00034 d: 287 | (OR[287]) = A
0x0069 (0x0000D2) 0x311F- f:00030 d: 287 | A = (OR[287])
0x006A (0x0000D4) 0x0E03- f:00007 d: 3 | A = A << 3 (0x0003)
0x006B (0x0000D6) 0x0A01- f:00005 d: 1 | A = A < 1 (0x0001)
0x006C (0x0000D8) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x006D (0x0000DA) 0x0C04- f:00006 d: 4 | A = A >> 4 (0x0004)
0x006E (0x0000DC) 0x391F- f:00034 d: 287 | (OR[287]) = A
0x006F (0x0000DE) 0x1003- f:00010 d: 3 | A = 3 (0x0003)
0x0070 (0x0000E0) 0x2926- f:00024 d: 294 | OR[294] = A
0x0071 (0x0000E2) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x0072 (0x0000E4) 0x5800- f:00054 d: 0 | B = A
0x0073 (0x0000E6) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0074 (0x0000E8) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0075 (0x0000EA) 0x1018- f:00010 d: 24 | A = 24 (0x0018)
0x0076 (0x0000EC) 0x2926- f:00024 d: 294 | OR[294] = A
0x0077 (0x0000EE) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x0078 (0x0000F0) 0x1402- f:00012 d: 2 | A = A + 2 (0x0002)
0x0079 (0x0000F2) 0x2927- f:00024 d: 295 | OR[295] = A
0x007A (0x0000F4) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x007B (0x0000F6) 0x2928- f:00024 d: 296 | OR[296] = A
0x007C (0x0000F8) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x007D (0x0000FA) 0x2929- f:00024 d: 297 | OR[297] = A
0x007E (0x0000FC) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x007F (0x0000FE) 0x292A- f:00024 d: 298 | OR[298] = A
0x0080 (0x000100) 0x111C- f:00010 d: 284 | A = 284 (0x011C)
0x0081 (0x000102) 0x292B- f:00024 d: 299 | OR[299] = A
0x0082 (0x000104) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x0083 (0x000106) 0x5800- f:00054 d: 0 | B = A
0x0084 (0x000108) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0085 (0x00010A) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0086 (0x00010C) 0x8E17- f:00107 d: 23 | P = P - 23 (0x006F), A # 0
0x0087 (0x00010E) 0x211C- f:00020 d: 284 | A = OR[284]
0x0088 (0x000110) 0x1428- f:00012 d: 40 | A = A + 40 (0x0028)
0x0089 (0x000112) 0x2920- f:00024 d: 288 | OR[288] = A
0x008A (0x000114) 0x211C- f:00020 d: 284 | A = OR[284]
0x008B (0x000116) 0x290E- f:00024 d: 270 | OR[270] = A
0x008C (0x000118) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x008D (0x00011A) 0x290D- f:00024 d: 269 | OR[269] = A
0x008E (0x00011C) 0x210D- f:00020 d: 269 | A = OR[269]
0x008F (0x00011E) 0x8407- f:00102 d: 7 | P = P + 7 (0x0096), A = 0
0x0090 (0x000120) 0x1800-0x2020 f:00014 d: 0 | A = 8224 (0x2020)
0x0092 (0x000124) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x0093 (0x000126) 0x2F0D- f:00027 d: 269 | OR[269] = OR[269] - 1
0x0094 (0x000128) 0x2D0E- f:00026 d: 270 | OR[270] = OR[270] + 1
0x0095 (0x00012A) 0x7207- f:00071 d: 7 | P = P - 7 (0x008E)
0x0096 (0x00012C) 0x1800-0x00F2 f:00014 d: 0 | A = 242 (0x00F2)
0x0098 (0x000130) 0x2403- f:00022 d: 3 | A = A + OR[3]
0x0099 (0x000132) 0x291D- f:00024 d: 285 | OR[285] = A
0x009A (0x000134) 0x211C- f:00020 d: 284 | A = OR[284]
0x009B (0x000136) 0x140A- f:00012 d: 10 | A = A + 10 (0x000A)
0x009C (0x000138) 0x1402- f:00012 d: 2 | A = A + 2 (0x0002)
0x009D (0x00013A) 0x291E- f:00024 d: 286 | OR[286] = A
0x009E (0x00013C) 0x211D- f:00020 d: 285 | A = OR[285]
0x009F (0x00013E) 0x290D- f:00024 d: 269 | OR[269] = A
0x00A0 (0x000140) 0x211C- f:00020 d: 284 | A = OR[284]
0x00A1 (0x000142) 0x290E- f:00024 d: 270 | OR[270] = A
0x00A2 (0x000144) 0x100A- f:00010 d: 10 | A = 10 (0x000A)
0x00A3 (0x000146) 0x290F- f:00024 d: 271 | OR[271] = A
0x00A4 (0x000148) 0x7006- f:00070 d: 6 | P = P + 6 (0x00AA)
0x00A5 (0x00014A) 0x310D- f:00030 d: 269 | A = (OR[269])
0x00A6 (0x00014C) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x00A7 (0x00014E) 0x2D0D- f:00026 d: 269 | OR[269] = OR[269] + 1
0x00A8 (0x000150) 0x2D0E- f:00026 d: 270 | OR[270] = OR[270] + 1
0x00A9 (0x000152) 0x2F0F- f:00027 d: 271 | OR[271] = OR[271] - 1
0x00AA (0x000154) 0x210F- f:00020 d: 271 | A = OR[271]
0x00AB (0x000156) 0x8E06- f:00107 d: 6 | P = P - 6 (0x00A5), A # 0
0x00AC (0x000158) 0x2119- f:00020 d: 281 | A = OR[281]
0x00AD (0x00015A) 0x3920- f:00034 d: 288 | (OR[288]) = A
0x00AE (0x00015C) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x00AF (0x00015E) 0x2926- f:00024 d: 294 | OR[294] = A
0x00B0 (0x000160) 0x1800-0x000F f:00014 d: 0 | A = 15 (0x000F)
0x00B2 (0x000164) 0x2927- f:00024 d: 295 | OR[295] = A
0x00B3 (0x000166) 0x2120- f:00020 d: 288 | A = OR[288]
0x00B4 (0x000168) 0x2928- f:00024 d: 296 | OR[296] = A
0x00B5 (0x00016A) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00B6 (0x00016C) 0x2929- f:00024 d: 297 | OR[297] = A
0x00B7 (0x00016E) 0x1010- f:00010 d: 16 | A = 16 (0x0010)
0x00B8 (0x000170) 0x292A- f:00024 d: 298 | OR[298] = A
0x00B9 (0x000172) 0x211C- f:00020 d: 284 | A = OR[284]
0x00BA (0x000174) 0x292B- f:00024 d: 299 | OR[299] = A
0x00BB (0x000176) 0x1016- f:00010 d: 22 | A = 22 (0x0016)
0x00BC (0x000178) 0x292C- f:00024 d: 300 | OR[300] = A
0x00BD (0x00017A) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00BE (0x00017C) 0x292D- f:00024 d: 301 | OR[301] = A
0x00BF (0x00017E) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x00C0 (0x000180) 0x5800- f:00054 d: 0 | B = A
0x00C1 (0x000182) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x00C3 (0x000186) 0x7C09- f:00076 d: 9 | R = OR[9]
0x00C4 (0x000188) 0x211A- f:00020 d: 282 | A = OR[282]
0x00C5 (0x00018A) 0x2403- f:00022 d: 3 | A = A + OR[3]
0x00C6 (0x00018C) 0x291A- f:00024 d: 282 | OR[282] = A
0x00C7 (0x00018E) 0x211A- f:00020 d: 282 | A = OR[282]
0x00C8 (0x000190) 0x290D- f:00024 d: 269 | OR[269] = A
0x00C9 (0x000192) 0x211E- f:00020 d: 286 | A = OR[286]
0x00CA (0x000194) 0x290E- f:00024 d: 270 | OR[270] = A
0x00CB (0x000196) 0x211B- f:00020 d: 283 | A = OR[283]
0x00CC (0x000198) 0x290F- f:00024 d: 271 | OR[271] = A
0x00CD (0x00019A) 0x7006- f:00070 d: 6 | P = P + 6 (0x00D3)
0x00CE (0x00019C) 0x310D- f:00030 d: 269 | A = (OR[269])
0x00CF (0x00019E) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x00D0 (0x0001A0) 0x2D0D- f:00026 d: 269 | OR[269] = OR[269] + 1
0x00D1 (0x0001A2) 0x2D0E- f:00026 d: 270 | OR[270] = OR[270] + 1
0x00D2 (0x0001A4) 0x2F0F- f:00027 d: 271 | OR[271] = OR[271] - 1
0x00D3 (0x0001A6) 0x210F- f:00020 d: 271 | A = OR[271]
0x00D4 (0x0001A8) 0x8E06- f:00107 d: 6 | P = P - 6 (0x00CE), A # 0
0x00D5 (0x0001AA) 0x1010- f:00010 d: 16 | A = 16 (0x0010)
0x00D6 (0x0001AC) 0x2926- f:00024 d: 294 | OR[294] = A
0x00D7 (0x0001AE) 0x211C- f:00020 d: 284 | A = OR[284]
0x00D8 (0x0001B0) 0x2927- f:00024 d: 295 | OR[295] = A
0x00D9 (0x0001B2) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x00DA (0x0001B4) 0x5800- f:00054 d: 0 | B = A
0x00DB (0x0001B6) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x00DD (0x0001BA) 0x7C09- f:00076 d: 9 | R = OR[9]
0x00DE (0x0001BC) 0x1019- f:00010 d: 25 | A = 25 (0x0019)
0x00DF (0x0001BE) 0x2926- f:00024 d: 294 | OR[294] = A
0x00E0 (0x0001C0) 0x211C- f:00020 d: 284 | A = OR[284]
0x00E1 (0x0001C2) 0x2927- f:00024 d: 295 | OR[295] = A
0x00E2 (0x0001C4) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x00E3 (0x0001C6) 0x5800- f:00054 d: 0 | B = A
0x00E4 (0x0001C8) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00E5 (0x0001CA) 0x7C09- f:00076 d: 9 | R = OR[9]
0x00E6 (0x0001CC) 0x1003- f:00010 d: 3 | A = 3 (0x0003)
0x00E7 (0x0001CE) 0x2926- f:00024 d: 294 | OR[294] = A
0x00E8 (0x0001D0) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x00E9 (0x0001D2) 0x5800- f:00054 d: 0 | B = A
0x00EA (0x0001D4) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00EB (0x0001D6) 0x7C09- f:00076 d: 9 | R = OR[9]
0x00EC (0x0001D8) 0x436F- f:00041 d: 367 | C = 1, io 0557 = BZ
0x00ED (0x0001DA) 0x6E63- f:00067 d: 99 | OR[B] = OR[B] - 1 | **** non-standard encoding with D:0x0063 ****
0x00EE (0x0001DC) 0x656E- f:00062 d: 366 | A = A + OR[B] | **** non-standard encoding with D:0x016E ****
0x00EF (0x0001DE) 0x7472- f:00072 d: 114 | R = P + 114 (0x0161)
0x00F0 (0x0001E0) 0x6174- f:00060 d: 372 | A = OR[B] | **** non-standard encoding with D:0x0174 ****
0x00F1 (0x0001E2) 0x6F72- f:00067 d: 370 | OR[B] = OR[B] - 1 | **** non-standard encoding with D:0x0172 ****
0x00F2 (0x0001E4) 0x206F- f:00020 d: 111 | A = OR[111]
0x00F3 (0x0001E6) 0x7264- f:00071 d: 100 | P = P - 100 (0x008F)
0x00F4 (0x0001E8) 0x696E- f:00064 d: 366 | OR[B] = A | **** non-standard encoding with D:0x016E ****
0x00F5 (0x0001EA) 0x616C- f:00060 d: 364 | A = OR[B] | **** non-standard encoding with D:0x016C ****
0x00F6 (0x0001EC) 0x0000- f:00000 d: 0 | PASS
0x00F7 (0x0001EE) 0x6E6F- f:00067 d: 111 | OR[B] = OR[B] - 1 | **** non-standard encoding with D:0x006F ****
0x00F8 (0x0001F0) 0x7420- f:00072 d: 32 | R = P + 32 (0x0118)
0x00F9 (0x0001F2) 0x636F- f:00061 d: 367 | A = A & OR[B] | **** non-standard encoding with D:0x016F ****
0x00FA (0x0001F4) 0x6E66- f:00067 d: 102 | OR[B] = OR[B] - 1 | **** non-standard encoding with D:0x0066 ****
0x00FB (0x0001F6) 0x6967- f:00064 d: 359 | OR[B] = A | **** non-standard encoding with D:0x0167 ****
0x00FC (0x0001F8) 0x7572- f:00072 d: 370 | R = P + 370 (0x026E)
0x00FD (0x0001FA) 0x6564- f:00062 d: 356 | A = A + OR[B] | **** non-standard encoding with D:0x0164 ****
0x00FE (0x0001FC) 0x2E20- f:00027 d: 32 | OR[32] = OR[32] - 1
0x00FF (0x0001FE) 0x436F- f:00041 d: 367 | C = 1, io 0557 = BZ
0x0100 (0x000200) 0x6D6D- f:00066 d: 365 | OR[B] = OR[B] + 1 | **** non-standard encoding with D:0x016D ****
0x0101 (0x000202) 0x616E- f:00060 d: 366 | A = OR[B] | **** non-standard encoding with D:0x016E ****
0x0102 (0x000204) 0x6420- f:00062 d: 32 | A = A + OR[B] | **** non-standard encoding with D:0x0020 ****
0x0103 (0x000206) 0x6162- f:00060 d: 354 | A = OR[B] | **** non-standard encoding with D:0x0162 ****
0x0104 (0x000208) 0x6F72- f:00067 d: 370 | OR[B] = OR[B] - 1 | **** non-standard encoding with D:0x0172 ****
0x0105 (0x00020A) 0x7465- f:00072 d: 101 | R = P + 101 (0x016A)
0x0106 (0x00020C) 0x642E- f:00062 d: 46 | A = A + OR[B] | **** non-standard encoding with D:0x002E ****
0x0107 (0x00020E) 0x0000- f:00000 d: 0 | PASS
0x0108 (0x000210) 0x7465- f:00072 d: 101 | R = P + 101 (0x016D)
0x0109 (0x000212) 0x726D- f:00071 d: 109 | P = P - 109 (0x009C)
0x010A (0x000214) 0x696E- f:00064 d: 366 | OR[B] = A | **** non-standard encoding with D:0x016E ****
0x010B (0x000216) 0x6174- f:00060 d: 372 | A = OR[B] | **** non-standard encoding with D:0x0174 ****
0x010C (0x000218) 0x696F- f:00064 d: 367 | OR[B] = A | **** non-standard encoding with D:0x016F ****
0x010D (0x00021A) 0x6E20- f:00067 d: 32 | OR[B] = OR[B] - 1 | **** non-standard encoding with D:0x0020 ****
0x010E (0x00021C) 0x696E- f:00064 d: 366 | OR[B] = A | **** non-standard encoding with D:0x016E ****
0x010F (0x00021E) 0x2070- f:00020 d: 112 | A = OR[112]
0x0110 (0x000220) 0x726F- f:00071 d: 111 | P = P - 111 (0x00A1)
0x0111 (0x000222) 0x6772- f:00063 d: 370 | A = A - OR[B] | **** non-standard encoding with D:0x0172 ****
0x0112 (0x000224) 0x6573- f:00062 d: 371 | A = A + OR[B] | **** non-standard encoding with D:0x0173 ****
0x0113 (0x000226) 0x732E- f:00071 d: 302 | P = P - 302 (0xFFFFFFFFFFFFFFE5)
0x0114 (0x000228) 0x2043- f:00020 d: 67 | A = OR[67]
0x0115 (0x00022A) 0x6F6D- f:00067 d: 365 | OR[B] = OR[B] - 1 | **** non-standard encoding with D:0x016D ****
0x0116 (0x00022C) 0x6D61- f:00066 d: 353 | OR[B] = OR[B] + 1 | **** non-standard encoding with D:0x0161 ****
0x0117 (0x00022E) 0x6E64- f:00067 d: 100 | OR[B] = OR[B] - 1 | **** non-standard encoding with D:0x0064 ****
0x0118 (0x000230) 0x2061- f:00020 d: 97 | A = OR[97]
0x0119 (0x000232) 0x626F- f:00061 d: 111 | A = A & OR[B] | **** non-standard encoding with D:0x006F ****
0x011A (0x000234) 0x7274- f:00071 d: 116 | P = P - 116 (0x00A6)
0x011B (0x000236) 0x6564- f:00062 d: 356 | A = A + OR[B] | **** non-standard encoding with D:0x0164 ****
0x011C (0x000238) 0x2E00- f:00027 d: 0 | OR[0] = OR[0] - 1
0x011D (0x00023A) 0x6E6F- f:00067 d: 111 | OR[B] = OR[B] - 1 | **** non-standard encoding with D:0x006F ****
0x011E (0x00023C) 0x7420- f:00072 d: 32 | R = P + 32 (0x013E)
0x011F (0x00023E) 0x6163- f:00060 d: 355 | A = OR[B] | **** non-standard encoding with D:0x0163 ****
0x0120 (0x000240) 0x7469- f:00072 d: 105 | R = P + 105 (0x0189)
0x0121 (0x000242) 0x7665- f:00073 d: 101 | R = P - 101 (0x00BC)
0x0122 (0x000244) 0x2E20- f:00027 d: 32 | OR[32] = OR[32] - 1
0x0123 (0x000246) 0x436F- f:00041 d: 367 | C = 1, io 0557 = BZ
0x0124 (0x000248) 0x6D6D- f:00066 d: 365 | OR[B] = OR[B] + 1 | **** non-standard encoding with D:0x016D ****
0x0125 (0x00024A) 0x616E- f:00060 d: 366 | A = OR[B] | **** non-standard encoding with D:0x016E ****
0x0126 (0x00024C) 0x6420- f:00062 d: 32 | A = A + OR[B] | **** non-standard encoding with D:0x0020 ****
0x0127 (0x00024E) 0x6162- f:00060 d: 354 | A = OR[B] | **** non-standard encoding with D:0x0162 ****
0x0128 (0x000250) 0x6F72- f:00067 d: 370 | OR[B] = OR[B] - 1 | **** non-standard encoding with D:0x0172 ****
0x0129 (0x000252) 0x7465- f:00072 d: 101 | R = P + 101 (0x018E)
0x012A (0x000254) 0x642E- f:00062 d: 46 | A = A + OR[B] | **** non-standard encoding with D:0x002E ****
0x012B (0x000256) 0x0000- f:00000 d: 0 | PASS
0x012C (0x000258) 0x6E6F- f:00067 d: 111 | OR[B] = OR[B] - 1 | **** non-standard encoding with D:0x006F ****
0x012D (0x00025A) 0x7420- f:00072 d: 32 | R = P + 32 (0x014D)
0x012E (0x00025C) 0x636F- f:00061 d: 367 | A = A & OR[B] | **** non-standard encoding with D:0x016F ****
0x012F (0x00025E) 0x6E66- f:00067 d: 102 | OR[B] = OR[B] - 1 | **** non-standard encoding with D:0x0066 ****
0x0130 (0x000260) 0x6967- f:00064 d: 359 | OR[B] = A | **** non-standard encoding with D:0x0167 ****
0x0131 (0x000262) 0x7572- f:00072 d: 370 | R = P + 370 (0x02A3)
0x0132 (0x000264) 0x6564- f:00062 d: 356 | A = A + OR[B] | **** non-standard encoding with D:0x0164 ****
0x0133 (0x000266) 0x2063- f:00020 d: 99 | A = OR[99]
0x0134 (0x000268) 0x6F72- f:00067 d: 370 | OR[B] = OR[B] - 1 | **** non-standard encoding with D:0x0172 ****
0x0135 (0x00026A) 0x7265- f:00071 d: 101 | P = P - 101 (0x00D0)
0x0136 (0x00026C) 0x6374- f:00061 d: 372 | A = A & OR[B] | **** non-standard encoding with D:0x0174 ****
0x0137 (0x00026E) 0x6C79- f:00066 d: 121 | OR[B] = OR[B] + 1 | **** non-standard encoding with D:0x0079 ****
0x0138 (0x000270) 0x2E20- f:00027 d: 32 | OR[32] = OR[32] - 1
0x0139 (0x000272) 0x436F- f:00041 d: 367 | C = 1, io 0557 = BZ
0x013A (0x000274) 0x6D6D- f:00066 d: 365 | OR[B] = OR[B] + 1 | **** non-standard encoding with D:0x016D ****
0x013B (0x000276) 0x616E- f:00060 d: 366 | A = OR[B] | **** non-standard encoding with D:0x016E ****
0x013C (0x000278) 0x6420- f:00062 d: 32 | A = A + OR[B] | **** non-standard encoding with D:0x0020 ****
0x013D (0x00027A) 0x6162- f:00060 d: 354 | A = OR[B] | **** non-standard encoding with D:0x0162 ****
0x013E (0x00027C) 0x6F72- f:00067 d: 370 | OR[B] = OR[B] - 1 | **** non-standard encoding with D:0x0172 ****
0x013F (0x00027E) 0x7465- f:00072 d: 101 | R = P + 101 (0x01A4)
0x0140 (0x000280) 0x642E- f:00062 d: 46 | A = A + OR[B] | **** non-standard encoding with D:0x002E ****
0x0141 (0x000282) 0x0000- f:00000 d: 0 | PASS
0x0142 (0x000284) 0x0000- f:00000 d: 0 | PASS
0x0143 (0x000286) 0x0000- f:00000 d: 0 | PASS
| 87.52381 | 127 | 0.475843 |
c20b3003c611c61c4d5b858ae189101feba9a0d8 | 7,096 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0.log_21829_1852.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0.log_21829_1852.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0.log_21829_1852.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r14
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x14746, %rsi
lea addresses_WC_ht+0x1c546, %rdi
cmp %rax, %rax
mov $35, %rcx
rep movsb
nop
nop
inc %r14
lea addresses_WT_ht+0x18f46, %rsi
lea addresses_WC_ht+0xef46, %rdi
clflush (%rdi)
nop
nop
nop
inc %rax
mov $24, %rcx
rep movsq
nop
and $18251, %rdi
lea addresses_D_ht+0x8b06, %rax
nop
nop
nop
nop
add $40443, %r13
movw $0x6162, (%rax)
nop
nop
nop
nop
and $46958, %rdi
lea addresses_normal_ht+0xbd46, %rsi
lea addresses_WT_ht+0x19fbe, %rdi
clflush (%rsi)
nop
nop
cmp %r10, %r10
mov $69, %rcx
rep movsw
nop
nop
nop
nop
nop
xor %rax, %rax
lea addresses_WC_ht+0x8ca2, %rsi
lea addresses_WC_ht+0x14546, %rdi
nop
nop
nop
nop
nop
inc %r10
mov $4, %rcx
rep movsw
nop
nop
nop
xor %r13, %r13
lea addresses_normal_ht+0x16156, %r13
nop
nop
dec %rax
movw $0x6162, (%r13)
nop
sub $8650, %r14
lea addresses_A_ht+0xd46, %rcx
nop
nop
nop
nop
sub %rax, %rax
movb $0x61, (%rcx)
nop
nop
nop
nop
dec %rsi
lea addresses_normal_ht+0x74c6, %r10
nop
nop
nop
nop
add %rdi, %rdi
mov $0x6162636465666768, %r14
movq %r14, (%r10)
xor %rcx, %rcx
lea addresses_A_ht+0xb5de, %rsi
lea addresses_WC_ht+0x8f4e, %rdi
add %rbx, %rbx
mov $87, %rcx
rep movsl
nop
xor %r10, %r10
lea addresses_A_ht+0x11abe, %rsi
lea addresses_normal_ht+0x147c6, %rdi
nop
nop
nop
nop
cmp $23834, %r14
mov $14, %rcx
rep movsq
nop
cmp $37287, %rcx
lea addresses_normal_ht+0xda86, %rsi
lea addresses_WC_ht+0xaa46, %rdi
cmp $16956, %rbx
mov $75, %rcx
rep movsl
xor %rdi, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r14
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r15
push %r9
push %rbp
push %rcx
push %rdx
// Load
lea addresses_WT+0x4746, %rbp
clflush (%rbp)
nop
nop
nop
nop
nop
add $49781, %r9
mov (%rbp), %r13d
nop
dec %rbp
// Faulty Load
lea addresses_PSE+0x17546, %rcx
nop
nop
nop
dec %rdx
mov (%rcx), %r15w
lea oracles, %r9
and $0xff, %r15
shlq $12, %r15
mov (%r9,%r15,1), %r15
pop %rdx
pop %rcx
pop %rbp
pop %r9
pop %r15
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': True, 'same': True, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': True, 'size': 32}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_WT', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 8, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_WC_ht'}}
{'src': {'same': False, 'congruent': 7, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2}}
{'src': {'same': False, 'congruent': 7, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_WT_ht'}}
{'src': {'same': True, 'congruent': 2, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8}}
{'src': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}}
{'src': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_normal_ht'}}
{'src': {'same': True, 'congruent': 6, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_WC_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
*/
| 36.020305 | 2,999 | 0.661218 |
6c3c5b885b9b4a5aede2f187990dbf7458245ea7 | 25,778 | asm | Assembly | tetris.asm | hny-gd/arkowski-tetris | e5b192fab316efe3aa1d6177cce6a972d788cee5 | [
"MIT"
] | 1 | 2021-03-19T23:24:53.000Z | 2021-03-19T23:24:53.000Z | tetris.asm | hny-gd/arkowski-tetris | e5b192fab316efe3aa1d6177cce6a972d788cee5 | [
"MIT"
] | null | null | null | tetris.asm | hny-gd/arkowski-tetris | e5b192fab316efe3aa1d6177cce6a972d788cee5 | [
"MIT"
] | null | null | null | ;Frame parametres
frameHeight equ 8 * 20
frameWidth equ 8 * 10
frameBorderWidth equ 5
frameBeginningX equ 50
frameBeginningY equ 10
nextPieceFrameHeight equ 8 * 5
nextPieceFrameWidth equ 8 * 5
nextPieceFrameBorderWidth equ 5
nextPieceFrameBeginningX equ 155
nextPieceFrameBeginningY equ 10
boardColor equ 0
pieceSize equ 8
scorePosX equ 160
scorePosY equ 100
gameOverPosX equ 120
gameOverPosY equ 80
; waitFactor*usleepMS should be approx 1sec
; If usleepMS is too long, we will miss keyboard input
; If it is too short, keypresses will be counted several times
waitFactor equ 10
usleepMS equ 100000
section .data
gameOver: db "GAME OVER",0
scoreString: db "SCORE",0
section .bss
boardState: resb 20 * 10
nextPieceType: resb 1
pieceType: resb 1
pieceCol: resb 1
piecePos: resb 4
piecePivotPos: resb 1
temporaryPiecePos: resb 4
waitTime: resb 1
score: resw 1
scoreAsString: resb 6 ; 5 digits+0
extern gl_write,gl_setfont,gl_font8x8,gl_setfontcolors,gl_setwritemode,vga_init,vga_setmode,vga_setcolor,gl_fillbox,gl_setcontextvga,vga_getkey,usleep,rand
extern exit,keyboard_init,keyboard_translatekeys,keyboard_update,keyboard_keypressed,keyboard_close
section .text
global main
main:
;Initialization
sub rsp,8
call vga_init
mov rdi, 5 ; SVGALIB 5 = 320x200x256 (see vga.h)
call vga_setmode
mov rdi, 5 ; we need to init vgagl with the same mode
call gl_setcontextvga
mov rdi,8
mov rsi,8
mov rdx, [gl_font8x8]
call gl_setfont ; see man gl_write(3)
mov rdi,2
call gl_setwritemode
mov rdi, 0
mov rsi, 15
call gl_setfontcolors
call keyboard_init
mov rdi, 7
call drawFrame
call drawNextPieceFrame
jmp gameInProgres
endOfGame:
call delayForLongWhile
call displayGameOver
call delayForLongWhile
;Return to previous video mode
call keyboard_close
mov rdi, 0
call vga_setmode
;Finish program
; we can not simply call return because we might be called from within
; gameInProgress
mov rdi, 0
call exit
;/////DRAWING FUNCTIONS////
;////////////////////////////////////////////////////////////
;Draw Rectangle, rax - begin point, rcx - Height, rbx - Width, rdi - color
drawRect:
xor rdx, rdx ; clear dx for ax division
push rdi ; Save colour
push rcx ; Save height for later
mov rcx, 320 ; divisor in cx
div cx ; divide begin point/320 so we get y in ax and x in dx (remainder)
mov rdi, rdx ; x1 (param 1)
mov rsi, rax ; y1 (param 2)
mov rdx, rbx ; width (param 3)
pop rcx ; height (param 4, fetch again from stack)
pop r8 ; Pass colour
call gl_fillbox
mov rdi, r8 ; ...and restore colour
ret
;////////////////////////////////////////////////////////////
drawFrame:
mov rdi, 7 ; colour
;Gora
mov rax, frameBeginningY * 320 + frameBeginningX
mov rcx, frameBorderWidth
mov rbx, frameWidth + 2 * frameBorderWidth
call drawRect
;Lewa
mov rax, (frameBeginningY + frameBorderWidth) * 320 + frameBeginningX
mov rcx, frameHeight
mov rbx, frameBorderWidth
call drawRect
;Prawa
mov rax, (frameBeginningY + frameBorderWidth) * 320 + frameBeginningX + frameWidth + frameBorderWidth
mov rcx, frameHeight
mov rbx, frameBorderWidth
call drawRect
;Dol
mov rax, (frameBeginningY + frameHeight + frameBorderWidth) * 320 + frameBeginningX
mov rcx, frameBorderWidth
mov rbx, frameWidth + 2 * frameBorderWidth
call drawRect
ret
;////////////////////////////////////////////////////////////
drawNextPieceFrame:
mov rdi, 7
;Gora
mov rax, nextPieceFrameBeginningY * 320 + nextPieceFrameBeginningX
mov rcx, nextPieceFrameBorderWidth
mov rbx, nextPieceFrameWidth + 2 * nextPieceFrameBorderWidth
call drawRect
;Lewa
mov rax, (nextPieceFrameBeginningY + nextPieceFrameBorderWidth) * 320 + nextPieceFrameBeginningX
mov rcx, nextPieceFrameHeight
mov rbx, nextPieceFrameBorderWidth
call drawRect
;Prawa
mov rax, (nextPieceFrameBeginningY + nextPieceFrameBorderWidth) * 320 + nextPieceFrameBeginningX + nextPieceFrameWidth + nextPieceFrameBorderWidth
mov rcx, nextPieceFrameHeight
mov rbx, nextPieceFrameBorderWidth
call drawRect
;Dol
mov rax, (nextPieceFrameBeginningY + nextPieceFrameHeight + nextPieceFrameBorderWidth) * 320 + nextPieceFrameBeginningX
mov rcx, nextPieceFrameBorderWidth
mov rbx, nextPieceFrameWidth + 2 * nextPieceFrameBorderWidth
call drawRect
ret
;////////////////////////////////////////////////////////////
drawBoardState:
mov rbx, 200
drawBoardStateLoop1:
dec rbx
push rbx
movzx rdi, byte[boardState + rbx]
mov rax, rbx
call drawOneSquare
pop rbx
cmp rbx, 0
jne drawBoardStateLoop1
ret
;////////////////////////////////////////////////////////////
clearBoard:
mov rax, (frameBeginningY + frameBorderWidth) * 320 + frameBeginningX + frameBorderWidth
mov rcx, frameHeight
mov rbx, frameWidth
mov rdi, boardColor
call drawRect
ret
;////////////////////////////////////////////////////////////
drawTetromino:
movzx rax, byte[piecePos]
movzx rdi, byte[pieceCol]
call drawOneSquare
movzx rax, byte[piecePos + 1]
movzx rdi, byte[pieceCol]
call drawOneSquare
movzx rax, byte[piecePos + 2]
movzx rdi, byte[pieceCol]
call drawOneSquare
movzx rax, byte[piecePos + 3]
movzx rdi, byte[pieceCol]
call drawOneSquare
ret
;////////////////////////////////////////////////////////////
;rax - PieceNumber, rdi - color
drawOneSquare:
mov BL, 10
div BL
;AH - X, AL - Y
mov CX, AX
;Calculate Y offset
mov AL, CL
xor AH, AH
mov BX, 320 * pieceSize
mul BX
push rax
;Calculate X offset
mov AL, CH
xor AH, AH
mov BX, pieceSize
mul BX
pop rdx
;Move to fit frame
add AX, DX
add AX, (frameBeginningY + frameBorderWidth) * 320 + frameBeginningX + frameBorderWidth
mov BX, pieceSize
mov CX, pieceSize
jmp drawRect
;/////GAME FUNCTIONS////
;////////////////////////////////////////////////////////////
gameInProgres: ;-TO DO
mov byte[waitTime], waitFactor
call generateNextPieceNumber
placeNext:
call updateBoard
call generateNextPiece
call generateNextPieceNumber
call setNewDelay
call writeScore
jmp checkIfNotEnd
pieceInProgress:
call clearBoard
call drawBoardState
call drawTetromino
call scoreToString
call getPlayerInput
cmp AX, 0x0F0F
;AX = FFFF - Place Next Piece
cmp AX, 0xFFFF
je placeNext
call moveOneDown
cmp AX, 0xFFFF
je placeNext
jmp pieceInProgress
;---------
checkIfNotEnd:
movzx rbx, byte[piecePos]
mov AL, [boardState + rbx]
cmp AL, boardColor
jne endOfGame
movzx rbx, byte[piecePos + 1]
movzx rax, byte[boardState + rbx]
cmp AL, boardColor
jne endOfGame
movzx rbx, byte[piecePos + 2]
movzx rax, byte[boardState + rbx]
cmp AL, boardColor
jne endOfGame
movzx rbx, byte[piecePos + 3]
movzx rax, byte[boardState + rbx]
cmp AL, boardColor
jne endOfGame
jmp pieceInProgress
;////////////////////////////////////////////////////////////
getPlayerInput:
movzx rcx, byte[waitTime]
waitForKey:
dec CX
cmp CX, 0
je noInput
; We need to run this in a loop with frequent polling.
; If we just check every second or so if a keyboard has been pressed,
; we miss out on key events with keyboard_update from svgalib
push rcx ; we need to save the loop counter across the svgalib calls
; the various push/pops are not super-elegant, yes, I know...
call delayForWhile
; we need to ensure that we don't call this too frequently
; otherwise the same keypress is returned again
call keyboard_update
pop rcx
mov rdi, 75 ;SCANCODE_CURSORLEFT
push rcx
call keyboard_keypressed
pop rcx
cmp rax, 0
jne moveOneLeft
mov rdi, 97 ;SCANCODE_CURSORBLOCKLEFT
push rcx
call keyboard_keypressed
pop rcx
cmp rax, 0
jne moveOneLeft
mov rdi, 80 ;SCANCODE_CURSORSDOWN
push rcx
call keyboard_keypressed
pop rcx
cmp rax, 0
jne downKey
mov rdi, 100 ;SCANCODE_CURSORBLOCKDOWN
push rcx
call keyboard_keypressed
pop rcx
cmp rax, 0
jne downKey
mov rdi, 77 ;SCANCODE_CURSORRIGHT
push rcx
call keyboard_keypressed
pop rcx
cmp rax, 0
jne moveOneRight
mov rdi, 98 ;SCANCODE_CURSORBLOCKRIGHT
push rcx
call keyboard_keypressed
pop rcx
cmp rax, 0
jne moveOneRight
mov rdi, 72 ;SCANCODE_CURSORUP
push rcx
call keyboard_keypressed
pop rcx
cmp rax, 0
jne rotateCounterClockwise
mov rdi, 95 ;SCANCODE_CURSORBLOCKUP
push rcx
call keyboard_keypressed
pop rcx
cmp rax, 0
jne rotateCounterClockwise
mov rdi, 76 ;SCANCODE_KEYPAD5
push rcx
call keyboard_keypressed
pop rcx
cmp rax, 0
jne rotateClockwise
mov rdi, 1 ;SCANCODE_ESCAPE
push rcx
call keyboard_keypressed
pop rcx
cmp rax, 0
jne endOfGame
jmp waitForKey
noInput:
xor rax, rax
ret
downKey:
inc word[score]
call moveOneDown
xor rax, rax
ret
;////////////////////////////////////////////////////////////
generateNextPieceNumber:
mov rax, (nextPieceFrameBeginningY + nextPieceFrameBorderWidth) * 320 + nextPieceFrameBeginningX + nextPieceFrameBorderWidth
mov rcx, nextPieceFrameHeight
mov rbx, nextPieceFrameWidth
mov rdi, boardColor
call drawRect
; Random for next piece
call rand
xor DX, DX
mov CX, 7
div CX
mov byte[nextPieceType], DL
mov AH, DL ; DOS Code expects next piece type in AH...
genFirstPiece: ;I
cmp AH, 0
jne genSecondPiece
mov rax, (nextPieceFrameBeginningY + nextPieceFrameBorderWidth + 2 * pieceSize) * 320 + nextPieceFrameBeginningX + nextPieceFrameBorderWidth + 4
mov rcx, pieceSize
mov rbx, 4 * pieceSize
mov rdi, 52
call drawRect
ret
genSecondPiece: ;J
cmp AH, 1
jne genThirdPiece
mov rax, (nextPieceFrameBeginningY + nextPieceFrameBorderWidth + pieceSize + 4) * 320 + nextPieceFrameBeginningX + nextPieceFrameBorderWidth + pieceSize
mov rcx, pieceSize
mov rbx, 3 * pieceSize
mov rdi, 32
call drawRect
mov rax, (nextPieceFrameBeginningY + nextPieceFrameBorderWidth + 2 * pieceSize + 4) * 320 + nextPieceFrameBeginningX + nextPieceFrameBorderWidth + 3 * pieceSize
mov rcx, pieceSize
mov rbx, pieceSize
mov rdi, 32
call drawRect
ret
genThirdPiece: ;L
cmp AH, 2
jne genForthPiece
mov rax, (nextPieceFrameBeginningY + nextPieceFrameBorderWidth + pieceSize + 4) * 320 + nextPieceFrameBeginningX + nextPieceFrameBorderWidth + pieceSize
mov rcx, pieceSize
mov rbx, 3 * pieceSize
mov rdi, 43
call drawRect
mov rax, (nextPieceFrameBeginningY + nextPieceFrameBorderWidth + 2 * pieceSize + 4) * 320 + nextPieceFrameBeginningX + nextPieceFrameBorderWidth + pieceSize
mov rcx, pieceSize
mov rbx, pieceSize
mov rdi, 43
call drawRect
ret
genForthPiece: ;O
cmp AH, 3
jne genFifthPiece
mov rax, (nextPieceFrameBeginningY + nextPieceFrameBorderWidth + pieceSize + 4) * 320 + nextPieceFrameBeginningX + nextPieceFrameBorderWidth + pieceSize + 4
mov rcx, 2 * pieceSize
mov rbx, 2 * pieceSize
mov rdi, 45
call drawRect
ret
genFifthPiece: ;S
cmp AH, 4
jne genSixthPiece
mov rax, (nextPieceFrameBeginningY + nextPieceFrameBorderWidth + pieceSize + 4) * 320 + nextPieceFrameBeginningX + nextPieceFrameBorderWidth + 2 * pieceSize
mov rcx, pieceSize
mov rbx, 2 * pieceSize
mov rdi, 48
call drawRect
mov rax, (nextPieceFrameBeginningY + nextPieceFrameBorderWidth + 2 * pieceSize + 4) * 320 + nextPieceFrameBeginningX + nextPieceFrameBorderWidth + pieceSize
mov rcx, pieceSize
mov rbx, 2 * pieceSize
mov rdi, 48
call drawRect
ret
genSixthPiece: ;T
cmp AH, 5
jne genSeventhPiece
mov rax, (nextPieceFrameBeginningY + nextPieceFrameBorderWidth + pieceSize + 4) * 320 + nextPieceFrameBeginningX + nextPieceFrameBorderWidth + pieceSize
mov rcx, pieceSize
mov rbx, 3 * pieceSize
mov rdi, 34
call drawRect
mov rax, (nextPieceFrameBeginningY + nextPieceFrameBorderWidth + 2 * pieceSize + 4) * 320 + nextPieceFrameBeginningX + nextPieceFrameBorderWidth + 2 * pieceSize
mov rcx, pieceSize
mov rbx, pieceSize
mov rdi, 34
call drawRect
ret
genSeventhPiece: ;Z
mov rax, (nextPieceFrameBeginningY + nextPieceFrameBorderWidth + pieceSize + 4) * 320 + nextPieceFrameBeginningX + nextPieceFrameBorderWidth + pieceSize
mov rcx, pieceSize
mov rbx, 2 * pieceSize
mov rdi, 40
call drawRect
mov rax, (nextPieceFrameBeginningY + nextPieceFrameBorderWidth + 2 * pieceSize + 4) * 320 + nextPieceFrameBeginningX + nextPieceFrameBorderWidth + 2 * pieceSize
mov rcx, pieceSize
mov rbx, 2 * pieceSize
mov rdi, 40
call drawRect
ret
;---------------------
generateNextPiece:
mov AH, byte[nextPieceType]
mov byte[pieceType], AH
mov byte[piecePivotPos], 3
firstPiece: ;I
cmp AH, 0
jne secondPiece
mov byte[piecePos], 13
mov byte[piecePos + 1], 14
mov byte[piecePos + 2], 15
mov byte[piecePos + 3], 16
mov byte[pieceCol], 52
ret
secondPiece: ;J
cmp AH, 1
jne thirdPiece
mov byte[piecePos], 13
mov byte[piecePos + 1], 14
mov byte[piecePos + 2], 15
mov byte[piecePos + 3], 25
mov byte[pieceCol], 32
ret
thirdPiece: ;L
cmp AH, 2
jne forthPiece
mov byte[piecePos], 13
mov byte[piecePos + 1], 14
mov byte[piecePos + 2], 15
mov byte[piecePos + 3], 23
mov byte[pieceCol], 43
ret
forthPiece: ;O
cmp AH, 3
jne fifthPiece
mov byte[piecePos], 14
mov byte[piecePos + 1], 15
mov byte[piecePos + 2], 24
mov byte[piecePos + 3], 25
mov byte[pieceCol], 45
ret
fifthPiece: ;S
cmp AH, 4
jne sixthPiece
mov byte[piecePos], 14
mov byte[piecePos + 1], 15
mov byte[piecePos + 2], 23
mov byte[piecePos + 3], 24
mov byte[pieceCol], 48
ret
sixthPiece: ;T
cmp AH, 5
jne seventhPiece
mov byte[piecePos], 13
mov byte[piecePos + 1], 14
mov byte[piecePos + 2], 15
mov byte[piecePos + 3], 24
mov byte[pieceCol], 34
ret
seventhPiece: ;Z
mov byte[piecePos], 13
mov byte[piecePos + 1], 14
mov byte[piecePos + 2], 24
mov byte[piecePos + 3], 25
mov byte[pieceCol], 40
ret
;///////////////////////////////////////////////////////////
solidifyPiece:
movzx rbx, byte[piecePos]
mov AL, byte[pieceCol]
mov byte[boardState + rbx], AL
movzx rbx, byte[piecePos + 1]
mov byte[boardState + rbx], AL
movzx rbx, byte[piecePos + 2]
mov byte[boardState + rbx], AL
movzx rbx, byte[piecePos + 3]
mov byte[boardState + rbx], AL
ret
;///////////////// - TO DO
updateBoard:
mov DL, 20
updateBoardLoop:
dec DL
call clearOneRow
cmp DL, 0
jne updateBoardLoop
ret
clearOneRow:
;DL - row To clear
mov BL, 10
mov AL, DL
mul BL
xor rbx, rbx
mov BX, AX
mov CX, 10
clearOneRowLoop1:
cmp byte[boardState + rbx], boardColor
je notclearOneRow
inc BX
loop clearOneRowLoop1
add word[score], 100
cmp DL, 0
je notclearOneRow
push rdx
clearOneRowLoop2:
dec DL
call moveRowDown
cmp DL, 1
jne clearOneRowLoop2
pop rdx
jmp clearOneRow
notclearOneRow:
ret
moveRowDown:
;DL - beginRow
mov BL, 10
mov AL, DL
mul BL
xor rbx, rbx
mov BX, AX
mov CX, 10
moveRowDownLoop:
mov AL, byte[boardState + rbx]
mov byte[boardState + rbx + 10], AL
mov byte[boardState + rbx], boardColor
inc BX
loop moveRowDownLoop
ret
;///////////////// - TO DO
moveOneDown:
xor rax, rax
mov rbx, 10
xor DL, DL
;Check Frame Collision
cmp byte[piecePos], 19 * 10
jae cantMoveOneDown
cmp byte[piecePos + 1], 19 * 10
jae cantMoveOneDown
cmp byte[piecePos + 2], 19 * 10
jae cantMoveOneDown
cmp byte[piecePos + 3], 19 * 10
jae cantMoveOneDown
;Check Space Collsion
xor rbx, rbx
mov BL, byte[piecePos]
add BL, 10
cmp byte[boardState + rbx], boardColor
jne cantMoveOneDown
mov BL, byte[piecePos + 1]
add BL, 10
cmp byte[boardState + rbx], boardColor
jne cantMoveOneDown
mov BL, byte[piecePos + 2]
add BL, 10
cmp byte[boardState + rbx], boardColor
jne cantMoveOneDown
mov BL, byte[piecePos + 3]
add BL, 10
cmp byte[boardState + rbx], boardColor
jne cantMoveOneDown
add byte[piecePos], 10
add byte[piecePos + 1], 10
add byte[piecePos + 2], 10
add byte[piecePos + 3], 10
add byte[piecePivotPos], 10
xor rax, rax
ret
cantMoveOneDown:
call solidifyPiece
mov rax, 0xFFFF
ret
;-----------------------------------
moveOneLeft:
mov BL, 10
;Check Frame Collision
xor AX, AX
mov AL, byte[piecePos]
div BL
cmp AH, 0
je cantMoveOneLeft
xor AX, AX
mov AL, byte[piecePos + 1]
div BL
cmp AH, 0
je cantMoveOneLeft
xor AX, AX
mov AL, byte[piecePos + 2]
div BL
cmp AH, 0
je cantMoveOneLeft
xor AX, AX
mov AL, byte[piecePos + 3]
div BL
cmp AH, 0
je cantMoveOneLeft
;Check Space Collsion
xor rbx, rbx
mov BL, byte[piecePos]
dec BL
cmp byte[boardState + rbx], boardColor
jne cantMoveOneLeft
mov BL, byte[piecePos + 1]
dec BL
cmp byte[boardState + rbx], boardColor
jne cantMoveOneLeft
mov BL, byte[piecePos + 2]
dec BL
cmp byte[boardState + rbx], boardColor
jne cantMoveOneLeft
mov BL, byte[piecePos + 3]
dec BL
cmp byte[boardState + rbx], boardColor
jne cantMoveOneLeft
dec byte[piecePos]
dec byte[piecePos + 1]
dec byte[piecePos + 2]
dec byte[piecePos + 3]
dec byte[piecePivotPos]
cantMoveOneLeft:
xor AX, AX
ret
;-----------------------------------
moveOneRight:
mov BL, 10
;Check Frame Collision
xor AX, AX
mov AL, byte[piecePos]
div BL
cmp AH, 9
je cantMoveOneRight
xor AX, AX
mov AL, byte[piecePos + 1]
div BL
cmp AH, 9
je cantMoveOneRight
xor AX, AX
mov AL, byte[piecePos + 2]
div BL
cmp AH, 9
je cantMoveOneRight
xor AX, AX
mov AL, byte[piecePos + 3]
div BL
cmp AH, 9
je cantMoveOneRight
;Check Space Collsion
xor rbx, rbx
mov BL, byte[piecePos]
inc BL
cmp byte[boardState + rbx], boardColor
jne cantMoveOneRight
mov BL, byte[piecePos + 1]
inc BL
cmp byte[boardState + rbx], boardColor
jne cantMoveOneRight
mov BL, byte[piecePos + 2]
inc BL
cmp byte[boardState + rbx], boardColor
jne cantMoveOneRight
mov BL, byte[piecePos + 3]
inc BL
cmp byte[boardState + rbx], boardColor
jne cantMoveOneRight
inc byte[piecePos]
inc byte[piecePos + 1]
inc byte[piecePos + 2]
inc byte[piecePos + 3]
inc byte[piecePivotPos]
cantMoveOneRight:
ret
rotateClockwise:
;CheckBoard
mov rbx, 4
rotateClockwiseLoop1:
dec BX
push rbx
xor AX, AX
mov BL, 10
mov AL, byte[piecePivotPos]
div BL
pop rbx
cmp AH, 0
jb cantRotateClockwise
cmp AH, 6
ja cantRotateClockwise
cmp AL, 16
ja cantRotateClockwise
mov CX, AX
xor AX, AX
mov AL, byte[piecePos + rbx]
push rbx
mov BL, 10
sub AL, byte[piecePivotPos]
div BL
mov DX, AX
;AH - X, AL - Y
mov AH, DL
cmp byte[pieceType], 0
je rotateClockwiseSpc
mov AL, 3
rotateClockwiseSpcBack:
sub AL, DH
mov DX, AX
mov AL, DL
mov BL, 10
mul BL
add AL, DH
pop rbx
add AL, byte[piecePivotPos]
mov byte[temporaryPiecePos + rbx], AL
cmp BX, 0
jne rotateClockwiseLoop1
xor rbx, rbx
mov BL, byte[temporaryPiecePos]
cmp byte[boardState + rbx], boardColor
jne cantRotateClockwise
mov BL, byte[temporaryPiecePos + 1]
cmp byte[boardState + rbx], boardColor
jne cantRotateClockwise
mov BL, byte[temporaryPiecePos + 2]
cmp byte[boardState + rbx], boardColor
jne cantRotateClockwise
mov BL, byte[temporaryPiecePos + 3]
cmp byte[boardState + rbx], boardColor
jne cantRotateClockwise
mov AL, byte[temporaryPiecePos]
mov byte[piecePos], AL
mov AL, byte[temporaryPiecePos + 1]
mov byte[piecePos + 1], AL
mov AL, byte[temporaryPiecePos + 2]
mov byte[piecePos + 2], AL
mov AL, byte[temporaryPiecePos + 3]
mov byte[piecePos + 3], AL
cantRotateClockwise:
xor AX, AX
ret
rotateClockwiseSpc:
mov AL, 4
jmp rotateClockwiseSpcBack
;/////////////////
rotateCounterClockwise:
;CheckBoard
mov rbx, 4
rotateCounterClockwiseLoop1:
dec BX
push rbx
xor AX, AX
mov BL, 10
mov AL, byte[piecePivotPos]
div BL
pop rbx
cmp AH, 0
jb cantRotateCounterClockwise
cmp AH, 6
ja cantRotateCounterClockwise
cmp AL, 16
ja cantRotateCounterClockwise
mov CX, AX
xor AX, AX
mov AL, byte[piecePos + rbx]
push rbx
mov BL, 10
sub AL, byte[piecePivotPos]
div BL
mov DX, AX
;AH - X, AL - Y
mov AL, DH
cmp byte[pieceType], 0
je rotateCounterClockwiseSpc
mov AH, 3
rotateCounterClockwiseSpcBack:
sub AH, DL
mov DX, AX
mov AL, DL
mov BL, 10
mul BL
add AL, DH
pop rbx
add AL, byte[piecePivotPos]
mov byte[temporaryPiecePos + rbx], AL
cmp BX, 0
jne rotateCounterClockwiseLoop1
;xor BX, BX
movzx r8, byte[temporaryPiecePos]
cmp byte[boardState + r8], boardColor
jne cantRotateCounterClockwise
movzx r8, byte[temporaryPiecePos + 1]
cmp byte[boardState + r8], boardColor
jne cantRotateCounterClockwise
movzx r8, byte[temporaryPiecePos + 2]
cmp byte[boardState + r8], boardColor
jne cantRotateCounterClockwise
movzx r8, byte[temporaryPiecePos + 3]
cmp byte[boardState + r8], boardColor
jne cantRotateCounterClockwise
mov AL, byte[temporaryPiecePos]
mov byte[piecePos], AL
mov AL, byte[temporaryPiecePos + 1]
mov byte[piecePos + 1], AL
mov AL, byte[temporaryPiecePos + 2]
mov byte[piecePos + 2], AL
mov AL, byte[temporaryPiecePos + 3]
mov byte[piecePos + 3], AL
cantRotateCounterClockwise:
xor AX, AX
ret
rotateCounterClockwiseSpc:
mov AH, 4
jmp rotateCounterClockwiseSpcBack
;/////////////////
;Delay for one/10 second (loop in input is 10 times)
delayForWhile:
mov rdi, usleepMS
call usleep
ret
;--------------------
delayForLongWhile:
mov rdi, 0x000F8480
call usleep
ret
;/////////////////
setNewDelay:
cmp byte[waitTime], 1
jb noSetNewDelat
mov AX, word[score]
xor DX, DX
mov BX, 1000
div BX
mov DX, AX
mov AX, 10
cmp AX, DX
jl set1Delay
sub AX, DX
mov byte[waitTime], AL
noSetNewDelat:
ret
set1Delay:
mov byte[waitTime], 1
ret
;/////////////////
scoreToString:
xor DX, DX
mov AX, word[score]
mov BX, 10000
div BX
add AX, 48
mov byte[scoreAsString], AL
mov AX, DX
xor DX, DX
mov BX, 1000
div BX
add AX, 48
mov byte[scoreAsString + 1], AL
mov AX, DX
xor DX, DX
mov BX, 100
div BX
add AX, 48
mov byte[scoreAsString + 2], AL
mov AX, DX
xor DX, DX
mov BX, 10
div BX
add AX, 48
mov byte[scoreAsString + 3], AL
add DX, 48
mov byte[scoreAsString + 4], DL
mov byte[scoreAsString + 5], 0 ; 0 for C string end
mov BX, 5
mov DL, 24
mov rdi, scorePosX
mov rsi, scorePosY-15
mov rdx, scoreString
call gl_write
mov rdi, scorePosX ; x of position
mov rsi, scorePosY ; y of position
mov rdx, scoreAsString ; position of string (=1 character)
call gl_write
ret
;////////////////////////
writeScore:
mov rdi, scorePosX
mov rsi, scorePosY-15
mov rdx, scoreString
call gl_write
mov rdi, scorePosX ; x of position
mov rsi, scorePosY ; y of position
mov rdx, scoreAsString ; position of string (=1 character)
call gl_write
ret
;----------------
displayGameOver:
xor rax, rax
mov rcx, 200
mov rbx, 320
mov rdi, boardColor
call drawRect
mov rdi, gameOverPosX ; x of position
mov rsi, gameOverPosY ; y of position
mov rdx, gameOver ; position of string (=1 character)
call gl_write
ret
| 22.474281 | 164 | 0.616301 |
eca1089707d9e0e6ae3ca10a97339b9c6bd0280b | 408 | asm | Assembly | data/items/plate_items.asm | AtmaBuster/pokeplat-gen2 | fa83b2e75575949b8f72cb2c48f7a1042e97f70f | [
"blessing"
] | 6 | 2021-06-19T06:41:19.000Z | 2022-02-15T17:12:33.000Z | data/items/plate_items.asm | AtmaBuster/pokeplat-gen2-old | 01e42c55db5408d72d89133dc84a46c699d849ad | [
"blessing"
] | null | null | null | data/items/plate_items.asm | AtmaBuster/pokeplat-gen2-old | 01e42c55db5408d72d89133dc84a46c699d849ad | [
"blessing"
] | 3 | 2021-01-15T18:45:40.000Z | 2021-10-16T03:35:27.000Z | PlateItems:
db DRACO_PLATE, DRAGON
db DREAD_PLATE, DARK
db EARTH_PLATE, GROUND
db FIST_PLATE, FIGHTING
db FLAME_PLATE, FIRE
db ICICLE_PLATE, ICE
db INSECT_PLATE, BUG
db IRON_PLATE, STEEL
db MEADOW_PLATE, GRASS
db MIND_PLATE, PSYCHIC
db SKY_PLATE, FLYING
db SPLASH_PLATE, WATER
db SPOOKY_PLATE, GHOST
db STONE_PLATE, ROCK
db TOXIC_PLATE, POISON
db ZAP_PLATE, ELECTRIC
db -1
| 21.473684 | 26 | 0.745098 |
170e62a6bf20f8fc75eedca76c3729f80ea815ea | 761 | asm | Assembly | oeis/127/A127394.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/127/A127394.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/127/A127394.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A127394: Number of irreducible representations of Sp(2n,R) with same infinitesimal character as the trivial representation.
; Submitted by Christian Krause
; 4,18,88,460,2544,14776,89632,565392,3695680,24959776,173752704,1244125888,9146568448,68933546880,531838104064,4195358822656,33800254620672,277843218452992,2328182040156160,19870770461838336,172610363453599744,1525013813211609088,13694911244804825088,124930280386953318400,1157076861298444877824,10874821464541445431296,103667282645684915372032,1001909489667977714778112,9813005786830266119946240,97362773548063771936915456,978231441402071054944436224,9949417725588238079866503168
add $0,1
mov $3,1
lpb $0
sub $0,1
mul $3,2
mov $2,$3
mul $2,$0
mul $3,2
add $3,$1
mov $1,$2
lpe
mov $0,$3
| 44.764706 | 481 | 0.834428 |
e246ad1618a2ff056e3a5ef79cf67b19270305cc | 278 | asm | Assembly | libsrc/_DEVELOPMENT/adt/p_forward_list_alt/c/sdcc_iy/p_forward_list_alt_pop_front_fastcall.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/adt/p_forward_list_alt/c/sdcc_iy/p_forward_list_alt_pop_front_fastcall.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/adt/p_forward_list_alt/c/sdcc_iy/p_forward_list_alt_pop_front_fastcall.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null |
; void *p_forward_list_alt_pop_front_fastcall(p_forward_list_alt_t *list)
SECTION code_adt_p_forward_list_alt
PUBLIC _p_forward_list_alt_pop_front_fastcall
_p_forward_list_alt_pop_front_fastcall:
INCLUDE "adt/p_forward_list_alt/z80/asm_p_forward_list_alt_pop_front.asm"
| 25.272727 | 76 | 0.888489 |
3ad394efcb7f4e722d147bd8f8889c16ef03bc3a | 576 | asm | Assembly | libsrc/_DEVELOPMENT/target/scz180/device/csio/z180/csio_sd_write_byte.asm | Frodevan/z88dk | f27af9fe840ff995c63c80a73673ba7ee33fffac | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/target/scz180/device/csio/z180/csio_sd_write_byte.asm | Frodevan/z88dk | f27af9fe840ff995c63c80a73673ba7ee33fffac | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/target/scz180/device/csio/z180/csio_sd_write_byte.asm | Frodevan/z88dk | f27af9fe840ff995c63c80a73673ba7ee33fffac | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
INCLUDE "config_private.inc"
SECTION code_driver
EXTERN l_mirror
PUBLIC asm_sd_write_byte
;Do a write bus cycle to the SD drive, via the CSIO
;
;input L = byte to write to SD drive
.asm_sd_write_byte
ld a,l
call l_mirror ; reverse the bits before we busy wait
.sd_write_wait
in0 a,(CNTR)
tst CNTR_TE|CNTR_RE ; check the CSIO is not enabled
jr NZ,sd_write_wait
or a,CNTR_TE ; set TE bit
out0 (TRDR),l ; load (reversed) byte to transmit
out0 (CNTR),a ; enable transmit
ret
| 22.153846 | 66 | 0.631944 |
25e63bb5a50ff05c00743bea7cb23e06e210e014 | 1,457 | asm | Assembly | tests/exec/gdt/gdt.asm | ykskb/dax86 | d7c90afb4a306f04bd840da2b32faedec01bef93 | [
"MIT"
] | 12 | 2020-09-17T13:33:24.000Z | 2022-03-13T21:48:52.000Z | tests/exec/gdt/gdt.asm | ykusakabe/dax86 | d7c90afb4a306f04bd840da2b32faedec01bef93 | [
"MIT"
] | 2 | 2020-07-03T03:12:01.000Z | 2021-06-11T00:31:19.000Z | tests/exec/gdt/gdt.asm | ykusakabe/dax86 | d7c90afb4a306f04bd840da2b32faedec01bef93 | [
"MIT"
] | 5 | 2020-07-04T16:59:29.000Z | 2021-11-26T17:14:07.000Z | BITS 16
org 0x7c00
load_gdt:
lgdt [GDT_DESC] ; 0F 01 15 (14 7C 00 00): 15=21: 000 10(op) 101(r/m)
; xgetbv ; 0F 01 D0: D0(so): 110 10(op) 000(r/m)
; xsetbv ; 0F 01 D1: D1(so): 110 10(op) 001(r/m)
; monitor ; 0F 01 C8: C8(so): 110 01(op) 000(r/m)
; mwait ; 0F 01 C9: C9=201: 110 01(op) 001(r/m)
; Enable Protected Mode: PE bit on CR0
mov eax, cr0
or eax, 1
mov cr0, eax
jmp 8:pe_enter ; 1000b
BITS 32
pe_enter:
mov dword eax, 0x10 ; 10000b
mov ss, ax
push 0xFFFF
jmp 0 ; E9 (F4 83 FF FF)
; FF FF 00 00 00 92 CF 00
GDT:
; null segment descriptor
dw 0
dw 0
db 0
db 0
db 0
db 0
; code segment descriptor
; 0000 FFFF
; 00CF 9800
dw 0xFFFF ; limit low
dw 0 ; base low
db 0 ; base middle
db 10011000b ; access
db 11001111b ; limit + flags
db 0 ; base high
; data segment descriptor
; 0000 FFFF
; 00CF 9200
dw 0xFFFF ; limit low
dw 0 ; base low
db 0 ; base middle
db 10010010b ; access
db 11001111b ; limit + flags
db 0 ; base high
; 07 00 0C 7C 00 00
GDT_DESC:
dw (GDT_DESC - GDT - 1)
dd GDT
GDT_TEST:
dw 0xFFFF ; limit low
dw 0x5678 ; base low
db 0x34 ; base middle
db 10010010b ; access
db 11001111b ; limit + flags
db 0x12 ; base high | 22.765625 | 72 | 0.527111 |
1dc0b0fa6f0dca7f944d869c18017de50d9c145a | 888 | asm | Assembly | programs/oeis/022/A022397.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/022/A022397.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/022/A022397.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A022397: Fibonacci sequence beginning 1, 27.
; 1,27,28,55,83,138,221,359,580,939,1519,2458,3977,6435,10412,16847,27259,44106,71365,115471,186836,302307,489143,791450,1280593,2072043,3352636,5424679,8777315,14201994,22979309,37181303,60160612,97341915,157502527,254844442,412346969,667191411,1079538380,1746729791,2826268171,4572997962,7399266133,11972264095,19371530228,31343794323,50715324551,82059118874,132774443425,214833562299,347608005724,562441568023,910049573747,1472491141770,2382540715517,3855031857287,6237572572804,10092604430091,16330177002895,26422781432986,42752958435881,69175739868867,111928698304748,181104438173615,293033136478363,474137574651978,767170711130341,1241308285782319,2008478996912660,3249787282694979,5258266279607639,8508053562302618
mov $2,1
mov $3,1
lpb $0,1
sub $0,1
mov $1,26
add $1,$3
add $3,$2
mov $2,$1
lpe
add $1,$2
add $1,1
div $1,2
| 55.5 | 721 | 0.836712 |
a4762b073af3a333e61d7be8ff27544ee2d5add9 | 522 | asm | Assembly | programs/oeis/312/A312472.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/312/A312472.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/312/A312472.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A312472: Coordination sequence Gal.6.149.6 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; 1,4,8,14,18,22,26,30,34,40,44,48,52,56,62,66,70,74,78,82,88,92,96,100,104,110,114,118,122,126,130,136,140,144,148,152,158,162,166,170,174,178,184,188,192,196,200,206,210,214
mul $0,2
mov $1,$0
mul $0,2
add $0,6
mov $3,$1
mov $1,1
trn $1,$3
mov $2,$3
lpb $0
sub $0,5
sub $0,$2
trn $0,6
mul $3,2
add $1,$3
trn $2,$1
mov $3,1
lpe
| 24.857143 | 177 | 0.662835 |
734e1b7a4ea375b1075df28783210c09e2d5845b | 492 | asm | Assembly | oeis/121/A121699.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/121/A121699.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/121/A121699.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A121699: Floor((prime(n+1)/prime(n))^n).
; Submitted by Jamie Morken(w2)
; 1,2,2,6,2,5,2,4,8,1,7,3,1,3,6,5,1,5,3,1,5,2,4,7,2,1,2,1,2,33,2,4,1,10,1,4,4,2,3,3,1,9,1,2,1,14,13,2,1,2,3,1,8,3,3,3,1,3,2,1,8,18,2,1,2,17,3,7,1,2,3,4,3,3,2,3,4,2,4,6,1,6,1,3,2,3,4,2,1,2,10,4,2,4,2,3,9,1,28,3
add $0,1
mov $3,$0
mov $5,$0
add $5,1
lpb $5
add $1,$2
sub $5,1
sub $0,$5
seq $0,40 ; The prime numbers.
mov $2,$0
mov $0,$3
pow $2,$3
sub $2,$4
add $4,$2
lpe
div $2,$1
mov $0,$2
add $0,1
| 21.391304 | 209 | 0.530488 |
b58cb5266992bf6036fbc89ad7b3781125abf0d2 | 37,278 | asm | Assembly | onnxruntime/core/mlas/lib/amd64/QgemmU8S8KernelAvx2.asm | csteegz/onnxruntime | a36810471b346ec862ac6e4de7f877653f49525e | [
"MIT"
] | 1 | 2020-07-12T15:23:49.000Z | 2020-07-12T15:23:49.000Z | onnxruntime/core/mlas/lib/amd64/QgemmU8S8KernelAvx2.asm | ajinkya933/onnxruntime | 0e799a03f2a99da6a1b87a2cd37facb420c482aa | [
"MIT"
] | null | null | null | onnxruntime/core/mlas/lib/amd64/QgemmU8S8KernelAvx2.asm | ajinkya933/onnxruntime | 0e799a03f2a99da6a1b87a2cd37facb420c482aa | [
"MIT"
] | 1 | 2020-09-09T06:55:51.000Z | 2020-09-09T06:55:51.000Z | ;++
;
; Copyright (c) Microsoft Corporation. All rights reserved.
;
; Licensed under the MIT License.
;
; Module Name:
;
; QgemmU8S8KernelAvx2.asm
;
; Abstract:
;
; This module implements the kernels for the quantized integer matrix/matrix
; multiply operation (QGEMM).
;
; This implementation uses AVX2 instructions.
;
;--
.xlist
INCLUDE mlasi.inc
INCLUDE QgemmU8X8KernelAvx2Common.inc
.list
;
; Stack frame layout for the U8S8 CopyPackA routine.
;
GemmU8S8CopyPackAFrame STRUCT
PaddedMatrixAData OWORD 4 DUP (?)
SavedXmm6 OWORD ?
SavedXmm7 OWORD ?
SavedXmm8 OWORD ?
SavedXmm9 OWORD ?
SavedXmm10 OWORD ?
Padding QWORD ?
SavedR13 QWORD ?
SavedR12 QWORD ?
SavedRdi QWORD ?
SavedRsi QWORD ?
SavedRbx QWORD ?
SavedRbp QWORD ?
ReturnAddress QWORD ?
PreviousP1Home QWORD ?
PreviousP2Home QWORD ?
PreviousP3Home QWORD ?
PreviousP4Home QWORD ?
CountK QWORD ?
RowSumVector QWORD ?
offb QWORD ?
GemmU8S8CopyPackAFrame ENDS
;
; Stack frame layout for the U8S8 CopyPackB routine.
;
GemmU8S8CopyPackBFrame STRUCT
PaddedMatrixBData OWORD 4 DUP (?)
SavedXmm6 OWORD ?
SavedXmm7 OWORD ?
SavedXmm8 OWORD ?
Padding QWORD ?
SavedRdi QWORD ?
SavedRsi QWORD ?
SavedRbx QWORD ?
SavedRbp QWORD ?
ReturnAddress QWORD ?
PreviousP1Home QWORD ?
PreviousP2Home QWORD ?
PreviousP3Home QWORD ?
PreviousP4Home QWORD ?
CountK QWORD ?
ColumnSumVector QWORD ?
offa QWORD ?
GemmU8S8CopyPackBFrame ENDS
;++
;
; Routine Description:
;
; This routine copies elements from the source matrix to the destination
; packed buffer.
;
; Arguments:
;
; D (rcx) - Supplies the address of the destination packed buffer.
;
; A (rdx) - Supplies the address of the source matrix.
;
; lda (r8) - Supplies the number of elements per row of the source matrix.
;
; CountM (r9) - Supplies the number of rows of the source matrix to copy.
;
; CountK - Supplies the number of columns of the source matrix to copy.
;
; RowSumVector - Supplies the address of the buffer to receive the sums of
; the elements from each of the rows.
;
; offb - Supplies the zero point offset for the other source matrix of the
; matrix multiplication.
;
; Return Value:
;
; None.
;
;--
NESTED_ENTRY MlasGemmU8S8CopyPackAAvx2, _TEXT
rex_push_reg rbp
push_reg rbx
push_reg rsi
push_reg rdi
push_reg r12
push_reg r13
alloc_stack (GemmU8S8CopyPackAFrame.SavedR13)
save_xmm128 xmm6,GemmU8S8CopyPackAFrame.SavedXmm6
save_xmm128 xmm7,GemmU8S8CopyPackAFrame.SavedXmm7
save_xmm128 xmm8,GemmU8S8CopyPackAFrame.SavedXmm8
save_xmm128 xmm9,GemmU8S8CopyPackAFrame.SavedXmm9
save_xmm128 xmm10,GemmU8S8CopyPackAFrame.SavedXmm10
END_PROLOGUE
mov rdi,rcx
mov rsi,rdx
mov r10,GemmU8S8CopyPackAFrame.CountK[rsp]
lea r11,[r10+3]
and r11,NOT 3 ; align CountK up to quad count
mov r12,GemmU8S8CopyPackAFrame.RowSumVector[rsp]
vpbroadcastw xmm8,WORD PTR GemmU8S8CopyPackAFrame.offb[rsp]
vpcmpeqw ymm9,ymm9,ymm9 ; generate word vector [0xFFFF]
vpsrlw ymm9,ymm9,15 ; generate word vector [0x0001]
vpsllw ymm0,ymm9,8 ; generate word vector [0x0100]
vpor ymm9,ymm9,ymm0 ; generate word vector [0x0101]
;
; Compute the conditional load/store mask for an unaligned CountK.
;
mov eax,r10d
and eax,15 ; isolate unaligned count
add eax,3
shr eax,2 ; align unaligned count to quad count
mov DWORD PTR GemmU8S8CopyPackAFrame.CountK[rsp],eax
vpbroadcastd xmm10,DWORD PTR GemmU8S8CopyPackAFrame.CountK[rsp]
vpcmpgtd xmm10,xmm10,XMMWORD PTR [MlasMaskMoveAvx]
;
; Zero initialize the padded stack buffers.
;
vpxor xmm0,xmm0,xmm0
vmovdqu YMMWORD PTR GemmU8S8CopyPackAFrame.PaddedMatrixAData[rsp],ymm0
vmovdqu YMMWORD PTR GemmU8S8CopyPackAFrame.PaddedMatrixAData[rsp+32],ymm0
;
; Process 4 rows of matrix A in a loop.
;
sub r9,4
jb ProcessRemainingRows
ProcessNextRowM4:
vpxor xmm0,xmm0,xmm0 ; clear row accumulators
vpxor xmm1,xmm1,xmm1
vpxor xmm2,xmm2,xmm2
vpxor xmm3,xmm3,xmm3
mov rdx,rsi
mov rcx,rdi
lea rsi,[rsi+r8*4] ; advance next matrix A by 4 rows
lea rdi,[rdi+r11*4] ; advance next matrix D by 4 rows
mov rbx,r10 ; reload columns remaining
sub rbx,32
jb ProcessRemainingColumnsM4
ProcessNextColumnLoopM4:
lea rax,[rdx+r8*2] ; compute matrix A plus 2 rows
vmovdqu ymm4,YMMWORD PTR [rdx]
vmovdqu ymm5,YMMWORD PTR [rdx+r8]
vmovdqu ymm6,YMMWORD PTR [rax]
vmovdqu ymm7,YMMWORD PTR [rax+r8]
lea rax,[rcx+r11*2] ; compute matrix D plus 2 rows
vmovdqu YMMWORD PTR [rcx],ymm4
vmovdqu YMMWORD PTR [rcx+r11],ymm5
vmovdqu YMMWORD PTR [rax],ymm6
vmovdqu YMMWORD PTR [rax+r11],ymm7
vpmaddubsw ymm4,ymm4,ymm9 ; horizontal byte+byte=word per row
vpaddw ymm0,ymm0,ymm4 ; add words to row accumulators
vpmaddubsw ymm5,ymm5,ymm9
vpaddw ymm1,ymm1,ymm5
vpmaddubsw ymm6,ymm6,ymm9
vpaddw ymm2,ymm2,ymm6
vpmaddubsw ymm7,ymm7,ymm9
vpaddw ymm3,ymm3,ymm7
add rdx,32 ; advance matrix A by 32 bytes
add rcx,32 ; advance matrix D by 32 bytes
sub rbx,32 ; subtract columns remaining
jae ProcessNextColumnLoopM4
ProcessRemainingColumnsM4:
add rbx,32 ; correct for over-subtract above
jz ReduceRowSumVectorM4
test bl,16 ; (CountK & 16) != 0?
jz CopyRemainingCountKLessThan16M4
lea rax,[rdx+r8*2] ; compute matrix A plus 2 rows
vmovdqu xmm4,XMMWORD PTR [rdx]
vmovdqu xmm5,XMMWORD PTR [rdx+r8]
vmovdqu xmm6,XMMWORD PTR [rax]
vmovdqu xmm7,XMMWORD PTR [rax+r8]
lea rax,[rcx+r11*2] ; compute matrix D plus 2 rows
vmovdqu XMMWORD PTR [rcx],xmm4
vmovdqu XMMWORD PTR [rcx+r11],xmm5
vmovdqu XMMWORD PTR [rax],xmm6
vmovdqu XMMWORD PTR [rax+r11],xmm7
vpmaddubsw xmm4,xmm4,xmm9 ; horizontal byte+byte=word per row
vpaddw ymm0,ymm0,ymm4 ; add words to row accumulators
vpmaddubsw xmm5,xmm5,xmm9
vpaddw ymm1,ymm1,ymm5
vpmaddubsw xmm6,xmm6,xmm9
vpaddw ymm2,ymm2,ymm6
vpmaddubsw xmm7,xmm7,xmm9
vpaddw ymm3,ymm3,ymm7
add rdx,16 ; advance matrix A by 16 bytes
add rcx,16 ; advance matrix D by 16 bytes
test bl,15 ; test for unaligned columns
jz ReduceRowSumVectorM4
;
; Copy the unaligned CountK columns to a zero padded stack buffer.
;
CopyRemainingCountKLessThan16M4:
.errnz GemmU8S8CopyPackAFrame.PaddedMatrixAData
mov rbp,rsp ; GemmU8S8CopyPackAFrame.PaddedMatrixAData
test bl,8 ; (CountK & 8) != 0?
jz CopyRemainingCountKLessThan8M4
lea r13,[rdx+r8*2] ; compute matrix A plus 2 rows
mov rax,QWORD PTR [rdx]
mov QWORD PTR [rbp],rax
mov rax,QWORD PTR [rdx+r8]
mov QWORD PTR [rbp+16],rax
mov rax,QWORD PTR [r13]
mov QWORD PTR [rbp+32],rax
mov rax,QWORD PTR [r13+r8]
mov QWORD PTR [rbp+48],rax
add rdx,8
add rbp,8 ; advance padded buffer destination
CopyRemainingCountKLessThan8M4:
test bl,4 ; (CountK & 4) != 0?
jz CopyRemainingCountKLessThan4M4
lea r13,[rdx+r8*2] ; compute matrix A plus 2 rows
mov eax,DWORD PTR [rdx]
mov DWORD PTR [rbp],eax
mov eax,DWORD PTR [rdx+r8]
mov DWORD PTR [rbp+16],eax
mov eax,DWORD PTR [r13]
mov DWORD PTR [rbp+32],eax
mov eax,DWORD PTR [r13+r8]
mov DWORD PTR [rbp+48],eax
add rdx,4
add rbp,4 ; advance padded buffer destination
CopyRemainingCountKLessThan4M4:
test bl,2 ; (CountK & 2) != 0?
jz CopyRemainingCountKLessThan2M4
lea r13,[rdx+r8*2] ; compute matrix A plus 2 rows
movzx eax,WORD PTR [rdx]
mov WORD PTR [rbp],ax
movzx eax,WORD PTR [rdx+r8]
mov WORD PTR [rbp+16],ax
movzx eax,WORD PTR [r13]
mov WORD PTR [rbp+32],ax
movzx eax,WORD PTR [r13+r8]
mov WORD PTR [rbp+48],ax
add rdx,2
add rbp,2 ; advance padded buffer destination
CopyRemainingCountKLessThan2M4:
test bl,1 ; (CountK & 1) != 0?
jz ProcessPaddedMatrixADataM4
lea r13,[rdx+r8*2] ; compute matrix A plus 2 rows
movzx eax,BYTE PTR [rdx]
mov BYTE PTR [rbp],al
movzx eax,BYTE PTR [rdx+r8]
mov BYTE PTR [rbp+16],al
movzx eax,BYTE PTR [r13]
mov BYTE PTR [rbp+32],al
movzx eax,BYTE PTR [r13+r8]
mov BYTE PTR [rbp+48],al
;
; Process the remaining CountK columns using the zero padded stack buffer.
;
ProcessPaddedMatrixADataM4:
vmovdqu xmm4,XMMWORD PTR GemmU8S8CopyPackAFrame.PaddedMatrixAData[rsp]
vmovdqu xmm5,XMMWORD PTR GemmU8S8CopyPackAFrame.PaddedMatrixAData[rsp+16]
vmovdqu xmm6,XMMWORD PTR GemmU8S8CopyPackAFrame.PaddedMatrixAData[rsp+32]
vmovdqu xmm7,XMMWORD PTR GemmU8S8CopyPackAFrame.PaddedMatrixAData[rsp+48]
lea rax,[rcx+r11*2] ; compute matrix D plus 2 rows
vpmaskmovd XMMWORD PTR [rcx],xmm10,xmm4
vpmaskmovd XMMWORD PTR [rcx+r11],xmm10,xmm5
vpmaskmovd XMMWORD PTR [rax],xmm10,xmm6
vpmaskmovd XMMWORD PTR [rax+r11],xmm10,xmm7
vpmaddubsw xmm4,xmm4,xmm9 ; horizontal byte+byte=word per row
vpaddw ymm0,ymm0,ymm4 ; add words to row accumulators
vpmaddubsw xmm5,xmm5,xmm9
vpaddw ymm1,ymm1,ymm5
vpmaddubsw xmm6,xmm6,xmm9
vpaddw ymm2,ymm2,ymm6
vpmaddubsw xmm7,xmm7,xmm9
vpaddw ymm3,ymm3,ymm7
;
; Reduce the sums for the four rows of output.
;
ReduceRowSumVectorM4:
vphaddw ymm0,ymm0,ymm1 ; reduce and interleave Sum1/Sum0
vphaddw ymm1,ymm2,ymm3 ; reduce and interleave Sum3/Sum2
vphaddw ymm0,ymm0,ymm1 ; reduce and interleave Sum3/Sum2/Sum1/Sum0
vextracti128 xmm1,ymm0,1 ; extract high pairs
vpaddw xmm0,xmm0,xmm1 ; reduce low/high pairs
vpmaddwd xmm0,xmm0,xmm8 ; multiply by offset and reduce 32-bit sum
vmovdqu XMMWORD PTR [r12],xmm0
add r12,4*4 ; advance row sum vector by 4 DWORDs
sub r9,4 ; subtract rows remaining
jae ProcessNextRowM4
ProcessRemainingRows:
add r9,4 ; correct for over-subtract above
jz ExitRoutine
;
; Process a single row of matrix A in a loop.
;
ProcessNextRowM1:
vpxor xmm0,xmm0,xmm0 ; clear row accumulator
mov rdx,rsi
mov rcx,rdi
add rsi,r8
add rdi,r11
mov rbx,r10 ; reload columns remaining
sub rbx,32
jb ProcessRemainingColumnsM1
ProcessNextColumnLoopM1:
vmovdqu ymm4,YMMWORD PTR [rdx]
vmovdqu YMMWORD PTR [rcx],ymm4
vpmaddubsw ymm4,ymm4,ymm9 ; horizontal byte+byte=word per row
vpaddw ymm0,ymm0,ymm4 ; add words to row accumulators
add rdx,32 ; advance matrix A by 32 bytes
add rcx,32 ; advance matrix D by 32 bytes
sub rbx,32 ; subtract columns remaining
jae ProcessNextColumnLoopM1
ProcessRemainingColumnsM1:
add rbx,32 ; correct for over-subtract above
jz ReduceRowSumVectorM1
test bl,16 ; (CountK & 16) != 0?
jz CopyRemainingCountKLessThan16M1
vmovdqu xmm4,XMMWORD PTR [rdx]
vmovdqu XMMWORD PTR [rcx],xmm4
vpmaddubsw xmm4,xmm4,xmm9 ; horizontal byte+byte=word per row
vpaddw ymm0,ymm0,ymm4 ; add words to row accumulators
add rdx,16 ; advance matrix A by 16 bytes
add rcx,16 ; advance matrix D by 16 bytes
test bl,15 ; test for unaligned columns
jz ReduceRowSumVectorM1
;
; Copy the unaligned CountK columns to a zero padded stack buffer.
;
CopyRemainingCountKLessThan16M1:
.errnz GemmU8S8CopyPackAFrame.PaddedMatrixAData
mov rbp,rsp ; GemmU8S8CopyPackAFrame.PaddedMatrixAData
test bl,8 ; (CountK & 8) != 0?
jz CopyRemainingCountKLessThan8M1
mov rax,QWORD PTR [rdx]
mov QWORD PTR [rbp],rax
add rdx,8
add rbp,8 ; advance padded buffer destination
CopyRemainingCountKLessThan8M1:
test bl,4 ; (CountK & 4) != 0?
jz CopyRemainingCountKLessThan4M1
mov eax,DWORD PTR [rdx]
mov DWORD PTR [rbp],eax
add rdx,4
add rbp,4 ; advance padded buffer destination
CopyRemainingCountKLessThan4M1:
test bl,2 ; (CountK & 2) != 0?
jz CopyRemainingCountKLessThan2M1
movzx eax,WORD PTR [rdx]
mov WORD PTR [rbp],ax
add rdx,2
add rbp,2 ; advance padded buffer destination
CopyRemainingCountKLessThan2M1:
test bl,1 ; (CountK & 1) != 0?
jz ProcessPaddedMatrixADataM1
movzx eax,BYTE PTR [rdx]
mov BYTE PTR [rbp],al
;
; Process the remaining CountK columns using the zero padded stack buffer.
;
ProcessPaddedMatrixADataM1:
vmovdqu xmm4,XMMWORD PTR GemmU8S8CopyPackAFrame.PaddedMatrixAData[rsp]
vpmaskmovd XMMWORD PTR [rcx],xmm10,xmm4
vpmaddubsw ymm4,ymm4,ymm9 ; horizontal byte+byte=word per row
vpaddw ymm0,ymm0,ymm4 ; accumulate per row along columns
;
; Reduce the sum for the single row of output.
;
ReduceRowSumVectorM1:
vextracti128 xmm1,ymm0,1 ; extract high pairs
vpaddw xmm0,xmm0,xmm1 ; reduction
vphaddw xmm0,xmm0,xmm0
vphaddw xmm0,xmm0,xmm0
vpmaddwd xmm0,xmm0,xmm8 ; multiply by offset and reduce
vmovd DWORD PTR [r12],xmm0
add r12,4 ; advance row sum vector by 1 DWORD
dec r9 ; decrement rows remaining
jnz ProcessNextRowM1
;
; Restore non-volatile registers and return.
;
ExitRoutine:
vzeroupper
movaps xmm6,GemmU8S8CopyPackAFrame.SavedXmm6[rsp]
movaps xmm7,GemmU8S8CopyPackAFrame.SavedXmm7[rsp]
movaps xmm8,GemmU8S8CopyPackAFrame.SavedXmm8[rsp]
movaps xmm9,GemmU8S8CopyPackAFrame.SavedXmm9[rsp]
movaps xmm10,GemmU8S8CopyPackAFrame.SavedXmm10[rsp]
add rsp,(GemmU8S8CopyPackAFrame.SavedR13)
BEGIN_EPILOGUE
pop r13
pop r12
pop rdi
pop rsi
pop rbx
pop rbp
ret
NESTED_END MlasGemmU8S8CopyPackAAvx2, _TEXT
;++
;
; Routine Description:
;
; This routine copies elements from the source matrix to the destination
; packed buffer.
;
; Arguments:
;
; D (rcx) - Supplies the address of the destination packed buffer.
;
; B (rdx) - Supplies the address of the source matrix.
;
; ldb (r8) - Supplies the number of elements per row of the source matrix.
;
; CountN (r9) - Supplies the number of columns of the source matrix to copy.
;
; CountK - Supplies the number of rows of the source matrix to copy.
;
; ColumnSumVector - Supplies the address of the buffer to receive the sums of
; the elements from each of the columns. Each sum has also been multiplied
; by the zero point offset.
;
; offa - Supplies the zero point offset for the other source matrix of the
; matrix multiplication.
;
; Return Value:
;
; None.
;
;--
NESTED_ENTRY MlasGemmU8S8CopyPackBAvx2, _TEXT
rex_push_reg rbp
push_reg rbx
push_reg rsi
push_reg rdi
alloc_stack (GemmU8S8CopyPackBFrame.SavedRdi)
save_xmm128 xmm6,GemmU8S8CopyPackBFrame.SavedXmm6
save_xmm128 xmm7,GemmU8S8CopyPackBFrame.SavedXmm7
save_xmm128 xmm8,GemmU8S8CopyPackBFrame.SavedXmm8
END_PROLOGUE
mov rsi,rdx
mov r10,GemmU8S8CopyPackBFrame.CountK[rsp]
mov r11,GemmU8S8CopyPackBFrame.ColumnSumVector[rsp]
vpbroadcastw ymm7,WORD PTR GemmU8S8CopyPackBFrame.offa[rsp]
vpcmpeqw ymm8,ymm8,ymm8 ; generate word vector [0xFFFF]
vpsrlw ymm8,ymm8,15 ; generate word vector [0x0001]
vpsllw ymm0,ymm8,8 ; generate word vector [0x0100]
vpor ymm8,ymm8,ymm0 ; generate word vector [0x0101]
;
; Process 16 columns of matrix B in a loop.
;
sub r9,16
jb ProcessRemainingColumns
ProcessNextColumnN16:
vpxor xmm0,xmm0,xmm0 ; clear column accumulators
vpxor xmm1,xmm1,xmm1
mov rdx,rsi
add rsi,16 ; advance next matrix B by 16 columns
mov rbx,r10 ; reload rows remaining
sub rbx,4
jb ProcessRemainingRowsN16
ProcessNextRowLoopN16:
lea rax,[rdx+r8*2] ; compute matrix B plus 2 rows
vmovdqu xmm2,XMMWORD PTR [rdx] ; load 4 rows
vmovdqu xmm3,XMMWORD PTR [rdx+r8]
vmovdqu xmm4,XMMWORD PTR [rax]
vmovdqu xmm5,XMMWORD PTR [rax+r8]
lea rdx,[rdx+r8*4] ; advance matrix B by 4 rows
InterleaveRowDataN16:
vpunpcklbw xmm6,xmm2,xmm3 ; interleave row data
vpunpckhbw xmm3,xmm2,xmm3
vpunpcklbw xmm2,xmm4,xmm5
vpunpckhbw xmm5,xmm4,xmm5
vpunpcklwd xmm4,xmm6,xmm2
vpunpckhwd xmm6,xmm6,xmm2
vpunpcklwd xmm2,xmm3,xmm5
vpunpckhwd xmm3,xmm3,xmm5
vinsertf128 ymm4,ymm4,xmm6,1
vinsertf128 ymm2,ymm2,xmm3,1
vmovdqu YMMWORD PTR [rcx],ymm4 ; store interleaved rows
vmovdqu YMMWORD PTR [rcx+32],ymm2
vpmaddubsw ymm4,ymm8,ymm4 ; horizontal byte+byte=word per row
vpaddw ymm0,ymm0,ymm4 ; add words to row accumulators
vpmaddubsw ymm2,ymm8,ymm2
vpaddw ymm1,ymm1,ymm2
add rcx,64 ; advance matrix D by 64 bytes
sub rbx,4 ; subtract rows remaining
jae ProcessNextRowLoopN16
;
; Process the less than 4 remaining rows where the row has 16 columns.
;
ProcessRemainingRowsN16:
add rbx,4 ; correct for over-subtract above
jz ReduceColumnSumVectorN16
vmovdqu xmm2,XMMWORD PTR [rdx]
vpxor xmm3,xmm3,xmm3
vpxor xmm4,xmm4,xmm4
vpxor xmm5,xmm5,xmm5
xor ebx,ebx ; no more rows remaining
test r10b,2 ; (CountK & 2) != 0?
jz InterleaveRowDataN16
vmovdqu xmm3,XMMWORD PTR [rdx+r8]
test r10b,1 ; (CountK & 1) != 0?
jz InterleaveRowDataN16
vmovdqu xmm4,XMMWORD PTR [rdx+r8*2]
jmp InterleaveRowDataN16
ReduceColumnSumVectorN16:
vpmaddwd ymm0,ymm0,ymm7 ; multiply by offset and reduce
vpmaddwd ymm1,ymm1,ymm7 ; multiply by offset and reduce
vmovdqu YMMWORD PTR [r11],ymm0
vmovdqu YMMWORD PTR [r11+32],ymm1
add r11,16*4 ; advance column sum vector by 16 DWORDs
sub r9,16 ; subtract columns remaining
jae ProcessNextColumnN16
ProcessRemainingColumns:
add r9,16 ; correct for over-subtract above
jnz ProcessColumnNUnaligned
;
; Restore non-volatile registers and return.
;
ExitRoutine:
vzeroupper
movaps xmm6,GemmU8S8CopyPackBFrame.SavedXmm6[rsp]
movaps xmm7,GemmU8S8CopyPackBFrame.SavedXmm7[rsp]
movaps xmm8,GemmU8S8CopyPackBFrame.SavedXmm8[rsp]
add rsp,(GemmU8S8CopyPackBFrame.SavedRdi)
BEGIN_EPILOGUE
pop rdi
pop rsi
pop rbx
pop rbp
ret
;
; Process the remaining columns of matrix B.
;
ProcessColumnNUnaligned:
vpxor xmm0,xmm0,xmm0 ; clear column accumulators
vpxor xmm1,xmm1,xmm1
vmovdqu YMMWORD PTR GemmU8S8CopyPackBFrame.PaddedMatrixBData[rsp],ymm0
vmovdqu YMMWORD PTR GemmU8S8CopyPackBFrame.PaddedMatrixBData[rsp+32],ymm0
sub r10,4
jb ProcessRemainingRowsNUnaligned
ProcessNextRowLoopNUnaligned:
mov rdx,rsi
.errnz GemmU8S8CopyPackBFrame.PaddedMatrixBData
mov rbp,rsp ; GemmU8S8CopyPackBFrame.PaddedMatrixBData
test r9b,8 ; (CountN & 8) != 0?
jz CopyRemainingCountNLessThan8K4
lea rdi,[rdx+r8*2] ; compute matrix B plus 2 rows
mov rax,QWORD PTR [rdx]
mov QWORD PTR [rbp],rax
mov rax,QWORD PTR [rdx+r8]
mov QWORD PTR [rbp+16],rax
mov rax,QWORD PTR [rdi]
mov QWORD PTR [rbp+32],rax
mov rax,QWORD PTR [rdi+r8]
mov QWORD PTR [rbp+48],rax
add rdx,8 ; advance matrix B
add rbp,8 ; advance padded buffer destination
CopyRemainingCountNLessThan8K4:
test r9b,4 ; (CountN & 4) != 0?
jz CopyRemainingCountNLessThan4K4
lea rdi,[rdx+r8*2] ; compute matrix B plus 2 rows
mov eax,DWORD PTR [rdx]
mov DWORD PTR [rbp],eax
mov eax,DWORD PTR [rdx+r8]
mov DWORD PTR [rbp+16],eax
mov eax,DWORD PTR [rdi]
mov DWORD PTR [rbp+32],eax
mov eax,DWORD PTR [rdi+r8]
mov DWORD PTR [rbp+48],eax
add rdx,4 ; advance matrix B
add rbp,4 ; advance padded buffer destination
CopyRemainingCountNLessThan4K4:
test r9b,2 ; (CountN & 2) != 0?
jz CopyRemainingCountNLessThan2K4
lea rdi,[rdx+r8*2] ; compute matrix B plus 2 rows
movzx eax,WORD PTR [rdx]
mov WORD PTR [rbp],ax
movzx eax,WORD PTR [rdx+r8]
mov WORD PTR [rbp+16],ax
movzx eax,WORD PTR [rdi]
mov WORD PTR [rbp+32],ax
movzx eax,WORD PTR [rdi+r8]
mov WORD PTR [rbp+48],ax
add rdx,2 ; advance matrix B
add rbp,2 ; advance padded buffer destination
CopyRemainingCountNLessThan2K4:
test r9b,1 ; (CountN & 1) != 0?
jz ProcessPaddedMatrixBData
lea rdi,[rdx+r8*2] ; compute matrix B plus 2 rows
movzx eax,BYTE PTR [rdx]
mov BYTE PTR [rbp],al
movzx eax,BYTE PTR [rdx+r8]
mov BYTE PTR [rbp+16],al
movzx eax,BYTE PTR [rdi]
mov BYTE PTR [rbp+32],al
movzx eax,BYTE PTR [rdi+r8]
mov BYTE PTR [rbp+48],al
ProcessPaddedMatrixBData:
vmovdqu xmm2,XMMWORD PTR GemmU8S8CopyPackBFrame.PaddedMatrixBData[rsp]
vmovdqu xmm3,XMMWORD PTR GemmU8S8CopyPackBFrame.PaddedMatrixBData[rsp+16]
vmovdqu xmm4,XMMWORD PTR GemmU8S8CopyPackBFrame.PaddedMatrixBData[rsp+32]
vmovdqu xmm5,XMMWORD PTR GemmU8S8CopyPackBFrame.PaddedMatrixBData[rsp+48]
vpunpcklbw xmm6,xmm2,xmm3 ; interleave row data
vpunpckhbw xmm3,xmm2,xmm3
vpunpcklbw xmm2,xmm4,xmm5
vpunpckhbw xmm5,xmm4,xmm5
vpunpcklwd xmm4,xmm6,xmm2
vpunpckhwd xmm6,xmm6,xmm2
vpunpcklwd xmm2,xmm3,xmm5
vpunpckhwd xmm3,xmm3,xmm5
vinsertf128 ymm4,ymm4,xmm6,1
vinsertf128 ymm2,ymm2,xmm3,1
vmovdqu YMMWORD PTR [rcx],ymm4 ; store interleaved rows
vmovdqu YMMWORD PTR [rcx+32],ymm2
vpmaddubsw ymm4,ymm8,ymm4 ; horizontal byte+byte=word per row
vpaddw ymm0,ymm0,ymm4 ; add words to row accumulators
vpmaddubsw ymm2,ymm8,ymm2
vpaddw ymm1,ymm1,ymm2
lea rsi,[rsi+r8*4] ; advance next matrix B by 4 rows
add rcx,64 ; advance matrix D by 64 bytes
sub r10,4 ; subtract rows remaining
jae ProcessNextRowLoopNUnaligned
ProcessRemainingRowsNUnaligned:
add r10,4
jz ReduceColumnSumVectorNUnaligned
;
; Process the less than 4 remaining rows where the row has less than 16 columns.
;
.errnz GemmU8S8CopyPackBFrame.PaddedMatrixBData
mov rbp,rsp ; GemmU8S8CopyPackBFrame.PaddedMatrixBData
vpxor xmm6,xmm6,xmm6
vmovdqu YMMWORD PTR [rbp],ymm6
vmovdqu YMMWORD PTR [rbp+32],ymm6
CopyUnalignedRowLoop:
lea rdi,[rbp+16] ; advance next padded buffer by 16 bytes
mov rdx,rsi
test r9b,8 ; (CountN & 8) != 0?
jz CopyRemainingCountNLessThan8KSmall
mov rax,QWORD PTR [rdx]
mov QWORD PTR [rbp],rax
add rdx,8 ; advance matrix B
add rbp,8 ; advance padded buffer destination
CopyRemainingCountNLessThan8KSmall:
test r9b,4 ; (CountN & 4) != 0?
jz CopyRemainingCountNLessThan4KSmall
mov eax,DWORD PTR [rdx]
mov DWORD PTR [rbp],eax
add rdx,4 ; advance matrix B
add rbp,4 ; advance padded buffer destination
CopyRemainingCountNLessThan4KSmall:
test r9b,2 ; (CountN & 2) != 0?
jz CopyRemainingCountNLessThan2KSmall
movzx eax,WORD PTR [rdx]
mov WORD PTR [rbp],ax
add rdx,2 ; advance matrix B
add rbp,2 ; advance padded buffer destination
CopyRemainingCountNLessThan2KSmall:
test r9b,1 ; (CountN & 1) != 0?
jz DoneCopyRemainingCountNKSmall
movzx eax,BYTE PTR [rdx]
mov BYTE PTR [rbp],al
DoneCopyRemainingCountNKSmall:
dec r10
jz ProcessPaddedMatrixBData
add rsi,r8 ; advance next matrix B by 1 row
mov rbp,rdi
jmp CopyUnalignedRowLoop
ReduceColumnSumVectorNUnaligned:
vpmaddwd ymm0,ymm0,ymm7 ; multiply by offset and reduce
vpmaddwd ymm1,ymm1,ymm7 ; multiply by offset and reduce
vmovdqu YMMWORD PTR [r11],ymm0
vmovdqu YMMWORD PTR [r11+32],ymm1
jmp ExitRoutine
NESTED_END MlasGemmU8S8CopyPackBAvx2, _TEXT
;
; Macro Description:
;
; This macro generates code to multiply and accumulator a single row of the
; output block.
;
; Arguments:
;
; ColumnCount - Supplies the number of columns to produce.
;
; Vec1Reg - Supplies the high block accumulator register (when ColumnCount
; is 16).
;
; Vec2Reg - Supplies the low block accumulator register.
;
; Implicit Arguments:
;
; ymm0 - Supplies the first vector loaded from matrix B.
;
; ymm1 - Supplies the second vector loaded from matrix B (when ColumnCount
; is 16).
;
; ymm2 - Supplies the broadcast value loaded from matrix A.
;
; ymm12 - Supplies a 256-bit with the broadcasted word value 0x0001.
;
MultiplyAccumulateRow MACRO ColumnCount, Vec1Reg, Vec2Reg
vpmaddubsw ymm3,ymm2,ymm0
vpmaddwd ymm3,ymm3,ymm12
IF ColumnCount EQ 16
vpaddd Vec1Reg,Vec1Reg,ymm3
vpmaddubsw ymm2,ymm2,ymm1
vpmaddwd ymm2,ymm2,ymm12
vpaddd Vec2Reg,Vec2Reg,ymm2
ELSE
vpaddd Vec2Reg,Vec2Reg,ymm3
ENDIF
ENDM
;
; Macro Description:
;
; This macro generates code to multiply and accumulate each row of the output
; block.
;
; Arguments:
;
; ColumnCount - Supplies the number of columns to produce.
;
; RowCount - Supplies the number of rows to produce.
;
; VectorOffset - Supplies the byte offset from matrix B to fetch elements.
;
; BroadcastOffset - Supplies the byte offset from matrix A to fetch elements.
;
; Implicit Arguments:
;
; rbx - Supplies the address into the matrix A data plus 3 rows.
;
; rcx - Supplies the address into the matrix A data.
;
; rdx - Supplies the address into the matrix B data.
;
; r9 - Supplies the length in bytes of a row from matrix A.
;
; ymm4-ymm11 - Supplies the block accumulators.
;
; ymm12 - Supplies a 256-bit with the broadcasted word value 0x0001.
;
ComputeBlock MACRO ColumnCount, RowCount, VectorOffset, BroadcastOffset
IF RowCount EQ 1
vpbroadcastd ymm2,DWORD PTR [rcx+BroadcastOffset]
vpmaddubsw ymm3,ymm2,YMMWORD PTR [rdx+VectorOffset]
vpmaddwd ymm3,ymm3,ymm12
IF ColumnCount EQ 16
vpaddd ymm4,ymm4,ymm3
vpmaddubsw ymm2,ymm2,YMMWORD PTR [rdx+VectorOffset+32]
vpmaddwd ymm2,ymm2,ymm12
vpaddd ymm5,ymm5,ymm2
ELSE
vpaddd ymm5,ymm5,ymm3
ENDIF
ELSE
vmovdqu ymm0,YMMWORD PTR [rdx+VectorOffset]
EmitIfCountGE ColumnCount, 16, <vmovdqu ymm1,YMMWORD PTR [rdx+VectorOffset+32]>
EmitIfCountGE RowCount, 1, <vpbroadcastd ymm2,DWORD PTR [rcx+BroadcastOffset]>
EmitIfCountGE RowCount, 1, <MultiplyAccumulateRow ColumnCount, ymm4, ymm5>
EmitIfCountGE RowCount, 2, <vpbroadcastd ymm2,DWORD PTR [rcx+r9+BroadcastOffset]>
EmitIfCountGE RowCount, 2, <MultiplyAccumulateRow ColumnCount, ymm6, ymm7>
EmitIfCountGE RowCount, 3, <vpbroadcastd ymm2,DWORD PTR [rcx+r9*2+BroadcastOffset]>
EmitIfCountGE RowCount, 3, <MultiplyAccumulateRow ColumnCount, ymm8, ymm9>
EmitIfCountGE RowCount, 4, <vpbroadcastd ymm2,DWORD PTR [rbx+BroadcastOffset]>
EmitIfCountGE RowCount, 4, <MultiplyAccumulateRow ColumnCount, ymm10, ymm11>
ENDIF
ENDM
;
; Macro Description:
;
; This macro generates code to execute the block compute macro multiple
; times and advancing the matrix A and matrix B data pointers.
;
; Arguments:
;
; ColumnCount - Supplies the number of columns to produce.
;
; RowCount - Supplies the number of rows to produce.
;
; Implicit Arguments:
;
; rbx - Supplies the address into the matrix A data plus 3 rows.
;
; rcx - Supplies the address into the matrix A data.
;
; rdx - Supplies the address into the matrix B data.
;
; r9 - Supplies the length in bytes of a row from matrix A.
;
; ymm4-ymm11 - Supplies the block accumulators.
;
ComputeBlockLoop MACRO ColumnCount, RowCount
LOCAL ComputeBlockBy1Loop
mov rsi,r9 ; reload row length remaining
ComputeBlockBy1Loop:
ComputeBlock ColumnCount, RowCount, 0, 0
add rcx,4 ; advance matrix A by 1 quad
IF RowCount GT 3
add rbx,4 ; advance matrix A plus 3 rows by 1 quad
ENDIF
add rdx,64 ; advance matrix B
sub rsi,4
jnz ComputeBlockBy1Loop
ENDM
;++
;
; Routine Description:
;
; This routine is an inner kernel to compute matrix multiplication for a
; set of rows.
;
; Arguments:
;
; A (rcx) - Supplies the address of matrix A. The matrix data has been packed
; using MlasGemmU8S8CopyPackAAvx2.
;
; B (rdx) - Supplies the address of matrix B. The matrix data has been packed
; using MlasGemmU8S8CopyPackBAvx2.
;
; C (r8) - Supplies the address of matrix C.
;
; QuadCountK (r9) - Supplies the number of quad columns from matrix A and the
; number of quad rows from matrix B to iterate over.
;
; CountM - Supplies the maximum number of rows that can be processed for
; matrix A and matrix C. The actual number of rows handled for this
; invocation depends on the kernel implementation.
;
; CountN - Supplies the number of columns from matrix B and matrix C to iterate
; over.
;
; ldc - Supplies the first dimension of matrix C.
;
; RowSumVector - Supplies the sum of each row from matrix A multiplied by the
; zero point offset of matrix B. These values are accumulated into every
; row of matrix C.
;
; ColumnSumVector - Supplies the sum of each column from matrix B multiplied
; by the zero point offset of matrix A. These values are accumulated into
; every column of matrix C.
;
; DepthValue - Supplies the value CountK multiplied by the zero point offset
; of matrix A multplied by the zero point offset of matrix B. This value is
; accumulated into every element of matrix C.
;
; ZeroMode - Supplies true if the output matrix must be zero initialized,
; else false if the output matrix is accumulated into.
;
; Return Value:
;
; Returns the number of rows handled.
;
;--
NESTED_ENTRY MlasGemmU8S8KernelAvx2, _TEXT
rex_push_reg rbp
push_reg rbx
push_reg rsi
push_reg rdi
push_reg r12
push_reg r13
alloc_stack (GemmU8X8KernelFrame.SavedR13)
save_xmm128 xmm6,GemmU8X8KernelFrame.SavedXmm6
save_xmm128 xmm7,GemmU8X8KernelFrame.SavedXmm7
save_xmm128 xmm8,GemmU8X8KernelFrame.SavedXmm8
save_xmm128 xmm9,GemmU8X8KernelFrame.SavedXmm9
save_xmm128 xmm10,GemmU8X8KernelFrame.SavedXmm10
save_xmm128 xmm11,GemmU8X8KernelFrame.SavedXmm11
save_xmm128 xmm12,GemmU8X8KernelFrame.SavedXmm12
END_PROLOGUE
mov rdi,rcx
mov rbp,GemmU8X8KernelFrame.CountN[rsp]
mov rax,GemmU8X8KernelFrame.ldc[rsp]
shl rax,2 ; convert ldc to bytes
shl r9,2 ; convert to row length
movzx r10,BYTE PTR GemmU8X8KernelFrame.ZeroMode[rsp]
mov r11,GemmU8X8KernelFrame.CountM[rsp]
mov r12,GemmU8X8KernelFrame.RowSumVector[rsp]
mov r13,GemmU8X8KernelFrame.ColumnSumVector[rsp]
vpcmpeqw ymm12,ymm12,ymm12 ; generate 256-bit word vector [0xFFFF]
vpsrlw ymm12,ymm12,15 ; generate 256-bit word vector [0x0001]
;
; Process CountM rows of the matrices.
;
cmp r11,3
ja ProcessCountM4
je ProcessCountM3
cmp r11,1
je ProcessCountM1
ProcessCountM2:
ProcessCountM 2
ProcessCountM4:
mov r11d,4 ; return 4 rows handled
ProcessCountM 4, Fallthrough
;
; Restore non-volatile registers and return.
;
ExitKernel:
mov eax,r11d
vzeroupper
movaps xmm6,GemmU8X8KernelFrame.SavedXmm6[rsp]
movaps xmm7,GemmU8X8KernelFrame.SavedXmm7[rsp]
movaps xmm8,GemmU8X8KernelFrame.SavedXmm8[rsp]
movaps xmm9,GemmU8X8KernelFrame.SavedXmm9[rsp]
movaps xmm10,GemmU8X8KernelFrame.SavedXmm10[rsp]
movaps xmm11,GemmU8X8KernelFrame.SavedXmm11[rsp]
movaps xmm12,GemmU8X8KernelFrame.SavedXmm12[rsp]
add rsp,(GemmU8X8KernelFrame.SavedR13)
BEGIN_EPILOGUE
pop r13
pop r12
pop rdi
pop rsi
pop rbx
pop rbp
ret
ProcessCountM1:
ProcessCountM 1
ProcessCountM3:
ProcessCountM 3
NESTED_END MlasGemmU8S8KernelAvx2, _TEXT
END
| 35.368121 | 91 | 0.597672 |
7982a4090720f66ff75a39a04ca8d940769565f3 | 254 | asm | Assembly | Assembler/AssemblyCode/RET.asm | KPU-RISC/KPU | 9f85c322e1b8489eef31f0696799e0c6c7273c0e | [
"MIT"
] | 8 | 2017-04-16T16:53:03.000Z | 2021-09-14T22:29:28.000Z | Assembler/AssemblyCode/RET.asm | KPU-RISC/KPU | 9f85c322e1b8489eef31f0696799e0c6c7273c0e | [
"MIT"
] | null | null | null | Assembler/AssemblyCode/RET.asm | KPU-RISC/KPU | 9f85c322e1b8489eef31f0696799e0c6c7273c0e | [
"MIT"
] | null | null | null | ; Initialize the stack pointer
MOV XL, 0xFF
MOV XH, 0xFF
MOV SP, X
MOV F, 11110000b
; Call a subroutine...
CALL :SUBROUTINE
MOV F, 10101010b
; Write register F to the Output Port
OUTB F
; Stops program execution
HLT
:SUBROUTINE
MOV F, 01010101b
RET | 12.095238 | 37 | 0.740157 |
8983f61f9f48efa05a65e202b06f339c889223fd | 2,011 | asm | Assembly | programs/oeis/294/A294630.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/294/A294630.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/294/A294630.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A294630: Partial sums of A294629.
; 4,20,48,104,172,292,424,616,844,1140,1448,1888,2340,2876,3488,4224,4972,5892,6824,7936,9140,10460,11792,13416,15092,16900,18816,20960,23116,25612,28120,30880,33764,36812,39968,43568,47180,50972,54904,59240,63588,68372,73168,78288,83676,89276,94888,101112,107404,114044,120856,128040,135236,142964,150832,159216,167788,176620,185464,195176,204900,214900,225232,236072,247068,258692,270328,282432,294756,307676,320608,334528,348460,362716,377368,392536,407860,423908,439968,456880,474116,491708,509312,528040,546956,566244,585800,606096,626404,647868,669504,691752,714284,737220,760360,784752,809156,834148,859600,885992,912396,939716,967048,995232,1024116,1053452,1082800,1113528,1144268,1175860,1207784,1240800,1273828,1307868,1342144,1377176,1412732,1448788,1485048,1523232,1561516,1600316,1639480,1679448,1719668,1761380,1803104,1845848,1888972,1933076,1977192,2022944,2068916,2115452,2162832,2211288,2259756,2309428,2359112,2410368,2462036,2514300,2566768,2621312,2676140,2731580,2787672,2844712,2901764,2960596,3019440,3079472,3140156,3201916,3263976,3327928,3391892,3456516,3521600,3588432,3655516,3724212,3792920,3862672,3933412,4004844,4076288,4150232,4224292,4299588,4375600,4452704,4529820,4608428,4687624,4768392,4849668,4931684,5013712,5098672,5183644,5269852,5356584,5444728,5533220,5623300,5713616,5805120,5897676,5991596,6085528,6181992,6278468,6375748,6474160,6574200,6674252,6776468,6878696,6983048,7087972,7193732,7299792,7408256,7517100,7626796,7737336,7849688,7962292,8077828,8193376,8310256,8427740,8546108,8664872,8786712,8908868,9031924,9155600,9281552,9407756,9535836,9663928,9794264,9926028,10058724,10191432,10326800,10462180,10599180,10737408,10877384,11017372,11159860,11302776,11447168,11592228,11738844,11885472,12036136,12186812,12338748,12491656,12646088,12801300,12958580,13116128,13275536,13435644,13597500
mov $2,$0
add $2,1
mov $3,$0
lpb $2,1
mov $0,$3
sub $2,1
sub $0,$2
cal $0,294629 ; Partial sums of A294628.
add $1,$0
lpe
| 143.642857 | 1,841 | 0.840378 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.