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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
118bd98a4364374af7dbb348a21b3beaa3f28241 | 688 | asm | Assembly | programs/oeis/027/A027809.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/027/A027809.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/027/A027809.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A027809: a(n) = 143*(n+1)*C(n+4,13)/2.
; 715,11011,90090,520520,2382380,9189180,31039008,94225560,261891630,675745070,1636014380,3747960216,8180071900,17103786700,34420042800,66927861000,126159017985,231196390425,412918656150,720279159600,1229442013800,2056876004040,3377860886400,5452308061200,8660358006300,13550913115740,20907123092856,31833891129040,47873747470120,71158982174280,104609785760480,152190365735408,219237645762135,312880276563855,442569365207970,620746642109880,863680821799796,1192508772755300,1634524902410400,2224770006058600,3007979855130250,4040964156599370,5395498360352100,7161824299429800
mov $1,$0
add $1,13
bin $1,$0
add $0,10
mul $1,$0
div $1,2
mul $1,143
| 62.545455 | 575 | 0.856105 |
2c199bfacf8406ccd1c2b6a159f3e318bc980c8f | 2,819 | asm | Assembly | modules/core/Formatter - Hex.asm | vladikcomper/md-modules | 24f652a036dc63f295173369dddfffb3be89bdd7 | [
"MIT"
] | 9 | 2018-01-22T06:44:43.000Z | 2022-03-26T18:57:40.000Z | modules/core/Formatter - Hex.asm | vladikcomper/md-modules | 24f652a036dc63f295173369dddfffb3be89bdd7 | [
"MIT"
] | null | null | null | modules/core/Formatter - Hex.asm | vladikcomper/md-modules | 24f652a036dc63f295173369dddfffb3be89bdd7 | [
"MIT"
] | null | null | null |
; ===============================================================
; ---------------------------------------------------------------
; Error handling and debugging modules
; 2016-2017, Vladikcomper
; ---------------------------------------------------------------
; String formatters : Hexidecimal number
; ---------------------------------------------------------------
; INPUT:
; d1 Value
;
; d7 .w Number of bytes left in buffer, minus one
; a0 String buffer
; a4 Buffer flush function
;
; OUTPUT:
; (a0)++ ASCII characters for the converted value
;
; WARNING!
; 1) Formatters can only use registers a3 / d0-d4
; 2) Formatters should decrement d7 after each symbol write.
; 3) When d7 decrements below 0, a buffer flush function
; loaded in a4 should be called. The standard function
; usually renders buffer's contents on the screen (see
; "Console_FlushBuffer"), then resets the buffer.
; This function will reload d7, a0 and Carry flag.
; 4) If Carry flag is set after calling buffer flush function,
; formatter should halt all further processing and return,
; retaining the returned Carry bit.
; ---------------------------------------------------------------
FormatHex_Handlers:
jmp FormatHex_Word(pc) ; $00 ; handler for word
; ---------------------------------------------------------------
jmp FormatHex_LongWord(pc) ; $04 ; handler for longword
; ---------------------------------------------------------------
; jmp FormatHex_Byte(pc) ; $08 ; handler for byte
FormatHex_Byte:
moveq #$F,d3
move.w d1,d2
lsr.w #4,d2
and.w d3,d2
move.b HexDigitToChar(pc,d2), (a0)+
dbf d7, @buffer_ok
jsr (a4)
bcs.s FormatHex_Return
@buffer_ok
and.w d3,d1
move.b HexDigitToChar(pc,d1), (a0)+
dbf d7, FormatHex_Return
jmp (a4) ; call buffer flush function and return buffer status
; ---------------------------------------------------------------
FormatHex_LongWord:
swap d1
FormatHex_LongWord_Swapped:
bsr.s FormatHex_Word
bcs.s FormatHex_Return ; if buffer terminated, branch
FormatHex_Word_Swapped:
swap d1
; ---------------------------------------------------------------
FormatHex_Word:
moveq #4,d2
moveq #$F,d3
rept 4-1
rol.w d2,d1
move.b d1,d4
and.w d3,d4 ; get digit
move.b HexDigitToChar(pc,d4), (a0)+
dbf d7, *+6 ; if buffer is not exhausted, branch
jsr (a4) ; otherwise, call buffer flush function
bcs.s FormatHex_Return ; if buffer is terminated, branch
endr
rol.w d2,d1
move.b d1,d4
and.w d3,d4 ; get digit
move.b HexDigitToChar(pc,d4), (a0)+
dbf d7, FormatHex_Return
jmp (a4) ; call buffer flush function and return buffer status
FormatHex_Return:
rts ; return buffer status
; ---------------------------------------------------------------
HexDigitToChar:
dc.b '0123456789ABCDEF'
| 29.673684 | 69 | 0.545229 |
3c1f7131de104d3046f97ec5c125affc4f0a5560 | 570 | asm | Assembly | oeis/024/A024008.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/024/A024008.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/024/A024008.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A024008: a(n) = 1 - n^10.
; 1,0,-1023,-59048,-1048575,-9765624,-60466175,-282475248,-1073741823,-3486784400,-9999999999,-25937424600,-61917364223,-137858491848,-289254654975,-576650390624,-1099511627775,-2015993900448,-3570467226623,-6131066257800,-10239999999999,-16679880978200,-26559922791423,-41426511213648,-63403380965375,-95367431640624,-141167095653375,-205891132094648,-296196766695423,-420707233300200,-590489999999999,-819628286980800,-1125899906842623,-1531578985264448,-2064377754059775,-2758547353515624
mov $1,1
mov $2,$0
pow $2,10
sub $1,$2
mov $0,$1
| 63.333333 | 491 | 0.805263 |
d2eefd2e89ceca58862e0597223de3e84ca89316 | 3,011 | nasm | Assembly | Assignment-1/bindShell.nasm | xMilkPowderx/SLAE-Code | da0c6e9d0feacd3814b6954b3fd3af5ce1bbaffb | [
"MIT"
] | 1 | 2021-04-22T06:37:00.000Z | 2021-04-22T06:37:00.000Z | Assignment-1/bindShell.nasm | xMilkPowderx/SLAE-Code | da0c6e9d0feacd3814b6954b3fd3af5ce1bbaffb | [
"MIT"
] | null | null | null | Assignment-1/bindShell.nasm | xMilkPowderx/SLAE-Code | da0c6e9d0feacd3814b6954b3fd3af5ce1bbaffb | [
"MIT"
] | 1 | 2020-01-23T15:45:18.000Z | 2020-01-23T15:45:18.000Z | ;Filename: bindShell.nasm
;Author: Jonathan So
;Student ID: SLAE-1470
;SLAE-Exercise 1
global _start
section .text
_start:
;First, we will need to create a socket
;
; socketcall(int call, socket(int domain, int type, int protocol)
; eax: ebx: ecx:
; 0x66 call = 0x1 (SYS_SOCKET) *args = {domain = 0x2 (AF_INET), type = 0x1 (SOCK_STREAM), protocol = 0x0 (Single Protocol)}
;
xor ebx,ebx ; init register
xor eax,eax
xor edx,edx
push ebx ; 0x0 for protocol
inc ebx
push ebx ; 0x1 for SOCK_STREAM
push byte +0x2 ; 0x2 for AF_INET
mov ecx,esp ; ecx points to addr of current stack
mov al,0x66 ; 0x66 systemcall for socketcall
int 0x80
;Then we will need to set up bind() to assign address, listen() to listen for connection and accept() to accept connection
;
; socketcall(int call, bind(int sockfd, const struct sockaddr *addr,socklen_t addrlen))
; eax: ebx: ecx:
; 0x66 call = 0x2 (SYS_BIND) *args = {sockfd = eax, sockaddr = [0x2 (AF_INET), port = 115C (4444), address = 0x0], addrlen = 0x10}
;
pop ebx
pop esi
push edx ; We just set our address to 0x0 so that it will accept all traffic.
; You can also specify the address, e.g. 192.168.1.1 = C0.A8.01.01 = push dword 0101A8C0
push word 0x5c11; 115c is 4444 in hexadecimal form
push word 0x02 ; value for AF_INET
push byte +0x10
push ecx ; push the address that store value of sockaddr to stack
push eax ; eax was set to the value of sockfd after the socket call
mov ecx,esp ; ecx points to addr of current stack
push byte +0x66 ; 0x66 systemcall for socketcall
pop eax
int 0x80
;
; socketcall(int call, listen(int sockfd, int backlog))
; eax: ebx: ecx:
; 0x66 call = 0x4 (SYS_LISTEN) sockfd = eax
;
mov [ecx+0x4],eax ; modify the the stack ecx is pointing to to sockfd
mov bl,0x4 ; socket call for listen
mov al,0x66 ; 0x66 systemcall for socketcall
int 0x80
;
; socketcall(int call, accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen))
;
inc ebx ;increase ebx to 0x5 to call accept
mov al,0x66 ; 0x66 systemcall for socketcall
int 0x80
;Now, its time for us to redirect all file descriptor we need so that our input and output to the shell
;will be handled by stdin(0), stdout(1) and stderr(2)
;
; dup2(int oldfd, int newfd, int flags)
; eax: ebx: ecx:
; 0x3f oldfd = sockfd newfd = stdin(0), stdout(1) and stderr(2)
;
xchg eax,ebx
pop ecx
mov cl, 0x2
loop: ; Since we got three fd, we will use loop 3 times
mov al, 0x3f ; 0x3f systemcall for dup2
int 0x80
dec ecx ; 2 > 1 > 0
jns loop
;At last, the final part, this one is rather easy as we only need to call /bin/sh with execve()
;
; execve(const char *filename, char *const argv[],char *const envp[])
; eax: ebx: ecx: edx:
; 0xb *filename = /bin//sh address of /bin//sh 0x0
push dword 0x68732f2f
push dword 0x6e69622f ; /bin//sh
mov ebx,esp
push eax ; eax was set to 0x0 after dup2 and we can use it directly
push ebx
mov ecx,esp
mov al,0xb ; 0xb systemcall for execve
int 0x80 | 34.215909 | 133 | 0.7001 |
0329b08a352859b597a8f2562a1ee3d85fa349e2 | 398 | asm | Assembly | programs/oeis/078/A078835.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/078/A078835.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/078/A078835.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A078835: Sum of the divisors of the average of consecutive odd primes.
; 7,12,13,28,24,39,32,42,72,54,56,96,78,93,120,168,127,96,195,140,121,132,128,156,216,192,280,152,360,176,204,288,403,372,288,378,288,324,372,546,384,508,336,468,252,256,403,560,384,420,744,504,384,588,480
seq $0,24675 ; Average of two consecutive odd primes.
seq $0,39653 ; a(0) = 0; for n > 0, a(n) = sigma(n)-1.
add $0,1
| 56.857143 | 205 | 0.698492 |
f464ce59e6516cac6073f8c4ebff1f25e5ce3ee6 | 388 | asm | Assembly | programs/oeis/040/A040414.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/040/A040414.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/040/A040414.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A040414: Continued fraction for sqrt(435).
; 20,1,5,1,40,1,5,1,40,1,5,1,40,1,5,1,40,1,5,1,40,1,5,1,40,1,5,1,40,1,5,1,40,1,5,1,40,1,5,1,40,1,5,1,40,1,5,1,40,1,5,1,40,1,5,1,40,1,5,1,40,1,5,1,40,1,5,1,40,1,5,1,40,1,5,1,40,1,5,1,40,1,5,1
cal $0,40546 ; Continued fraction for sqrt(570).
mov $1,$0
cal $1,47297 ; Numbers that are congruent to {0, 3, 4, 6} mod 7.
sub $1,3
div $1,2
add $1,1
| 38.8 | 190 | 0.610825 |
93ed26c348f0e8e04d32b83fdc0cd77e155f4229 | 1,476 | asm | Assembly | assemblylabarray2/3duplicate.asm | zaoad/assembly- | 09b282351ae46efe746bf647ccf2834433f9b177 | [
"MIT"
] | null | null | null | assemblylabarray2/3duplicate.asm | zaoad/assembly- | 09b282351ae46efe746bf647ccf2834433f9b177 | [
"MIT"
] | null | null | null | assemblylabarray2/3duplicate.asm | zaoad/assembly- | 09b282351ae46efe746bf647ccf2834433f9b177 | [
"MIT"
] | null | null | null | segment .data
a: dq 0
b: dq 0
cnt: dq 0
cnt1: dq 0
temp: dq 0
fmt: dq "%lld ",10,0
fmt_in: dq "%lld", 0
fmt_out: dq " the number is exist already : %lld more unique number required ",10,0
fmt_add: dq " add to array : %lld more unique number required " ,10, 0
newline: dq " " ,10,0
segment .bss
array resq 100
unique resq 20
segment .text
global main
extern printf
extern scanf
main:
push RBP
mov RAX, 0
mov RCX, 0
mov RBX, 0
mov [temp] ,rcx
INPUT:
mov rcx , [temp]
cmp RCX, 10
jge init
mov [temp] ,rcx
mov RAX, 0
mov RDI, fmt_in
mov RSI, a
call scanf
jmp check_exist
check_exist:
mov rbx , 0
mov [cnt1] ,rbx
check_loop:
mov rdx ,[temp]
cmp rbx,rdx
jge addtoarray
mov rax ,[a]
mov r8 , [array+rbx*8]
cmp rax,r8
je alertduplicate
last_check_loop:
mov rbx,[cnt1]
inc rbx
mov [cnt1], rbx
jmp check_loop
alertduplicate:
mov rax , [temp]
mov rdx ,10
sub rdx ,rax
mov rax ,0
mov rdi, fmt_out
mov rsi ,rdx
call printf
mov rax ,0
mov rdi, newline
call printf
jmp INPUT
addtoarray:
mov rax , [a]
mov rbx ,[temp]
mov [array+rbx*8] ,rax
inc rbx
mov [temp] ,rbx
mov rax , [temp]
mov rdx ,10
sub rdx ,rax
mov rax ,0
mov rdi ,fmt_add
mov rsi ,rdx
call printf
mov rax ,0
mov rdi , newline
call printf
jmp INPUT
init:
mov RAX, 0
mov RCX, 0
mov RBX, 0
PRINT:
cmp RCX, 10
jz END
mov RAX, [array+RCX*8]
inc RCX
mov [cnt], RCX
mov RDI, fmt
mov RSI, RAX
call printf
mov RCX, [cnt]
jmp PRINT
END:
mov RAX, 0
pop RBP
ret
| 13.794393 | 84 | 0.663957 |
e664a20387dbc5795c6a5d7041da6b5fa5b17dbf | 6,037 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_133.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_133.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_133.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 %r8
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x16d9b, %rsi
lea addresses_normal_ht+0x1d9db, %rdi
nop
nop
nop
nop
dec %r8
mov $112, %rcx
rep movsw
nop
nop
nop
nop
and $34358, %r8
lea addresses_UC_ht+0x15a8b, %rbp
nop
xor $49265, %r13
mov $0x6162636465666768, %r12
movq %r12, %xmm7
and $0xffffffffffffffc0, %rbp
vmovntdq %ymm7, (%rbp)
xor %r13, %r13
lea addresses_D_ht+0xf86b, %r12
nop
nop
xor $59501, %rdi
movb $0x61, (%r12)
nop
and $45792, %rbp
lea addresses_D_ht+0x1e5db, %rsi
lea addresses_A_ht+0xfbdb, %rdi
nop
dec %rdx
mov $3, %rcx
rep movsl
nop
nop
nop
nop
nop
cmp %rbp, %rbp
lea addresses_A_ht+0x195db, %rbp
nop
nop
nop
nop
nop
inc %r13
movups (%rbp), %xmm3
vpextrq $1, %xmm3, %rdx
nop
nop
nop
nop
lfence
lea addresses_D_ht+0x137f, %rcx
and %rbp, %rbp
mov $0x6162636465666768, %rdx
movq %rdx, (%rcx)
nop
nop
nop
and $48085, %rdx
lea addresses_normal_ht+0x973b, %rsi
lea addresses_UC_ht+0x1578f, %rdi
nop
nop
nop
nop
and %r8, %r8
mov $116, %rcx
rep movsq
nop
nop
sub $28029, %r8
lea addresses_normal_ht+0x1d7fb, %rdx
cmp %r13, %r13
mov $0x6162636465666768, %rdi
movq %rdi, %xmm1
and $0xffffffffffffffc0, %rdx
vmovaps %ymm1, (%rdx)
add %rdi, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r14
push %r8
push %rbx
push %rcx
// Faulty Load
lea addresses_WT+0x1dfdb, %rbx
add %r8, %r8
mov (%rbx), %r13w
lea oracles, %r14
and $0xff, %r13
shlq $12, %r13
mov (%r14,%r13,1), %r13
pop %rcx
pop %rbx
pop %r8
pop %r14
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': True, 'type': 'addresses_WT'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': True, 'type': 'addresses_WT'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'}
{'dst': {'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 1, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 3, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 9, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 8, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 2, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 4, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 5, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'}
{'39': 21829}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
| 41.349315 | 2,999 | 0.662912 |
a270bc90976f91d8a5c81c759a373475da7fee94 | 3,567 | asm | Assembly | Transynther/x86/_processed/P/_zr_/i7-7700_9_0xca_notsx.log_448_867.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/P/_zr_/i7-7700_9_0xca_notsx.log_448_867.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/P/_zr_/i7-7700_9_0xca_notsx.log_448_867.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r8
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0xaff3, %rsi
lea addresses_normal_ht+0x17233, %rdi
nop
nop
nop
nop
add %r13, %r13
mov $79, %rcx
rep movsq
nop
nop
nop
and %r11, %r11
lea addresses_WC_ht+0x6ab3, %rsi
lea addresses_A_ht+0x15493, %rdi
cmp %rax, %rax
mov $66, %rcx
rep movsb
add $56206, %rdi
lea addresses_normal_ht+0x15c33, %rdi
clflush (%rdi)
nop
nop
nop
nop
cmp $48053, %r13
mov $0x6162636465666768, %r11
movq %r11, (%rdi)
nop
nop
nop
nop
nop
add $57092, %rax
lea addresses_A_ht+0xc733, %r11
nop
nop
nop
xor $21104, %r8
mov $0x6162636465666768, %rsi
movq %rsi, %xmm3
and $0xffffffffffffffc0, %r11
vmovntdq %ymm3, (%r11)
nop
nop
nop
nop
nop
and $20346, %rsi
lea addresses_UC_ht+0x1aa33, %rax
nop
cmp $35092, %rsi
movl $0x61626364, (%rax)
nop
cmp $3412, %r11
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r8
push %r9
push %rdi
push %rdx
// Faulty Load
mov $0x433, %r9
nop
nop
sub $32532, %r11
mov (%r9), %rdx
lea oracles, %r10
and $0xff, %rdx
shlq $12, %rdx
mov (%r10,%rdx,1), %rdx
pop %rdx
pop %rdi
pop %r9
pop %r8
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_P'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': True, 'type': 'addresses_P'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 9, 'same': True, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 2, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'}
{'dst': {'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 11, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'}
{'dst': {'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 8, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 8, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'00': 448}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 30.75 | 1,343 | 0.660779 |
c99a23d079d312f56d0c60ed6aa3df1f2cecd475 | 416 | asm | Assembly | programs/oeis/186/A186189.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/186/A186189.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/186/A186189.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A186189: least k such that A074286^(k)(n)=1 where a^(k)=a(a^(k-1)).
; 1,1,2,2,2,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7
mov $2,$0
add $0,4
trn $2,3
add $2,$0
add $2,$0
mov $0,2
sub $2,3
add $0,$2
sub $0,1
mov $3,1
lpb $0
add $0,$1
add $1,1
mul $3,2
sub $0,$3
trn $0,2
lpe
sub $1,1
| 18.909091 | 173 | 0.516827 |
d52a723787abae242f422d70835f07de388767f0 | 561 | asm | Assembly | programs/oeis/169/A169960.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/169/A169960.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/169/A169960.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A169960: Binomial(11n,n).
; 1,11,231,5456,135751,3478761,90858768,2404808340,64276915527,1731030945644,46897636623981,1276749965026536,34898565177533200,957150015393611193,26327386978706181060,725971390105457325456,20062118235172477959495,555476984964439251664995,15406114558482236881576284,427936041510109397793688160,11902995933154739790826719501,331488223958251318888250434410,9241979048402633009987542369480,257931330856626816752436542769300,7205233852717611545366428364067600,201448524633987556015884474007463136
mov $1,11
mul $1,$0
bin $1,$0
mov $0,$1
| 70.125 | 491 | 0.898396 |
054c8aa4de38a540ac2e1b155f9fa1386207a567 | 405 | asm | Assembly | oeis/044/A044131.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/044/A044131.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/044/A044131.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A044131: Numbers n such that string 4,5 occurs in the base 6 representation of n but not of n-1.
; Submitted by Jamie Morken(s4)
; 29,65,101,137,173,209,245,281,317,353,389,425,461,497,533,569,605,641,677,713,749,785,821,857,893,929,965,1001,1037,1109,1145,1181,1217,1253,1289,1325,1361,1397,1433,1469,1505,1541,1577,1613,1649,1685,1721,1757
mov $1,$0
div $0,29
add $1,$0
mov $0,$1
mul $0,36
add $0,29
| 36.818182 | 212 | 0.725926 |
944e4c0a94793f289f88d07bf958ae75b47c5c96 | 379 | asm | Assembly | oeis/229/A229702.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/229/A229702.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/229/A229702.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A229702: Expansion of 1/((1-x)^4*(1-6x)).
; Submitted by Jamie Morken(s2)
; 1,10,70,440,2675,16106,96720,580440,3482805,20897050,125382586,752295880,4513775735,27082654970,162495930500,974975583816,5849853503865,35099121024330,210594726147310,1263568356885400,7581410141314171
add $0,1
lpb $0
sub $0,1
add $4,1
add $3,$4
add $2,$3
add $1,$2
mul $3,6
lpe
mov $0,$1
| 25.266667 | 202 | 0.728232 |
97013f1e6d99d2f2284d282780510f78eaa02b53 | 376 | asm | Assembly | programs/oeis/171/A171226.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/171/A171226.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/171/A171226.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A171226: 9+10^n+9*100^n.
; 19,919,90109,9001009,900010009,90000100009,9000001000009,900000010000009,90000000100000009,9000000001000000009,900000000010000000009,90000000000100000000009,9000000000001000000000009,900000000000010000000000009,90000000000000100000000000009
mov $1,10
pow $1,$0
mul $1,9
add $1,1
bin $1,2
div $1,5
mul $1,10
sub $1,90
div $1,9
add $1,19
mov $0,$1
| 25.066667 | 242 | 0.800532 |
ef090a294aa2fee458416c3de5014cd0fff3c1ca | 464 | asm | Assembly | programs/oeis/025/A025800.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/025/A025800.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/025/A025800.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A025800: Expansion of 1/((1-x^2)(1-x^3)(1-x^11)).
; 1,0,1,1,1,1,2,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,13,13,14,15,15,16,17,17,18,19,19,21,21,22,23,24,24,26,26,27,28,29,30,31,32,33,34,35,36,37,38
mov $3,2
mov $5,$0
lpb $3,1
mov $0,$5
sub $3,1
add $0,$3
sub $0,1
cal $0,29005 ; Expansion of 1/((1-x)(1-x^2)(1-x^3)(1-x^11)).
mov $2,$3
mov $4,$0
lpb $2,1
mov $1,$4
sub $2,1
lpe
lpe
lpb $5,1
sub $1,$4
mov $5,0
lpe
| 20.173913 | 165 | 0.530172 |
5d6ba6ae5fc0ca0fdd9456efb1e06363fade9c1d | 6,983 | asm | Assembly | Controller_Software/Tut2- PWM Interrupts and Sine Wave Generation/dsp/SGEN/v101/source/C28x_SGEN_LIB/tzdlgc.asm | equinoxorg/Micro-Hydro-ELC | 242d1e07ae4defe1c675bc45748f24709c9eba0d | [
"CC-BY-3.0"
] | 2 | 2017-04-05T13:08:33.000Z | 2018-02-06T22:35:38.000Z | Controller_Software/Tut2- PWM Interrupts and Sine Wave Generation/dsp/SGEN/v101/source/C28x_SGEN_LIB/tzdlgc.asm | equinoxorg/Micro-Hydro-ELC | 242d1e07ae4defe1c675bc45748f24709c9eba0d | [
"CC-BY-3.0"
] | null | null | null | Controller_Software/Tut2- PWM Interrupts and Sine Wave Generation/dsp/SGEN/v101/source/C28x_SGEN_LIB/tzdlgc.asm | equinoxorg/Micro-Hydro-ELC | 242d1e07ae4defe1c675bc45748f24709c9eba0d | [
"CC-BY-3.0"
] | 5 | 2015-11-14T21:53:00.000Z | 2021-01-12T01:02:28.000Z | ; ========================================================================
; This software is licensed for use with Texas Instruments C28x
; family DSCs. This license was provided to you prior to installing
; the software. You may review this license by consulting a copy of
; the agreement in the doc directory of this library.
; ------------------------------------------------------------------------
; Copyright (C) 2010-2011 Texas Instruments, Incorporated.
; All Rights Reserved.
;=========================================================================
;********************************************************************************
; File name : TZDLGC.ASM
;
; Originator : Advanced Embeeded Control (AEC)
; Texas Instruments Inc.
;
; Description : This module generates trapezoidal output
;
; Routine Type : "CcA Only"
;
; Date : 28/12/2001 (DD/MM/YYYY)
;********************************************************************************
; Routine Name: trapgen_calc
;
; C prototype : void TZDLGEN_calc(TZDLGEN *p);
; : void TZDLGEN_init(TZDLGEN *P);
;
; The struct object is defined in the header file "sgen.h" as follows:
;
; typedef struct {int skip_cntr;
; int prescalar;
; int freq;
; int step_max;
; long task;
; int alpha;
; int gain;
; int offset;
; int out;
; } TZDLGEN;
;
;********************************************************************************
; ###########################################################################
; $TI Release: C28x SGEN Library Version v1.01 $
; $Release Date: September 30, 2011 $
; ###########################################################################
.def _TZDLGEN_calc
.def _TZDLGEN_init
;********************************************************************************
;************************ Initialisation Function *******************************
;********************************************************************************
_TZDLGEN_init:
MOV *XAR4,#0 ; XAR4->skip_cntr=0
MOVL XAR5,#TZDL_MIN
MOVL *+XAR4[4],XAR5 ; task=TZDL_MIN
MOV *+XAR4[6],#8000h ; alpha=0x8000
ADDB XAR4,#9 ; XAR4->out
MOV *XAR4,#0 ; out=0
LRETR
;********************************************************************************
;************************ Computation Function **********************************
;********************************************************************************
_TZDLGEN_calc:
SETC SXM,OVM
INC *XAR4 ; XAR4->skip_cntr=skip_cntr+1
MOV ACC,*XAR4 ; ACC=skip_cntr
SUB ACC,*+XAR4[1] ; ACC=skip_cntr-prescalar
BF TZDL_EXIT,LT ; if (skip_cntr+1) < prescalar, then exit
MOV *XAR4,#0 ; skip_cntr=0
; Obtain the step value in pro-rata with the freq input
MOV T,*+XAR4[2] ; T=freq
MPY ACC,T,*+XAR4[3] ; ACC=step=freq*step_max (Q15)
MOVH PL,ACC<<1 ; PL=freq*step_max (Q0)
; Increment the angle "alpha" by step value
MOVU ACC,*+XAR4[6] ; ACC=alpha
ADDU ACC,PL
MOV *+XAR4[6],AL ; alpha=alpha+step
MOV T,#0FFFFh
SUBU ACC,T ; alpha=alpha-FFFFh
MOVL XAR7,*+XAR4[4] ; XAR7=task
ADDB XAR4,#4 ; XAR4->task
LB *XAR7 ; Brach to Task
;--------------------------------------------------------------------------------
; Minimum value Task
;--------------------------------------------------------------------------------
TZDL_MIN:
BF MIN,LT
MOVL XAR5,#TZDL_INCR
MOVL *XAR4,XAR5 ; task=TZDL_INCR
BF POS_RAMP,UNC
MIN:
MOV T,#8000h
MPY ACC,T,*+XAR4[3] ; ACC=Y*gain(Q30)
LSL ACC,#1 ; ACC=Y*gain (Q31)
ADD ACC,*+XAR4[4]<<16 ; ACC=Y*gain+offset
MOV *+XAR4[5],AH ; out=Y*gain+offset
CLRC OVM
LRETR
;--------------------------------------------------------------------------------
; Positive Ramp Task
;--------------------------------------------------------------------------------
TZDL_INCR:
BF POS_RAMP,LT
MOVL XAR5,#TZDL_MAX
MOVL *XAR4,XAR5 ; task=TZDL_MAX
BF MAX,UNC
POS_RAMP:
MOV ACC,#08000h
MOV T,*+XAR4[2] ; T=alpha
SUB T,AL ; T=alpha-8000h
MPY ACC,T,*+XAR4[3] ; ACC=Y*gain(Q30)
LSL ACC,#1 ; ACC=Y*gain (Q31)
ADD ACC,*+XAR4[4]<<16 ; ACC=Y*gain+offset
MOV *+XAR4[5],AH ; out=Y*gain+offset
CLRC OVM
LRETR
;--------------------------------------------------------------------------------
; Maximum value Task
;--------------------------------------------------------------------------------
TZDL_MAX:
; Increment the angle "alpha" by step value
BF MAX,LT
MOVL XAR5,#TZDL_DECR
MOVL *XAR4,XAR5 ; task=TZDL_MIN
BF NEG_RAMP,UNC
MAX:
MOV T,#7FFFh
MPY ACC,T,*+XAR4[3] ; ACC=Y*gain(Q30)
LSL ACC,#1 ; ACC=Y*gain (Q31)
ADD ACC,*+XAR4[4]<<16 ; ACC=Y*gain+offset
MOV *+XAR4[5],AH ; out=Y*gain+offset
CLRC OVM
LRETR
;--------------------------------------------------------------------------------
; Negative Ramp Task
;--------------------------------------------------------------------------------
TZDL_DECR:
BF NEG_RAMP,LT
MOVL XAR5,#TZDL_MIN
MOVL *XAR4,XAR5 ; task=TZDL_MIN
BF MIN,UNC
NEG_RAMP:
MOV ACC,#7FFFh
SUB ACC,*+XAR4[2] ; ACC=0x7fff-alpha
MOV T,AL ; T=0x7fff-alpha
MPY ACC,T,*+XAR4[3] ; ACC=Y*gain(Q30)
LSL ACC,#1 ; ACC=Y*gain (Q31)
ADD ACC,*+XAR4[4]<<16 ; ACC=Y*gain+offset
MOV *+XAR4[5],AH ; out=Y*gain+offset
CLRC OVM
LRETR
;--------------------------------------------------------------------------------
; Return
;--------------------------------------------------------------------------------
TZDL_EXIT:
CLRC OVM
LRETR
| 38.368132 | 81 | 0.334384 |
2134428897605b37bd96e67847d2e6ab0bbae9be | 47,075 | asm | Assembly | wc.asm | cassianomaia/SO1-P2 | 8152b4bb2e60b2907f1c34d77ff4b739b6da73be | [
"MIT-0"
] | null | null | null | wc.asm | cassianomaia/SO1-P2 | 8152b4bb2e60b2907f1c34d77ff4b739b6da73be | [
"MIT-0"
] | null | null | null | wc.asm | cassianomaia/SO1-P2 | 8152b4bb2e60b2907f1c34d77ff4b739b6da73be | [
"MIT-0"
] | null | null | null |
_wc: file format elf32-i386
Disassembly of section .text:
00001000 <wc>:
char buf[512];
void
wc(int fd, char *name)
{
1000: 55 push %ebp
1001: 89 e5 mov %esp,%ebp
1003: 83 ec 48 sub $0x48,%esp
int i, n;
int l, w, c, inword;
l = w = c = 0;
1006: c7 45 e8 00 00 00 00 movl $0x0,-0x18(%ebp)
100d: 8b 45 e8 mov -0x18(%ebp),%eax
1010: 89 45 ec mov %eax,-0x14(%ebp)
1013: 8b 45 ec mov -0x14(%ebp),%eax
1016: 89 45 f0 mov %eax,-0x10(%ebp)
inword = 0;
1019: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
while((n = read(fd, buf, sizeof(buf))) > 0){
1020: eb 68 jmp 108a <wc+0x8a>
for(i=0; i<n; i++){
1022: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
1029: eb 57 jmp 1082 <wc+0x82>
c++;
102b: 83 45 e8 01 addl $0x1,-0x18(%ebp)
if(buf[i] == '\n')
102f: 8b 45 f4 mov -0xc(%ebp),%eax
1032: 05 80 2c 00 00 add $0x2c80,%eax
1037: 0f b6 00 movzbl (%eax),%eax
103a: 3c 0a cmp $0xa,%al
103c: 75 04 jne 1042 <wc+0x42>
l++;
103e: 83 45 f0 01 addl $0x1,-0x10(%ebp)
if(strchr(" \r\t\n\v", buf[i]))
1042: 8b 45 f4 mov -0xc(%ebp),%eax
1045: 05 80 2c 00 00 add $0x2c80,%eax
104a: 0f b6 00 movzbl (%eax),%eax
104d: 0f be c0 movsbl %al,%eax
1050: 89 44 24 04 mov %eax,0x4(%esp)
1054: c7 04 24 9d 19 00 00 movl $0x199d,(%esp)
105b: e8 58 02 00 00 call 12b8 <strchr>
1060: 85 c0 test %eax,%eax
1062: 74 09 je 106d <wc+0x6d>
inword = 0;
1064: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
106b: eb 11 jmp 107e <wc+0x7e>
else if(!inword){
106d: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
1071: 75 0b jne 107e <wc+0x7e>
w++;
1073: 83 45 ec 01 addl $0x1,-0x14(%ebp)
inword = 1;
1077: c7 45 e4 01 00 00 00 movl $0x1,-0x1c(%ebp)
int l, w, c, inword;
l = w = c = 0;
inword = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
for(i=0; i<n; i++){
107e: 83 45 f4 01 addl $0x1,-0xc(%ebp)
1082: 8b 45 f4 mov -0xc(%ebp),%eax
1085: 3b 45 e0 cmp -0x20(%ebp),%eax
1088: 7c a1 jl 102b <wc+0x2b>
int i, n;
int l, w, c, inword;
l = w = c = 0;
inword = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
108a: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
1091: 00
1092: c7 44 24 04 80 2c 00 movl $0x2c80,0x4(%esp)
1099: 00
109a: 8b 45 08 mov 0x8(%ebp),%eax
109d: 89 04 24 mov %eax,(%esp)
10a0: e8 c4 03 00 00 call 1469 <read>
10a5: 89 45 e0 mov %eax,-0x20(%ebp)
10a8: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
10ac: 0f 8f 70 ff ff ff jg 1022 <wc+0x22>
w++;
inword = 1;
}
}
}
if(n < 0){
10b2: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
10b6: 79 19 jns 10d1 <wc+0xd1>
printf(1, "wc: read error\n");
10b8: c7 44 24 04 a3 19 00 movl $0x19a3,0x4(%esp)
10bf: 00
10c0: c7 04 24 01 00 00 00 movl $0x1,(%esp)
10c7: e8 05 05 00 00 call 15d1 <printf>
exit();
10cc: e8 80 03 00 00 call 1451 <exit>
}
printf(1, "%d %d %d %s\n", l, w, c, name);
10d1: 8b 45 0c mov 0xc(%ebp),%eax
10d4: 89 44 24 14 mov %eax,0x14(%esp)
10d8: 8b 45 e8 mov -0x18(%ebp),%eax
10db: 89 44 24 10 mov %eax,0x10(%esp)
10df: 8b 45 ec mov -0x14(%ebp),%eax
10e2: 89 44 24 0c mov %eax,0xc(%esp)
10e6: 8b 45 f0 mov -0x10(%ebp),%eax
10e9: 89 44 24 08 mov %eax,0x8(%esp)
10ed: c7 44 24 04 b3 19 00 movl $0x19b3,0x4(%esp)
10f4: 00
10f5: c7 04 24 01 00 00 00 movl $0x1,(%esp)
10fc: e8 d0 04 00 00 call 15d1 <printf>
}
1101: c9 leave
1102: c3 ret
00001103 <main>:
int
main(int argc, char *argv[])
{
1103: 55 push %ebp
1104: 89 e5 mov %esp,%ebp
1106: 83 e4 f0 and $0xfffffff0,%esp
1109: 83 ec 20 sub $0x20,%esp
int fd, i;
if(argc <= 1){
110c: 83 7d 08 01 cmpl $0x1,0x8(%ebp)
1110: 7f 19 jg 112b <main+0x28>
wc(0, "");
1112: c7 44 24 04 c0 19 00 movl $0x19c0,0x4(%esp)
1119: 00
111a: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1121: e8 da fe ff ff call 1000 <wc>
exit();
1126: e8 26 03 00 00 call 1451 <exit>
}
for(i = 1; i < argc; i++){
112b: c7 44 24 1c 01 00 00 movl $0x1,0x1c(%esp)
1132: 00
1133: e9 8f 00 00 00 jmp 11c7 <main+0xc4>
if((fd = open(argv[i], 0)) < 0){
1138: 8b 44 24 1c mov 0x1c(%esp),%eax
113c: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
1143: 8b 45 0c mov 0xc(%ebp),%eax
1146: 01 d0 add %edx,%eax
1148: 8b 00 mov (%eax),%eax
114a: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1151: 00
1152: 89 04 24 mov %eax,(%esp)
1155: e8 37 03 00 00 call 1491 <open>
115a: 89 44 24 18 mov %eax,0x18(%esp)
115e: 83 7c 24 18 00 cmpl $0x0,0x18(%esp)
1163: 79 2f jns 1194 <main+0x91>
printf(1, "cat: cannot open %s\n", argv[i]);
1165: 8b 44 24 1c mov 0x1c(%esp),%eax
1169: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
1170: 8b 45 0c mov 0xc(%ebp),%eax
1173: 01 d0 add %edx,%eax
1175: 8b 00 mov (%eax),%eax
1177: 89 44 24 08 mov %eax,0x8(%esp)
117b: c7 44 24 04 c1 19 00 movl $0x19c1,0x4(%esp)
1182: 00
1183: c7 04 24 01 00 00 00 movl $0x1,(%esp)
118a: e8 42 04 00 00 call 15d1 <printf>
exit();
118f: e8 bd 02 00 00 call 1451 <exit>
}
wc(fd, argv[i]);
1194: 8b 44 24 1c mov 0x1c(%esp),%eax
1198: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
119f: 8b 45 0c mov 0xc(%ebp),%eax
11a2: 01 d0 add %edx,%eax
11a4: 8b 00 mov (%eax),%eax
11a6: 89 44 24 04 mov %eax,0x4(%esp)
11aa: 8b 44 24 18 mov 0x18(%esp),%eax
11ae: 89 04 24 mov %eax,(%esp)
11b1: e8 4a fe ff ff call 1000 <wc>
close(fd);
11b6: 8b 44 24 18 mov 0x18(%esp),%eax
11ba: 89 04 24 mov %eax,(%esp)
11bd: e8 b7 02 00 00 call 1479 <close>
if(argc <= 1){
wc(0, "");
exit();
}
for(i = 1; i < argc; i++){
11c2: 83 44 24 1c 01 addl $0x1,0x1c(%esp)
11c7: 8b 44 24 1c mov 0x1c(%esp),%eax
11cb: 3b 45 08 cmp 0x8(%ebp),%eax
11ce: 0f 8c 64 ff ff ff jl 1138 <main+0x35>
exit();
}
wc(fd, argv[i]);
close(fd);
}
exit();
11d4: e8 78 02 00 00 call 1451 <exit>
000011d9 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
11d9: 55 push %ebp
11da: 89 e5 mov %esp,%ebp
11dc: 57 push %edi
11dd: 53 push %ebx
asm volatile("cld; rep stosb" :
11de: 8b 4d 08 mov 0x8(%ebp),%ecx
11e1: 8b 55 10 mov 0x10(%ebp),%edx
11e4: 8b 45 0c mov 0xc(%ebp),%eax
11e7: 89 cb mov %ecx,%ebx
11e9: 89 df mov %ebx,%edi
11eb: 89 d1 mov %edx,%ecx
11ed: fc cld
11ee: f3 aa rep stos %al,%es:(%edi)
11f0: 89 ca mov %ecx,%edx
11f2: 89 fb mov %edi,%ebx
11f4: 89 5d 08 mov %ebx,0x8(%ebp)
11f7: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
11fa: 5b pop %ebx
11fb: 5f pop %edi
11fc: 5d pop %ebp
11fd: c3 ret
000011fe <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
11fe: 55 push %ebp
11ff: 89 e5 mov %esp,%ebp
1201: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
1204: 8b 45 08 mov 0x8(%ebp),%eax
1207: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
120a: 90 nop
120b: 8b 45 08 mov 0x8(%ebp),%eax
120e: 8d 50 01 lea 0x1(%eax),%edx
1211: 89 55 08 mov %edx,0x8(%ebp)
1214: 8b 55 0c mov 0xc(%ebp),%edx
1217: 8d 4a 01 lea 0x1(%edx),%ecx
121a: 89 4d 0c mov %ecx,0xc(%ebp)
121d: 0f b6 12 movzbl (%edx),%edx
1220: 88 10 mov %dl,(%eax)
1222: 0f b6 00 movzbl (%eax),%eax
1225: 84 c0 test %al,%al
1227: 75 e2 jne 120b <strcpy+0xd>
;
return os;
1229: 8b 45 fc mov -0x4(%ebp),%eax
}
122c: c9 leave
122d: c3 ret
0000122e <strcmp>:
int
strcmp(const char *p, const char *q)
{
122e: 55 push %ebp
122f: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
1231: eb 08 jmp 123b <strcmp+0xd>
p++, q++;
1233: 83 45 08 01 addl $0x1,0x8(%ebp)
1237: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
123b: 8b 45 08 mov 0x8(%ebp),%eax
123e: 0f b6 00 movzbl (%eax),%eax
1241: 84 c0 test %al,%al
1243: 74 10 je 1255 <strcmp+0x27>
1245: 8b 45 08 mov 0x8(%ebp),%eax
1248: 0f b6 10 movzbl (%eax),%edx
124b: 8b 45 0c mov 0xc(%ebp),%eax
124e: 0f b6 00 movzbl (%eax),%eax
1251: 38 c2 cmp %al,%dl
1253: 74 de je 1233 <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
1255: 8b 45 08 mov 0x8(%ebp),%eax
1258: 0f b6 00 movzbl (%eax),%eax
125b: 0f b6 d0 movzbl %al,%edx
125e: 8b 45 0c mov 0xc(%ebp),%eax
1261: 0f b6 00 movzbl (%eax),%eax
1264: 0f b6 c0 movzbl %al,%eax
1267: 29 c2 sub %eax,%edx
1269: 89 d0 mov %edx,%eax
}
126b: 5d pop %ebp
126c: c3 ret
0000126d <strlen>:
uint
strlen(char *s)
{
126d: 55 push %ebp
126e: 89 e5 mov %esp,%ebp
1270: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
1273: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
127a: eb 04 jmp 1280 <strlen+0x13>
127c: 83 45 fc 01 addl $0x1,-0x4(%ebp)
1280: 8b 55 fc mov -0x4(%ebp),%edx
1283: 8b 45 08 mov 0x8(%ebp),%eax
1286: 01 d0 add %edx,%eax
1288: 0f b6 00 movzbl (%eax),%eax
128b: 84 c0 test %al,%al
128d: 75 ed jne 127c <strlen+0xf>
;
return n;
128f: 8b 45 fc mov -0x4(%ebp),%eax
}
1292: c9 leave
1293: c3 ret
00001294 <memset>:
void*
memset(void *dst, int c, uint n)
{
1294: 55 push %ebp
1295: 89 e5 mov %esp,%ebp
1297: 83 ec 0c sub $0xc,%esp
stosb(dst, c, n);
129a: 8b 45 10 mov 0x10(%ebp),%eax
129d: 89 44 24 08 mov %eax,0x8(%esp)
12a1: 8b 45 0c mov 0xc(%ebp),%eax
12a4: 89 44 24 04 mov %eax,0x4(%esp)
12a8: 8b 45 08 mov 0x8(%ebp),%eax
12ab: 89 04 24 mov %eax,(%esp)
12ae: e8 26 ff ff ff call 11d9 <stosb>
return dst;
12b3: 8b 45 08 mov 0x8(%ebp),%eax
}
12b6: c9 leave
12b7: c3 ret
000012b8 <strchr>:
char*
strchr(const char *s, char c)
{
12b8: 55 push %ebp
12b9: 89 e5 mov %esp,%ebp
12bb: 83 ec 04 sub $0x4,%esp
12be: 8b 45 0c mov 0xc(%ebp),%eax
12c1: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
12c4: eb 14 jmp 12da <strchr+0x22>
if(*s == c)
12c6: 8b 45 08 mov 0x8(%ebp),%eax
12c9: 0f b6 00 movzbl (%eax),%eax
12cc: 3a 45 fc cmp -0x4(%ebp),%al
12cf: 75 05 jne 12d6 <strchr+0x1e>
return (char*)s;
12d1: 8b 45 08 mov 0x8(%ebp),%eax
12d4: eb 13 jmp 12e9 <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
12d6: 83 45 08 01 addl $0x1,0x8(%ebp)
12da: 8b 45 08 mov 0x8(%ebp),%eax
12dd: 0f b6 00 movzbl (%eax),%eax
12e0: 84 c0 test %al,%al
12e2: 75 e2 jne 12c6 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
12e4: b8 00 00 00 00 mov $0x0,%eax
}
12e9: c9 leave
12ea: c3 ret
000012eb <gets>:
char*
gets(char *buf, int max)
{
12eb: 55 push %ebp
12ec: 89 e5 mov %esp,%ebp
12ee: 83 ec 28 sub $0x28,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
12f1: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
12f8: eb 4c jmp 1346 <gets+0x5b>
cc = read(0, &c, 1);
12fa: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
1301: 00
1302: 8d 45 ef lea -0x11(%ebp),%eax
1305: 89 44 24 04 mov %eax,0x4(%esp)
1309: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1310: e8 54 01 00 00 call 1469 <read>
1315: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
1318: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
131c: 7f 02 jg 1320 <gets+0x35>
break;
131e: eb 31 jmp 1351 <gets+0x66>
buf[i++] = c;
1320: 8b 45 f4 mov -0xc(%ebp),%eax
1323: 8d 50 01 lea 0x1(%eax),%edx
1326: 89 55 f4 mov %edx,-0xc(%ebp)
1329: 89 c2 mov %eax,%edx
132b: 8b 45 08 mov 0x8(%ebp),%eax
132e: 01 c2 add %eax,%edx
1330: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1334: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
1336: 0f b6 45 ef movzbl -0x11(%ebp),%eax
133a: 3c 0a cmp $0xa,%al
133c: 74 13 je 1351 <gets+0x66>
133e: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1342: 3c 0d cmp $0xd,%al
1344: 74 0b je 1351 <gets+0x66>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
1346: 8b 45 f4 mov -0xc(%ebp),%eax
1349: 83 c0 01 add $0x1,%eax
134c: 3b 45 0c cmp 0xc(%ebp),%eax
134f: 7c a9 jl 12fa <gets+0xf>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
1351: 8b 55 f4 mov -0xc(%ebp),%edx
1354: 8b 45 08 mov 0x8(%ebp),%eax
1357: 01 d0 add %edx,%eax
1359: c6 00 00 movb $0x0,(%eax)
return buf;
135c: 8b 45 08 mov 0x8(%ebp),%eax
}
135f: c9 leave
1360: c3 ret
00001361 <stat>:
int
stat(char *n, struct stat *st)
{
1361: 55 push %ebp
1362: 89 e5 mov %esp,%ebp
1364: 83 ec 28 sub $0x28,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
1367: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
136e: 00
136f: 8b 45 08 mov 0x8(%ebp),%eax
1372: 89 04 24 mov %eax,(%esp)
1375: e8 17 01 00 00 call 1491 <open>
137a: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
137d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
1381: 79 07 jns 138a <stat+0x29>
return -1;
1383: b8 ff ff ff ff mov $0xffffffff,%eax
1388: eb 23 jmp 13ad <stat+0x4c>
r = fstat(fd, st);
138a: 8b 45 0c mov 0xc(%ebp),%eax
138d: 89 44 24 04 mov %eax,0x4(%esp)
1391: 8b 45 f4 mov -0xc(%ebp),%eax
1394: 89 04 24 mov %eax,(%esp)
1397: e8 0d 01 00 00 call 14a9 <fstat>
139c: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
139f: 8b 45 f4 mov -0xc(%ebp),%eax
13a2: 89 04 24 mov %eax,(%esp)
13a5: e8 cf 00 00 00 call 1479 <close>
return r;
13aa: 8b 45 f0 mov -0x10(%ebp),%eax
}
13ad: c9 leave
13ae: c3 ret
000013af <atoi>:
int
atoi(const char *s)
{
13af: 55 push %ebp
13b0: 89 e5 mov %esp,%ebp
13b2: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
13b5: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
13bc: eb 25 jmp 13e3 <atoi+0x34>
n = n*10 + *s++ - '0';
13be: 8b 55 fc mov -0x4(%ebp),%edx
13c1: 89 d0 mov %edx,%eax
13c3: c1 e0 02 shl $0x2,%eax
13c6: 01 d0 add %edx,%eax
13c8: 01 c0 add %eax,%eax
13ca: 89 c1 mov %eax,%ecx
13cc: 8b 45 08 mov 0x8(%ebp),%eax
13cf: 8d 50 01 lea 0x1(%eax),%edx
13d2: 89 55 08 mov %edx,0x8(%ebp)
13d5: 0f b6 00 movzbl (%eax),%eax
13d8: 0f be c0 movsbl %al,%eax
13db: 01 c8 add %ecx,%eax
13dd: 83 e8 30 sub $0x30,%eax
13e0: 89 45 fc mov %eax,-0x4(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
13e3: 8b 45 08 mov 0x8(%ebp),%eax
13e6: 0f b6 00 movzbl (%eax),%eax
13e9: 3c 2f cmp $0x2f,%al
13eb: 7e 0a jle 13f7 <atoi+0x48>
13ed: 8b 45 08 mov 0x8(%ebp),%eax
13f0: 0f b6 00 movzbl (%eax),%eax
13f3: 3c 39 cmp $0x39,%al
13f5: 7e c7 jle 13be <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
13f7: 8b 45 fc mov -0x4(%ebp),%eax
}
13fa: c9 leave
13fb: c3 ret
000013fc <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
13fc: 55 push %ebp
13fd: 89 e5 mov %esp,%ebp
13ff: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
1402: 8b 45 08 mov 0x8(%ebp),%eax
1405: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
1408: 8b 45 0c mov 0xc(%ebp),%eax
140b: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
140e: eb 17 jmp 1427 <memmove+0x2b>
*dst++ = *src++;
1410: 8b 45 fc mov -0x4(%ebp),%eax
1413: 8d 50 01 lea 0x1(%eax),%edx
1416: 89 55 fc mov %edx,-0x4(%ebp)
1419: 8b 55 f8 mov -0x8(%ebp),%edx
141c: 8d 4a 01 lea 0x1(%edx),%ecx
141f: 89 4d f8 mov %ecx,-0x8(%ebp)
1422: 0f b6 12 movzbl (%edx),%edx
1425: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
1427: 8b 45 10 mov 0x10(%ebp),%eax
142a: 8d 50 ff lea -0x1(%eax),%edx
142d: 89 55 10 mov %edx,0x10(%ebp)
1430: 85 c0 test %eax,%eax
1432: 7f dc jg 1410 <memmove+0x14>
*dst++ = *src++;
return vdst;
1434: 8b 45 08 mov 0x8(%ebp),%eax
}
1437: c9 leave
1438: c3 ret
00001439 <fork>:
1439: b8 01 00 00 00 mov $0x1,%eax
143e: cd 40 int $0x40
1440: c3 ret
00001441 <cowfork>:
1441: b8 0f 00 00 00 mov $0xf,%eax
1446: cd 40 int $0x40
1448: c3 ret
00001449 <procdump>:
1449: b8 10 00 00 00 mov $0x10,%eax
144e: cd 40 int $0x40
1450: c3 ret
00001451 <exit>:
1451: b8 02 00 00 00 mov $0x2,%eax
1456: cd 40 int $0x40
1458: c3 ret
00001459 <wait>:
1459: b8 03 00 00 00 mov $0x3,%eax
145e: cd 40 int $0x40
1460: c3 ret
00001461 <pipe>:
1461: b8 04 00 00 00 mov $0x4,%eax
1466: cd 40 int $0x40
1468: c3 ret
00001469 <read>:
1469: b8 05 00 00 00 mov $0x5,%eax
146e: cd 40 int $0x40
1470: c3 ret
00001471 <write>:
1471: b8 12 00 00 00 mov $0x12,%eax
1476: cd 40 int $0x40
1478: c3 ret
00001479 <close>:
1479: b8 17 00 00 00 mov $0x17,%eax
147e: cd 40 int $0x40
1480: c3 ret
00001481 <kill>:
1481: b8 06 00 00 00 mov $0x6,%eax
1486: cd 40 int $0x40
1488: c3 ret
00001489 <exec>:
1489: b8 07 00 00 00 mov $0x7,%eax
148e: cd 40 int $0x40
1490: c3 ret
00001491 <open>:
1491: b8 11 00 00 00 mov $0x11,%eax
1496: cd 40 int $0x40
1498: c3 ret
00001499 <mknod>:
1499: b8 13 00 00 00 mov $0x13,%eax
149e: cd 40 int $0x40
14a0: c3 ret
000014a1 <unlink>:
14a1: b8 14 00 00 00 mov $0x14,%eax
14a6: cd 40 int $0x40
14a8: c3 ret
000014a9 <fstat>:
14a9: b8 08 00 00 00 mov $0x8,%eax
14ae: cd 40 int $0x40
14b0: c3 ret
000014b1 <link>:
14b1: b8 15 00 00 00 mov $0x15,%eax
14b6: cd 40 int $0x40
14b8: c3 ret
000014b9 <mkdir>:
14b9: b8 16 00 00 00 mov $0x16,%eax
14be: cd 40 int $0x40
14c0: c3 ret
000014c1 <chdir>:
14c1: b8 09 00 00 00 mov $0x9,%eax
14c6: cd 40 int $0x40
14c8: c3 ret
000014c9 <dup>:
14c9: b8 0a 00 00 00 mov $0xa,%eax
14ce: cd 40 int $0x40
14d0: c3 ret
000014d1 <getpid>:
14d1: b8 0b 00 00 00 mov $0xb,%eax
14d6: cd 40 int $0x40
14d8: c3 ret
000014d9 <sbrk>:
14d9: b8 0c 00 00 00 mov $0xc,%eax
14de: cd 40 int $0x40
14e0: c3 ret
000014e1 <sleep>:
14e1: b8 0d 00 00 00 mov $0xd,%eax
14e6: cd 40 int $0x40
14e8: c3 ret
000014e9 <uptime>:
14e9: b8 0e 00 00 00 mov $0xe,%eax
14ee: cd 40 int $0x40
14f0: c3 ret
000014f1 <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
14f1: 55 push %ebp
14f2: 89 e5 mov %esp,%ebp
14f4: 83 ec 18 sub $0x18,%esp
14f7: 8b 45 0c mov 0xc(%ebp),%eax
14fa: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
14fd: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
1504: 00
1505: 8d 45 f4 lea -0xc(%ebp),%eax
1508: 89 44 24 04 mov %eax,0x4(%esp)
150c: 8b 45 08 mov 0x8(%ebp),%eax
150f: 89 04 24 mov %eax,(%esp)
1512: e8 5a ff ff ff call 1471 <write>
}
1517: c9 leave
1518: c3 ret
00001519 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
1519: 55 push %ebp
151a: 89 e5 mov %esp,%ebp
151c: 56 push %esi
151d: 53 push %ebx
151e: 83 ec 30 sub $0x30,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
1521: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
1528: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
152c: 74 17 je 1545 <printint+0x2c>
152e: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
1532: 79 11 jns 1545 <printint+0x2c>
neg = 1;
1534: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
153b: 8b 45 0c mov 0xc(%ebp),%eax
153e: f7 d8 neg %eax
1540: 89 45 ec mov %eax,-0x14(%ebp)
1543: eb 06 jmp 154b <printint+0x32>
} else {
x = xx;
1545: 8b 45 0c mov 0xc(%ebp),%eax
1548: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
154b: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
1552: 8b 4d f4 mov -0xc(%ebp),%ecx
1555: 8d 41 01 lea 0x1(%ecx),%eax
1558: 89 45 f4 mov %eax,-0xc(%ebp)
155b: 8b 5d 10 mov 0x10(%ebp),%ebx
155e: 8b 45 ec mov -0x14(%ebp),%eax
1561: ba 00 00 00 00 mov $0x0,%edx
1566: f7 f3 div %ebx
1568: 89 d0 mov %edx,%eax
156a: 0f b6 80 44 2c 00 00 movzbl 0x2c44(%eax),%eax
1571: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
1575: 8b 75 10 mov 0x10(%ebp),%esi
1578: 8b 45 ec mov -0x14(%ebp),%eax
157b: ba 00 00 00 00 mov $0x0,%edx
1580: f7 f6 div %esi
1582: 89 45 ec mov %eax,-0x14(%ebp)
1585: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
1589: 75 c7 jne 1552 <printint+0x39>
if(neg)
158b: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
158f: 74 10 je 15a1 <printint+0x88>
buf[i++] = '-';
1591: 8b 45 f4 mov -0xc(%ebp),%eax
1594: 8d 50 01 lea 0x1(%eax),%edx
1597: 89 55 f4 mov %edx,-0xc(%ebp)
159a: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
159f: eb 1f jmp 15c0 <printint+0xa7>
15a1: eb 1d jmp 15c0 <printint+0xa7>
putc(fd, buf[i]);
15a3: 8d 55 dc lea -0x24(%ebp),%edx
15a6: 8b 45 f4 mov -0xc(%ebp),%eax
15a9: 01 d0 add %edx,%eax
15ab: 0f b6 00 movzbl (%eax),%eax
15ae: 0f be c0 movsbl %al,%eax
15b1: 89 44 24 04 mov %eax,0x4(%esp)
15b5: 8b 45 08 mov 0x8(%ebp),%eax
15b8: 89 04 24 mov %eax,(%esp)
15bb: e8 31 ff ff ff call 14f1 <putc>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
15c0: 83 6d f4 01 subl $0x1,-0xc(%ebp)
15c4: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
15c8: 79 d9 jns 15a3 <printint+0x8a>
putc(fd, buf[i]);
}
15ca: 83 c4 30 add $0x30,%esp
15cd: 5b pop %ebx
15ce: 5e pop %esi
15cf: 5d pop %ebp
15d0: c3 ret
000015d1 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
15d1: 55 push %ebp
15d2: 89 e5 mov %esp,%ebp
15d4: 83 ec 38 sub $0x38,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
15d7: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
15de: 8d 45 0c lea 0xc(%ebp),%eax
15e1: 83 c0 04 add $0x4,%eax
15e4: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
15e7: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
15ee: e9 7c 01 00 00 jmp 176f <printf+0x19e>
c = fmt[i] & 0xff;
15f3: 8b 55 0c mov 0xc(%ebp),%edx
15f6: 8b 45 f0 mov -0x10(%ebp),%eax
15f9: 01 d0 add %edx,%eax
15fb: 0f b6 00 movzbl (%eax),%eax
15fe: 0f be c0 movsbl %al,%eax
1601: 25 ff 00 00 00 and $0xff,%eax
1606: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
1609: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
160d: 75 2c jne 163b <printf+0x6a>
if(c == '%'){
160f: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
1613: 75 0c jne 1621 <printf+0x50>
state = '%';
1615: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
161c: e9 4a 01 00 00 jmp 176b <printf+0x19a>
} else {
putc(fd, c);
1621: 8b 45 e4 mov -0x1c(%ebp),%eax
1624: 0f be c0 movsbl %al,%eax
1627: 89 44 24 04 mov %eax,0x4(%esp)
162b: 8b 45 08 mov 0x8(%ebp),%eax
162e: 89 04 24 mov %eax,(%esp)
1631: e8 bb fe ff ff call 14f1 <putc>
1636: e9 30 01 00 00 jmp 176b <printf+0x19a>
}
} else if(state == '%'){
163b: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
163f: 0f 85 26 01 00 00 jne 176b <printf+0x19a>
if(c == 'd'){
1645: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
1649: 75 2d jne 1678 <printf+0xa7>
printint(fd, *ap, 10, 1);
164b: 8b 45 e8 mov -0x18(%ebp),%eax
164e: 8b 00 mov (%eax),%eax
1650: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp)
1657: 00
1658: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
165f: 00
1660: 89 44 24 04 mov %eax,0x4(%esp)
1664: 8b 45 08 mov 0x8(%ebp),%eax
1667: 89 04 24 mov %eax,(%esp)
166a: e8 aa fe ff ff call 1519 <printint>
ap++;
166f: 83 45 e8 04 addl $0x4,-0x18(%ebp)
1673: e9 ec 00 00 00 jmp 1764 <printf+0x193>
} else if(c == 'x' || c == 'p'){
1678: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
167c: 74 06 je 1684 <printf+0xb3>
167e: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
1682: 75 2d jne 16b1 <printf+0xe0>
printint(fd, *ap, 16, 0);
1684: 8b 45 e8 mov -0x18(%ebp),%eax
1687: 8b 00 mov (%eax),%eax
1689: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
1690: 00
1691: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
1698: 00
1699: 89 44 24 04 mov %eax,0x4(%esp)
169d: 8b 45 08 mov 0x8(%ebp),%eax
16a0: 89 04 24 mov %eax,(%esp)
16a3: e8 71 fe ff ff call 1519 <printint>
ap++;
16a8: 83 45 e8 04 addl $0x4,-0x18(%ebp)
16ac: e9 b3 00 00 00 jmp 1764 <printf+0x193>
} else if(c == 's'){
16b1: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
16b5: 75 45 jne 16fc <printf+0x12b>
s = (char*)*ap;
16b7: 8b 45 e8 mov -0x18(%ebp),%eax
16ba: 8b 00 mov (%eax),%eax
16bc: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
16bf: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
16c3: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
16c7: 75 09 jne 16d2 <printf+0x101>
s = "(null)";
16c9: c7 45 f4 d6 19 00 00 movl $0x19d6,-0xc(%ebp)
while(*s != 0){
16d0: eb 1e jmp 16f0 <printf+0x11f>
16d2: eb 1c jmp 16f0 <printf+0x11f>
putc(fd, *s);
16d4: 8b 45 f4 mov -0xc(%ebp),%eax
16d7: 0f b6 00 movzbl (%eax),%eax
16da: 0f be c0 movsbl %al,%eax
16dd: 89 44 24 04 mov %eax,0x4(%esp)
16e1: 8b 45 08 mov 0x8(%ebp),%eax
16e4: 89 04 24 mov %eax,(%esp)
16e7: e8 05 fe ff ff call 14f1 <putc>
s++;
16ec: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
16f0: 8b 45 f4 mov -0xc(%ebp),%eax
16f3: 0f b6 00 movzbl (%eax),%eax
16f6: 84 c0 test %al,%al
16f8: 75 da jne 16d4 <printf+0x103>
16fa: eb 68 jmp 1764 <printf+0x193>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
16fc: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
1700: 75 1d jne 171f <printf+0x14e>
putc(fd, *ap);
1702: 8b 45 e8 mov -0x18(%ebp),%eax
1705: 8b 00 mov (%eax),%eax
1707: 0f be c0 movsbl %al,%eax
170a: 89 44 24 04 mov %eax,0x4(%esp)
170e: 8b 45 08 mov 0x8(%ebp),%eax
1711: 89 04 24 mov %eax,(%esp)
1714: e8 d8 fd ff ff call 14f1 <putc>
ap++;
1719: 83 45 e8 04 addl $0x4,-0x18(%ebp)
171d: eb 45 jmp 1764 <printf+0x193>
} else if(c == '%'){
171f: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
1723: 75 17 jne 173c <printf+0x16b>
putc(fd, c);
1725: 8b 45 e4 mov -0x1c(%ebp),%eax
1728: 0f be c0 movsbl %al,%eax
172b: 89 44 24 04 mov %eax,0x4(%esp)
172f: 8b 45 08 mov 0x8(%ebp),%eax
1732: 89 04 24 mov %eax,(%esp)
1735: e8 b7 fd ff ff call 14f1 <putc>
173a: eb 28 jmp 1764 <printf+0x193>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
173c: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp)
1743: 00
1744: 8b 45 08 mov 0x8(%ebp),%eax
1747: 89 04 24 mov %eax,(%esp)
174a: e8 a2 fd ff ff call 14f1 <putc>
putc(fd, c);
174f: 8b 45 e4 mov -0x1c(%ebp),%eax
1752: 0f be c0 movsbl %al,%eax
1755: 89 44 24 04 mov %eax,0x4(%esp)
1759: 8b 45 08 mov 0x8(%ebp),%eax
175c: 89 04 24 mov %eax,(%esp)
175f: e8 8d fd ff ff call 14f1 <putc>
}
state = 0;
1764: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
176b: 83 45 f0 01 addl $0x1,-0x10(%ebp)
176f: 8b 55 0c mov 0xc(%ebp),%edx
1772: 8b 45 f0 mov -0x10(%ebp),%eax
1775: 01 d0 add %edx,%eax
1777: 0f b6 00 movzbl (%eax),%eax
177a: 84 c0 test %al,%al
177c: 0f 85 71 fe ff ff jne 15f3 <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
1782: c9 leave
1783: c3 ret
00001784 <free>:
1784: 55 push %ebp
1785: 89 e5 mov %esp,%ebp
1787: 83 ec 10 sub $0x10,%esp
178a: 8b 45 08 mov 0x8(%ebp),%eax
178d: 83 e8 08 sub $0x8,%eax
1790: 89 45 f8 mov %eax,-0x8(%ebp)
1793: a1 68 2c 00 00 mov 0x2c68,%eax
1798: 89 45 fc mov %eax,-0x4(%ebp)
179b: eb 24 jmp 17c1 <free+0x3d>
179d: 8b 45 fc mov -0x4(%ebp),%eax
17a0: 8b 00 mov (%eax),%eax
17a2: 3b 45 fc cmp -0x4(%ebp),%eax
17a5: 77 12 ja 17b9 <free+0x35>
17a7: 8b 45 f8 mov -0x8(%ebp),%eax
17aa: 3b 45 fc cmp -0x4(%ebp),%eax
17ad: 77 24 ja 17d3 <free+0x4f>
17af: 8b 45 fc mov -0x4(%ebp),%eax
17b2: 8b 00 mov (%eax),%eax
17b4: 3b 45 f8 cmp -0x8(%ebp),%eax
17b7: 77 1a ja 17d3 <free+0x4f>
17b9: 8b 45 fc mov -0x4(%ebp),%eax
17bc: 8b 00 mov (%eax),%eax
17be: 89 45 fc mov %eax,-0x4(%ebp)
17c1: 8b 45 f8 mov -0x8(%ebp),%eax
17c4: 3b 45 fc cmp -0x4(%ebp),%eax
17c7: 76 d4 jbe 179d <free+0x19>
17c9: 8b 45 fc mov -0x4(%ebp),%eax
17cc: 8b 00 mov (%eax),%eax
17ce: 3b 45 f8 cmp -0x8(%ebp),%eax
17d1: 76 ca jbe 179d <free+0x19>
17d3: 8b 45 f8 mov -0x8(%ebp),%eax
17d6: 8b 40 04 mov 0x4(%eax),%eax
17d9: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
17e0: 8b 45 f8 mov -0x8(%ebp),%eax
17e3: 01 c2 add %eax,%edx
17e5: 8b 45 fc mov -0x4(%ebp),%eax
17e8: 8b 00 mov (%eax),%eax
17ea: 39 c2 cmp %eax,%edx
17ec: 75 24 jne 1812 <free+0x8e>
17ee: 8b 45 f8 mov -0x8(%ebp),%eax
17f1: 8b 50 04 mov 0x4(%eax),%edx
17f4: 8b 45 fc mov -0x4(%ebp),%eax
17f7: 8b 00 mov (%eax),%eax
17f9: 8b 40 04 mov 0x4(%eax),%eax
17fc: 01 c2 add %eax,%edx
17fe: 8b 45 f8 mov -0x8(%ebp),%eax
1801: 89 50 04 mov %edx,0x4(%eax)
1804: 8b 45 fc mov -0x4(%ebp),%eax
1807: 8b 00 mov (%eax),%eax
1809: 8b 10 mov (%eax),%edx
180b: 8b 45 f8 mov -0x8(%ebp),%eax
180e: 89 10 mov %edx,(%eax)
1810: eb 0a jmp 181c <free+0x98>
1812: 8b 45 fc mov -0x4(%ebp),%eax
1815: 8b 10 mov (%eax),%edx
1817: 8b 45 f8 mov -0x8(%ebp),%eax
181a: 89 10 mov %edx,(%eax)
181c: 8b 45 fc mov -0x4(%ebp),%eax
181f: 8b 40 04 mov 0x4(%eax),%eax
1822: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
1829: 8b 45 fc mov -0x4(%ebp),%eax
182c: 01 d0 add %edx,%eax
182e: 3b 45 f8 cmp -0x8(%ebp),%eax
1831: 75 20 jne 1853 <free+0xcf>
1833: 8b 45 fc mov -0x4(%ebp),%eax
1836: 8b 50 04 mov 0x4(%eax),%edx
1839: 8b 45 f8 mov -0x8(%ebp),%eax
183c: 8b 40 04 mov 0x4(%eax),%eax
183f: 01 c2 add %eax,%edx
1841: 8b 45 fc mov -0x4(%ebp),%eax
1844: 89 50 04 mov %edx,0x4(%eax)
1847: 8b 45 f8 mov -0x8(%ebp),%eax
184a: 8b 10 mov (%eax),%edx
184c: 8b 45 fc mov -0x4(%ebp),%eax
184f: 89 10 mov %edx,(%eax)
1851: eb 08 jmp 185b <free+0xd7>
1853: 8b 45 fc mov -0x4(%ebp),%eax
1856: 8b 55 f8 mov -0x8(%ebp),%edx
1859: 89 10 mov %edx,(%eax)
185b: 8b 45 fc mov -0x4(%ebp),%eax
185e: a3 68 2c 00 00 mov %eax,0x2c68
1863: c9 leave
1864: c3 ret
00001865 <morecore>:
1865: 55 push %ebp
1866: 89 e5 mov %esp,%ebp
1868: 83 ec 28 sub $0x28,%esp
186b: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
1872: 77 07 ja 187b <morecore+0x16>
1874: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
187b: 8b 45 08 mov 0x8(%ebp),%eax
187e: c1 e0 03 shl $0x3,%eax
1881: 89 04 24 mov %eax,(%esp)
1884: e8 50 fc ff ff call 14d9 <sbrk>
1889: 89 45 f4 mov %eax,-0xc(%ebp)
188c: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
1890: 75 07 jne 1899 <morecore+0x34>
1892: b8 00 00 00 00 mov $0x0,%eax
1897: eb 22 jmp 18bb <morecore+0x56>
1899: 8b 45 f4 mov -0xc(%ebp),%eax
189c: 89 45 f0 mov %eax,-0x10(%ebp)
189f: 8b 45 f0 mov -0x10(%ebp),%eax
18a2: 8b 55 08 mov 0x8(%ebp),%edx
18a5: 89 50 04 mov %edx,0x4(%eax)
18a8: 8b 45 f0 mov -0x10(%ebp),%eax
18ab: 83 c0 08 add $0x8,%eax
18ae: 89 04 24 mov %eax,(%esp)
18b1: e8 ce fe ff ff call 1784 <free>
18b6: a1 68 2c 00 00 mov 0x2c68,%eax
18bb: c9 leave
18bc: c3 ret
000018bd <malloc>:
18bd: 55 push %ebp
18be: 89 e5 mov %esp,%ebp
18c0: 83 ec 28 sub $0x28,%esp
18c3: 8b 45 08 mov 0x8(%ebp),%eax
18c6: 83 c0 07 add $0x7,%eax
18c9: c1 e8 03 shr $0x3,%eax
18cc: 83 c0 01 add $0x1,%eax
18cf: 89 45 ec mov %eax,-0x14(%ebp)
18d2: a1 68 2c 00 00 mov 0x2c68,%eax
18d7: 89 45 f0 mov %eax,-0x10(%ebp)
18da: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
18de: 75 23 jne 1903 <malloc+0x46>
18e0: c7 45 f0 60 2c 00 00 movl $0x2c60,-0x10(%ebp)
18e7: 8b 45 f0 mov -0x10(%ebp),%eax
18ea: a3 68 2c 00 00 mov %eax,0x2c68
18ef: a1 68 2c 00 00 mov 0x2c68,%eax
18f4: a3 60 2c 00 00 mov %eax,0x2c60
18f9: c7 05 64 2c 00 00 00 movl $0x0,0x2c64
1900: 00 00 00
1903: 8b 45 f0 mov -0x10(%ebp),%eax
1906: 8b 00 mov (%eax),%eax
1908: 89 45 f4 mov %eax,-0xc(%ebp)
190b: 8b 45 f4 mov -0xc(%ebp),%eax
190e: 8b 40 04 mov 0x4(%eax),%eax
1911: 3b 45 ec cmp -0x14(%ebp),%eax
1914: 72 4d jb 1963 <malloc+0xa6>
1916: 8b 45 f4 mov -0xc(%ebp),%eax
1919: 8b 40 04 mov 0x4(%eax),%eax
191c: 3b 45 ec cmp -0x14(%ebp),%eax
191f: 75 0c jne 192d <malloc+0x70>
1921: 8b 45 f4 mov -0xc(%ebp),%eax
1924: 8b 10 mov (%eax),%edx
1926: 8b 45 f0 mov -0x10(%ebp),%eax
1929: 89 10 mov %edx,(%eax)
192b: eb 26 jmp 1953 <malloc+0x96>
192d: 8b 45 f4 mov -0xc(%ebp),%eax
1930: 8b 40 04 mov 0x4(%eax),%eax
1933: 2b 45 ec sub -0x14(%ebp),%eax
1936: 89 c2 mov %eax,%edx
1938: 8b 45 f4 mov -0xc(%ebp),%eax
193b: 89 50 04 mov %edx,0x4(%eax)
193e: 8b 45 f4 mov -0xc(%ebp),%eax
1941: 8b 40 04 mov 0x4(%eax),%eax
1944: c1 e0 03 shl $0x3,%eax
1947: 01 45 f4 add %eax,-0xc(%ebp)
194a: 8b 45 f4 mov -0xc(%ebp),%eax
194d: 8b 55 ec mov -0x14(%ebp),%edx
1950: 89 50 04 mov %edx,0x4(%eax)
1953: 8b 45 f0 mov -0x10(%ebp),%eax
1956: a3 68 2c 00 00 mov %eax,0x2c68
195b: 8b 45 f4 mov -0xc(%ebp),%eax
195e: 83 c0 08 add $0x8,%eax
1961: eb 38 jmp 199b <malloc+0xde>
1963: a1 68 2c 00 00 mov 0x2c68,%eax
1968: 39 45 f4 cmp %eax,-0xc(%ebp)
196b: 75 1b jne 1988 <malloc+0xcb>
196d: 8b 45 ec mov -0x14(%ebp),%eax
1970: 89 04 24 mov %eax,(%esp)
1973: e8 ed fe ff ff call 1865 <morecore>
1978: 89 45 f4 mov %eax,-0xc(%ebp)
197b: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
197f: 75 07 jne 1988 <malloc+0xcb>
1981: b8 00 00 00 00 mov $0x0,%eax
1986: eb 13 jmp 199b <malloc+0xde>
1988: 8b 45 f4 mov -0xc(%ebp),%eax
198b: 89 45 f0 mov %eax,-0x10(%ebp)
198e: 8b 45 f4 mov -0xc(%ebp),%eax
1991: 8b 00 mov (%eax),%eax
1993: 89 45 f4 mov %eax,-0xc(%ebp)
1996: e9 70 ff ff ff jmp 190b <malloc+0x4e>
199b: c9 leave
199c: c3 ret
| 38.365933 | 63 | 0.416888 |
8eb290914974c23f4e644a5486813a56fe500d64 | 713 | asm | Assembly | oeis/117/A117216.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/117/A117216.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/117/A117216.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A117216: Number of points in the standard root system version of the D_4 lattice having L_infinity norm n.
; Submitted by Jon Maiga
; 1,40,272,888,2080,4040,6960,11032,16448,23400,32080,42680,55392,70408,87920,108120,131200,157352,186768,219640,256160,296520,340912,389528,442560,500200,562640,630072,702688,780680,864240,953560,1048832,1150248,1258000,1372280,1493280,1621192,1756208,1898520,2048320,2205800,2371152,2544568,2726240,2916360,3115120,3322712,3539328,3765160,4000400,4245240,4499872,4764488,5039280,5324440,5620160,5926632,6244048,6572600,6912480,7263880,7626992,8002008,8389120,8788520,9200400,9624952,10062368
mov $2,$0
mul $0,2
mul $2,8
mul $0,$2
add $0,4
mul $0,$2
trn $0,4
div $0,4
add $0,1
| 50.928571 | 493 | 0.805049 |
8a9dbc3f93419d93fe09f742dc27c7e6fbcff29b | 320 | asm | Assembly | programs/oeis/117/A117575.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/117/A117575.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/117/A117575.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A117575: Expansion of (1-x^3)/((1-x)*(1+2*x^2)).
; 1,1,-1,-2,2,4,-4,-8,8,16,-16,-32,32,64,-64,-128,128,256,-256,-512,512,1024,-1024,-2048,2048,4096,-4096,-8192,8192,16384,-16384,-32768,32768,65536,-65536,-131072,131072,262144,-262144,-524288,524288
sub $2,$0
div $0,2
mov $1,-2
pow $1,$0
gcd $2,2
dif $1,$2
mov $0,$1
| 29.090909 | 199 | 0.621875 |
89ca619de746347dfea2052821731638f373035e | 165 | asm | Assembly | libsrc/_DEVELOPMENT/adt/b_vector/c/sdcc_iy/b_vector_at.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/adt/b_vector/c/sdcc_iy/b_vector_at.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/adt/b_vector/c/sdcc_iy/b_vector_at.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
; int b_vector_at(b_vector_t *v, size_t idx)
SECTION code_clib
SECTION code_adt_b_vector
PUBLIC _b_vector_at
EXTERN _b_array_at
defc _b_vector_at = _b_array_at
| 13.75 | 44 | 0.824242 |
150fa7263547b996f0dbe9c686184d79e46a1e5c | 2,537 | asm | Assembly | Source/ZUIDSTCK.asm | walmartlabs/zFAM | f57e36adec60c0c03d2fb86cd944b2ce0c43f8f5 | [
"Apache-2.0"
] | 21 | 2018-04-17T15:37:29.000Z | 2021-09-26T20:19:16.000Z | Source/ZUIDSTCK.asm | wizardofzos/zFAM | f57e36adec60c0c03d2fb86cd944b2ce0c43f8f5 | [
"Apache-2.0"
] | null | null | null | Source/ZUIDSTCK.asm | wizardofzos/zFAM | f57e36adec60c0c03d2fb86cd944b2ce0c43f8f5 | [
"Apache-2.0"
] | 9 | 2016-12-02T16:08:12.000Z | 2017-10-27T04:07:02.000Z | *
* PROGRAM: ZUIDSTCK
* AUTHOR: Randy Frerking.
* DATE: June 29, 2014
* COMMENTS: Get STCKE TOD for COBOL program.
*
*
***********************************************************************
* Application dynamic storage area - start *
***********************************************************************
DSA DSECT
EISTOD DS CL16 STCKE TOD time
*
***********************************************************************
* Application dynamic storage area - end *
***********************************************************************
*
*
***********************************************************************
* Control Section *
***********************************************************************
ZUIDSTCK AMODE 31
ZUIDSTCK RMODE 31
ZUIDSTCK CSECT
STM R14,R12,12(R13) Save registers
L R1,0(R1) Load parameter address
USING DSA,R1 ... tell assember
STCKE EISTOD Save STCKE TOD
*
LM R14,R12,12(R13) Load Registers
XR R15,R15 Clear R15 (RC)
BR R14 Return to calling program
*
DC CL08'ZUIDSTCK '
DC CL48' -- Get STCKE TOD for COBOL program '
DC CL08' '
DC CL08'&SYSDATE'
DC CL08' '
DC CL08'&SYSTIME'
*
***********************************************************************
* Literal Pool *
***********************************************************************
LTORG
DS 0F
*
***********************************************************************
* Register assignments *
***********************************************************************
DS 0F
R0 EQU 0
R1 EQU 1
R2 EQU 2
R3 EQU 3
R4 EQU 4
R5 EQU 5
R6 EQU 6
R7 EQU 7
R8 EQU 8
R9 EQU 9
R10 EQU 10
R11 EQU 11
R12 EQU 12
R13 EQU 13
R14 EQU 14
R15 EQU 15
*
***********************************************************************
* End of Program *
***********************************************************************
END ZUIDSTCK | 35.732394 | 71 | 0.261726 |
155390fef5fca2eeb04f0a95e597832eecfde5c5 | 477 | asm | Assembly | programs/oeis/246/A246030.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/246/A246030.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/246/A246030.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A246030: a(n) = (5*2^(2*n)+(-2)^(n+1))/3.
; 1,8,24,112,416,1728,6784,27392,109056,437248,1746944,6991872,27959296,111853568,447381504,1789591552,7158235136,28633202688,114532286464,458130194432,1832518680576,7330078916608,29320307277824,117281245888512,469124949999616,1876499867107328,7505999334211584
mov $1,-2
pow $1,$0
mov $0,1
mov $2,4
mov $3,$1
mov $4,4
lpb $0
sub $0,1
sub $3,$4
add $2,$3
mul $2,4
lpe
sub $1,1
add $1,$2
pow $1,2
sub $1,13
div $1,15
add $1,1
| 21.681818 | 260 | 0.708595 |
89df657628bef01a0ef9187e49c1b71ac0133bfb | 420 | asm | Assembly | programs/oeis/278/A278741.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/278/A278741.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/278/A278741.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A278741: Odd numbers n such that tau(n-1) is a prime.
; 3,5,17,65,1025,4097,65537,262145,4194305,268435457,1073741825,68719476737,1099511627777,4398046511105,70368744177665,4503599627370497,288230376151711745,1152921504606846977,73786976294838206465,1180591620717411303425,4722366482869645213697
seq $0,6005 ; The odd prime numbers together with 1.
mov $1,2
pow $1,$0
mul $1,30
mov $0,$1
sub $0,91
div $0,60
add $0,3
| 35 | 241 | 0.797619 |
daf7d09b0fa2604e2fb1942a5fac729fd91c751e | 5,196 | asm | Assembly | Transynther/x86/_processed/NONE/_st_un_/i7-8650U_0xd2.log_11742_1253.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_st_un_/i7-8650U_0xd2.log_11742_1253.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_st_un_/i7-8650U_0xd2.log_11742_1253.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x14873, %rsi
lea addresses_D_ht+0x18a93, %rdi
nop
nop
nop
nop
inc %r9
mov $56, %rcx
rep movsl
and $45633, %r9
lea addresses_UC_ht+0x1da13, %rsi
lea addresses_A_ht+0x1ea13, %rdi
cmp %rbp, %rbp
mov $109, %rcx
rep movsb
nop
nop
nop
nop
cmp %rbp, %rbp
lea addresses_WT_ht+0xe6eb, %rsi
lea addresses_normal_ht+0x60d3, %rdi
clflush (%rdi)
nop
nop
nop
dec %rbp
mov $75, %rcx
rep movsq
nop
xor %rbp, %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r13
push %rbp
push %rcx
push %rsi
// Store
lea addresses_US+0x12be7, %r10
nop
nop
nop
nop
nop
xor %rsi, %rsi
movw $0x5152, (%r10)
nop
nop
nop
xor $22644, %r13
// Store
lea addresses_WT+0x613, %rcx
nop
nop
nop
nop
nop
add $11378, %r12
mov $0x5152535455565758, %rsi
movq %rsi, (%rcx)
nop
nop
nop
nop
nop
dec %r12
// Faulty Load
lea addresses_WC+0xf613, %rbp
and $8962, %r10
mov (%rbp), %cx
lea oracles, %rbp
and $0xff, %rcx
shlq $12, %rcx
mov (%rbp,%rcx,1), %rcx
pop %rsi
pop %rcx
pop %rbp
pop %r13
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}}
{'58': 11740, 'd0': 2}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 d0 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 d0 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
| 43.663866 | 2,999 | 0.661085 |
746a3e40c7da02d7cc2200c9991ebfabca2f1120 | 1,988 | asm | Assembly | E91.asm | SEUGaoJiajun/microcomputer | 52ae69e576b53ccb7e80b3dd8715dec88fc7aec6 | [
"MIT"
] | null | null | null | E91.asm | SEUGaoJiajun/microcomputer | 52ae69e576b53ccb7e80b3dd8715dec88fc7aec6 | [
"MIT"
] | null | null | null | E91.asm | SEUGaoJiajun/microcomputer | 52ae69e576b53ccb7e80b3dd8715dec88fc7aec6 | [
"MIT"
] | null | null | null | DATA SEGMENT
BUFFER DB 11
DB ?
DB 10 DUP(?)
STIME DB 0DH,0AH
DB 8 DUP(?)
DB '$'
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
BEGIN: MOV AX,DATA
MOV DS,AX
MOV DL,':'
MOV AH,2
INT 21H
MOV DX,OFFSET BUFFER
MOV AH,0AH
INT 21H
MOV BX,OFFSET BUFFER+2
MOV AL,[BX]
AND AL,0FH
MOV [BX],AL
INC BX
MOV AL,[BX]
AND AL,0FH
MOV [BX],AL
INC BX
INC BX
MOV AL,[BX]
AND AL,0FH
MOV [BX],AL
INC BX
MOV AL,[BX]
AND AL,0FH
MOV [BX],AL
INC BX
INC BX
MOV AL,[BX]
AND AL,0FH
MOV [BX],AL
INC BX
MOV AL,[BX]
AND AL,0FH
MOV [BX],AL
MOV BX,OFFSET BUFFER+2
CALL TOBCD
MOV CH,AL
ADD BX,3
CALL TOBCD
MOV DH,AL
ADD BX,3
CALL TOBCD
MOV DL,AL
AGAIN: PUSH CX
MOV CX,0FFFFH
C: CALL DELAY
LOOP C
POP CX
MOV AL,DL
ADD AL,1
DAA
MOV DL,AL
CMP AL,60H
JNE DISPY
MOV DL,0
MOV AL,DH
ADD AL,1
DAA
MOV DH,AL
CMP AL,60H
JNE DISPY
MOV DH,0
MOV AL,CH
ADD AL,1
DAA
MOV CH,AL
CMP AL,24H
JNE DISPY
MOV CH,0
DISPY:MOV BX,OFFSET STIME+2
MOV AL,CH
CALL TOA
INC BX
MOV AL,':'
MOV [BX],AL
INC BX
MOV AL,DH
CALL TOA
INC BX
MOV AL,':'
MOV [BX],AL
INC BX
MOV AL,DL
CALL TOA
PUSH BX
PUSH CX
PUSH DX
MOV BH,0
MOV DH,0
MOV DL,0
MOV AH,2
INT 10H
MOV AL,' '
MOV BH,0
MOV BL,47H
MOV AH,9
INT 10H
MOV BH,0
MOV DH,23
MOV DL,0
MOV AH,2
INT 10H
MOV DX,OFFSET STIME
MOV AH,9H
INT 21H
MOV AH,06H
MOV DL,0FFH
INT 21H
JNZ OVER
POP DX
POP CX
POP BX
JMP AGAIN
OVER:MOV AH,4CH
INT 21H
TOBCD PROC
MOV AL,[BX]
SHL AL,1
SHL AL,1
SHL AL,1
SHL AL,1
OR AL,[BX+1]
RET
TOBCD ENDP
TOA PROC
MOV CL,AL
SHR AL,1
SHR AL,1
SHR AL,1
SHR AL,1
OR AL,30H
MOV [BX],AL
INC BX
MOV AL,CL
AND AL,0FH
OR AL,30H
MOV [BX],AL
RET
TOA ENDP
DELAY PROC
PUSH CX
PUSH AX
MOV CX,0FFFFH
GOON:DEC CX
JNE GOON
POP AX
POP CX
RET
DELAY ENDP
CODE ENDS
END BEGIN
| 12.048485 | 31 | 0.581489 |
5c0b72943b6fe923e26ce387977e945c86e5ed9b | 179 | asm | Assembly | nasm/you_cant_code_under_pressure_#1_53ee5429ba190077850011d4.asm | p85/codewars-solutions | b4a5073b0c21f64e50e975416526ba5dd58019fc | [
"MIT"
] | null | null | null | nasm/you_cant_code_under_pressure_#1_53ee5429ba190077850011d4.asm | p85/codewars-solutions | b4a5073b0c21f64e50e975416526ba5dd58019fc | [
"MIT"
] | null | null | null | nasm/you_cant_code_under_pressure_#1_53ee5429ba190077850011d4.asm | p85/codewars-solutions | b4a5073b0c21f64e50e975416526ba5dd58019fc | [
"MIT"
] | null | null | null | SECTION .text
global double_integer
double_integer:
mov eax,edi
cmp eax,0d
mov bx,2d
jge positive
neg eax
mul bx
neg eax
jmp end
positive:
mul bx
end:
ret | 11.1875 | 21 | 0.681564 |
68f6b803ee8b43b8a7744c207520ef9d3570dea3 | 6,908 | asm | Assembly | Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_900.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_900.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_900.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r15
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x8daa, %r15
nop
nop
nop
nop
xor $13543, %rbx
mov $0x6162636465666768, %rsi
movq %rsi, %xmm6
movups %xmm6, (%r15)
nop
nop
nop
inc %rdi
lea addresses_D_ht+0xa0e, %r12
sub %r10, %r10
movl $0x61626364, (%r12)
nop
nop
nop
inc %r10
lea addresses_A_ht+0x904a, %rsi
lea addresses_normal_ht+0x12821, %rdi
nop
nop
nop
nop
nop
add $33582, %rdx
mov $70, %rcx
rep movsw
nop
nop
nop
nop
add $26307, %rbx
lea addresses_D_ht+0x1e63, %rsi
lea addresses_normal_ht+0x1b34a, %rdi
nop
nop
nop
nop
nop
and %rdx, %rdx
mov $7, %rcx
rep movsw
nop
nop
nop
sub %rdi, %rdi
lea addresses_UC_ht+0xc0aa, %rcx
and %rbx, %rbx
movl $0x61626364, (%rcx)
nop
nop
nop
nop
add $60886, %rdi
lea addresses_WT_ht+0x32a, %rsi
lea addresses_normal_ht+0x9f37, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
xor $14030, %r12
mov $38, %rcx
rep movsq
nop
nop
nop
nop
nop
inc %rdx
lea addresses_UC_ht+0xf6ca, %rsi
lea addresses_A_ht+0x81ca, %rdi
xor %r10, %r10
mov $78, %rcx
rep movsw
inc %r12
lea addresses_A_ht+0xc40a, %rbx
cmp %rsi, %rsi
vmovups (%rbx), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $0, %xmm0, %rcx
nop
nop
nop
nop
nop
xor $61936, %r12
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r15
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r15
push %r8
push %rbp
push %rbx
push %rdx
push %rsi
// Store
lea addresses_RW+0x3baa, %r13
nop
nop
nop
inc %rbx
movw $0x5152, (%r13)
nop
nop
nop
sub $4540, %rbx
// Store
lea addresses_WT+0x1c1a, %r13
nop
nop
nop
nop
nop
sub %r15, %r15
mov $0x5152535455565758, %rbx
movq %rbx, %xmm1
and $0xffffffffffffffc0, %r13
vmovaps %ymm1, (%r13)
nop
xor %rbp, %rbp
// Store
lea addresses_RW+0xfca, %r13
clflush (%r13)
add %rdx, %rdx
mov $0x5152535455565758, %rbp
movq %rbp, %xmm4
movups %xmm4, (%r13)
sub $21465, %r15
// Faulty Load
lea addresses_UC+0x6dca, %rsi
nop
nop
nop
nop
nop
dec %r8
mov (%rsi), %bx
lea oracles, %rbp
and $0xff, %rbx
shlq $12, %rbx
mov (%rbp,%rbx,1), %rbx
pop %rsi
pop %rdx
pop %rbx
pop %rbp
pop %r8
pop %r15
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 5, 'size': 2, 'same': False, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': True, 'congruent': 4, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 6, 'size': 16, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 5, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 2, 'size': 4, 'same': False, 'NT': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 5, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 4, 'size': 32, 'same': False, 'NT': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 34.368159 | 2,999 | 0.659959 |
895462533d10acee693770c8a185b2ac8120d23b | 479 | asm | Assembly | oeis/073/A073881.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/073/A073881.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/073/A073881.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A073881: a(n) = smallest number m (obviously prime) such that pi(m) = 2*pi(n).
; 1,3,7,7,13,13,19,19,19,19,29,29,37,37,37,37,43,43,53,53,53,53,61,61,61,61,61,61,71,71,79,79,79,79,79,79,89,89,89,89,101,101,107,107,107,107,113,113,113,113,113,113,131,131,131,131,131,131,139,139,151,151
seq $0,720 ; pi(n), the number of primes <= n. Sometimes called PrimePi(n) to distinguish it from the number 3.14159...
mul $0,2
trn $0,1
seq $0,6005 ; The odd prime numbers together with 1.
| 59.875 | 205 | 0.686848 |
5e88344ad3d22731fb440324fe5e2aeb4ad343b7 | 146 | asm | Assembly | other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/kart/mak.lzh/mak/kart-apu.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/kart/mak.lzh/mak/kart-apu.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/kart/mak.lzh/mak/kart-apu.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | Name: kart-apu.asm
Type: file
Size: 33859
Last-Modified: '1992-08-06T07:16:29Z'
SHA-1: C4E070FC2CE65A68977D68DCC14A43E063138C5D
Description: null
| 20.857143 | 47 | 0.808219 |
b509d31808294172340649a92edfe9556b180e7e | 512 | asm | Assembly | oeis/026/A026728.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/026/A026728.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/026/A026728.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A026728: a(n) = number of primes of the form k*(n-k) + 1.
; Submitted by Christian Krause
; 0,1,1,1,2,0,3,2,1,1,4,1,6,1,1,2,8,1,5,3,1,4,7,1,7,1,4,5,8,0,10,6,2,2,7,1,9,8,4,4,14,1,16,3,3,5,12,3,7,7,4,11,21,0,11,4,7,6,11,2,12,9,7,10,7,1,22,7,7,5,17,3,23,10,2,9,19,2,19,8,5,8,23,1,16,6,4,11,14,4,16,12,9,5,12
mov $3,$0
add $3,1
mov $5,$0
lpb $3
mov $2,$5
seq $2,80339 ; Characteristic function of {1} union {primes}: 1 if n is 1 or a prime, else 0.
sub $3,2
add $4,$2
add $5,$3
sub $5,1
lpe
mov $0,$4
| 30.117647 | 214 | 0.580078 |
20b9a9a7402b586438d56fbd3ec996ba1da53fb8 | 234 | asm | Assembly | src/res/music/song_table.asm | Xeyler/gb-hello-world | f8a10a3589caab9d3d183d459cdfd070c1d73070 | [
"MIT"
] | null | null | null | src/res/music/song_table.asm | Xeyler/gb-hello-world | f8a10a3589caab9d3d183d459cdfd070c1d73070 | [
"MIT"
] | null | null | null | src/res/music/song_table.asm | Xeyler/gb-hello-world | f8a10a3589caab9d3d183d459cdfd070c1d73070 | [
"MIT"
] | null | null | null | add_song: MACRO
.\1::
db BANK(\1)
dw \1
; The song bank must be representable with a single byte
ASSERT BANK(\1) <= $FF
ENDM
SECTION "song table", ROMX
song_table::
add_song ryukenden
add_song wild_pokemon_appear
add_song uwu
| 14.625 | 56 | 0.730769 |
f9cbbeaf25cfbe9f120aa5b351d9dcc0c50af844 | 189 | nasm | Assembly | MdePkg/pcdhack.nasm | Zero-Tang/EDK-II-Library | 18462d4d1fe318f3e89a03fc1ad7341d33902665 | [
"MIT"
] | 7 | 2020-09-02T14:57:52.000Z | 2022-03-11T09:07:02.000Z | MdePkg/pcdhack.nasm | Zero-Tang/EDK-II-Library | 18462d4d1fe318f3e89a03fc1ad7341d33902665 | [
"MIT"
] | null | null | null | MdePkg/pcdhack.nasm | Zero-Tang/EDK-II-Library | 18462d4d1fe318f3e89a03fc1ad7341d33902665 | [
"MIT"
] | 3 | 2020-09-04T14:06:11.000Z | 2021-07-19T10:57:04.000Z | %define ASM_PFX(a) a
%define PcdGet32(a) _gPcd_FixedAtBuild_ %+ a
%define THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 0x00000002
%define THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL 0x00000004 | 31.5 | 60 | 0.857143 |
1aff365ae5b8aeaa5727f0baf9ea9aed216f5aec | 1,993 | asm | Assembly | programs/oeis/033/A033539.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/033/A033539.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/033/A033539.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A033539: a(0)=1, a(1)=1, a(2)=1, a(n) = 2*a(n-1) + a(n-2) + 1.
; 1,1,1,4,10,25,61,148,358,865,2089,5044,12178,29401,70981,171364,413710,998785,2411281,5821348,14053978,33929305,81912589,197754484,477421558,1152597601,2782616761,6717831124,16218279010,39154389145,94527057301,228208503748,550944064798,1330096633345,3211137331489,7752371296324,18715879924138,45184131144601,109084142213341,263352415571284,635788973355910,1534930362283105,3705649697922121,8946229758127348,21598109214176818,52142448186480985,125883005587138789,303908459360758564,733699924308655918,1771308307978070401,4276316540264796721,10323941388507663844,24924199317280124410,60172340023067912665,145268879363415949741,350710098749899812148,846689076863215574038,2044088252476330960225,4934865581815877494489,11913819416108085949204,28762504414032049392898,69438828244172184735001,167640160902376418862901,404719150048925022460804,977078461000226463784510,2358876072049377950029825,5694830605098982363844161,13748537282247342677718148,33191905169593667719280458,80132347621434678116279065,193456600412463023951838589,467045548446360726019956244,1127547697305184475991751078,2722140943056729678003458401,6571829583418643831998667881,15865800109894017342000794164,38303429803206678516000256210,92472659716307374374001306585,223248749235821427264002869381,538970158187950228902007045348,1301189065611721885068016960078,3141348289411393999038040965505,7583885644434509883144098891089,18309119578280413765326238747684,44202124800995337413796576386458,106713369180271088592919391520601,257628863161537514599635359427661,621971095503346117792190110375924,1501571054168229750184015580179510,3625113203839805618160221270734945,8751797461847840986504458121649401,21128708127535487591169137514033748,51009213716918816168842733149716898,123147135561373119928854603813467545,297303484839665056026551940776651989,717754105240703231981958485366771524
trn $0,2
seq $0,78057 ; Expansion of (1+x)/(1-2*x-x^2).
div $0,2
mul $0,3
add $0,1
| 221.444444 | 1,843 | 0.912694 |
8559af450314bff5439db217702b1be19e33360e | 1,370 | asm | Assembly | src/mappers/mapper11.asm | ddp34/neon64v2 | f887944762b402ee372111e53ef6808bddd30ddb | [
"ISC"
] | 36 | 2020-07-08T11:27:17.000Z | 2022-03-15T08:38:52.000Z | src/mappers/mapper11.asm | ddp34/neon64v2 | f887944762b402ee372111e53ef6808bddd30ddb | [
"ISC"
] | 19 | 2020-07-12T23:14:03.000Z | 2021-12-14T07:57:40.000Z | src/mappers/mapper11.asm | ddp34/neon64v2 | f887944762b402ee372111e53ef6808bddd30ddb | [
"ISC"
] | 6 | 2021-07-17T09:57:46.000Z | 2022-03-13T07:50:25.000Z | // Mapper 11: Color Dreams
scope Mapper11: {
Init:
addi sp, 8
sw ra, -8(sp)
// 32K
jal TLB.AllocateVaddr
lui a0, 0x1'0000 >> 16 // align 64K to leave a 32k guard page unmapped
ls_gp(sw a0, mapper11_prgrom_vaddr)
ls_gp(sb a1, mapper11_prgrom_tlb_index)
// 0x8000-0x1'0000
addi t0, a0, -0x8000
la_gp(t1, Write)
lli t2, 0
lli t3, 0x80
-
sw t0, cpu_read_map + 0x80 * 4 (t2)
sw t1, cpu_write_map + 0x80 * 4 (t2)
addi t3, -1
bnez t3,-
addi t2, 4
// Initially map PRG ROM bank 0, CHR ROM bank 0
j Write_alt
lli cpu_t0, 0
Write:
// cpu_t0: data
// cpu_t1: address (unused)
addi sp, 8
sw ra, -8(sp)
Write_alt:
// TODO save cpu_t0 for save states
and t3, cpu_t0, 3
sll t3, 15 // 32k PRG ROM bank
ls_gp(lw a1, prgrom_start_phys)
ls_gp(lw a0, mapper11_prgrom_vaddr)
ls_gp(lwu t1, prgrom_mask)
ls_gp(lbu t2, mapper11_prgrom_tlb_index)
and t3, t1
add a1, t3
jal TLB.Map32K
mtc0 t2, Index
srl t0, cpu_t0, 4
sll t0, chrrom_page_shift
ls_gp(lwu t2, chrrom_mask)
ls_gp(lwu t1, chrrom_start)
and t0, t2
dadd t0, t1
dsll32 t1, t0, 0
or t0, t1
sd t0, ppu_map + 0*4 (r0)
sd t0, ppu_map + 2*4 (r0)
sd t0, ppu_map + 4*4 (r0)
sd t0, ppu_map + 6*4 (r0)
lw ra, -8(sp)
jr ra
addi sp, -8
}
begin_bss()
align(4)
mapper11_prgrom_vaddr:; dw 0
mapper11_prgrom_tlb_index:; db 0
align(4)
end_bss()
| 17.125 | 73 | 0.651825 |
84bb471c4205805e5b1e4478092a34d52071ba80 | 141 | asm | Assembly | other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/kart/risc.lzh/risc/join/demo.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/kart/risc.lzh/risc/join/demo.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/kart/risc.lzh/risc/join/demo.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | Name: demo.asm
Type: file
Size: 7075
Last-Modified: '1992-11-18T01:48:27Z'
SHA-1: A0376E84CCFE0EE836CE249F891A99E642295D48
Description: null
| 20.142857 | 47 | 0.808511 |
9ae01482808f309612578c51b26eb3915d904a8e | 437 | asm | Assembly | programs/oeis/234/A234904.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/234/A234904.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/234/A234904.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A234904: a(n)*Pi is the total length of irregular spiral (center points: 2, 1, 3) after n rotations.
; 3,12,18,21,30,36,39,48,54,57,66,72,75,84,90,93,102,108,111,120,126,129,138,144,147,156,162,165,174,180,183,192,198,201,210,216,219,228,234,237,246,252,255,264,270,273,282,288,291,300,306,309,318,324,327,336,342,345,354,360,363,372,378,381,390,396,399,408
mov $1,3
gcd $1,$0
mod $1,3
add $1,$0
add $1,$0
mul $1,3
add $1,3
mov $0,$1
| 36.416667 | 256 | 0.688787 |
ce6c02eea59b1ebf52f22f013919d2a17acc1bdb | 5,604 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_st_zr_4k_/i7-7700_9_0x48_notsx.log_21829_1850.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/AVXALIGN/_st_zr_4k_/i7-7700_9_0x48_notsx.log_21829_1850.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/AVXALIGN/_st_zr_4k_/i7-7700_9_0x48_notsx.log_21829_1850.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x2761, %rcx
nop
cmp %r14, %r14
and $0xffffffffffffffc0, %rcx
movntdqa (%rcx), %xmm0
vpextrq $0, %xmm0, %rbx
nop
nop
nop
nop
nop
add %rbp, %rbp
lea addresses_WC_ht+0xcc39, %rsi
lea addresses_WC_ht+0x14f39, %rdi
nop
nop
nop
xor $28112, %r13
mov $72, %rcx
rep movsq
nop
nop
dec %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_UC+0xed39, %r11
nop
nop
nop
nop
cmp %rbp, %rbp
mov $0x5152535455565758, %r10
movq %r10, (%r11)
nop
nop
nop
xor $6812, %rdx
// Store
lea addresses_A+0x18a39, %r11
clflush (%r11)
nop
nop
nop
nop
nop
sub $12645, %rax
mov $0x5152535455565758, %rdx
movq %rdx, (%r11)
// Exception!!!
nop
nop
nop
nop
nop
mov (0), %r12
dec %r12
// Store
mov $0x339, %r10
add $27110, %r9
mov $0x5152535455565758, %rax
movq %rax, %xmm2
movups %xmm2, (%r10)
dec %rbp
// REPMOV
mov $0x5a1710000000ce9, %rsi
mov $0x439, %rdi
nop
nop
sub $43640, %rbp
mov $39, %rcx
rep movsb
nop
nop
nop
nop
inc %r11
// Faulty Load
mov $0x7001b20000000a39, %rbp
nop
nop
nop
nop
nop
and $2497, %r12
mov (%rbp), %r11d
lea oracles, %rax
and $0xff, %r11
shlq $12, %r11
mov (%rax,%r11,1), %r11
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_NC', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_UC', 'congruent': 7}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_A', 'congruent': 11}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_P', 'congruent': 8}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 7, 'type': 'addresses_P'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_NC'}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': True, 'size': 4, 'type': 'addresses_NC', 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'NT': True, 'AVXalign': False, 'size': 16, 'type': 'addresses_UC_ht', 'congruent': 3}}
{'dst': {'same': False, 'congruent': 8, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_WC_ht'}}
{'58': 13396, '00': 8433}
58 58 58 58 58 58 00 00 00 00 58 58 58 00 58 58 00 58 00 00 58 58 58 58 58 58 58 58 00 00 00 00 00 00 58 58 58 00 00 58 00 58 58 58 58 58 58 58 00 00 58 00 58 00 58 58 58 00 58 58 58 00 58 58 58 58 00 58 00 58 00 58 00 58 00 00 00 58 58 00 00 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 00 00 58 58 58 58 00 58 00 58 58 58 00 58 58 00 00 58 58 58 00 00 58 58 00 00 58 58 00 00 00 00 00 58 58 00 58 58 58 58 58 58 58 00 58 00 00 00 58 58 58 58 58 58 58 00 00 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 00 00 58 58 58 00 58 58 00 58 58 58 58 00 00 58 00 58 00 58 58 58 58 00 00 00 58 58 00 00 58 58 58 00 58 00 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 00 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 00 00 58 58 58 58 58 00 58 58 58 00 58 00 00 00 58 00 00 58 00 00 58 58 00 00 58 58 58 00 58 00 00 58 00 58 58 58 58 58 58 58 58 00 58 00 00 58 58 58 00 58 58 58 58 58 58 00 58 00 58 00 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 00 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 00 58 00 58 58 58 58 00 00 58 00 58 58 00 58 00 00 58 58 58 00 58 00 58 58 00 58 00 58 58 58 58 00 58 00 58 58 00 58 00 00 58 00 00 58 00 58 58 58 00 58 58 58 58 00 00 00 58 58 00 58 58 58 00 58 00 00 00 00 00 00 00 58 58 00 00 58 00 58 58 58 58 58 58 58 00 00 58 58 00 00 58 00 58 58 00 58 58 00 58 00 58 00 58 00 58 00 58 58 58 00 00 00 58 00 58 00 00 58 58 58 00 58 00 00 58 58 58 58 58 00 00 00 58 58 58 58 58 58 00 58 00 58 58 58 58 58 58 00 00 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 00 00 00 58 00 00 00 58 58 58 58 00 58 00 58 58 58 00 00 58 58 58 00 00 00 58 58 58 58 58 58 58 58 58 58 00 58 00 58 58 58 58 00 58 58 00 58 58 00 58 58 58 00 00 58 00 58 00 00 58 58 58 58 58 58 00 58 58 58 58 58 58 00 58 58 58 00 58 00 58 00 58 58 58 58 58 00 58 58 00 58 00 58 58 58 00 00 58 58 00 00 00 58 58 00 00 00 00 00 00 00 58 00 58 00 58 58 00 58 00 58 58 58 58 58 58 00 58 58 00 58 58 58 58 58 58 58 00 58 58 58 00 00 00 58 00 00 58 00 00 00 00 58 58 58 58 00 00 00 58 58 00 58 00 00 58 58 00 58 58 00 00 58 58 00 00 00 58 00 00 58 00 00 00 58 00 00 58 58 58 00 00 58 58 00 58 58 58 58 58 58 58 00 00 58 00 58 58 58 00 58 00 58 58 00 58 58 58 58 58 58 00 58 00 00 58 00 00 58 00 58 00 58 58 58 58 00 58 58 00 00 58 58 58 00 00 00 00 58 58 58 58 00 58 00 00 00 58 58 00 58 00 58 00 00 58 00 58 58 00 58 00 58 58 58 58 58 58 58 00 58 58 00 58 00 00 58 58 00 58 58 58 58 58 00 58 58 58 00 00 58 00 00 00 58 00 00 00 00 58 58 00 00 58 00 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 00 58 58 00 58 58 58 58 58 58 58 58 00 58 00 58 00 58 58 58 58 58 58 58 58 00 58 58 58 00 00 00 58 00 58 00 00 58 00 58 00 58 58 00 00 58 58 58 00 58 00 58 58 00 00 58 58 00 58 58 58 58 58 58 58 00 00 58 58 58 58 58 58 00 58 00 00 58 00 58 00 58 58 58 58 00 00 58 58 58 58 00 58 00 00 58 00 58 58 58 00 00 58 00 58 00 00 00 00 58 58 58 58 58 00 58 58 58 58 58 58 58 58 00 00 00 00 00 00 00 00 00 58 58 58
*/
| 36.627451 | 2,999 | 0.657388 |
c2fcc03f6748a5e48cc61cef996052ca94f9526b | 12,455 | asm | Assembly | P6/data_P6_2/ALUTest115.asm | alxzzhou/BUAA_CO_2020 | b54bf367081a5a11701ebc3fc78a23494aecca9e | [
"Apache-2.0"
] | 1 | 2022-01-23T09:24:47.000Z | 2022-01-23T09:24:47.000Z | P6/data_P6_2/ALUTest115.asm | alxzzhou/BUAA_CO_2020 | b54bf367081a5a11701ebc3fc78a23494aecca9e | [
"Apache-2.0"
] | null | null | null | P6/data_P6_2/ALUTest115.asm | alxzzhou/BUAA_CO_2020 | b54bf367081a5a11701ebc3fc78a23494aecca9e | [
"Apache-2.0"
] | null | null | null | andi $1,$4,8027
sh $3,4($0)
lh $3,14($0)
xori $4,$4,3757
sltu $3,$5,$3
sltiu $4,$5,14899
addu $3,$4,$3
nor $1,$4,$3
slti $3,$3,-27990
lh $4,4($0)
slti $4,$6,-30725
sh $4,2($0)
slt $3,$3,$3
srlv $5,$5,$3
andi $5,$6,2660
addu $5,$3,$3
sra $3,$4,29
slt $4,$3,$3
subu $5,$4,$3
addu $4,$4,$3
or $3,$6,$3
addiu $3,$1,28685
srlv $0,$0,$3
xor $3,$3,$3
sw $3,8($0)
nor $3,$3,$3
subu $0,$0,$3
slt $4,$0,$3
subu $5,$3,$3
lhu $5,10($0)
srav $3,$3,$3
nor $4,$4,$3
subu $4,$4,$3
lhu $4,16($0)
srlv $4,$1,$3
lbu $4,7($0)
nor $1,$1,$3
addu $3,$4,$3
addiu $5,$3,10472
addu $4,$5,$3
slti $6,$5,1402
or $5,$5,$3
srav $1,$4,$3
srlv $4,$4,$3
srlv $6,$3,$3
srlv $6,$3,$3
lw $2,16($0)
srlv $4,$4,$3
and $4,$4,$3
xori $3,$3,46067
and $5,$5,$3
lb $4,2($0)
slt $5,$6,$3
srlv $4,$1,$3
addu $1,$3,$3
sh $4,0($0)
sra $3,$3,6
and $4,$3,$3
addu $1,$3,$3
sltu $4,$0,$3
ori $3,$3,7098
ori $4,$5,58265
sllv $5,$5,$3
and $6,$1,$3
sw $5,0($0)
addu $6,$3,$3
sllv $3,$3,$3
sh $6,0($0)
addiu $4,$3,-17207
sltu $1,$5,$3
subu $1,$4,$3
sw $1,0($0)
lb $5,12($0)
sllv $6,$3,$3
sw $3,16($0)
lw $5,4($0)
lbu $3,7($0)
srl $0,$4,9
srl $1,$5,4
andi $1,$3,37448
lb $6,4($0)
sll $0,$0,24
lh $3,4($0)
slti $5,$5,-28599
sra $0,$3,29
and $1,$0,$3
sllv $3,$5,$3
sb $4,9($0)
sll $0,$0,29
srav $5,$3,$3
srl $4,$2,26
ori $6,$5,57497
slti $0,$0,25266
xor $4,$4,$3
sltu $5,$1,$3
lbu $3,12($0)
lh $1,12($0)
nor $6,$2,$3
addiu $4,$3,-7089
srl $1,$2,20
sltu $5,$4,$3
sh $6,2($0)
addu $4,$5,$3
subu $4,$5,$3
lh $5,14($0)
addiu $3,$4,15164
lh $5,2($0)
srl $0,$1,1
srlv $6,$1,$3
addu $4,$3,$3
addiu $1,$3,5793
sb $5,4($0)
subu $4,$4,$3
subu $4,$1,$3
sll $4,$4,0
addu $3,$3,$3
or $4,$3,$3
xor $4,$3,$3
subu $3,$3,$3
lh $0,10($0)
addu $6,$6,$3
lh $6,10($0)
slt $3,$4,$3
subu $3,$3,$3
andi $0,$1,13835
addu $3,$3,$3
lw $4,0($0)
addu $3,$4,$3
sltiu $3,$2,3029
addiu $4,$4,-11914
slti $1,$3,776
sh $3,0($0)
lhu $3,12($0)
srl $5,$3,9
lhu $1,14($0)
srlv $3,$3,$3
srl $4,$0,20
andi $3,$3,33841
andi $5,$3,35461
srlv $4,$0,$3
slt $3,$3,$3
xor $6,$6,$3
srav $3,$3,$3
xor $4,$3,$3
ori $4,$6,43719
sb $3,4($0)
nor $6,$1,$3
sra $4,$1,21
sltiu $6,$3,1606
or $5,$4,$3
addu $1,$3,$3
lh $3,14($0)
sh $4,8($0)
slt $3,$5,$3
or $1,$5,$3
addu $0,$3,$3
subu $3,$3,$3
lbu $5,3($0)
subu $0,$3,$3
andi $4,$4,24766
sh $1,14($0)
xor $3,$3,$3
xori $3,$3,16991
slt $3,$5,$3
lhu $3,8($0)
lh $6,10($0)
or $1,$3,$3
sll $5,$6,12
addiu $4,$0,13000
xori $1,$4,40604
sh $1,4($0)
slti $5,$1,25044
sll $3,$6,23
and $4,$3,$3
xori $3,$0,57611
sb $4,7($0)
sb $3,0($0)
subu $0,$2,$3
sltiu $3,$3,25804
andi $0,$0,23646
sh $3,8($0)
lh $4,16($0)
sra $4,$3,11
subu $4,$4,$3
lhu $3,4($0)
sw $3,0($0)
sw $3,16($0)
lb $6,8($0)
srlv $0,$4,$3
sll $4,$4,15
sllv $0,$4,$3
sw $3,16($0)
srl $6,$2,7
addu $1,$4,$3
sltu $6,$6,$3
lw $3,0($0)
nor $3,$4,$3
lhu $4,4($0)
lb $1,16($0)
sra $4,$4,31
sra $4,$4,23
nor $1,$3,$3
lb $3,3($0)
sra $4,$3,24
srl $3,$3,6
lw $0,12($0)
addiu $3,$3,-15937
sw $4,4($0)
lbu $5,16($0)
ori $4,$5,35054
xori $1,$5,1408
addu $1,$5,$3
lhu $3,8($0)
addiu $3,$3,16023
xori $6,$0,45863
slti $5,$3,-20031
sh $6,12($0)
xor $3,$3,$3
sllv $5,$4,$3
sll $4,$4,11
srl $4,$5,9
lbu $3,10($0)
nor $5,$3,$3
xori $1,$3,29082
slti $5,$5,3616
addiu $3,$3,-29760
lb $3,4($0)
addu $4,$4,$3
lhu $4,10($0)
sllv $3,$3,$3
subu $3,$3,$3
nor $4,$0,$3
sllv $4,$3,$3
srl $4,$3,15
lb $4,12($0)
sltiu $4,$3,-9360
lhu $0,6($0)
slt $3,$3,$3
or $5,$5,$3
nor $4,$5,$3
srl $4,$4,7
sltu $5,$4,$3
sllv $3,$6,$3
srav $3,$3,$3
nor $3,$5,$3
and $3,$3,$3
addiu $1,$4,-31175
slti $5,$3,-15878
addiu $4,$0,21478
slti $5,$0,-19790
sb $3,7($0)
srav $5,$4,$3
sw $1,12($0)
sh $2,10($0)
lhu $6,6($0)
sltu $5,$1,$3
or $0,$5,$3
or $6,$3,$3
addu $4,$5,$3
sltu $4,$4,$3
slti $4,$4,-15651
sllv $4,$0,$3
slt $6,$3,$3
lw $1,4($0)
addiu $4,$4,23298
sllv $6,$4,$3
subu $3,$0,$3
subu $3,$4,$3
lb $6,14($0)
srl $3,$5,19
addiu $3,$4,1224
sra $6,$4,24
srl $4,$5,20
sh $5,10($0)
xori $4,$2,63022
sb $3,11($0)
sltu $1,$1,$3
xor $3,$3,$3
slti $5,$2,-23795
xor $5,$1,$3
sw $3,8($0)
subu $3,$3,$3
sb $3,8($0)
sll $4,$5,2
srav $4,$3,$3
xori $3,$3,46969
subu $3,$4,$3
addu $3,$3,$3
addiu $5,$3,-12223
lb $4,16($0)
sh $3,12($0)
slt $3,$3,$3
and $6,$0,$3
slt $3,$4,$3
lhu $4,10($0)
lb $0,14($0)
subu $4,$3,$3
sltiu $3,$5,-19023
xor $4,$1,$3
sll $4,$4,13
sw $4,4($0)
lhu $5,10($0)
sllv $4,$3,$3
sw $5,16($0)
or $4,$4,$3
and $3,$1,$3
srlv $2,$2,$3
srlv $3,$4,$3
lhu $5,0($0)
addu $5,$3,$3
sw $4,16($0)
srl $4,$5,29
lh $5,14($0)
srav $5,$4,$3
lh $5,12($0)
sltu $4,$3,$3
sw $3,8($0)
addiu $1,$1,7020
lh $3,16($0)
addiu $5,$5,23931
sltiu $6,$4,26769
addu $4,$5,$3
lhu $6,2($0)
addu $3,$3,$3
xor $0,$0,$3
srl $3,$0,18
subu $4,$3,$3
addu $5,$5,$3
addu $5,$4,$3
subu $3,$4,$3
and $5,$1,$3
lw $5,4($0)
sltu $1,$1,$3
sw $4,12($0)
andi $1,$3,38530
sh $3,6($0)
sra $5,$1,13
lh $3,0($0)
sra $6,$5,14
subu $3,$4,$3
srav $3,$6,$3
or $4,$3,$3
slti $0,$3,5585
addiu $6,$4,27317
lw $4,16($0)
lw $4,16($0)
and $3,$3,$3
sb $2,11($0)
lh $2,8($0)
lhu $6,0($0)
xori $4,$4,28612
lhu $4,6($0)
andi $0,$1,50606
lbu $3,4($0)
srlv $4,$4,$3
srav $1,$5,$3
sltiu $1,$3,27497
sw $1,0($0)
nor $6,$3,$3
xor $3,$4,$3
addu $4,$1,$3
sra $3,$3,9
sh $3,10($0)
addu $0,$0,$3
lw $5,16($0)
subu $3,$3,$3
xor $5,$4,$3
addiu $4,$4,21177
subu $3,$4,$3
sh $1,0($0)
slti $5,$1,5507
addu $4,$3,$3
ori $5,$5,62535
andi $4,$5,36389
sw $6,12($0)
ori $5,$4,9740
sll $0,$0,22
addu $3,$0,$3
sh $5,16($0)
srlv $4,$3,$3
srlv $0,$4,$3
addiu $5,$5,-23328
addu $5,$5,$3
lw $3,16($0)
lbu $5,7($0)
xor $1,$1,$3
nor $3,$3,$3
nor $3,$5,$3
nor $1,$1,$3
lb $4,16($0)
lbu $3,5($0)
addiu $1,$3,-24814
srav $3,$1,$3
nor $5,$3,$3
slt $6,$3,$3
ori $3,$3,2915
lh $5,8($0)
slt $4,$4,$3
xor $4,$5,$3
slti $6,$4,-19719
addiu $3,$6,-12875
lhu $3,10($0)
lw $6,16($0)
subu $4,$3,$3
srl $6,$2,27
srl $3,$3,14
addiu $4,$4,-5285
andi $3,$0,2793
slti $6,$6,-11111
or $0,$1,$3
srav $1,$3,$3
srl $3,$5,27
lh $4,2($0)
slt $3,$1,$3
subu $1,$3,$3
srav $0,$1,$3
slti $4,$3,-29258
sb $0,7($0)
addu $0,$1,$3
sll $3,$2,1
nor $3,$4,$3
xor $4,$5,$3
lbu $3,15($0)
slti $3,$5,15941
sltiu $0,$3,-9838
sltiu $1,$2,-9942
slt $4,$3,$3
subu $1,$1,$3
lbu $6,14($0)
sra $1,$0,22
ori $5,$4,20848
slti $4,$4,11567
srlv $3,$3,$3
addu $3,$3,$3
lb $4,5($0)
slt $3,$3,$3
ori $6,$2,40362
sltu $4,$0,$3
or $3,$3,$3
xor $5,$5,$3
srlv $3,$6,$3
lbu $3,16($0)
sltu $6,$3,$3
xori $5,$0,37420
or $0,$4,$3
sra $3,$5,22
sb $3,3($0)
sltiu $0,$3,-22750
srl $5,$1,10
srlv $3,$5,$3
lb $6,6($0)
sh $3,10($0)
sw $1,16($0)
addiu $1,$4,-4921
sltu $3,$3,$3
lhu $3,4($0)
addiu $3,$3,8531
sra $4,$4,12
srl $0,$3,9
sltiu $1,$4,-19300
addiu $4,$0,16335
sltu $4,$3,$3
slt $1,$1,$3
sb $3,13($0)
sllv $5,$5,$3
sw $0,4($0)
lw $3,0($0)
xor $3,$1,$3
subu $4,$6,$3
addu $3,$4,$3
lb $3,16($0)
sll $1,$4,31
and $3,$4,$3
sh $3,16($0)
slt $3,$3,$3
or $3,$6,$3
addiu $1,$1,-9904
subu $3,$3,$3
lhu $4,4($0)
or $3,$6,$3
addiu $4,$4,29333
srlv $4,$4,$3
sltiu $0,$5,-22263
and $4,$0,$3
xor $3,$1,$3
addu $3,$6,$3
sb $0,6($0)
xor $0,$4,$3
lb $3,0($0)
xori $5,$4,30564
addu $4,$1,$3
srav $1,$0,$3
xori $0,$1,6781
xor $3,$1,$3
xori $5,$4,31207
addiu $6,$6,-5058
addiu $0,$4,-25507
addiu $1,$4,1410
lbu $3,15($0)
addiu $4,$2,-17816
sw $4,12($0)
slt $4,$3,$3
sh $3,4($0)
sltiu $4,$4,-2951
srav $4,$4,$3
addu $0,$0,$3
or $5,$5,$3
or $3,$5,$3
addu $1,$1,$3
ori $3,$1,56892
or $4,$4,$3
subu $4,$4,$3
slt $1,$1,$3
nor $5,$4,$3
sllv $1,$1,$3
sh $5,12($0)
addu $3,$3,$3
sb $5,1($0)
srav $3,$3,$3
ori $6,$4,17191
nor $3,$3,$3
sltiu $5,$1,18756
addu $5,$5,$3
subu $3,$6,$3
lbu $0,4($0)
sltu $4,$3,$3
andi $5,$4,5696
lbu $1,4($0)
sllv $4,$1,$3
subu $3,$0,$3
xor $4,$4,$3
srav $1,$5,$3
sltu $6,$5,$3
lh $5,2($0)
lh $1,10($0)
subu $3,$5,$3
subu $4,$3,$3
srl $1,$3,28
subu $6,$3,$3
lbu $6,1($0)
addu $3,$6,$3
or $3,$1,$3
or $3,$4,$3
sw $5,4($0)
sltiu $3,$5,11470
addiu $3,$5,-15725
lhu $5,14($0)
ori $3,$3,37271
sh $4,8($0)
or $4,$2,$3
sltiu $6,$1,19891
subu $4,$4,$3
ori $5,$5,12878
slt $3,$1,$3
srlv $1,$3,$3
addu $4,$3,$3
sw $1,0($0)
slti $3,$6,26512
sra $4,$3,7
sltiu $1,$1,-20713
nor $3,$3,$3
and $4,$3,$3
nor $3,$3,$3
nor $5,$6,$3
srl $5,$1,3
xori $4,$5,54015
andi $5,$3,28216
sra $4,$3,13
sra $4,$6,31
subu $3,$3,$3
sra $3,$4,0
lb $5,5($0)
sb $1,9($0)
subu $0,$4,$3
slti $1,$1,-12974
srlv $3,$3,$3
addu $1,$4,$3
subu $1,$5,$3
sra $1,$6,7
or $4,$6,$3
addiu $3,$4,1561
srlv $1,$2,$3
andi $1,$1,6987
addu $3,$1,$3
slti $4,$4,12018
or $4,$1,$3
andi $3,$3,19892
lw $5,16($0)
lhu $3,8($0)
xori $4,$1,29958
srlv $3,$4,$3
xor $1,$1,$3
sra $0,$5,22
lhu $4,0($0)
addu $4,$6,$3
ori $5,$4,37931
sllv $1,$4,$3
srav $4,$4,$3
lh $4,0($0)
nor $5,$1,$3
sra $3,$1,24
andi $4,$3,42616
sltiu $3,$3,24662
xor $1,$1,$3
addu $0,$4,$3
lhu $6,12($0)
and $0,$3,$3
addu $3,$3,$3
sh $3,8($0)
sll $1,$1,15
srl $5,$3,24
srlv $1,$1,$3
sll $3,$3,0
srlv $3,$1,$3
subu $1,$5,$3
srl $4,$5,31
lw $3,4($0)
subu $3,$1,$3
subu $4,$4,$3
or $1,$1,$3
addiu $1,$3,16458
sw $3,12($0)
lw $5,4($0)
ori $3,$5,23847
srlv $4,$5,$3
lh $5,16($0)
srlv $3,$3,$3
lw $5,4($0)
or $3,$3,$3
sltu $5,$5,$3
lbu $5,6($0)
lh $1,12($0)
ori $0,$5,33992
sh $3,12($0)
srl $4,$3,28
sb $4,3($0)
and $3,$3,$3
lh $1,10($0)
srlv $3,$3,$3
lb $1,15($0)
sra $6,$6,7
lbu $3,16($0)
lhu $3,4($0)
xori $5,$4,19178
xori $4,$3,27799
lh $6,16($0)
srav $3,$6,$3
subu $3,$3,$3
sllv $3,$4,$3
addiu $1,$3,25245
slt $3,$3,$3
andi $4,$0,3313
lbu $3,13($0)
or $3,$6,$3
sra $3,$2,23
nor $3,$3,$3
addiu $6,$0,12254
and $3,$1,$3
srav $4,$0,$3
andi $4,$0,21430
xor $0,$4,$3
sb $0,2($0)
srlv $5,$3,$3
sb $5,0($0)
nor $4,$4,$3
and $4,$4,$3
addu $5,$4,$3
sllv $3,$3,$3
sltiu $4,$3,-22782
addiu $4,$3,30706
srl $3,$4,4
slti $0,$5,-5559
sltu $3,$5,$3
lw $0,16($0)
xori $0,$0,47177
addu $5,$3,$3
sltiu $3,$4,-22922
sltu $5,$5,$3
addu $2,$2,$3
andi $0,$0,53193
sb $4,7($0)
or $6,$3,$3
xor $5,$3,$3
srl $5,$0,23
and $4,$1,$3
sllv $3,$3,$3
subu $3,$5,$3
nor $5,$1,$3
sll $1,$5,21
lhu $3,12($0)
slti $4,$2,19500
lb $5,11($0)
xor $3,$1,$3
sb $4,6($0)
lb $3,2($0)
sll $1,$3,14
lw $3,12($0)
addiu $1,$4,2911
xor $1,$3,$3
slti $3,$3,6294
xori $1,$3,52799
ori $4,$5,15176
slt $4,$4,$3
slti $5,$5,5291
and $4,$1,$3
sra $1,$4,11
lhu $1,4($0)
xori $3,$5,51422
sltu $3,$4,$3
lw $5,12($0)
addiu $1,$6,3832
sltu $4,$5,$3
ori $1,$1,381
addiu $3,$0,12052
srlv $5,$1,$3
lhu $4,0($0)
addiu $4,$4,-31667
nor $3,$4,$3
addiu $4,$5,12856
sb $5,14($0)
lhu $3,16($0)
lhu $1,4($0)
xor $3,$5,$3
sll $3,$3,4
lb $3,14($0)
slt $4,$4,$3
lbu $6,5($0)
or $4,$4,$3
sll $3,$3,26
lhu $5,0($0)
sb $3,4($0)
lh $6,4($0)
srav $3,$2,$3
sw $5,16($0)
andi $5,$3,11437
srl $5,$1,4
xor $3,$3,$3
addiu $5,$3,21462
sltu $6,$3,$3
sltiu $5,$0,-22044
subu $3,$2,$3
lw $4,0($0)
slt $4,$4,$3
sw $0,8($0)
sb $4,11($0)
sb $5,11($0)
lbu $5,11($0)
addu $6,$4,$3
sltu $0,$4,$3
xor $4,$5,$3
nor $1,$0,$3
lhu $5,12($0)
andi $3,$0,60987
slti $1,$5,1280
srlv $3,$3,$3
sh $3,14($0)
subu $3,$3,$3
sll $5,$3,14
sw $3,12($0)
lw $3,0($0)
lb $4,7($0)
subu $5,$0,$3
sra $1,$4,10
lb $1,15($0)
lhu $3,2($0)
or $3,$5,$3
lbu $6,5($0)
andi $6,$4,12968
srlv $3,$3,$3
addiu $4,$4,-26122
addiu $1,$1,12663
sltiu $6,$1,32753
addiu $3,$4,-13063
lb $4,10($0)
lhu $6,12($0)
addu $1,$2,$3
sltu $3,$3,$3
slt $4,$3,$3
srlv $5,$5,$3
nor $5,$3,$3
subu $3,$3,$3
addu $5,$1,$3
addu $1,$3,$3
lw $4,12($0)
addu $1,$0,$3
sltu $1,$0,$3
lb $2,8($0)
xori $5,$1,6030
or $3,$3,$3
xor $3,$3,$3
lbu $5,0($0)
nor $1,$1,$3
nor $1,$0,$3
sw $2,12($0)
srlv $3,$0,$3
addiu $5,$3,965
sll $5,$4,23
sltiu $4,$5,29396
sllv $4,$5,$3
xori $4,$4,31326
subu $4,$4,$3
ori $3,$3,6493
subu $0,$3,$3
slti $3,$1,-24622
sltiu $0,$3,16975
ori $3,$3,32595
addiu $6,$6,25071
sll $5,$4,18
lb $4,4($0)
addu $6,$6,$3
srlv $1,$6,$3
or $4,$4,$3
addu $3,$3,$3
subu $5,$3,$3
xor $3,$3,$3
lb $6,15($0)
sw $3,12($0)
lbu $3,3($0)
srlv $3,$5,$3
or $3,$3,$3
xori $3,$4,33487
sll $1,$4,10
addiu $6,$6,-13153
sw $0,8($0)
srlv $1,$3,$3
addu $5,$1,$3
srlv $5,$3,$3
lw $3,0($0)
sw $3,0($0)
lh $3,4($0)
lbu $4,0($0)
lbu $0,8($0)
srlv $0,$0,$3
sltiu $1,$1,23147
nor $4,$1,$3
addu $0,$0,$3
srav $0,$5,$3
addiu $5,$4,6133
lhu $6,14($0)
xor $4,$4,$3
srlv $0,$0,$3
slt $4,$1,$3
srl $4,$4,19
and $5,$5,$3
srlv $4,$4,$3
slt $3,$3,$3
addiu $5,$0,16354
lh $4,4($0)
sw $6,8($0)
addu $6,$5,$3
lhu $4,0($0)
lbu $0,16($0)
addiu $1,$3,-710
sltu $0,$4,$3
sra $3,$3,21
ori $5,$6,19439
sh $3,2($0)
xori $1,$4,20264
sltu $3,$6,$3
lw $3,8($0)
sra $3,$3,17
sra $3,$4,15
or $4,$4,$3
ori $4,$0,38906
or $5,$5,$3
and $5,$0,$3
srlv $4,$1,$3
andi $0,$0,50199
sltiu $3,$4,-25118
sltiu $3,$4,-4383
ori $3,$5,64508
lhu $3,16($0)
lhu $3,12($0)
sltiu $4,$5,19115
lhu $4,14($0)
lhu $4,6($0)
nor $3,$4,$3
sllv $3,$3,$3
or $3,$3,$3
lb $4,14($0)
srl $5,$6,19
sll $5,$5,5
lb $5,2($0)
slt $3,$3,$3
addu $3,$5,$3
lhu $4,8($0)
lhu $3,0($0)
sw $1,0($0)
| 14.010124 | 18 | 0.518507 |
1e13cb0faddd25f13275fdfa09a652e746b81d84 | 165 | asm | Assembly | code/occupying/t1.asm | KongoHuster/assembly-exercise | 1c4a44c60c0e93a1350ed4f887aeaf1414702a51 | [
"0BSD"
] | 1 | 2021-08-20T03:57:29.000Z | 2021-08-20T03:57:29.000Z | code/occupying/t1.asm | KongoHuster/assembly-exercise | 1c4a44c60c0e93a1350ed4f887aeaf1414702a51 | [
"0BSD"
] | null | null | null | code/occupying/t1.asm | KongoHuster/assembly-exercise | 1c4a44c60c0e93a1350ed4f887aeaf1414702a51 | [
"0BSD"
] | null | null | null | .data
ARRAY dw 23,36,2,100,32000,54,0
ZERO dw ?
.code
start:
mov ax,@data
mov ds,ax
mov bx,offset ARRAY
mov [bx+14],0
mov bx,offset ARRAY[12]
mov [bx+2],0
end start
| 12.692308 | 31 | 0.69697 |
2fb950af5ca0d250ba4f58448cde4a4554424a8a | 838 | asm | Assembly | oeis/094/A094687.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/094/A094687.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/094/A094687.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A094687: Convolution of Fibonacci and Jacobsthal numbers.
; 0,0,1,2,6,13,30,64,137,286,594,1221,2498,5084,10313,20858,42094,84797,170582,342760,688105,1380390,2767546,5546037,11109786,22248228,44542825,89160674,178442742,357081901,714481614,1429477456,2859786953,5720920174,11444018658,22891561893,45788826674,91586880812,183188691977,366401541770,732842171710,1465747589405,2931597512966,5863360606072,11726989126441,23454411747318,46909524903370,93820184709909,187642205731722,375287382678516,750579572884009,1501166924510066,3002346435289158
mov $5,2
mov $6,$0
lpb $5
mov $0,$6
mov $3,0
sub $5,1
add $0,$5
sub $0,1
lpb $0
mov $2,$0
sub $0,2
max $2,0
seq $2,8466 ; a(n) = 2^n - Fibonacci(n+2).
add $3,$2
lpe
mov $4,$5
mul $4,$3
add $1,$4
mov $7,$3
lpe
min $6,1
mul $6,$7
sub $1,$6
mov $0,$1
| 29.928571 | 486 | 0.731504 |
3fc190992c61af8b5f15568ba2e3a274773fd08c | 688 | asm | Assembly | oeis/330/A330390.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/330/A330390.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/330/A330390.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A330390: G.f.: (1 + 15*x) / (1 - 2*x - 17*x^2).
; Submitted by Jamie Morken(s3)
; 1,17,51,391,1649,9945,47923,264911,1344513,7192513,37241747,196756215,1026622129,5398099913,28248776019,148265250559,776759693441,4074028646385,21352972081267,111964431151079,586929387683697,3077254104935737,16132307800494323,84577935384896175,443405103378195841,2324635108299626657,12187156974028582611,63893110789150818391,334967890136787541169,1756118663689138994985,9206691459703666189843,48267400202122695294431,253048555219207715816193,1326642913874501251637713,6955111266475533672150707
mov $1,1
mov $3,1
lpb $0
sub $0,1
mov $2,$3
mul $2,18
add $3,$1
sub $1,2
add $1,$2
lpe
mov $0,$1
| 43 | 495 | 0.80814 |
f17ef38c5918cb69548386974197635f90a49d06 | 269 | asm | Assembly | 06/5-b/program4/Rect.asm | AbstractXan/ComputerSystemDesignLab | 2851da683e4e894be66463dcc29a9fa6ba0538b6 | [
"MIT"
] | null | null | null | 06/5-b/program4/Rect.asm | AbstractXan/ComputerSystemDesignLab | 2851da683e4e894be66463dcc29a9fa6ba0538b6 | [
"MIT"
] | null | null | null | 06/5-b/program4/Rect.asm | AbstractXan/ComputerSystemDesignLab | 2851da683e4e894be66463dcc29a9fa6ba0538b6 | [
"MIT"
] | null | null | null | @10
D=A
@INFINITE_LOOP
D;JLE
@counter
M=D
@SCREEN
D=A
@address
M=D
(LOOP)
@address
A=M
M=-1
@address
D=M
@32
D=D+A
@address
M=D
@counter
MD=M-1
@LOOP
D;JGT
(INFINITE_LOOP)
@INFINITE_LOOP
0;JMP
| 9.607143 | 17 | 0.498141 |
031425ab7d43685feeda4cf615bf079379740954 | 387 | asm | Assembly | programs/oeis/212/A212346.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/212/A212346.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/212/A212346.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A212346: Sequence of coefficients of x^0 in marked mesh pattern generating function Q_{n,132}^(0,4,0,0)(x).
; 1,1,2,5,14,28,48,75,110,154,208,273,350,440,544,663,798,950,1120,1309,1518,1748,2000,2275,2574,2898,3248,3625,4030,4464,4928,5423,5950,6510,7104,7733
mov $1,1
lpb $0
sub $0,1
add $3,1
add $2,$3
sub $2,1
add $1,$2
lpe
add $0,2
trn $1,4
add $1,$2
add $1,$0
sub $1,1
| 22.764706 | 151 | 0.664083 |
c24be911b442d70a61de29bf8ad1877c91cfaaa2 | 452 | asm | Assembly | programs/oeis/243/A243111.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/243/A243111.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/243/A243111.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A243111: Difference between the smallest triangular number >= n-th prime and the n-th prime.
; 1,0,1,3,4,2,4,2,5,7,5,8,4,2,8,2,7,5,11,7,5,12,8,2,8,4,2,13,11,7,9,5,16,14,4,2,14,8,4,17,11,9,19,17,13,11,20,8,4,2,20,14,12,2,19,13,7,5,23,19,17,7,18,14,12,8,20,14,4,2,25,19,11,5,27,23,17,9,5,26,16,14,4,2,26,22,16,8,4,2,29,17,9,5,29,25,19,7,5,20
seq $0,6093 ; a(n) = prime(n) - 1.
seq $0,25669 ; Exponent of 7 (value of i) in n-th number of form 7^i*8^j.
| 75.333333 | 246 | 0.628319 |
e8ed16c56c85558266c4a24b7ce1509dd566c3e8 | 689 | asm | Assembly | Irvine/Examples/ch10/Struct2.asm | alieonsido/ASM_TESTING | 4d5e2a3e11d921eeb50d69bbe4352cfc0e99afa7 | [
"Apache-2.0"
] | null | null | null | Irvine/Examples/ch10/Struct2.asm | alieonsido/ASM_TESTING | 4d5e2a3e11d921eeb50d69bbe4352cfc0e99afa7 | [
"Apache-2.0"
] | null | null | null | Irvine/Examples/ch10/Struct2.asm | alieonsido/ASM_TESTING | 4d5e2a3e11d921eeb50d69bbe4352cfc0e99afa7 | [
"Apache-2.0"
] | null | null | null | ; Nested Structures (Struct2.asm)
; This program shows how to declare nested
; structures, and how to access the members.
INCLUDE Irvine32.inc
Rectangle STRUCT
UpperLeft COORD <>
LowerRight COORD <>
Rectangle ENDS
.data
rect1 Rectangle <>
rect2 Rectangle { }
rect3 Rectangle { {10,20}, {5,15} }
rect4 Rectangle < <10,20>, <5,15> >
.code
main PROC
; Direct reference to a nested member.
mov rect1.UpperLeft.X,30
; Using an indirect operand, access a
; nested member.
mov esi,OFFSET rect1
mov (Rectangle PTR [esi]).UpperLeft.Y, 40
; Get the offsets of individual members.
mov edi,OFFSET rect2.LowerRight
mov edi,OFFSET rect2.LowerRight.X
exit
main ENDP
END main | 19.138889 | 46 | 0.724238 |
7afa93f0d3eeb948ba85253dfe8b6c111e867f96 | 3,205 | asm | Assembly | asm_func.asm | toku-sa-n/my_cpp_os | a2044a2daee305450b68c1a34527935aa8c0ca2a | [
"MIT"
] | null | null | null | asm_func.asm | toku-sa-n/my_cpp_os | a2044a2daee305450b68c1a34527935aa8c0ca2a | [
"MIT"
] | null | null | null | asm_func.asm | toku-sa-n/my_cpp_os | a2044a2daee305450b68c1a34527935aa8c0ca2a | [
"MIT"
] | null | null | null | [bits 32]
global IoHlt
global IoCli
global IoSti
global IoStiHlt
global IoIn8
global IoIn16
global IoIn32
global IoOut8
global IoOut16
global IoOut32
global IoLoadEflags
global IoStoreEflags
global LoadGdtr
global LoadIdtr
global AsmInterruptHandler21
global AsmInterruptHandler27
global AsmInterruptHandler2c
global LoadCr0
global StoreCr0
global AsmCheckMemorySize
extern InterruptHandler21
extern InterruptHandler27
extern InterruptHandler2c
[section .text]
IoHlt:
hlt
ret
IoCli:
cli
ret
IoSti:
sti
ret
IoStiHlt:
sti
hlt
ret
; int IoIn(8|16|32)(int port);
IoIn8:
mov edx,[esp+4]
mov eax,0
in al,dx
ret
IoIn16:
mov edx,[esp+4]
mov eax,0
in ax,dx
ret
IoIn32:
mov edx,[esp+4]
in eax,dx
ret
; void IoOut(8|16|32)(int port, int data);
IoOut8:
mov edx,[esp+4]
mov al,[esp+8]
out dx,al
ret
IoOut16:
mov edx,[esp+4]
mov eax,[esp+8]
out dx,ax
ret
IoOut32:
mov edx,[esp+4]
mov eax,[esp+8]
out dx,eax
ret
; int IoLoadEflags();
IoLoadEflags:
pushfd
pop eax
ret
; void IoStoreEflags(int eflags);
IoStoreEflags:
mov eax,[esp+4]
push eax
popfd
ret
; void LoadGdtr(int limit, int addr);
LoadGdtr:
mov ax,[esp+4]
mov [esp+6],ax
lgdt [esp+6]
ret
; void LoadIdtr(int limit, int addr);
LoadIdtr:
mov ax,[esp+4]
mov [esp+6],ax
lidt [esp+6]
ret
%macro ASM_INTERRUPT_HANDLER 1
AsmInterruptHandler%1:
push es
push ds
pushad
mov eax,esp
push eax
mov ax,ss
mov ds,ax
mov es,ax
call InterruptHandler%1
pop eax
popad
pop ds
pop es
iretd
%endmacro
ASM_INTERRUPT_HANDLER 21
ASM_INTERRUPT_HANDLER 27
ASM_INTERRUPT_HANDLER 2c
LoadCr0:
mov eax,cr0
ret
StoreCr0:
mov eax,[esp+4]
mov cr0,eax
ret
; unsigned int AsmCheckMemorySize(unsigned start, unsigned end)
AsmCheckMemorySize:
push edi
push esi
push ebx
mov esi,0xaa55aa55
mov edi,0x55aa55aa
; eax = start;
mov eax,[esp+12+4]
; Assign a value into [eax] and reverse all bits of that place.
; The bits reversion will be done twice.
; If the reversion succeeds, then go to the next bit.
; Otherwise regard the last-succeess bit as the limit of memory.
; eax: Iterator
; ebx: Memory to check
; edx: Data on [ebx]. When checking memory, the value of checked memory will be changed.
; edx will be used to save the value in the memory.
check_memory_size_loop:
mov ebx,eax
add ebx,0xffc
mov edx,[ebx]
mov [ebx],esi
xor dword [ebx],0xffffffff
; If bits reversion fails, end loop.
cmp edi,[ebx]
jne check_memory_size_fin
; Second trial of reversing bits.
xor dword [ebx],0xffffffff
cmp esi,[ebx]
jne check_memory_size_fin
; Restore the value of [ebx]
mov [ebx],edx
; Loop continuation condition.
add eax,0x1000
cmp eax,[esp+12+8]
jbe check_memory_size_loop
check_memory_size_fin:
mov [ebx],edx
pop ebx
pop esi
pop edi
ret
| 16.269036 | 88 | 0.633385 |
76da832299b7cc33f8d635bfd288aee6fda8d5e9 | 3,354 | asm | Assembly | external/source/shellcode/linux/ia32/stager_sock_bind6.asm | madhavarao-yejarla/VoIP | 3f7d0cdc0bb1423f9e952e411d073a1424ef9f5e | [
"Apache-2.0",
"BSD-3-Clause"
] | 35 | 2015-08-08T07:23:38.000Z | 2021-04-07T18:00:44.000Z | external/source/shellcode/linux/ia32/stager_sock_bind6.asm | madhavarao-yejarla/VoIP | 3f7d0cdc0bb1423f9e952e411d073a1424ef9f5e | [
"Apache-2.0",
"BSD-3-Clause"
] | 1 | 2019-02-12T12:13:53.000Z | 2019-02-12T12:13:53.000Z | external/source/shellcode/linux/ia32/stager_sock_bind6.asm | fozavci/metasploit-framework-with-viproy | 3f7d0cdc0bb1423f9e952e411d073a1424ef9f5e | [
"Apache-2.0",
"BSD-3-Clause"
] | 23 | 2015-08-11T05:07:47.000Z | 2020-11-06T03:55:10.000Z | ;;
;
; Name: stager_sock_bind6
; Qualities: Can Have Nulls
; Version: $Revision: 1607 $
; License:
;
; This file is part of the Metasploit Exploit Framework
; and is subject to the same licenses and copyrights as
; the rest of this package.
;
; Description:
;
; Implementation of a Linux portbind TCP stager.
;
; File descriptor in edi.
;
; Meta-Information:
;
; meta-shortname=Linux Bind TCP Stager
; meta-description=Listen on a port for a connection and run a second stage
; meta-authors=skape <mmiller [at] hick.org>; egypt <egypt [at] metasploit.com>
; meta-os=linux
; meta-arch=ia32
; meta-category=stager
; meta-connection-type=bind
; meta-name=bind_ipv6_tcp
; meta-path=lib/Msf/PayloadComponent/Linux/ia32/BindStager.pm
;;
BITS 32
GLOBAL _start
_start:
; int mprotect(const void *addr, size_t len, int prot);
mprotect:
push byte 0x7d ; __NR_mprotect
pop eax
cdq
mov dl, 0x7 ; prot = 7 = PROT_READ | PROT_WRITE | PROT_EXEC
mov ecx, 0x1000 ; len = PAGE_SIZE (on most systems)
mov ebx, esp ; addr
and bx, 0xf000 ; ensure that addr is page-aligned
int 0x80
xor ebx, ebx ; ebx is the call argument to socketcall
mul ebx ; set edx:eax to 0, we'll need them in a minute
; int socket(int domain, int type, int protocol);
socket:
push ebx ; protocol = 0 = first that matches this type and domain, i.e. tcp
inc ebx ; 1 = SYS_SOCKET
push ebx ; type = 1 = SOCK_STREAM
push byte 0xa ; domain = 0xa = AF_INET6
mov ecx, esp ; socketcall args
mov al, 0x66 ; __NR_socketcall
int 0x80
; Server socket is now in eax. We'll push it to the stack in a sec and then
; just reference it from there, no need to store it in a register
; int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
bind:
inc ebx ; 2 = SYS_BIND (this was PF_INET for the call to socket)
; set up the sockaddr
push edx ; addr->sin6_scopeid = 0
push edx ; addr->sin6_addr = inet_pton("::0")
push edx ; ...
push edx ; ...
push edx ; ...
push edx ; addr->flowinfo = 0
push 0xbfbf000a ; addr->sin6_port = 0xbfbf
; addr->sin6_family = 0xa = AF_INET6
mov ecx, esp ; socketcall args
push byte 0x1c ; addrlen
push ecx ; addr
push eax ; sockfd ; return value from socket(2) above
mov ecx, esp ; socketcall args
push byte 0x66 ; __NR_socketcall
pop eax
int 0x80
listen:
shl ebx, 1 ; 4 = SYS_LISTEN
mov al, 0x66 ; __NR_socketcall
int 0x80
; int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
accept:
inc ebx ; 5 = SYS_ACCEPT
mov al, 0x66 ; __NR_socketcall
mov [ecx+4], edx
int 0x80
xchg eax, ebx
%ifndef USE_SINGLE_STAGE
; ssize_t read(int fd, void *buf, size_t count);
recv:
; fd = ebx
; buf = ecx is pointing somewhere in the stack
mov dh, 0xc ; count = 0xc00
mov al, 0x3 ; __NR_read
int 0x80
mov edi, ebx ; not necessary if second stages use ebx instead of edi
; for fd
jmp ecx
%else
%ifdef FD_REG_EDI
mov edi, ebx
%endif
%endif
| 29.421053 | 87 | 0.610018 |
1f7cd4d6e4838a1d25442930502db1ecca52fe88 | 3,803 | asm | Assembly | Altair101/asm/programs/opXra.asm | tigerfarm/arduino | e51f111a092fe6737646b146a825f4eecbd05d44 | [
"OLDAP-2.4",
"OLDAP-2.7"
] | 2 | 2021-12-12T23:27:10.000Z | 2022-02-17T14:01:21.000Z | Altair101/asm/programs/opXra.asm | tigerfarm/arduino | e51f111a092fe6737646b146a825f4eecbd05d44 | [
"OLDAP-2.4",
"OLDAP-2.7"
] | null | null | null | Altair101/asm/programs/opXra.asm | tigerfarm/arduino | e51f111a092fe6737646b146a825f4eecbd05d44 | [
"OLDAP-2.4",
"OLDAP-2.7"
] | 4 | 2021-08-29T19:55:49.000Z | 2022-02-15T08:30:15.000Z | ; --------------------------------------
; Test XRA.
; Exclusive OR a register, with register with A.
;
; A or B, but not, A and B
; 01010001
; 01000101
; --------
; 00010100
;
; --------------------------------------
lxi sp,1024 ; Set stack pointer.
Test:
mvi a,5 ; 00000101
mvi b,10 ; 00001010
mvi c,11 ; 00001011
mvi d,5 ; 00000101
mvi e,10 ; 00001010
mvi h,11 ; 00001011
mvi l,5 ; 00000101
; --------------------------------------
call newTest
mvi a,6 ; Initialize register values for testing.
out 37 ; Print register A
out 30 ; Register B.
xra b ; Exclusive OR register, with register with A.
out 37 ; Print register A
;
call newTest
mvi a,6
out 37
out 31 ; Register C.
xra c
out 37
;
call newTest
mvi a,6
out 37
out 32 ; Register D.
xra d
out 37
;
call newTest
mvi a,6
out 37
out 33
xra e ; Exclusive OR register, with register with A.
out 37
;
call newTest
mvi a,6
out 37
out 34
xra h ; Exclusive OR register B, with register with A.
out 37
;
call newTest
mvi a,6
out 37
out 35 ; Register L.
xra l
out 37
; --------------------------------------
mvi a,'\r'
out 3
mvi a,'\n'
out 3
hlt
jmp Test
; --------------------------------------
newTest:
mvi a,'\r'
out 3
mvi a,'\n'
out 3
mvi a,'-'
out 3
mvi a,'-'
out 3
mvi a,'-'
out 3
mvi a,'-'
out 3
mvi a,'-'
out 3
mvi a,'-'
out 3
ret
end
; --------------------------------------
;
+ Download complete.
?- + r, RUN.
?- + runProcessor()
------
> Register A = 6 = 006 = 00000110
> Register B = 10 = 012 = 00001010
> Register A = 0 = 000 = 00000000
------
> Register A = 6 = 006 = 00000110
> Register C = 11 = 013 = 00001011
> Register A = 13 = 015 = 00001101
------
> Register A = 6 = 006 = 00000110
> Register D = 5 = 005 = 00000101
> Register A = 3 = 003 = 00000011
------
> Register A = 6 = 006 = 00000110
> Register E = 10 = 012 = 00001010
> Register A = 12 = 014 = 00001100
------
> Register A = 6 = 006 = 00000110
> Register H = 11 = 013 = 00001011
> Register A = 13 = 015 = 00001101
------
> Register A = 6 = 006 = 00000110
> Register L = 5 = 005 = 00000101
> Register A = 3 = 003 = 00000011
++ HALT, host_read_status_led_WAIT() = 0
;
; --------------------------------------
| 30.669355 | 76 | 0.309493 |
03585baf07baca8612b59e572818c7cb174b621a | 319 | asm | Assembly | programs/oeis/081/A081106.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/081/A081106.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/081/A081106.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A081106: 6th binomial transform of (1,1,0,0,0,0,...).
; 1,7,48,324,2160,14256,93312,606528,3919104,25194240,161243136,1027924992,6530347008,41358864384,261213880320,1645647446016,10344069660672,64885527871488,406239826673664,2538998916710400
mov $1,$0
lpb $0,1
sub $0,1
add $1,5
mul $1,6
lpe
div $1,6
add $1,1
| 26.583333 | 187 | 0.749216 |
763f9946bf9dabdab951fc654e743e7592a6a5c2 | 531 | asm | Assembly | solutions/34 - Seek and Destroy 1/size-25_speed-11.asm | michaelgundlach/7billionhumans | 02c6f3963364362c95cb516cbc6ef1efc073bb2e | [
"MIT"
] | 45 | 2018-09-05T04:56:59.000Z | 2021-11-22T08:57:26.000Z | solutions/34 - Seek and Destroy 1/size-25_speed-11.asm | michaelgundlach/7billionhumans | 02c6f3963364362c95cb516cbc6ef1efc073bb2e | [
"MIT"
] | 36 | 2018-09-01T11:34:26.000Z | 2021-05-19T23:20:49.000Z | solutions/34 - Seek and Destroy 1/size-25_speed-11.asm | michaelgundlach/7billionhumans | 02c6f3963364362c95cb516cbc6ef1efc073bb2e | [
"MIT"
] | 36 | 2018-09-01T07:44:19.000Z | 2021-09-10T19:07:35.000Z | -- 7 Billion Humans (2087) --
-- 34: Seek and Destroy 1 --
-- Author: landfillbaby
-- Size: 25
-- Speed: 11
mem1 = nearest datacube
mem2 = nearest shredder
step mem1
step n
if c < mem1:
mem1 = nearest datacube
endif
step n
if c < mem1:
mem1 = nearest datacube
endif
step n
if c < mem1:
mem1 = nearest datacube
endif
step n
if c < mem1:
mem1 = nearest datacube
endif
step n
if c < mem1:
mem1 = nearest datacube
endif
step n
if c < mem1:
mem1 = nearest datacube
endif
if n < mem1:
mem1 = set n
endif
pickup mem1
giveto mem2
| 13.275 | 29 | 0.693032 |
330b6f37bee93cb3192ba5c02f7fe505ffb642de | 583 | asm | Assembly | oeis/168/A168555.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/168/A168555.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/168/A168555.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A168555: a(n) = n^6*(n^3 + 1)/2.
; 0,1,288,10206,133120,984375,5062176,20235628,67239936,193975965,500500000,1179859626,2581383168,5304663091,10334288160,19227375000,34368126976,59306007033,99196651296,161367371830,256032000000,397182906351,603691298848,900650348676,1320999321600,1907470703125,2714906297376,3812992452738,5289468921856,7253870399595,9841864500000,13220254832176,17592722915328,23206387934961,30359268785440,39408738468750,50781066725376,64982152760743,82609556099616,104365939951260,131074048000000,163693342249101
mov $1,$0
pow $0,6
pow $1,9
add $0,$1
div $0,2
| 64.777778 | 499 | 0.850772 |
33ea4856299e0dbb92e29cd430c7246c245d32a8 | 6,406 | asm | Assembly | Options/Molar Mass.asm | vcte/eclectic | 46d82f3a573d9fd09847a07cb9017d8a57db9b1a | [
"MIT"
] | 1 | 2018-10-22T23:38:28.000Z | 2018-10-22T23:38:28.000Z | Options/Molar Mass.asm | vcte/eclectic | 46d82f3a573d9fd09847a07cb9017d8a57db9b1a | [
"MIT"
] | null | null | null | Options/Molar Mass.asm | vcte/eclectic | 46d82f3a573d9fd09847a07cb9017d8a57db9b1a | [
"MIT"
] | null | null | null | ; ---------------------------------------------------------------
; Molar Mass Calculator
; ---------------------------------------------------------------
MolarMass:
ld HL, tMolarMass
call DrawHeader
ld HL, tPromptForm
b_call(_VPutS)
call InitInput
MolarMassLp:
call ifastcopy
call GetCSCCur
ld HL, keymass
call HandleKey
ld B, A
ld A, (size)
cp 96 / 4 - 2; max
jr z, MolarMassLp
ld A, (alphanum)
or A
ld A, B
jr z, MolarMassInNum
call GetChar
jr c, MolarMassLp
ld B, A
ld A, (alphanum)
cp 1
ld A, B
jr z, MolarMassAlphaUp
add A, $20
MolarMassAlphaUp:
call SaveIn
b_call(_VPutMap)
jr MolarMassLp
MolarMassInNum:
call GetNum
jr c, MolarMassLp
call IsNumber
jr c, MolarMassAlphaUp
push AF
call SaveIn
call curoff
pop AF
sub '0'
call PutSubScript
call curson
jr MolarMassLp
MolarMassDel:
call Delete
jr MolarMassLp
MolarMassClr:
ld A, (size)
or A
jp z, calculate
ld A, 2
call ClearIn
jr MolarMassLp
MolarMassAlpha:
ld A, (alphanum)
or A
jr z, MolarMassAlpha0
cp 1
jr z, MolarMassAlpha1
xor A
ld C, $5F
ld B, 4
jr MolarMassAlphaEnd2
MolarMassAlpha1:
ld C, $1F
ld B, 3
jr MolarMassAlphaEnd
MolarMassAlpha0:
ld C, $7C
ld B, 2
MolarMassAlphaEnd:
inc A
MolarMassAlphaEnd2:
ld HL, cursorA
ld (HL), C ;ld into cursorA
inc HL
ld (HL), B ;ld into cursorwid
inc HL
ld (HL), A ;ld into alphanum
call curoff
call curson
jp MolarMassLp
MolarMassEnter:
ld A, (size) ;return if nothing is inputted
or A
jp z, MolarMassLp
xor A ;null terminate
call SaveIn
ld HL, size ;to compensate for some odd glitch
dec (HL)
call curoff
; MassTotal = 0
; For (each element E)
; MassTotal = MassTotal + (E.Mass * Subscript# * ParanthesisSub#)
; End
; Disp MassTotal
b_call(_OP3Set0) ;OP3 shall hold MassTotal, initial value of 0
b_call(_OP4Set1) ;OP4 shall hold ParanSub#, initial value of 1
ld HL, buffer
MolarMassEnterLp:
ld A, (HL) ;if character is an uppercase letter...
cp 'A'
jp c, MolarMassEnterNotEle
cp 'Z' + 1
jp nc, MolarMassEnterNotEle
ld DE, tempstr ;...then find element
ld (DE), A
inc HL
inc DE
MolarMassEnterLpLp:
ld A, (HL)
cp 'a'
jr c, MolarMassEnterNotLow
cp 'z' + 1
jr nc, MolarMassEnterNotLow
ld (DE), A
inc DE
inc HL
jr MolarMassEnterLpLp
MolarMassEnterNotLow:
xor A
ld (DE), A
ld DE, tempstr
ld C, 0
push HL
call SearchStr
pop HL
jp c, MolarMassEnterErr
push HL
push AF
call GetData1
pop AF
ld B, (HL)
bit 7, B
jr z, MolarMassBCD
call GetMass
call GetSyntMass
jr MolarMassStoreOP
MolarMassBCD:
call GetMass
call BCDFP
MolarMassStoreOP:
rst rOP1ToOP2 ;put elemental molar mass into OP2
pop HL
ld B, 6
call StrFP
jr c, MolarMassEnterNoSub
push HL
b_call(_PushOP3)
b_call(_FPMult) ;(elemental mass) * (subscript) -> OP1
b_call(_PopOp3)
pop HL
MolarMassEnterSkipMult:
push HL
b_call(_PushOp3)
b_call(_OP4ToOp2) ;OP1 * (Paranthesis subscript) -> OP1
b_call(_FPMult)
b_call(_PopOp3)
b_call(_OP3ToOp2)
rst rFPAdd ;OP1 + MassTotal -> MassTotal
b_call(_OP1ToOp3)
pop HL
jp MolarMassEnterLp
MolarMassEnterNoSub:
push HL
b_call(_OP2ToOp1)
pop HL
jr MolarMassEnterSkipMult
MolarMassEnterNotEle:
ld A, (HL) ;...else if char is opening paranthesis...
cp '('
jr nz, MolarMassEnterNotParan
push HL ;...then look for closing paranthesis and find subscript value
pop DE ;DE saveguards HL
inc HL
ld B, 1 ;B = (# of '(') - (# of ')') (for djnz trick)
MolarMassEnterParanLp: ;when B = 1, then corresponding closing paran has been found
ld A, (HL)
cp '('
jr z, MolarMassEnterParanL
cp ')'
jr z, MolarMassEnterParanR
or A
jp z, MolarMassEnterErr3
MolarMassEnterParanEnd:
inc HL
jr MolarMassEnterParanLp
MolarMassEnterParanL:
inc B
jr MolarMassEnterParanEnd
MolarMassEnterParanR:
djnz MolarMassEnterParanEnd ;keep looping if B /= 1
push DE
inc HL ;move to subscript value and find FP value
ld A, (HL) ;if not # or dot, then skip ahead
call IsNumDot
jr c, MolarMassEnterNotNum
push HL
ld B, 24
call StrFp
; jp c, MolarMassEnterErr2 ;error if user inputted invalid # ;redundant
b_call(_Op2Set0) ;if ParanSub# = 0
b_call(_CpOp1Op2)
pop HL
jr nz, MolarMassEnterOP1N0
pop BC ;level SP, but preserve HL
jr MolarMassEnterNotParan ;then skip entire contents of paran
MolarMassEnterOP1N0:
b_call(_PushOp3) ;ParanSub# = ParanSub# * NewParanSub#
b_call(_Op4ToOp2) ;value is cumulative,
b_call(_FPMult) ;for hypothetical cases like (Ba(NO3)2)2
b_call(_Op1ToOp4)
b_call(_PopOp3)
MolarMassEnterNotNum:
pop HL ;pop DE into HL
MolarMassEnterNotParan:
ld A, (HL) ;...else if char is closing paranthesis...
cp ')'
jr nz, MolarMassEnterNotParan2
push HL
inc HL
ld A, (HL)
dec HL ;so current char not skipped
call IsNumDot
jr c, MolarMassEnterNotNum2
inc HL
ld B, 24
call StrFP
; jp c, MolarMassEnterErr2 ;redundant
b_call(_PushOp3) ;ParanSub# = ParanSub# / NewParanSub#
b_call(_Op1ToOp2)
b_call(_Op4ToOp1)
b_call(_FPDiv)
b_call(_Op1ToOp4)
b_call(_PopOp3)
MolarMassEnterNotNum2:
pop HL
MolarMassEnterNotParan2:
ld A, (HL)
inc HL ;...else try next character
or A
jp nz, MolarMassEnterLp
ld HL, 28 * 256 + 2 ;when done, display MassTotal
ld (PenCol), HL
b_call(_OP3ToOp1)
ld A, 8
b_call(_DispOP1A)
ld HL, tGperMol ;disp g/mol
b_call(_VPutS)
ld HL, 40 * 256 + 2
ld (PenCol), HL
ld HL, MassStorePrompt
b_call(_VPutS)
ld HL, 46 * 256 + 2
ld (PenCol), HL
ld HL, MassEditPrompt
b_call(_VPutS)
ld HL, 52 * 256 + 2
ld (PenCol), HL
ld HL, MassBackPrompt
b_call(_VPutS)
call ifastcopy
MolarMassEnterPause:
b_call(_GetCSC)
or A
jr z, MolarMassEnterPause
ld HL, keymass2
call HandleKey
jr MolarMassEnterPause
MolarMassStoreAns:
b_call(_StoAns)
jp features
MolarMassEdit:
ld HL, tMolarMass
call DrawHeader
ld HL, tPromptForm
b_call(_VPutS)
ld HL, 16 * 256 + 2
ld (PenCol), HL
ld HL, buffer
call SPutS
jp MolarMassLp
MolarMassEnterErr: ;error: user inputted unrecognized element
ld HL, tempstr
ld DE, tempstr2
call CopyStr
ld HL, ErrorIDK
call CopyStr
xor A
ld (DE), A
ld HL, tempstr2
call DispErr
jp MolarMassLp
MolarMassEnterErr2:
ld HL, ErrorInvalid ;error: user inputted invalid number
call DispErr
jp MolarMassLp
MolarMassEnterErr3:
ld HL, ErrorMissingP ;error: user is missing ')'
call DispErr
jp MolarMassLp
| 17.174263 | 84 | 0.696066 |
627eee82a8464c99f853ff73728960dbd0b2127e | 11,981 | asm | Assembly | sdk/source/cxx/gccdefines.asm | fincs/FeOS | 68258965239f2cd74ab545af2f5f0229d335d49b | [
"WTFPL"
] | 55 | 2015-04-01T20:42:55.000Z | 2022-02-16T03:00:06.000Z | sdk/source/cxx/gccdefines.asm | shutterbug2000/FeOS | 68258965239f2cd74ab545af2f5f0229d335d49b | [
"WTFPL"
] | 8 | 2017-04-05T18:30:12.000Z | 2021-05-19T00:48:48.000Z | sdk/source/cxx/gccdefines.asm | shutterbug2000/FeOS | 68258965239f2cd74ab545af2f5f0229d335d49b | [
"WTFPL"
] | 4 | 2017-07-05T01:39:41.000Z | 2021-11-26T12:13:43.000Z | @ libgcc code defines - extracted from lib1funcs.S
/* Copyright 1995, 1996, 1998, 1999, 2000, 2003, 2004, 2005, 2007, 2008,
2009, 2010 Free Software Foundation, Inc.
This file is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3, or (at your option) any
later version.
This file 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
General Public License for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* An executable stack is *not* required for these functions. */
#if defined(__ELF__) && defined(__linux__)
.section .note.GNU-stack,"",%progbits
.previous
#endif /* __ELF__ and __linux__ */
#ifdef __ARM_EABI__
/* Some attributes that are common to all routines in this file. */
/* Tag_ABI_align_needed: This code does not require 8-byte
alignment from the caller. */
/* .eabi_attribute 24, 0 -- default setting. */
/* Tag_ABI_align_preserved: This code preserves 8-byte
alignment in any callee. */
.eabi_attribute 25, 1
#endif /* __ARM_EABI__ */
/* ------------------------------------------------------------------------ */
/* We need to know what prefix to add to function names. */
#ifndef __USER_LABEL_PREFIX__
#error __USER_LABEL_PREFIX__ not defined
#endif
/* ANSI concatenation macros. */
#define CONCAT1(a, b) CONCAT2(a, b)
#define CONCAT2(a, b) a ## b
/* Use the right prefix for global labels. */
#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
#ifdef __ELF__
//#ifdef __thumb__
//#define __PLT__ /* Not supported in Thumb assembler (for now). */
//#elif defined __vxworks && !defined __PIC__
#define __PLT__ /* Not supported by the kernel loader. */
//#else
//#define __PLT__ (PLT)
//#endif
#define TYPE(x) .type SYM(x),function
#define SIZE(x) .size SYM(x), . - SYM(x)
#define LSYM(x) .x
#else
#define __PLT__
#define TYPE(x)
#define SIZE(x)
#define LSYM(x) x
#endif
/* Function end macros. Variants for interworking. */
#if defined(__ARM_ARCH_2__)
# define __ARM_ARCH__ 2
#endif
#if defined(__ARM_ARCH_3__)
# define __ARM_ARCH__ 3
#endif
#if defined(__ARM_ARCH_3M__) || defined(__ARM_ARCH_4__) \
|| defined(__ARM_ARCH_4T__)
/* We use __ARM_ARCH__ set to 4 here, but in reality it's any processor with
long multiply instructions. That includes v3M. */
# define __ARM_ARCH__ 4
#endif
#if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \
|| defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \
|| defined(__ARM_ARCH_5TEJ__)
# define __ARM_ARCH__ 5
#endif
#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
|| defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \
|| defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) \
|| defined(__ARM_ARCH_6M__)
# define __ARM_ARCH__ 6
#endif
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
|| defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
|| defined(__ARM_ARCH_7EM__)
# define __ARM_ARCH__ 7
#endif
#ifndef __ARM_ARCH__
#error Unable to determine architecture.
#endif
/* There are times when we might prefer Thumb1 code even if ARM code is
permitted, for example, the code might be smaller, or there might be
interworking problems with switching to ARM state if interworking is
disabled. */
#if (defined(__thumb__) \
&& !defined(__thumb2__) \
&& (!defined(__THUMB_INTERWORK__) \
|| defined (__OPTIMIZE_SIZE__) \
|| defined(__ARM_ARCH_6M__)))
# define __prefer_thumb__
#endif
/* How to return from a function call depends on the architecture variant. */
#if (__ARM_ARCH__ > 4) || defined(__ARM_ARCH_4T__)
# define RET bx lr
# define RETc(x) bx##x lr
/* Special precautions for interworking on armv4t. */
# if (__ARM_ARCH__ == 4)
/* Always use bx, not ldr pc. */
# if (defined(__thumb__) || defined(__THUMB_INTERWORK__))
# define __INTERWORKING__
# endif /* __THUMB__ || __THUMB_INTERWORK__ */
/* Include thumb stub before arm mode code. */
# if defined(__thumb__) && !defined(__THUMB_INTERWORK__)
# define __INTERWORKING_STUBS__
# endif /* __thumb__ && !__THUMB_INTERWORK__ */
#endif /* __ARM_ARCH == 4 */
#else
# define RET mov pc, lr
# define RETc(x) mov##x pc, lr
#endif
.macro cfi_pop advance, reg, cfa_offset
#ifdef __ELF__
.pushsection .debug_frame
.byte 0x4 /* DW_CFA_advance_loc4 */
.4byte \advance
.byte (0xc0 | \reg) /* DW_CFA_restore */
.byte 0xe /* DW_CFA_def_cfa_offset */
.uleb128 \cfa_offset
.popsection
#endif
.endm
.macro cfi_push advance, reg, offset, cfa_offset
#ifdef __ELF__
.pushsection .debug_frame
.byte 0x4 /* DW_CFA_advance_loc4 */
.4byte \advance
.byte (0x80 | \reg) /* DW_CFA_offset */
.uleb128 (\offset / -4)
.byte 0xe /* DW_CFA_def_cfa_offset */
.uleb128 \cfa_offset
.popsection
#endif
.endm
.macro cfi_start start_label, end_label
#ifdef __ELF__
.pushsection .debug_frame
LSYM(Lstart_frame):
.4byte LSYM(Lend_cie) - LSYM(Lstart_cie) @ Length of CIE
LSYM(Lstart_cie):
.4byte 0xffffffff @ CIE Identifier Tag
.byte 0x1 @ CIE Version
.ascii "\0" @ CIE Augmentation
.uleb128 0x1 @ CIE Code Alignment Factor
.sleb128 -4 @ CIE Data Alignment Factor
.byte 0xe @ CIE RA Column
.byte 0xc @ DW_CFA_def_cfa
.uleb128 0xd
.uleb128 0x0
.align 2
LSYM(Lend_cie):
.4byte LSYM(Lend_fde)-LSYM(Lstart_fde) @ FDE Length
LSYM(Lstart_fde):
.4byte LSYM(Lstart_frame) @ FDE CIE offset
.4byte \start_label @ FDE initial location
.4byte \end_label-\start_label @ FDE address range
.popsection
#endif
.endm
.macro cfi_end end_label
#ifdef __ELF__
.pushsection .debug_frame
.align 2
LSYM(Lend_fde):
.popsection
\end_label:
#endif
.endm
/* Don't pass dirn, it's there just to get token pasting right. */
.macro RETLDM regs=, cond=, unwind=, dirn=ia
#if defined (__INTERWORKING__)
.ifc "\regs",""
ldr\cond lr, [sp], #8
.else
# if defined(__thumb2__)
pop\cond {\regs, lr}
# else
ldm\cond\dirn sp!, {\regs, lr}
# endif
.endif
.ifnc "\unwind", ""
/* Mark LR as restored. */
97: cfi_pop 97b - \unwind, 0xe, 0x0
.endif
bx\cond lr
#else
/* Caller is responsible for providing IT instruction. */
.ifc "\regs",""
ldr\cond pc, [sp], #8
.else
# if defined(__thumb2__)
pop\cond {\regs, pc}
# else
ldm\cond\dirn sp!, {\regs, pc}
# endif
.endif
#endif
.endm
/* The Unified assembly syntax allows the same code to be assembled for both
ARM and Thumb-2. However this is only supported by recent gas, so define
a set of macros to allow ARM code on older assemblers. */
#if defined(__thumb2__)
.macro do_it cond, suffix=""
it\suffix \cond
.endm
.macro shift1 op, arg0, arg1, arg2
\op \arg0, \arg1, \arg2
.endm
#define do_push push
#define do_pop pop
#define COND(op1, op2, cond) op1 ## op2 ## cond
/* Perform an arithmetic operation with a variable shift operand. This
requires two instructions and a scratch register on Thumb-2. */
.macro shiftop name, dest, src1, src2, shiftop, shiftreg, tmp
\shiftop \tmp, \src2, \shiftreg
\name \dest, \src1, \tmp
.endm
#else
.macro do_it cond, suffix=""
.endm
.macro shift1 op, arg0, arg1, arg2
mov \arg0, \arg1, \op \arg2
.endm
#define do_push stmfd sp!,
#define do_pop ldmfd sp!,
#define COND(op1, op2, cond) op1 ## cond ## op2
.macro shiftop name, dest, src1, src2, shiftop, shiftreg, tmp
\name \dest, \src1, \src2, \shiftop \shiftreg
.endm
#endif
#ifdef __ARM_EABI__
.macro ARM_LDIV0 name signed
cmp r0, #0
.ifc \signed, unsigned
movne r0, #0xffffffff
.else
movgt r0, #0x7fffffff
movlt r0, #0x80000000
.endif
b SYM (__aeabi_idiv0) __PLT__
.endm
#else
.macro ARM_LDIV0 name signed
str lr, [sp, #-8]!
98: cfi_push 98b - __\name, 0xe, -0x8, 0x8
bl SYM (__div0) __PLT__
mov r0, #0 @ About as wrong as it could be.
RETLDM unwind=98b
.endm
#endif
#ifdef __ARM_EABI__
.macro THUMB_LDIV0 name signed
#if defined(__ARM_ARCH_6M__)
.ifc \signed, unsigned
cmp r0, #0
beq 1f
mov r0, #0
mvn r0, r0 @ 0xffffffff
1:
.else
cmp r0, #0
beq 2f
blt 3f
mov r0, #0
mvn r0, r0
lsr r0, r0, #1 @ 0x7fffffff
b 2f
3: mov r0, #0x80
lsl r0, r0, #24 @ 0x80000000
2:
.endif
push {r0, r1, r2}
ldr r0, 4f
adr r1, 4f
add r0, r1
str r0, [sp, #8]
@ We know we are not on armv4t, so pop pc is safe.
pop {r0, r1, pc}
.align 2
4:
.word __aeabi_idiv0 - 4b
#elif defined(__thumb2__)
.syntax unified
.ifc \signed, unsigned
cbz r0, 1f
mov r0, #0xffffffff
1:
.else
cmp r0, #0
do_it gt
movgt r0, #0x7fffffff
do_it lt
movlt r0, #0x80000000
.endif
b.w SYM(__aeabi_idiv0) __PLT__
#else
.align 2
bx pc
nop
.arm
cmp r0, #0
.ifc \signed, unsigned
movne r0, #0xffffffff
.else
movgt r0, #0x7fffffff
movlt r0, #0x80000000
.endif
b SYM(__aeabi_idiv0) __PLT__
.thumb
#endif
.endm
#else
.macro THUMB_LDIV0 name signed
push { r1, lr }
98: cfi_push 98b - __\name, 0xe, -0x4, 0x8
bl SYM (__div0)
mov r0, #0 @ About as wrong as it could be.
#if defined (__INTERWORKING__)
pop { r1, r2 }
bx r2
#else
pop { r1, pc }
#endif
.endm
#endif
.macro FUNC_END name
SIZE (__\name)
.endm
.macro DIV_FUNC_END name signed
cfi_start __\name, LSYM(Lend_div0)
LSYM(Ldiv0):
#ifdef __thumb__
THUMB_LDIV0 \name \signed
#else
ARM_LDIV0 \name \signed
#endif
cfi_end LSYM(Lend_div0)
FUNC_END \name
.endm
.macro THUMB_FUNC_START name
.globl SYM (\name)
TYPE (\name)
.thumb_func
SYM (\name):
.endm
/* Function start macros. Variants for ARM and Thumb. */
#ifdef __thumb__
#define THUMB_FUNC .thumb_func
#define THUMB_CODE .force_thumb
# if defined(__thumb2__)
#define THUMB_SYNTAX .syntax divided
# else
#define THUMB_SYNTAX
# endif
#else
#define THUMB_FUNC
#define THUMB_CODE
#define THUMB_SYNTAX
#endif
.macro FUNC_START name
.text
.globl SYM (__\name)
.hidden SYM (__\name)
TYPE (__\name)
.align 0
THUMB_CODE
THUMB_FUNC
THUMB_SYNTAX
SYM (__\name):
.endm
/* Special function that will always be coded in ARM assembly, even if
in Thumb-only compilation. */
#if defined(__thumb2__)
/* For Thumb-2 we build everything in thumb mode. */
.macro ARM_FUNC_START name
FUNC_START \name
.syntax unified
.endm
#define EQUIV .thumb_set
.macro ARM_CALL name
bl __\name
.endm
#elif defined(__INTERWORKING_STUBS__)
.macro ARM_FUNC_START name
FUNC_START \name
bx pc
nop
.arm
/* A hook to tell gdb that we've switched to ARM mode. Also used to call
directly from other local arm routines. */
_L__\name:
.endm
#define EQUIV .thumb_set
/* Branch directly to a function declared with ARM_FUNC_START.
Must be called in arm mode. */
.macro ARM_CALL name
bl _L__\name
.endm
#else /* !(__INTERWORKING_STUBS__ || __thumb2__) */
#ifdef __ARM_ARCH_6M__
#define EQUIV .thumb_set
#else
.macro ARM_FUNC_START name
.text
.globl SYM (__\name)
.hidden SYM (__\name)
TYPE (__\name)
.align 0
.arm
SYM (__\name):
.endm
#define EQUIV .set
.macro ARM_CALL name
bl __\name
.endm
#endif
#endif
.macro FUNC_ALIAS new old
.globl SYM (__\new)
.hidden SYM (__\new)
#if defined (__thumb__)
.thumb_set SYM (__\new), SYM (__\old)
#else
.set SYM (__\new), SYM (__\old)
#endif
.endm
#ifndef __ARM_ARCH_6M__
.macro ARM_FUNC_ALIAS new old
.globl SYM (__\new)
.hidden SYM (__\new)
EQUIV SYM (__\new), SYM (__\old)
#if defined(__INTERWORKING_STUBS__)
.set SYM (_L__\new), SYM (_L__\old)
#endif
.endm
#endif
#ifdef __ARMEB__
#define xxh r0
#define xxl r1
#define yyh r2
#define yyl r3
#else
#define xxh r1
#define xxl r0
#define yyh r3
#define yyl r2
#endif
#ifdef __ARM_EABI__
.macro WEAK name
.weak SYM (__\name)
.endm
#endif
| 22.952107 | 78 | 0.707787 |
bd5cb9aecde455dc1a826fe2e71f208ee2828228 | 97,031 | asm | Assembly | gwnum/ymult3ax.asm | Kasual/GIMPS | a09c0d4cc1489558725eef0578613c66bd65a708 | [
"Intel"
] | null | null | null | gwnum/ymult3ax.asm | Kasual/GIMPS | a09c0d4cc1489558725eef0578613c66bd65a708 | [
"Intel"
] | null | null | null | gwnum/ymult3ax.asm | Kasual/GIMPS | a09c0d4cc1489558725eef0578613c66bd65a708 | [
"Intel"
] | null | null | null | ; Copyright 2011-2019 Mersenne Research, Inc. All rights reserved
; Author: George Woltman
; Email: woltman@alum.mit.edu
;
; Additional routines used with yr4dwpn (r4delay with partial normalization) FFTs,
;
TITLE setup
IFNDEF X86_64
.686
.XMM
.MODEL FLAT
ENDIF
INCLUDE unravel.mac
INCLUDE extrn.mac
INCLUDE yarch.mac
INCLUDE ybasics.mac
INCLUDE ymult.mac
INCLUDE ynormal.mac
_TEXT SEGMENT
;;
;; Add two numbers without carry propagation. Caller can use this for
;; consecutive add or subtract operations. However, the last operation
;; before a multiply must use the routine that will normalize data.
;;
PROCFL gwyaddq3
ad_prolog 0,0,rbx,rsi,rdi
mov rcx, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rsi, DESTARG ; Address of destination
mov ebx, 4 ; Four pass 2 blks in one pass 1 block
qadd0: mov eax, normval4 ; Load count of 4KB chunks in a block
qadd1: mov edi, normval1 ; Load count of clms in 4KB
imul edi, cache_line_multiplier ; Compute cache lines in 4KB chunk
shr edi, 2
qaddlp: vmovapd ymm0, [rdx] ; Load second number
vaddpd ymm0, ymm0, [rcx] ; Add in first number
vmovapd ymm1, [rdx+32] ; Load second number
vaddpd ymm1, ymm1, [rcx+32] ; Add in first number
ystore [rsi], ymm0 ; Save result
ystore [rsi+32], ymm1 ; Save result
bump rcx, 64 ; Next source
bump rdx, 64 ; Next source
bump rsi, 64 ; Next dest
dec rdi ; Test for end of 4KB chunk
jnz short qaddlp ; Loop if necessary
add rcx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec rax ; Check middle loop counter
jnz short qadd1 ; Loop if necessary
add rcx, pass2gapsize ; Next source
add rdx, pass2gapsize ; Next source
add rsi, pass2gapsize ; Next dest
dec rbx ; Check loop counter
jnz qadd0 ; Loop if necessary
ad_epilog 0,0,rbx,rsi,rdi
gwyaddq3 ENDP
;;
;; Add two numbers with carry propagation (eight different versions)
;;
saved_src1 EQU PPTR [rsp+first_local+0*SZPTR]
saved_src2 EQU PPTR [rsp+first_local+1*SZPTR]
saved_biglit EQU PPTR [rsp+first_local+2*SZPTR]
dist_to_dest EQU PPTR [rsp+first_local+3*SZPTR]
loopcount1 EQU DPTR [rsp+first_local+4*SZPTR]
loopcount2 EQU DPTR [rsp+first_local+4*SZPTR+4]
loopcount3 EQU DPTR [rsp+first_local+4*SZPTR+8]
loopcount4 EQU DPTR [rsp+first_local+4*SZPTR+12]
loopcount5 EQU DPTR [rsp+first_local+4*SZPTR+16]
; Base 2, irrational, not zero-padded
PROCFL gwyadd3
ad_prolog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rax, DESTARG ; Address of destination
sub rax, rsi ; Calculate distance from first number to destination
mov dist_to_dest, rax ; Save distance to dest
mov rbp, norm_grp_mults ; Addr of the group multipliers
mov rdi, norm_biglit_array ; Addr of the big/little flags array
vmovapd ymm2, YMM_BIGVAL ; Init 2 carry registers
vmovapd ymm3, ymm2
;; Loop over all pass 1 blocks
mov eax, count3 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
ablk0: mov eax, count2 ; Load wpn count
mov loopcount2, eax ; Save count
ablk1:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov saved_biglit, rdi
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
add0: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
add1: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
add2: ynorm_op_wpn vaddpd, exec, exec, dist_to_dest ; Add and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
bump rdi, 2 ; Next flags ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc add2
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz add2
add rdi, normval2 ; Adjust ptr to little/big flags
dec loopcount4 ; Loop until 4KB processed
jnz add1 ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz add0
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore dest start of block ptr
add rsi, dist_to_dest
mov rdi, saved_biglit ; Restore biglit start of block ptr
ynorm_op_wpn_blk exec, exec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
add rdi, normval3 ; Next little/big flags ptr
dec loopcount2 ; Test wpn_count
jnz ablk1
bump rbp, 2*YMM_GMD ; Next set of group multipliers
dec loopcount1 ; Decrement outer loop counter
jnz ablk0 ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
mov rbp, norm_grp_mults ; Group ttp ptr
mov rdi, norm_biglit_array ; Addr of the big/little flags array
ynorm_op_wpn_final exec, exec, xmm2, xmm3 ; Add last 2 carries to start of destination
ad_epilog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
gwyadd3 ENDP
; Base 2, rational, not zero-padded
PROCFL gwyaddr3
ad_prolog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rdi, DESTARG ; Address of destination
sub rdi, rsi ; Calculate distance from first number to destination
vmovapd ymm2, YMM_BIGVAL ; Init 2 carry registers
vmovapd ymm3, ymm2
;; Loop over all pass 1 blocks
mov eax, addcount1 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
ablk0r:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
add0r: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
add1r: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
add2r: ynorm_op_wpn vaddpd, noexec, exec, rdi ; Add and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc add2r
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz add2r
dec loopcount4 ; Loop until 4KB processed
jnz add1r ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz add0r
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore dest start of block ptr
add rsi, rdi
ynorm_op_wpn_blk noexec, exec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
dec loopcount1 ; Decrement outer loop counter
jnz ablk0r ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
ynorm_op_wpn_final noexec, exec, xmm2, xmm3 ; Add last 2 carries to start of destination
ad_epilog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
gwyaddr3 ENDP
; Not base 2, irrational, not zero-padded
PROCFL gwyaddn3
ad_prolog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rax, DESTARG ; Address of destination
sub rax, rsi ; Calculate distance from first number to destination
mov dist_to_dest, rax ; Save distance to dest
mov rbp, norm_grp_mults ; Addr of the group multipliers
mov rdi, norm_biglit_array ; Addr of the big/little flags array
vxorpd ymm2, ymm2, ymm2 ; Init 2 carry registers
vxorpd ymm3, ymm3, ymm3
;; Loop over all pass 1 blocks
mov eax, count3 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
ablk0n: mov eax, count2 ; Load wpn count
mov loopcount2, eax ; Save count
ablk1n:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov saved_biglit, rdi
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
add0n: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
add1n: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
add2n: ynorm_op_wpn vaddpd, exec, noexec, dist_to_dest ; Add and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
bump rdi, 2 ; Next flags ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc add2n
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz add2n
add rdi, normval2 ; Adjust ptr to little/big flags
dec loopcount4 ; Loop until 4KB processed
jnz add1n ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz add0n
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore dest start of block ptr
add rsi, dist_to_dest
mov rdi, saved_biglit ; Restore biglit start of block ptr
ynorm_op_wpn_blk exec, noexec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
add rdi, normval3 ; Next little/big flags ptr
dec loopcount2 ; Test wpn_count
jnz ablk1n
bump rbp, 2*YMM_GMD ; Next set of group multipliers
dec loopcount1 ; Decrement outer loop counter
jnz ablk0n ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
mov rbp, norm_grp_mults ; Group ttp ptr
mov rdi, norm_biglit_array ; Addr of the big/little flags array
ynorm_op_wpn_final exec, noexec, xmm2, xmm3 ; Add last 2 carries to start of destination
ad_epilog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
gwyaddn3 ENDP
; Not base 2, rational, not zero-padded
PROCFL gwyaddnr3
ad_prolog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rdi, DESTARG ; Address of destination
sub rdi, rsi ; Calculate distance from first number to destination
vxorpd ymm2, ymm2, ymm2 ; Init 2 carry registers
vxorpd ymm3, ymm3, ymm3
;; Loop over all pass 1 blocks
mov eax, addcount1 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
ablk0nr:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
add0nr: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
add1nr: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
add2nr: ynorm_op_wpn vaddpd, noexec, noexec, rdi ; Add and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc add2nr
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz add2nr
dec loopcount4 ; Loop until 4KB processed
jnz add1nr ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz add0nr
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore dest start of block ptr
add rsi, rdi
ynorm_op_wpn_blk noexec, noexec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
dec loopcount1 ; Decrement outer loop counter
jnz ablk0nr ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
ynorm_op_wpn_final noexec, noexec, xmm2, xmm3 ; Add last 2 carries to start of destination
ad_epilog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
gwyaddnr3 ENDP
; Base 2, irrational, zero-padded
PROCFL gwyaddzp3
ad_prolog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rbx, DESTARG ; Address of destination
sub rbx, rsi ; Calculate distance from first number to destination
mov rbp, norm_grp_mults ; Addr of the group multipliers
mov rdi, norm_biglit_array ; Addr of the big/little flags array
vmovapd ymm2, YMM_BIGVAL ; Init 2 carry registers
vmovapd ymm3, ymm2
;; Loop over all pass 1 blocks
mov eax, count3 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
ablk0zp: mov eax, count2 ; Load wpn count
mov loopcount2, eax ; Save count
ablk1zp:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov saved_biglit, rdi
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
add0zp: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
add1zp: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
add2zp: ynorm_op_wpn_zpad vaddpd, exec, exec ; Add and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
bump rdi, 2 ; Next flags ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc add2zp
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz add2zp
add rdi, normval2 ; Adjust ptr to little/big flags
dec loopcount4 ; Loop until 4KB processed
jnz add1zp ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz add0zp
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore source start of block ptr
add rsi, rbx ; Convert source ptr to dest ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
ynorm_op_wpn_zpad_blk exec, exec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
add rdi, normval3 ; Next little/big flags ptr
dec loopcount2 ; Test wpn_count
jnz ablk1zp
bump rbp, YMM_GMD ; Next set of group multipliers
dec loopcount1 ; Decrement outer loop counter
jnz ablk0zp ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
mov rbp, norm_grp_mults ; Group ttp ptr
mov rdi, norm_biglit_array ; Addr of the big/little flags array
ynorm_op_wpn_zpad_final exec, exec, xmm2, xmm3 ; Add last 2 carries to start of destination
ad_epilog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
gwyaddzp3 ENDP
; Base 2, rational, zero-padded
PROCFL gwyaddrzp3
ad_prolog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rbx, DESTARG ; Address of destination
sub rbx, rsi ; Calculate distance from first number to destination
vmovapd ymm2, YMM_BIGVAL ; Init 2 carry registers
vmovapd ymm3, ymm2
;; Loop over all pass 1 blocks
mov eax, addcount1 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
ablk0rzp:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
add0rzp: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
add1rzp: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
add2rzp: ynorm_op_wpn_zpad vaddpd, noexec, exec ; Add and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc add2rzp
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz add2rzp
dec loopcount4 ; Loop until 4KB processed
jnz add1rzp ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz add0rzp
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore source start of block ptr
add rsi, rbx ; Convert source ptr to dest ptr
ynorm_op_wpn_zpad_blk noexec, exec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
dec loopcount1 ; Decrement outer loop counter
jnz ablk0rzp ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
ynorm_op_wpn_zpad_final noexec, exec, xmm2, xmm3 ; Add last 2 carries to start of destination
ad_epilog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
gwyaddrzp3 ENDP
; Not base 2, irrational, zero-padded
PROCFL gwyaddnzp3
ad_prolog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rbx, DESTARG ; Address of destination
sub rbx, rsi ; Calculate distance from first number to destination
mov rbp, norm_grp_mults ; Addr of the group multipliers
mov rdi, norm_biglit_array ; Addr of the big/little flags array
vxorpd ymm2, ymm2, ymm2 ; Init 2 carry registers
vxorpd ymm3, ymm3, ymm3
;; Loop over all pass 1 blocks
mov eax, count3 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
ablk0nzp: mov eax, count2 ; Load wpn count
mov loopcount2, eax ; Save count
ablk1nzp:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov saved_biglit, rdi
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
add0nzp: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
add1nzp: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
add2nzp: ynorm_op_wpn_zpad vaddpd, exec, noexec ; Add and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
bump rdi, 2 ; Next flags ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc add2nzp
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz add2nzp
add rdi, normval2 ; Adjust ptr to little/big flags
dec loopcount4 ; Loop until 4KB processed
jnz add1nzp ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz add0nzp
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore source start of block ptr
add rsi, rbx ; Convert source ptr to dest ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
ynorm_op_wpn_zpad_blk exec, noexec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
add rdi, normval3 ; Next little/big flags ptr
dec loopcount2 ; Test wpn_count
jnz ablk1nzp
bump rbp, YMM_GMD ; Next set of group multipliers
dec loopcount1 ; Decrement outer loop counter
jnz ablk0nzp ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
mov rbp, norm_grp_mults ; Group ttp ptr
mov rdi, norm_biglit_array ; Addr of the big/little flags array
ynorm_op_wpn_zpad_final exec, noexec, xmm2, xmm3 ; Add last 2 carries to start of destination
ad_epilog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
gwyaddnzp3 ENDP
; Not base 2, rational, zero-padded
PROCFL gwyaddnrzp3
ad_prolog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rbx, DESTARG ; Address of destination
sub rbx, rsi ; Calculate distance from first number to destination
vxorpd ymm2, ymm2, ymm2 ; Init 2 carry registers
vxorpd ymm3, ymm3, ymm3
;; Loop over all pass 1 blocks
mov eax, addcount1 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
ablk0nrzp:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
add0nrzp: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
add1nrzp: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
add2nrzp: ynorm_op_wpn_zpad vaddpd, noexec, noexec ; Add and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc add2nrzp
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz add2nrzp
dec loopcount4 ; Loop until 4KB processed
jnz add1nrzp ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz add0nrzp
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore source start of block ptr
add rsi, rbx ; Convert source ptr to dest ptr
ynorm_op_wpn_zpad_blk noexec, noexec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
dec loopcount1 ; Decrement outer loop counter
jnz ablk0nrzp ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
ynorm_op_wpn_zpad_final noexec, noexec, xmm2, xmm3 ; Add last 2 carries to start of destination
ad_epilog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
gwyaddnrzp3 ENDP
;;
;; Subtract two numbers without carry propagation. Caller can use this for
;; consecutive add or subtract operations. However, the last operation
;; before a multiply must use the routine that will normalize data.
;;
PROCFL gwysubq3
ad_prolog 0,0,rbx,rsi,rdi
mov rcx, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rsi, DESTARG ; Address of destination
mov ebx, 4 ; Four pass 2 blks in one pass 1 block
qsub0: mov eax, normval4 ; Load count of 4KB chunks in a block
qsub1: mov edi, normval1 ; Load count of clms in 4KB
imul edi, cache_line_multiplier ; Compute cache lines in 4KB chunk
shr edi, 2
qsublp: vmovapd ymm0, [rdx] ; Load second number
vsubpd ymm0, ymm0, [rcx] ; Subtract first number
vmovapd ymm1, [rdx+32] ; Load second number
vsubpd ymm1, ymm1, [rcx+32] ; Subtract first number
ystore [rsi], ymm0 ; Save result
ystore [rsi+32], ymm1 ; Save result
bump rcx, 64 ; Next source
bump rdx, 64 ; Next source
bump rsi, 64 ; Next dest
dec rdi ; Test for end of 4KB chunk
jnz short qsublp ; Loop if necessary
add rcx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec rax ; Check middle loop counter
jnz short qsub1 ; Loop if necessary
add rcx, pass2gapsize ; Next source
add rdx, pass2gapsize ; Next source
add rsi, pass2gapsize ; Next dest
dec rbx ; Check loop counter
jnz qsub0 ; Loop if necessary
ad_epilog 0,0,rbx,rsi,rdi
gwysubq3 ENDP
;;
;; Subtract two numbers with carry propagation (eight different versions)
;;
saved_src1 EQU PPTR [rsp+first_local+0*SZPTR]
saved_src2 EQU PPTR [rsp+first_local+1*SZPTR]
saved_biglit EQU PPTR [rsp+first_local+2*SZPTR]
dist_to_dest EQU PPTR [rsp+first_local+3*SZPTR]
loopcount1 EQU DPTR [rsp+first_local+4*SZPTR]
loopcount2 EQU DPTR [rsp+first_local+4*SZPTR+4]
loopcount3 EQU DPTR [rsp+first_local+4*SZPTR+8]
loopcount4 EQU DPTR [rsp+first_local+4*SZPTR+12]
loopcount5 EQU DPTR [rsp+first_local+4*SZPTR+16]
; Base 2, irrational, not zero-padded
PROCFL gwysub3
ad_prolog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rax, DESTARG ; Address of destination
sub rax, rsi ; Calculate distance from first number to destination
mov dist_to_dest, rax ; Save distance to dest
mov rbp, norm_grp_mults ; Addr of the group multipliers
mov rdi, norm_biglit_array ; Addr of the big/little flags array
vmovapd ymm2, YMM_BIGVAL ; Init 2 carry registers
vmovapd ymm3, ymm2
;; Loop over all pass 1 blocks
mov eax, count3 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
sblk0: mov eax, count2 ; Load wpn count
mov loopcount2, eax ; Save count
sblk1:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov saved_biglit, rdi
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
sub0: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
sub1: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
sub2: ynorm_op_wpn vsubpd, exec, exec, dist_to_dest ; Add and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
bump rdi, 2 ; Next flags ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc sub2
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz sub2
add rdi, normval2 ; Adjust ptr to little/big flags
dec loopcount4 ; Loop until 4KB processed
jnz sub1 ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz sub0
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore dest start of block ptr
add rsi, dist_to_dest
mov rdi, saved_biglit ; Restore biglit start of block ptr
ynorm_op_wpn_blk exec, exec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
add rdi, normval3 ; Next little/big flags ptr
dec loopcount2 ; Test wpn_count
jnz sblk1
bump rbp, 2*YMM_GMD ; Next set of group multipliers
dec loopcount1 ; Decrement outer loop counter
jnz sblk0 ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
mov rbp, norm_grp_mults ; Group ttp ptr
mov rdi, norm_biglit_array ; Addr of the big/little flags array
ynorm_op_wpn_final exec, exec, xmm2, xmm3 ; Add last 2 carries to start of destination
ad_epilog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
gwysub3 ENDP
; Base 2, rational, not zero-padded
PROCFL gwysubr3
ad_prolog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rdi, DESTARG ; Address of destination
sub rdi, rsi ; Calculate distance from first number to destination
vmovapd ymm2, YMM_BIGVAL ; Init 2 carry registers
vmovapd ymm3, ymm2
;; Loop over all pass 1 blocks
mov eax, addcount1 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
sblk0r:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
sub0r: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
sub1r: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
sub2r: ynorm_op_wpn vsubpd, noexec, exec, rdi ; Add and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc sub2r
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz sub2r
dec loopcount4 ; Loop until 4KB processed
jnz sub1r ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz sub0r
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore dest start of block ptr
add rsi, rdi
ynorm_op_wpn_blk noexec, exec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
dec loopcount1 ; Decrement outer loop counter
jnz sblk0r ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
ynorm_op_wpn_final noexec, exec, xmm2, xmm3 ; Add last 2 carries to start of destination
ad_epilog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
gwysubr3 ENDP
; Not base 2, irrational, not zero-padded
PROCFL gwysubn3
ad_prolog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rax, DESTARG ; Address of destination
sub rax, rsi ; Calculate distance from first number to destination
mov dist_to_dest, rax ; Save distance to dest
mov rbp, norm_grp_mults ; Addr of the group multipliers
mov rdi, norm_biglit_array ; Addr of the big/little flags array
vxorpd ymm2, ymm2, ymm2 ; Init 2 carry registers
vxorpd ymm3, ymm3, ymm3
;; Loop over all pass 1 blocks
mov eax, count3 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
sblk0n: mov eax, count2 ; Load wpn count
mov loopcount2, eax ; Save count
sblk1n:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov saved_biglit, rdi
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
sub0n: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
sub1n: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
sub2n: ynorm_op_wpn vsubpd, exec, noexec, dist_to_dest ; Add and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
bump rdi, 2 ; Next flags ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc sub2n
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz sub2n
add rdi, normval2 ; Adjust ptr to little/big flags
dec loopcount4 ; Loop until 4KB processed
jnz sub1n ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz sub0n
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore dest start of block ptr
add rsi, dist_to_dest
mov rdi, saved_biglit ; Restore biglit start of block ptr
ynorm_op_wpn_blk exec, noexec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
add rdi, normval3 ; Next little/big flags ptr
dec loopcount2 ; Test wpn_count
jnz sblk1n
bump rbp, 2*YMM_GMD ; Next set of group multipliers
dec loopcount1 ; Decrement outer loop counter
jnz sblk0n ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
mov rbp, norm_grp_mults ; Group ttp ptr
mov rdi, norm_biglit_array ; Addr of the big/little flags array
ynorm_op_wpn_final exec, noexec, xmm2, xmm3 ; Add last 2 carries to start of destination
ad_epilog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
gwysubn3 ENDP
; Not base 2, rational, not zero-padded
PROCFL gwysubnr3
ad_prolog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rdi, DESTARG ; Address of destination
sub rdi, rsi ; Calculate distance from first number to destination
vxorpd ymm2, ymm2, ymm2 ; Init 2 carry registers
vxorpd ymm3, ymm3, ymm3
;; Loop over all pass 1 blocks
mov eax, addcount1 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
sblk0nr:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
sub0nr: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
sub1nr: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
sub2nr: ynorm_op_wpn vsubpd, noexec, noexec, rdi ; Add and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc sub2nr
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz sub2nr
dec loopcount4 ; Loop until 4KB processed
jnz sub1nr ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz sub0nr
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore dest start of block ptr
add rsi, rdi
ynorm_op_wpn_blk noexec, noexec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
dec loopcount1 ; Decrement outer loop counter
jnz sblk0nr ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
ynorm_op_wpn_final noexec, noexec, xmm2, xmm3 ; Add last 2 carries to start of destination
ad_epilog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
gwysubnr3 ENDP
; Base 2, irrational, zero-padded
PROCFL gwysubzp3
ad_prolog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rbx, DESTARG ; Address of destination
sub rbx, rsi ; Calculate distance from first number to destination
mov rbp, norm_grp_mults ; Addr of the group multipliers
mov rdi, norm_biglit_array ; Addr of the big/little flags array
vmovapd ymm2, YMM_BIGVAL ; Init 2 carry registers
vmovapd ymm3, ymm2
;; Loop over all pass 1 blocks
mov eax, count3 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
sblk0zp: mov eax, count2 ; Load wpn count
mov loopcount2, eax ; Save count
sblk1zp:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov saved_biglit, rdi
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
sub0zp: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
sub1zp: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
sub2zp: ynorm_op_wpn_zpad vsubpd, exec, exec ; Add and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
bump rdi, 2 ; Next flags ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc sub2zp
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz sub2zp
add rdi, normval2 ; Adjust ptr to little/big flags
dec loopcount4 ; Loop until 4KB processed
jnz sub1zp ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz sub0zp
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore source start of block ptr
add rsi, rbx ; Convert to a dest ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
ynorm_op_wpn_zpad_blk exec, exec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
add rdi, normval3 ; Next little/big flags ptr
dec loopcount2 ; Test wpn_count
jnz sblk1zp
bump rbp, YMM_GMD ; Next set of group multipliers
dec loopcount1 ; Decrement outer loop counter
jnz sblk0zp ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
mov rbp, norm_grp_mults ; Group ttp ptr
mov rdi, norm_biglit_array ; Addr of the big/little flags array
ynorm_op_wpn_zpad_final exec, exec, xmm2, xmm3 ; Add last 2 carries to start of destination
ad_epilog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
gwysubzp3 ENDP
; Base 2, rational, zero-padded
PROCFL gwysubrzp3
ad_prolog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rbx, DESTARG ; Address of destination
sub rbx, rsi ; Calculate distance from first number to destination
vmovapd ymm2, YMM_BIGVAL ; Init 2 carry registers
vmovapd ymm3, ymm2
;; Loop over all pass 1 blocks
mov eax, addcount1 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
sblk0rzp:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
sub0rzp: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
sub1rzp: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
sub2rzp: ynorm_op_wpn_zpad vsubpd, noexec, exec ; Add and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc sub2rzp
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz sub2rzp
dec loopcount4 ; Loop until 4KB processed
jnz sub1rzp ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz sub0rzp
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore source start of block ptr
add rsi, rbx ; Convert to a dest ptr
ynorm_op_wpn_zpad_blk noexec, exec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
dec loopcount1 ; Decrement outer loop counter
jnz sblk0rzp ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
ynorm_op_wpn_zpad_final noexec, exec, xmm2, xmm3 ; Add last 2 carries to start of destination
ad_epilog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
gwysubrzp3 ENDP
; Not base 2, irrational, zero-padded
PROCFL gwysubnzp3
ad_prolog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rbx, DESTARG ; Address of destination
sub rbx, rsi ; Calculate distance from first number to destination
mov rbp, norm_grp_mults ; Addr of the group multipliers
mov rdi, norm_biglit_array ; Addr of the big/little flags array
vxorpd ymm2, ymm2, ymm2 ; Init 2 carry registers
vxorpd ymm3, ymm3, ymm3
;; Loop over all pass 1 blocks
mov eax, count3 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
sblk0nzp: mov eax, count2 ; Load wpn count
mov loopcount2, eax ; Save count
sblk1nzp:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov saved_biglit, rdi
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
sub0nzp: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
sub1nzp: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
sub2nzp: ynorm_op_wpn_zpad vsubpd, exec, noexec ; Add and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
bump rdi, 2 ; Next flags ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc sub2nzp
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz sub2nzp
add rdi, normval2 ; Adjust ptr to little/big flags
dec loopcount4 ; Loop until 4KB processed
jnz sub1nzp ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz sub0nzp
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore source start of block ptr
add rsi, rbx ; Convert to a dest ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
ynorm_op_wpn_zpad_blk exec, noexec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
add rdi, normval3 ; Next little/big flags ptr
dec loopcount2 ; Test wpn_count
jnz sblk1nzp
bump rbp, YMM_GMD ; Next set of group multipliers
dec loopcount1 ; Decrement outer loop counter
jnz sblk0nzp ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
mov rbp, norm_grp_mults ; Group ttp ptr
mov rdi, norm_biglit_array ; Addr of the big/little flags array
ynorm_op_wpn_zpad_final exec, noexec, xmm2, xmm3 ; Add last 2 carries to start of destination
ad_epilog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
gwysubnzp3 ENDP
; Not base 2, rational, zero-padded
PROCFL gwysubnrzp3
ad_prolog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rbx, DESTARG ; Address of destination
sub rbx, rsi ; Calculate distance from first number to destination
vxorpd ymm2, ymm2, ymm2 ; Init 2 carry registers
vxorpd ymm3, ymm3, ymm3
;; Loop over all pass 1 blocks
mov eax, addcount1 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
sblk0nrzp:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
sub0nrzp: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
sub1nrzp: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
sub2nrzp: ynorm_op_wpn_zpad vsubpd, noexec, noexec ; Add and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc sub2nrzp
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz sub2nrzp
dec loopcount4 ; Loop until 4KB processed
jnz sub1nrzp ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz sub0nrzp
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore source start of block ptr
add rsi, rbx ; Convert to a dest ptr
ynorm_op_wpn_zpad_blk noexec, noexec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
dec loopcount1 ; Decrement outer loop counter
jnz sblk0nrzp ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
ynorm_op_wpn_zpad_final noexec, noexec, xmm2, xmm3 ; Add last 2 carries to start of destination
ad_epilog 4*SZPTR+20,0,rbx,rbp,rsi,rdi
gwysubnrzp3 ENDP
;;
;; Add and subtract two numbers without carry propagation
;;
PROCFL gwyaddsubq3
ad_prolog 0,0,rbx,rbp,rsi,rdi
mov rcx, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rsi, DESTARG ; Address of destination #1
mov rbp, DEST2ARG ; Address of destination #2
mov ebx, 4 ; Four pass 2 blks in one pass 1 block
qaddsub0:mov eax, normval4 ; Load count of 4KB chunks in a block
qaddsub1:mov edi, normval1 ; Load count of clms in 4KB
imul edi, cache_line_multiplier ; Compute cache lines in 4KB chunk
shr edi, 2
qaddsublp:
vmovapd ymm0, [rcx] ; Load first number
vsubpd ymm1, ymm0, [rdx] ; Subtract out second number
vaddpd ymm0, ymm0, [rdx] ; Add in second number
vmovapd ymm2, [rcx+32] ; Load first number
vsubpd ymm3, ymm2, [rdx+32] ; Subtract out second number
vaddpd ymm2, ymm2, [rdx+32] ; Add in second number
ystore [rsi], ymm0 ; Save result
ystore [rbp], ymm1 ; Save result
ystore [rsi+32], ymm2 ; Save result
ystore [rbp+32], ymm3 ; Save result
bump rcx, 64 ; Next source
bump rdx, 64 ; Next source
bump rsi, 64 ; Next dest
bump rbp, 64 ; Next dest
dec rdi ; Test for end of 4KB chunk
jnz short qaddsublp ; Loop if necessary
add rcx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rbp, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec rax ; Check middle loop counter
jnz qaddsub1 ; Loop if necessary
add rcx, pass2gapsize ; Next source
add rdx, pass2gapsize ; Next source
add rsi, pass2gapsize ; Next dest
add rbp, pass2gapsize ; Next dest
dec rbx ; Check loop counter
jnz qaddsub0 ; Loop if necessary
ad_epilog 0,0,rbx,rbp,rsi,rdi
gwyaddsubq3 ENDP
;;
;; Add and subtract two numbers with carry propagation (eight different versions)
;;
saved_src1 EQU PPTR [rsp+first_local+0*SZPTR]
saved_src2 EQU PPTR [rsp+first_local+1*SZPTR]
saved_biglit EQU PPTR [rsp+first_local+2*SZPTR]
dist_to_dest1 EQU PPTR [rsp+first_local+3*SZPTR]
dist_to_dest2 EQU PPTR [rsp+first_local+4*SZPTR]
loopcount1 EQU DPTR [rsp+first_local+5*SZPTR]
loopcount2 EQU DPTR [rsp+first_local+5*SZPTR+4]
loopcount3 EQU DPTR [rsp+first_local+5*SZPTR+8]
loopcount4 EQU DPTR [rsp+first_local+5*SZPTR+12]
loopcount5 EQU DPTR [rsp+first_local+5*SZPTR+16]
; Base 2, irrational, not zero-padded
PROCFL gwyaddsub3
ad_prolog 5*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6,xmm7
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rax, DESTARG ; Address of destination
sub rax, rsi ; Calculate distance from first number to destination
mov dist_to_dest1, rax ; Save distance to dest
mov rax, DEST2ARG ; Address of destination #2
sub rax, rsi ; Calculate distance from first number to destination
mov dist_to_dest2, rax ; Save distance to dest
mov rbp, norm_grp_mults ; Addr of the group multipliers
mov rdi, norm_biglit_array ; Addr of the big/little flags array
vmovapd ymm2, YMM_BIGVAL ; Init 4 carry registers
vmovapd ymm3, ymm2
vmovapd ymm6, ymm2
vmovapd ymm7, ymm2
;; Loop over all pass 1 blocks
mov eax, count3 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
asblk0: mov eax, count2 ; Load wpn count
mov loopcount2, eax ; Save count
asblk1:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov saved_biglit, rdi
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
as0: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
as1: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
as2: ynorm_addsub_wpn exec, exec, dist_to_dest1, dist_to_dest2 ; Add & subtract and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
bump rdi, 2 ; Next flags ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc as2
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz as2
add rdi, normval2 ; Adjust ptr to little/big flags
dec loopcount4 ; Loop until 4KB processed
jnz as1 ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz as0
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore dest start of block ptr
add rsi, dist_to_dest1
mov rdi, saved_biglit ; Restore biglit start of block ptr
ynorm_op_wpn_blk exec, exec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore dest start of block ptr
add rsi, dist_to_dest2
mov rdi, saved_biglit ; Restore biglit start of block ptr
ynorm_op_wpn_blk exec, exec, ymm6, ymm7 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
add rdi, normval3 ; Next little/big flags ptr
dec loopcount2 ; Test wpn_count
jnz asblk1
bump rbp, 2*YMM_GMD ; Next set of group multipliers
dec loopcount1 ; Decrement outer loop counter
jnz asblk0 ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
mov rbp, norm_grp_mults ; Group ttp ptr
mov rdi, norm_biglit_array ; Addr of the big/little flags array
ynorm_op_wpn_final exec, exec, xmm2, xmm3 ; Add last 2 carries to start of destination
mov rsi, DEST2ARG ; Address of destination
mov rbp, norm_grp_mults ; Group ttp ptr
mov rdi, norm_biglit_array ; Addr of the big/little flags array
ynorm_op_wpn_final exec, exec, xmm6, xmm7 ; Add last 2 carries to start of destination
ad_epilog 5*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6,xmm7
gwyaddsub3 ENDP
; Base 2, rational, not zero-padded
PROCFL gwyaddsubr3
ad_prolog 5*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6,xmm7
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rdi, DESTARG ; Address of destination
sub rdi, rsi ; Calculate distance from first number to destination
mov rbp, DEST2ARG ; Address of destination #2
sub rbp, rsi ; Calculate distance from first number to destination
vmovapd ymm2, YMM_BIGVAL ; Init 4 carry registers
vmovapd ymm3, ymm2
vmovapd ymm6, ymm2
vmovapd ymm7, ymm2
;; Loop over all pass 1 blocks
mov eax, addcount1 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
asblk0r:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
as0r: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
as1r: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
as2r: ynorm_addsub_wpn noexec, exec, rdi, rbp ; Add & subtract and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc as2r
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz as2r
dec loopcount4 ; Loop until 4KB processed
jnz as1r ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz as0r
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore dest start of block ptr
add rsi, rdi
ynorm_op_wpn_blk noexec, exec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore dest start of block ptr
add rsi, rbp
ynorm_op_wpn_blk noexec, exec, ymm6, ymm7 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
dec loopcount1 ; Decrement outer loop counter
jnz asblk0r ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
ynorm_op_wpn_final noexec, exec, xmm2, xmm3 ; Add last 2 carries to start of destination
mov rsi, DEST2ARG ; Address of destination
ynorm_op_wpn_final noexec, exec, xmm6, xmm7 ; Add last 2 carries to start of destination
ad_epilog 5*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6,xmm7
gwyaddsubr3 ENDP
; Not base 2, irrational, not zero-padded
PROCFL gwyaddsubn3
ad_prolog 5*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6,xmm7
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rax, DESTARG ; Address of destination
sub rax, rsi ; Calculate distance from first number to destination
mov dist_to_dest1, rax ; Save distance to dest
mov rax, DEST2ARG ; Address of destination #2
sub rax, rsi ; Calculate distance from first number to destination
mov dist_to_dest2, rax ; Save distance to dest
mov rbp, norm_grp_mults ; Addr of the group multipliers
mov rdi, norm_biglit_array ; Addr of the big/little flags array
vxorpd ymm2, ymm2, ymm2 ; Init 4 carry registers
vxorpd ymm3, ymm3, ymm3
vxorpd ymm6, ymm6, ymm6
vxorpd ymm7, ymm7, ymm7
;; Loop over all pass 1 blocks
mov eax, count3 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
asblk0n: mov eax, count2 ; Load wpn count
mov loopcount2, eax ; Save count
asblk1n:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov saved_biglit, rdi
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
as0n: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
as1n: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
as2n: ynorm_addsub_wpn exec, noexec, dist_to_dest1, dist_to_dest2 ; Add & subtract and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
bump rdi, 2 ; Next flags ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc as2n
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz as2n
add rdi, normval2 ; Adjust ptr to little/big flags
dec loopcount4 ; Loop until 4KB processed
jnz as1n ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz as0n
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore dest start of block ptr
add rsi, dist_to_dest1
mov rdi, saved_biglit ; Restore biglit start of block ptr
ynorm_op_wpn_blk exec, noexec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore dest start of block ptr
add rsi, dist_to_dest2
mov rdi, saved_biglit ; Restore biglit start of block ptr
ynorm_op_wpn_blk exec, noexec, ymm6, ymm7 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
add rdi, normval3 ; Next little/big flags ptr
dec loopcount2 ; Test wpn_count
jnz asblk1n
bump rbp, 2*YMM_GMD ; Next set of group multipliers
dec loopcount1 ; Decrement outer loop counter
jnz asblk0n ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
mov rbp, norm_grp_mults ; Group ttp ptr
mov rdi, norm_biglit_array ; Addr of the big/little flags array
ynorm_op_wpn_final exec, noexec, xmm2, xmm3 ; Add last 2 carries to start of destination
mov rsi, DEST2ARG ; Address of destination
mov rbp, norm_grp_mults ; Group ttp ptr
mov rdi, norm_biglit_array ; Addr of the big/little flags array
ynorm_op_wpn_final exec, noexec, xmm6, xmm7 ; Add last 2 carries to start of destination
ad_epilog 5*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6,xmm7
gwyaddsubn3 ENDP
; Not base 2, rational, not zero-padded
PROCFL gwyaddsubnr3
ad_prolog 5*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6,xmm7
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rdi, DESTARG ; Address of destination
sub rdi, rsi ; Calculate distance from first number to destination
mov rbp, DEST2ARG ; Address of destination #2
sub rbp, rsi ; Calculate distance from first number to destination
vxorpd ymm2, ymm2, ymm2 ; Init 4 carry registers
vxorpd ymm3, ymm3, ymm3
vxorpd ymm6, ymm6, ymm6
vxorpd ymm7, ymm7, ymm7
;; Loop over all pass 1 blocks
mov eax, addcount1 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
asblk0nr:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
as0nr: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
as1nr: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
as2nr: ynorm_addsub_wpn noexec, noexec, rdi, rbp ; Add & subtract and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc as2nr
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz as2nr
dec loopcount4 ; Loop until 4KB processed
jnz as1nr ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz as0nr
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore dest start of block ptr
add rsi, rdi
ynorm_op_wpn_blk noexec, noexec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore dest start of block ptr
add rsi, rbp
ynorm_op_wpn_blk noexec, noexec, ymm6, ymm7 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
dec loopcount1 ; Decrement outer loop counter
jnz asblk0nr ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
ynorm_op_wpn_final noexec, noexec, xmm2, xmm3 ; Add last 2 carries to start of destination
mov rsi, DEST2ARG ; Address of destination
ynorm_op_wpn_final noexec, noexec, xmm6, xmm7 ; Add last 2 carries to start of destination
ad_epilog 5*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6,xmm7
gwyaddsubnr3 ENDP
; Base 2, irrational, zero-padded
PROCFL gwyaddsubzp3
ad_prolog 5*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6,xmm7
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rbx, DESTARG ; Address of destination
sub rbx, rsi ; Calculate distance from first number to destination
mov rax, DEST2ARG ; Address of destination #2
sub rax, rsi ; Calculate distance from first number to destination
mov dist_to_dest2, rax ; Save distance to dest
mov rbp, norm_grp_mults ; Addr of the group multipliers
mov rdi, norm_biglit_array ; Addr of the big/little flags array
vmovapd ymm2, YMM_BIGVAL ; Init 4 carry registers
vmovapd ymm3, ymm2
vmovapd ymm6, ymm2
vmovapd ymm7, ymm2
;; Loop over all pass 1 blocks
mov eax, count3 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
asblk0zp: mov eax, count2 ; Load wpn count
mov loopcount2, eax ; Save count
asblk1zp:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov saved_biglit, rdi
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
as0zp: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
as1zp: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
as2zp: ynorm_addsub_wpn_zpad exec, exec, dist_to_dest2 ; Add & subtract and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
bump rdi, 2 ; Next flags ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc as2zp
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz as2zp
add rdi, normval2 ; Adjust ptr to little/big flags
dec loopcount4 ; Loop until 4KB processed
jnz as1zp ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz as0zp
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore source start of block ptr
add rsi, rbx ; Convert to destination1 ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
ynorm_op_wpn_zpad_blk exec, exec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore source start of block ptr
add rsi, dist_to_dest2 ; Convert to destination2 ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
ynorm_op_wpn_zpad_blk exec, exec, ymm6, ymm7 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
add rdi, normval3 ; Next little/big flags ptr
dec loopcount2 ; Test wpn_count
jnz asblk1zp
bump rbp, YMM_GMD ; Next set of group multipliers
dec loopcount1 ; Decrement outer loop counter
jnz asblk0zp ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
mov rbp, norm_grp_mults ; Group ttp ptr
mov rdi, norm_biglit_array ; Addr of the big/little flags array
ynorm_op_wpn_zpad_final exec, exec, xmm2, xmm3 ; Add last 2 carries to start of destination
mov rsi, DEST2ARG ; Address of destination
mov rbp, norm_grp_mults ; Group ttp ptr
mov rdi, norm_biglit_array ; Addr of the big/little flags array
ynorm_op_wpn_zpad_final exec, exec, xmm6, xmm7 ; Add last 2 carries to start of destination
ad_epilog 5*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6,xmm7
gwyaddsubzp3 ENDP
; Base 2, rational, zero-padded
PROCFL gwyaddsubrzp3
ad_prolog 5*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6,xmm7
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rbx, DESTARG ; Address of destination
sub rbx, rsi ; Calculate distance from first number to destination
mov rdi, DEST2ARG ; Address of destination #2
sub rdi, rsi ; Calculate distance from first number to destination
vmovapd ymm2, YMM_BIGVAL ; Init 4 carry registers
vmovapd ymm3, ymm2
vmovapd ymm6, ymm2
vmovapd ymm7, ymm2
;; Loop over all pass 1 blocks
mov eax, addcount1 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
asblk0rzp:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
as0rzp: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
as1rzp: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
as2rzp: ynorm_addsub_wpn_zpad noexec, exec, rdi ; Add & subtract and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc as2rzp
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz as2rzp
dec loopcount4 ; Loop until 4KB processed
jnz as1rzp ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz as0rzp
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore source start of block ptr
add rsi, rbx ; Convert to destination1 ptr
ynorm_op_wpn_zpad_blk noexec, exec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore source start of block ptr
add rsi, rdi ; Convert to destination2 ptr
ynorm_op_wpn_zpad_blk noexec, exec, ymm6, ymm7 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
dec loopcount1 ; Decrement outer loop counter
jnz asblk0rzp ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
ynorm_op_wpn_zpad_final noexec, exec, xmm2, xmm3 ; Add last 2 carries to start of destination
mov rsi, DEST2ARG ; Address of destination
ynorm_op_wpn_zpad_final noexec, exec, xmm6, xmm7 ; Add last 2 carries to start of destination
ad_epilog 5*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6,xmm7
gwyaddsubrzp3 ENDP
; Not base 2, irrational, zero-padded
PROCFL gwyaddsubnzp3
ad_prolog 5*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6,xmm7
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rbx, DESTARG ; Address of destination
sub rbx, rsi ; Calculate distance from first number to destination
mov rax, DEST2ARG ; Address of destination #2
sub rax, rsi ; Calculate distance from first number to destination
mov dist_to_dest2, rax ; Save distance to dest
mov rbp, norm_grp_mults ; Addr of the group multipliers
mov rdi, norm_biglit_array ; Addr of the big/little flags array
vxorpd ymm2, ymm2, ymm2 ; Init 4 carry registers
vxorpd ymm3, ymm3, ymm3
vxorpd ymm6, ymm6, ymm6
vxorpd ymm7, ymm7, ymm7
;; Loop over all pass 1 blocks
mov eax, count3 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
asblk0nzp: mov eax, count2 ; Load wpn count
mov loopcount2, eax ; Save count
asblk1nzp:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov saved_biglit, rdi
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
as0nzp: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
as1nzp: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
as2nzp: ynorm_addsub_wpn_zpad exec, noexec, dist_to_dest2 ; Add & subtract and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
bump rdi, 2 ; Next flags ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc as2nzp
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz as2nzp
add rdi, normval2 ; Adjust ptr to little/big flags
dec loopcount4 ; Loop until 4KB processed
jnz as1nzp ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz as0nzp
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore source start of block ptr
add rsi, rbx ; Convert to destination1 ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
ynorm_op_wpn_zpad_blk exec, noexec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore source start of block ptr
add rsi, dist_to_dest2 ; Convert to destination2 ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
ynorm_op_wpn_zpad_blk exec, noexec, ymm6, ymm7 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
add rdi, normval3 ; Next little/big flags ptr
dec loopcount2 ; Test wpn_count
jnz asblk1nzp
bump rbp, YMM_GMD ; Next set of group multipliers
dec loopcount1 ; Decrement outer loop counter
jnz asblk0nzp ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
mov rbp, norm_grp_mults ; Group ttp ptr
mov rdi, norm_biglit_array ; Addr of the big/little flags array
ynorm_op_wpn_zpad_final exec, noexec, xmm2, xmm3 ; Add last 2 carries to start of destination
mov rsi, DEST2ARG ; Address of destination
mov rbp, norm_grp_mults ; Group ttp ptr
mov rdi, norm_biglit_array ; Addr of the big/little flags array
ynorm_op_wpn_zpad_final exec, noexec, xmm6, xmm7 ; Add last 2 carries to start of destination
ad_epilog 5*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6,xmm7
gwyaddsubnzp3 ENDP
; Not base 2, rational, zero-padded
PROCFL gwyaddsubnrzp3
ad_prolog 5*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6,xmm7
mov rsi, SRCARG ; Address of first number
mov rdx, SRC2ARG ; Address of second number
mov rbx, DESTARG ; Address of destination
sub rbx, rsi ; Calculate distance from first number to destination
mov rdi, DEST2ARG ; Address of destination #2
sub rdi, rsi ; Calculate distance from first number to destination
vxorpd ymm2, ymm2, ymm2 ; Init 4 carry registers
vxorpd ymm3, ymm3, ymm3
vxorpd ymm6, ymm6, ymm6
vxorpd ymm7, ymm7, ymm7
;; Loop over all pass 1 blocks
mov eax, addcount1 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
asblk0nrzp:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_src2, rdx
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
as0nrzp: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
as1nrzp: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
as2nrzp: ynorm_addsub_wpn_zpad noexec, noexec, rdi ; Add & subtract and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add rdx, pass2blkdst ; Next src ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc as2nrzp
sub rsi, pass1blkdst ; Adjust source pointers
sub rdx, pass1blkdst
bump rsi, 64
bump rdx, 64
sub loopcount5, 4 ; Loop clm times
jnz as2nrzp
dec loopcount4 ; Loop until 4KB processed
jnz as1nrzp ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz as0nrzp
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore source start of block ptr
add rsi, rbx ; Convert to destination1 ptr
ynorm_op_wpn_zpad_blk noexec, noexec, ymm2, ymm3 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore source start of block ptr
add rsi, rdi ; Convert to destination2 ptr
ynorm_op_wpn_zpad_blk noexec, noexec, ymm6, ymm7 ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdx, saved_src2 ; Restore src2 start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdx, pass1blkdst ; Next source pointer
dec loopcount1 ; Decrement outer loop counter
jnz asblk0nrzp ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
ynorm_op_wpn_zpad_final noexec, noexec, xmm2, xmm3 ; Add last 2 carries to start of destination
mov rsi, DEST2ARG ; Address of destination
ynorm_op_wpn_zpad_final noexec, noexec, xmm6, xmm7 ; Add last 2 carries to start of destination
ad_epilog 5*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6,xmm7
gwyaddsubnrzp3 ENDP
;;
;; Copy one number and zero some low order words.
;;
PROCFL gwycopyzero3
ad_prolog 0,0,rbx,rsi,rdi,rbp
mov rsi, SRCARG ; Address of first number
mov rdi, DESTARG ; Address of destination
sub ecx, ecx ; Offset to compare to COPYZERO
mov al, -1 ; Create 4 masks for copying values
mov BYTE PTR YMM_TMP4[7], al ; Create the copy all four values mask
mov BYTE PTR YMM_TMP4[15], al
mov BYTE PTR YMM_TMP4[23], al
mov BYTE PTR YMM_TMP4[31], al
mov BYTE PTR YMM_TMP3[7], cl ; Create the copy three values mask
mov BYTE PTR YMM_TMP3[15], al
mov BYTE PTR YMM_TMP3[23], al
mov BYTE PTR YMM_TMP3[31], al
mov BYTE PTR YMM_TMP2[7], cl ; Create the copy two values mask
mov BYTE PTR YMM_TMP2[15], cl
mov BYTE PTR YMM_TMP2[23], al
mov BYTE PTR YMM_TMP2[31], al
mov BYTE PTR YMM_TMP1[7], cl ; Create the copy one value mask
mov BYTE PTR YMM_TMP1[15], cl
mov BYTE PTR YMM_TMP1[23], cl
mov BYTE PTR YMM_TMP1[31], al
vxorpd ymm1, ymm1, ymm1 ; Start with the copy zero values mask
mov ebx, addcount1 ; Load pass 1 blk count
cz1: mov ebp, normval4 ; Load count of 4KB chunks in a block
cz2: mov edx, normval1 ; Load count of clms in 4KB
cz3: mov eax, cache_line_multiplier ; Compute cache lines in 4KB chunk
cz4: ycopyzero
add rsi, pass2blkdst ; Next src ptr
add rdi, pass2blkdst ; Next dest ptr
add rcx, pass2blkdst ; Next comparison offset
add al, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc short cz4
sub rsi, pass1blkdst ; Adjust source pointers
sub rdi, pass1blkdst
sub rcx, pass1blkdst
bump rsi, 64 ; Next source
bump rdi, 64 ; Next dest
bump rcx, 64 ; Next compare offset
sub al, 4 ; Loop clm times
jnz cz4 ; Loop if necessary
dec rdx ; Test for end of 4KB chunk
jnz cz3 ; Loop if necessary
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rdi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
add rcx, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec rbp ; Test loop counter
jnz cz2 ; Loop if necessary
add rsi, pass2gapsize
add rdi, pass2gapsize
add rcx, pass2gapsize
sub rsi, pass2blkdst
sub rdi, pass2blkdst
sub rcx, pass2blkdst
add rsi, pass1blkdst
add rdi, pass1blkdst
add rcx, pass1blkdst
dec rbx ; Test loop counter
jnz cz1 ; Loop if necessary
ad_epilog 0,0,rbx,rsi,rdi,rbp
gwycopyzero3 ENDP
;;
;; Add in a small number with carry propagation (four different versions)
;;
; Base 2, irrational version
PROCFL gwyadds3
ad_prolog 0,0,rbx,rbp,rsi,rdi
ynorm_smalladd_wpn exec, exec
ad_epilog 0,0,rbx,rbp,rsi,rdi
gwyadds3 ENDP
; Base 2, rational version
PROCFL gwyaddsr3
ad_prolog 0,0,rbx,rbp,rsi,rdi
ynorm_smalladd_wpn noexec, exec
ad_epilog 0,0,rbx,rbp,rsi,rdi
gwyaddsr3 ENDP
; Non base 2, irrational version
PROCFL gwyaddsn3
ad_prolog 0,0,rbx,rbp,rsi,rdi
ynorm_smalladd_wpn exec, noexec
ad_epilog 0,0,rbx,rbp,rsi,rdi
gwyaddsn3 ENDP
; Non base 2, rational version
PROCFL gwyaddsnr3
ad_prolog 0,0,rbx,rbp,rsi,rdi
ynorm_smalladd_wpn noexec, noexec
ad_epilog 0,0,rbx,rbp,rsi,rdi
gwyaddsnr3 ENDP
;;
;; Multiply a number by a small value with carry propagation (eight different versions)
;;
saved_src1 EQU PPTR [rsp+first_local+0*SZPTR]
saved_biglit EQU PPTR [rsp+first_local+1*SZPTR]
loopcount1 EQU DPTR [rsp+first_local+2*SZPTR]
loopcount2 EQU DPTR [rsp+first_local+2*SZPTR+4]
loopcount3 EQU DPTR [rsp+first_local+2*SZPTR+8]
loopcount4 EQU DPTR [rsp+first_local+2*SZPTR+12]
loopcount5 EQU DPTR [rsp+first_local+2*SZPTR+16]
; Base 2, irrational version, not zero-padded
PROCFL gwymuls3
ad_prolog 2*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6
mov rsi, DESTARG ; Address of destination
mov rbp, norm_grp_mults ; Addr of the group multipliers
mov rdi, norm_biglit_array ; Addr of the big/little flags array
vbroadcastsd ymm6, DBLARG ; Load small multiplier value
vmovapd ymm2, YMM_BIGVAL ; Init 2 carry registers
vmovapd ymm3, ymm2
;; Loop over all pass 1 blocks
mov eax, count3 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
mblk0: mov eax, count2 ; Load wpn count
mov loopcount2, eax ; Save count
mblk1:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_biglit, rdi
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
mul0: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
mul1: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
mul2: ynorm_smallmul_wpn exec, exec ; Multiply and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
bump rdi, 2 ; Next flags ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc mul2
sub rsi, pass1blkdst ; Adjust source pointers
bump rsi, 64
sub loopcount5, 4 ; Loop clm times
jnz mul2
add rdi, normval2 ; Adjust ptr to little/big flags
dec loopcount4 ; Loop until 4KB processed
jnz mul1 ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz mul0
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore dest start of block ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
ynorm_smallmul_wpn_blk exec, exec ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdi, normval3 ; Next little/big flags ptr
dec loopcount2 ; Test wpn_count
jnz mblk1
bump rbp, 2*YMM_GMD ; Next set of group multipliers
dec loopcount1 ; Decrement outer loop counter
jnz mblk0 ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
mov rbp, norm_grp_mults ; Group ttp ptr
mov rdi, norm_biglit_array ; Addr of the big/little flags array
ynorm_smallmul_wpn_final exec, exec ; Add last 2 carries to start of destination
ad_epilog 2*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6
gwymuls3 ENDP
; Base 2, rational version, not zero-padded
PROCFL gwymulsr3
ad_prolog 2*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6
mov rsi, DESTARG ; Address of destination
vbroadcastsd ymm6, DBLARG ; Load small multiplier value
vmovapd ymm2, YMM_BIGVAL ; Init 2 carry registers
vmovapd ymm3, ymm2
;; Loop over all pass 1 blocks
mov eax, addcount1 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
mblk0r:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
mul0r: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
mul1r: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
mul2r: ynorm_smallmul_wpn noexec, exec ; Multiply and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc mul2r
sub rsi, pass1blkdst ; Adjust source pointers
bump rsi, 64
sub loopcount5, 4 ; Loop clm times
jnz mul2r
dec loopcount4 ; Loop until 4KB processed
jnz mul1r ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz mul0r
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore dest start of block ptr
ynorm_smallmul_wpn_blk noexec, exec ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
add rsi, pass1blkdst ; Next source pointer
dec loopcount1 ; Decrement outer loop counter
jnz mblk0r ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
ynorm_smallmul_wpn_final noexec, exec ; Add last 2 carries to start of destination
ad_epilog 2*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6
gwymulsr3 ENDP
; Not base 2, irrational version, not zero-padded
PROCFL gwymulsn3
ad_prolog 2*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6
mov rsi, DESTARG ; Address of destination
mov rbp, norm_grp_mults ; Addr of the group multipliers
mov rdi, norm_biglit_array ; Addr of the big/little flags array
vbroadcastsd ymm6, DBLARG ; Load small multiplier value
vxorpd ymm2, ymm2, ymm2 ; Init 2 carry registers
vxorpd ymm3, ymm3, ymm3
;; Loop over all pass 1 blocks
mov eax, count3 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
mblk0n: mov eax, count2 ; Load wpn count
mov loopcount2, eax ; Save count
mblk1n:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_biglit, rdi
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
mul0n: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
mul1n: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
mul2n: ynorm_smallmul_wpn exec, noexec ; Multiply and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
bump rdi, 2 ; Next flags ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc mul2n
sub rsi, pass1blkdst ; Adjust source pointers
bump rsi, 64
sub loopcount5, 4 ; Loop clm times
jnz mul2n
add rdi, normval2 ; Adjust ptr to little/big flags
dec loopcount4 ; Loop until 4KB processed
jnz mul1n ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz mul0n
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore dest start of block ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
ynorm_smallmul_wpn_blk exec, noexec ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdi, normval3 ; Next little/big flags ptr
dec loopcount2 ; Test wpn_count
jnz mblk1n
bump rbp, 2*YMM_GMD ; Next set of group multipliers
dec loopcount1 ; Decrement outer loop counter
jnz mblk0n ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
mov rbp, norm_grp_mults ; Group ttp ptr
mov rdi, norm_biglit_array ; Addr of the big/little flags array
ynorm_smallmul_wpn_final exec, noexec ; Add last 2 carries to start of destination
ad_epilog 2*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6
gwymulsn3 ENDP
; Not base 2, rational version, not zero-padded
PROCFL gwymulsnr3
ad_prolog 2*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6
mov rsi, DESTARG ; Address of destination
vbroadcastsd ymm6, DBLARG ; Load small multiplier value
vxorpd ymm2, ymm2, ymm2 ; Init 2 carry registers
vxorpd ymm3, ymm3, ymm3
;; Loop over all pass 1 blocks
mov eax, addcount1 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
mblk0nr:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
mul0nr: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
mul1nr: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
mul2nr: ynorm_smallmul_wpn noexec, noexec ; Multiply and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc mul2nr
sub rsi, pass1blkdst ; Adjust source pointers
bump rsi, 64
sub loopcount5, 4 ; Loop clm times
jnz mul2nr
dec loopcount4 ; Loop until 4KB processed
jnz mul1nr ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz mul0nr
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore dest start of block ptr
ynorm_smallmul_wpn_blk noexec, noexec ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
add rsi, pass1blkdst ; Next source pointer
dec loopcount1 ; Decrement outer loop counter
jnz mblk0nr ; Loop til done
;; All blocks done, propagate wraparound carries
mov rsi, DESTARG ; Address of destination
ynorm_smallmul_wpn_final noexec, noexec ; Add last 2 carries to start of destination
ad_epilog 2*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6
gwymulsnr3 ENDP
; Base 2, irrational version, zero-padded
PROCFL gwymulszp3
ad_prolog 2*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6
mov rsi, DESTARG ; Address of destination
mov rbp, norm_grp_mults ; Addr of the group multipliers
mov rdi, norm_biglit_array ; Addr of the big/little flags array
vbroadcastsd ymm6, DBLARG ; Load small multiplier value
vmovapd ymm2, YMM_BIGVAL ; Init 2 carry registers
vmovapd ymm3, ymm2
;; Loop over all pass 1 blocks
mov eax, count3 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
mblk0zp: mov eax, count2 ; Load wpn count
mov loopcount2, eax ; Save count
mblk1zp:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_biglit, rdi
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
mul0zp: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
mul1zp: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
mul2zp: ynorm_smallmul_wpn_zpad exec, exec ; Multiply and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
bump rdi, 2 ; Next flags ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc mul2zp
sub rsi, pass1blkdst ; Adjust source pointers
bump rsi, 64
sub loopcount5, 4 ; Loop clm times
jnz mul2zp
add rdi, normval2 ; Adjust ptr to little/big flags
dec loopcount4 ; Loop until 4KB processed
jnz mul1zp ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz mul0zp
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore dest start of block ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
ynorm_smallmul_wpn_zpad_blk exec, exec ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdi, normval3 ; Next little/big flags ptr
dec loopcount2 ; Test wpn_count
jnz mblk1zp
bump rbp, YMM_GMD ; Next set of group multipliers
dec loopcount1 ; Decrement outer loop counter
jnz mblk0zp ; Loop til done
;; All blocks done, propagate wraparound carries
ynorm_smallmul_wpn_zpad_final exec, exec, DESTARG ; Add last 2 carries to start of destination
ad_epilog 2*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6
gwymulszp3 ENDP
; Base 2, rational version, zero-padded
PROCFL gwymulsrzp3
ad_prolog 2*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6
mov rsi, DESTARG ; Address of destination
vbroadcastsd ymm6, DBLARG ; Load small multiplier value
vmovapd ymm2, YMM_BIGVAL ; Init 2 carry registers
vmovapd ymm3, ymm2
;; Loop over all pass 1 blocks
mov eax, addcount1 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
mblk0rzp:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
mul0rzp: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
mul1rzp: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
mul2rzp: ynorm_smallmul_wpn_zpad noexec, exec ; Multiply and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc mul2rzp
sub rsi, pass1blkdst ; Adjust source pointers
bump rsi, 64
sub loopcount5, 4 ; Loop clm times
jnz mul2rzp
dec loopcount4 ; Loop until 4KB processed
jnz mul1rzp ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz mul0rzp
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore dest start of block ptr
ynorm_smallmul_wpn_zpad_blk noexec, exec ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
add rsi, pass1blkdst ; Next source pointer
dec loopcount1 ; Decrement outer loop counter
jnz mblk0rzp ; Loop til done
;; All blocks done, propagate wraparound carries
ynorm_smallmul_wpn_zpad_final noexec, exec, DESTARG ; Add last 2 carries to start of destination
ad_epilog 2*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6
gwymulsrzp3 ENDP
; Non base 2, irrational version, zero-padded
PROCFL gwymulsnzp3
ad_prolog 2*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6
mov rsi, DESTARG ; Address of destination
mov rbp, norm_grp_mults ; Addr of the group multipliers
mov rdi, norm_biglit_array ; Addr of the big/little flags array
vbroadcastsd ymm6, DBLARG ; Load small multiplier value
vxorpd ymm2, ymm2, ymm2 ; Init 2 carry registers
vxorpd ymm3, ymm3, ymm3
;; Loop over all pass 1 blocks
mov eax, count3 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
mblk0nzp: mov eax, count2 ; Load wpn count
mov loopcount2, eax ; Save count
mblk1nzp:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov saved_biglit, rdi
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
mul0nzp: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
mul1nzp: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
mul2nzp: ynorm_smallmul_wpn_zpad exec, noexec ; Multiply and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
bump rdi, 2 ; Next flags ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc mul2nzp
sub rsi, pass1blkdst ; Adjust source pointers
bump rsi, 64
sub loopcount5, 4 ; Loop clm times
jnz mul2nzp
add rdi, normval2 ; Adjust ptr to little/big flags
dec loopcount4 ; Loop until 4KB processed
jnz mul1nzp ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz mul0nzp
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore dest start of block ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
ynorm_smallmul_wpn_zpad_blk exec, noexec ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
mov rdi, saved_biglit ; Restore biglit start of block ptr
add rsi, pass1blkdst ; Next source pointer
add rdi, normval3 ; Next little/big flags ptr
dec loopcount2 ; Test wpn_count
jnz mblk1nzp
bump rbp, YMM_GMD ; Next set of group multipliers
dec loopcount1 ; Decrement outer loop counter
jnz mblk0nzp ; Loop til done
;; All blocks done, propagate wraparound carries
ynorm_smallmul_wpn_zpad_final exec, noexec, DESTARG ; Add last 2 carries to start of destination
ad_epilog 2*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6
gwymulsnzp3 ENDP
; Non base 2, rational version, zero-padded
PROCFL gwymulsnrzp3
ad_prolog 2*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6
mov rsi, DESTARG ; Address of destination
vbroadcastsd ymm6, DBLARG ; Load small multiplier value
vxorpd ymm2, ymm2, ymm2 ; Init 2 carry registers
vxorpd ymm3, ymm3, ymm3
;; Loop over all pass 1 blocks
mov eax, addcount1 ; Load count of grp multipliers
mov loopcount1, eax ; Save count
mblk0nrzp:
;; Do a pass 1 block
mov saved_src1, rsi ; Remember pointers at the start of the pass 1 block
mov eax, normval4 ; Load count of 4KB chunks in a pass 2 block
mov loopcount3, eax
mul0nrzp: mov eax, normval1 ; Load count of clms in 4KB
mov loopcount4, eax
mul1nrzp: mov eax, cache_line_multiplier ; Load inner loop count
mov loopcount5, eax ; Save inner loop count
mul2nrzp: ynorm_smallmul_wpn_zpad noexec, noexec ; Multiply and normalize 8 values
add rsi, pass2blkdst ; Next src ptr
add BYTE PTR loopcount5, 256/4 ; Loop 4 times (4 pass 2 blocks in each pass 1 block)
jnc mul2nrzp
sub rsi, pass1blkdst ; Adjust source pointers
bump rsi, 64
sub loopcount5, 4 ; Loop clm times
jnz mul2nrzp
dec loopcount4 ; Loop until 4KB processed
jnz mul1nrzp ; Loop til done
add rsi, fourKBgapsize ; Skip 64 to 192 bytes every 4KB
dec loopcount3 ; Loop until pass 1 block completed
jnz mul0nrzp
;; Pass 1 block done, propagate carries
mov rsi, saved_src1 ; Restore dest start of block ptr
ynorm_smallmul_wpn_zpad_blk noexec, noexec ; Add 2 carries to start of block
mov rsi, saved_src1 ; Restore src1 start of block ptr
add rsi, pass1blkdst ; Next source pointer
dec loopcount1 ; Decrement outer loop counter
jnz mblk0nrzp ; Loop til done
;; All blocks done, propagate wraparound carries
ynorm_smallmul_wpn_zpad_final noexec, noexec, DESTARG ; Add last 2 carries to start of destination
ad_epilog 2*SZPTR+20,0,rbx,rbp,rsi,rdi,xmm6
gwymulsnrzp3 ENDP
_TEXT ENDS
END
| 36.809939 | 105 | 0.741505 |
90cd4b13ddce8ee37faa5ea0cade5b0ef44e5fe4 | 5,814 | asm | Assembly | boot/boot.asm | cambridgejames/CP-JOS | 71b431d96278978e01632e142f6022cff5f19651 | [
"MIT"
] | null | null | null | boot/boot.asm | cambridgejames/CP-JOS | 71b431d96278978e01632e142f6022cff5f19651 | [
"MIT"
] | null | null | null | boot/boot.asm | cambridgejames/CP-JOS | 71b431d96278978e01632e142f6022cff5f19651 | [
"MIT"
] | null | null | null | ; --------------------------------------------------------------
; 作者:彭剑桥
; 创建时间:2019-09-10 20:08 Feb.
; 编辑环境: OS: Deepin 15.9.1 unstable
; Kernel: x86_64 Linux 4.15.0-29deepin-generic
; 功能:操作系统引导程序,用来在磁盘中寻找内核加载程序并将其载入内存,然后
; 将系统控制权转交给内核加载程序。
; --------------------------------------------------------------
;%define _BOOT_DEBUG_ ; 该语句用来将程序编译为COM文件
; 当需要编译为bin文件时要将此句注释掉
%ifdef _BOOT_DEBUG_
org 0100h
%else
org 07c00h
%endif
; --------------------------------------------------------------
; 以下是宏定义
; --------------------------------------------------------------
%ifdef _BOOT_DEBUG_ ; 定义堆栈的基地址
BaseOfStack equ 0100h
%else
BaseOfStack equ 07c00h
%endif
BaseOfLoader equ 09000h ; 定义内核加载程序 LOADER.BIN 被加载到的段基址
OffsetOfLoader equ 0100h ; 定义内核加载程序 LOADER.BIN 被加载到的偏移地址
; --------------------------------------------------------------
; 以下是引导扇区头部必须存在的短跳转指令
; --------------------------------------------------------------
jmp short LABEL_START ; 开始引导
nop
; 在此处引入 FAT12 磁盘头信息,方便操作系统识别
%include "fat12bpb.inc"
; --------------------------------------------------------------
; 以下是程序主体
; --------------------------------------------------------------
LABEL_START:
mov ax, cs
mov ds, ax
mov es, ax
; 初始化堆栈
mov ss, ax
mov sp, BaseOfStack
; 复位软盘驱动器:AH=00h,DL=驱动器号
mov ah, 0x00
mov dl, [BS_DrvNum]
int 13h
; 输出正在引导的提示
mov ax, BootingMsg
mov cx, BootingLen
call DispStr
mov word [wSectorNo], SecNoOfRootDir
LABEL_SEARCH_IN_ROOT:
; 功能:从根目录读一个扇区,并判断还有没有扇区可读
cmp word [wRootDirSize], 0 ; 判断根目录是否已经读完
jz LABEL_NO_LOADER ; 仍未找到加载程序但已读完,跳转
dec word [wRootDirSize] ; 将未读扇区数减一,准备读扇区
mov ax, BaseOfLoader
mov es, ax ; 设置内核加载程序的目标段
mov bx, OffsetOfLoader
mov ax, [wSectorNo] ; ax 存储接下来要读取的扇区号
mov cl, 1 ; cl 存储要读取的扇区的个数
call ReadSector ; 调用 ReadSector 函数读取软盘
mov si, LoaderFileName ; ds:si 是要寻找的文件名的首地址
mov di, OffsetOfLoader ; es:di 是扇区加载的目标位置
cld
mov dx, 10h ; 每扇区最多包含16个文件头信息,所以最多循环16次
LABEL_SEARCH_HOLE_SECTOR:
; 功能:在整个扇区中逐个查找文件名是否为“LOADER BIN”
cmp dx, 0 ; 如果当前扇区还剩下 0 个文件头没有读
jz LABEL_NEXT_SECTOR ; 就准备读取下一个扇区
dec dx ; 否则将未读文件数减 1
mov cx, 11 ; 文件名和扩展名共 11 字节
LABEL_CMP_FILENAME:
; 功能:在当前的文件头信息中逐个字节对比文件名,若有一个字节不一致则跳出循环
cmp cx, 0 ; 判断文件名是否已经比较完了
jz LABEL_FIND_LOADER ; 若比较完了还未跳出说明找到了目标文件
dec cx ; 否则剩余字节数减 1
lodsb ; 将 ds:si 所指向的一字节拷入 al
cmp al, byte [es:di] ; 比较当前字节是否一致,相同则 ZF 置0
jnz LABEL_DIFFERENT ; 若不相同则跳出当前字符比较循环
inc di ; 若相同则准备比较下一个字符
jmp LABEL_CMP_FILENAME ; 比较下一个字符
LABEL_DIFFERENT:
; 功能:在文件名比较失败时执行,用于准备下一个文件名来进行比较
and di, 0ffe0h ; 将后五位清零,使 di 指向当前项的开头
add di, 20h ; 使 di 指向下一个文件头信息的开头
mov si, LoaderFileName ; 将 si 指回目标文件名的首地址
jmp LABEL_SEARCH_HOLE_SECTOR ; 准备对比下一个文件项
LABEL_NEXT_SECTOR:
; 功能:将即将读取的扇区号加一,然后准备读取下一个扇区
add word [wSectorNo], 1 ; 将即将读取的扇区号加一
jmp LABEL_SEARCH_IN_ROOT ; 准备重新读取一个新的扇区
LABEL_NO_LOADER:
; 功能: 没有找到lodaer.bin时执行的操作
mov ax, NoFileMsg
mov cx, NoFileLen
call DispStr
jmp LABEL_PAULSE
LABEL_PAULSE:
; 功能: 等待指令,或重新引导
jmp $
LABEL_FIND_LOADER:
; 功能: 找到lodaer.bin时执行的操作
mov ax, FileFondMsg
mov cx, FileFondLen
call DispStr
jmp LABEL_PAULSE
; --------------------------------------------------------------
; 以下是变量和字符串定义
; --------------------------------------------------------------
; 变量定义
wRootDirSize dw RootDirSectors ; 根目录中的未读扇区数
wSectorNo dw 0 ; 即将读取的扇区号
bOdd db 0 ; 簇号是否为奇数
bRowIndex db 0 ; 下一个字符需要显示的行号
; 字符串定义
LoaderFileName db 'LOADER BIN' ; 内核加载程序的文件名,占11字节
BootingMsg: db 'System booting...'
BootingLen: equ $-BootingMsg
FileFondMsg: db 'Kernel loader has been found.'
FileFondLen: equ $-FileFondMsg
NoFileMsg: db "There's no kernel loader."
NoFileLen: equ $-NoFileMsg
; --------------------------------------------------------------
; 以下是函数定义
; --------------------------------------------------------------
DispStr:
; --------------------------------------------------------------
; 功能:显示以 ax 为首地址的长度为 cx 的字符串,然后换行
; --------------------------------------------------------------
; 在当前位置显示字符
mov bp, ax
mov ax, ds
mov es, ax
mov ax, 01301h
mov bx, 0007h
mov dh, [bRowIndex] ; 设置行号
mov dl, 0 ; 设置光标在第0列(最左侧)
int 10h
add byte [bRowIndex], 1
ret
; -- END OF FUNCTION 'DispStr' --
ReadSector:
; --------------------------------------------------------------
; 功能:将从第 ax 个 Sector 开始的 cl 个 Sector 读入 es:bx 中
; 原理:
; 设扇区号为 x,则可通过下面的方法计算出柱面号、起始扇区和磁头号:
; ┌ 柱面号 = y >> 1
; x ┌ 商 y ┤
; -------------- => ┤ └ 磁头号 = y & 1
; 每磁道扇区数 │
; └ 余 z => 起始扇区号 = z + 1
; 注释:之所以使用 ax 存储开始的扇区号,是因为 div 指令的被除数必须保存在
; eax 寄存器中,这样做可以减少指令数。
; --------------------------------------------------------------
push bp
mov bp, sp
sub esp, 2 ; 将 byte [bp-2] 处的两字节用来存放需要读取的扇区数
mov byte [bp - 2], cl ; 将传入的扇区数存入堆栈
; 下面开始计算柱面号、起始扇区和磁头号
push bx ; 保存 bx ,因为接下来要使用 bl 进行除法运算
mov bl, [BPB_SecPerTrk] ; bl 为每磁道的扇区数(在BPB中定义)
div bl ; 由于 bl 只有八位,所以商 y 在 al 中,余数 z 在 ah 中
inc ah ; ah = z + 1,得到起始扇区号
mov dh, al
shr al, 1 ; 计算 al >> 1,得到柱面号
and dh, 1 ; 计算 dh & 1,得到磁头号
pop bx ; 恢复 bx 的值
; 下面将得到的值送入 13h 号中断所要求的寄存器中,并开始读取内容
mov ch, al ; ch <- 柱面(磁道)号
mov cl, ah ; cl <- 起始扇区号
mov dl, [BS_DrvNum] ; dl <- 驱动器号(在BPB中定义)
.DoReadSector:
mov ah, 2 ; 设置读模式
mov al, byte [bp - 2] ; 设置需要读取的扇区数
int 13h
jc .DoReadSector ; ruo读取错误则 CF 会被置1,只需不停地读,直到正确为止
; 函数结束
add esp, 2
pop bp
ret
; -- END OF FUNCTION 'ReadSector' --
; 将引导扇区的剩余空间填充为0x00,并将最后两字节设为0xAA55
times 510-($-$$) db 0
dw 0xaa55
| 26.792627 | 65 | 0.528724 |
c9d9ee80678c439b80872b9653fb413cd94327bb | 4,116 | asm | Assembly | Driver/Printer/PrintCom/printcomTables.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 504 | 2018-11-18T03:35:53.000Z | 2022-03-29T01:02:51.000Z | Driver/Printer/PrintCom/printcomTables.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 96 | 2018-11-19T21:06:50.000Z | 2022-03-06T10:26:48.000Z | Driver/Printer/PrintCom/printcomTables.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 73 | 2018-11-19T20:46:53.000Z | 2022-03-29T00:59:26.000Z |
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1990 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Common print driver tables
FILE: printcom9Tables.asm
AUTHOR: Jim DeFrisco, 1 March 1990
REVISION HISTORY:
Name Date Description
---- ---- -----------
Jim 3/1/90 Initial revision
Dave 3/92 initial 2.0 version.
DESCRIPTION:
This file contains printer jump tables. The escape jump tables
are in the printer - specific tables files.
$Id: printcomTables.asm,v 1.1 97/04/18 11:50:10 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
;--------------------------------------------------------------------------
; Routines found in Entry module (FIXED)
;--------------------------------------------------------------------------
residentJumpTable label word
word offset PrintInit ; in xxxAdmin.asm
word offset PrintExit ; in xxxAdmin.asm
word offset PrintSuspend ; in printcomEntry.asm
word offset PrintUnsuspend ; in printcomEntry.asm
word offset PrintTestDevice ; in printcomInfo.asm
word offset PrintSetDevice ; in printcomInfo.asm
word offset PrintGetDriverInfo ; in printcomInfo.asm
word offset PrintDeviceInfo ; in printcomInfo.asm
word offset PrintSetMode ; in printcomInfo.asm
word offset PrintSetStream ; in printcomInfo.asm
word offset PrintHomeCursor ; in printcomInfo.asm
;--------------------------------------------------------------------------
; Routines found in CommonCode module
;--------------------------------------------------------------------------
modHanJumpTable hptr \
handle PrintGetCursor, ; DR_PRINT_GET_CURSOR
handle PrintSetCursor, ; DR_PRINT_SET_CURSOR
handle PrintGetLineSpacing, ; DR_PRINT_GET_LINE_SPACING
handle PrintSetLineSpacing, ; DR_PRINT_SET_LINE_SPACING
handle PrintSetFont, ; DR_PRINT_SET_FONT
handle PrintGetColorFormat, ; DR_PRINT_GET_COLOR_FORMAT
handle PrintSetColor, ; DR_PRINT_SET_COLOR
handle PrintGetStyles, ; DR_PRINT_GET_STYLES
handle PrintSetStyles, ; DR_PRINT_SET_STYLES
handle PrintTestStyles, ; DR_PRINT_TEST_STYLES
handle PrintText, ; DR_PRINT_TEXT
handle PrintRaw, ; DR_PRINT_RAW
handle PrintStyleRun, ; DR_PRINT_STYLE_RUN
handle PrintSwath, ; DR_PRINT_SWATH
handle PrintStartPage, ; DR_PRINT_START_PAGE
handle PrintEndPage, ; DR_PRINT_END_PAGE
handle PrintGetPrintArea, ; DR_PRINT_GET_PRINT_AREA
handle PrintGetMargins, ; DR_PRINT_GET_MARGINS
handle PrintGetPaperPath, ; DR_PRINT_GET_PAPER_PATH
handle PrintSetPaperPath, ; DR_PRINT_SET_PAPER_PATH
handle PrintStartJob, ; DR_PRINT_START_JOB
handle PrintEndJob, ; DR_PRINT_END_JOB
handle PrintGetMainUI, ; DR_PRINT_GET_MAIN_UI
handle PrintGetOptionsUI, ; DR_PRINT_GET_OPTIONS_UI
handle PrintEvalUI, ; DR_PRINT_EVAL_UI
handle PrintStuffUI ; DR_PRINT_STUFF_UI
modOffJumpTable nptr \
offset PrintGetCursor,
offset PrintSetCursor,
offset PrintGetLineSpacing ,
offset PrintSetLineSpacing,
offset PrintSetFont,
offset PrintGetColorFormat,
offset PrintSetColor,
offset PrintGetStyles ,
offset PrintSetStyles,
offset PrintTestStyles,
offset PrintText,
offset PrintRaw,
offset PrintStyleRun,
offset PrintSwath,
offset PrintStartPage,
offset PrintEndPage,
offset PrintGetPrintArea,
offset PrintGetMargins,
offset PrintGetPaperPath,
offset PrintSetPaperPath,
offset PrintStartJob,
offset PrintEndJob,
offset PrintGetMainUI,
offset PrintGetOptionsUI,
offset PrintEvalUI,
offset PrintStuffUI
.assert length modOffJumpTable eq length modHanJumpTable
| 35.179487 | 79 | 0.609086 |
9cfbed2949fc561042f416431c2dde0573930d94 | 379 | asm | Assembly | 7_kyu/Triangular_Treasure.asm | UlrichBerntien/Codewars-Katas | bbd025e67aa352d313564d3862db19fffa39f552 | [
"MIT"
] | null | null | null | 7_kyu/Triangular_Treasure.asm | UlrichBerntien/Codewars-Katas | bbd025e67aa352d313564d3862db19fffa39f552 | [
"MIT"
] | null | null | null | 7_kyu/Triangular_Treasure.asm | UlrichBerntien/Codewars-Katas | bbd025e67aa352d313564d3862db19fffa39f552 | [
"MIT"
] | null | null | null | section .text
global triangular
; int triangular(int n);
; n --> edi, result --> eax
triangular:
xor eax, eax ; eax = 0, error return value
test edi, edi
js .error ; error case: return 0
mov eax, edi ; eax = n
inc edi ; edi = n-1
xor rdx, rdx
mul edi ; edx:eax = (n-1)*n
sar eax, 1 ; return (n-1)*n/2
.error:
ret
| 22.294118 | 49 | 0.532982 |
bf5d2e5a567ee01791642784e3c39d101317f34b | 601 | asm | Assembly | oeis/191/A191528.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/191/A191528.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/191/A191528.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A191528: Triangle read by rows: T(n,k) is the number of left factors of Dyck paths of length n that have k returns to the axis.
; Submitted by Jon Maiga
; 1,1,1,1,2,1,3,2,1,6,3,1,10,6,3,1,20,10,4,1,35,20,10,4,1,70,35,15,5,1,126,70,35,15,5,1,252,126,56,21,6,1,462,252,126,56,21,6,1,924,462,210,84,28,7,1,1716,924,462,210,84,28,7,1,3432,1716,792,330,120,36,8,1,6435,3432,1716,792,330,120,36,8,1,12870,6435,3003,1287,495,165,45,9,1,24310,12870,6435,3003,1287,495,165,45,9,1
lpb $0
add $1,$2
sub $0,$1
cmp $2,0
sub $0,$2
lpe
sub $2,$0
add $2,$1
sub $2,1
add $0,$2
add $1,$2
bin $1,$0
mov $0,$1
| 33.388889 | 317 | 0.655574 |
f1538b08d21929a96ff79eaf9f9848a7aec6c0ce | 3,425 | asm | Assembly | src/binData.asm | LessNick/CLi-for-WildCommander | 9b3267278f89ff08b52d8ad8dfceb34af3f8fdcb | [
"BSD-2-Clause"
] | 8 | 2016-10-22T19:38:38.000Z | 2021-08-22T12:53:28.000Z | src/binData.asm | LessNick/CLi-for-WildCommander | 9b3267278f89ff08b52d8ad8dfceb34af3f8fdcb | [
"BSD-2-Clause"
] | null | null | null | src/binData.asm | LessNick/CLi-for-WildCommander | 9b3267278f89ff08b52d8ad8dfceb34af3f8fdcb | [
"BSD-2-Clause"
] | 2 | 2019-04-28T16:12:08.000Z | 2020-04-14T13:15:06.000Z | ;---------------------------------------------
; Binary Data
;---------------------------------------------
rootPath db "/",#00
binPath db "/bin",#00
fontsPath db "/fonts",#00
libsPath db "/libs",#00
localePath db "/locale",#00
systemPath db "/system",#00
cdBinPath db "/bin/"
cibPath db " "
cibFile ds 8,0
db #00
entry ds 32
extSh db "SH "
extSpace db " "
currentVMode db %11000010 ; включение видео режима (разрешение+тип)
; i:A' - видео режим
; [7-6]: %00 - 256x192
; %01 - 320x200
; %10 - 320x240
; %11 - 360x288
; [5-2]: %0000
; [1-0]: %00 - ZX
; %01 - 16c
; %10 - 256c
; %11 - txt
callBackApp dw callBackRet
callBackRet db 201 ; RET
progressWPos db #00
progressWData dw waitStep_01,waitStep_02,waitStep_03,waitStep_04
dw #0000
tabSize equ #08 ; tab size
tabTable db tabSize*0, tabSize*1, tabSize*2, tabSize*3, tabSize*4
db tabSize*5, tabSize*6, tabSize*7, tabSize*8, tabSize*9
codeBuff db " ",#00
fileLength dw #0000,#0000
storeKey db #00
iBufferPos db #00
iBuffer ds iBufferSize,#00
curColor db defaultCol ; paper | ink
;curEColor db defaultCol ; paper | ink
curGfxBorder db #00 ; graphics mode border color
zxPal dw #0000,#0010,#4000,#4010
dw #0200,#0210,#4200,#4210
dw #0000,#0018,#6000,#6018
dw #0300,#0318,#6300,#6318
; rR gG bB
; RRrrrGGgggBBbbb
cliPal dw %0000000000000000 ; 0.black
dw %0000000000010000 ; 1.navy
; dw %0100000000000000 ; 2.maroon
dw %0110000100010000 ; 2.amiga pink
; dw %0100000000010000 ; 3.purple
dw %0110001000011000 ; 3.light violet
dw %0000001000000000 ; 4.green
; dw %0000001000010000 ; 5.teal
dw %0000000100010000 ; 5.dark teal
; dw %0100001000000000 ; 6.olive
dw %0110000100000000 ; 6.orange
dw %0110001000010000 ; 7.light beige
; rR gG bB
; RRrrrGGgggBBbbb
; dw %0010000100001000 ; 8.gray
dw %0100001000010000 ; 8.silver
dw %0000000000011000 ; 9.blue
dw %0110000000000000 ;10.red
;dw %0100000000010000 ;11.fuchsia
dw %0110000100001000 ;11.dark pink
dw %0000001100000000 ;12.lime
; dw %0000001100011000 ;13.aqua
dw %0000001000011000 ;13.teal
;dw %0110001100000000 ;14.yellow
dw %0110001100010000 ;14.light yellow
dw %0110001100011000 ;15.white
nameEmpty db " "
fileOneLine db 16,15," "
db 16,15," "
db 16,15," "
db 16,15," "
db 16,15," "
db 16,15," "
db #0d,#00 ; end
helpOneLine db " "
db " "
db " "
db " "
db " "
db " "
db #0d,#00 ; end
entryForSearch ds 255,#00
rootSearch db flagDir,".",#00
curAnimPos db #00
curAnim db 14,15 ; timeout,color
db 5,8 ; timeout,color
db 7,5 ; timeout,color
db 5,8 ; timeout,color
db #00
hCount db #00
historyPos db #00
cliHistory DUP historySize
ds iBufferSize, #00
EDUP
pathStrPos dw #0000
pathString ds pathStrSize,#00
db #00
pathBString ds pathStrSize,#00
db #00
pathCString ds pathStrSize,#00
db #00
pathHomeString ds pathStrSize,#00
db #00
echoBuffer ds eBufferSize, #00
| 24.29078 | 70 | 0.559708 |
35825be69c42339afa1f65461be629b52c53e277 | 5,177 | asm | Assembly | tests/gbcpu.asm | dimitrit/uz80as | b4fd490c9ce89ac30c5b130d951a1ed4288233d0 | [
"MIT"
] | 8 | 2017-05-03T10:49:20.000Z | 2022-02-03T02:55:21.000Z | tests/gbcpu.asm | vipoo/uz80as | 7cf5c353a5c1ceeaf5ba7b502e220fb41e7d9fb0 | [
"MIT"
] | 1 | 2020-02-25T06:28:30.000Z | 2020-03-30T17:09:50.000Z | tests/gbcpu.asm | vipoo/uz80as | 7cf5c353a5c1ceeaf5ba7b502e220fb41e7d9fb0 | [
"MIT"
] | 2 | 2020-02-26T21:12:55.000Z | 2022-02-02T17:51:03.000Z | ; ===========================================================================
; uz80as, an assembler for the Zilog Z80 and several other microprocessors.
;
; Sharp LR25902 (Nintendo Gameboy CPU).
; ===========================================================================
#define equ .equ
#define end .end
n: equ 20h
nn: equ 0584h
dddd: equ 07h
a16: equ $1234
hi8: equ $ff11
port: equ 3
imm8: equ 56h ;immediate data (8 bits)
offset: equ 7
offset_neg: equ -7
; 0x
NOP
LD BC,nn
LD (BC),A
INC BC
INC B
DEC B
LD B,n
RLCA
LD (nn),SP
ADD HL,BC
LD A,(BC)
DEC BC
INC C
DEC C
LD C,n
RRCA
; 1x
STOP
LD DE,nn
LD (DE),A
INC DE
INC D
DEC D
LD D,n
RLA
loop1: JR loop1
ADD HL,DE
LD A,(DE)
DEC DE
INC E
DEC E
LD E,n
RRA
; 2x
loop2: JR NZ,loop2
LD HL,nn
LD (HLI),A
INC HL
INC H
DEC H
LD H,n
DAA
loop3: JR Z,loop3
ADD HL,HL
LD A,(HLI)
DEC HL
INC L
DEC L
LD L,n
CPL
; 3x
loop4: JR NC,loop4
LD SP,nn
LD (HLD),A
INC SP
INC (HL)
DEC (HL)
LD (HL),n
SCF
loop5: JR C,loop5
ADD HL,SP
LD A,(HLD)
DEC SP
INC A
DEC A
LD A,n
CCF
; 4x
LD B,B
LD B,C
LD B,D
LD B,E
LD B,H
LD B,L
LD B,(HL)
LD B,A
LD C,B
LD C,C
LD C,D
LD C,E
LD C,H
LD C,L
LD C,(HL)
LD C,A
; 5x
LD D,B
LD D,C
LD D,D
LD D,E
LD D,H
LD D,L
LD D,(HL)
LD D,A
LD E,B
LD E,C
LD E,D
LD E,E
LD E,H
LD E,L
LD E,(HL)
LD E,A
; 6x
LD H,B
LD H,C
LD H,D
LD H,E
LD H,H
LD H,L
LD H,(HL)
LD H,A
LD L,B
LD L,C
LD L,D
LD L,E
LD L,H
LD L,L
LD L,(HL)
LD L,A
; 7X
LD (HL),B
LD (HL),C
LD (HL),D
LD (HL),E
LD (HL),H
LD (HL),L
HALT
LD (HL),A
LD A,B
LD A,C
LD A,D
LD A,E
LD A,H
LD A,L
LD A,(HL)
LD A,A
; 8x
ADD A,B
ADD A,C
ADD A,D
ADD A,E
ADD A,H
ADD A,L
ADD A,(HL)
ADD A,A
ADC A,B
ADC A,C
ADC A,D
ADC A,E
ADC A,H
ADC A,L
ADC A,(HL)
ADC A,A
; 9x
SUB B
SUB C
SUB D
SUB E
SUB H
SUB L
SUB (HL)
SUB A
SBC A,B
SBC A,C
SBC A,D
SBC A,E
SBC A,H
SBC A,L
SBC A,(HL)
SBC A,A
; Ax
AND B
AND C
AND D
AND E
AND H
AND L
AND (HL)
AND A
XOR B
XOR C
XOR D
XOR E
XOR H
XOR L
XOR (HL)
XOR A
; Bx
OR B
OR C
OR D
OR E
OR H
OR L
OR (HL)
OR A
CP B
CP C
CP D
CP E
CP H
CP L
CP (HL)
CP A
; Cx
RET NZ
POP BC
JP NZ,a16
JP a16
CALL NZ,a16
PUSH BC
ADD A,n
RST 00h
RET Z
RET
JP Z,a16
; CB prefix
CALL Z,a16
CALL a16
ADC A,n
RST 08h
; Dx
RET NC
POP DE
JP NC,a16
;
CALL NC,a16
PUSH DE
SUB n
RST 10h
RET C
RETI
JP C,a16
;
CALL C,a16
;
SBC A,n
RST 18h
; Ex
LD (hi8),A
POP HL
LD (C),A
;
;
PUSH HL
AND n
RST 20h
ADD SP,n
JP (HL)
LD (a16),A
;
;
;
XOR n
RST 28h
; Fx
LD A,(hi8)
POP AF
LD A,(C)
DI
;
PUSH AF
OR n
RST 30h
LDHL SP,n
LD SP,HL
LD A,(a16)
EI
;
;
CP n
RST 38h
; Prefix CB
; 0x
RLC B
RLC C
RLC D
RLC E
RLC H
RLC L
RLC (HL)
RLC A
RRC B
RRC C
RRC D
RRC E
RRC H
RRC L
RRC (HL)
RRC A
; 1x
RL B
RL C
RL D
RL E
RL H
RL L
RL (HL)
RL A
RR B
RR C
RR D
RR E
RR H
RR L
RR (HL)
RR A
; 2x
SLA B
SLA C
SLA D
SLA E
SLA H
SLA L
SLA (HL)
SLA A
SRA B
SRA C
SRA D
SRA E
SRA H
SRA L
SRA (HL)
SRA A
; 3x
SWAP B
SWAP C
SWAP D
SWAP E
SWAP H
SWAP L
SWAP (HL)
SWAP A
SRL B
SRL C
SRL D
SRL E
SRL H
SRL L
SRL (HL)
SRL A
; 4x
BIT 0,B
BIT 0,C
BIT 0,D
BIT 0,E
BIT 0,H
BIT 0,L
BIT 0,(HL)
BIT 0,A
BIT 1,B
BIT 1,C
BIT 1,D
BIT 1,E
BIT 1,H
BIT 1,L
BIT 1,(HL)
BIT 1,A
; 5x
BIT 2,B
BIT 2,C
BIT 2,D
BIT 2,E
BIT 2,H
BIT 2,L
BIT 2,(HL)
BIT 2,A
BIT 3,B
BIT 3,C
BIT 3,D
BIT 3,E
BIT 3,H
BIT 3,L
BIT 3,(HL)
BIT 3,A
; 6x
BIT 4,B
BIT 4,C
BIT 4,D
BIT 4,E
BIT 4,H
BIT 4,L
BIT 4,(HL)
BIT 4,A
BIT 5,B
BIT 5,C
BIT 5,D
BIT 5,E
BIT 5,H
BIT 5,L
BIT 5,(HL)
BIT 5,A
; 7x
BIT 6,B
BIT 6,C
BIT 6,D
BIT 6,E
BIT 6,H
BIT 6,L
BIT 6,(HL)
BIT 6,A
BIT 7,B
BIT 7,C
BIT 7,D
BIT 7,E
BIT 7,H
BIT 7,L
BIT 7,(HL)
BIT 7,A
; 8x
RES 0,B
RES 0,C
RES 0,D
RES 0,E
RES 0,H
RES 0,L
RES 0,(HL)
RES 0,A
RES 1,B
RES 1,C
RES 1,D
RES 1,E
RES 1,H
RES 1,L
RES 1,(HL)
RES 1,A
; 9x
RES 2,B
RES 2,C
RES 2,D
RES 2,E
RES 2,H
RES 2,L
RES 2,(HL)
RES 2,A
RES 3,B
RES 3,C
RES 3,D
RES 3,E
RES 3,H
RES 3,L
RES 3,(HL)
RES 3,A
; Ax
RES 4,B
RES 4,C
RES 4,D
RES 4,E
RES 4,H
RES 4,L
RES 4,(HL)
RES 4,A
RES 5,B
RES 5,C
RES 5,D
RES 5,E
RES 5,H
RES 5,L
RES 5,(HL)
RES 5,A
; Bx
RES 6,B
RES 6,C
RES 6,D
RES 6,E
RES 6,H
RES 6,L
RES 6,(HL)
RES 6,A
RES 7,B
RES 7,C
RES 7,D
RES 7,E
RES 7,H
RES 7,L
RES 7,(HL)
RES 7,A
; Cx
SET 0,B
SET 0,C
SET 0,D
SET 0,E
SET 0,H
SET 0,L
SET 0,(HL)
SET 0,A
SET 1,B
SET 1,C
SET 1,D
SET 1,E
SET 1,H
SET 1,L
SET 1,(HL)
SET 1,A
; Dx
SET 2,B
SET 2,C
SET 2,D
SET 2,E
SET 2,H
SET 2,L
SET 2,(HL)
SET 2,A
SET 3,B
SET 3,C
SET 3,D
SET 3,E
SET 3,H
SET 3,L
SET 3,(HL)
SET 3,A
; Ex
SET 4,B
SET 4,C
SET 4,D
SET 4,E
SET 4,H
SET 4,L
SET 4,(HL)
SET 4,A
SET 5,B
SET 5,C
SET 5,D
SET 5,E
SET 5,H
SET 5,L
SET 5,(HL)
SET 5,A
; Fx
SET 6,B
SET 6,C
SET 6,D
SET 6,E
SET 6,H
SET 6,L
SET 6,(HL)
SET 6,A
SET 7,B
SET 7,C
SET 7,D
SET 7,E
SET 7,H
SET 7,L
SET 7,(HL)
SET 7,A
end
| 8.191456 | 77 | 0.523083 |
a5f8430be1c64b6ebe3932ce6dd2c35fe46fd990 | 417 | asm | Assembly | libsrc/math/mbf64/c/sccz80/l_f64_swap.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/math/mbf64/c/sccz80/l_f64_swap.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/math/mbf64/c/sccz80/l_f64_swap.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
SECTION code_fp_mbf64
PUBLIC l_f64_swap
EXTERN ___mbf64_FA
; Swap two values around
; Stack: +0 defw return address
; +2 defw right hand LSW
; +4 defw right hand NLSW
; +6 defw right hand NMSW
; +8 defw right hand MSW
l_f64_swap:
ld hl,2
add hl,sp
ld de,___mbf64_FA
ld b,8
loop:
ld c,(hl)
ld a,(de)
ld (hl),a
ld a,c
ld (de),a
inc hl
inc de
djnz loop
ret
| 14.37931 | 32 | 0.611511 |
b2220613126e7b3f15be1d0c845d3833440fea1a | 3,854 | asm | Assembly | data/test_add_sub.asm | colinw7/C6502 | a79e573e3b16da0d895b18d0081716d9a76e4654 | [
"MIT"
] | null | null | null | data/test_add_sub.asm | colinw7/C6502 | a79e573e3b16da0d895b18d0081716d9a76e4654 | [
"MIT"
] | null | null | null | data/test_add_sub.asm | colinw7/C6502 | a79e573e3b16da0d895b18d0081716d9a76e4654 | [
"MIT"
] | null | null | null | ERROR:
DB 0
S1:
DB 0
S2:
DB 0
U1:
DB 0
U2:
DB 0
SP:
DB " ",0
ADCSTR:
DB "ADC ",0
SBCSTR:
DB "SBC ",0
; ------------------
ORG $100
; Demonstrate that the V flag works as described
;
; Returns with ERROR = 0 if the test passes, ERROR = 1 if the test fails
;
; Five (additional) memory locations are used: ERROR, S1, S2, U1, and U2
; which can be located anywhere convenient in RAM
;
TEST:
CLD ; Clear decimal mode (just in case) for test
LDA #1
STA ERROR ; Store 1 in ERROR until test passes
LDA #$80
STA S1 ; Initalize S1 and S2 to -128 ($80)
STA S2
LDA #0
STA U1 ; Initialize U1 and U2 to 0
STA U2
LDY #1 ; Initialize Y (used to set and clear the carry flag) to 1
LOOP:
OUTS ADCSTR
OUTN U1
OUTS SP
OUT U2
JSR ADD ; Test ADC
CPX #1
BEQ DONE ; End if V and unsigned result do not agree (X = 1)
OUTS SBCSTR
OUTN U1
OUTS SP
OUT U2
JSR SUB ; Test SBC
CPX #1
BEQ DONE ; End if V and unsigned result do not agree (X = 1)
INC S1
INC U1
BNE LOOP ; Loop until all 256 possibilities of S1 and U1 are tested
INC S2
INC U2
BNE LOOP ; Loop until all 256 possibilities of S2 and U2 are tested
DEY
BPL LOOP ; Loop until both possiblities of the carry flag are tested
LDA #0
STA ERROR ; All tests pass, so store 0 in ERROR
DONE:
LDA ERROR
OUT A
BRK
;
; Test ADC
;
; X is initialized to 0
; X is incremented when V = 1
; X is incremented when the unsigned result predicts an overflow
; Therefore, if the V flag and the unsigned result agree, X will be
; incremented zero or two times (returning X = 0 or X = 2), and if they do
; not agree X will be incremented once (returning X = 1)
;
ADD:
CPY #1 ; Set carry when Y = 1, clear carry when Y = 0
LDA S1 ; Test twos complement addition
ADC S2
LDX #0 ; Initialize X to 0
BVC ADD1
INX ; Increment X if V = 1
ADD1:
CPY #1 ; Set carry when Y = 1, clear carry when Y = 0
LDA U1 ; Test unsigned addition
ADC U2
BCS ADD3 ; Carry is set if U1 + U2 >= 256
BMI ADD2 ; U1 + U2 < 256, A >= 128 if U1 + U2 >= 128
INX ; Increment X if U1 + U2 < 128
ADD2:
RTS
ADD3:
BPL ADD4 ; U1 + U2 >= 256, A <= 127 if U1 + U2 <= 383 ($17F)
INX ; Increment X if U1 + U2 > 383
ADD4:
RTS
BRK
;
; Test SBC
;
; X is initialized to 0
; X is incremented when V = 1
; X is incremented when the unsigned result predicts an overflow
; Therefore, if the V flag and the unsigned result agree, X will be
; incremented zero or two times (returning X = 0 or X = 2), and if they do
; not agree X will be incremented once (returning X = 1)
;
SUB:
CPY #1 ; Set carry when Y = 1, clear carry when Y = 0
LDA S1 ; Test twos complement subtraction
SBC S2
LDX #0 ; Initialize X to 0
BVC SUB1
INX ; Increment X if V = 1
SUB1:
CPY #1 ; Set carry when Y = 1, clear carry when Y = 0
LDA U1 ; Test unsigned subtraction
SBC U2
PHA ; Save the low byte of result on the stack
LDA #$FF
SBC #$00 ; result = (65280 + U1) - U2, 65280 = $FF00
CMP #$FE
BNE SUB4 ; Branch if result >= 65280 ($FF00) or result < 65024 ($FE00)
PLA ; Get the low byte of result
BMI SUB3 ; result < 65280 ($FF00), A >= 128 if result >= 65152 ($FE80)
SUB2:
INX ; Increment X if result < 65152 ($FE80)
SUB3:
RTS
SUB4:
PLA ; Get the low byte of result (does not affect the carry flag)
BCC SUB2 ; The carry flag is clear if result < 65024 ($FE00)
BPL SUB5 ; result >= 65280 ($FF00), A <= 127 if result <= 65407 ($FF7F)
INX ; Increment X if result > 65407 ($FF7F)
SUB5:
RTS
BRK
| 25.523179 | 76 | 0.589258 |
47a95f867de44d231219b7466bee06b60fc3c81a | 1,008 | asm | Assembly | libsrc/_DEVELOPMENT/stdlib/z80/asm_atof.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/stdlib/z80/asm_atof.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/stdlib/z80/asm_atof.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null |
; ===============================================================
; Jun 2015
; ===============================================================
;
; double atof(const char *nptr)
;
; Convert initial portion of string nptr to double.
;
; ===============================================================
SECTION code_stdlib
PUBLIC asm_atof
EXTERN asm_strtod
asm_atof:
; enter : hl = char *nptr
;
; exit : de = char * (first unconsumed char)
; *endp as per C11
;
; success
;
; AC' = double x
; carry reset
;
; fail if range error
;
; exx = +- infinity
; carry set, errno = ERANGE
;
; fail if invalid string
;
; exx = 0.0
; carry set, errno = EINVAL
;
; fail if nan not supported
;
; exx = 0.0
; carry set, errno = EINVAL
;
; uses : af, bc, de, hl, af', bc', de', hl'
ld de,0
jp asm_strtod
| 20.571429 | 65 | 0.376984 |
a233d8829820d6f6b73a156b91db53460502231f | 240 | asm | Assembly | libsrc/_DEVELOPMENT/arch/zx/misc/c/sccz80/zx_cls_wc_pix_callee.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/arch/zx/misc/c/sccz80/zx_cls_wc_pix_callee.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/arch/zx/misc/c/sccz80/zx_cls_wc_pix_callee.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z | ; void zx_cls_wc_pix_callee(struct r_Rect8 *r, uchar pix)
SECTION code_clib
SECTION code_arch
PUBLIC zx_cls_wc_pix_callee
EXTERN asm_zx_cls_wc_pix
zx_cls_wc_pix_callee:
pop af
pop hl
pop ix
push af
jp asm_zx_cls_wc_pix
| 13.333333 | 57 | 0.779167 |
1ae0cdc8cc56e031216146e6ec9260fb736bf148 | 427 | asm | Assembly | oeis/128/A128529.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/128/A128529.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/128/A128529.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A128529: Survivor of the Josephus problem, counting direction reversed after each step.
; Submitted by Jon Maiga
; 1,1,1,1,3,4,1,3,5,1,9,8,3,3,11,1,15,7,7,18,19,16,3,7,15,24,25,18,9,28,19,24,7,13,21,5,31,20,11,15,21,32,3,11,31,7,39,23,25,15,35,1,47,32,15,54,55,48,9,19,39,60,59,58,63,7,49,50,11,40,27,70,63,48,23,27,47,74,67
lpb $0
sub $0,1
add $2,2
add $2,$0
mul $2,$3
add $3,1
mod $2,$3
lpe
mov $0,$2
add $0,1
| 28.466667 | 211 | 0.632319 |
cc6ae87bb07ef398d0b82a6cd93a25aedf049f69 | 6,252 | asm | Assembly | binary_tree.asm | EdTheBass/asm_tutorial | 0731a1465a2fd85e1797e6a530950347f9dad341 | [
"BSD-3-Clause"
] | 97 | 2019-07-09T22:08:40.000Z | 2022-03-25T06:52:42.000Z | binary_tree.asm | EdTheBass/asm_tutorial | 0731a1465a2fd85e1797e6a530950347f9dad341 | [
"BSD-3-Clause"
] | 1 | 2021-05-18T18:38:25.000Z | 2021-08-05T05:37:45.000Z | binary_tree.asm | EdTheBass/asm_tutorial | 0731a1465a2fd85e1797e6a530950347f9dad341 | [
"BSD-3-Clause"
] | 20 | 2019-07-09T22:08:36.000Z | 2022-01-07T02:54:26.000Z | bits 64
default rel
segment .bss
; Remember, the alignment must be the size of the largest data item in the struct.
; Can use ``alignb`` to achieve this if necessary.
struc Node
.value resq 1
.left resq 1
.right resq 1
endstruc
struc Tree
.count resq 1
.root resq 1
endstruc
segment .text
extern ExitProcess
extern _CRT_INIT
extern malloc
extern printf
extern scanf
global main
; newTreePtr = new_tree();
new_tree:
push rbp
mov rbp, rsp
sub rsp, 64
mov rcx, Tree_size
call malloc
cmp rax, 0
je .error
xor ecx, ecx
mov [rax + Tree.root], rcx ; New tree has no root node yet
mov [rax + Tree.count], rcx ; New tree has a node count of zero
jmp .done
.error:
xor rax, rax
mov eax, 0
.done:
leave
ret
; ptr_to_node = find_node_in_tree(tree, node); NULL if not found
find_node_in_tree:
push rbp
mov rbp, rsp
sub rsp, 64
mov rcx, [rcx + Tree.root] ; Store the tree root node in rcx
xor eax, eax
.loop:
cmp rcx, 0 ; If we've reached a sentinel value, end iteration
je .done
cmp rdx, [rcx + Node.value] ; Compare the node value passed in with the current node's value
jl .traverse_left
jg .traverse_right
mov rax, rcx ; Move the node to rax
jmp .done
.traverse_left:
mov rcx, [rcx + Node.left]
jmp .loop
.traverse_right:
mov rcx, [rcx + Node.right]
jmp .loop
.done:
leave
ret
; insert_node(tree, node)
insert_node:
.node equ 32
.tree equ 40
push rbp
mov rbp, rsp
sub rsp, 64
mov [rsp + .tree], rcx ; save the parameters passed in onto the stack
mov [rsp + .node], rdx
; Check if the node already exists in the tree to prevent cycles (i.e. inserting when it already exists)
call find_node_in_tree
cmp rax, 0
jne .done ; If it already exists, don't insert
mov rcx, Node_size
call malloc ; Allocate memory for a new node
mov rdx, [rsp + .node] ; Get the node that was passed in
mov [rax + Node.value], rdx ; Store the node's value that was passed in into the new node's value
; We'll set the Lf/Rt sides of the new node to sentinel values first; we'll
; decide where it goes in the tree right after this
xor r10, r10
mov [rax + Node.left], r10 ; set the new node's left side to NULL
mov [rax + Node.right], r10 ; set the new node's right side to NULL
mov r9, [rsp + .tree] ; Get the tree that was passed in
mov rcx, [r9 + Tree.count] ; Get the number of nodes in the tree passed in
cmp rcx, 0 ; If the tree has no existing nodes, node inserted is the first one
jne .find_parent
inc qword [r9 + Tree.count] ; count = 1
mov [r9 + Tree.root], rax ; The tree root points to the new node created (if first node in tree is being inserted)
jmp .done
.find_parent:
inc qword [r9 + Tree.count] ; increment the tree node count for the new node inserted
mov r9, [r9 + Tree.root] ; r9 now points to the root node of the tree
.loop:
cmp rdx, [r9 + Node.value] ; check if node's value passed in is less than root node's value
jl .traverse_left
mov r8, r9 ; Store the current node in r8
mov r9, [r8 + Node.right] ; Store current node's right side in r9
cmp r9, 0 ; If we have reached a sentinel value for the right side, add the node here
jne .loop
mov [r8 + Node.right], rax ; Set the current node's right to point to the new node created
jmp .done
.traverse_left:
mov r8, r9 ; Store the current node in r8
mov r9, [r8 + Node.left] ; Store current node's left side in r9
cmp r9, 0 ; If we have reached a sentinel value for the left side, add the node here instead
jne .loop
mov [r8 + Node.left], rax ; Set the current node's left to point to the new node created
.done:
leave
ret
; print_recurse_tree(node)
print_recurse_tree:
segment .data
.print_fmt db '%ld ', 0
segment .text
.node equ 32
push rbp
mov rbp, rsp
sub rsp, 64
cmp rcx, 0 ; Once we hit the sentinel value, end recursion
je .done
mov [rsp + .node], rcx ; Store the node passed in onto the stack
mov rcx, [rcx + Node.left] ; Go to the first node in the tree
call print_recurse_tree
mov rcx, [rsp + .node]
mov rdx, [rcx + Node.value] ; Get the value from the tree and print it
lea rcx, [.print_fmt]
call printf
mov rcx, [rsp + .node]
mov rcx, [rcx + Node.right] ; Now go to the right node
call print_recurse_tree
.done:
leave
ret
; print_tree(root)
; This prints all keys in the left sub-tree, then the root node's key, then the
; keys of the right sub-tree.
print_tree:
segment .data
.print_endline db 0xd, 0xa, 0 ; CRLF null terminator
segment .text
push rbp
mov rbp, rsp
sub rsp, 64
mov rcx, [rcx + Tree.root] ; Store tree root node passed in
call print_recurse_tree
lea rcx, [.print_endline]
call printf
leave
ret
main:
segment .data
.prompt_fmt db 'Enter an integer for the node value. To abort, enter a character', 0xd, 0xa, 0
.scanf_fmt db '%ld', 0
segment .text
.tree equ 32
.k equ 40
push rbp
mov rbp, rsp
sub rsp, 64
call _CRT_INIT
call new_tree
mov [rsp + .tree], rax ; Tree just created is saved on the stack
.more:
lea rcx, [.prompt_fmt]
call printf
lea rcx, [.scanf_fmt]
lea rdx, [rsp + .k]
call scanf ; Read user input and store in k
cmp rax, 1 ; On failure, exit
jne .error_reading_input
mov rcx, [rsp + .tree]
mov rdx, [rsp + .k]
call insert_node
mov rcx, [rsp + .tree]
call print_tree
jmp .more
.error_reading_input:
mov rax, -1
jmp .done
.done:
xor eax, eax
call ExitProcess
| 24.046154 | 123 | 0.596769 |
8aa6b5d8e69c1b942c33d724a74cc3f2e15c84c0 | 20,673 | asm | Assembly | source/system/boot.asm | mega65dev/rom-assembler | 1670a56a8246dcdcc18e83b345d577eba686cf32 | [
"MIT"
] | null | null | null | source/system/boot.asm | mega65dev/rom-assembler | 1670a56a8246dcdcc18e83b345d577eba686cf32 | [
"MIT"
] | null | null | null | source/system/boot.asm | mega65dev/rom-assembler | 1670a56a8246dcdcc18e83b345d577eba686cf32 | [
"MIT"
] | null | null | null | ; ********************************************************************************************
; ********************************************************************************************
;
; Name : boot.asm
; Purpose : ..
; Created : 15th Nov 1991
; Updated : 4th Jan 2021
; Authors : Fred Bowen
;
; ********************************************************************************************
; ********************************************************************************************
;****************************************************************************
; BOOT Boot has three modes of operation...
;
; 1. *B*LOAD a given binary file and SYS to its load address.
; 2. *D*LOAD a BASIC file named AUTOBOOT.C65* and RUN it.
; 3. BOOT SYS loads the home sector to $0400 and JMPs to it.
;
; For modes 1 & 2, syntax is the same as BLOAD. Differentiate
; between the two modes via the presence of a filename. All other
; parameters, such as drive and device numbers, are utilized in the
; normal manner. For mode 3 there are no options. It's intended
; to boot a new OS. BASIC is turned off if it's successful. If it
; fails, the run time stack & sprites might be corrupted.
;****************************************************************************
boot cmp #sys_token ; BOOTSYS? [910111]
bne l189_1 ; no
jsr chrget ; yes- eat token
jsr _bootsys ; attempt to boot a new OS
bcc l189_4 ; returned to us after successful install
ldx #errbdk ; bootsys failed, report 'bad disk'????
+lbra error
l189_1 bbr4 runmod,l189_2 ; Error if in Edit mode [910620]
+lbra edit_err
l189_2 lda #0 ; BOOT "filename" [910417]
sta verck ; want 'load', not 'verify'
lda #$e6 ; set up parameters for DOS parser like BLOAD
ldx #$fc
jsr dosprx ; parse the command
bbr0 parsts,l189_5 ; was there a filename? branch if not
jsr bload_boot ; yes- bload it
+lbcs erexit ; load error
; ldx current_bank ;assume no B(ank) arg was given [910114]
; bbr0 parstx,l189_3 ; correct, use current setup
ldx dosbnk ; else use given bank number
l189_3 stx _bank
lda _starting_addr ; set up address BLOAD loaded to
sta _pclo
lda _starting_addr+1
sta _pchi
jsr _jsr_far ; call it
l189_4 rts
l189_5 ldy #$ff
l189_6 iny ; Copy default filename from ROM into buffer
lda autoboot_filename,y
sta savram,y
bne l189_6 ; null terminated
sty dosf1l ; length not counting terminator
smb6 runmod ; set flag for load not to go to ready
jsr dload_boot ; Load it
+lbcs erexit ; error if problems
+lbra run_a_program ; else go run it
; AUTOBOOT_CSG Runs a system diagnostic if PB0 is low after initialization.
; Diagnostic is copied to RAM-0 from ROM-2 and jumped to.
autobootCSG ; Run ROMed diagnostic if PB0 low [911105]
lda $dd01
lsr
bcs autoboot ; no, try to boot from disk
sei ; prevent IRQ from wacking code DL'd to $1xxx [911106]
ldx #12-1
l190_1 lda l190_2,x ; prep DMA list
sta dma1_cmd,x
dex
bpl l190_1
lda #0
ldx #>dma1_cmd ; copy program from ROM to RAM
ldy #<dma1_cmd
sta dma_ctlr+2 ; dma_list bank
stx dma_ctlr+1 ; dma_list hi
sty dma_ctlr ; dma_list lo & trigger
; jmp run_a_program ;if 'program' was BASIC
; lda #0 ;else set up arg's for call to 'long jmp' [911105]
sta _bank
sta _pclo
lda #$10
sta _pchi
jmp _jmp_far ; jump to code, no return. NOTE: this *MAPs* RAM-0 into context!
; move from $024001 to $002001, $3FFF bytes BASIC program
;l190_2 .byte $00,$ff,$3f,$01,$40,$02,$01,$20,$00,$00,$00,$00
; move from $024000 to $1000, $4000 bytes Diagnostic [911105]
l190_2 !text $00,$00,$40,$00,$40,$02,$00,$10,$00,0,0,0
; AUTOBOOT Attempts to RUN a disk program after cold startup. The
; program must be a BASIC program called "AUTOBOOT.C65*"
autoboot
lda #0 ; Select internal drive
sta fdc
l191_1 bit fdc+2 ; busywait
bmi l191_1
lda fdc+3 ; See if a diskette is present
and #$08
beq l191_3 ; exit with no action taken if not
lda #$e6 ; set up parameters for DOS parser like BLOAD
ldx #$fc
jsr dosprx ; let the parser init DOS stuff
ldy #$ff
l191_2 iny ; Copy filename from ROM into buffer
lda autoboot_filename,y
sta savram,y
bne l191_2 ; null terminated
sty dosf1l ; length not counting terminator
lda #%01000001 ; set flag for load indicating autoboot
sta runmod ; set flag for load not to go to ready
jsr dload_boot ; skip parser & load it
lda #0 ; clear autoboot flags
sta runmod
phx ; save end address
phy
jsr _readst ; get status report, but check it later
pha
jsr Suck_DS ; clear any DOS errors (to kill error LED)
pla ; now check I/O status
ply
plx
and #$bf ; EOI is okay
bne l191_3 ; outside problems
bcs l191_3 ; inside problems
stx text_top ; success- set end address & run it
sty text_top+1
cli
+lbra run_a_program
l191_3 rts ; failure- go_ready
autoboot_filename
!text "AUTOBOOT.C65*",0
erexit tax ; set termination flags
+lbne error ; normal error
+lbra break_exit ; user break
outch jsr _bsout
bcs erexit
rts
inchr jsr _basin
bcs erexit
rts
coout
; jsr put_io_in_map
jsr _chkout
jsr dschk ; see if device # >=4, and clear DS if so
bcs erexit ; take error exit of there was one
rts
coin
; jsr put_io_in_map
jsr _chkin
jsr dschk ; see if device # >=4, and clear DS if so
bcs erexit
rts
cgetl
; jsr put_io_in_map
jsr _getin
+lbcs break_exit ; 'stop' key was pressed
rts
save jsr plsv ; parse parameters, dschk
savenp ; Save Program (from DSave)
ldx text_top ; ending address
ldy text_top+1
lda #<txttab ; pointer to start address
savenb ; Save Binary (from BSave & KEY SAVE)
; jsr put_io_in_map
jsr _savesp ; save it
; Any changes to the following code must be duplicated at:
; bload
; load (load_file)
exit_disk_op
exit_disk_operation
php ; preserve kernel error status (.c)
pha ; preserve kernel error # (.a)
jsr print_dos_error ; print DOS error msg if any only in direct mode
pla
plp
bcc l192_3 ; branch if no error (rts)
bbs7 runmod,l192_2 ; branch if run mode (erexit)
cmp #errfnf ; is it 'file not found' catch-all?
bne l192_1 ; no (erexit)
sta errnum ; yes- save error # for 'er'
ora #$80 ; but no errdis
l192_1 sec
l192_2 bcs erexit ; exit if kernel problem (rts)
l192_3 rts
verify lda #1 ; verify flag
!text $2c ; skip two bytes
load lda #0 ; load flag
sta verck
l193_1 bbr4 runmod,l193_2 ; Error if in Edit mode [910620]
+lbra edit_err
l193_2 jsr plsv ; parse parameters, dschk
cld10 ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< entry from dload
; jsr put_io_in_map
lda verck
ldx txttab ; .x and .y have alt...
ldy txttab+1 ; ...load address
; Any changes to the following code must be duplicated at:
; bload
; save (exit_disk_op)
load_file
jsr _loadsp ; load it
bbs0 runmod,cld20 ; skip error checks if autoboot (rts)
phx ; save end address
phy
php ; save kernel load status (.c)
pha ; save kernel error # (.a)
jsr _readst ; save I/O status byte
sta parsts
jsr print_dos_error ; report error msg if any only in direct mode
pla ; restore error stuff
plp
bcc l194_3 ; branch if no error (rts)
bbs7 runmod,l194_2 ; branch if run mode (erexit)
cmp #errfnf ; is it 'file not found' catch-all?
bne l194_1 ; no (erexit)
sta errnum ; yes- save error # for 'er'
ora #$80 ; but no errdis
l194_1 sec
l194_2 +lbcs erexit ; exit if kernel problem
l194_3 ply ; restore end address
plx
lda verck
beq cld50 ; was load
; Finish verify
verify_check
ldx #ervfy ; assume error
; jsr _readst ;read status
bbs4 parsts,cld55 ; branch if 'verify' error
bbs7 runmod,cld20 ; branch if not direct mode
verify_ok
jsr _primm
!text cr,"OK", cr,0
cld20 rts
; Finish load
cld50
; jsr _readst ;check I/O status
lda parsts
and #%10111111 ; EOI is okay, so mask it
beq cld60 ; good- finish load operation
load_error
ldx #erload
cld55 +lbra error
cld60 stx text_top
sty text_top+1 ; end load address
bbs7 runmod,cld70 ; branch if not direct mode
bbs6 runmod,cld20 ; special "RUN file_name" flag...get out here (rts)
jsr link_program ; relink
jsr runc ; clear vars
+lbra ready_2 ; print 'ready' & return to main
; Program load
cld70 jsr reset_txtptr
jsr link_program
+lbra fload
open jsr paoc ; parse statement
jsr _open ; open it
bra close_out_1
close jsr paoc ; parse statement
; jsr put_io_in_map
lda andmsk ; get la
close_out ; enter with .a=LA [900725]
clc ; flag a real close
jsr _close ; close it
close_out_1
php
pha
lda _fa ; special error checking if disk op
cmp #8
bcc l195_1
pla
plp
+lbra exit_disk_operation ; disk
l195_1 pla ; something else
plp
+lbcs erexit
rts
; Parse LOAD, SAVE, & VERIFY commands
plsv
lda #0 ; set default filename (none)
jsr _setnam
ldx _default_drive ; set default device # (dosffn)
ldy #0 ; command 0
jsr _setlfs
lda text_bank ; all loads to bank 0 ???? set default memory banks
ldx var_bank ; all names from bank 1 ???? [910620]
jsr _setbank
jsr paoc20 ; by-pass junk
jsr paoc15 ; get/set file name
jsr paoc20 ; by-pass junk
jsr plsv7 ; get ',fa'
ldy #0 ; command 0
stx andmsk
jsr _setlfs
jsr paoc20 ; by-pass junk
jsr plsv7 ; get ',sa'
txa ; new command
tay
ldx andmsk ; device #
jsr _setlfs
bra dschk ; make dosfa current [900801]
; Look for comma followed by byte
plsv7 jsr paoc30
+lbra getbyt
; Skip return if next char is end
paoc20 jsr chrgot
bne paocx
pla
pla
paocx rts
; Check for comma and good stuff
paoc30 jsr chkcom ; check comma
paoc32 jsr chrgot ; get current character
bne paocx ; is okay
+lbra snerr ; bad...end of line
; Parse OPEN/CLOSE
paoc lda #sys_bank ; ???? [910620]
ldx var_bank ;
jsr _setbank ; filename bank (string bank)????
jsr _setnam ; default file name (null)
jsr paoc32 ; must get something
jsr getbyt ; get la
stx andmsk
txa
ldx _default_drive ; default device
ldy #0 ; default command
jsr _setlfs ; store it
jsr paoc20 ; skip junk
jsr plsv7
stx eormsk
ldy #0 ; default sa (command)
lda andmsk ; get la
cpx #3
bcc l196_1
dey ; if sa not given and fa=serial bus, default to $ff
l196_1 jsr _setlfs ; store them
jsr paoc20 ; skip junk
jsr plsv7 ; get sa
txa
tay
ldx eormsk
lda andmsk
jsr _setlfs ; set up real everything
jsr paoc20
jsr paoc30
paoc15 jsr frmstr ; do frmevl, frestr. return with len in a, index =~string
jsr getspa ; ????fixes old PET bug- load"string",val(chr$(56)) [910917]
; ldx index1
; ldy index1+1
jsr _setnam ; bank always set at plsv
;fall into dschk [900801]
dschk php ; check if current device >=8, and clear DS if so
pha
lda _fa
cmp #1
bne l197_1
lda _default_drive
sta _fa
l197_1 cmp #8 ; ???? [900807]
bcc l197_2
sta dosfa ; also make last DOS device = current device
jsr Clear_DS
l197_2 pla
plp
rts
;k_readst
; jsr put_io_in_map
; jmp _readst
;k_setlfs
; jsr put_io_in_map
; jmp _setlfs
;k_setnam
; jsr put_io_in_map
; jmp _setnam
;k_basin
; jsr put_io_in_map
; jmp _basin
;k_bsout
; jsr put_io_in_map
; jmp _bsout
;k_clrch
; jsr put_io_in_map
; jmp _clrch
;k_close
; jsr put_io_in_map
; jmp _close
;k_clall
; jsr put_io_in_map
; jmp _clall
;k_primm
; jsr put_io_in_map
; jmp _primm
;k_setbank
; jsr put_io_in_map
; jmp _setbank
; rts
;k_plot
; sta sw_rom_ram0 ;????
; jmp _plot
;k_stop
; jsr put_io_in_map
; jmp _stop
;.end
; ********************************************************************************************
;
; Date Changes
; ==== =======
;
; ********************************************************************************************
| 37.862637 | 121 | 0.366952 |
e242cb367a81f9013c42ac8447365af22a44cf1c | 385 | asm | Assembly | programs/oeis/027/A027657.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/027/A027657.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/027/A027657.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A027657: Expansion of (1+4*x)/(1-34*x+x^2).
; 1,38,1291,43856,1489813,50609786,1719242911,58403649188,1984004829481,67397760553166,2289539853978163,77776957274704376,2642127007485970621,89754541297248296738,3049012277098956118471
add $0,1
mul $0,2
sub $0,2
mov $1,4
mov $2,7
lpb $0
sub $0,1
add $2,$1
add $1,$2
add $1,$2
add $2,$1
lpe
sub $1,4
div $1,4
add $1,1
mov $0,$1
| 19.25 | 185 | 0.709091 |
8ffc8d7ff77c6e1ee5a25e0f13a708c6d7ffb633 | 26,497 | asm | Assembly | Library/GrObj/GrObj/grobjUtils.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 504 | 2018-11-18T03:35:53.000Z | 2022-03-29T01:02:51.000Z | Library/GrObj/GrObj/grobjUtils.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 96 | 2018-11-19T21:06:50.000Z | 2022-03-06T10:26:48.000Z | Library/GrObj/GrObj/grobjUtils.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 73 | 2018-11-19T20:46:53.000Z | 2022-03-29T00:59:26.000Z | COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1989 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: objectUtils.asm
AUTHOR: Steve Scholl, Nov 15, 1989
ROUTINES:
Name Description
---- -----------
GrObjGrabMouse
GrObjReleaseMouse
GrObjChangeTempStateBits
GrObjCanMove?
GrObjCanResize?
GrObjCanRotate?
GrObjCanSkew?
GrObjCanTransformed?
GrObjCanGeomtry?
GrObjCanGeomtryAndValid?
GrObjCanEdit?
GrObjCanDrawHandles?
GrObjCreateGrObjClassedEvent
INT GrObjAllocLMemBlock Alloc an lmem block in vm file
REVISION HISTORY:
Name Date Description
---- ---- -----------
Steve 11/15/89 Initial revision
DESCRIPTION:
Utililty routines for graphic class
$Id: grobjUtils.asm,v 1.1 97/04/04 18:07:19 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PointerImages segment lmem LMEM_TYPE_GENERAL
ptrCreate chunk
PointerDef <
16, ; PD_width
16, ; PD_height
7, ; PD_hotX
7 ; PD_hotY
>
byte 00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b
byte 00000001b, 00000000b,
00000001b, 00000000b,
00000001b, 00000000b,
00000001b, 00000000b,
00000001b, 00000000b,
00000001b, 00000000b,
00000001b, 00000000b,
11111110b, 11111110b,
00000001b, 00000000b,
00000001b, 00000000b,
00000001b, 00000000b,
00000001b, 00000000b,
00000001b, 00000000b,
00000001b, 00000000b,
00000001b, 00000000b,
00000000b, 00000000b
ptrCreate endc
ptrTextEdit chunk
PointerDef <
16, ; PD_width
16, ; PD_height
5, ; PD_hotX
8 ; PD_hotY
>
byte 00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b
byte 00000000b, 00000000b,
01110001b, 11000000b,
00001010b, 00000000b,
00000100b, 00000000b,
00000100b, 00000000b,
00000100b, 00000000b,
00000100b, 00000000b,
00000100b, 00000000b,
00000100b, 00000000b,
00000100b, 00000000b,
00000100b, 00000000b,
00000100b, 00000000b,
00000100b, 00000000b,
00000100b, 00000000b,
00001010b, 00000000b,
01110001b, 11000000b
ptrTextEdit endc
ptrTextCreate chunk
PointerDef <
16, ; PD_width
16, ; PD_height
7, ; PD_hotX
8 ; PD_hotY
>
byte 00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b
byte 00000000b, 00000000b,
00011100b, 01110000b,
00000010b, 10000000b,
00000001b, 00000000b,
10000001b, 00000010b,
10000001b, 00000010b,
10000001b, 00000010b,
01000001b, 00000100b,
00111111b, 11111000b,
01000001b, 00000100b,
10000001b, 00000010b,
10000001b, 00000010b,
10000001b, 00000010b,
00000001b, 00000000b,
00000010b, 10000000b,
00011100b, 01110000b
ptrTextCreate endc
ptrRotateTool chunk
PointerDef <
16, ; PD_width
16, ; PD_height
0, ; PD_hotX
4 ; PD_hotY
>
byte 00001100b, 00000000b,
00011100b, 00000000b,
00111111b, 00000000b,
01111111b, 11000000b,
11111111b, 11110000b,
01111111b, 11111000b,
00111111b, 11111100b,
00011100b, 11111110b,
00001100b, 00111110b,
00000000b, 00111111b,
00000000b, 00011111b,
00000000b, 00011111b,
00000000b, 00011111b,
00000000b, 00011111b,
00000000b, 00000000b,
00000000b, 00000000b
byte 00001100b, 00000000b,
00010100b, 00000000b,
00100111b, 00000000b,
01000000b, 11000000b,
10000000b, 00110000b,
01000000b, 00001000b,
00100111b, 00000100b,
00010100b, 11000010b,
00001100b, 00100010b,
00000000b, 00100001b,
00000000b, 00010001b,
00000000b, 00010001b,
00000000b, 00010001b,
00000000b, 00011111b,
00000000b, 00000000b,
00000000b, 00000000b
ptrRotateTool endc
ptrZoom chunk
PointerDef <
16, ; PD_width
16, ; PD_height
6, ; PD_hotX
6 ; PD_hotY
>
byte 00000000b, 00000000b,
00000000b, 00000000b,
00000111b, 00000000b,
00011000b, 11000000b,
00010000b, 01000000b,
00100000b, 00100000b,
00100000b, 00100000b,
00100000b, 00100000b,
00010000b, 01000000b,
00011000b, 11100000b,
00000111b, 01110000b,
00000000b, 00111000b,
00000000b, 00011100b,
00000000b, 00001100b,
00000000b, 00000000b,
00000000b, 00000000b
byte 00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000010b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b
ptrZoom endc
ptrMove chunk
PointerDef <
16, ; PD_width
16, ; PD_height
7, ; PD_hotX
7 ; PD_hotY
>
byte 00000001b, 00000000b,
00000011b, 10000000b,
00000111b, 11000000b,
00001111b, 11100000b,
00011111b, 11110000b,
00111011b, 10111000b,
01111111b, 11111100b,
11111111b, 11111110b,
01111111b, 11111100b,
00111011b, 10111000b,
00011111b, 11110000b,
00001111b, 11100000b,
00000111b, 11000000b,
00000011b, 10000000b,
00000001b, 00000000b,
00000000b, 00000000b
byte 00000001b, 00000000b,
00000010b, 10000000b,
00000100b, 01000000b,
00001000b, 00100000b,
00011110b, 11110000b,
00101010b, 10101000b,
01001110b, 11100100b,
10000000b, 00000010b,
01001110b, 11100100b,
00101010b, 10101000b,
00011110b, 11110000b,
00001000b, 00100000b,
00000100b, 01000000b,
00000010b, 10000000b,
00000001b, 00000000b,
00000000b, 00000000b
ptrMove endc
ptrResize chunk
PointerDef <
16, ; PD_width
16, ; PD_height
6, ; PD_hotX
6 ; PD_hotY
>
byte 11111101b, 11111000b,
11111101b, 11111000b,
11111000b, 11111000b,
11111101b, 11111000b,
11111111b, 11111000b,
11011111b, 11011000b,
00001111b, 10000000b,
11011111b, 11011000b,
11111111b, 11111000b,
11111101b, 11111000b,
11111000b, 11111000b,
11111101b, 11111000b,
11111101b, 11111000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b
byte 11111101b, 11111000b,
10000101b, 00001000b,
10001000b, 10001000b,
10000101b, 00001000b,
10100010b, 00101000b,
11010000b, 01011000b,
00001000b, 10000000b,
11010000b, 01011000b,
10100010b, 00101000b,
10000101b, 00001000b,
10001000b, 10001000b,
10000101b, 00001000b,
11111101b, 11111000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b
ptrResize endc
if 1
ptrRotate chunk
PointerDef <
16, ; PD_width
16, ; PD_height
6, ; PD_hotX
6 ; PD_hotY
>
byte 11111101b, 11111000b,
11111101b, 11111000b,
11111000b, 11111000b,
11111101b, 11111000b,
11111111b, 11111000b,
11011111b, 11011000b,
00001111b, 10000000b,
11011111b, 11011000b,
11111111b, 11111000b,
11111101b, 11111000b,
11111000b, 11111000b,
11111101b, 11111000b,
11111101b, 11111000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b
byte 11111101b, 11111000b,
10000101b, 00001000b,
10001000b, 10001000b,
10000101b, 00001000b,
10100010b, 00101000b,
11010000b, 01011000b,
00001000b, 10000000b,
11010000b, 01011000b,
10100010b, 00101000b,
10000101b, 00001000b,
10001000b, 10001000b,
10000101b, 00001000b,
11111101b, 11111000b,
00000000b, 00000000b,
00000000b, 00000000b,
00000000b, 00000000b
ptrRotate endc
else
ptrRotate chunk
PointerDef <
16, ; PD_width
16, ; PD_height
0, ; PD_hotX
4 ; PD_hotY
>
byte 00001100b, 00000000b,
00011100b, 00000000b,
00111111b, 00000000b,
01111111b, 11000000b,
11111111b, 11110000b,
01111111b, 11111000b,
00111111b, 11111000b,
00011100b, 11111100b,
00001100b, 01111100b,
00000000b, 01111100b,
00000001b, 11111111b,
00000001b, 11111111b,
00000000b, 11111110b,
00000000b, 01111100b,
00000000b, 00111000b,
00000000b, 00010000b
byte 00001100b, 00000000b,
00010100b, 00000000b,
00100111b, 00000000b,
01000000b, 11000000b,
10000000b, 00110000b,
01000000b, 00001000b,
00100111b, 00001000b,
00010100b, 11000100b,
00001100b, 01000100b,
00000000b, 01000100b,
00000001b, 11000111b,
00000001b, 00000001b,
00000000b, 10000010b,
00000000b, 01000100b,
00000000b, 00101000b,
00000000b, 00010000b
ptrRotate endc
endif
PointerImages ends
GrObjDrawCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjChangeTempStateBits
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set and reset some temp state bits. We use the in use count
to protect this bits and their associated data from being
discarded. So, if we have any bits set and after the reset
there are no bits set, then dec the in use cont. If we have
no bits set and we set some then inc the use count.
CALLED BY: INTERNAL UTILITY
PASS: *ds:si - object
cl - bits to set
ch - bits to reset
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 5/17/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjChangeTempStateBits proc far
uses cx,di
.enter
EC < call ECGrObjCheckLMemObject >
EC < push cx >
EC < and cl, not mask GrObjTempModes >
EC < ERROR_NZ GROBJ_BAD_GROBJ_TEMP_MODES_PARAM >
EC < and ch, not mask GrObjTempModes >
EC < ERROR_NZ GROBJ_BAD_GROBJ_TEMP_MODES_PARAM >
EC < pop cx >
GrObjDeref di,ds,si
; If we are not reseting any bits, or we have no bits to
; reset then jump to setting.
;
tst ch ;reseting any bits?
jz set
tst ds:[di].GOI_tempState ;any bits to reset?
jz set
; Reset those bits. If the result are all the bits cleared
; then dec the interactible count.
;
not ch
and ds:[di].GOI_tempState,ch
jnz set
call ObjDecInteractibleCount
set:
; If we are not setting any bits then bail
;
tst cl ;setting any bits?
jz done
; Set those bits. If there were no bits set originally then
; inc the interactible count
;
mov ch,ds:[di].GOI_tempState
or ds:[di].GOI_tempState,cl
tst ch ;original bits
jnz done
call ObjIncInteractibleCount
done:
.leave
ret
GrObjChangeTempStateBits endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjCanDrawHandles?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Determine if object can draw its selection handles.
CALLED BY: INTERNAL (UTILITY)
PASS: *ds:si - GrObj
RETURN:
stc - yes
clc - no
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
object can draw its selection handles
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 2/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjCanDrawHandles? proc far
class GrObjClass
uses di
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref di,ds,si
test ds:[di].GOI_optFlags, mask GOOF_ATTRIBUTE_MANAGER
jnz done
test ds:[di].GOI_optFlags, mask GOOF_GROBJ_INVALID
jnz done
tst_clc ds:[di].GOI_normalTransform
jz done
test ds:[di].GOI_locks,mask GOL_SELECT ;implied clc
jnz done
test ds:[di].GOI_attrFlags, mask GOAF_INSTRUCTION
jnz checkIfInstructionsVisible
success:
stc
done:
.leave
ret
checkIfInstructionsVisible:
;
; Check if instructions (annotations) are visible. If they are not
; visible, then they are not selectable. We query the body for this
; information.
;
push ax
call GrObjGetDrawFlagsFromBody
test ax, mask GODF_DRAW_INSTRUCTIONS ; Carry clear
pop ax
jz done ; invisible => fail
jmp success ; visible => stc
GrObjCanDrawHandles? endp
GrObjDrawCode ends
GrObjAlmostRequiredCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjCanEdit?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Determine if object can be edited
CALLED BY: INTERNAL (UTILITY)
PASS: *ds:si - GrObj
RETURN:
stc - yes
clc - no
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
object can be edited
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 2/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjCanEdit? proc far
class GrObjClass
uses di
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref di,ds,si
test ds:[di].GOI_optFlags, mask GOOF_ATTRIBUTE_MANAGER
jnz done
test ds:[di].GOI_optFlags, mask GOOF_GROBJ_INVALID
jnz done
tst_clc ds:[di].GOI_normalTransform
jz done
test ds:[di].GOI_locks,mask GOL_EDIT
jnz done
test ds:[di].GOI_locks,mask GOL_SHOW
jnz done
stc
done:
.leave
ret
GrObjCanEdit? endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjCanGeometry?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Determine if object can do any kind of geometry
like move, resize, etc.
CALLED BY: INTERNAL (UTILITY)
PASS: *ds:si - GrObj
RETURN:
stc - yes
clc - no
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
object can do geometry
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 2/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjCanGeometry? proc far
class GrObjClass
uses di
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref di,ds,si
test ds:[di].GOI_optFlags, mask GOOF_ATTRIBUTE_MANAGER
jnz done
tst_clc ds:[di].GOI_normalTransform
jz done
stc
done:
.leave
ret
GrObjCanGeometry? endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjCanResize?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Determine if object can be resized
CALLED BY: INTERNAL (UTILITY)
PASS: *ds:si - GrObj
RETURN:
stc - yes
clc - no
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
object can be resized
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 2/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjCanResize? proc far
class GrObjClass
uses di
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref di,ds,si
test ds:[di].GOI_locks, mask GOL_RESIZE
jnz done
test ds:[di].GOI_optFlags,mask GOOF_IN_GROUP
jnz done
call GrObjCanGeometry?
done:
.leave
ret
GrObjCanResize? endp
GrObjAlmostRequiredCode ends
GrObjRequiredExtInteractive2Code segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjCreateGrObjClassedEvent
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Encapsulate a classed event for the GrObj
CALLED BY: INTERNAL (UTILITY)
PASS:
ax - message
di - 0 or MF_STACK if data on stack
cx,dx,bp - other data
RETURN:
cx - event handle
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/15/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjCreateGrObjClassedEvent proc far
uses bx,di,si
.enter
mov bx, segment GrObjClass
mov si, offset GrObjClass
ornf di,mask MF_RECORD
call ObjMessage
mov cx,di
.leave
ret
GrObjCreateGrObjClassedEvent endp
GrObjRequiredExtInteractive2Code ends
GrObjExtInteractiveCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjCopyChunk
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Copy a chunk into a newly created chunk
CALLED BY: INTERNAL
PASS:
*ds:ax - chunk to copy
es - segment to copy chunk to
RETURN:
ax - new chunk
ds,es - possibly moved (ES, only if the same as DS)
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
WARNING: May cause block to move and/or chunk to move
within block
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 12/ 9/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjCopyChunk proc far
uses bx,cx,di,si
.enter
; Do nothing if no chunk
;
tst ax
jz done
; Create new chunk, always marking it dirty
;
mov si,ax ;source chunk handle
call ObjGetFlags
ChunkSizeHandle ds,si,cx
segxchg ds,es ;es <- source segment
;ds <- dest segment
push es:[LMBH_handle] ;source handle
ornf al, mask OCF_DIRTY
call LMemAlloc
pop bx ;source handle
call MemDerefES ;source segment
; Copy chunk
;
mov di,ax ;dest chunk
mov di,ds:[di] ;dest offset
segxchg ds,es ;ds <- source segment
;es <- dest segment
mov si,ds:[si] ;source offset
MoveBytes cx,cx
done:
.leave
ret
GrObjCopyChunk endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjCanMove?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Determine if object can be moved
CALLED BY: INTERNAL (UTILITY)
PASS: *ds:si - GrObj
RETURN:
stc - yes
clc - no
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
object can be moved
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 2/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjCanMove? proc far
class GrObjClass
uses di
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref di,ds,si
test ds:[di].GOI_locks, mask GOL_MOVE
jnz done
call GrObjCanGeometry?
done:
.leave
ret
GrObjCanMove? endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjCanRotate?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Determine if object can be rotated
CALLED BY: INTERNAL (UTILITY)
PASS: *ds:si - GrObj
RETURN:
stc - yes
clc - no
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
object can be rotated
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 2/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjCanRotate? proc far
class GrObjClass
uses di
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref di,ds,si
test ds:[di].GOI_locks, mask GOL_ROTATE
jnz done
call GrObjCanGeometry?
done:
.leave
ret
GrObjCanRotate? endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjCanSkew?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Determine if object can be skewed
CALLED BY: INTERNAL (UTILITY)
PASS: *ds:si - GrObj
RETURN:
stc - yes
clc - no
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
object can be skewed
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 2/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjCanSkew? proc far
class GrObjClass
uses di
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref di,ds,si
test ds:[di].GOI_locks, mask GOL_SKEW
jnz done
call GrObjCanGeometry?
done:
.leave
ret
GrObjCanSkew? endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjCanTransform?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Determine if object can be transformed
CALLED BY: INTERNAL (UTILITY)
PASS: *ds:si - GrObj
RETURN:
stc - yes
clc - no
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
object can be transformed
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 2/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjCanTransform? proc far
class GrObjClass
uses di
.enter
EC < call ECGrObjCheckLMemObject >
call GrObjCanGeometry?
.leave
ret
GrObjCanTransform? endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjCanGeometryAndValid?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Determine if object can do any kind of geometry
like move, resize, and it is grobj valid
CALLED BY: INTERNAL (UTILITY)
PASS: *ds:si - GrObj
RETURN:
stc - yes
clc - no
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
object can do geometry
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 2/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjCanGeometryAndValid? proc far
class GrObjClass
uses di
.enter
EC < call ECGrObjCheckLMemObject >
GrObjDeref di,ds,si
test ds:[di].GOI_optFlags, mask GOOF_GROBJ_INVALID
jnz done
call GrObjCanGeometry?
done:
.leave
ret
GrObjCanGeometryAndValid? endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjGrabMouse
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Send message to body to grab the grobj mouse
CALLED BY: INTERNAL
PASS:
*ds:si - object grabbing mouse
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 10/ 7/91 Initial version
jon 17 mar 1992 turned into method
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjGrabMouse method dynamic GrObjClass, MSG_GO_GRAB_MOUSE
uses cx,dx
.enter
; GrObjs inside groups are not allowed to grab the mouse
;
EC < test ds:[di].GOI_optFlags, mask GOOF_IN_GROUP >
EC < ERROR_NZ OBJECTS_IN_GROUP_MAY_NOT_GRAB_MOUSE >
; Send message to body
;
mov cx,ds:[LMBH_handle]
mov dx,si
mov ax,MSG_GB_GIVE_ME_MOUSE_EVENTS
mov di,mask MF_FIXUP_DS
call GrObjMessageToBody
.leave
ret
GrObjGrabMouse endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjReleaseMouse
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Send message to body to release the grobj mouse
CALLED BY: INTERNAL
PASS:
*ds:si - object grabbing mouse
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 10/ 7/91 Initial version
jon 17 mar 1992 turned into method
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjReleaseMouse method dynamic GrObjClass, MSG_GO_RELEASE_MOUSE
uses ax,cx,dx, di
.enter
; GrObjs inside groups will never have mouse grab, so
; skip sending message to body
;
test ds:[di].GOI_optFlags, mask GOOF_IN_GROUP
jnz done
; Send message to body
;
mov cx,ds:[LMBH_handle]
mov dx,si
mov ax,MSG_GB_DONT_GIVE_ME_MOUSE_EVENTS
mov di,mask MF_FIXUP_DS
call GrObjMessageToBody
done:
.leave
ret
GrObjReleaseMouse endm
GrObjExtInteractiveCode ends
| 20.11921 | 79 | 0.596785 |
d6b43d6861889353dc2050a531f375820b42f0da | 8,184 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_634.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_634.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_634.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r13
push %r15
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x152a9, %r10
nop
sub $14570, %rdx
mov $0x6162636465666768, %rcx
movq %rcx, %xmm5
vmovups %ymm5, (%r10)
nop
nop
nop
and %r13, %r13
lea addresses_normal_ht+0xf4af, %r15
nop
nop
nop
nop
nop
xor %r12, %r12
movw $0x6162, (%r15)
sub %r10, %r10
lea addresses_D_ht+0xbce9, %rcx
inc %rbp
mov $0x6162636465666768, %r12
movq %r12, (%rcx)
nop
nop
nop
cmp $52175, %r12
lea addresses_A_ht+0xeda9, %rsi
lea addresses_UC_ht+0x1744d, %rdi
nop
nop
add $30517, %r10
mov $12, %rcx
rep movsb
nop
nop
nop
xor %rbp, %rbp
lea addresses_D_ht+0x16a5f, %r12
nop
sub $10302, %rcx
mov $0x6162636465666768, %rsi
movq %rsi, %xmm2
and $0xffffffffffffffc0, %r12
vmovaps %ymm2, (%r12)
nop
nop
nop
nop
nop
sub $27803, %rbp
lea addresses_normal_ht+0x18931, %rsi
lea addresses_A_ht+0x9ce9, %rdi
clflush (%rdi)
nop
nop
and $21637, %r10
mov $120, %rcx
rep movsq
sub $36938, %r13
lea addresses_UC_ht+0x2659, %r15
nop
nop
xor %rdi, %rdi
mov (%r15), %r10w
nop
nop
nop
add $35197, %r15
lea addresses_UC_ht+0x5ce9, %rsi
lea addresses_WT_ht+0x19501, %rdi
clflush (%rdi)
nop
nop
add %r15, %r15
mov $70, %rcx
rep movsl
nop
dec %rdx
lea addresses_WC_ht+0x164e9, %rsi
lea addresses_normal_ht+0x6509, %rdi
nop
sub $61543, %r10
mov $105, %rcx
rep movsw
nop
nop
nop
cmp %rbp, %rbp
lea addresses_normal_ht+0xe6e9, %rsi
lea addresses_WT_ht+0x1c3e9, %rdi
clflush (%rsi)
nop
nop
nop
dec %rbp
mov $11, %rcx
rep movsq
nop
nop
nop
dec %r15
lea addresses_normal_ht+0x2df7, %rdi
nop
cmp %rdx, %rdx
mov (%rdi), %r15w
nop
nop
nop
nop
add %rcx, %rcx
lea addresses_WC_ht+0x41a9, %rbp
nop
nop
nop
nop
cmp $40073, %r10
movw $0x6162, (%rbp)
nop
nop
nop
dec %r12
lea addresses_A_ht+0xdb99, %rsi
lea addresses_normal_ht+0x4fa5, %rdi
nop
nop
nop
nop
and $26779, %rbp
mov $40, %rcx
rep movsw
nop
nop
nop
nop
nop
add $59728, %rsi
lea addresses_D_ht+0xe3c9, %rsi
nop
sub $31319, %rdx
movb (%rsi), %r12b
cmp $3833, %r13
lea addresses_A_ht+0x18d0b, %rdi
clflush (%rdi)
nop
nop
nop
xor %r15, %r15
movb $0x61, (%rdi)
nop
nop
nop
nop
nop
xor $9427, %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r15
pop %r13
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %r15
push %rbx
push %rcx
push %rdi
// Store
lea addresses_UC+0x1c4e9, %rdi
xor $62457, %rcx
movb $0x51, (%rdi)
nop
nop
nop
nop
nop
cmp $20976, %r13
// Faulty Load
lea addresses_UC+0xf4e9, %rbx
clflush (%rbx)
nop
nop
add $26170, %r15
movups (%rbx), %xmm3
vpextrq $1, %xmm3, %rdi
lea oracles, %r14
and $0xff, %rdi
shlq $12, %rdi
mov (%r14,%rdi,1), %rdi
pop %rdi
pop %rcx
pop %rbx
pop %r15
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_UC'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 10, 'same': False, 'type': 'addresses_UC'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': True, 'type': 'addresses_UC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 6, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 1, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 9, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 0, 'same': True, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 3, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 11, 'same': True, 'type': 'addresses_A_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 4, 'same': True, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 9, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 10, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 9, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 1, 'same': True, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 3, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 4, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 5, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
| 33.540984 | 2,999 | 0.660068 |
ecbe55eba99845bad8899271cfa27d4691345bcb | 701 | asm | Assembly | programs/oeis/017/A017768.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/017/A017768.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/017/A017768.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A017768: Binomial coefficients C(52,n).
; 1,52,1326,22100,270725,2598960,20358520,133784560,752538150,3679075400,15820024220,60403728840,206379406870,635013559600,1768966344600,4481381406320,10363194502115,21945588357420,42671977361650,76360380541900,125994627894135,191991813933920,270533919634160,352870329957600,426384982032100,477551179875952,495918532948104,477551179875952,426384982032100,352870329957600,270533919634160,191991813933920,125994627894135,76360380541900,42671977361650,21945588357420,10363194502115,4481381406320,1768966344600,635013559600,206379406870,60403728840,15820024220,3679075400,752538150,133784560,20358520,2598960,270725,22100,1326,52,1
mov $1,52
bin $1,$0
mov $0,$1
| 100.142857 | 627 | 0.884451 |
f7b11fc7eb9be0f5a5854d06ef53e3ccf1c50a53 | 1,055 | asm | Assembly | Library/ParentC/parentcManager.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 504 | 2018-11-18T03:35:53.000Z | 2022-03-29T01:02:51.000Z | Library/ParentC/parentcManager.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 96 | 2018-11-19T21:06:50.000Z | 2022-03-06T10:26:48.000Z | Library/ParentC/parentcManager.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 73 | 2018-11-19T20:46:53.000Z | 2022-03-29T00:59:26.000Z | COMMENT @----------------------------------------------------------------------
Copyright (c) Globalpc 1999 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: parentcManager.asm
AUTHOR:
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
DESCRIPTION:
$Id: heapManager.asm,v 1.1 97/04/05 01:13:56 newdeal Exp $
------------------------------------------------------------------------------@
;--------------------------------------
; Include files
;--------------------------------------
include geos.def
include geode.def
include resource.def
include lmem.def
include file.def
include vm.def
include hugearr.def
include initfile.def
include heap.def
include gstring.def
include ec.def
UseLib config.def
UseLib Objects/vTextC.def
include parentc.def
include parentControl.rdef
;-------------------------------------
include parentControl.asm
include parentcURLs.asm
;-------------------------------------
end
| 18.508772 | 80 | 0.476777 |
9d074d01cccc774bbf2ec8e707fc97206aa1c833 | 422 | asm | Assembly | programs/oeis/032/A032793.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/032/A032793.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/032/A032793.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A032793: Numbers that are congruent to {1, 2, 4} mod 5.
; 1,2,4,6,7,9,11,12,14,16,17,19,21,22,24,26,27,29,31,32,34,36,37,39,41,42,44,46,47,49,51,52,54,56,57,59,61,62,64,66,67,69,71,72,74,76,77,79,81,82,84,86,87,89,91,92,94,96,97,99,101,102,104,106,107,109,111,112,114,116,117,119,121,122,124,126,127,129,131,132,134,136,137,139,141,142,144,146,147,149,151,152,154,156,157,159,161,162,164,166
mul $0,5
div $0,3
add $0,1
| 60.285714 | 335 | 0.682464 |
c977a477edffcb7cdcb25a321eff680847cadaba | 12,872 | asm | Assembly | Lab 6/lab6-P2.asm | AndrewDichabeng/Computer-Systems-Foundations | b98854118963c09d03f39a7f33354b17f503a540 | [
"MIT"
] | null | null | null | Lab 6/lab6-P2.asm | AndrewDichabeng/Computer-Systems-Foundations | b98854118963c09d03f39a7f33354b17f503a540 | [
"MIT"
] | null | null | null | Lab 6/lab6-P2.asm | AndrewDichabeng/Computer-Systems-Foundations | b98854118963c09d03f39a7f33354b17f503a540 | [
"MIT"
] | null | null | null | ; Lab6 - Subroutine to retrieve and print a salary from
; an Employee record from an array of structures
; Constant definitions
Display .EQU 04E9h ; address of Libra display
; Offsets to access individual fields within the records
ID .EQU 0 ; Zero bytes from start of record is ID
NAME .EQU 1 ; One byte from start of record is name
GENDER .EQU 3 ; 3 bytes from start of record is gender
SALARY .EQU 4 ; 4 bytes from start of record is salary
REC_SIZE .EQU 5 ; Total size of each record is 5 bytes
; ---------------------------------------------------------------
; Function: getSalary
; Function to retrive the salary of the specified employee record.
; Input Parameters:
; Stack: 16-bit address of start of array of structures
; Stack: 8-bit record number to be printed (record numbering starts at 0)
; Output Paramters:
; Stack: returns 8-bit salary of specified Employee record
; ---------------------------------------------------------------
getSalary:
; Save register values that will be modified in this routine
push AX ; FIXED
push SI ; FIXED
push BP ; FIXED
push BX ; FIXED
; Get input parameters from the stack.
; Use SI for the start address of the array of structures
; Use AL for record number
mov BP, SP ; FIXED
mov SI, [BP+10] ; FIXED
mov AL, [BP+12] ; FIXED
; Calculate OFFSET of this record (distance from starting address of array of structures)
; Offset is REC_NUM*REC_SIZE)
mov AH, REC_SIZE ; FIXED: Load REC_SIZE into suitable register (for MUL)
mul AH ; FIXED: Multiply REC_NUM by REC_SIZE
add Bx,Ax ; FIXED: move offset into a suitable register (see next line)
; For the next instruction, you MUST USE BASED-INDEXED Addressing mode (look it up!)
mov AL, [BX+SI+SALARY] ; FIXED - Load the salary of this record into AL
mov [BP+14], AX ; FIXED - Save return value into reserved slot in stack frame
; Restore registers
pop BX ; FIXED
pop BP ; FIXED
pop SI ; FIXED
pop AX ; FIXED
; Return to calling function
RET ; FIXED
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; INSERT SUBROUTINES FROM lab6-P1.asm HERE
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ---------------------------------------------------------------
; printInt: Subroutine to print a 1-byte unsigned (short) integer between 0-255
; Input parameters:
; Stack: Unsigned short int to be printed
; Output parameters:
; None.
; ---------------------------------------------------------------
printInt:
; Save registers modified by this subroutine
push AX ; FIXED
push CX ; FIXED
push BP ; FIXED
; Retrieve input parameter from stack into AL
mov BP, SP ; FIXED - make a copy of SP
mov AL, [BP + 8] ; FIXED - read from the appropriate slot of your stack frame
mov CL, 10 ; Will be dividing by 10...
LoopPI:
cmp AL, 10 ; Compare the number to 10
jl printLast ; If it is less than 10, then print this digit
; If it is greater than 10, divide by 10
mov AH, 0 ; Clear AH
div CL ; Divide number by 10
push AX ; FIXED - Push the input parameter of printDigit onto the stack
call printDigit ; Print the quotient in AL
pop AX ; FIXED - Pop the input parameter of printDigit back off the stack
mov AL, AH ; Move remainder into AL to be printed
jmp LoopPI ; Jump back to the top of the loop
printLast:
push AX ; FIXED - Push the input parameter of printDigit onto the stack
call printDigit ; Print the quotient in AL
pop AX ; FIXED - Pop the input parameter of printDigit back off the stack
; Restore registers
pop Bp ; FIXED
pop CX ; FIXED
pop AX ; FIXED
RET
; ---------------------------------------------------------------
; printDigit: Subroutine to print a single decimal digit
; Input parameters:
; Stack: Unsigned decimal digit (between 0-9) to be printed
; Output parameters:
; None.
; ---------------------------------------------------------------
printDigit:
; Save registers modified by this subroutine
push AX ; FIXED
push DX ; FIXED
push Bp ; FIXED
; Retrieve input parameter from stack into AL
mov BP,SP ; FIXED- make a copy of SP
mov AL, [BP+8] ; FIXED - read from the appropriate slot of your stack frame
mov DX, Display
add AL, '0' ; Convert number to ASCII code
out DX,AL ; Print it
; Restore registers
pop Bp ; FIXED
pop DX ; FIXED
pop AX ; FIXED
RET
; ---------------------------------------------------------------
; printSalary: Subroutine to print employee salary
; Input parameters:
; Stack: Unsigned short int (0-255) representing salary in 1000's of $
; Output parameters:
; None.
; ---------------------------------------------------------------
printSalary:
; Save registers modified by this subroutine
push AX
push SI ; Not strictly necessary, but please keep
push DX
push Bp ; FIXED
; Retrieve input parameter from stack into AL
mov BP,SP ; FIXED - make a copy of SP
mov AL, [BP+ 10] ; FIXED - read from the appropriate slot of your stack frame
mov DX, Display
mov AH,AL ; Keep a copy of the salary in AH (need AL for printing...)
mov AL, '$' ; Print '$' preceeding number
out DX,AL ; Print it
mov AL,AH ; Move salary back into AL
push AX ; FIXED - Push the input parameter of printInt onto the stack
call printInt ; Print the salary (0-255)
pop AX ; FIXED - Pop the input parameter of printInt back off the stack
mov AL, ',' ; Print ',' after number
out DX,AL ; Print it
mov AL, '0' ; Print '0' after comma
out DX,AL ; Print a zero
out DX,AL ; Print a zero
out DX,AL ; Print a zero
; Restore registers
pop BP ; FIXED
pop DX
pop SI
pop AX
RET
; ---------------------------------------------------------------
; newLine: Subroutine to print a newline and a linefeed character
; Input parameters:
; None.
; Output parameters:
; None.
; ---------------------------------------------------------------
; Constants for this subroutine:
s_CR .EQU 0Dh ; ASCII value for Carriage return
s_LF .EQU 0Ah ; ASCII value for NewLine
newLine:
; Save registers modified by this subroutine
push AX
push DX
mov DX, Display ; Initialize the output port number in DX
mov AL, s_LF ; Load line feed (LF) into AL
out DX,AL ; print the char
mov AL, s_CR ; Load carriage return (CR) into AL
out DX,AL ; print the char
; Restore registers
pop DX
pop AX
RET
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; END OF SUBROUTINES FROM lab6-P1.asm
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ---------------------------------------------------------------
; main: Main function to test all subroutines
; ---------------------------------------------------------------
main:
; Print salary of dayShiftDB[0]
mov BX, dayShiftDB
mov AL, 0
push AX ; FIXED Make room on stack for return value from getSalary
push AX ; FIXED Push record number
push BX ; FIXED Push starting address of array of structures
call getSalary ; FIXED Invoke getSalary subroutine
pop BX ; FIXED Pop starting address of array of structures
pop AX ; FIXED Pop record number
call printSalary ; Input parameter for printSalary is already on the stack!
call newLine
pop AX ; FIXED Pop the return value from getSalary
; Print dayShiftDB[3] FIX ME. Add LINES BELOW TO DO THIS
mov BX, dayShiftDB
mov AL, 3
push AX ; FIXED Make room on stack for return value from getSalary
push AX ; FIXED Push record number
push BX ; FIXED Push starting address of array of structures
call getSalary ; FIXED Invoke getSalary subroutine
pop BX ; FIXED Pop starting address of array of structures
pop AX ; FIXED Pop record number
call printSalary ; Input parameter for printSalary is already on the stack!
call newLine
pop AX ; FIXED Pop the return value from getSalary
; Print nightShiftDB[0] FIX ME. Add LINES BELOW TO DO THIS
mov BX, nightShiftDB
mov AL, 0
push AX ; FIXED Make room on stack for return value from getSalary
push AX ; FIXED Push record number
push BX ; FIXED Push starting address of array of structures
call getSalary ; FIXED Invoke getSalary subroutine
pop BX ; FIXED Pop starting address of array of structures
pop AX ; FIXED Pop record number
call printSalary ; Input parameter for printSalary is already on the stack!
call newLine
pop AX ; FIXED Pop the return value from getSalary
; Quit
HLT
; ---------------------------------------------------------------
; Test data
; ---------------------------------------------------------------
; ---------------------------------------------------------------
; Record format:-
; Struct Employee {
; char* name; // 2-byte pointer to string of chars
; bool gender; // 1-byte Boolean (zero-->male, else-->female)
; short salary; // 1-byte unsigned short int salary (in $1000�s)
; int id; // 1-byte unsigned integer ID
; };
; ---------------------------------------------------------------
.ORG 5000h
dayShiftDB:
; Record dayShiftDB[0]
.DB 12 ; dayShiftDB[0].id
.DW name0 ; dayShiftDB[0].name
.DB 0 ; dayShiftDB[0].gender
.DB 50 ; dayShiftDB[0].salary
; Record dayShiftDB[1]
.DB 27
.DW name1
.DB 1
.DB 58
; Record dayShiftDB[2]
.DB 1
.DW name2
.DB 1
.DB 70
; Record dayShiftDB[3]
.DB 77
.DW name3
.DB 0
.DB 32
nightShiftDB:
.DB 7
.DW name4 ; Record nightShiftDB[0]
.DB 1
.DB 99
.DB 80
.DW name5 ; Record nightShiftDB[1]
.DB 0
.DB 75
name0: .DB 'Sam Jones$'
name1: .DB 'Sara Thomas$'
name2: .DB 'Samira Smith$'
name3: .DB 'Max Golshani$'
name4: .DB 'The Boss!$'
name5: .DB 'Sven Svenderson$'
.END main ; Entry point of program is main()
| 44.539792 | 123 | 0.456417 |
6447d1b4e4de2453faf0d6b1be2de9749833dc2b | 4,657 | asm | Assembly | apps/breakfast/pde_fw/toast/examples/Assembly (CCE)/msp430x24x_uscib0_i2c_08.asm | tp-freeforall/breakfast | 0399619cdb7a81b3c3cc4c5a1b7d69f5c32b8c65 | [
"BSD-3-Clause"
] | 1 | 2020-05-15T18:08:48.000Z | 2020-05-15T18:08:48.000Z | apps/breakfast/toast/msp430-code-examples/Assembly (CCE)/msp430x24x_uscib0_i2c_08.asm | tp-freeforall/breakfast | 0399619cdb7a81b3c3cc4c5a1b7d69f5c32b8c65 | [
"BSD-3-Clause"
] | null | null | null | apps/breakfast/toast/msp430-code-examples/Assembly (CCE)/msp430x24x_uscib0_i2c_08.asm | tp-freeforall/breakfast | 0399619cdb7a81b3c3cc4c5a1b7d69f5c32b8c65 | [
"BSD-3-Clause"
] | null | null | null | ;*******************************************************************************
; MSP430x24x Demo - USCI_B0 I2C Master TX multiple bytes to MSP430 Slave
;
; Description: This demo connects two MSP430's via the I2C bus. The master
; transmits to the slave. This is the MASTER CODE. It continuously
; transmits an array of data and demonstrates how to implement an I2C
; master transmitter sending multiple bytes using the USCI_B0 TX interrupt.
; ACLK = n/a, MCLK = SMCLK = BRCLK = default DCO = ~1.045MHz
;
; /|\ /|\
; MSP430F249 10k 10k MSP430F249
; slave | | master
; ----------------- | | -----------------
; -|XIN P3.1/UCB0SDA|<-|---+->|P3.1/UCB0SDA XIN|-
; | | | | | 32kHz
; -|XOUT | | | XOUT|-
; | P3.2/UCB0SCL|<-+----->|P3.2/UCB0SCL |
; | | | P1.0|--> LED
;
; JL Bile
; Texas Instruments Inc.
; May 2008
; Built Code Composer Essentials: v3 FET
;*******************************************************************************
.cdecls C,LIST, "msp430x24x.h"
;-------------------------------------------------------------------------------
.text ;Program Start
;-------------------------------------------------------------------------------
RESET mov.w #0500h,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT
SetupP3 bis.b #06h,&P3SEL ; Assign I2C pins to USCI_B0
SetupUCB0 bis.b #UCSWRST,&UCB0CTL1 ; Enable SW reset
mov.b #UCMST+UCMODE_3+UCSYNC,&UCB0CTL0
; I2C Master, synchronous mode
mov.b #UCSSEL_2+UCSWRST,&UCB0CTL1
; Use SMCLK, keep SW reset
mov.b #12,&UCB0BR0 ; fSCL = SMCLK/12 = ~100kHz
mov.b #00,&UCB0BR1
mov.w #048h,&UCB0I2CSA ; Slave Address is 048h
bic.b #UCSWRST,&UCB0CTL1 ; Clear SW reset, resume operation
bis.b #UCB0TXIE,&IE2 ; Enable TX interrupt
Main mov.w #TxData,R5 ; TX array start address
mov.w #5,R6 ; Load TX byte counter
Main_1 bit.b #UCTXSTP,&UCB0CTL1 ; Ensure stop condition got sent
jc Main_1
bis.b #UCTR+UCTXSTT,&UCB0CTL1 ; I2C TX, start condition
bis.b #LPM0+GIE,SR ; Enter LPM0, enable interrupts
; Remain in LPM0 until all data
; is TX'd
jmp Main ; Repeat
;-------------------------------------------------------------------------------
; The USCIAB0TX_ISR is structured such that it can be used to transmit any
; number of bytes by pre-loading R6 with the byte count. Also, R5 points to
; the next byte to transmit.
;-------------------------------------------------------------------------------
USCIAB0TX_ISR; USCI_B0 Data ISR
;-------------------------------------------------------------------------------
tst.w R6 ; Check TX byte counter
jz USCIAB0TX_ISR_1 ; Jump if all bytes were TX'd
mov.b @R5+,&UCB0TXBUF ; Load TX buffer
dec.w R6 ; Decrement TX byte counter
reti
USCIAB0TX_ISR_1
bis.b #UCTXSTP,&UCB0CTL1 ; I2C stop condition
bic.b #UCB0TXIFG,&IFG2 ; Clear USCI_B0 TX int flag
bic.w #LPM0,0(SP) ; Clear LPM0
reti
;-------------------------------------------------------------------------------
TxData; Table of data to transmit
;-------------------------------------------------------------------------------
.byte 011h
.byte 022h
.byte 033h
.byte 044h
.byte 055h
;-------------------------------------------------------------------------------
; Interrupt Vectors
;-------------------------------------------------------------------------------
.sect ".int22" ; USCI_B0 I2C Data Int Vector
.short USCIAB0TX_ISR
.sect ".reset" ; POR, ext. Reset, Watchdog
.short RESET
.end
| 54.151163 | 81 | 0.376423 |
ceab83661cae7729e5e66310e1d909356d45c42a | 7,162 | asm | Assembly | ArraySort/IOSortArray.asm | miguel2192/CSC211-Assembly | 39cd43026f07e443d9809fb7ec229303522ecab9 | [
"MIT"
] | null | null | null | ArraySort/IOSortArray.asm | miguel2192/CSC211-Assembly | 39cd43026f07e443d9809fb7ec229303522ecab9 | [
"MIT"
] | null | null | null | ArraySort/IOSortArray.asm | miguel2192/CSC211-Assembly | 39cd43026f07e443d9809fb7ec229303522ecab9 | [
"MIT"
] | null | null | null | ############ IOSortArray.asm on ##################
# Author: Miguel Rodriguez #
# Illustrates Base Addressing #
# #
# Enter an array of numbers and #
# sorts them and displays them #
# #
##################################################
# output - a subprogram or method to: #
# 1. sorts the entries in the array #
# 2.display the entries in an array #
# #
##################################################
.text
.globl __start
__start:
restart:
jal input # Call a subprogram to enter an array of numbers
jal output # helps display regular numbers from array
jal sort
jal output # helps display sorted numbers
jal restarts
la $t0,array # t0 = address of array
lw $t1,count # t1 = count, exit loop when it goes to 0
lw $t2,($t0) # t2 = min = a[0] (initialization)
lw $t3,($t0) # t3 = max = a[0] (initialization)
add $t0,$t0,4 # move pointer ahead to next array element a[1]
add $t1,$t1,-1 # decrement counter to keep in step with array
loop: lw $t4,($t0) # t4 = next element in array
bge $t4,$t2,notMin # if array element is >= min goto notMin
move $t2,$t4 # min = a[i]
j notMax
notMin: ble $t4,$t3,notMax # if array element is <= max goto notMax
move $t3,$t4 # max = a[i]
notMax: add $t1,$t1,-1 # t1 -- -> counter --
add $t0,$t0,4 # increment counter to point to next word
bnez $t1,loop
la $a0,min # Display "The minimum number is "
li $v0,4 # a0 = address of message
syscall # v0 = 4 which indicates display a string
move $a0,$t2 # Display the minimum number
li $v0,1
syscall
la $a0,max # Display "The maximum number is "
li $v0,4 # a0 = address of message
syscall # v0 = 4 which indicates display a string
move $a0,$t3 # Display the maximum number
li $v0,1
syscall
la $a0,nl # Display "cr/lf"
li $v0,4 # a0 = address of message
syscall # v0 = 4 which indicates display a string
li $v0,10 # End Of Program
syscall
output:
la $a0, numbers #displays the numbers
li $v0, 4
syscall
la $t0, array # initialize t0 and t1
lw $t1, count
outloop: # use a loop to enter the actual numbers in array
lw $t5, ($t0) # load a number from the array into $t5
move $a0, $t5 # display that number with spacing (either new line or space)
li $v0, 1
syscall
la $a0, space # displays the new line
li $v0, 4
syscall
addi $t0, $t0, 4
addi $t1, $t1, -1
bgtz $t1, outloop
la $a0, nl
li $v0, 4
syscall
jr $ra # go back to where you came from
input: #Ask for the numbers of numbers in the array
la $a0, prompt1 #Print "Please enter the number of numbers that you wish to enter: "
li $v0, 4
syscall
li $v0, 5 #Gets input from the user
syscall
sw $v0, count
move $t5, $v0 # t5 = count
li $t6, 1 # t6 = 1
la $t0 array
inloop:
la $a0, pound #Display #1, #2, #3, etc...
li $v0, 4
syscall
move $a0, $t6
li $v0, 1
syscall
la $a0, spacing
li $v0, 4
syscall
li $v0, 5 #Enter the array numbers
syscall
sw $v0,($t0)
addi $t0, $t0, 4 #t0 = t0 + 4
addi $t6, $t6, 1 #t6 = t6 + 1
ble $t6, $t5, inloop
jr $ra # go back to where you came from
sort:
la $t0, array # t0 is a pointer to a[0] (a[i])
la $t1, array # t1 is a pointer to a[0] (a[j])
addi $t1, $t1, 4 # t1 += 4 (so t1 is now a pointer to a[1])
lw $t2, count # t2 = count (i counter)
addi $t2, $t2, -1 # t2 = count-1
move $t3, $t2 # t3 = t2 (j counter)
sloop:
lw $t4, ($t0) # t4 = a[i]
lw $t5, ($t1) # t5 = a[j]
ble $t4, $t5, noswap # if (a[i] <= a[j]) do not swap
swap:
sw $t5, ($t0) # swap a[i] and a[j]
sw $t4, ($t1)
noswap:
addi $t1, $t1, 4 # t1 = next address of a[j]
addi $t3, $t3, -1 # j count --
bnez $t3, sloop # if j count != 0 go back to sort loop
addi $t0, $t0, 4 # t0 = next address of a[i]
addi $t2, $t2, -1 # i count --
move $t3, $t2 # j count = i count
beqz $t2, endsort # if i count = 0 sort is complete
addi $t1, $t0, 4 # t1 = the next address of a[i]
j sloop # jump to sort loop
endsort:
jr $ra # go back to where you came from
restarts:
la $a0, prompt2 #prompts the user if they wish to restart program
li $v0, 4
syscall
li $v0, 5
syscall
bnez $v0, restart #restarts the program
li $v0, 10
syscall
.data
array: .space 100
count: .word 0
min: .asciiz "The minimum number is "
max: .asciiz "\nThe maximium number is "
nl: .asciiz "\n"
prompt1:.asciiz "Please enter the number of numbers that you wish to enter: "
pound: .asciiz "#"
spacing:.asciiz ": "
numbers:.asciiz "Here are your numbers: \n"
space: .asciiz " "
prompt2:.asciiz "\nWould you like to repeat the program: (1-yes, 0-no): "
################ Output ###############################################################
# Please enter the number of numbers that you wish to enter: **** user input : 5
# #1: **** user input : -11
# #2: **** user input : 5
# #3: **** user input : 9
# #4: **** user input : 9
# #5: **** user input : 2
# Here are your numbers:
# -11 5 9 9 2
# Here are your numbers:
# -11 2 5 9 9
#
# Would you like to repeat the program: (1-yes, 0-no): **** user input : 1
# Please enter the number of numbers that you wish to enter: **** user input : 5
# #1: **** user input : -100
# #2: **** user input : 9
# #3: **** user input : 6
# #4: **** user input : 3
# #5: **** user input : 55
# Here are your numbers:
# -100 9 6 3 55
# Here are your numbers:
# -100 3 6 9 55
#
# Would you like to repeat the program: (1-yes, 0-no): **** user input : 1
# Please enter the number of numbers that you wish to enter: **** user input : 9
# #1: **** user input : 88
# #2: **** user input : 33
# #3: **** user input : -66
# #4: **** user input : 4
# #5: **** user input : 99
# #6: **** user input : 33
# #7: **** user input : 54
# #8: **** user input : 77
# #9: **** user input : 23
# Here are your numbers:
# 88 33 -66 4 99 33 54 77 23
# Here are your numbers:
# -66 4 23 33 33 54 77 88 99
#
# Would you like to repeat the program: (1-yes, 0-no): **** user input : 0
#
# -- program is finished running --
#
##############################End Output################################################## | 27.546154 | 94 | 0.4926 |
debd10cf497f554140d846895bc1260e98d348a3 | 507 | asm | Assembly | oeis/066/A066588.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/066/A066588.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/066/A066588.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A066588: The sum of the digits of n^n.
; 1,4,9,13,11,27,25,37,45,1,41,54,58,52,99,88,98,108,127,31,117,148,146,153,151,154,189,163,167,63,184,205,207,214,260,270,271,265,306,112,308,315,313,325,306,352,374,333,355,151,414,412,350,378,442,391,450,472,470,243,484,451,495,487,572,531,526,583,477,259,638,558,604,607,639,652,722,639,745,361,693,757,707,747,706,772,765,745,773,360,856,805,774,868,911,927,853,811,936,1
add $0,1
pow $0,$0
lpb $0
mov $2,$0
div $0,10
mod $2,10
add $3,$2
lpe
mov $0,$3
| 39 | 376 | 0.684418 |
723f14ceb77b7ab1f5000bce277e5d37140d8ccb | 420 | asm | Assembly | programs/oeis/261/A261337.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/261/A261337.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/261/A261337.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A261337: Digit-sums in an incremental base that adjusts itself as the digits of n are generated from right to left.
; 0,1,1,2,1,3,2,2,1,3,3,4,2,3,2,4,1,5,3,2,3,5,4,6,2,3,3,3,2,7,4,4,1,4,5,4,3,3,2,5,3,5,5,4,4,6,6,6,2,5,3,4,3,7,3,2,2,5,7,8,4,5,4,6,1,5,4,6,5,7,4,6,3,3,3,5,2,7,5,3,3,6,5,8,5,7,4,7,4,9,6,4,6,8,6,6,2,4,5,3
mov $2,2
lpb $0,7
add $2,$1
mov $1,$0
div $0,$2
mod $1,$2
lpe
mov $1,$2
sub $1,2
mov $0,$1
| 30 | 201 | 0.57381 |
6f2bd0d097aa14530de5ad28b3aa94070beef468 | 628 | asm | Assembly | programs/oeis/076/A076338.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/076/A076338.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/076/A076338.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A076338: a(n) = 512*n + 1.
; 1,513,1025,1537,2049,2561,3073,3585,4097,4609,5121,5633,6145,6657,7169,7681,8193,8705,9217,9729,10241,10753,11265,11777,12289,12801,13313,13825,14337,14849,15361,15873,16385,16897,17409,17921,18433,18945,19457,19969,20481,20993,21505,22017,22529,23041,23553,24065,24577,25089,25601,26113,26625,27137,27649,28161,28673,29185,29697,30209,30721,31233,31745,32257,32769,33281,33793,34305,34817,35329,35841,36353,36865,37377,37889,38401,38913,39425,39937,40449,40961,41473,41985,42497,43009,43521,44033,44545,45057,45569,46081,46593,47105,47617,48129,48641,49153,49665,50177,50689
mul $0,512
add $0,1
| 104.666667 | 577 | 0.799363 |
56aa34bb32bc7e5b77e72a69a187da958a35f960 | 139 | asm | Assembly | Working Disassembly/Levels/CNZ/Misc Object Data/Anim - Trap Door.asm | TeamASM-Blur/Sonic-3-Blue-Balls-Edition | 7e8a2c5df02271615ff4cae529521e6b1560d6b1 | [
"Apache-2.0"
] | 5 | 2021-07-09T08:17:56.000Z | 2022-02-27T19:57:47.000Z | Working Disassembly/Levels/CNZ/Misc Object Data/Anim - Trap Door.asm | TeamASM-Blur/Sonic-3-Blue-Balls-Edition | 7e8a2c5df02271615ff4cae529521e6b1560d6b1 | [
"Apache-2.0"
] | null | null | null | Working Disassembly/Levels/CNZ/Misc Object Data/Anim - Trap Door.asm | TeamASM-Blur/Sonic-3-Blue-Balls-Edition | 7e8a2c5df02271615ff4cae529521e6b1560d6b1 | [
"Apache-2.0"
] | null | null | null | Ani_31D2E: dc.w byte_31D32-Ani_31D2E
dc.w byte_31D35-Ani_31D2E
byte_31D32: dc.b $7F, 0, $FF
byte_31D35: dc.b 5, 1, 2, $FD, 0
| 27.8 | 39 | 0.647482 |
91ffd582d1f46036c446530affb6bb0f3e020065 | 578 | asm | Assembly | tests/tcp-sack/tcp-sack.asm | ygrek/ubpf | 10e0a45b11ea27696add38c33e24dbc631caffb6 | [
"Apache-2.0"
] | 466 | 2015-09-17T17:24:18.000Z | 2022-03-30T14:14:37.000Z | tests/tcp-sack/tcp-sack.asm | ygrek/ubpf | 10e0a45b11ea27696add38c33e24dbc631caffb6 | [
"Apache-2.0"
] | 79 | 2015-12-03T19:01:57.000Z | 2022-03-30T13:01:39.000Z | tests/tcp-sack/tcp-sack.asm | ygrek/ubpf | 10e0a45b11ea27696add38c33e24dbc631caffb6 | [
"Apache-2.0"
] | 104 | 2016-03-23T02:23:28.000Z | 2022-03-28T09:25:08.000Z | ldxb r2, [r1+12]
ldxb r3, [r1+13]
lsh r3, 0x8
or r3, r2
mov r0, 0x0
jne r3, 0x8, +37
ldxb r2, [r1+23]
jne r2, 0x6, +35
ldxb r2, [r1+14]
add r1, 0xe
and r2, 0xf
lsh r2, 0x2
add r1, r2
mov r0, 0x0
ldxh r4, [r1+12]
add r1, 0x14
rsh r4, 0x2
and r4, 0x3c
mov r2, r4
add r2, 0xffffffec
mov r5, 0x15
mov r3, 0x0
jgt r5, r4, +20
mov r5, r3
lsh r5, 0x20
arsh r5, 0x20
mov r4, r1
add r4, r5
ldxb r5, [r4]
jeq r5, 0x1, +4
jeq r5, 0x0, +12
mov r6, r3
jeq r5, 0x5, +9
ja +2
add r3, 0x1
mov r6, r3
ldxb r3, [r4+1]
add r3, r6
lsh r3, 0x20
arsh r3, 0x20
jsgt r2, r3, -18
ja +1
mov r0, 0x1
exit
| 12.844444 | 18 | 0.633218 |
30f7a09a2bb92b9317c25b8307826b1b2beda3d4 | 349 | asm | Assembly | programs/oeis/320/A320661.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/320/A320661.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/320/A320661.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A320661: a(n) = 2^(n+3) - 6*n - 7.
; 1,3,13,39,97,219,469,975,1993,4035,8125,16311,32689,65451,130981,262047,524185,1048467,2097037,4194183,8388481,16777083,33554293,67108719,134217577,268435299,536870749,1073741655,2147483473,4294967115,8589934405,17179868991
mov $1,2
pow $1,$0
sub $0,$1
mul $0,3
sub $1,$0
sub $1,4
mul $1,2
add $1,1
mov $0,$1
| 26.846154 | 225 | 0.722063 |
573e8ce69caf4ace8a2dc21f65a196ed56d3033b | 21 | asm | Assembly | AtariSTDev/main.asm | tehongis/reTry | 7c219cba39c806373d1c6098166a919345a2fe7b | [
"MIT"
] | null | null | null | AtariSTDev/main.asm | tehongis/reTry | 7c219cba39c806373d1c6098166a919345a2fe7b | [
"MIT"
] | null | null | null | AtariSTDev/main.asm | tehongis/reTry | 7c219cba39c806373d1c6098166a919345a2fe7b | [
"MIT"
] | null | null | null |
move.w #0,d0
rts
| 4.2 | 13 | 0.52381 |
ff92a8e6721f98371d109b923c8409a040873a2b | 1,282 | asm | Assembly | Main.asm | sleepingburrito/BackIsle | 546b4ac35136144c9103e0266bfa8d02a2834e17 | [
"MIT"
] | 1 | 2019-07-23T15:43:01.000Z | 2019-07-23T15:43:01.000Z | Main.asm | sleepingburrito/BackIsle | 546b4ac35136144c9103e0266bfa8d02a2834e17 | [
"MIT"
] | null | null | null | Main.asm | sleepingburrito/BackIsle | 546b4ac35136144c9103e0266bfa8d02a2834e17 | [
"MIT"
] | null | null | null | ;Back Isle
;2019 (C) SleepingBurrito MIT
;
include "Constants.asm"
include "GloableVarirables.asm"
include "MacroTools.asm"
SECTION "Interrupt Vblank", ROM0[$0040]
reti
include "RomHeader.asm"
;main
;====
SECTION "MAIN", ROM0[$0150]
;init code
include "StartingState.asm"
call InitGraphics
call InitPlayer
;=======
CopyConst8Bit DIR_LEFT,NpcSpriteFacingReg
CopyConst8Bit 20,NpcSpriteXY
CopyConst8Bit 26,NpcSpriteXY + 1
CopyConst8Bit SPRITE_SPEED_SLOW, NpcSpriteSpeed
;=======
GameLoop:
;frame upkeep
;=============
call ReadJoypad
call HideAllSprites
call PlayerStep
;drawing
;=======
HaltCounter ;wait for start of vblank
OAMCopyMacro
;end of main game loop
jp GameLoop
;=================
NewGame:
;what to do for a new game (aka no save data)
ret
;more bank 0 code
;================
include "Tools.asm"
include "DAM.asm"
include "Timers.asm"
include "Joypad.asm"
include "Drawing.asm"
include "Map.asm"
include "Prng.asm"
include "SavingLoading.asm"
include "player.asm"
;other bank includes
;====================
;text/ui graphics data
include "graphics/Graphics.asm"
;dialog/text data
include "text/DialogData.asm"
;tile map/map meta data
include "maps/MapData.asm" | 17.805556 | 49 | 0.661466 |
62cba99a58a9fe1deaf29aced4d27d42476be5a4 | 409 | asm | Assembly | oeis/238/A238292.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/238/A238292.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/238/A238292.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A238292: Final digit of imaginary part of (n+n*i)^n.
; Submitted by Jon Maiga
; 1,8,4,0,0,2,6,0,4,0,2,0,8,2,0,0,2,8,8,0,6,8,4,0,0,2,6,0,4,0,2,0,8,2,0,0,2,8,8,0,6,8,4,0,0,2,6,0,4,0,2,0,8,2,0,0,2,8,8,0,6,8,4,0,0,2,6,0,4,0,2,0,8,2,0,0,2,8,8,0,6,8,4,0,0,2,6,0,4,0,2,0,8,2,0,0,2,8,8,0
mov $1,$0
add $1,1
pow $1,$1
lpb $0
sub $0,1
mul $1,2
sub $1,$2
add $2,$1
lpe
mov $0,$1
mod $0,10
add $0,10
mod $0,10
| 22.722222 | 201 | 0.542787 |
1739097c6072624684b34a817413f0ff2403424e | 40 | asm | Assembly | MIPS64CLI/test.asm | Ryu64Emulator/MIPS64 | 116f95a1d0162bf89b1d09ffd6e5134c07c0a404 | [
"Unlicense"
] | 4 | 2019-01-08T07:35:59.000Z | 2020-11-04T02:12:51.000Z | MIPS64CLI/test.asm | Ryu64Emulator/MIPS64 | 116f95a1d0162bf89b1d09ffd6e5134c07c0a404 | [
"Unlicense"
] | null | null | null | MIPS64CLI/test.asm | Ryu64Emulator/MIPS64 | 116f95a1d0162bf89b1d09ffd6e5134c07c0a404 | [
"Unlicense"
] | null | null | null | [BASE 0x8000]
main:
LB $t3, 0x1000($t3) | 10 | 19 | 0.65 |
0ce2e7b018c650a98e774e37031b20378078f55c | 625 | asm | Assembly | Engine Hacks/Strmag/Strmag/ASM/SaveMoreUnitData.asm | sme23/Christmas2 | f3f3daeda1afe2b78bfed38cbf60d8bc17ca9f79 | [
"CC0-1.0"
] | 3 | 2020-06-15T14:22:38.000Z | 2020-06-28T19:44:52.000Z | Wizardry/ExternalHacks/StrMagSplit/ASM/SaveMoreUnitData.s | sme23/WhatHeck | 746a2be83358aaa4e855182176b47c4808f2587a | [
"CC0-1.0"
] | null | null | null | Wizardry/ExternalHacks/StrMagSplit/ASM/SaveMoreUnitData.s | sme23/WhatHeck | 746a2be83358aaa4e855182176b47c4808f2587a | [
"CC0-1.0"
] | null | null | null | .thumb
.org 0x00
.macro blh to, reg=r3
ldr \reg, =\to
mov lr, \reg
.short 0xF800
.endm
Player:
mov r0, #0x48
mov r2, #51
mul r2, r0 @Size of Copy
ldr r1, =0x1F78 @Dest
add r1, r7, r1
ldr r0, =0x202BE4C @Player Unit Pool
blh 0x80D1724 @SaveToSram
Enemy:
mov r0, #0x48
mov r2, #50
mul r2, r0 @Size of Copy
ldr r1, =0x1F78+(51*0x48) @Dest
add r1, r7, r1
ldr r0, =0x202CFBC @Enemy Unit Pool
blh 0x80D1724 @SaveToSram
NPC:
mov r0, #0x48
mov r2, #10
mul r2, r0 @Size of Copy
ldr r1, =0x1F78+(51*0x48)+(50*0x48) @Dest
add r1, r7, r1
ldr r0, =0x202DDCC @NPC Unit Pool
blh 0x80D1724 @SaveToSram
ldr r3, =0x80A5B11
bx r3
.pool
| 14.534884 | 41 | 0.6864 |
d998c00a9610fb295bd1dfae54cab056e688fca3 | 689 | asm | Assembly | practica7/practica7.asm | ramseslopez/Arqui | da2b4b8b384209417c2aeceeab06fd671f7e29b1 | [
"MIT"
] | null | null | null | practica7/practica7.asm | ramseslopez/Arqui | da2b4b8b384209417c2aeceeab06fd671f7e29b1 | [
"MIT"
] | null | null | null | practica7/practica7.asm | ramseslopez/Arqui | da2b4b8b384209417c2aeceeab06fd671f7e29b1 | [
"MIT"
] | null | null | null | .data
a: .word 5
b: .word 4
.text
main: #Preambulo
#Invocación
#Retorno de mist_1
#Conclusión main
#mist_1 recibe como argumentos $a0 y $a1
lw $a0 a
lw $a1 b
jal mist_1
j end_1
mist_1: subi $sp $s0 24
sw $ra 20($sp)
sw $s0 16($sp)
#Preambulo mist_1
move $s0, $a0
move $t0, $a1
li $t1, 1
loop_1: beqz $s0, end_1
#invocamos de mist_0
move $a0, $t0 # Se pasa el argumento $a0
move $a1, $t1 # Se pasa el argumento $a1
jal mist_0
# Retorno de mist_0
move $t1, $v0
subi $s0, $s0, 1
j loop_1
end_1: # Conclusión mist_1
move $v0, $t1
lw $s0, 16($sp)
lw $ra, 20($sp)
addi $sp, $sp, 24
mult $a0, $a1
# Conclusión mist_0
mflo $v0 # Se retorna el resultado en $v0 | 16.804878 | 43 | 0.640058 |
eda81f4ea9545dfbd6464b834328aedb21db1089 | 422 | asm | Assembly | programs/oeis/033/A033142.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/033/A033142.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/033/A033142.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A033142: Base-6 digits are, in order, the first n terms of the periodic sequence with initial period 1,0,0.
; 1,6,36,217,1302,7812,46873,281238,1687428,10124569,60747414,364484484,2186906905,13121441430,78728648580,472371891481,2834231348886,17005388093316,102032328559897,612193971359382,3673163828156292,22038982968937753
add $0,2
lpb $0
mov $2,6
pow $2,$0
sub $0,3
add $1,$2
lpe
sub $1,36
div $1,36
add $1,1
| 30.142857 | 215 | 0.767773 |
c52f4f4a4eea928d23f6d4a71189561b5db9a8d9 | 40,123 | asm | Assembly | srcs/mm/mm.asm | gamozolabs/falkervisor_beta | 48e83a56badcf53dba94a5ab224eb37775a2f37d | [
"MIT"
] | 69 | 2018-09-09T01:30:53.000Z | 2021-07-27T18:56:39.000Z | srcs/mm/mm.asm | gamozolabs/falkervisor_beta | 48e83a56badcf53dba94a5ab224eb37775a2f37d | [
"MIT"
] | null | null | null | srcs/mm/mm.asm | gamozolabs/falkervisor_beta | 48e83a56badcf53dba94a5ab224eb37775a2f37d | [
"MIT"
] | 15 | 2018-09-09T05:46:41.000Z | 2022-02-16T01:46:38.000Z | [bits 64]
; Get the APIC ID for this core
get_thread_id:
mov rax, 0xFEE00020
mov eax, dword [rax]
shr rax, (32 - 8)
ret
; rcx <- Node ID
get_current_node:
push rax
push rbx
push rdx
mov eax, 0x8000001E
cpuid
and ecx, (MAX_NODES - 1)
pop rdx
pop rbx
pop rax
ret
; rdi -> Haystack
; rdx -> Haystack size
; rsi -> Needle
; rcx -> Needle size
; rax <- Found location
memmem:
push rcx
push rdx
push rdi
push rsi
sub rdx, rcx
jl short .not_found
.lewp:
push rdi
push rsi
push rcx
mov rax, rdi
rep cmpsb
pop rcx
pop rsi
pop rdi
je .found
add rdi, 1
sub rdx, 1
cmp rdx, 0
jge short .lewp
.not_found:
xor rax, rax
.found:
pop rsi
pop rdi
pop rdx
pop rcx
ret
; rdi -> memory to zero
; rcx -> size in bytes of memory to zero
bzero:
push rax
push rcx
push rdx
push rdi
; Zero out rax for stosq
xor eax, eax
mov rdx, rcx
and edx, 0x7 ; Get remainder of bytes to do individually
shr rcx, 3 ; Get number of 8-byte chunks
jz short .individual
rep stosq
.individual:
; We know rcx is 0, so this is effectively a 'mov' that sets flags
xor rcx, rdx
jz short .done
rep stosb
.done:
pop rdi
pop rdx
pop rcx
pop rax
ret
; Allocate 1MB and store the address to it in GS-base
;
; rax -> Core ID
init_per_core_storage:
push rax
push rbx
push rcx
push rdx
push rax
mov rbx, (1024 * 1024)
bamp_alloc rbx
; Zero out the structure
push rdi
mov rdi, rbx
mov rcx, (1024 * 1024)
xor eax, eax
rep stosb
pop rdi
mov eax, ebx
bextr rdx, rbx, 0x2020
mov ecx, 0xC0000101 ; gs_base
wrmsr
mov qword [gs:thread_local.gs_base], rbx
call get_current_node
mov qword [gs:thread_local.node_id], rcx
pop rax
mov qword [gs:thread_local.core_id], rax
pop rdx
pop rcx
pop rbx
pop rax
ret
; rbx -> Node struct to initialize
; rsi -> Source data
; rbp -> Size of data (in bytes)
init_node_data:
push rcx
mov rcx, qword [gs:thread_local.node_id]
mov qword [rbx + node_struct.node_data + rcx*8], rsi
mov qword [rbx + node_struct.orig_data], rsi
mov qword [rbx + node_struct.data_len], rbp
pop rcx
ret
; rbx -> node_struct
; rax <- Pointer to data local to this node
;
; This is thread safe. You can call this before the orig_data and data_len
; are set, as it will wait until they are set!
;
per_node_data:
push rcx
push rdi
; Wait for the initial data and length to be populated
.wait_for_data:
pause
cmp qword [rbx + node_struct.orig_data], 0
je short .wait_for_data
.wait_for_len:
pause
cmp qword [rbx + node_struct.data_len], 0
je short .wait_for_len
mov rcx, qword [gs:thread_local.node_id]
; Check if we already have a local data pointer
cmp qword [rbx + node_struct.node_data + rcx*8], 0
jne short .done
; Acquire a lock on the per node data. This will only occur when two
; threads both race to initialize an empty node pointer.
mov rax, 1
lock xadd qword [rbx + node_struct.node_race + rcx*8], rax
test rax, rax
jnz short .poll_for_done ; If we're not the first, wait for the first to
; finish setting up the copy.
; Check again for presence of node data. This is possible if we didn't see
; data above, then the guy populating the node released the lock and then
; we got lock #0
cmp qword [rbx + node_struct.node_data + rcx*8], 0
jne short .release_lock
; Allocate on this node
mov rdi, qword [rbx + node_struct.data_len]
bamp_alloc rdi
; Copy from the master data source to our local allocation
push rcx
push rsi
push rdi
mov rcx, qword [rbx + node_struct.data_len]
mov rsi, qword [rbx + node_struct.orig_data]
rep movsb
pop rdi
pop rsi
pop rcx
; Save the data pointer!
mov qword [rbx + node_struct.node_data + rcx*8], rdi
jmp short .release_lock
; Wait for the winner of the race to populate the node data
.poll_for_done:
pause
cmp qword [rbx + node_struct.node_data + rcx*8], 0
je short .poll_for_done
.release_lock:
; Release the lock
lock dec qword [rbx + node_struct.node_race + rcx*8]
.done:
mov rax, qword [rbx + node_struct.node_data + rcx*8]
pop rdi
pop rcx
ret
; rsi -> Size to allocate
; rsi <- Pointer
bamp_alloc_int:
push rax
push rbx
push rcx
push rdx
push rdi
call get_current_node
; rcx now contains the node id
mov rbx, [fs:globals.fs_base]
lea rbx, [rbx + globals.bamp_addr + rcx*8]
add rsi, 0xFFF
and rsi, ~0xFFF
mov rdx, rsi
lock xadd qword [rbx], rsi
; Check for OOM
push rdx
add rdx, rsi
cmp rdx, [fs:globals.bamp_ends + rcx*8]
pop rdx
jbe short .not_oom
int3
.not_oom:
lock add qword [fs:globals.fuzz_status + fuzz_status.alloc_charge + rcx*8], rdx
pop rdi
pop rdx
pop rcx
pop rbx
pop rax
ret
; rsi -> Size to allocate
; rsi <- Pointer
rand_alloc_int:
push rax
push rbx
push rcx
push rdx
push rdi
XMMPUSH xmm15
call falkrand
movq rcx, xmm15
and rcx, 0x7
; rcx now contains the node id
mov rbx, [fs:globals.fs_base]
lea rbx, [rbx + globals.bamp_addr + rcx*8]
add rsi, 0xFFF
and rsi, ~0xFFF
mov rdx, rsi
lock xadd qword [rbx], rsi
; Check for OOM
push rdx
add rdx, rsi
cmp rdx, [fs:globals.bamp_ends + rcx*8]
pop rdx
jbe short .not_oom
int3
.not_oom:
lock add qword [fs:globals.fuzz_status + fuzz_status.alloc_charge + rcx*8], rdx
XMMPOP xmm15
pop rdi
pop rdx
pop rcx
pop rbx
pop rax
ret
; bamp_get_phys
;
; Summary:
;
; This performs a manual page table lookup to get the physical address for
; a virtual address. Bounds are not checked. A valid vaddr must be provided!
;
; Parameters:
;
; rbx - Virtual address to look up
;
; Alignment:
;
; None
;
; Returns:
;
; rax - Physical address
;
; Smashes:
;
; rax - Return value
;
; Optimization
;
; Readability
;
bamp_get_phys:
push rdx
mov rdx, cr3
call mm_get_phys
pop rdx
ret
alloc_zero_4k:
push rcx
push rdi
call mm_alloc_phys_4k
push rax
mov rdi, rax
mov ecx, 4096
xor eax, eax
rep stosb
pop rax
pop rdi
pop rcx
ret
; rbx -> vaddr
; rcx -> Mark present? (zero - mark not present, nonzero - mark present)
; rdx -> cr3
bamp_mark_pte_present:
push rax
push rbx
push rdx
; Save the virtual address
mov rax, rbx
; Get CR3
shr rdx, 12
shl rdx, 12
; Get the PML4E
shr rbx, 39
and rbx, 0x1FF
mov rdx, [rdx + rbx * 8]
bt rdx, 0
jnc .fail
shr rdx, 12
shl rdx, 12
; Get the PDPTE
mov rbx, rax
shr rbx, 30
and rbx, 0x1FF
mov rdx, [rdx + rbx * 8]
bt rdx, 0
jnc .fail
shr rdx, 12
shl rdx, 12
btr rdx, 63
; Get the PDE
mov rbx, rax
shr rbx, 21
and rbx, 0x1FF
mov rdx, [rdx + rbx * 8]
bt rdx, 0
jnc .fail
shr rdx, 12
shl rdx, 12
btr rdx, 63
; Get the PTE
mov rbx, rax
shr rbx, 12
and rbx, 0x1FF
test rcx, rcx
jnz short .mark_present
; Mark the PTE not present
btr qword [rdx + rbx * 8], 0
jmp short .fail
.mark_present:
; Mark the PTE present
bts qword [rdx + rbx * 8], 0
.fail:
pop rdx
pop rbx
pop rax
ret
; rbx -> Physical address to probe
; rdx <- Zero if DRAM, nonzero if MMIO
probe_memory_dest:
push rax
push rbx
push rcx
push rbp
lea rax, [rel mmio_routing_table]
mov rcx, 12
.lewp:
mov rdx, qword [rax + 0] ; Base
mov rbp, qword [rax + 8] ; Limit
; If the limit does not exist then go to the next table
test rbp, rbp
jz short .next_table
; If we're < the base, we can't possibly be in this region
cmp rbx, rdx
jb short .next_table
; If we're <= the limit, then we're MMIO
cmp rbx, rbp
jbe short .is_mmio
.next_table:
add rax, 0x10
dec rcx
jnz short .lewp
xor rdx, rdx
jmp short .done
.is_mmio:
mov rdx, 1
.done:
pop rbp
pop rcx
pop rbx
pop rax
ret
; rax <- Physical address to 4k page
mm_alloc_phys_4k:
push rbx
push rcx
; Get the per node entry
mov rbx, qword [gs:thread_local.phys_4k_freelist]
; If the list is dead, allocate a new entry from the global pool
test rbx, rbx
jz short .alloc_new
; Get the next free element and set it as the next free entry
mov rcx, [rbx]
mov qword [gs:thread_local.phys_4k_freelist], rcx
jmp short .done
.alloc_new:
mov rbx, 4096
bamp_alloc rbx
.done:
call bamp_get_phys
pop rcx
pop rbx
ret
; rax <- Physical address to 4k page
mm_rand_alloc_phys_4k:
push rbx
push rcx
; Get the per node entry
mov rbx, qword [gs:thread_local.phys_4k_freelist]
; If the list is dead, allocate a new entry from the global pool
test rbx, rbx
jz short .alloc_new
; Get the next free element and set it as the next free entry
mov rcx, [rbx]
mov qword [gs:thread_local.phys_4k_freelist], rcx
jmp short .done
.alloc_new:
mov rbx, 4096
rand_alloc rbx
.done:
call bamp_get_phys
pop rcx
pop rbx
ret
; rax -> Physical address to 4k page to free
mm_free_phys_4k:
push rbx
; Get the current free list
mov rbx, qword [gs:thread_local.phys_4k_freelist]
; Put the free list link after us
mov [rax], rbx
; Make us the head of the free list
mov qword [gs:thread_local.phys_4k_freelist], rax
pop rbx
ret
; rcx -> Number of bytes to allocate
; rax <- Allocation
mm_mixed_alloc:
push rbx
push rcx
push rdx
push rbp
push r10
push r13
push r14
push r15
; Zero out the return value
xor r15, r15
; Page align the length
add rcx, 0xFFF
and rcx, ~0xFFF
; If there is no length, fail
test rcx, rcx
jz short .done
; Get a vaddr to map to and update the current pointer
mov r10, rcx
lock xadd qword [fs:globals.next_free_vaddr], r10
; Save off the base virtual address
mov r15, r10
; For each page, create a map
.lewp:
call mm_rand_alloc_phys_4k
mov rbx, r10
mov rdx, cr3
lea rbp, [rax + 3] ; Map as R/W
call mm_map_4k
add r10, 4096
sub rcx, 4096
jnz short .lewp
.done:
mov rax, r15
pop r15
pop r14
pop r13
pop r10
pop rbp
pop rdx
pop rcx
pop rbx
ret
; rbx -> Address to linearlly map (rounded down to page boundry)
; rcx -> Number of bytes to linearlly map (rounded up to page boundry)
; rdx -> cr3 of the source
; rax <- Mapping
mm_linear_map:
push rbx
push rcx
push rdx
push rbp
push r10
push r13
push r14
push r15
; Zero out the return value
xor r15, r15
; Get the rounding amount on the address
mov r13, rbx
and r13, 0xFFF
; Round down the address
and rbx, ~0xFFF
; Add the length to the rounded amount and then round it up
lea rcx, [rcx + r13 + 0xFFF]
and rcx, ~0xFFF
; If there is no length, fail
test rcx, rcx
jz short .done
; Get a vaddr to map to and update the current pointer
mov r10, rcx
lock xadd qword [fs:globals.next_free_vaddr], r10
; Save off the base virtual address
mov r14, r10
; For each page, create a map
.lewp:
; Get the physical memory backing this page
call mm_get_phys
; Check if this memory is present
test rax, rax
jnz short .mapped
jmp panic
.mapped:
push rbx
push rdx
push rbp
mov rbx, r10
mov rdx, cr3
lea rbp, [rax + 3] ; Map as R/W
call mm_map_4k
pop rbp
pop rdx
pop rbx
add r10, 4096
add rbx, 4096
sub rcx, 4096
jnz short .lewp
lea r15, [r14 + r13]
.done:
mov rax, r15
pop r15
pop r14
pop r13
pop r10
pop rbp
pop rdx
pop rcx
pop rbx
ret
; rbx -> Guest physical memory to access for write
; rdx -> Guest n_cr3
; rax <- Host physical address for write (zero on failure)
mm_get_phys_with_cow:
push rcx
push rdi
push rsi
push rbp
push r10
; First get the mapping
call mm_get_phys_int
test rax, rax
jz .done
; If the mapping is already writable do nothing
bt rcx, 1
jc .done
; Mapping is not writeable, make a new allocation and map it as writable
; then copy the memory here.
; Get the base address of the original page
mov rsi, rax
mov r10, rax
and rsi, ~0xFFF
and r10, 0xFFF
; Allocate a new page and copy the old contents to it
call mm_alloc_phys_4k
mov rdi, rax
mov rcx, (4096 / 8)
rep movsq
; Create the new mapping
lea rbp, [rax + 7]
call mm_map_4k
; Return the pointer to the new mapping plus the original offset
add rax, r10
.done:
pop r10
pop rbp
pop rsi
pop rdi
pop rcx
ret
; rbx -> Virtual Address
; rdx -> CR3 to use for mapping
; rax <- Physical Address (zero on failure)
mm_get_phys:
push rcx
call mm_get_phys_int
pop rcx
ret
; rbx -> Virtual Address
; rdx -> CR3 to use for mapping
; rax <- Physical Address (zero on failure)
; rcx <- Raw entry
mm_get_phys_int:
push rdx
; ------ PML4 -------------------------------------------------
; Extract the PML4 base address, bits 51:12
bextr rdx, rdx, 0x280c
shl rdx, 12
; Extract the PML4 offset from bits 47:39 of the vaddr
bextr rax, rbx, 0x0927
; Fetch the PML4E and check for presence
mov rdx, qword [rdx + rax*8]
bt rdx, 0
jnc .not_present
; ------ PDP -------------------------------------------------
; Extract the PDP base address, bits 51:12
bextr rdx, rdx, 0x280c
shl rdx, 12
; Extract the PDP offset from bits 38:30 of the vaddr
bextr rax, rbx, 0x091e
; Fetch the PDPE and check for presence
mov rdx, qword [rdx + rax*8]
bt rdx, 0
jnc short .not_present
; Check for 1GB paging
mov eax, (30 << 8) ; Virtual address bextr mask to get physical page offset
bt rdx, 7
jc short .present
; ------ PD -------------------------------------------------
; Extract the PD base address, bits 51:12
bextr rdx, rdx, 0x280c
shl rdx, 12
; Extract the PD offset from bits 29:21 of the vaddr
bextr rax, rbx, 0x0915
; Fetch the PDE and check for presence
mov rdx, qword [rdx + rax*8]
bt rdx, 0
jnc short .not_present
; Check for 2MB paging
mov eax, (21 << 8) ; Virtual address bextr mask to get physical page offset
bt rdx, 7
jc short .present
; ------ PT -------------------------------------------------
; Extract the PT base address, bits 51:12
bextr rdx, rdx, 0x280c
shl rdx, 12
; Extract the PT offset from bits 20:12 of the vaddr
bextr rax, rbx, 0x090c
; Fetch the PTE and check for presence
mov rdx, qword [rdx + rax*8]
bt rdx, 0
jnc short .not_present
; We're using 4KB paging
mov eax, (12 << 8) ; Virtual address bextr mask to get physical page offset
.present:
; At this point
; rax - Mask for bextr to get physical address offset
; (12 for 4KB, 21 for 2MB, and 30 for 1GB)
; rdx - Raw entry from the page table
mov rcx, rdx
; Extract the physical page base address, bits 51:12
bextr rdx, rdx, 0x280c
shl rdx, 12
; Extract the n number of bits from the virtual address to get our offset
bextr rax, rbx, rax
; Calculate the physical address + offset for our final result
add rax, rdx
jmp short .done
.not_present:
xor eax, eax
.done:
pop rdx
ret
; rbx -> Virtual Address
; rdx -> Guest cr3
; rbp -> Guest nested page table
; rax <- Physical Address
mm_guest_virt_to_host_phys:
push rcx
push r10
mov r10, 0
call mm_guest_virt_to_host_phys_int
pop r10
pop rcx
ret
; rbx -> Virtual Address
; rdx -> Guest cr3
; rbp -> Guest nested page table
; rax <- Physical Address
mm_guest_virt_to_host_phys_cow:
push rcx
push r10
mov r10, 1
call mm_guest_virt_to_host_phys_int
pop r10
pop rcx
ret
; rbx -> Virtual Address
; rdx -> Guest cr3
; rbp -> Guest nested page table
; r10 -> 0 - read access, 1 - write access
; rax <- Physical Address
; rcx <- Raw page table entry (in a failure case, it's the contents of the non
; present data)
mm_guest_virt_to_host_phys_int:
push rdx
xor rcx, rcx
; ------ PML4 -------------------------------------------------
; Extract the PML4 base address, bits 51:12
bextr rdx, rdx, 0x280c
shl rdx, 12
; Translate guest physical into host physical via ncr3
push rax
push rbx
mov rbx, rdx
mov rdx, rbp
call mm_get_phys
mov rdx, rax
pop rbx
pop rax
; Validate that the guest physical to host physical was successful
test rdx, rdx
jz .not_present
; Extract the PML4 offset from bits 47:39 of the vaddr
bextr rax, rbx, 0x0927
; Fetch the PML4E and check for presence
mov rdx, qword [rdx + rax*8]
mov rcx, rdx
bt rdx, 0
jnc .not_present
; ------ PDP -------------------------------------------------
; Extract the PDP base address, bits 51:12
bextr rdx, rdx, 0x280c
shl rdx, 12
; Translate guest physical into host physical via ncr3
push rax
push rbx
mov rbx, rdx
mov rdx, rbp
call mm_get_phys
mov rdx, rax
pop rbx
pop rax
; Validate that the guest physical to host physical was successful
test rdx, rdx
jz .not_present
; Extract the PDP offset from bits 38:30 of the vaddr
bextr rax, rbx, 0x091e
; Fetch the PDPE and check for presence
mov rdx, qword [rdx + rax*8]
mov rcx, rdx
bt rdx, 0
jnc .not_present
; Check for 1GB paging
mov eax, (30 << 8) ; Virtual address bextr mask to get physical page offset
bt rdx, 7
jc .present
; ------ PD -------------------------------------------------
; Extract the PD base address, bits 51:12
bextr rdx, rdx, 0x280c
shl rdx, 12
; Translate guest physical into host physical via ncr3
push rax
push rbx
mov rbx, rdx
mov rdx, rbp
call mm_get_phys
mov rdx, rax
pop rbx
pop rax
; Validate that the guest physical to host physical was successful
test rdx, rdx
jz .not_present
; Extract the PD offset from bits 29:21 of the vaddr
bextr rax, rbx, 0x0915
; Fetch the PDE and check for presence
mov rdx, qword [rdx + rax*8]
mov rcx, rdx
bt rdx, 0
jnc .not_present
; Check for 2MB paging
mov eax, (21 << 8) ; Virtual address bextr mask to get physical page offset
bt rdx, 7
jc short .present
; ------ PT -------------------------------------------------
; Extract the PT base address, bits 51:12
bextr rdx, rdx, 0x280c
shl rdx, 12
; Translate guest physical into host physical via ncr3
push rax
push rbx
mov rbx, rdx
mov rdx, rbp
call mm_get_phys
mov rdx, rax
pop rbx
pop rax
; Validate that the guest physical to host physical was successful
test rdx, rdx
jz .not_present
; Extract the PT offset from bits 20:12 of the vaddr
bextr rax, rbx, 0x090c
; Fetch the PTE and check for presence
mov rdx, qword [rdx + rax*8]
mov rcx, rdx
bt rdx, 0
jnc short .not_present
; We're using 4KB paging
mov eax, (12 << 8) ; Virtual address bextr mask to get physical page offset
.present:
; At this point
; rax - Mask for bextr to get physical address offset
; (12 for 4KB, 21 for 2MB, and 30 for 1GB)
; rdx - Raw entry from the page table
; Extract the physical page base address, bits 51:12
bextr rdx, rdx, 0x280c
shl rdx, 12
; Extract the n number of bits from the virtual address to get our offset
bextr rax, rbx, rax
; Calculate the physical address + offset for our final result
add rax, rdx
; Translate guest physical into host physical via ncr3
push rbx
mov rbx, rax
mov rdx, rbp
test r10, r10
jnz short .cow
call mm_get_phys
jmp short .done_cow
.cow:
call mm_get_phys_with_cow
.done_cow:
pop rbx
; Validate that the guest physical to host physical was successful
test rax, rax
jz .not_present
jmp short .done
.not_present:
xor eax, eax
.done:
pop rdx
ret
; rbx -> Virtual address to make a map for
; rdx -> Page table base address (what you would have in cr3) [allocated already]
; rbp -> Physical page to describe with this vaddr
mm_map_4k:
push rax
push rcx
push rdx
push rsi
; ------ PML4 -------------------------------------------------
; Extract the PML4 base address, bits 51:12
bextr rdx, rdx, 0x280c
shl rdx, 12
; Extract the PML4 offset from bits 47:39 of the vaddr
bextr rcx, rbx, 0x0927
; Fetch the PML4E and check for presence
mov rsi, qword [rdx + rcx*8]
bt rsi, 0
jc .already_mapped_pml4
; Allocate PML4E as RW, present, and user
call alloc_zero_4k
or rax, 7 | (3 << 9)
bts rax, 62
bts rax, 61
mov qword [rdx + rcx*8], rax
mov rsi, rax
; ------ PDP -------------------------------------------------
.already_mapped_pml4:
; Extract the PDP base address, bits 51:12
bextr rdx, rsi, 0x280c
shl rdx, 12
; Extract the PDP offset from bits 38:30 of the vaddr
bextr rcx, rbx, 0x091e
; Fetch the PDPE and check for presence
mov rsi, qword [rdx + rcx*8]
bt rsi, 0
jc .already_mapped_pdp
; Allocate PDPE as RW, present, and user
call alloc_zero_4k
or rax, 7 | (2 << 9)
bts rax, 62
bts rax, 61
mov qword [rdx + rcx*8], rax
mov rsi, rax
; ------ PD -------------------------------------------------
.already_mapped_pdp:
; Extract the PD base address, bits 51:12
bextr rdx, rsi, 0x280c
shl rdx, 12
; Extract the PD offset from bits 29:21 of the vaddr
bextr rcx, rbx, 0x0915
; Fetch the PDE and check for presence
mov rsi, qword [rdx + rcx*8]
bt rsi, 0
jc .already_mapped_pde
; Allocate PDE as RW, present, and user
call alloc_zero_4k
or rax, 7 | (1 << 9)
bts rax, 62
bts rax, 61
mov qword [rdx + rcx*8], rax
mov rsi, rax
; ------ PT -------------------------------------------------
.already_mapped_pde:
; Extract the PT base address, bits 51:12
bextr rdx, rsi, 0x280c
shl rdx, 12
; Extract the PT offset from bits 20:12 of the vaddr
bextr rcx, rbx, 0x090c
; Fetch the PTE and check for presence
;mov rsi, qword [rdx + rcx*8]
;bt rsi, 0
;jc .already_mapped_pte
; Move in specified value as PTE
bts rbp, 62
bts rbp, 61
mov qword [rdx + rcx*8], rbp
.already_mapped_pte:
pop rsi
pop rdx
pop rcx
pop rax
ret
; Allocate contiguous physical memory by discarding anything that isn't. This
; can very dangerously exhaust memory!!! For anything <= 4K, simply call
; mm_alloc_phys_4k
;
; rcx -> Number of physically contiguous bytes needed
; rax <- Physical address to memory
;
mm_alloc_contig_phys:
push rbx
push rcx
push rdx
push rdi
push rsi
push rbp
; Round up bytes requested to next 4k boundry
add rcx, 0xFFF
and rcx, ~0xFFF
; Prevent an infinite loop on the zero case
test rcx, rcx
jz short .fail
; Save off the aligned number of bytes needed
mov rbp, rcx
; Store cr3 in rdx for mm_get_phys calls
mov rdx, cr3
.try_another_allocation:
; Restore number of bytes needed
mov rcx, rbp
; Allocate!
mov rbx, rcx
bamp_alloc rbx
; Get the number of contiguous pages we need
shr rcx, 12
; Get the physical address of the first page
call mm_get_phys
mov rsi, rax
mov rdi, rax
.for_each_page:
add rbx, 4096
dec rcx
jz short .done
; Get the physical address of the next page
call mm_get_phys
; Did our next page follow directly after the previous? If not, try again!
add rsi, 4096
cmp rsi, rax
jne short .try_another_allocation
jmp short .for_each_page
.done:
; Get the original physical address
mov rax, rdi
jmp short .end
.fail:
xor eax, eax
.end:
pop rbp
pop rsi
pop rdi
pop rdx
pop rcx
pop rbx
ret
; rdx -> CR3 to use for mapping
; rbp -> Function to call with each dirty page
; r13 -> Pointer to page entry
; rbx -> Virtual address
mm_for_each_dirty_4k:
push rax
push rbx
push r10
push r11
push r12
push r13
push r14
; Extract the PML4 base address, bits 51:12
bextr r10, rdx, 0x280c
shl r10, 12
.for_each_pml4:
; Fetch the PML4E and check for presence
mov r11, qword [r10]
bt r11, 0
jnc .next_pml4
; If the entry is not accessed, ignore
bt r11, 5
jnc .next_pml4
; Extract the PDP base address, bits 51:12
bextr r11, r11, 0x280c
shl r11, 12
.for_each_pdpe:
; Fetch the PDPE and check for presence
mov r12, qword [r11]
bt r12, 0
jnc .next_pdpe
; If the entry is not accessed, ignore
bt r12, 5
jnc .next_pdpe
; Extract the PD base address, bits 51:12
bextr r12, r12, 0x280c
shl r12, 12
.for_each_pde:
; Fetch the PDPE and check for presence
mov r13, qword [r12]
bt r13, 0
jnc .next_pde
; If the entry is not accessed, ignore
bt r13, 5
jnc .next_pde
; Extract the PT base address, bits 51:12
bextr r13, r13, 0x280c
shl r13, 12
.for_each_pte:
; Fetch the PTE and check for presence
mov r14, qword [r13]
bt r14, 0
jnc .next_pte
; If the entry is not dirty, ignore
bt r14, 6
jnc .next_pte
; Compute the virtual address for this map
xor rbx, rbx
bextr rax, r10, 0x0c00
shl rax, (39 - 3)
or rbx, rax
bextr rax, r11, 0x0c00
shl rax, (30 - 3)
or rbx, rax
bextr rax, r12, 0x0c00
shl rax, (21 - 3)
or rbx, rax
bextr rax, r13, 0x0c00
shl rax, (12 - 3)
or rbx, rax
call rbp
.next_pte:
btr qword [r13], 5 ; Clear accessed
btr qword [r13], 6 ; Clear dirty
add r13, 8
test r13, 0xfff
jnz short .for_each_pte
.next_pde:
btr qword [r12], 5 ; Clear accessed
btr qword [r12], 6 ; Clear dirty
add r12, 8
test r12, 0xfff
jnz .for_each_pde
.next_pdpe:
btr qword [r11], 5 ; Clear accessed
btr qword [r11], 6 ; Clear dirty
add r11, 8
test r11, 0xfff
jnz .for_each_pdpe
.next_pml4:
btr qword [r10], 5 ; Clear accessed
btr qword [r10], 6 ; Clear dirty
add r10, 8
test r10, 0xfff
jnz .for_each_pml4
.done:
pop r14
pop r13
pop r12
pop r11
pop r10
pop rbx
pop rax
ret
; rdx -> CR3 to clean
mm_clean_all_pages:
push r10
push r11
push r12
push r13
push r14
; Extract the PML4 base address, bits 51:12
bextr r10, rdx, 0x280c
shl r10, 12
.for_each_pml4:
; Fetch the PML4E and check for presence
mov r11, qword [r10]
bt r11, 0
jnc .next_pml4
; Clear both the accessed and dirty flags
and qword [r10], ~((1 << 6) | (1 << 5))
; Extract the PDP base address, bits 51:12
bextr r11, r11, 0x280c
shl r11, 12
.for_each_pdpe:
; Fetch the PDPE and check for presence
mov r12, qword [r11]
bt r12, 0
jnc .next_pdpe
; Clear both the accessed and dirty flags
and qword [r11], ~((1 << 6) | (1 << 5))
; Extract the PD base address, bits 51:12
bextr r12, r12, 0x280c
shl r12, 12
.for_each_pde:
; Fetch the PDPE and check for presence
mov r13, qword [r12]
bt r13, 0
jnc .next_pde
; Clear both the accessed and dirty flags
and qword [r12], ~((1 << 6) | (1 << 5))
; Extract the PT base address, bits 51:12
bextr r13, r13, 0x280c
shl r13, 12
.for_each_pte:
; Fetch the PTE and check for presence
mov r14, qword [r13]
bt r14, 0
jnc .next_pte
; Clear both the accessed and dirty flags
and qword [r13], ~((1 << 6) | (1 << 5))
.next_pte:
add r13, 8
test r13, 0xfff
jnz short .for_each_pte
.next_pde:
add r12, 8
test r12, 0xfff
jnz short .for_each_pde
.next_pdpe:
add r11, 8
test r11, 0xfff
jnz short .for_each_pdpe
.next_pml4:
add r10, 8
test r10, 0xfff
jnz .for_each_pml4
.done:
pop r14
pop r13
pop r12
pop r11
pop r10
ret
; rsi -> Host resident vaddr to copy from
; rdi -> Guest resident vaddr to copy to
; rcx -> Number of bytes to copy
; rdx -> Guest CR3
; rbp -> Nested CR3
mm_copy_to_guest_vm:
push rax
push rbx
push rcx
push rsi
push rdi
push r8
; Bail on the nothing to copy case
test rcx, rcx
jz short .done
; Fetch a host physical mapping to the guest memory
mov rbx, rdi
call mm_guest_virt_to_host_phys_cow
test rax, rax
jz short .done
.lewp:
; Check if we're on a new page boundry
test rdi, 0xFFF
jnz short .not_new_page
; If we're on a new page boundry, get the new page address
mov rbx, rdi
call mm_guest_virt_to_host_phys_cow
test rax, rax
jz short .done
.not_new_page:
mov r8b, byte [rsi]
mov byte [rax], r8b
inc rax ; Increment guest paddr
inc rsi ; Increment host vaddr
inc rdi ; Increment guest vaddr
dec rcx ; Decrement count
jnz short .lewp
.done:
pop r8
pop rdi
pop rsi
pop rcx
pop rbx
pop rax
ret
; rsi -> Host resident vaddr to copy from
; rdi -> Guest resident vaddr to copy to
; rcx -> Number of bytes to copy
mm_copy_to_guest_vm_vmcb:
push rax
push rdx
push rbp
mov rax, [gs:thread_local.VMCB]
mov rdx, [rax + VMCB.cr3]
mov rbp, [rax + VMCB.n_cr3]
call mm_copy_to_guest_vm
pop rbp
pop rdx
pop rax
ret
; rdx -> Address to read qword from
; rdx <- Result
mm_read_guest_qword:
push rax
push rsi
push rdi
push rcx
push rbp
sub rsp, 0x8
mov rdi, rsp
mov rsi, rdx
mov rcx, 0x8
mov rax, [gs:thread_local.VMCB]
mov rdx, [rax + VMCB.cr3]
mov rbp, [rax + VMCB.n_cr3]
call mm_copy_from_guest_vm
mov rdx, qword [rsp]
add rsp, 0x8
pop rbp
pop rcx
pop rdi
pop rsi
pop rax
ret
; rdx -> Address to write qword to
; rbx -> Value to write
mm_write_guest_qword:
push rax
push rsi
push rdi
push rcx
push rdx
push rbp
sub rsp, 0x8
mov qword [rsp], rbx
mov rsi, rsp
mov rdi, rdx
mov rcx, 0x8
mov rax, [gs:thread_local.VMCB]
mov rdx, [rax + VMCB.cr3]
mov rbp, [rax + VMCB.n_cr3]
call mm_copy_to_guest_vm
add rsp, 0x8
pop rbp
pop rdx
pop rcx
pop rdi
pop rsi
pop rax
ret
; rdx -> Address to read qword from
; rdx <- Result
mm_read_guest_qword_phys:
push rax
push rbx
push rbp
mov rbx, rdx
mov rax, [gs:thread_local.VMCB]
mov rdx, [rax + VMCB.n_cr3]
call mm_get_phys
test rax, rax
jz short .fail
mov rdx, [rax]
.fail:
pop rbp
pop rbx
pop rax
ret
; rdx -> Address to write qword to
; rbx -> Value to write
mm_write_guest_qword_phys:
push rax
push rbx
push rcx
push rbp
push rbx
mov rbx, rdx
mov rax, [gs:thread_local.VMCB]
mov rdx, [rax + VMCB.n_cr3]
call mm_get_phys_with_cow
test rax, rax
pop rbx
jz short .fail
mov [rax], rbx
.fail:
pop rbp
pop rcx
pop rbx
pop rax
ret
; rsi -> Guest resident vaddr to copy from
; rdi -> Host resident vaddr to copy to
; rcx -> Number of bytes to copy
mm_copy_from_guest_vm_vmcb:
push rax
push rdx
push rbp
mov rax, [gs:thread_local.VMCB]
mov rdx, [rax + VMCB.cr3]
mov rbp, [rax + VMCB.n_cr3]
call mm_copy_from_guest_vm
pop rbp
pop rdx
pop rax
ret
; rsi -> Guest resident vaddr to copy from
; rdi -> Host resident vaddr to copy to
; rcx -> Number of bytes to copy
; rdx -> Guest CR3
; rbp -> Nested CR3
mm_copy_from_guest_vm:
push rax
push rbx
push rcx
push rsi
push rdi
push r8
; Bail on the nothing to copy case
test rcx, rcx
jz short .done
; Fetch a host physical mapping to the guest memory
mov rbx, rsi
call mm_guest_virt_to_host_phys
test rax, rax
jz short .done
.lewp:
; Check if we're on a new page boundry
test rsi, 0xFFF
jnz short .not_new_page
; If we're on a new page boundry, get the new page address
mov rbx, rsi
call mm_guest_virt_to_host_phys
test rax, rax
jz short .done
.not_new_page:
mov r8b, byte [rax]
mov byte [rdi], r8b
inc rax ; Increment guest paddr
inc rsi ; Increment guest vaddr
inc rdi ; Increment host vaddr
dec rcx ; Decrement count
jnz short .lewp
.done:
pop r8
pop rdi
pop rsi
pop rcx
pop rbx
pop rax
ret
; sil -> Byte to set (second argument to memset())
; rdi -> Guest resident vaddr to copy to
; rcx -> Number of bytes to copy
; rdx -> Guest CR3
; rbp -> Nested CR3
mm_memset:
push rax
push rbx
push rcx
push rdi
push r8
; Bail on the nothing to copy case
test rcx, rcx
jz short .done
; Fetch a host physical mapping to the guest memory
mov rbx, rdi
call mm_guest_virt_to_host_phys
test rax, rax
jz short .done
.lewp:
; Check if we're on a new page boundry
test rdi, 0xFFF
jnz short .not_new_page
; If we're on a new page boundry, get the new page address
mov rbx, rdi
call mm_guest_virt_to_host_phys
test rax, rax
jz short .done
.not_new_page:
mov byte [rax], sil
inc rax ; Increment guest paddr
inc rdi ; Increment guest vaddr
dec rcx ; Decrement count
jnz short .lewp
.done:
pop r8
pop rdi
pop rcx
pop rbx
pop rax
ret
; sil -> Byte to set (second argument to memset())
; rdi -> Guest resident vaddr to copy to
; rcx -> Number of bytes to copy
; rdx -> Guest CR3
; rbp -> Nested CR3
mm_memset_backwards:
push rax
push rbx
push rcx
push rdi
push r8
push r9
; Bail on the nothing to copy case
test rcx, rcx
jz short .done
; Fetch a host physical mapping to the guest memory
mov rbx, rdi
call mm_guest_virt_to_host_phys
test rax, rax
jz short .done
.lewp:
; Check if we're on a new page boundry
mov r9, rdi
and r9, 0xFFF
cmp r9, 0xFFF
jne short .not_new_page
; If we're on a new page boundry, get the new page address
mov rbx, rdi
call mm_guest_virt_to_host_phys
test rax, rax
jz short .done
.not_new_page:
mov byte [rax], sil
dec rax ; Decrement guest paddr
dec rdi ; Decrement guest vaddr
dec rcx ; Decrement count
jnz short .lewp
.done:
pop r9
pop r8
pop rdi
pop rcx
pop rbx
pop rax
ret
; rcx -> Size in bytes to allocate in the guest
; rcx <- Guest physical address of the allocation
mm_guest_allocate_phys:
push rax
push rbx
push rdx
push rbp
push r15
add rcx, 0xFFF
and rcx, ~0xFFF
jz .done
.try_alloc_phys:
call xorshift64
mov rbx, 0x7FFFFFFFF000
and r15, rbx
; Get the number of pages to allocate
mov rbp, rcx
shr rbp, 12
mov rbx, r15
.next_phys_page:
; Get the current mapping. If this page is present, try all over again
mov rax, [gs:thread_local.VMCB]
mov rdx, [rax + VMCB.n_cr3]
call mm_get_phys
test rax, rax
jnz short .try_alloc_phys
add rbx, 4096
dec rbp
jnz short .next_phys_page
; rcx - Size to allocate, in bytes
; r15 - Physical memory location to map to
mov rbp, rcx
shr rbp, 12
mov rbx, r15
.alloc_phys_page:
push rbp
call mm_alloc_phys_4k
push rax
mov rax, [gs:thread_local.VMCB]
mov rdx, [rax + VMCB.n_cr3]
pop rax
lea rbp, [rax + 7]
call mm_map_4k
pop rbp
add rbx, 4096
dec rbp
jnz short .alloc_phys_page
mov rcx, r15
.done:
pop r15
pop rbp
pop rdx
pop rbx
pop rax
ret
; rcx -> Size to allocate in guest (in bytes)
; rcx <- Guest virtual address of the buffer
; The buffer returned from this function is present in both host and guest
; virtual memory. Meaning the host can access this memory directly as well.
mm_guest_allocate_virt:
push rax
push rbx
push rdx
push rbp
push r12
push r13
push r14
push r15
add rcx, 0xFFF
and rcx, ~0xFFF
jz .done
push rcx
call mm_guest_allocate_phys
mov r14, rcx
pop rcx
; Now we try to find room in the virtual mapping
.try_alloc_virt:
call xorshift64
mov rbx, 0x7FFFFFFFF000
and r15, rbx
; Get the number of pages to allocate
mov rbp, rcx
shr rbp, 12
mov rbx, r15
.next_virt_page:
; Get the current mapping. If this page is present, try all over again
mov rax, [gs:thread_local.VMCB]
mov rdx, [rax + VMCB.cr3]
bextr rax, rbx, 0x0927
lea rdx, [rdx + rax*8]
call mm_read_guest_qword_phys
bt rdx, 0
jc .try_alloc_virt
mov rdx, cr3
call mm_get_phys
test rax, rax
jnz short .try_alloc_virt
add rbx, 4096
dec rbp
jnz short .next_virt_page
; At this point we know that the guest virtual space has enough room for
; rcx bytes at virtual address r15
mov r13, rcx
shr r13, 12
mov rbx, r15
mov r12, r14
.map_virt_page:
lea rbp, [r12 + 7]
call mm_guest_map_4k
test rax, rax
jz .try_alloc_virt
mov rax, [gs:thread_local.VMCB]
mov rdx, [rax + VMCB.cr3]
mov rbp, [rax + VMCB.n_cr3]
call mm_guest_virt_to_host_phys
test rax, rax
jz .try_alloc_virt
mov rdx, cr3
lea rbp, [rax + 7]
call mm_map_4k
add rbx, 4096
add r12, 4096
dec r13
jnz .map_virt_page
mov rcx, r15
.done:
pop r15
pop r14
pop r13
pop r12
pop rbp
pop rdx
pop rbx
pop rax
ret
; rax <- Guest physical address
guest_alloc_zero_4k:
push rbx
push rcx
push rdx
push rdi
mov rax, [gs:thread_local.VMCB]
mov rcx, 4096
call mm_guest_allocate_phys
mov rbx, rcx
mov rdx, [rax + VMCB.n_cr3]
call mm_get_phys
test rax, rax
jz panic
mov rdi, rax
mov rcx, (4096 / 8)
xor eax, eax
rep stosq
mov rax, rbx
pop rdi
pop rdx
pop rcx
pop rbx
ret
; rbx -> Virtual address to map
; rbp -> Entry to place in for the mapping
mm_guest_map_4k:
push rcx
push rdx
push rsi
mov rax, [gs:thread_local.VMCB]
mov rdx, [rax + VMCB.cr3]
; ------ PML4 -------------------------------------------------
; Extract the PML4 base address, bits 51:12
bextr rdx, rdx, 0x280c
shl rdx, 12
; Extract the PML4 offset from bits 47:39 of the vaddr
bextr rcx, rbx, 0x0927
; Fetch the PML4E and check for presence
push rdx
lea rdx, [rdx + rcx*8]
call mm_read_guest_qword_phys
mov rsi, rdx
pop rdx
bt rsi, 0
jc .already_mapped_pml4
; Allocate PML4E as RW, present, and user
call guest_alloc_zero_4k
or rax, 7
push rbx
push rdx
lea rdx, [rdx + rcx*8]
mov rbx, rax
call mm_write_guest_qword_phys
pop rdx
pop rbx
mov rsi, rax
; ------ PDP -------------------------------------------------
.already_mapped_pml4:
; Make sure the memory is user and writable and not a large page
bt rsi, 1
jnc .unmapable_memory
bt rsi, 2
jnc .unmapable_memory
bt rsi, 7
jc .unmapable_memory
; Extract the PDP base address, bits 51:12
bextr rdx, rsi, 0x280c
shl rdx, 12
; Extract the PDP offset from bits 38:30 of the vaddr
bextr rcx, rbx, 0x091e
; Fetch the PDPE and check for presence
push rdx
lea rdx, [rdx + rcx*8]
call mm_read_guest_qword_phys
mov rsi, rdx
pop rdx
bt rsi, 0
jc .already_mapped_pdp
; Allocate PDPE as RW, present, and user
call guest_alloc_zero_4k
or rax, 7
push rbx
push rdx
lea rdx, [rdx + rcx*8]
mov rbx, rax
call mm_write_guest_qword_phys
pop rdx
pop rbx
mov rsi, rax
; ------ PD -------------------------------------------------
.already_mapped_pdp:
; Make sure the memory is user and writable and not a large page
bt rsi, 1
jnc .unmapable_memory
bt rsi, 2
jnc .unmapable_memory
bt rsi, 7
jc .unmapable_memory
; Extract the PD base address, bits 51:12
bextr rdx, rsi, 0x280c
shl rdx, 12
; Extract the PD offset from bits 29:21 of the vaddr
bextr rcx, rbx, 0x0915
; Fetch the PDE and check for presence
push rdx
lea rdx, [rdx + rcx*8]
call mm_read_guest_qword_phys
mov rsi, rdx
pop rdx
bt rsi, 0
jc .already_mapped_pde
; Allocate PDE as RW, present, and user
call guest_alloc_zero_4k
or rax, 7
push rbx
push rdx
lea rdx, [rdx + rcx*8]
mov rbx, rax
call mm_write_guest_qword_phys
pop rdx
pop rbx
mov rsi, rax
; ------ PT -------------------------------------------------
.already_mapped_pde:
; Make sure the memory is user and writable and not a large page
bt rsi, 1
jnc .unmapable_memory
bt rsi, 2
jnc .unmapable_memory
bt rsi, 7
jc .unmapable_memory
; Extract the PT base address, bits 51:12
bextr rdx, rsi, 0x280c
shl rdx, 12
; Extract the PT offset from bits 20:12 of the vaddr
bextr rcx, rbx, 0x090c
; Move in specified value as PTE
push rbx
push rdx
lea rdx, [rdx + rcx*8]
mov rbx, rbp
call mm_write_guest_qword_phys
pop rdx
pop rbx
mov eax, 1
jmp short .done
.unmapable_memory:
xor eax, eax
.done:
pop rsi
pop rdx
pop rcx
ret
; rbx -> nested page table to use
iommu_init:
push rax
push rbx
push rcx
push rdx
push rbp
push rdi
; get the low 32-bits of the IOMMU base address
mov eax, (0x00 << 16) | (0x00 << 11) | (0x02 << 8) | (1 << 31) | 0x44
mov dx, 0x0CF8
out dx, eax
mov dx, 0x0CFC
in eax, dx
mov ebp, eax
and ebp, ~0x3FFF
; get the high 32-bits of the IOMMU base address
mov eax, (0x00 << 16) | (0x00 << 11) | (0x02 << 8) | (1 << 31) | 0x48
mov dx, 0x0CF8
out dx, eax
mov dx, 0x0CFC
in eax, dx
shl rax, 32
or rbp, rax
; rbp now contains the IOMMU base address
; Allocate the device table
mov rcx, (2 * 1024 * 1024)
call mm_alloc_contig_phys
; Zero out the device table
mov rdi, rax
mov rcx, (2 * 1024 * 1024)
call bzero
; Create our device table entry template
; IW - Enable DMA writes
; IR - Enable DMA reads
; Mode - 4 level page table
; TV - Translation information valid
; V - DTE valid
mov rdx, (1 << 62) | (1 << 61) | (4 << 9) | (1 << 1) | (1 << 0)
or rdx, rbx ; Add in the page table root pointer
; Fill in the device table
xor ecx, ecx
.lewp:
mov qword [rdi + rcx], rdx
add ecx, 32
cmp ecx, (2 * 1024 * 1024)
jb short .lewp
; Set up the device table base (with maximum size of 0x1ff)
or rdi, 0x1ff
mov qword [rbp + 0x00], rdi
; Enable the IOMMU :)
bts qword [rbp + 0x18], 0
pop rdi
pop rbp
pop rdx
pop rcx
pop rbx
pop rax
ret
; rdi -> Dest
; rsi -> Source
; rcx -> Length
memmove:
memcpy:
push rcx
push rsi
push rdi
; If there is nothing to be copied, do nothing.
test rcx, rcx
jz short .done
; If the dest and source are the same, there is no effect, don't copy.
cmp rsi, rdi
je short .done
ja short .copy_forwards
.copy_backwards:
std
lea rsi, [rsi + rcx - 1]
lea rdi, [rdi + rcx - 1]
.copy_forwards:
rep movsb
.done:
cld
pop rdi
pop rsi
pop rcx
ret
| 17.832444 | 81 | 0.67308 |
a01036b5b9eeb879c8f8ea92abf1e6ebd1114200 | 6,153 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_sm_/i9-9900K_12_0xca_notsx.log_21829_1241.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_sm_/i9-9900K_12_0xca_notsx.log_21829_1241.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_sm_/i9-9900K_12_0xca_notsx.log_21829_1241.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 %rax
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x6b97, %rax
nop
nop
nop
nop
sub %rdx, %rdx
vmovups (%rax), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $1, %xmm1, %rcx
nop
nop
nop
nop
nop
and $48710, %rbp
lea addresses_WT_ht+0x12a1b, %rsi
lea addresses_WC_ht+0x7e37, %rdi
nop
nop
dec %r14
mov $123, %rcx
rep movsb
nop
nop
sub $56724, %r14
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %r9
push %rax
push %rcx
push %rsi
// Store
lea addresses_PSE+0x1f637, %r12
nop
xor %r9, %r9
mov $0x5152535455565758, %rax
movq %rax, %xmm4
vmovups %ymm4, (%r12)
nop
nop
nop
dec %rax
// Load
lea addresses_PSE+0x124bf, %rsi
nop
nop
nop
nop
sub $61195, %rcx
mov (%rsi), %r13w
nop
nop
xor $63473, %rsi
// Store
lea addresses_UC+0x1de37, %r13
xor %r12, %r12
mov $0x5152535455565758, %r11
movq %r11, %xmm1
vmovups %ymm1, (%r13)
xor %rsi, %rsi
// Store
mov $0xc37, %rax
sub $40273, %rcx
movl $0x51525354, (%rax)
add %r11, %r11
// Store
mov $0x3021970000000077, %rax
add %r12, %r12
movw $0x5152, (%rax)
nop
nop
dec %r13
// Load
lea addresses_PSE+0x19d13, %rsi
nop
nop
nop
sub $42544, %rcx
movups (%rsi), %xmm6
vpextrq $1, %xmm6, %rax
nop
nop
xor $19052, %r9
// Store
mov $0x537, %rcx
cmp $50429, %rax
mov $0x5152535455565758, %r12
movq %r12, (%rcx)
and %r13, %r13
// Faulty Load
lea addresses_PSE+0x1f637, %rcx
nop
add $36998, %r11
movups (%rcx), %xmm7
vpextrq $0, %xmm7, %r13
lea oracles, %rsi
and $0xff, %r13
shlq $12, %r13
mov (%rsi,%r13,1), %r13
pop %rsi
pop %rcx
pop %rax
pop %r9
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_P', 'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 4}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_P', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 7}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_WT_ht'}, 'dst': {'same': True, 'congruent': 11, 'type': 'addresses_WC_ht'}}
{'58': 21829}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
| 39.191083 | 2,999 | 0.652852 |
14aabf69900514e7f5e9de73f3f9bedcf2f85cf1 | 26,773 | asm | Assembly | z80sbcFiles/source/cbios128.asm | roberts7531/z80Computer | 28623b04db6c936bc43dd01dde4b736ec99cae67 | [
"CC0-1.0"
] | null | null | null | z80sbcFiles/source/cbios128.asm | roberts7531/z80Computer | 28623b04db6c936bc43dd01dde4b736ec99cae67 | [
"CC0-1.0"
] | null | null | null | z80sbcFiles/source/cbios128.asm | roberts7531/z80Computer | 28623b04db6c936bc43dd01dde4b736ec99cae67 | [
"CC0-1.0"
] | null | null | null | ;==================================================================================
; Contents of this file are copyright Grant Searle
; Blocking/unblocking routines are the published version by Digital Research
; (bugfixed, as found on the web)
;
; You have permission to use this for NON COMMERCIAL USE ONLY
; If you wish to use it elsewhere, please include an acknowledgement to myself.
;
; http://searle.hostei.com/grant/index.html
;
; eMail: home.micros01@btinternet.com
;
; If the above don't work, please perform an Internet search to see if I have
; updated the web page hosting service.
;
;==================================================================================
ccp .EQU 0D000h ; Base of CCP.
bdos .EQU ccp + 0806h ; Base of BDOS.
bios .EQU ccp + 1600h ; Base of BIOS.
; Set CP/M low memory datA, vector and buffer addresses.
iobyte .EQU 03h ; Intel standard I/O definition byte.
userdrv .EQU 04h ; Current user number and drive.
tpabuf .EQU 80h ; Default I/O buffer and command line storage.
SER_BUFSIZE .EQU 60
SER_FULLSIZE .EQU 50
SER_EMPTYSIZE .EQU 5
RTS_HIGH .EQU 0E8H
RTS_LOW .EQU 0EAH
SIOA_D .EQU $00
SIOA_C .EQU $02
SIOB_D .EQU $01
SIOB_C .EQU $03
int38 .EQU 38H
nmi .EQU 66H
blksiz .equ 4096 ;CP/M allocation size
hstsiz .equ 512 ;host disk sector size
hstspt .equ 32 ;host disk sectors/trk
hstblk .equ hstsiz/128 ;CP/M sects/host buff
cpmspt .equ hstblk * hstspt ;CP/M sectors/track
secmsk .equ hstblk-1 ;sector mask
;compute sector mask
;secshf .equ 2 ;log2(hstblk)
wrall .equ 0 ;write to allocated
wrdir .equ 1 ;write to directory
wrual .equ 2 ;write to unallocated
; CF registers
CF_DATA .EQU $10
CF_FEATURES .EQU $11
CF_ERROR .EQU $11
CF_SECCOUNT .EQU $12
CF_SECTOR .EQU $13
CF_CYL_LOW .EQU $14
CF_CYL_HI .EQU $15
CF_HEAD .EQU $16
CF_STATUS .EQU $17
CF_COMMAND .EQU $17
CF_LBA0 .EQU $13
CF_LBA1 .EQU $14
CF_LBA2 .EQU $15
CF_LBA3 .EQU $16
;CF Features
CF_8BIT .EQU 1
CF_NOCACHE .EQU 082H
;CF Commands
CF_READ_SEC .EQU 020H
CF_WRITE_SEC .EQU 030H
CF_SET_FEAT .EQU 0EFH
LF .EQU 0AH ;line feed
FF .EQU 0CH ;form feed
CR .EQU 0DH ;carriage RETurn
;================================================================================================
.ORG bios ; BIOS origin.
;================================================================================================
; BIOS jump table.
;================================================================================================
JP boot ; 0 Initialize.
wboote: JP wboot ; 1 Warm boot.
JP const ; 2 Console status.
JP conin ; 3 Console input.
JP conout ; 4 Console OUTput.
JP list ; 5 List OUTput.
JP punch ; 6 punch OUTput.
JP reader ; 7 Reader input.
JP home ; 8 Home disk.
JP seldsk ; 9 Select disk.
JP settrk ; 10 Select track.
JP setsec ; 11 Select sector.
JP setdma ; 12 Set DMA ADDress.
JP read ; 13 Read 128 bytes.
JP write ; 14 Write 128 bytes.
JP listst ; 15 List status.
JP sectran ; 16 Sector translate.
;================================================================================================
; Disk parameter headers for disk 0 to 15
;================================================================================================
; disk Parameter header for disk 00
dpbase: .DW 0000h, 0000h
.DW 0000h, 0000h
.DW dirbf, dpblk
.DW chk00, all00
; disk parameter header for disk 01
.DW 0000h, 0000h
.DW 0000h, 0000h
.DW dirbf, dpblk
.DW chk01, all01
; disk parameter header for disk 02
.DW 0000h, 0000h
.DW 0000h, 0000h
.DW dirbf, dpblk
.DW chk02, all02
; disk parameter header for disk 03
.DW 0000h, 0000h
.DW 0000h, 0000h
.DW dirbf, dpblk
.DW chk03, all03
;
; sector translate vector
trans: .DB 1, 7, 13, 19 ;sectors 1, 2, 3, 4
.DB 25, 5, 11, 17 ;sectors 5, 6, 7, 6
.DB 23, 3, 9, 15 ;sectors 9, 10, 11, 12
.DB 21, 2, 8, 14 ;sectors 13, 14, 15, 16
.DB 20, 26, 6, 12 ;sectors 17, 18, 19, 20
.DB 18, 24, 4, 10 ;sectors 21, 22, 23, 24
.DB 16, 22 ;sectors 25, 26
;
dpblk: ;disk parameter block for all disks.
.DW 26 ;sectors per track
.DB 3 ;block shift factor
.DB 7 ;block mask
.DB 0 ;null mask
.DW 242 ;disk size-1
.DW 63 ;directory max
.DB 192 ;alloc 0
.DB 0 ;alloc 1
.DW 0 ;check size
.DW 2 ;track offset
;
; end of fixed tables
;
;================================================================================================
; Cold boot
;================================================================================================
boot:
DI ; Disable interrupts.
LD SP,biosstack ; Set default stack.
; Turn off ROM
LD A,$01
OUT ($00),A
; Initialise SIO
CALL printInline
.DB FF
.TEXT "Z80 CP/M BIOS 1.0 by G. Searle 2007-13"
.DB CR,LF
.DB CR,LF
.TEXT "CP/M 2.2 "
.TEXT "Copyright"
.TEXT " 1979 (c) by Digital Research"
.DB CR,LF,0
CALL cfWait
LD A,CF_8BIT ; Set IDE to be 8bit
OUT (CF_FEATURES),A
LD A,CF_SET_FEAT
OUT (CF_COMMAND),A
CALL cfWait
LD A,CF_NOCACHE ; No write cache
OUT (CF_FEATURES),A
LD A,CF_SET_FEAT
OUT (CF_COMMAND),A
XOR a ; Clear I/O & drive bytes.
LD (userdrv),A
LD (serBufUsed),A
LD HL,serBuf
LD (serInPtr),HL
LD (serRdPtr),HL
JP gocpm
;================================================================================================
; Warm boot
;================================================================================================
wboot:
DI ; Disable interrupts.
LD SP,biosstack ; Set default stack.
LD B,11 ; Number of sectors to reload
LD A,0
LD (hstsec),A
LD HL,ccp
rdSectors:
CALL cfWait
LD A,(hstsec)
OUT (CF_LBA0),A
LD A,0
OUT (CF_LBA1),A
OUT (CF_LBA2),A
LD a,0E1H
OUT (CF_LBA3),A
LD A,1
OUT (CF_SECCOUNT),A
PUSH BC
CALL cfWait
LD A,CF_READ_SEC
OUT (CF_COMMAND),A
CALL cfWait
LD c,2
rd4secs512:
call cfWait
LD b,128
rdByte512:
in A,(CF_DATA)
LD (HL),A
iNC HL
dec b
JR NZ, rdByte512
dec c
JR NZ,rd4secs512
;mans
CALL cfWait
LD A,(hstsec)
OUT (CF_LBA0),A
LD A,0
OUT (CF_LBA1),A
OUT (CF_LBA2),A
LD a,0E2H
OUT (CF_LBA3),A
LD A,1
OUT (CF_SECCOUNT),A
CALL cfWait
LD A,CF_READ_SEC
OUT (CF_COMMAND),A
CALL cfWait
LD c,2
rd4secs5122:
call cfWait
LD b,128
rdByte5122:
in A,(CF_DATA)
LD (HL),A
iNC HL
dec b
JR NZ, rdByte5122
dec c
JR NZ,rd4secs5122
POP BC
LD A,(hstsec)
inc a
LD (hstsec),A
djnz rdSectors
;================================================================================================
; Common code for cold and warm boot
;================================================================================================
gocpm:
xor a ;0 to accumulator
ld (hstact),a ;host buffer inactive
ld (unacnt),a ;clear unalloc count
LD A,0C3h
LD ($38),A
LD HL,serialInt ; ADDress of serial interrupt.
LD ($39),HL
LD HL,tpabuf ; ADDress of BIOS DMA buffer.
LD (dmaAddr),HL
LD A,0C3h ; Opcode for 'JP'.
LD (00h),A ; Load at start of RAM.
LD HL,wboote ; ADDress of jump for a warm boot.
LD (01h),HL
LD (05h),A ; Opcode for 'JP'.
LD HL,bdos ; ADDress of jump for the BDOS.
LD (06h),HL
LD A,(userdrv) ; Save new drive number (0).
LD c,A ; Pass drive number in C.
IM 1
EI ; Enable interrupts
JP ccp ; Start CP/M by jumping to the CCP.
;================================================================================================
; Console I/O routines
;================================================================================================
serialInt: PUSH AF
ld a,1
out ($02),a
PUSH HL
intl: IN A,($00)
AND $2
JP Z,intl
IN A,($01)
PUSH AF
LD A,(serBufUsed)
CP SER_BUFSIZE ; If full then ignore
JR NZ,notFull
POP AF
JR rts0
notFull: LD HL,(serInPtr)
INC HL
LD A,L ; Only need to check low byte becasuse buffer<256 bytes
CP (serBuf+SER_BUFSIZE) & $FF
JR NZ, notWrap
LD HL,serBuf
notWrap: LD (serInPtr),HL
POP AF
LD (HL),A
LD A,(serBufUsed)
INC A
LD (serBufUsed),A
CP SER_FULLSIZE
JR C,rts0
rts0:
POP HL
ld a,0
out ($02),a
POP AF
EI
RETI
;------------------------------------------------------------------------------------------------
const:
LD A,(iobyte)
AND 00001011b ; Mask off console and high bit of reader
CP 00001010b ; redirected to reader on UR1/2 (Serial A)
JR constA
constA:
PUSH HL
LD A,(serBufUsed)
CP $00
JR Z, dataAEmpty
LD A,0FFH
POP HL
RET
dataAEmpty:
LD A,0
POP HL
RET
;------------------------------------------------------------------------------------------------
reader:
PUSH HL
PUSH AF
reader2: LD A,(iobyte)
AND $08
CP $08
JR coninA
;------------------------------------------------------------------------------------------------
conin:
PUSH HL
PUSH AF
LD A,(iobyte)
AND $03
CP $02
JR Z,reader2 ; "BAT:" redirect
coninA:
POP AF
waitForCharA:
LD A,(serBufUsed)
CP $00
JR Z, waitForCharA
LD HL,(serRdPtr)
INC HL
LD A,L
CP (serBuf+SER_BUFSIZE) & $FF
JR NZ, notRdWrapA
LD HL,serBuf
notRdWrapA:
DI
LD (serRdPtr),HL
LD A,(serBufUsed)
DEC A
LD (serBufUsed),A
CP SER_EMPTYSIZE
JR NC,rtsA1
rtsA1:
LD A,(HL)
EI
POP HL
RET ; Char ready in A
; Char ready in A
;------------------------------------------------------------------------------------------------
list: PUSH AF ; Store character
list2: LD A,(iobyte)
AND $C0
CP $40
JR conoutA1
;------------------------------------------------------------------------------------------------
punch: PUSH AF ; Store character
LD A,(iobyte)
AND $20
CP $20
JR conoutA1
;------------------------------------------------------------------------------------------------
conout: PUSH AF ; Store character
LD A,(iobyte)
AND $03
CP $02
JR Z,list2 ; "BAT:" redirect
conoutA1:
TXALOOP1: IN A,($00)
AND $4
JP Z,TXALOOP1
TXALOOP: IN A,($00)
AND $1
JP NZ,TXALOOP
LD A,C
OUT ($01),A ; OUTput the character
POP AF ; RETrieve character
RET
;------------------------------------------------------------------------------------------------
CKSIOA
SUB A
OUT (SIOA_C),A
IN A,(SIOA_C) ; Status byte D2=TX Buff Empty, D0=RX char ready
RRCA ; Rotates RX status into Carry Flag,
BIT 1,A ; Set Zero flag if still transmitting character
RET
CKSIOB
SUB A
OUT (SIOB_C),A
IN A,(SIOB_C) ; Status byte D2=TX Buff Empty, D0=RX char ready
RRCA ; Rotates RX status into Carry Flag,
BIT 1,A ; Set Zero flag if still transmitting character
RET
;------------------------------------------------------------------------------------------------
listst: LD A,$FF ; Return list status of 0xFF (ready).
RET
;================================================================================================
; Disk processing entry points
;================================================================================================
seldsk: ;select disk given by register c
LD HL, 0000h ;error return code
LD a, c
LD (hstdsk),A
;CP disks ;must be between 0 and 3
;RET NC ;no carry if 4, 5,...
; disk number is in the proper range
; defs 10 ;space for disk select
; compute proper disk Parameter header address
LD A,(hstdsk)
LD l, a ;l=disk number 0, 1, 2, 3
LD h, 0 ;high order zero
ADD HL,HL ;*2
ADD HL,HL ;*4
ADD HL,HL ;*8
ADD HL,HL ;*16 (size of each header)
LD DE, dpbase
ADD HL,DE ;hl=,dpbase (diskno*16). Note typo "DAD 0" here in original 8080 source.
ret
chgdsk: LD (sekdsk),A
RLC a ;*2
RLC a ;*4
RLC a ;*8
RLC a ;*16
LD HL,dpbase
LD b,0
LD c,A
ADD HL,BC
RET
;------------------------------------------------------------------------------------------------
home:
ld a,(hstwrt) ;check for pending write
or a
jr nz,homed
ld (hstact),a ;clear host active flag
homed:
LD BC,0000h
;------------------------------------------------------------------------------------------------
settrk: ;set track given by register c
LD a, c
LD (hsttrk),A
ret
;------------------------------------------------------------------------------------------------
setsec: ;set sector given by register c
LD a, c
LD (hstsec),A
ret
;------------------------------------------------------------------------------------------------
setdma: ;set dma address given by registers b and c
LD l, c ;low order address
LD h, b ;high order address
LD (dmaad),HL ;save the address
ret
;------------------------------------------------------------------------------------------------
sectran:
EX DE,HL ;hl=.trans
ADD HL,BC ;hl=.trans (sector)
ret ;debug no translation
;PUSH BC
; POP HL
; RET
;------------------------------------------------------------------------------------------------
read1:
;read the selected CP/M sector
xor a
ld (unacnt),a
ld a,1
ld (readop),a ;read operation
ld (rsflag),a ;must read data
ld a,wrual
ld (wrtype),a ;treat as unalloc
jp rwoper ;to perform the read
;------------------------------------------------------------------------------------------------
write1:
;write the selected CP/M sector
xor a ;0 to accumulator
ld (readop),a ;not a read operation
ld a,c ;write type in c
ld (wrtype),a
cp wrual ;write unallocated?
jr nz,chkuna ;check for unalloc
;
; write to unallocated, set parameters
ld a,blksiz/128 ;next unalloc recs
ld (unacnt),a
ld a,(sekdsk) ;disk to seek
ld (unadsk),a ;unadsk = sekdsk
ld hl,(sektrk)
ld (unatrk),hl ;unatrk = sectrk
ld a,(seksec)
ld (unasec),a ;unasec = seksec
;
chkuna:
; check for write to unallocated sector
ld a,(unacnt) ;any unalloc remain?
or a
jr z,alloc ;skip if not
;
; more unallocated records remain
dec a ;unacnt = unacnt-1
ld (unacnt),a
ld a,(sekdsk) ;same disk?
ld hl,unadsk
cp (hl) ;sekdsk = unadsk?
jp nz,alloc ;skip if not
;
; disks are the same
ld hl,unatrk
call sektrkcmp ;sektrk = unatrk?
jp nz,alloc ;skip if not
;
; tracks are the same
ld a,(seksec) ;same sector?
ld hl,unasec
cp (hl) ;seksec = unasec?
jp nz,alloc ;skip if not
;
; match, move to next sector for future ref
inc (hl) ;unasec = unasec+1
ld a,(hl) ;end of track?
cp cpmspt ;count CP/M sectors
jr c,noovf ;skip if no overflow
;
; overflow to next track
ld (hl),0 ;unasec = 0
ld hl,(unatrk)
inc hl
ld (unatrk),hl ;unatrk = unatrk+1
;
noovf:
;match found, mark as unnecessary read
xor a ;0 to accumulator
ld (rsflag),a ;rsflag = 0
jr rwoper ;to perform the write
;
alloc:
;not an unallocated record, requires pre-read
xor a ;0 to accum
ld (unacnt),a ;unacnt = 0
inc a ;1 to accum
ld (rsflag),a ;rsflag = 1
;------------------------------------------------------------------------------------------------
rwoper:
;enter here to perform the read/write
xor a ;zero to accum
ld (erflag),a ;no errors (yet)
ld a,(seksec) ;compute host sector
or a ;carry = 0
rra ;shift right
or a ;carry = 0
rra ;shift right
ld (sekhst),a ;host sector to seek
;
; active host sector?
ld hl,hstact ;host active flag
ld a,(hl)
ld (hl),1 ;always becomes 1
or a ;was it already?
jr z,filhst ;fill host if not
;
; host buffer active, same as seek buffer?
ld a,(sekdsk)
ld hl,hstdsk ;same disk?
cp (hl) ;sekdsk = hstdsk?
jr nz,nomatch
;
; same disk, same track?
ld hl,hsttrk
call sektrkcmp ;sektrk = hsttrk?
jr nz,nomatch
;
; same disk, same track, same buffer?
ld a,(sekhst)
ld hl,hstsec ;sekhst = hstsec?
cp (hl)
jr z,match ;skip if match
;
nomatch:
;proper disk, but not correct sector
ld a,(hstwrt) ;host written?
or a
call nz,writehst ;clear host buff
;
filhst:
;may have to fill the host buffer
ld a,(sekdsk)
ld (hstdsk),a
ld hl,(sektrk)
ld (hsttrk),hl
ld a,(sekhst)
ld (hstsec),a
ld a,(rsflag) ;need to read?
or a
call nz,readhst ;yes, if 1
xor a ;0 to accum
ld (hstwrt),a ;no pending write
;
match:
;copy data to or from buffer
ld a,(seksec) ;mask buffer number
and secmsk ;least signif bits
ld l,a ;ready to shift
ld h,0 ;double count
add hl,hl
add hl,hl
add hl,hl
add hl,hl
add hl,hl
add hl,hl
add hl,hl
; hl has relative host buffer address
ld de,hstbuf
add hl,de ;hl = host address
ex de,hl ;now in DE
ld hl,(dmaAddr) ;get/put CP/M data
ld c,128 ;length of move
ld a,(readop) ;which way?
or a
jr nz,rwmove ;skip if read
;
; write operation, mark and switch direction
ld a,1
ld (hstwrt),a ;hstwrt = 1
ex de,hl ;source/dest swap
;
rwmove:
;C initially 128, DE is source, HL is dest
ld a,(de) ;source character
inc de
ld (hl),a ;to dest
inc hl
dec c ;loop 128 times
jr nz,rwmove
;
; data has been moved to/from host buffer
ld a,(wrtype) ;write type
cp wrdir ;to directory?
ld a,(erflag) ;in case of errors
ret nz ;no further processing
;
; clear host buffer for directory write
or a ;errors?
ret nz ;skip if so
xor a ;0 to accum
ld (hstwrt),a ;buffer written
call writehst
ld a,(erflag)
ret
;------------------------------------------------------------------------------------------------
;Utility subroutine for 16-bit compare
sektrkcmp:
;HL = .unatrk or .hsttrk, compare with sektrk
ex de,hl
ld hl,sektrk
ld a,(de) ;low byte compare
cp (HL) ;same?
ret nz ;return if not
; low bytes equal, test high 1s
inc de
inc hl
ld a,(de)
cp (hl) ;sets flags
ret
;================================================================================================
; Convert track/head/sector into LBA for physical access to the disk
;================================================================================================
;================================================================================================
; Read physical sector from host
;================================================================================================
read:
;Read one CP/M sector from disk.
;Return a 00h in register a if the operation completes properly, and 01h if an error occurs during the read.
;Disk number in 'diskno'
;Track number in 'track'
;Sector number in 'sector'
;Dma address in 'dmaad' (0-65535)
ld hl,hstbuf ;buffer to place disk sector (256 bytes)
rd_status_loop_1: in a,(CF_STATUS) ;check status
readhst: and 80h ;check BSY bit
jp nz,rd_status_loop_1 ;loop until not busy
rd_status_loop_2: in a,(CF_STATUS) ;check status
and 40h ;check DRDY bit
jp z,rd_status_loop_2 ;loop until ready
ld a,01h ;number of sectors = 1
out (CF_SECCOUNT),a ;sector count register
ld a,(hstsec) ;sector
out (CF_LBA0),a ;lba bits 0 - 7
ld a,(hsttrk) ;track
out (CF_LBA1),a ;lba bits 8 - 15
ld a,(hstdsk) ;disk (only bits 16 and 17 used)
out (CF_LBA2),a ;lba bits 16 - 23
ld a,11100000b ;LBA mode, select host drive 0
out (CF_LBA3),a ;drive/head register
ld a,20h ;Read sector command
out (CF_STATUS),a
rd_wait_for_DRQ_set: in a,(CF_STATUS) ;read status
and 08h ;DRQ bit
jp z,rd_wait_for_DRQ_set ;loop until bit set
rd_wait_for_BSY_clear: in a,(CF_STATUS)
and 80h
jp nz,rd_wait_for_BSY_clear
;in a,(0fh) ;clear INTRQ
read_loop: in a,(CF_DATA) ;get data
ld (hl),a
inc hl
in a,(CF_STATUS) ;check status
and 08h ;DRQ bit
jp nz,read_loop ;loop until clear
ld hl,(dmaad) ;memory location to place data read from disk
ld de,hstbuf ;host buffer
ld b,128 ;size of CP/M sector
rd_sector_loop: ld a,(de) ;get byte from host buffer
ld (hl),a ;put in memory
inc hl
inc de
djnz rd_sector_loop ;put 128 bytes into memory
in a,(CF_STATUS) ;get status
and 01h ;error bit
ret
;================================================================================================
; Write physical sector to host
;================================================================================================
write:
ld hl,(dmaad) ;memory location of data to write
writehst: ld de,hstbuf ;host buffer
ld b,128 ;size of CP/M sector
wr_sector_loop: ld a,(hl) ;get byte from memory
ld (de),a ;put in host buffer
inc hl
inc de
djnz wr_sector_loop ;put 128 bytes in host buffer
ld hl,hstbuf ;location of data to write to disk
wr_status_loop_1: in a,(CF_STATUS) ;check status
and 80h ;check BSY bit
jp nz,wr_status_loop_1 ;loop until not busy
wr_status_loop_2: in a,(CF_STATUS) ;check status
and 40h ;check DRDY bit
jp z,wr_status_loop_2 ;loop until ready
ld a,01h ;number of sectors = 1
out (CF_SECCOUNT),a ;sector count register
ld a,(hstsec)
out (CF_LBA0),a ;lba bits 0 - 7 = "sector"
ld a,(hsttrk)
out (CF_LBA1),a ;lba bits 8 - 15 = "track"
ld a,(hstdsk)
out (CF_LBA2),a ;lba bits 16 - 23, use 16 to 20 for "disk"
ld a,11100000b ;LBA mode, select drive 0
out (CF_LBA3),a ;drive/head register
ld a,30h ;Write sector command
out (CF_COMMAND),a
wr_wait_for_DRQ_set: in a,(CF_STATUS) ;read status
and 08h ;DRQ bit
jp z,wr_wait_for_DRQ_set ;loop until bit set
write_loop: ld a,(hl)
out (CF_DATA),a ;write data
inc hl
in a,(CF_STATUS) ;read status
and 08h ;check DRQ bit
jp nz,write_loop ;write until bit cleared
wr_wait_for_BSY_clear: in a,(CF_STATUS)
and 80h
jp nz,wr_wait_for_BSY_clear
and 01h ;check for error
ret
;================================================================================================
; Wait for disk to be ready (busy=0,ready=1)
;================================================================================================
cfWait:
PUSH AF
cfWait1:
in A,(CF_STATUS)
AND 080H
cp 080H
JR Z,cfWait1
POP AF
RET
cfWaitDRQ:
push af
cfWaitDRQ1:
in A,(CF_STATUS)
AND 008H
cp 008H
JR NZ,cfWaitDRQ1
POP AF
RET
;================================================================================================
; Utilities
;================================================================================================
printInline:
EX (SP),HL ; PUSH HL and put RET ADDress into HL
PUSH AF
PUSH BC
nextILChar: LD A,(HL)
CP 0
JR Z,endOfPrint
LD C,A
CALL conout ; Print to TTY
iNC HL
JR nextILChar
endOfPrint: INC HL ; Get past "null" terminator
POP BC
POP AF
EX (SP),HL ; PUSH new RET ADDress on stack and restore HL
RET
;================================================================================================
; Data storage
;================================================================================================
dirbf: .ds 128 ;scratch directory area
all00: .ds 31 ;allocation vector 0
all01: .ds 31 ;allocation vector 1
all02: .ds 31 ;allocation vector 0
all03: .ds 31 ;allocation vector 1
chk00: .ds 16
chk01: .ds 16
chk02: .ds 16
chk03: .ds 16
lba0 .DB 00h
lba1 .DB 00h
lba2 .DB 00h
lba3 .DB 00h
.DS 020h ; Start of BIOS stack area.
biosstack: .EQU $
sekdsk: .ds 1 ;seek disk number
sektrk: .ds 2 ;seek track number
seksec: .ds 2 ;seek sector number
;
hstdsk: .ds 1 ;host disk number
hsttrk: .ds 2 ;host track number
hstsec: .ds 1 ;host sector number
;
sekhst: .ds 1 ;seek shr secshf
hstact: .ds 1 ;host active flag
hstwrt: .ds 1 ;host written flag
;
unacnt: .ds 1 ;unalloc rec cnt
unadsk: .ds 1 ;last unalloc disk
unatrk: .ds 2 ;last unalloc track
unasec: .ds 1 ;last unalloc sector
;
erflag: .ds 1 ;error reporting
rsflag: .ds 1 ;read sector flag
readop: .ds 1 ;1 if read operation
wrtype: .ds 1 ;write operation type
dmaAddr: .ds 2 ;last dma address
hstbuf: .ds 512 ;host buffer
dmaad: .ds 2
hstBufEnd: .EQU $
serBuf: .ds SER_BUFSIZE ; SIO A Serial buffer
serInPtr .DW 00h
serRdPtr .DW 00h
serBufUsed .DB 00h
serialVarsEnd: .EQU $
biosEnd: .EQU $
; Disable the ROM, pop the active IO port from the stack (supplied by monitor),
; then start CP/M
popAndRun:
LD A,$01
OUT ($00),A
POP AF
CP $01
JR Z,consoleAtB
LD A,$01 ;(List is TTY:, Punch is TTY:, Reader is TTY:, Console is CRT:)
JR setIOByte
consoleAtB: LD A,$00 ;(List is TTY:, Punch is TTY:, Reader is TTY:, Console is TTY:)
setIOByte: LD (iobyte),A
JP bios
; IM 2 lookup for serial interrupt
.org 0FFE0H
.dw serialInt
;=================================================================================
; Relocate TPA area from 4100 to 0100 then start CP/M
; Used to manually transfer a loaded program after CP/M was previously loaded
;=================================================================================
.org 0FFE8H
LD A,$01
OUT ($00),A
LD HL,04100H
LD DE,00100H
LD BC,08F00H
LDIR
JP bios
;=================================================================================
; Normal start CP/M vector
;=================================================================================
.ORG 0FFFEH
.dw popAndRun
.END
| 25.425451 | 111 | 0.494117 |
d5c93d2c71d60950f3e9483bdb9c7abd35f9a745 | 7,917 | asm | Assembly | Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_21829_1366.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_21829_1366.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_21829_1366.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %rax
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x1d6d9, %rsi
lea addresses_D_ht+0x6e89, %rdi
nop
nop
nop
nop
and %r14, %r14
mov $125, %rcx
rep movsl
nop
add $57415, %r11
lea addresses_WT_ht+0x5559, %rdi
nop
nop
dec %rbx
movw $0x6162, (%rdi)
add $10259, %r11
lea addresses_normal_ht+0x9359, %r11
clflush (%r11)
nop
sub %rax, %rax
movb (%r11), %r14b
nop
nop
nop
add %rsi, %rsi
lea addresses_normal_ht+0x10151, %rax
nop
nop
nop
sub $63440, %rcx
mov $0x6162636465666768, %r14
movq %r14, (%rax)
nop
nop
nop
sub $18149, %rcx
lea addresses_WC_ht+0x3977, %r14
nop
nop
nop
nop
nop
cmp %r11, %r11
mov $0x6162636465666768, %rsi
movq %rsi, %xmm6
movups %xmm6, (%r14)
nop
nop
nop
nop
sub $60514, %rax
lea addresses_WC_ht+0x12559, %rsi
lea addresses_WC_ht+0x2559, %rdi
cmp $65285, %rdx
mov $37, %rcx
rep movsw
nop
xor $19893, %r14
lea addresses_WT_ht+0xa759, %rsi
lea addresses_WT_ht+0xeb9, %rdi
nop
nop
nop
nop
nop
sub $48482, %rdx
mov $68, %rcx
rep movsw
nop
nop
xor $62969, %rbx
lea addresses_WC_ht+0x1869, %r14
nop
nop
inc %rdx
mov $0x6162636465666768, %rdi
movq %rdi, %xmm0
vmovups %ymm0, (%r14)
nop
sub $12793, %rdi
lea addresses_UC_ht+0x168d6, %rax
nop
nop
nop
and %r14, %r14
movb $0x61, (%rax)
nop
nop
nop
nop
and %r14, %r14
lea addresses_normal_ht+0x7def, %rbx
clflush (%rbx)
nop
nop
xor %rdi, %rdi
vmovups (%rbx), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $1, %xmm4, %rdx
nop
nop
nop
nop
inc %rdi
lea addresses_normal_ht+0x16059, %rdx
nop
nop
nop
sub %r14, %r14
mov $0x6162636465666768, %rax
movq %rax, (%rdx)
nop
nop
nop
nop
nop
sub %rbx, %rbx
lea addresses_normal_ht+0x1d959, %rsi
lea addresses_WC_ht+0xf169, %rdi
clflush (%rdi)
nop
nop
nop
and $18275, %r11
mov $96, %rcx
rep movsq
nop
nop
nop
nop
nop
dec %rax
lea addresses_WT_ht+0x1d859, %rbx
nop
nop
nop
nop
and $39610, %rax
movb (%rbx), %cl
add $45686, %rsi
lea addresses_WC_ht+0x2d2, %rsi
lea addresses_normal_ht+0x11d9d, %rdi
nop
nop
xor %r14, %r14
mov $65, %rcx
rep movsq
nop
nop
xor %rcx, %rcx
lea addresses_D_ht+0xa4c9, %r11
clflush (%r11)
nop
nop
nop
xor $46229, %rdx
movb $0x61, (%r11)
nop
nop
lfence
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %rax
push %rbp
push %rbx
push %rcx
// Faulty Load
lea addresses_UC+0x16559, %r11
dec %rcx
movups (%r11), %xmm0
vpextrq $1, %xmm0, %rbx
lea oracles, %rax
and $0xff, %rbx
shlq $12, %rbx
mov (%rax,%rbx,1), %rbx
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': True}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 33.978541 | 2,999 | 0.660856 |
8a0c972d15ed90f6990b496ee52751b5bded2239 | 112 | asm | Assembly | libsrc/_DEVELOPMENT/math/float/math48/lm/z80/asm_ddiv_s.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/math/float/math48/lm/z80/asm_ddiv_s.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/math/float/math48/lm/z80/asm_ddiv_s.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
SECTION code_clib
SECTION code_fp_math48
PUBLIC asm_ddiv_s
EXTERN am48_ddiv_s
defc asm_ddiv_s = am48_ddiv_s
| 11.2 | 29 | 0.848214 |
760cd1be96f7f8544208df8c409393f7ef0d6a8a | 140 | asm | Assembly | libsrc/_DEVELOPMENT/z180/c/sccz80/z180_inp.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/z180/c/sccz80/z180_inp.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/z180/c/sccz80/z180_inp.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
; uint8_t z180_inp(uint16_t port)
SECTION code_clib
SECTION code_z180
PUBLIC z180_inp
EXTERN asm_z180_inp
defc z180_inp = asm_z180_inp
| 11.666667 | 33 | 0.821429 |
efc0ccd1cadb3d215e1152d2c3df4d2b0962393d | 824 | asm | Assembly | oeis/142/A142022.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/142/A142022.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/142/A142022.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A142022: Primes congruent to 18 mod 31.
; Submitted by Jon Maiga
; 173,359,421,607,1103,1289,1723,1847,2281,2467,2591,2777,2963,3583,3769,4079,4327,4451,4513,4637,5009,5381,5443,5939,6311,6373,6869,7489,8171,8233,8419,8543,9349,9473,9721,9907,10093,10589,10651,10837,11519,11953,12263,12511,12697,12821,13007,13441,13627,13751,13999,14557,14867,14929,15053,15797,15859,16231,16417,16603,17099,17471,17657,18401,18587,18773,18959,19207,19889,20261,20323,20509,21067,21191,21377,21563,21997,22307,22369,22679,22741,23609,23671,23857,23981,24043,24229,25097,25469,25717
mov $2,$0
add $2,2
pow $2,2
lpb $2
mul $1,$4
mov $3,$1
add $3,48
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,62
sub $2,1
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
mov $0,$1
sub $0,13
| 35.826087 | 501 | 0.728155 |
2daf671c7e4531c5c66c805569231cd45c45c570 | 148 | asm | Assembly | other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/polygon.lzh/polygon/sample2/DpolyZclip.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/polygon.lzh/polygon/sample2/DpolyZclip.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/polygon.lzh/polygon/sample2/DpolyZclip.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | Name: DpolyZclip.asm
Type: file
Size: 13908
Last-Modified: '1992-09-24T02:25:43Z'
SHA-1: FF775105EFA2438B4B1B2BC2691A4959C11A2E82
Description: null
| 21.142857 | 47 | 0.817568 |
eeb458a879a1891782828808293a13f90830165d | 14,095 | asm | Assembly | src/user_tools/ml2bas.asm | Chysn/wAx | fb74ca84ed0547f447a24f0cca7d11af217f1847 | [
"MIT"
] | 5 | 2020-06-13T09:19:46.000Z | 2020-12-10T17:22:10.000Z | src/user_tools/ml2bas.asm | Chysn/VIC20-wAx | fb74ca84ed0547f447a24f0cca7d11af217f1847 | [
"MIT"
] | 1 | 2020-07-27T19:44:18.000Z | 2020-07-31T13:59:24.000Z | src/user_tools/ml2bas.asm | Chysn/VIC20-wAx | fb74ca84ed0547f447a24f0cca7d11af217f1847 | [
"MIT"
] | 1 | 2020-08-06T20:00:40.000Z | 2020-08-06T20:00:40.000Z | ; wAx ML2BAS Tool
; 'start end+1 [R,H,T]
; Convert the 6502 code between start and end into a BASIC program in the
; current BASIC stage. The 6502 code will be appended to the existing program,
; with line numbers in increments of 5.
;
; The specified end address should be the byte after the last instruction
; in the program.
;
; If R is specified after the end address, uses the relocatable "hermit crab"
; syntax. Otherwise, uses absolute addresses.
;
; If H is specified after the end address, creates hex data entry lines
; instead of 6502 code.
;
; If T is specified after the end address, creates assertion test data
; instead of 6502 code.
;
; If the disassembly would extend beyond the end of the BASIC stage, the
; existing BASIC program (if any) is restored, and an OUT OF MEMORY error is
; thrown.
; wAx API
EFADDR = $a6 ; Effective Address
X_PC = $03 ; External Persistent Counter
Buff2Byte = $7000 ; Get 8-bit hex number from input buffer to A
CharGet = $7003 ; Get character from input buffer to A
CharOut = $7006 ; Write character in A to output buffer
Hex = $7009 ; Write value in A to output buffer 8-bit hex
IncAddr = $700c ; Increment Effective Address, store value in A
IncPC = $700f ; Increment Persistent Counter
Lookup = $7012 ; Lookup 6502 instruction with operand in A
PrintBuff = $7015 ; Flush output buffer to screen
ResetIn = $7018 ; Reset input buffer index
ResetOut = $701b ; Reset output buffer index
ShowAddr = $701e ; Write Effective Address to output buffer
ShowPC = $7021 ; Write Persistent Counter to output buffer
Disasm = $60fb ; Disassemble to output buffer
Rechain = $6a4f ; Rechain BASIC program
DMnemonic = $611e ; Display mnemonic
; ML2BAS Workspace
LINE_NUM = $0247 ; BASIC Line Number (2 bytes)
MODIFIER = $0249 ; Relocate or
FAIL_POINT = $024a ; BASIC program end restore point (2 bytes)
OUTBUFFER = $0218 ; Output buffer (24 bytes)
IDX_OUT = $ad ; Buffer index - Output
RANGE_END = $0254 ; End of range for Save and Copy (2 bytes)
*=$7b00
Main: bcc error ; Error if the first address is no good
jsr Buff2Byte ; Get high byte of range end
bcc error ; ,,
sta RANGE_END+1 ; ,,
jsr Buff2Byte ; Get low byte of range end
bcc error ; ,,
sta RANGE_END ; ,,
jsr CharGet ; If there's an R at the end of the command,
cmp #"R" ; use the "hermit crab" syntax instead of
beq set_mod ; absolute addresses
cmp #"H" ; If there's an H at the end of the command,
beq set_mod ; this will create hex dump lines
cmp #"T" ; If there's a T at the end of the command,
beq set_mod ; this will create assertion tests
lda #$00
set_mod: sta MODIFIER
lda #$00 ; Initialize fail point high byte
sta FAIL_POINT+1 ; ,,
lda $2b ; Set persistent counter with start of
sta X_PC ; BASIC
lda $2c ; ,,
sta X_PC+1 ; ,,
lda #$64 ; Start at line 100 by default
sta LINE_NUM ; ,,
lda #$00 ; ,,
sta LINE_NUM+1 ; ,,
jsr NextLink ; Is there an existing BASIC program?
bcc found_end ; If no existing program,
jsr FindEnd ; Find the last line number
jsr IncLine ; Increment it by 5
lda X_PC ; Set fail point, which preserves the existing
sta FAIL_POINT ; BASIC program if the ML2BAS process results
lda X_PC+1 ; in an out of memory condition.
sta FAIL_POINT+1 ; ,,
found_end: lda MODIFIER ; If the code is not relocatable, skip the
beq Start ; PC setting up front
jsr LinkBytes ; Add link bytes to next line
jsr LineNumber ; Add line number to first line
lda #$ac ; Add PC set tool
jsr AddByte ; Add the selected tool to the buffer
jsr ResetOut ; Add the start address to the output buffer
jsr ShowAddr ; ,,
jsr AddBuffer ; Add the output buffer to the BASIC line
jsr EndLine ; Finish the first BASIC line
jmp Start ; Start adding lines of 6502 code
error: jmp $cf08 ; ?SYNTAX ERROR, warm start
Start: jsr CheckRange
bcc range_ok
done: jsr EndProgram ; Add $00,$00 to the the program
jsr Rechain ; Rechain BASIC program
jmp ($c002) ; READY.
range_ok: jsr LinkBytes
jsr LineNumber
lda #"@" ; Add the assemble tool
ldy MODIFIER ; If the modifier is T (assertion test), then
cpy #"T" ; switch the tool over to =
bne show_tool ; ,,
lda #$b2 ; ,,
show_tool: jsr AddByte ; Add the selected tool to the buffer
lda MODIFIER ; If the user requested relocatable code,
beq show_addr ; add the * instead of the address
cmp #"T" ; ,,
beq show_addr ; ,,
lda #$ac ; ,,
jsr AddByte ; ,,
jmp code_part ; ,,
show_addr: jsr ResetOut ; Add the current address to the BASIC line
jsr ShowAddr ; ,,
jsr AddBuffer ; ,,
code_part: lda #" " ; Space after address or hermit crab
jsr AddByte ; ,,
jsr ResetOut ; Reset output for the code portion
lda MODIFIER ; If the disassembly is in relocate mode,
beq gen_code ;
cmp #"H" ; check for hex dump modifier and
beq HexDump ; handle that, if necessary. Otherwise, check
cmp #"T" ; for assertion test modified and
beq HexDump ; handle that, if necessary. Otherwise, check
jsr CheckRel ; for relative branch. If so, disassemble the
bcs code2buff ; instruction as two bytes.
gen_code: jsr Disasm ; Disassemble code to empty output buffer and
code2buff: jsr AddBuffer ; add it to the BASIC LINE
jsr EndLine ; End the line
jmp Start ; Check for the next line of code
; Hex Dump Line
; Add up to six hex bytes to the current BASIC line buffer
HexDump: lda #$04 ; Reset a byte counter; we'll add up to six
sta $08 ; bytes per BASIC line (see below)
lda MODIFIER ; If the modifier is assertion testing,
cmp #"T" ; don't add a colon to the buffer
beq add_hex ; ,,
inc $08 ; If the modifier is not assertion testing,
inc $08 ; use six bytes instead of 4
lda #":" ; Add a colon to specify hex entry
jsr AddByte ; Add the wedge character to the buffer
add_hex: jsr IncAddr ; Add the hex data to the buffer
jsr Hex ; ,,
jsr CheckRange ; Is the counter still in range?
bcs code2buff ; If not, finish the line
next_byte: dec $08
lda $08
bne add_hex
beq code2buff
; Add Link Bytes
; We're not trying to keep track of the starting addresses of each line,
; because BASIC can do that.
LinkBytes: lda #$ff ; Add two $ff bytes to start the next
jsr AddByte ; BASIC line. These will be set by the BASIC
jsr AddByte ; rechain operation at the end of the build
rts
; Add Line Number
LineNumber: lda LINE_NUM ; Add the current line number to the
jsr AddByte ; BASIC line
lda LINE_NUM+1 ; ,,
jsr AddByte ; ,,
IncLine: lda #$05 ; Increment the line number by 5
clc ; ,,
adc LINE_NUM ; ,,
sta LINE_NUM ; ,,
lda #$00 ; ,,
adc LINE_NUM+1 ; ,,
sta LINE_NUM+1 ; ,,
rts
; Add Byte
; Add the byte in Accumulator to the BASIC line
AddByte: pha
ldx #$00
sta (X_PC,x)
jsr IncPC
lda X_PC+1 ; Check memory for end of BASIC
cmp $34 ; ,,
bcc ok ; ,,
lda X_PC ; ,,
cmp $33 ; ,,
bcs OutOfMem ; If at limit of memory, then ERROR
ok: pla
rts
; Perform NEW, then show Out of Memory Error
OutOfMem: jsr ResetOut ; Show the current address, so the user
lda #"$" ; knows where we ran out of BASIC
jsr CharOut ; memory
jsr ShowAddr ; ,,
lda #$0d ; ,,
jsr CharOut ; ,,
jsr PrintBuff ; ,,
lda FAIL_POINT+1 ; Is there an existing program?
bne restore ; If so, restore it instead of NEW
jsr $c642 ; Perform NEW
jmp $c435 ; Out of Memory Error + Warm Start
restore: lda FAIL_POINT ; Reset the bytes at the previous
sta $07 ; program end address to $00,
lda FAIL_POINT+1 ; essentially reversing everything
sta $08 ; this process did, and the rechain
ldy #$00 ; the BASIC program so it's like
tya ; nothing ever happened.
sta ($07),y ; ,,
iny ; ,,
sta ($07),y ; ,,
jsr Rechain ; ,,
jmp $c435 ; Out of Memory Error + Warm Start
; End Program / End Line
; End the BASIC line or program
EndProgram: jsr EndLine
EndLine: lda #$00
jsr AddByte
rts
; Add Output Buffer
; Paste output buffer into the BASIC program, without the ending $00
AddBuffer: ldy #$00
-loop: lda OUTBUFFER,y
jsr AddByte
iny
cpy IDX_OUT
bne loop
buffer_out: rts
; Find End of Program
FindEnd: jsr NextLink ; Get the next BASIC line location
bcs get_line ; If a line was found, advance line number and
rts ; link pointer and try again; else, return
get_line: iny ; Get the line number and update it
lda (X_PC),y ; it
sta LINE_NUM ; ,,
iny ; ,,
lda (X_PC),y ; ,,
sta LINE_NUM+1 ; ,,
lda $07 ; Get the next link pointer and update X_PC
sta X_PC ; ,,
lda $08 ; ,,
sta X_PC+1 ; Keep looking for the end
jmp FindEnd
NextLink: ldy #$00 ; Set locations $07 and $08 to the next
lda (X_PC),y ; BASIC line pointer. If both are $00, then
sta $07 ; we're at the end of the BASIC program,
iny ; otherwise, the BASIC program continues
lda (X_PC),y ; at the specified address
sta $08 ; ,,
sec ; Set Carry if the link isn't $00/$00
lda $07 ; ,,
bne next_r ; ,,
lda $08 ; ,,
bne next_r ; ,,
clc_r: clc ; Otherwise clear it to indicate end of program
next_r: rts
; Check Relative Instruction
; for relocatable byte syntax
CheckRel: ldx #$00 ; Check the instruction at the effective address
lda (EFADDR,x) ; ,,
jsr Lookup ; If it doesn't exist, exit
bcc clc_r ; ,,
cmp #$c0 ; Is the instruction relative mode?
bne clc_r ; If not, exit
lda #":" ; Add a colon to indicate that bytes follow
jsr CharOut ; ,,
jsr IncAddr ; Add the instruction opcode to the buffer
jsr Hex ; ,,
lda #" " ; Add a space between the instruction and the
jsr CharOut ; operand
jsr IncAddr ; Add the operand to the buffer
jsr Hex ; ,,
lda #";" ; Show the mnemonic for the instruction as
jsr CharOut ; a comment, for the reader's benefit
jsr DMnemonic ; ,,
sec ; Set Carry to indicate that a relative
rts ; instruction was handled
; Check Range
; Check to see if X_PC is greater than or equal to Range End
CheckRange: lda RANGE_END+1
cmp EFADDR+1
bcc out_range
bne in_range
lda EFADDR
cmp RANGE_END
bcc in_range
out_range: sec
rts
in_range: clc
rts | 46.827243 | 90 | 0.491451 |
e6b1bebca766b82527910f19e97e238cda69a8b7 | 738 | asm | Assembly | src/test/ref/unary-plus.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | 2 | 2022-03-01T02:21:14.000Z | 2022-03-01T04:33:35.000Z | src/test/ref/unary-plus.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | null | null | null | src/test/ref/unary-plus.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | null | null | null | // Test unary plus
// Commodore 64 PRG executable file
.file [name="unary-plus.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.const SIZEOF_INT = 2
.segment Code
main: {
.const i = 3
.const j = 3
.label SCREEN = $400
.label SCREEN2 = $428
// SCREEN[0] = i
lda #i
sta SCREEN
// SCREEN[1] = +3
lda #3
sta SCREEN+1
// SCREEN2[0] = j
lda #<j
sta SCREEN2
lda #>j
sta SCREEN2+1
// SCREEN2[1] = +3
lda #<3
sta SCREEN2+1*SIZEOF_INT
lda #>3
sta SCREEN2+1*SIZEOF_INT+1
// }
rts
}
| 20.5 | 61 | 0.597561 |
c1eb8aae47c17bdda8d91d765362083b6e9c47cd | 298 | asm | Assembly | oldstuff/tigcc/PolySnd/sources/statique/_SkipData_voice2.asm | bcherry/bcherry | 5d2f1144dbdbf35d6284018fa2c9e24ec5cecec6 | [
"MIT"
] | 3 | 2016-11-13T09:06:41.000Z | 2021-09-11T23:36:19.000Z | oldstuff/tigcc/PolySnd/sources/statique/_SkipData_voice2.asm | bcherry/bcherry | 5d2f1144dbdbf35d6284018fa2c9e24ec5cecec6 | [
"MIT"
] | null | null | null | oldstuff/tigcc/PolySnd/sources/statique/_SkipData_voice2.asm | bcherry/bcherry | 5d2f1144dbdbf35d6284018fa2c9e24ec5cecec6 | [
"MIT"
] | 2 | 2017-04-04T10:03:18.000Z | 2021-09-11T23:36:26.000Z | section ".data"
xdef pSnd_SkipData_voice2
pSnd_SkipData_voice2:
move.l a0,-(a7)
lea _fcounter2,a0
clr.w (a0)
clr.w 2(a0)
clr.w 10(a0)
clr.l 32(a0)
clr.b -53(a0) ;lenght_voice2
clr.b -51(a0) ;_lcounter2
clr.b -42(a0) ;note_voice2
bclr.b #1,($60000E)
move.l (a7)+,a0
rts
| 15.684211 | 32 | 0.637584 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.