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
sequencelengths
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
sequencelengths
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
sequencelengths
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
252bc5ebc182fd76b6300185efc57aff2fdf1b0c
617
asm
Assembly
Micro_Processor_Lab/3a-BubbleSort/BubbleSort.asm
MohithGowdaHR/PES-Engineering-Lab-Programs
1d2e854158ad7b4e32c3b39b5801eac38c0b41ca
[ "MIT" ]
null
null
null
Micro_Processor_Lab/3a-BubbleSort/BubbleSort.asm
MohithGowdaHR/PES-Engineering-Lab-Programs
1d2e854158ad7b4e32c3b39b5801eac38c0b41ca
[ "MIT" ]
null
null
null
Micro_Processor_Lab/3a-BubbleSort/BubbleSort.asm
MohithGowdaHR/PES-Engineering-Lab-Programs
1d2e854158ad7b4e32c3b39b5801eac38c0b41ca
[ "MIT" ]
null
null
null
; Assembly Level Program 3a ; Sort a given set of 'n' numbers in ascending and descending orders using the Bubble Sort algorithm. .model SMALL .data ARRAY dB 05h, 07h, 06h, 04h, 10h, 09h LEN dB $-ARRAY .code ; Initialize Data Segment MOV AX, @DATA MOV DS, AX ; Clear Counter Register MOV CX, 00h MOV CL, LEN DEC CL OuterLoop: MOV BX, CX ; Point SI to First Position of ARRAY LEA SI, ARRAY InnerLoop: MOV AL, [SI] INC SI CMP [SI], AL JAE NoSwap XCHG [SI], AL MOV [SI-1], AL NoSwap: DEC BX JNZ InnerLoop LOOP OuterLoop Exit: ; Terminate the Program MOV AH, 4Ch INT 21h END
13.413043
101
0.675851
69c76b3f30c7ead216a91639becf1cbe1af38acd
1,778
asm
Assembly
programs/oeis/157/A157613.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/157/A157613.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/157/A157613.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A157613: a(n) = 2662*n + 22. ; 2684,5346,8008,10670,13332,15994,18656,21318,23980,26642,29304,31966,34628,37290,39952,42614,45276,47938,50600,53262,55924,58586,61248,63910,66572,69234,71896,74558,77220,79882,82544,85206,87868,90530,93192,95854,98516,101178,103840,106502,109164,111826,114488,117150,119812,122474,125136,127798,130460,133122,135784,138446,141108,143770,146432,149094,151756,154418,157080,159742,162404,165066,167728,170390,173052,175714,178376,181038,183700,186362,189024,191686,194348,197010,199672,202334,204996,207658,210320,212982,215644,218306,220968,223630,226292,228954,231616,234278,236940,239602,242264,244926,247588,250250,252912,255574,258236,260898,263560,266222,268884,271546,274208,276870,279532,282194,284856,287518,290180,292842,295504,298166,300828,303490,306152,308814,311476,314138,316800,319462,322124,324786,327448,330110,332772,335434,338096,340758,343420,346082,348744,351406,354068,356730,359392,362054,364716,367378,370040,372702,375364,378026,380688,383350,386012,388674,391336,393998,396660,399322,401984,404646,407308,409970,412632,415294,417956,420618,423280,425942,428604,431266,433928,436590,439252,441914,444576,447238,449900,452562,455224,457886,460548,463210,465872,468534,471196,473858,476520,479182,481844,484506,487168,489830,492492,495154,497816,500478,503140,505802,508464,511126,513788,516450,519112,521774,524436,527098,529760,532422,535084,537746,540408,543070,545732,548394,551056,553718,556380,559042,561704,564366,567028,569690,572352,575014,577676,580338,583000,585662,588324,590986,593648,596310,598972,601634,604296,606958,609620,612282,614944,617606,620268,622930,625592,628254,630916,633578,636240,638902,641564,644226,646888,649550,652212,654874,657536,660198,662860,665522 mov $1,$0 mul $1,2662 add $1,2684
254
1,711
0.841957
e68be7bdcc50f2bc67e56c703cd45426e63e1117
4,201
asm
Assembly
cmd/replace/_replace.asm
minblock/msdos
479ffd237d9bb7cc83cb06361db2c4ef42dfbac0
[ "Apache-2.0" ]
null
null
null
cmd/replace/_replace.asm
minblock/msdos
479ffd237d9bb7cc83cb06361db2c4ef42dfbac0
[ "Apache-2.0" ]
null
null
null
cmd/replace/_replace.asm
minblock/msdos
479ffd237d9bb7cc83cb06361db2c4ef42dfbac0
[ "Apache-2.0" ]
null
null
null
page 60,132 ; name _replace title Critical error or control break exit ;/* ; * Microsoft Confidential ; * Copyright (C) Microsoft Corporation 1991 ; * All Rights Reserved. ; */ ;------------------------------------------------------------------- ; ; MODULE: _replace ; ; PURPOSE: Supplies assembler exit routines for ; critical error or control break situations ; ; CALLING FORMAT: ; crit_err_handler; ; ctl_brk_handler; ; ; DATE: 10/87 ; ;------------------------------------------------------------------- public _crit_err_handler ;AN000; public _ctl_brk_handler ;AN000; ;------------------------------------------------------------------- RET_EXIT equ 4ch ; terminate ;AN000; CTLBRK equ 3 ; errorlevel return in al ;AN000; ABORT equ 2 ; if >=, retry ;AN000; XABORT equ 1 ; errorlevel return in al ;AN000; ;------------------------------------------------------------------- NULL SEGMENT PARA PUBLIC 'BEGDATA' ;AN000; NULL ENDS ;AN000; _DATA SEGMENT PARA PUBLIC 'DATA' ;AN000; extrn _oldint24:dword ;AN000; _DATA ENDS ;AN000; CONST SEGMENT WORD PUBLIC 'CONST' ;AN000; CONST ENDS ;AN000; _BSS SEGMENT WORD PUBLIC 'BSS' ;AN000; _BSS ENDS ;AN000; STACK SEGMENT PARA STACK 'DATA' ;AN000; STACK ENDS ;AN000; PGROUP GROUP _TEXT ;AN000; DGROUP GROUP NULL, _DATA, CONST, _BSS, STACK ;AN000; _TEXT segment para public 'CODE' ;AN000; ASSUME CS:PGROUP ;AN000; extrn _restore:near ;AN000; ;------------------------------------------------------------------- ; CRITICAL ERROR HANDLER ;------------------------------------------------------------------- vector dd 0 ;receives a copy of _oldint24 ;AN000; _crit_err_handler proc near ;AN000; pushf ; req by int24 handler ;AN000; push ax ; will use ax ;AN000; push ds ; will use ds ;AN000; mov ax,dgroup ; setup ;AN000; mov ds,ax ; ;AN000; ASSUME DS:DGROUP ;AN000; mov ax,word ptr _oldint24 ; load vector so we can use it ;AN000; mov word ptr vector,ax ; ;AN000; mov ax,word ptr _oldint24+2 ; ;AN000; mov word ptr vector+2,ax ; ;AN000; pop ds ; finished with ds ;AN000; ASSUME DS:NOTHING pop ax ; finished with ax ;AN000; call dword ptr vector ; invoke DOS err hndlr ;AN000; cmp al,ABORT ; what was the user's response ;AN000; jnge retry ; ;AN000; mov ax,(RET_EXIT shl 8)+XABORT ; return to DOS w/criterr error ;AN000; call call_restore ; restore user's orig append/x ;AN000; ; =================== this call does not return =============== retry: ;AN000; ASSUME DS:NOTHING ASSUME ES:NOTHING iret ; user response was "retry" ;AN000; _crit_err_handler endp ;AN000; ;------------------------------------------------------------------- ; CONTROL BREAK HANDLER ;------------------------------------------------------------------- _ctl_brk_handler proc near ;AN000; ASSUME DS:NOTHING ASSUME ES:NOTHING mov ax,(RET_EXIT shl 8)+CTLBRK ; return to DOS w/ctlbrk error ;AN000; ;------------------------------------------------------------------- call call_restore ; restore user's orig append/x ;AN000; ;------------------------------------------------------------------- ; =================== this call does not return =============== _ctl_brk_handler endp ;AN000; call_restore proc near ;input: ah has the RETURN TO DOS WITH RET CODE function request ; al has the ERRORLEVEL return code to be passed back to DOS ;output: this routine does NOT RETURN, but exits to DOS with ret code. push ax ;save errorlevel return code push ds push es mov ax,dgroup ; setup "c" code regs ;AN000; mov ds,ax ; ;AN000; ASSUME DS:DGROUP ;AN000; mov es,ax ; ;AN000; ASSUME ES:DGROUP ;AN000; ;------------------------------------------------------------------- call _restore ; restore user's orig append/x ;AN000; ;------------------------------------------------------------------- pop es pop ds pop ax ;restore return code int 21h ; ;AN000; int 20h ; in case int21 fails ;AN000; call_restore endp _TEXT ends ; end code segment ;AN000; end ;AN000; 
28.006667
71
0.525113
b569bd86d099cd8273a447291b8578f652ecd77c
627
asm
Assembly
programs/oeis/110/A110491.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/110/A110491.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/110/A110491.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A110491: Expansion of e.g.f.: sqrt(1+2x)/sqrt(1-2x). ; 1,2,4,24,144,1440,14400,201600,2822400,50803200,914457600,20118067200,442597478400,11507534438400,299195895398400,8975876861952000,269276305858560000,9155394399191040000,311283409572495360000,11828769563754823680000,449493243422683299840000,18878716223752698593280000,792906081397613340917760000,36473679744290213682216960000,1677789268237349829381980160000,83889463411867491469099008000000,4194473170593374573454950400000000,226501551212042226966567321600000000 mul $0,2 mov $1,5 lpb $0 mov $2,$0 sub $0,2 mod $2,4 add $2,$0 mul $1,$2 lpe div $1,5 mov $0,$1
41.8
464
0.832536
5676c24ce77b33200b834133990e5ec5e8cbbaa7
472
asm
Assembly
programs/oeis/339/A339332.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/339/A339332.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/339/A339332.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A339332: Sums of antidiagonals in A283683. ; 0,1,1,1,2,2,2,2,3,3,4,4,4,5,5,5,6,6,6,7,7,7,7,8,8,8,9,9,9,9,9,10,10,10,11,11,12,12,12,12,13,13,13,14,14,14,15,15,15,15,16,16,16,17,17,18,18,19,19,19,19,20,20,20,21,21,21,22,22,23,23,23,23 mov $2,$0 mov $4,$0 lpb $2,1 mov $0,$4 sub $2,1 sub $0,$2 cal $0,20906 ; Triangle where n-th row is the first n terms of the sequence in reverse order, starting with a(1) = 1 and a(2) = 2. mov $3,$0 sub $3,1 add $1,$3 lpe
31.466667
189
0.614407
acafe15f50323feacc152b8b74777c0a56c3cec4
460
asm
Assembly
libsrc/_DEVELOPMENT/temp/sp1/zx/c/sccz80/sp1_MoveSprAbs_callee.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/_DEVELOPMENT/temp/sp1/zx/c/sccz80/sp1_MoveSprAbs_callee.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/_DEVELOPMENT/temp/sp1/zx/c/sccz80/sp1_MoveSprAbs_callee.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
; void __CALLEE__ sp1_MoveSprAbs_callee(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uchar row, uchar col, uchar vrot, uchar hrot) ; 04.2006 aralbrec, Sprite Pack v3.0 ; sinclair zx version SECTION code_clib SECTION code_temp_sp1 PUBLIC sp1_MoveSprAbs_callee EXTERN asm_sp1_MoveSprAbs sp1_MoveSprAbs_callee: pop af pop de pop bc ld b,e pop de pop hl ld d,l pop hl pop iy pop ix push af jp asm_sp1_MoveSprAbs
17.037037
140
0.730435
c1d422119c4f1d17a5da137c3110d911ca5cf0b1
154
asm
Assembly
src/stack_top_win_x86.asm
znone/taskpp
1c630e232041007cc6497d10f0c30a035663ca91
[ "Apache-2.0" ]
4
2019-03-14T01:47:53.000Z
2020-06-24T10:48:54.000Z
src/stack_top_win_x86.asm
znone/taskpp
1c630e232041007cc6497d10f0c30a035663ca91
[ "Apache-2.0" ]
null
null
null
src/stack_top_win_x86.asm
znone/taskpp
1c630e232041007cc6497d10f0c30a035663ca91
[ "Apache-2.0" ]
null
null
null
.386 .MODEL FLAT .CODE ?stack_top@this_task@taskpp@@YAPAXXZ PROC PUBLIC mov eax, esp add eax, 4 ret ?stack_top@this_task@taskpp@@YAPAXXZ ENDP END
12.833333
48
0.74026
471acf2b202452cf17a8ad9f9832749cbe0a988a
1,103
asm
Assembly
programs/oeis/017/A017754.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/017/A017754.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/017/A017754.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A017754: Binomial coefficients C(n,90). ; 1,91,4186,129766,3049501,57940519,927048304,12846240784,157366449604,1731030945644,17310309456440,158940114100040,1350990969850340,10704005376506540,79515468511191440,556608279578340080,3687529852206503030,23209746716829166130,139258480300974996780,798903913305593402580,4393971523180763714190,23225278051098322489290,118237779169227823581840,580907349831423654989040,2759309911699262361197940,12692825593816606861510524,56629529572412553689816184,245394628147121065989203464,1034163075762867349525928884,4243634690199352227365018524,16974538760797408909460074096,66255457743757628324021579536,252598932648075957985332271981,941505112597374025218056650111,3433724528296305268442324253346,12263301886772518815865443761950,42921556603703815855529053166825,147325342937037421990599723032075,496253786735283947757809593371200,1641454833047477673352754808843200,5334728207404302438396453128740400,17045107199267405351949642923536400,53570336911983273963270306331114400,165694297890552917142208156791586400,504614452666683884023997568410740400 add $0,90 bin $0,90
183.833333
1,039
0.939257
8f43b1681d27d90a085075b99dda44187f2c1419
934
asm
Assembly
programs/oeis/280/A280056.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/280/A280056.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/280/A280056.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A280056: Number of 2 X 2 matrices with entries in {0,1,...,n} and even trace with no entries repeated. ; 0,0,0,8,48,144,360,720,1344,2240,3600,5400,7920,11088,15288,20384,26880,34560,44064,55080,68400,83600,101640,121968,145728,172224,202800,236600,275184,317520,365400,417600,476160,539648,610368,686664,771120,861840,961704,1068560,1185600,1310400,1446480,1591128,1748208,1914704,2094840,2285280,2490624,2707200,2940000,3185000,3447600,3723408,4018248,4327344,4656960,5001920,5368944,5752440,6159600,6584400,7034520,7503488,7999488,8515584,9060480,9626760,10223664,10843280,11495400,12171600,12882240,13618368,14390928,15190424,16028400,16894800,17801784,18738720,19718400,20729600,21785760,22875048,24011568,25182864,26403720,27661040,28970304,30317760,31719600,33161400,34660080,36200528,37800408,39443904,41149440,42900480,44716224,46579400 mov $3,$0 mul $3,$0 sub $0,1 bin $0,2 mov $2,$3 div $2,2 mul $0,$2 div $0,4 mul $0,8
71.846154
742
0.814775
263ea033d8ab0a7620144fdf3d537a3862317a56
175
asm
Assembly
floppy/impl/ebr.asm
nabijaczleweli/ASMOSis
2ba5161b4663ec670a37494c0600f29cc2e9425b
[ "MIT" ]
null
null
null
floppy/impl/ebr.asm
nabijaczleweli/ASMOSis
2ba5161b4663ec670a37494c0600f29cc2e9425b
[ "MIT" ]
null
null
null
floppy/impl/ebr.asm
nabijaczleweli/ASMOSis
2ba5161b4663ec670a37494c0600f29cc2e9425b
[ "MIT" ]
null
null
null
db 00h ; Drive number db 00h ; Reserved db 28h ; Signature db 'ASOS' ; Serial db 'ASMOSisBOOT' ; Volume label db 'FAT12' ; FS ident
25
31
0.531429
ccbdc687e99482354a52b731846b29165c8a894d
344
asm
Assembly
kernel/drivers/keyboard/keyboard.asm
conorm110/KoalemOS
5480464dd3026002bd61f72eb7bd3a097b6aa74e
[ "BSD-4-Clause" ]
null
null
null
kernel/drivers/keyboard/keyboard.asm
conorm110/KoalemOS
5480464dd3026002bd61f72eb7bd3a097b6aa74e
[ "BSD-4-Clause" ]
null
null
null
kernel/drivers/keyboard/keyboard.asm
conorm110/KoalemOS
5480464dd3026002bd61f72eb7bd3a097b6aa74e
[ "BSD-4-Clause" ]
null
null
null
; Copyright (c) 2021, Conor Mika ; All rights reserved. ; This source code is licensed under the BSD-style license found in the ; LICENSE file in the root directory of this source tree. ; Linking extern keyboard_handler global keyboard_interrupt_handler ; keyboard_interrupt_handler() - ; recurses C function keyboard_interrupt_handler: ret
28.666667
71
0.799419
89b53737e0462cc2055a67f7fb43924e9a91df16
906
asm
Assembly
data/pokemon/base_stats/machoke.asm
AtmaBuster/pokeplat-gen2
fa83b2e75575949b8f72cb2c48f7a1042e97f70f
[ "blessing" ]
6
2021-06-19T06:41:19.000Z
2022-02-15T17:12:33.000Z
data/pokemon/base_stats/machoke.asm
AtmaBuster/pokeplat-gen2-old
01e42c55db5408d72d89133dc84a46c699d849ad
[ "blessing" ]
null
null
null
data/pokemon/base_stats/machoke.asm
AtmaBuster/pokeplat-gen2-old
01e42c55db5408d72d89133dc84a46c699d849ad
[ "blessing" ]
2
2021-08-11T19:47:07.000Z
2022-01-01T07:07:56.000Z
db 0 ; species ID placeholder db 80, 100, 70, 45, 50, 60 ; hp atk def spd sat sdf db FIGHTING, FIGHTING ; type db 90 ; catch rate db 146 ; base exp db NO_ITEM, NO_ITEM ; items db GENDER_F25 ; gender ratio db 20 ; step cycles to hatch INCBIN "gfx/pokemon/machoke/front.dimensions" db GROWTH_MEDIUM_SLOW ; growth rate dn EGG_HUMANSHAPE, EGG_HUMANSHAPE ; egg groups db 70 ; happiness ; tm/hm learnset tmhm FOCUS_PUNCH, TOXIC, BULK_UP, HIDDEN_POWER, SUNNY_DAY, PROTECT, RAIN_DANCE, FRUSTRATION, EARTHQUAKE, RETURN, DIG, BRICK_BREAK, DOUBLE_TEAM, FLAMETHROWER, FIRE_BLAST, ROCK_TOMB, FACADE, SECRET_POWER, REST, ATTRACT, THIEF, FOCUS_BLAST, FLING, ENDURE, PAYBACK, CAPTIVATE, ROCK_SLIDE, SLEEP_TALK, NATURAL_GIFT, POISON_JAB, SWAGGER, SUBSTITUTE, STRENGTH, ROCK_SMASH, ROCK_CLIMB, FIRE_PUNCH, HELPING_HAND, ICE_PUNCH, MUD_SLAP, SNORE, SUPERPOWER, THUNDERPUNCH, VACUUM_WAVE ; end
45.3
471
0.757174
ec23d634825fe4a8e8a93dac66331320d855e4a2
336
asm
Assembly
oeis/076/A076740.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/076/A076740.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/076/A076740.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A076740: a(0)=0, a(1)=1, a(n)=2*a(n-1)^2-a(n-2)^2. ; Submitted by Christian Krause ; 0,1,2,7,94,17623,621131422,771608486480914039,1190759312818733806192492198418844958,2835815482129086304432303489823255992516794878843873643408264712776750007 lpb $0 sub $0,1 pow $2,2 sub $2,$1 add $1,$2 add $1,1 add $2,$1 lpe mov $0,$2
24
159
0.714286
5b3e4f6d018ff65367fb88b81e6db74b0560a5d0
122,462
asm
Assembly
Library/Cards/deck.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
504
2018-11-18T03:35:53.000Z
2022-03-29T01:02:51.000Z
Library/Cards/deck.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
96
2018-11-19T21:06:50.000Z
2022-03-06T10:26:48.000Z
Library/Cards/deck.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: Solitaire FILE: deck.asm REVISION HISTORY: Name Date Description ---- ---- ----------- Jon 6/90 Initial Version DESCRIPTION: this file contains handlers for DeckClass RCS STAMP: $Id: deck.asm,v 1.1 97/04/04 17:44:40 newdeal Exp $ ------------------------------------------------------------------------------@ CardsClassStructures segment resource DeckClass CardsClassStructures ends ;--------------------------------------------------- CardsCodeResource segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckSaveState %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Description: Deck method for MSG_DECK_SAVE_STATE marks the deck as dirty. Called by: MSG_DECK_SAVE_STATE Pass: *ds:si = Deck object ds:di = Deck instance Return: nothing Destroyed: nothing Comments: Revision History: Name Date Description ---- ------------ ----------- jon Feb 18, 1993 Initial version. PW March 23, 1993 modified. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckSaveState method dynamic DeckClass, MSG_DECK_SAVE_STATE .enter call ObjMarkDirty .leave ret DeckSaveState endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckRestoreState %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Description: Deck method for MSG_DECK_RESTORE_STATE does nothing, just there to subclass Called by: MSG_DECK_RESTORE_STATE Pass: *ds:si = Deck object ds:di = Deck instance Return: nothing Destroyed: nothing Comments: Revision History: Name Date Description ---- ------------ ----------- jon Feb 18, 1993 Initial version. PW March 23, 1993 modified. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckRestoreState method dynamic DeckClass, MSG_DECK_RESTORE_STATE .enter .leave ret DeckRestoreState endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckGetVMFile %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Description: Deck method for MSG_DECK_GET_VM_FILE Called by: MSG_DECK_GET_VM_FILE Pass: *ds:si = Deck object ds:di = Deck instance Return: cx = vm file Destroyed: ax Comments: Revision History: Name Date Description ---- ------------ ----------- jon Sep 2, 1992 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckGetVMFile method dynamic DeckClass, MSG_DECK_GET_VM_FILE .enter mov ax, MSG_GAME_GET_VM_FILE call VisCallParent .leave ret DeckGetVMFile endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckAddCardFirst %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_ADD_CARD_FIRST handler for DeckClass This method moves the card into the proper position (DI_topCardLeft, DI_topCardTop), and then adds the card into the deck's child tree as the first child. CALLED BY: DeckPushCard, DeckGetDealt; PASS: ds:di = deck instance *ds:si = instance data of deck ^lcx:dx = child to be added CHANGES: card in ^lcx:dx is moved to DI_topCardLeft, DI_topCardTop card is added to deck's vis tree as first child DI_nCards is updated accordingly RETURN: nothing DESTROYED: ax, bx, cx, dx, di PSEUDO CODE/STRATEGY: moves card adds card gets card's attributes KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckAddCardFirst method DeckClass, MSG_DECK_ADD_CARD_FIRST ;;move the card (visually) to where it is supposed to be push cx, dx, si ;save card OD and deck offset mov bx, cx mov si, dx ;^lbx:si = card mov cx, ds:[di].DI_topCardLeft mov dx, ds:[di].DI_topCardTop mov ax, MSG_VIS_SET_POSITION ;move card to topCard(Left,Top) mov di, mask MF_FIXUP_DS call ObjMessage pop cx, dx, si ;restore card OD and ;deck offset ;;add the card into the deck's composite mov bp, CCO_FIRST or mask CCF_MARK_DIRTY ;card as the first child mov ax, MSG_VIS_ADD_CHILD GOTO ObjCallInstanceNoLock DeckAddCardFirst endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckCardDoubleClicked %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_CARD_DOUBLE_CLICKED handler for DeckClass This method is called by a child card when it gets double clicked. The deck turns this event into a sort of psuedo-drag, then asks if anydeck wants it. CALLED BY: called by the double clicked card in CardStartSelect PASS: ds:di = deck instance *ds:si = instance data of deck bp = # of card double clicked in composite CHANGES: sends a message to the playing table to check its children for acceptance of the double clicked card. If it is accepted, it is transferred. Otherwise, no changes. RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: checks to make sure double clicked card is top card checks to make sure card is face up sets up drag data informs playing table of the double click if card is accepted by another deck: new top card of deck *ds:si is maximized DI_topCard(Left,Top) is updated we check if we need to uncover the deck (valid only for TalonClass) KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckCardDoubleClicked method DeckClass, MSG_DECK_CARD_DOUBLE_CLICKED test ds:[di].DI_deckAttrs, mask DA_IGNORE_DOUBLE_CLICKS jnz endDCDC tst bp ;test if card is first child jnz endDCDC ;if not, jump to end mov ax, MSG_CARD_GET_ATTRIBUTES ;get card's attrs call VisCallFirstChild test bp, mask CA_FACE_UP ;test if card is face up jz endDCDC ;if not, jump to end push bp ;save card attrs mov bp,1 ;bp <- # cards to drag mov ax, MSG_DECK_SETUP_DRAG ;setup deck's drag data call ObjCallInstanceNoLock pop bp ;restore card attrs mov ax, MSG_GAME_BROADCAST_DOUBLE_CLICK call DeckCallParentWithSelf ;tell playing table to tell the ;foundations that a card has ;been double clicked jnc endDCDC ;if nobody took the cards, ;jump to end Deref_DI Deck_offset clr ds:[di].DI_nDragCards ;clear # drag cards call ObjMarkDirty mov ax, MSG_DECK_REPAIR_SUCCESSFUL_TRANSFER call ObjCallInstanceNoLock endDCDC: Deref_DI Deck_offset clr ds:[di].DI_nDragCards ;clear # drag cards call ObjMarkDirty ret DeckCardDoubleClicked endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckDragOrFlip %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_DRAG_OR_FLIP handler for DeckClass Deck will either start a drag or flip a card, depending on whether the card is face up or face down. CALLED BY: called by the selected card PASS: *ds:si = instance data of deck cx,dx = mouse position bp = # of selected card in deck's composite CHANGES: RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: issues a MSG_[UP|DOWN]_CARD_SELECTED to self, depending on the attrs of the selected card KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckDragOrFlip method DeckClass, MSG_DECK_DRAG_OR_FLIP push bp ;save card # mov ax, MSG_CARD_GET_ATTRIBUTES call DeckCallNthChild test bp, mask CA_FACE_UP ;see if card is face up pop bp ;restore card # jz cardIsFaceDown ;if card face down, jmp ;cardIsFaceUp: Deref_DI Deck_offset mov cx, ds:[di].DI_initLeft mov dx, ds:[di].DI_initTop mov ax, MSG_DECK_UP_CARD_SELECTED call ObjCallInstanceNoLock jmp endDeckDragOrFlip cardIsFaceDown: mov ax, MSG_DECK_DOWN_CARD_SELECTED call ObjCallInstanceNoLock endDeckDragOrFlip: ret DeckDragOrFlip endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckCardSelected %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_CARD_SELECTED handler for DeckClass CALLED BY: called by the selected card PASS: ds:di = deck instance *ds:si = instance data of deck cx,dx = mouse position bp = # of selected card in deck's composite CHANGES: RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckCardSelected method DeckClass, MSG_DECK_CARD_SELECTED mov ds:[di].DI_initLeft, cx mov ds:[di].DI_initTop, dx call ObjMarkDirty mov ax, MSG_GAME_DECK_SELECTED call DeckCallParentWithSelf ret DeckCardSelected endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckFlipCard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_CARD_FLIP_CARD handler for DeckClass. Flips the top card (i.e., if it's face up, turns it face down, and vice-versa) and sends it a fade redraw. CALLED BY: PASS: *ds:si = deck object CHANGES: top card gets flipped RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 10/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckFlipCard method DeckClass, MSG_CARD_FLIP_CARD mov ax, MSG_CARD_FLIP call VisCallFirstChild mov ax, MSG_CARD_FADE_REDRAW call VisCallFirstChild mov ax, MSG_GAME_NOTIFY_CARD_FLIPPED call VisCallParent ret DeckFlipCard endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckCheckDragCaught %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_CHECK_DRAG_CAUGHT handler for DeckClass checks to see whether a drag area intersects with this deck's catch area CALLED BY: PASS: *ds:si = instance data of deck ^lcx:dx = dragging deck CHANGES: nothing RETURN: carry set if drag area of deck ^lcx:dx overlaps with catch area of deck *ds:si DESTROYED: ax, bx, cx, dx, bp PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckCheckDragCaught method DeckClass, MSG_DECK_CHECK_DRAG_CAUGHT CallObjectCXDX MSG_DECK_GET_DRAG_BOUNDS, MF_CALL push ax ;save drag left push bp ;save drag top push cx ;save drag right push dx ;save drag bottom mov ax, MSG_DECK_GET_CATCH_BOUNDS call ObjCallInstanceNoLock mov bx, bp ;at this point, ;ax = catch left ;bx = catch top ;cx = catch right ;dx = catch bottom pop bp ;bp <- drag bottom cmp bx, bp jle continue1 ;if catch top <= drag bottom, continue add sp, 6 ;else clear stack jmp noIntersect ;catch area is below drag area continue1: pop bp ;bp <- drag right cmp ax, bp jle continue2 ;if catch left <= drag right, continue add sp, 4 ;else clear stack jmp noIntersect ;catch area is to right of drag area continue2: pop bp ;bp <- drag top cmp bp, dx jle continue3 ;if drag top <= catch bottom, continue add sp, 2 ;else clear stack jmp noIntersect ;catch area is above drag area continue3: pop bp ;bp <- drag left cmp bp, cx jg noIntersect ;if drag left > catch right, drag area ;is left of catch area ;yesIntersect: stc ;set carry to indicate that ;areas intersect jmp endDeckCheckDragCaught noIntersect: clc ;clear carry to indicate that ;areas do not intersect endDeckCheckDragCaught: ret DeckCheckDragCaught endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckClipNthCard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_CLIP_NTH_CARD handler for DeckClass CALLED BY: used when full drag cards are misplaced, the card immediately under the drag cards must be re-clipped PASS: *ds:si = instance data of deck bp = nth card to clip (0 = top card) cx = (left of card to be placed onto nth) - (left of nth) dx = (top of card to be placed onto nth) - (top of nth) CHANGES: bp'th card is clipped according to offsets in cx,dx RETURN: nothing DESTROYED: ax, bx, cx, dx, di, si PSEUDO CODE/STRATEGY: calls MSG_VIS_FIND_CHILD with cx, dx as passed passes MSG_CARD_CLIP_BOUNDS to child returned (if any) KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckClipNthCard method DeckClass, MSG_DECK_CLIP_NTH_CARD tst bp mov ax, MSG_CARD_CLIP_BOUNDS ;tell card to clip its bounds jnz callChild call VisCallFirstChild ;for top card, do it quickly jmp endDeckClipNthCard callChild: call DeckCallNthChild endDeckClipNthCard: ret DeckClipNthCard endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckDraggableCardSelected %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_DRAGGABLE_CARD_SELECTED handler for DeckClass CALLED BY: PASS: *ds:si = instance data of deck cx,dx = mouse position bp = # of children to drag CHANGES: GState is created (destroyed in DeckEndSelect) drag data is set up (via MSG_DECK_SETUP_DRAG) if outline dragging: *inital outline is drawn (via MSG_DECK_DRAW_DRAG_OUTLINE) if full dragging: *deck registers itself with the playing table in order to assure that it is redrawn during an exposed event (in case the drag goes off the screen, we don't want the graphics to be lost) *card immediately beneath selected card is maximized RETURN: nothing DESTROYED: ax, bx, cx, dx, bp, di PSEUDO CODE/STRATEGY: [0]: Grab mouse and Ptr Events [1]: Create GState [2]: call MSG_DECK_SETUP_DRAG on self [3]: check drag type from playing table [4 outline]: call MSG_DECK_DRAW_DRAG_OUTLINE [4 full]: register self as dragger with playing table [5 full]: maximize card below selected card KNOWN BUGS/IDEAS: RENAME THIS TO REFLECT ACTUAL PURPOSE!!!!!!!!! none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckDraggableCardSelected method DeckClass, MSG_DECK_DRAGGABLE_CARD_SELECTED push cx,dx,bp ;save mouse position, n cards call VisForceGrabMouse ;grab mouse events ; call VisSendAllPtrEvents ;and ptr events mov ax, MSG_VIS_VUP_CREATE_GSTATE call ObjCallInstanceNoLock Deref_DI Deck_offset mov ds:[di].DI_gState, bp ;save gstate for later use call ObjMarkDirty pop cx,dx,bp ;restore mouse position, n card mov ax, MSG_DECK_SETUP_DRAG call ObjCallInstanceNoLock ;set up drag data mov ax, MSG_GAME_MARK_ACCEPTORS call DeckCallParentWithSelf mov ax, MSG_GAME_GET_DRAG_TYPE call VisCallParent cmp cl, DRAG_OUTLINE ;see if we're outline dragging jne fullDragging ;if not, jump to full dragging ;outlineDragging: Deref_DI Deck_offset mov di, ds:[di].DI_gState ;di <- graphics state ;change the graphics state to our liking and draw the outline mov al, MM_INVERT call GrSetMixMode ;set invert mode clr ax, dx call GrSetLineWidth ;set line width = 1 mov ax, MSG_DECK_DRAW_DRAG_OUTLINE call ObjCallInstanceNoLock ;draw the outline jmp checkInvertAcceptors fullDragging: ; set first card under last drag card to drawable, full-size Deref_DI Deck_offset mov bp, ds:[di].DI_nDragCards mov ax, MSG_CARD_MAXIMIZE call DeckCallNthChild checkInvertAcceptors: mov ax, MSG_DECK_GET_DROP_CARD_ATTRIBUTES call ObjCallInstanceNoLock mov ax, MSG_GAME_INVERT_ACCEPTORS call DeckCallParentWithSelf ;the deck must register itself with the playing table as being a ;dragger so that MSG_EXPOSEDs are passed to the deck no matter what mov ax, MSG_GAME_REGISTER_DRAG call DeckCallParentWithSelf ret DeckDraggableCardSelected endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckDraw %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_VIS_DRAW handler for DeckClass CALLED BY: PASS: ds:di = deck instance *ds:si = instance data of deck bp = gState CHANGES: draws deck RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: checks to see if deck owns any visible children. if so, processes them, then frees ClipRect if not, draws its marker KNOWN BUGS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckDraw method DeckClass, MSG_VIS_DRAW .enter ;;we want to draw the marker instead of the children when the ;number of cards in the deck is not greater than the number of drag ;cards (i.e., when there are no undragged cards) mov dx, ds:[di].DI_nCards ;dx <- # total cards sub dx, ds:[di].DI_nDragCards ;dx <- (total - drag) cards jnz drawChildren ;if the deck has any cards that ;are not currently dragging, ;then we want to draw them mov ax, MSG_DECK_DRAW_MARKER call ObjCallInstanceNoLock ;otherwise, draw the marker jmp done drawChildren: mov ax, MSG_DECK_DRAW_REVERSE call ObjCallInstanceNoLock ;draw children in reverse order done: .leave ret DeckDraw endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckDrawDragOutline %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_DRAW_DRAG_OUTLINE handler for DeckClass CALLED BY: DeckDraggableCardSelected, DeckOutlinePtr, etc. PASS: ds:di = deck instance *ds:si = instance data of deck CHANGES: draws outine of drag cards RETURN: nothing DESTROYED: ax, bx, cx, dx, bp PSEUDO CODE/STRATEGY: draws a big box around entire drag area draws in horizontal lines as needed to show multiple cards KNOWN BUGS/IDEAS: this outline drawer will only look good if DI_offsetFromUpCardX is 0. For the present, this is OK because it is 0. REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckDrawDragOutline method DeckClass, MSG_DECK_DRAW_DRAG_OUTLINE mov si, ds:[di].DI_offsetFromUpCardY ;si <- vert. offset mov bp, ds:[di].DI_nDragCards ;bp <- # drag cards dec bp ;bp <- # of extra ;lines we have to ;draw other than the ;bounding box mov ax, ds:[di].DI_dragWidth mov bx, ds:[di].DI_dragHeight mov cx, ds:[di].DI_prevLeft mov dx, ds:[di].DI_prevTop CONVERT_WHLT_TO_LTRB ;;now ax,bx,cx,dx = left,top,right,bottom of drag area mov di, ds:[di].DI_gState ;di <- gState push ax, dx mov dx, 5 clr ax call GrSetLineWidth ;set line width = 5 pop ax, dx call GrDrawRect ;draw bounding outline ;;this loop draws in the extra lines we need to indicate multiple cards startLoop: dec bp ; tst bp ;see if we're done yet jl endLoop ;if so, end add bx, si ;otherwise add vert. offset to top ; mov dx, bx ;set dx = bx so we get a horizontal line ; call GrDrawLine ;draw in our line call GrDrawHLine ;This one line should replace the two ;preceeding lines jmp startLoop endLoop: ret DeckDrawDragOutline endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckDrawDrags %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_DRAW_DRAGS handler for DeckClass Deck sends MSG_VIS_DRAW's to each of its drag cards CALLED BY: PlayingTableDraw PASS: ds:di = deck instance *ds:si = instance data of deck bp = gstate CHANGES: RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: draws drag cards. used for conditions where the drag area has gone out of bounds and we need to expose the area. KNOWN BUGS/IDEAS: This should be changed to use ObjCompProcessChildren stuff instead of the vis links. REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckDrawDrags method DeckClass, MSG_DECK_DRAW_DRAGS mov cx, ds:[di].DI_nDragCards ;cx <- # drag cards jcxz endLoop mov si, ds:[si] add si, ds:[si].Vis_offset mov bx, ds:[si].VCI_comp.CP_firstChild.handle mov si, ds:[si].VCI_comp.CP_firstChild.chunk mov ax, MSG_VIS_DRAW startLoop: dec cx ;cx-- tst cx ;test for more drag cards jl endLoop ;if none, jump mov di, mask MF_FIXUP_DS call ObjMessage ;make the call mov si, ds:[si] add si, ds:[si].Vis_offset add si, offset VI_link mov bx, ds:[si].LP_next.handle mov si, ds:[si].LP_next.chunk jmp startLoop ;jump to start of loop endLoop: ret DeckDrawDrags endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckDrawMarker %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_DRAW_MARKER handler for DeckClass draws a colored box in the bounds of the deck CALLED BY: DeckDraw PASS: ds:di = deck instance *ds:si = instance data of deck bp = gstate CHANGES: changes color, area mask, draw mode of gstate, then fills a box in the vis bounds of the deck RETURN: nothing DESTROYED: ax, bx, cx, dx, di PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: probably want to put in cool bitmaps eventually to replace the colored boxes REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckDrawMarker method DeckClass, MSG_DECK_DRAW_MARKER uses ax, cx, dx, bp .enter mov cl, ds:[di].DI_markerMask mov al, ds:[di].DI_markerColor ;get our color into al mov di,bp ;move gstate into di mov ah, CF_INDEX call GrSetAreaColor ;set our color mov al, cl call GrSetAreaMask mov al, MM_COPY ;copy mode call GrSetMixMode mov al, CMT_DITHER call GrSetAreaColorMap clr cl ;clear CompBoundsFlags call VisGetBounds mov cx, ax mov dx, bx mov ax, MSG_GAME_DRAW_BLANK_CARD call VisCallParent mov di, bp mov al, SDM_100 call GrSetAreaMask .leave ret DeckDrawMarker endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckDrawReverse %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_DRAW_REVERSE handler for DeckClass CALLED BY: PASS: *ds:si = instance data of deck bp = graphics state CHANGES: nothing RETURN: nothing DESTROYED: ax, bx, cx, dx, di PSEUDO CODE/STRATEGY: cycles through children and pushes their OD to the stack then pops each one off the stack and sends each a MSG_VIS_DRAW KNOWN BUGS/IDEAS: THIS METHOD WONT BE NEEDED IF VIS BOUNDS DONT OVERLAP, WHICH WOULD HAPPEN IF EITHER OF THE DI_offsetFromUpCard IN TALON IS ZEROED i would prefer the routine to use the next sibling links, rather than calling MSG_VIS_FIND_CHILD each time REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckDrawReverse method DeckClass, MSG_DECK_DRAW_REVERSE push bp ;gstate clr dx clr bx startPushLoop: push dx ;save # of child we're about to examine push bx ;save # pushed so far clr cx ;cx:dx = # of child mov ax, MSG_VIS_FIND_CHILD call ObjCallInstanceNoLock jc endPushLoop ;if no children, we're done CallObjectCXDX MSG_CARD_QUERY_DRAWABLE, MF_CALL ;do we want to draw it? jnc checkOutNext ;if not, check next ;;otherwise, get the OD of this child onto the stack ; we want it so that the OD's are always at the bottom of the stack: ; ; +---------------------+ ; top of stack ->| # pushed so far | ; +---------------------+ ; |# of child to examine| ; +---------------------+ ; | gstate | ; +---------------------+ ; | OD | ; | #1 | ; +---------------------+ ; | OD | ; | #2 | ; +---------------------+ ; | OD | ; | #3 | ; . ; . ; . ; ; pop bx ;get # pushed so far off stack pop ax ;get # of child just examined off stack pop bp ;get gstate off stack push cx,dx ;push card OD push bp ;put gstate back on stack push ax ;put # of child just examined back on stack inc bx ;increment # of OD's pushed on stack push bx ;and push it onto the stack checkOutNext: pop bx ;restore # of OD's on stack so far pop dx ;restore # of child just examined inc dx ;get number of next child jmp startPushLoop endPushLoop: pop bx ; # of ODs pushed pop dx ; junk pop bp ; gstate startDrawLoop: dec bx ;see if there are any more ODs on the stack jl endDrawLoop ;if not, end pop cx,si ;otherwise, pop one off push bx ;save # of ODs mov bx, cx ;^lbx:si <- OD mov ax, MSG_VIS_DRAW ;draw the card mov di, mask MF_FIXUP_DS call ObjMessage pop bx ;restore # of ODs jmp startDrawLoop endDrawLoop: ret DeckDrawReverse endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckDropDrags %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_DROP_DRAGS handler for DeckClass CALLED BY: DeckEndSelect PASS: *ds:si = instance data of deck CHANGES: RETURN: nothing DESTROYED: ax, cx, dx PSEUDO CODE/STRATEGY: sends a method to the playing table asking it to give the drag cards to any deck that'll take them. if the cards are taken: issues a MSG_DECK_REPAIR_SUCCESSFUL_TRANSFER to self else: issues a MSG_DECK_REPAIR_FAILED_TRANSFER to self KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckDropDrags method DeckClass, MSG_DECK_DROP_DRAGS push si mov ax, MSG_DECK_GET_DROP_CARD_ATTRIBUTES call ObjCallInstanceNoLock mov ax, MSG_GAME_DROPPING_DRAG_CARDS call DeckCallParentWithSelf ;tell parent to ;advertise the dropped ;cards pop si mov ax, MSG_DECK_REPAIR_SUCCESSFUL_TRANSFER jc repair mov ax, MSG_DECK_REPAIR_FAILED_TRANSFER ;do visual repairs repair: call ObjCallInstanceNoLock ret DeckDropDrags endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckEndSelect %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_META_END_SELECT, MSG_META_END_MOVE_COPY handler for DeckClass CALLED BY: PASS: ds:di = deck instance *ds:si = instance data of deck CHANGES: DI_gState cleared DI_nDragCards zeroed RETURN: nothing DESTROYED: ax, bx, cx, dx, bp, PSEUDO CODE/STRATEGY: [outline 0] erases last outline [full 0] invalidates last drag region [1] send self a MSG_DRAP_DRAGS [2] release mouse [3] destroy gState [4] clear DI_gState and DI_nDragCards [5] send a method to playing table to inform that it is no longer dragging KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckEndDrag method DeckClass, MSG_META_END_SELECT, MSG_META_END_MOVE_COPY tst ds:[di].DI_gState ;if we have a gstate, we're dragging, jnz getDragType ;so continue jmp endDeckEndDrag ;otherwise, end getDragType: ; CallObject MyPlayingTable, MSG_GAME_GET_DRAG_TYPE, MF_CALL mov ax, MSG_GAME_GET_DRAG_TYPE call VisCallParent cmp cl, DRAG_OUTLINE ;see what kind of drag we're doing jne eraseDragArea ;if full dragging, erase drag area ;eraseOutline: mov ax, MSG_DECK_DRAW_DRAG_OUTLINE ;erase the outline call ObjCallInstanceNoLock jmp invertAcceptors eraseDragArea: Deref_DI Deck_offset mov cx, ds:[di].DI_prevLeft mov dx, ds:[di].DI_prevTop cmp cx, ds:[di].DI_initLeft ;have we moved horizontally? jne loadDimensions ;if so, go ahead with erasing cmp dx, ds:[di].DI_initTop ;have we moved vertically? je invertAcceptors ;if not, don't erase loadDimensions: mov ax, ds:[di].DI_dragWidth mov bx, ds:[di].DI_dragHeight CONVERT_WHLT_TO_LTRB mov di, ds:[di].DI_gState call GrInvalRect ;erase the last drag area invertAcceptors: mov ax, MSG_GAME_GET_USER_MODE call VisCallParent cmp cl, INTERMEDIATE_MODE jne $10 clr cx clr dx mov ax, MSG_GAME_REGISTER_HILITED call VisCallParent $10: mov ax, MSG_DECK_GET_DROP_CARD_ATTRIBUTES call ObjCallInstanceNoLock mov ax, MSG_GAME_INVERT_ACCEPTORS call DeckCallParentWithSelf mov ax, MSG_DECK_DROP_DRAGS ;drop these babies!!! call ObjCallInstanceNoLock call VisReleaseMouse ;We no longer want all the mouse events Deref_DI Deck_offset mov di, ds:[di].DI_gState tst di jz cleanUp call GrDestroyState ;Free the gstate cleanUp: Deref_DI Deck_offset clr ds:[di].DI_gState ;clear gstate pointer clr ds:[di].DI_nDragCards ;no longer dragging any cards call ObjMarkDirty endDeckEndDrag: ; do this since the mouse event is processed here (return code) mov ax, mask MRF_PROCESSED ret DeckEndDrag endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckFullPtr %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_FULL_ PTR handler for DeckClass CALLED BY: DeckPtr when the game is in full card dragging mode PASS: ds:di = deck instance *ds:si = instance data of deck cx,dx = mouse coordinates CHANGES: moves dragged cards to reflect new mouse position bit blts to reflect new mouse position RETURN: nothing DESTROYED: ax, bx, cx, dx, bp, di PSEUDO CODE/STRATEGY: calculate spatial differences between this mouse event and the last (deltaX and deltaY) move the dragged cards by deltaX and deltaY via (MSG_CARD_MOVE_RELATIVE) update the drag coordinates call GrBitBlt KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckFullPtr method DeckClass, MSG_DECK_FULL_PTR push cx,dx ;save mouse position ;;get the x and y distances between this mouse event and ; the last one sub cx, ds:[di].DI_dragOffsetX ;cx <- new left sub dx, ds:[di].DI_dragOffsetY ;dx <- new top sub cx, ds:[di].DI_prevLeft ;cx <- change in x from last sub dx, ds:[di].DI_prevTop ;dx <- change in y from last mov bp, ds:[di].DI_nDragCards ;bp <- # drag cards push si tst bp ;any drag cards? jz endLoop ;;Point to first child mov si, ds:[si] ;load ^lbx:si with first child add si, ds:[si].Vis_offset add si, offset VCI_comp ; mov bx, ds:[si].CP_firstChild.handle mov si, ds:[si].CP_firstChild.chunk startLoop: dec bp ;bp-- tst bp ;test for more drag cards jl endLoop ;if none, jump call VisSetPositionRelative mov si, ds:[si] add si, ds:[si].Vis_offset add si, offset VI_link mov si, ds:[si].LP_next.chunk jmp startLoop ;jump to start of loop endLoop: pop si pop cx,dx mov ax, MSG_DECK_UPDATE_DRAG ;update drag data call ObjCallInstanceNoLock ; ; See if the hilight status has changed. ; ; Currently has visual bug ; push ax, bp, cx, dx mov ax, MSG_GAME_CHECK_HILITES call DeckCallParentWithSelf pop ax, bx, cx, dx Deref_DI Deck_offset push ds:[di].DI_dragHeight ;push height to stack mov si, BLTM_MOVE push si ;push BLTM_MOVE to stack mov si, ds:[di].DI_dragWidth ;si <- width mov di, ds:[di].DI_gState ;di <- gstate call GrBitBlt ;do the move ret DeckFullPtr endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckGetCatchBounds %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_GET_CATCH_BOUNDS handler for DeckClass Returns the boundaries against which drag boundaries are tested. CALLED BY: PASS: *ds:si = instance data of deck CHANGES: nothing RETURN: ax = left of catch boundary bp = top of catch boundary cx = right of catch boundary dx = bottom of catch boundary DESTROYED: ax, bp, cx, dx PSEUDO CODE/STRATEGY: currently, catch boundaries = vis boundaries, so this routine just passes the call on to MSG_VIS_GET_BOUNDS KNOWN BUGS/IDEAS: may want to change boundaries to be the bounds of just the first card in the deck (i think the windows version does it this way) REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckGetCatchBounds method DeckClass, MSG_DECK_GET_CATCH_BOUNDS ;;for now, the catch bounds are the same as the vis bounds mov ax, MSG_VIS_GET_BOUNDS call ObjCallInstanceNoLock ret DeckGetCatchBounds endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckGetDragBounds %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_GET_DRAG_BOUNDS handler for DeckClass Returns vis bounds of a deck's drag region CALLED BY: PASS: ds:di = deck instance *ds:si = instance data of deck CHANGES: nothing RETURN: ax = left of drag region bp = top of drag region cx = right of drag region dx = bottom of drag region DESTROYED: bx PSEUDO CODE/STRATEGY: loads in drag parameters and passes them to CovertWHLT2LTRB to get them into the proper format KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckGetDragBounds method DeckClass, MSG_DECK_GET_DRAG_BOUNDS mov cx, ds:[di].DI_prevLeft mov dx, ds:[di].DI_prevTop mov ax, ds:[di].DI_dragWidth mov bx, ds:[di].DI_dragHeight CONVERT_WHLT_TO_LTRB mov bp, bx ret DeckGetDragBounds endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckGetDropCardAttributes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_GET_DROP_CARD_ATTRIBUTES handler for DeckClass CALLED BY: PASS: ds:di = deck instance *ds:si = instance data of deck CHANGES: nothing RETURN: bp = CardAttrs of the drop card The "drop card" is the card in a drag group whose attributes must be checked when determining the legality of a transfer For example, in the following drag group: +--------------------+ ! ! ! 6 Hearts ! ! ! +--------------------+ ! ! ! 5 Clubs ! ! ! +--------------------+ ! ! ! 4 Diamonds ! ! ! +--------------------+ ! ! ! 3 Clubs ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! +--------------------+ the 6 of Hearts is the "drop card", because this group wants to find a black 7 to land on, and the red 6 is what dictates this criteria. In general, the drop card is the last card in a drag group. DESTROYED: ax, cx, dx PSEUDO CODE/STRATEGY: get attributes of card #(DI_nDragCards - 1) KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckGetDropCardAttributes method DeckClass, MSG_DECK_GET_DROP_CARD_ATTRIBUTES mov bp, ds:[di].DI_nDragCards dec bp mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock ret DeckGetDropCardAttributes endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckGetNthCardAttributes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_GET_NTH_CARD_ATTRIBUTES handler for DeckClass Returns the attributes of the deck's nth card CALLED BY: PASS: bp = # of card to get attributes of (n=0 for top card) CHANGES: nothing RETURN: bp = attributes of nth card carry = clear for success DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 10/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckGetNthCardAttributes method DeckClass, MSG_DECK_GET_NTH_CARD_ATTRIBUTES mov ax, MSG_CARD_GET_ATTRIBUTES call DeckCallNthChild ret DeckGetNthCardAttributes endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckImplodeExplode %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_IMPLODE_EXPLODE handler for DeckClass This is the effect of an illegal drop in outline dragging mode. the outline of the drag region shinks to nothing (implodes), then an outline grows to the size of the drag, only relocated to where the drag began. CALLED BY: DeckRepairFailedTransfer PASS: ds:di = deck instance *ds:si = instance data of deck CHANGES: DI_dragOffset(X,Y) are changed to store the offset between the initial and final mouse coordinates of the drag RETURN: nothing DESTROYED: ax, bx, cx, dx, bp, di PSEUDO CODE/STRATEGY: draw and erase a bunch of ever-shrinking outlines at the point where the cards were droped, then draw and erase a bunch of ever-growing outlines at the point where the cards were originally selected KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckImplodeExplode method DeckClass, MSG_DECK_IMPLODE_EXPLODE ;draw first outline mov cx, ds:[di].DI_prevLeft mov dx, ds:[di].DI_prevTop ; since we no longer need the info in DI_dragOffset(X,Y), we'll ; use these slots to store the offset between the initial and final ; mouse coordinates of the drag mov ds:[di].DI_dragOffsetX, cx mov ax, ds:[di].DI_initLeft sub ds:[di].DI_dragOffsetX, ax mov ds:[di].DI_dragOffsetY, dx mov ax, ds:[di].DI_initTop sub ds:[di].DI_dragOffsetY, ax call ObjMarkDirty mov ax, ds:[di].DI_dragWidth mov bx, ds:[di].DI_dragHeight CONVERT_WHLT_TO_LTRB mov di, ds:[di].DI_gState call GrDrawRect ; draw the first outline clr bp ; clear counter startImplodeLoop: push ax, bx, cx, dx ; old coords inc ax ; increment left inc bx ; increment top dec cx ; decrement bottom dec dx ; decrement right cmp ax,cx jge endImplodeLoop inc bp ; increment the counter call GrDrawRect ; draw the new outline pop ax, bx, cx, dx ; restore old coords call GrDrawRect ; erase the old outline inc ax inc bx ; shrink the outline dec cx dec dx jmp startImplodeLoop ; loop back endImplodeLoop: pop ax, bx, cx, dx call GrDrawRect ; erase last outline from imploding ; reposition ourselves so we can explode where the dragging originated Deref_DI Deck_offset sub ax, ds:[di].DI_dragOffsetX sub bx, ds:[di].DI_dragOffsetY sub cx, ds:[di].DI_dragOffsetX sub dx, ds:[di].DI_dragOffsetY mov di, ds:[di].DI_gState call GrDrawRect ; draw initial outline startExplodeLoop: push ax, bx, cx, dx ; old coords dec ax ; dec bx ; grow the outline inc cx ; inc dx ; tst bp jz endExplodeLoop dec bp call GrDrawRect ; draw new outline pop ax, bx, cx, dx ; restore old coords call GrDrawRect ; erase old outline dec ax ; dec bx ; grow the outline inc cx ; inc dx ; jmp startExplodeLoop ; loop back endExplodeLoop: pop ax, bx, cx, dx ; restore old coords call GrDrawRect ; erase last outline ret DeckImplodeExplode endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckInvalidateInit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_INVALIDATE_INIT handler for DeckClass Invalidates the initial drag area CALLED BY: PASS: ds:di = deck instance *ds:si = instance data of deck CHANGES: nothing RETURN: nothing DESTROYED: ax, bx, cx, dx, bp, di PSEUDO CODE/STRATEGY: creates a graphics state calculates initial drag area calls WinInvalRect on the area destroys th graphics state KNOWN BUGS/IDEAS: rename method to MSG_DECK_INVALIDATE_INIT_AREA REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckInvalidateInit method DeckClass, MSG_DECK_INVALIDATE_INIT tst ds:[di].DI_gState jnz clean mov ax, MSG_VIS_VUP_CREATE_GSTATE call ObjCallInstanceNoLock Deref_DI Deck_offset mov ds:[di].DI_gState, bp call ObjMarkDirty clean: mov bp, ds:[di].DI_gState push bp mov ax, MSG_DECK_CLEAN_AFTER_SHRINK call ObjCallInstanceNoLock pop bp tst ds:[di].DI_nCards jz drawMarker mov ax, MSG_VIS_DRAW call VisCallFirstChild jmp done drawMarker: mov ax, MSG_VIS_INVALIDATE call ObjCallInstanceNoLock done: Deref_DI Deck_offset clr bp xchg bp, ds:[di].DI_gState call ObjMarkDirty mov di, bp call GrDestroyState ret DeckInvalidateInit endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckCleanAfterShrink %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_CLEAN_AFTER_SHRINK handler for DeckClass This method invalidates the portion of a deck's original vis bounds that was clipped as a result of the deck shinking. (i.e., Let A = original deck bounds, B = new deck bounds: this method invalidates A - B) CALLED BY: PASS: bp = gstate to invalidate through. Also: DI_initRight and DI_initBottom should contain the right, bottom coordinates of the deck BEFORE any shrinking occurred. CHANGES: RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 10/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckCleanAfterShrink method DeckClass, MSG_DECK_CLEAN_AFTER_SHRINK push bp mov ax, MSG_VIS_GET_BOUNDS call ObjCallInstanceNoLock mov bx, bp pop bp Deref_DI Deck_offset cmp cx, ds:[di].DI_initRight ;see if new right < old right jge checkHeights push ax, bx, cx, dx mov ax, cx ;ax <- new right + 1 ; inc ax mov cx, ds:[di].DI_initRight ;cx <- old right mov dx, ds:[di].DI_initBottom ;dx <- old top mov di, bp call GrInvalRect pop ax, bx, cx, dx checkHeights: Deref_DI Deck_offset cmp dx, ds:[di].DI_initBottom jge done mov bx, dx ; inc bx mov cx, ds:[di].DI_initRight ;cx <- old right mov dx, ds:[di].DI_initBottom ;dx <- old top sub bx, 2 ; bx = top mov di, bp call GrInvalRect done: ret DeckCleanAfterShrink endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckMoveAndClip %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_MOVE_AND_CLIP handler for DeckClass Prepares the deck to push a card into its composite. The data in DI_topCardLeft and DI_topCardTop are changed to reflect the new card coming, and the vis bounds of the current top card are clipped. CALLED BY: PASS: *ds:si = instance data of deck CHANGES: DI_topCard(Left,Top) are updated via DeckOffsetTopLeft Deck's vis bounds are stretched to cover all cards Deck's top card's vis bounds are clipped RETURN: nothing DESTROYED: ax, cx, dx PSEUDO CODE/STRATEGY: bundle calls to MSG_DECK_OFFSET_TOP_LEFT, MSG_DECK_STRETCH_BOUNDS KNOWN BUGS/IDEAS: i'm not sure why i put MSG_DECK_STRETCH_BOUNDS here. REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckMoveAndClip method DeckClass, MSG_DECK_MOVE_AND_CLIP ; ; We need to update our records regarding the origin of ; the deck's top card. ; ; cx <- amount added to DI_topCardLeft ; dx <- amount added to DI_topCardTop ; mov ax, MSG_DECK_OFFSET_TOP_LEFT call ObjCallInstanceNoLock ; ; Stretch the deck by the amount that the new card is offset ; from the old top card ; push cx,dx mov ax, MSG_DECK_STRETCH_BOUNDS call ObjCallInstanceNoLock pop cx,dx ; ; Clip the vis bounds of the deck's top card ; mov bp, 0 mov ax, MSG_DECK_CLIP_NTH_CARD call ObjCallInstanceNoLock ret DeckMoveAndClip endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckOffsetTopLeft %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_OFFSET_TOP_LEFT handler for DeckClass Adds offsets to the deck's information about the origin of its top card. CALLED BY: PASS: *ds:si = instance data of deck CHANGES: DI_topCardLeft and DI_topCardTop are offset by DI_offsetFrom[Up|Down]Card[X|Y] RETURN: cx = offset added to DI_topCardLeft dx = offset added to DI_topCardTop DESTROYED: bp, cx, dx, di PSEUDO CODE/STRATEGY: get attributes of first child if no children, clear cx,dx and return else use attributes to determine whether we want UpCard or DownCard offsets, then add them KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckOffsetTopLeft method DeckClass, MSG_DECK_OFFSET_TOP_LEFT clr bp mov ax, MSG_CARD_GET_ATTRIBUTES call VisCallFirstChild tst bp ;see if we got anything back (i.e., ;see if we have any children) jnz gotTopCardAttrs ;if so, we've got its attributes in bp ;noKids: clr cx ;no kids, so no offsets clr dx jmp endDeckOffsetTopLeft gotTopCardAttrs: Deref_DI Deck_offset test bp, mask CA_FACE_UP jz faceDown ;faceUp: mov cx, ds:[di].DI_offsetFromUpCardX ;if the card is face up mov dx, ds:[di].DI_offsetFromUpCardY ;we want up offsets jmp addOffsets faceDown: mov cx, ds:[di].DI_offsetFromDownCardX ;if card is face down, mov dx, ds:[di].DI_offsetFromDownCardY ;we want down offsets addOffsets: add ds:[di].DI_topCardLeft, cx ;add the offsets to the topCard add ds:[di].DI_topCardTop, dx ;position call ObjMarkDirty endDeckOffsetTopLeft: ret DeckOffsetTopLeft endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckOutlinePtr %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_OUTLINE_PTR handler for DeckClass Handles a new mouse event during a drag under outline dragging. CALLED BY: DeckPtr PASS: *ds:si = instance data of deck cx,dx = mouse position CHANGES: instance data in the deck is changed to reflect new mouse coordinates, old outline is erased, new outline is drawn RETURN: nothing DESTROYED: ax, cx, dx PSEUDO CODE/STRATEGY: erase old outline update drag data draw new outline KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckOutlinePtr method DeckClass, MSG_DECK_OUTLINE_PTR push cx,dx ;save mouse mov ax, MSG_DECK_DRAW_DRAG_OUTLINE ;erase old outline call ObjCallInstanceNoLock pop cx,dx ;restore mouse mov ax, MSG_DECK_UPDATE_DRAG ;update drag data call ObjCallInstanceNoLock mov ax, MSG_DECK_DRAW_DRAG_OUTLINE ;draw new outline call ObjCallInstanceNoLock mov ax, MSG_GAME_CHECK_HILITES call DeckCallParentWithSelf ret DeckOutlinePtr endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckPopAllCards %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_POP_ALL_CARDS handler for DeckClass Pops all of a deck's cards to another deck. Relative order of the cards is reversed. CALLED BY: PASS: ds:di = deck instance *ds:si = instance data of deck ^lcx:dx = instance of VisCompClass to receive the cards (usually another Deck) CHANGES: Deck's cards popped to deck in ^lcx:dx RETURN: nothing DESTROYED: ax, bp, di PSEUDO CODE/STRATEGY: sends self a MSG_DECK_POP_N_CARDS with n = total # of cards KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckPopAllCards method DeckClass, MSG_DECK_POP_ALL_CARDS mov bp, ds:[di].DI_nCards mov ax, MSG_DECK_POP_N_CARDS ;set bp = total cards and call ObjCallInstanceNoLock ;pop 'em all ret DeckPopAllCards endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckPopCard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_POP_CARD handler for DeckClass Remove deck's top card from deck's composite. CALLED BY: PASS: *ds:si = instance data of deck CHANGES: if deck has children: its top card is removed from the vis tree RETURN: if deck has children: carry clear ^lcx:dx = popped card if not: carry set DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckPopCard method DeckClass, MSG_DECK_POP_CARD clr cx clr dx mov ax, MSG_DECK_REMOVE_NTH_CARD ;remove 1st card call ObjCallInstanceNoLock ret DeckPopCard endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckPopNCards %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_POP_N_CARDS handler for DeckClass Give a certain number of cards to another deck by popping them off, and pushing them onto the other deck. CALLED BY: PASS: *ds:si = instance data of deck bp = number of cards to transfer ^lcx:dx = instance of VisCompClass to receive the cards (usually another Deck) CHANGES: The top bp cards of deck at *ds:si are popped to the top of deck at ^lcx:dx. The order of the cards is reversed (i.e., the top card of the donor will be the bp'th card of the recipient). RETURN: nothing DESTROYED: ax, bx, cx, dx, bp PSEUDO CODE/STRATEGY: loops bp times, popping cards (starting with the 0th, ending with the bp'th) from the donor and pushing them to the recipient KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckPopNCards method DeckClass, MSG_DECK_POP_N_CARDS startLoop: dec bp ;done yet? js endLoop ;if so, end push bp ;total left to pop push cx, dx ;save OD of recipient mov ax, MSG_DECK_POP_CARD call ObjCallInstanceNoLock mov bp, si ;save deck chunk in bp pop bx, si ;restore OD of recipient push bp ;push deck chunk to stack push bx, si ;save OD of recipient mov ax, MSG_DECK_PUSH_CARD ;give card to recipient mov di, mask MF_FIXUP_DS call ObjMessage pop cx, dx ;restore OD of recipient pop si ;restore deck chunk pop bp ;restore cards left to pop jmp startLoop endLoop: ret DeckPopNCards endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckPtr %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_META_PTR handler for DeckClass CALLED BY: PASS: *ds:si = instance data of deck cx,dx = mouse position bp = ButtonInfo CHANGES: nothing RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: depending on the drag type, passes the call on to either MSG_DECK_OUTLINE_PTR or MSG_DECK_FULL_PTR KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckPtr method DeckClass, MSG_META_PTR ; test bp, mask BI_B0_DOWN or mask BI_B2_DOWN ; ;see if button is still down ; jz endDeckPtr ;if not, end ; ; We'll test the gstate to see whether or not the user is ; dragging. Could also just test DI_nDragCards. ; tst ds:[di].DI_gState ;see if we have a gstate (i.e., ;if we're dragging) jz endDeckPtr ;if not, end push cx,dx ;save mouse position ;; see what kind of drag we're supposed to be doing ; CallObject MyPlayingTable, MSG_GAME_GET_DRAG_TYPE, MF_CALL mov ax, MSG_GAME_GET_DRAG_TYPE call VisCallParent cmp cl, DRAG_OUTLINE pop cx,dx ;restore mouse position jne fullDragging ;outlineDragging: mov ax, MSG_DECK_OUTLINE_PTR ;dispatch call to outline ptr call ObjCallInstanceNoLock jmp endDeckPtr fullDragging: mov ax, MSG_DECK_FULL_PTR ;dispatch call to full ptr call ObjCallInstanceNoLock endDeckPtr: mov ax, mask MRF_PROCESSED ;the ptr event has been ;processed ret DeckPtr endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckPushCard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_PUSH_CARD, MSG_DECK_PUSH_CARD_NO_EFFECTS handler for DeckClass Adds a card to the deck's composite, and does some visual operations that reflect the adoption. The two methods are identical at this level, but exist independently so they can be subclassed differently. CALLED BY: PASS: *ds:si = instance data of deck ^lcx:dx = card to be added CHANGES: RETURN: nothing DESTROYED: ax, bx, cx, dx, bp, di PSEUDO CODE/STRATEGY: [0] self-call MSG_DECK_MOVE_AND_CLIP [1] self-call MSG_DECK_ADD_CARD_FIRST [2] send added card MSG_CARD_SET_NOT_DRAWABLE [3] send added card MSG_CARD_SET_DRAWABLE via queue [4] send added card MSG_CARD_FADE_REDRAW via queue KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckPushCard method DeckClass, MSG_DECK_PUSH_CARD, MSG_DECK_PUSH_CARD_NO_EFFECTS push cx,dx ;save card OD mov ax, MSG_DECK_MOVE_AND_CLIP ;prepare to push card call ObjCallInstanceNoLock pop cx,dx ;restore card OD push cx, dx ;save card OD mov ax, MSG_DECK_ADD_CARD_FIRST ;push it call ObjCallInstanceNoLock Deref_DI Deck_offset mov dx, ds:[di].DI_pushPoints tst dx jz afterScore clr cx mov ax, MSG_GAME_UPDATE_SCORE call VisCallParent afterScore: pop bx, si ;restore card OD mov ax, MSG_CARD_SET_DRAWABLE mov di, mask MF_FIXUP_DS ; or mask MF_FORCE_QUEUE call ObjMessage mov ax, MSG_CARD_NORMAL_REDRAW mov di, mask MF_FIXUP_DS ; or mask MF_FORCE_QUEUE GOTO ObjMessage DeckPushCard endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckRedraw %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_REDRAW handler for DeckClass CALLED BY: PASS: *ds:si = instance data of deck CHANGES: nothing RETURN: nothing DESTROYED: ax, bx, cx, dx, bp, di PSEUDO CODE/STRATEGY: generates a graphics state issues a MSG_VIS_DRAW to self destroys the graphics state KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckRedraw method DeckClass, MSG_DECK_REDRAW mov ax, MSG_VIS_VUP_CREATE_GSTATE call ObjCallInstanceNoLock tst bp jz endDeckRedraw ;;draw it push bp mov ax, MSG_VIS_DRAW call ObjCallInstanceNoLock ;;destroy the graphics state pop di call GrDestroyState endDeckRedraw: ret DeckRedraw endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckRemoveNthCard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_REMOVE_NTH_CARD method handler for DeckClass Removes a card from the deck's composite CALLED BY: DeckPopCard, others PASS: *ds:si = instance data of deck ^lcx:dx = child to remove - or - if cx = 0, dx = nth child to remove (0 = first child) CHANGES: if deck has children: the card indicated by cx,dx is removed from the vis tree and DI_nCards is updated accordingly RETURN: if deck has children: carry clear ^lcx:dx = removed card if not: carry set DESTROYED: ax, bx, cx, dx, di PSEUDO CODE/STRATEGY: locates the child removes it gets its attrs decrements n[Up|Down]Cards depending on attributes KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckRemoveNthCard method DeckClass, MSG_DECK_REMOVE_NTH_CARD ;;cx:dx = number of child to remove (for pop, cx=dx=0) mov ax, MSG_VIS_FIND_CHILD call ObjCallInstanceNoLock jc cantFindNthCard ;;now ^lcx:dx = nth child mov bp, mask CCF_MARK_DIRTY mov ax, MSG_VIS_REMOVE_CHILD call ObjCallInstanceNoLock ;endDeckRemoveNthCard: push cx,dx mov dx, ds:[di].DI_popPoints tst dx jz afterScore clr cx ; CallObject MyPlayingTable, MSG_GAME_UPDATE_SCORE, MF_FIXUP_DS mov ax, MSG_GAME_UPDATE_SCORE call VisCallParent afterScore: mov ax, MSG_DECK_UPDATE_TOPLEFT call ObjCallInstanceNoLock pop cx,dx clc ; clear carry to denote that we popped a card cantFindNthCard: ret DeckRemoveNthCard endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckRemoveVisChild %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_VIS_REMOVE_CHILD handler for DeckClass This method is subclassed from VisCompClass so that we can update the number of cards we have. CALLED BY: PASS: ds:di = deck instance *ds:si - instance data (offset through Vis_offset) es - segment of VisCompClass ax - MSG_VIS_REMOVE_CHILD bp - mask CCF_MARK_DIRTY set if parent and siblings should be dirtied appropriately cx:dx - child to remove CHANGES: card ^lcx:dx is removed from the deck's composite, DI_nCards is decremented accordingly RETURN: nothing DESTROYED: ax, bx, cx, dx, bp, si, di, ds, es PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jon 12/19/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckRemoveVisChild method DeckClass, MSG_VIS_REMOVE_CHILD dec ds:[di].DI_nCards call ObjMarkDirty mov di, offset DeckClass call ObjCallSuperNoLock ret DeckRemoveVisChild endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckAddVisChild %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_VIS_ADD_CHILD handler for DeckClass This method is subclassed from VisCompClass so that we can update the number of cards we have. CALLED BY: PASS: ds:di = deck instance *ds:si - instance data (offset through Vis_offset) es - segment of VisCompClass ax - MSG_VIS_ADD_CHILD cx:dx - object to add bp - CompChildFlags CHANGES: card ^lcx:dx is added from the deck's composite, DI_nCards is incremented accordingly RETURN: nothing DESTROYED: ax, bx, cx, dx, bp, si, di, ds, es PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jon 12/19/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckAddVisChild method DeckClass, MSG_VIS_ADD_CHILD inc ds:[di].DI_nCards call ObjMarkDirty mov di, offset DeckClass GOTO ObjCallSuperNoLock DeckAddVisChild endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckRepairFailedTransfer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_REPAIR_FAILED_TRANSFER handler for DeckClass Fixes up the state of affairs (both visual and internal) when cards are dropped and no deck accepts them. CALLED BY: DeckDropDrags PASS: ds:di = deck instance *ds:si = instance data of deck CHANGES: RETURN: nothing DESTROYED: ax, bx, cx, dx, bp, di PSEUDO CODE/STRATEGY: [0] clip the vis bounds of the top *UN*dragged card in the deck to prepare for the return of the dragged cards [1] get drag type from playing table [2] check to see if there was any mouse movement if no mouse movement: jump to the end [outline dragging 3] issue self a MSG_DECK_IMPLODE_EXPLODE [outline dragging 4] jump to end [full dragging 3] move the dragged cards back to their original positions [full dragging 4] set the cards *NOT* drawable we queue the calls in [5] and [6] so that the MSG_META_EXPOSED generated by the call to WinInvalRect in DeckEndSelect can occur before [5] and [6] [full dragging 5] queue call to set drag cards drawable [full dragging 6] queue call to fade redraw drag cards KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckRepairFailedTransfer method DeckClass, MSG_DECK_REPAIR_FAILED_TRANSFER ;;the card below the drop card has been set to full size, so we must ; re-clip its bounds to prepare for the return of the drag cards mov bp, ds:[di].DI_nDragCards mov ax, MSG_CARD_GET_ATTRIBUTES call DeckCallNthChild Deref_DI Deck_offset test bp, mask CA_FACE_UP jnz faceUp ;faceDown: mov cx, ds:[di].DI_offsetFromDownCardX mov dx, ds:[di].DI_offsetFromDownCardY jmp clipCard faceUp: mov cx, ds:[di].DI_offsetFromUpCardX mov dx, ds:[di].DI_offsetFromUpCardY clipCard: mov bp, ds:[di].DI_nDragCards mov ax, MSG_DECK_CLIP_NTH_CARD call ObjCallInstanceNoLock Deref_DI Deck_offset mov cx, ds:[di].DI_initLeft mov dx, ds:[di].DI_initTop sub cx, ds:[di].DI_prevLeft ;cx <- total horizontal travel sub dx, ds:[di].DI_prevTop ;dx <- total vertical travel jnz notifyGame ;if we moved vertically, fixup jcxz endRepair ;if we haven't moved, don't fixup notifyGame: push cx, dx mov dx, si mov cx, ds:[LMBH_handle] ;^lcx:dx - self mov ax, MSG_GAME_TRANSFER_FAILED call VisCallParent ;checkType: ; CallObject MyPlayingTable, MSG_GAME_GET_DRAG_TYPE, MF_CALL mov ax, MSG_GAME_GET_DRAG_TYPE call VisCallParent cmp cl, DRAG_OUTLINE pop cx, dx jne failedFull ;failedOutline: tst cx jge checkHorizDisp neg cx checkHorizDisp: cmp cx, MINIMUM_HORIZONTAL_DISPLACEMENT jg implodeExplode tst dx jge checkVertDisp neg dx checkVertDisp: cmp dx, MINIMUM_VERTICAL_DISPLACEMENT jle endRepair implodeExplode: mov ax, MSG_DECK_IMPLODE_EXPLODE ;funky outline effect call ObjCallInstanceNoLock jmp endRepair failedFull: mov bp, MSG_CARD_MOVE_RELATIVE ;move drag cards back to where mov di, mask MF_FIXUP_DS ;they came from call DeckCallDrags mov bp, MSG_CARD_SET_NOT_DRAWABLE ; set drags not drawable, so mov di, mask MF_FIXUP_DS ; that when the area is cleaned call DeckCallDrags ; up, they don't appear mov bp, MSG_CARD_SET_DRAWABLE ; by queueing this request, we ; make sure that WinInvalRect ; is done before redrawing mov di, mask MF_FIXUP_DS or mask MF_FORCE_QUEUE call DeckCallDrags mov bp, MSG_CARD_FADE_REDRAW mov di, mask MF_FIXUP_DS or mask MF_FORCE_QUEUE call DeckCallDrags endRepair: ;; Telling the game object that no deck is dragging anymore ;; used to be handled at the end of DeckEndDrag, but that ;; handler generated methods that needed to be handled before ;; we can really say that there is no more dragger. ;; Accordingly, the sent MSG_GAME_REGISTER_DRAG has been moved to ;; the end of DeckRepairFailedTransfer and DeckRepairSuccessfulTransfer clr cx clr dx mov ax, MSG_GAME_REGISTER_DRAG call VisCallParent ret DeckRepairFailedTransfer endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckCallDrags %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Sends a method to a deck's dragging cards. Used for stuff like sending a method to move to all the dragging cards, etc. CALLED BY: DeckRepairFailedTransfer PASS: *ds:si = instance data of deck bp = method number cx, dx = other data di = flags for ObjMessage CHANGES: the dragged cards (= the first DI_nDragCards) are called with message #bp and data cx,dx RETURN: nothing DESTROYED: ax, bx, cx, dx, di, bp PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version jon 10/90 merged two methods into one fuunction by letting the user pass in his own ObjMessage flags %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckCallDrags proc near class DeckClass push si mov ax, bp ;ax <- method # push di Deref_DI Deck_offset mov bp, ds:[di].DI_nDragCards ;bp <- # drag cards tst bp ;any drag cards? pop di jz endLoop push di ;;set ^lbx:si to first child mov si, ds:[si] ;load ^lbx:si with first child add si, ds:[si].Vis_offset add si, offset VCI_comp mov bx, ds:[si].CP_firstChild.handle mov si, ds:[si].CP_firstChild.chunk startLoop: ;;test for completion pop di dec bp ;decrement the number of cards ;left to process tst bp jl endLoop ;if no more drag cards, jump ;; make the call push di call ObjMessage ;make the call ;;get the next child to process mov si, ds:[si] add si, ds:[si].Vis_offset add si, offset VI_link mov bx, ds:[si].LP_next.handle ;load ^lbx:si with next child mov si, ds:[si].LP_next.chunk jmp startLoop ;jump to start of loop endLoop: pop si ret DeckCallDrags endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckRepairSuccessfulTransfer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_REPAIR_SUCCESSFUL_TRANSFER handler for DeckClass fixes up the visual state of affairs when cards are dropped successfully (i.e., the dragged cards are accepted by another deck). CALLED BY: DeckDropDrags PASS: *ds:si = instance data of deck CHANGES: nothing RETURN: nothing DESTROYED: ax, cx, dx PSEUDO CODE/STRATEGY: maximizes bounds of new top card, and issues a MSG_UPDATE_TOP_LEFT to self. KNOWN BUGS/IDEAS: this method is really only necessary for outline dragging, but doesn't hurt in full dragging, and it's faster just to do it anyway. REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckRepairSuccessfulTransfer method DeckClass,MSG_DECK_REPAIR_SUCCESSFUL_TRANSFER mov ax, MSG_CARD_MAXIMIZE ;make sure top card is now call VisCallFirstChild ;set to full size clr cx clr dx mov ax, MSG_GAME_REGISTER_DRAG call VisCallParent mov ax, MSG_DECK_INVALIDATE_INIT call ObjCallInstanceNoLock ret DeckRepairSuccessfulTransfer endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckRequestBlankCard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_REQUEST_BLANK_CARD handler for DeckClass Draws a blank card at the specified location. CALLED BY: PASS: cx,dx = origin of blank card bp = gstate CHANGES: RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: should be turned into a VUQ in the game object, maybe? REVISION HISTORY: Name Date Description ---- ---- ----------- jon 10/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckRequestBlankCard method DeckClass, MSG_DECK_REQUEST_BLANK_CARD mov ax, MSG_GAME_DRAW_BLANK_CARD call VisCallParent ret DeckRequestBlankCard endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckRequestFrame %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_REQUEST_FRAME handler for DeckClass Draws a card frame at the specified location. CALLED BY: PASS: cx,dx = origin of blank card bp = gstate CHANGES: RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: should be turned into a VUQ in the game object, maybe? REVISION HISTORY: Name Date Description ---- ---- ----------- jon 10/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckRequestFrame method DeckClass, MSG_DECK_REQUEST_FRAME mov ax, MSG_GAME_DRAW_FRAME call VisCallParent ret DeckRequestFrame endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckRequestFakeBlankCard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_REQUEST_FAKE_BLANK_CARD handler for DeckClass Deck makes a request to the game object to draw a fake blank card at the specified position. A fake blank card is simply a black-bordered white rectangle the size of a card. CALLED BY: PASS: cx,dx = where to draw fake blank card bp = gstate CHANGES: RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 10/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckRequestFakeBlankCard method DeckClass, MSG_DECK_REQUEST_FAKE_BLANK_CARD mov ax, MSG_GAME_FAKE_BLANK_CARD call VisCallParent ret DeckRequestFakeBlankCard endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckStretchBounds %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_STRETCH_BOUNDS handler for DeckClass Widens (or shrinks) a deck's vis bounds by a certain amount. CALLED BY: PASS: *ds:si = instance data of deck cx = incremental width dx = incremental height CHANGES: deck's vis dimensions are increased by cx,dx RETURN: nothing DESTROYED: ax, bx, cx, dx PSEUDO CODE/STRATEGY: get size add increments to size resize KNOWN BUGS/IDEAS: maybe turn into VisStretch? REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckStretchBounds method DeckClass, MSG_DECK_STRETCH_BOUNDS push cx, dx ;save increments mov ax, MSG_VIS_GET_SIZE ;get current size call ObjCallInstanceNoLock pop ax, bx add cx, ax ;add in increments add dx, bx mov ax, MSG_VIS_SET_SIZE ;resize call ObjCallInstanceNoLock ret DeckStretchBounds endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckTakeCardsIfOK %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_TAKE_CARDS_IF_OK handler for DeckClass Determines whether a deck will accept a drop from another deck. If so, issues a MSG_DECK_TRANSFER_DRAGGED_CARDS to the donor. CALLED BY: PASS: *ds:si = instance data of deck bp = CardAttr of the drop card (bottom card in the drag) ^lcx:dx = potential donor deck CHANGES: If the transfer is accepted, the deck with OD ^lcx:dx transfers #DI_nDragCards cards to the deck RETURN: carry set if transfer occurs, carry clear if not DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: calls TestAcceptCards if deck accepts, issues a MSG_DECK_TRANSFER_DRAGGED_CARDS to donor KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckTakeCardsIfOK method DeckClass, MSG_DECK_TAKE_CARDS_IF_OK push cx,dx ;save donor OD mov ax, MSG_DECK_TEST_ACCEPT_CARDS call ObjCallInstanceNoLock jc willAccept ;wontAccept: add sp, 4 ;clear OD off stack jmp endDeckTakeCardsIfOK willAccept: ;;get drag type ; CallObject MyPlayingTable, MSG_GAME_GET_DRAG_TYPE, MF_CALL mov ax, MSG_GAME_GET_DRAG_TYPE call VisCallParent cmp cl, DRAG_OUTLINE pop cx,dx ;restore donor OD jne transferCards ;;tell donor to invalidate the initial drag area if we in outline mode ; CallObjectCXDX MSG_DECK_INVALIDATE_INIT, MF_FIXUP_DS transferCards: mov bx, ds:[LMBH_handle] xchg bx, cx xchg si, dx ;^lbx:si = donor ;^lcx:dx = recipient mov ax, MSG_DECK_TRANSFER_DRAGGED_CARDS ;do the transfer mov di, mask MF_FIXUP_DS call ObjMessage stc ;indicate that we took ;the cards endDeckTakeCardsIfOK: ret DeckTakeCardsIfOK endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckTakeDoubleClickIfOK %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_TAKE_DOUBLE_CLICK_IF_OK handler for DeckClass Determines whether a deck wil accept a double click from another deck. If so, issues a MSG_DECK_TRANSFER_DRAGGED_CARDS to the donor. CALLED BY: PASS: ds:di = deck instance *ds:si = instance data of deck bp = CardAttr of the double clicked card ^lcx:dx = potential donor deck CHANGES: nothing RETURN: carry set if card(s) are accepted elsewhere DESTROYED: nothing PSEUDO CODE/STRATEGY: since only a foundation should be accepting a double click, this default routine returns carry clear, indicating no transfer. See FoundationTakeDoubleClickIfOK for something more exciting. KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckTakeDoubleClickIfOK method DeckClass, MSG_DECK_TAKE_DOUBLE_CLICK_IF_OK test ds:[di].DI_deckAttrs, mask DA_IGNORE_EXPRESS_DRAG jnz endDeckTakeDoubleClickIfOK push cx,dx ;save OD of donor ; mov ax, MSG_DECK_TEST_RIGHT_CARD ;check if right card ; call ObjCallInstanceNoLock mov ax, MSG_DECK_GET_COMPARISON_KIT call ObjCallInstanceNoLock pop cx,dx push cx,dx ;save OD of donor call Test4RightCard pop cx,dx ;restore OD of donor jc willAccept ;wontAccept: jmp clearCarry willAccept: ; CallObjectCXDX MSG_DECK_INVALIDATE_INIT, MF_FIXUP_DS ;inval. donor mov bx, ds:[LMBH_handle] xchg bx, cx ;^lbx:si <- donor xchg si, dx ;^lcx:dx <- acceptor mov ax, MSG_DECK_TRANSFER_DRAGGED_CARDS mov di, mask MF_FIXUP_DS call ObjMessage stc ;we've taken the cards jmp endDeckTakeDoubleClickIfOK clearCarry: clc ;we didn't take cards endDeckTakeDoubleClickIfOK: ret DeckTakeDoubleClickIfOK endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckInvertSelf %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_INVERT handler for DeckClass Deck visually inverts itself (its top card if it has one, its marker if not). CALLED BY: PASS: ds:di = deck instance *ds:si = deck object CHANGES: RETURN: nothing DESTROYED: ax, bx, cx, dx, bp, di PSEUDO CODE/STRATEGY: if (deck has cards) { tell top card to invert itself; } else { create a gstate; set draw mode to MM_INVERT; get deck's vis bounds; invert the bounds; destroy gstate; } KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 10/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckInvertSelf method DeckClass, MSG_DECK_INVERT TOGGLE ds:[di].DI_deckAttrs, DA_INVERTED call ObjMarkDirty tst ds:[di].DI_nCards jz invertMarker mov ax, MSG_CARD_INVERT call VisCallFirstChild jmp endDeckInvertSelf invertMarker: ifdef I_DONT_REALLY_LIKE_THIS_EFFECT mov ax, MSG_VIS_VUP_CREATE_GSTATE call ObjCallInstanceNoLock mov di, bp mov al, MM_INVERT call GrSetMixMode ;set invert mode push di mov ax, MSG_VIS_GET_BOUNDS call ObjCallInstanceNoLock mov bx, bp pop di call GrFillRect call GrDestroyState endif endDeckInvertSelf: ret DeckInvertSelf endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckClearInverted %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_CLEAR_INVERTED handler for DeckClass CALLED BY: PASS: ds:di = deck instance *ds:si = deck object CHANGES: RETURN: nothing DESTROYED: ax, bx, cx, dx, bp, di PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 19 feb 92 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckClearInverted method DeckClass, MSG_DECK_CLEAR_INVERTED test ds:[di].DI_deckAttrs, mask DA_INVERTED jz done RESET ds:[di].DI_deckAttrs, DA_INVERTED call ObjMarkDirty tst ds:[di].DI_nCards jz done ; jz clearMarker mov ax, MSG_CARD_CLEAR_INVERTED call VisSendToChildren ifdef I_DONT_REALLY_LIKE_THIS_EFFECT jmp done clearMarker: mov ax, MSG_VIS_INVALIDATE call ObjCallInstanceNoLock endif done: ret DeckClearInverted endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckInvertIfAccept %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_INVERT_IF_ACCEPT handler for DeckClass. Deck visually inverts itself (or its top card, if any) if its DA_WANTS_DRAG bit is set. CALLED BY: PASS: ds:di = deck instance *ds:si = deck object CHANGES: RETURN: nothing DESTROYED: ax, cx, dx PSEUDO CODE/STRATEGY: if (ds:[di].DI_deckAttrs && mask DA_WANTS_DRAG) send self MSG_DECK_INVERT KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 10/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckInvertIfAccept method DeckClass, MSG_DECK_INVERT_IF_ACCEPT test ds:[di].DI_deckAttrs, mask DA_WANTS_DRAG jz endDeckInvertIfAccept mov ax, MSG_DECK_INVERT call ObjCallInstanceNoLock endDeckInvertIfAccept: ret DeckInvertIfAccept endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckMarkIfAccept %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_MARK_IF_ACCEPT handler for DeckClass This method sets the DA_WANTS_DRAG bit in the DeckAttrs iff the deck would accept the drag set from the passed dragger. CALLED BY: PASS: ^lcx:dx = dragging deck CHANGES: RETURN: nothing DESTROYED: ax, cx, dx PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 10/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckMarkIfAccept method DeckClass, MSG_DECK_MARK_IF_ACCEPT mov ax, MSG_DECK_TEST_RIGHT_CARD call ObjCallInstanceNoLock jnc noAccept ;accept: Deref_DI Deck_offset SET ds:[di].DI_deckAttrs, DA_WANTS_DRAG call ObjMarkDirty jmp endDeckMarkIfAccept noAccept: Deref_DI Deck_offset RESET ds:[di].DI_deckAttrs, DA_WANTS_DRAG call ObjMarkDirty endDeckMarkIfAccept: ret DeckMarkIfAccept endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckCheckPotentialDrop %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_CHECK_POTENTIAL_DROP handler for DeckClass Checks to see whether this deck would accept the drag if it were to be dropped right now. If it would, it sends a MSG_GAME_REGISTER_HILITED to the game object with its own OD. CALLED BY: PASS: *ds:si = deck object ^lcx:dx = dragging deck CHANGES: RETURN: carry set if deck would accept cards DESTROYED: ax, cx, dx PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 10/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckCheckPotentialDrop method DeckClass, MSG_DECK_CHECK_POTENTIAL_DROP mov ax, MSG_DECK_TEST_ACCEPT_CARDS call ObjCallInstanceNoLock jnc endDeckCheckPotentialDrop mov ax, MSG_GAME_REGISTER_HILITED call DeckCallParentWithSelf stc endDeckCheckPotentialDrop: ret DeckCheckPotentialDrop endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckTestAcceptCards %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_TEST_ACCEPT_CARDS handler for DeckClass Tests deck to see whether a set of dragged cards would be accepted to the drag if it were dropped right now (i.e., rank&suit are ok, and position is ok). CALLED BY: PASS: ds:di = deck instance *ds:si = instance data of deck ^lcx:dx = potential donor deck CHANGES: RETURN: carry set if deck would accept cards, carry clear otherwise DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: calls TestRightCard to see if the card type is correct calls CheckDragCaught to see if the bounds are correct KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckTestAcceptCards method DeckClass, MSG_DECK_TEST_ACCEPT_CARDS test ds:[di].DI_deckAttrs, mask DA_WANTS_DRAG jz endTest mov ax, MSG_DECK_CHECK_DRAG_CAUGHT ;see if the drag area is in the call ObjCallInstanceNoLock ;right place endTest: ;;the carry bit will now be set if the deck will accept the cards ret DeckTestAcceptCards endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckTestRightCard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_TEST_RIGHT_CARD handler for DeckClass Checks to see if the deck would accept the drag set from the passed deck (i.e., see if the catch card of this deck would take the drop card fom the drag deck). CALLED BY: PASS: ^lcx:dx = dragging deck CHANGES: nothing RETURN: carry set if deck will accept card carry clear else DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckTestRightCard method DeckClass, MSG_DECK_TEST_RIGHT_CARD push cx,dx mov ax, MSG_DECK_GET_COMPARISON_KIT ;get the info needed to call ObjCallInstanceNoLock ;check for acceptance pop cx,dx FALL_THRU Test4RightCard DeckTestRightCard endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Test4RightCard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Checks to see whether a deck has the appropriate catch card to take the drag from the dragging deck. CALLED BY: PASS: *ds:si = deck object ^lcx:dx = potential donor deck bp = ComparisonKit of *ds:si deck CHANGES: RETURN: carry set if the deck's catch card would catch the dragging deck's drag card DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jon 8/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Test4RightCard proc far class DeckClass ; ; if there is a restriction on the number of cards that ; a deck can catch at any one time (such as the case of ; klondike's foundations, which only accept a drag of ; size one), then we must check that here. ; test bp, mask CAC_SINGLE_CARD_ONLY shl offset CK_CAC jz testSuit ; ; We want to access data from the deck at ^lcx:dx, so we'll ; lock its block, get the info, then swap back out. ; mov bx, cx ;bx <- block handle of dragger call ObjSwapLock ;ds <- segment of dragger, ;bx <- block handle of the ; deck we're checking mov di, dx mov di, ds:[di] add di, ds:[di].Deck_offset cmp ds:[di].DI_nDragCards, 1 call ObjSwapLock ;restore ds to original segment ;(flags preserved). jne returnCarry ;carry clear if cmp <>, so ;we return it ; ; Test the cards for suit compatibility ; testSuit: push bp ;save Kit CallObjectCXDX MSG_DECK_GET_DROP_CARD_ATTRIBUTES, MF_CALL ;bp <- dropAttr pop bx ;bx <- Kit push bx, bp ;save Kit, ;CardAttrs of ;drop card call TestSuit pop bx, bp jnc returnCarry ;if suit is ;wrong, then ;the cards ;do not match ;testRank: call TestRank ;at this point, it all rides ;on TestRank, so we'll return ;whatever it returns returnCarry: ret Test4RightCard endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TestSuit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Checks to see whether a drop card would be suit-wise accepted according to a ComparisonKit CALLED BY: PASS: bp = CardAttrs of the drop card bx = ComparisonKit of catch deck CHANGES: RETURN: carry set if drop card is suit-wise compatible with the ComparisonKit DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: maybe could be done more efficiently when testing same/opposite color REVISION HISTORY: Name Date Description ---- ---- ----------- jon 10/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TestSuit proc near mov dx, bx ;dx <- acceptor ComparisonKit ANDNF dx, mask CAC_SAC shl offset CK_CAC ;filter thru SAC cmp dx, SAC_ANY_SUIT shl (offset CAC_SAC + offset CK_CAC) je returnTrue ;if any suit will ;do, then we return ;true ANDNF bp, mask CA_SUIT ;filter dropsuit mov cl, offset CK_TOP_CARD shr bx, cl ;bx <- topcard ANDNF bx, mask CA_SUIT ;filter suit cmp dx, SAC_SAME_SUIT shl (offset CAC_SAC + offset CK_CAC) je testSameSuit ANDNF bp, CS_CLUBS shl offset CA_SUIT ;filter black bit ANDNF bx, CS_CLUBS shl offset CA_SUIT ;filter black bit cmp dx, SAC_OPPOSITE_COLOR shl (offset CAC_SAC + offset CK_CAC) je testOppositeColor ;testSameColor: cmp bx,bp je returnTrue jmp returnFalse testOppositeColor: cmp bx, bp jne returnTrue jmp returnFalse testSameSuit: cmp bx,bp je returnTrue returnFalse: clc jmp endTestSuit returnTrue: stc endTestSuit: ret TestSuit endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TestRank %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Checks to see whether a drop card would be rank-wise accepted according to a ComparisonKit CALLED BY: PASS: bp = CardAttrs of the drop card bx = ComparisonKit of catch deck CHANGES: RETURN: carry set if drop card is rank-wise compatible with the ComparisonKit DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 10/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TestRank proc near mov dx, bx ;dx <- acceptor comparison kit ANDNF bp, mask CA_RANK ;filter thru droprank mov cl, offset CA_RANK shr bp, cl ANDNF dx, mask CAC_RAC shl offset CK_CAC cmp dx, RAC_ABSOLUTE_RANK shl (offset CAC_RAC + offset CK_CAC) je absoluteRank ;relativeRank: ANDNF bx, mask CA_RANK shl offset CK_TOP_CARD mov cl, offset CA_RANK + offset CK_TOP_CARD shr bx, cl dec bx cmp dx, RAC_ONE_LESS_RANK shl (offset CAC_RAC + offset CK_CAC) je compare inc bx cmp dx, RAC_EQUAL_RANK shl (offset CAC_RAC + offset CK_CAC) je compare inc bx jmp compare absoluteRank: ANDNF bx, mask CAC_RANK shl offset CK_CAC mov cl, offset CAC_RANK + offset CK_CAC shr bx, cl cmp bx, CR_WILD je returnTrue compare: cmp bx, bp je returnTrue ;returnFalse: clc jmp endTestRank returnTrue: stc endTestRank: ret TestRank endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckGetRidOfCards %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_GET_RID_OF_CARDS handler for DeckClass Pops all the deck's cards to another deck. CALLED BY: PASS: ds:di = deck instance ^lcx:dx = deck to receive cards CHANGES: RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 10/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckGetRidOfCards method DeckClass, MSG_DECK_GET_RID_OF_CARDS mov bp, ds:[di].DI_popPoints push bp clr ds:[di].DI_popPoints call ObjMarkDirty mov ax, MSG_DECK_POP_ALL_CARDS call ObjCallInstanceNoLock Deref_DI Deck_offset pop ds:[di].DI_popPoints call ObjMarkDirty ret DeckGetRidOfCards endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckTransferAllCards %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_TRANSFER_ALL_CARDS handler for DeckClass Transfers all of a deck's cards to another deck. Relative order of the cards is preserved. CALLED BY: PASS: ds:di = deck instance *ds:si = instance data of deck ^lcx:dx = instance of VisCompClass to receive the cards (usually another Deck) CHANGES: Deck's cards transferred to deck in ^lcx:dx RETURN: nothing DESTROYED: ax, bp, di PSEUDO CODE/STRATEGY: calls TransferNCards with n = total # of cards KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckTransferAllCards method DeckClass, MSG_DECK_TRANSFER_ALL_CARDS mov bp, ds:[di].DI_nCards ;set bp = all cards mov ax, MSG_DECK_TRANSFER_N_CARDS ;and transfer them call ObjCallInstanceNoLock ret DeckTransferAllCards endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckTransferDraggedCards %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_TRANSFER_DRAGGED_CARDS handler for DeckClass Transfers the deck's drag cards (if any) to another deck. CALLED BY: PASS: ds:di = deck instance *ds:si = instance data of deck ^lcx:dx = deck to which to transfer the cards CHANGES: deck *ds:si transfers its cards to deck ^lcx:dx RETURN: nothing DESTROYED: ax, bp, cx, dx PSEUDO CODE/STRATEGY: forwards the call to MSG_DECK_TRANSFER_N_CARDS, setting N to the number of dragged cards KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckTransferDraggedCards method DeckClass, MSG_DECK_TRANSFER_DRAGGED_CARDS mov ax, MSG_GAME_TRANSFERRING_CARDS call VisCallParent ;notify the game mov bp, ds:[di].DI_nDragCards ;set bp = # drag cards mov ax, MSG_DECK_TRANSFER_N_CARDS ;and transfer them call ObjCallInstanceNoLock ret DeckTransferDraggedCards endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckTransferNCards %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_TRANSFER_N_CARDS handler for DeckClass Transfers a specified number of cards to another deck. CALLED BY: DeckTransferAllCards, DeckTransferDragCards, etc. PASS: ds:di = deck instance *ds:si = instance data of deck bp = number of cards to transfer ^lcx:dx = instance of VisCompClass to receive the cards (usually another Deck) CHANGES: The top bp cards of deck at *ds:si are transferred to the top of deck at ^lcx:dx. The order of the cards is preserved. RETURN: nothing DESTROYED: ax, bx, cx, dx, bp PSEUDO CODE/STRATEGY: loops bp times, popping cards (starting with the bp'th, ending with the top)from the donor and pushing them to the recipient KNOWN BUGS/IDEAS: *WARNING* A deck must never transfer to itself. REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckTransferNCards method DeckClass, MSG_DECK_TRANSFER_N_CARDS push cx,dx,bp mov ds:[di].DI_lastRecipient.handle, cx mov ds:[di].DI_lastRecipient.chunk, dx mov ds:[di].DI_lastGift, bp call ObjMarkDirty mov ax, MSG_GAME_SET_DONOR call DeckCallParentWithSelf pop cx,dx,bp startDeckTransferNCards: dec bp ;see if we're done tst bp jl endDeckTransferNCards push bp ;save count push cx, dx ;save OD of recipient clr cx ;cx:dx <- # of child mov dx, bp ;to remove mov ax, MSG_DECK_REMOVE_NTH_CARD mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjCallInstanceNoLock ;^lcx:dx <- OD of card mov bp, si ;save donor offset pop bx,si ;restore recipient OD push bp ;push donor offset push bx,si mov ax, MSG_DECK_PUSH_CARD ;give card to recipient mov di, mask MF_FIXUP_DS call ObjMessage pop cx, dx pop si ;restore donor offset pop bp ;restore count jmp startDeckTransferNCards endDeckTransferNCards: ret DeckTransferNCards endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckUpdateDrag %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_UPDATE_DRAG handler for DeckClass Updates the deck's drag instance data to reflect a new mouse position. CALLED BY: various PASS: ds:di = deck instance *ds:si = instance data of deck cx,dx = new mouse position CHANGES: DI_prevLeft and DI_prevTop to reflect new mouse position RETURN: cx,dx = new prevLeft, new prevTop ax,bp = old prevLeft, old prevTop DESTROYED: ax, bp, cx, dx PSEUDO CODE/STRATEGY: subtract the drag offsets from cx,dx to turn them from mouse positions to left,top of drag area KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckUpdateDrag method DeckClass, MSG_DECK_UPDATE_DRAG sub cx, ds:[di].DI_dragOffsetX ;cx <- new left drag bound sub dx, ds:[di].DI_dragOffsetY ;dx <- new top drag bound mov ax, ds:[di].DI_prevLeft ;ax <- old left drag bound mov bp, ds:[di].DI_prevTop ;bp <- old top drag bound mov ds:[di].DI_prevLeft, cx mov ds:[di].DI_prevTop, dx call ObjMarkDirty ret DeckUpdateDrag endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckUpdateTopLeft %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_UPDATE_TOPLEFT handler for DeckClass Sets the instance data indicating the position of the deck's top card, and also resizes the deck to make a tight fit around its cards. CALLED BY: PASS: *ds:si = instance data of deck CHANGES: if deck has children: DI_topCard(Left,Top) are set to Left,Top of top child deck's Right,Bottom match Right,Bottom of top card if deck doesn't have children: DI_topCard(Left,Top) are set to Left,Top of deck deck is resized to the size of one card RETURN: nothing DESTROYED: ax, bp, cx, dx, di PSEUDO CODE/STRATEGY: checks to see if deck has a card if so: gets bounds of top card sets DI_topCard(Left,Top) sets right,bottom vis bounds to deck if not: gets own bounds sets DI_topCard(Left,Top) KNOWN BUGS/IDEAS: This method assumes (and the assumption is general over a large portion of the cards library) that overlapping cards go left -> right, top -> bottom. This should really by made more general. REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckUpdateTopLeft method DeckClass, MSG_DECK_UPDATE_TOPLEFT clr cx clr dx mov ax, MSG_VIS_FIND_CHILD ;find first child call ObjCallInstanceNoLock jc noTopCard ;if no children, jump ;yesTopCard: CallObjectCXDX MSG_VIS_GET_BOUNDS, MF_CALL ;get top card's bounds Deref_DI Deck_offset mov ds:[di].DI_topCardLeft, ax ;set DI_topCardLeft to ;left of top card mov ds:[di].DI_topCardTop, bp ;set DI_topCardTop to ;top of top card Deref_DI Vis_offset mov ds:[di].VI_bounds.R_right, cx ;set right,bottom of mov ds:[di].VI_bounds.R_bottom, dx ;deck to right,bottom ;of top card call ObjMarkDirty jmp endDeckUpdateTopLeft noTopCard: mov cx, VUQ_CARD_DIMENSIONS mov ax, MSG_VIS_VUP_QUERY call VisCallParent push cx, dx mov ax, MSG_VIS_GET_BOUNDS ;if no card, use self call ObjCallInstanceNoLock ; bounds Deref_DI Deck_offset mov ds:[di].DI_topCardLeft, ax mov ds:[di].DI_topCardTop, bp call ObjMarkDirty pop cx, dx mov ax, MSG_VIS_SET_SIZE call ObjCallInstanceNoLock endDeckUpdateTopLeft: ret DeckUpdateTopLeft endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckReturnCards %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_RETURN_CARDS handler for DeckClass Gives a specified # of cards to a specified deck, and fixes things up visually. Used primarily for UNDO. CALLED BY: PASS: *ds:si = deck object ^lcx:dx = deck to give cards to bp = # of cards to give CHANGES: RETURN: nothing DESTROYED: ax, cx, dx, bp PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 10/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckReturnCards method DeckClass, MSG_DECK_RETURN_CARDS .enter ; ; since the deck will soon be changing, we want to invalidate ; its screen area now instead of after the change ; push cx,dx,bp mov ax, MSG_VIS_INVALIDATE call ObjCallInstanceNoLock pop cx,dx,bp ; ; give the cards back to ^lcx:dx ; mov ax, MSG_DECK_TRANSFER_N_CARDS call ObjCallInstanceNoLock ; ; Make the top card fully sized again ; mov ax, MSG_CARD_MAXIMIZE call VisCallFirstChild .leave ret DeckReturnCards endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckRetrieveCards %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_RETRIEVE_CARDS handler for DeckClass. Retrieves the last set of cards that were given to another deck. Used for UNDO CALLED BY: PASS: ds:di = deck instance *ds:si = deck object CHANGES: RETURN: nothing DESTROYED: ax, bx, cx, dx, bp, di PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 10/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckRetrieveCards method DeckClass, MSG_DECK_RETRIEVE_CARDS mov cx, ds:[LMBH_handle] mov dx, si mov bx, ds:[di].DI_lastRecipient.handle mov si, ds:[di].DI_lastRecipient.chunk mov bp, ds:[di].DI_lastGift mov ax, MSG_DECK_RETURN_CARDS mov di, mask MF_FIXUP_DS GOTO ObjMessage DeckRetrieveCards endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckDownCardSelected %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_DOWN_CARD_SELECTED handler for DeckClass CALLED BY: CardStartSelect PASS: *ds:si = deck object bp = # of selected child in composite CHANGES: if card is top card, turns it face up RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: make sure card is top card if so, turn it face up redraw it. KNOWN BUGS/IDEAS: don't know if the call to MSG_DECK_UPDATE_TOPLEFT does anything REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckDownCardSelected method DeckClass, MSG_DECK_DOWN_CARD_SELECTED tst bp ;see if bp = first child jnz endDeckDownCardSelected ;do nothing unless top card mov ax, MSG_CARD_FLIP_CARD call ObjCallInstanceNoLock mov ax, MSG_DECK_UPDATE_TOPLEFT ;update top left call ObjCallInstanceNoLock Deref_DI Deck_offset mov dx, ds:[di].DI_flipPoints tst dx jz afterScore clr cx mov ax, MSG_GAME_UPDATE_SCORE call VisCallParent afterScore: mov dl, VUM_NOW mov ax, MSG_GAME_DISABLE_UNDO call VisCallParent endDeckDownCardSelected: ret DeckDownCardSelected endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckGetDealt %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_GET_DEALT handler for DeckClass CALLED BY: HandDeal PASS: *ds:si = deck object ^lcx:dx = card to add CHANGES: RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: send self MSG_DECK_MOVE_AND_CLIP to prepare for the new card add the card set the card drawable get card's attributes if card is face up, fade it in if card is face down, just draw it KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckGetDealt method DeckClass, MSG_DECK_GET_DEALT push cx,dx ;save card OD mov ax, MSG_DECK_MOVE_AND_CLIP ;get ready for new card call ObjCallInstanceNoLock pop cx,dx ;restore card OD push cx, dx ;save card OD mov ax, MSG_DECK_ADD_CARD_FIRST ;add the card call ObjCallInstanceNoLock pop bx, si ;^lbx:si <- card OD mov ax, MSG_CARD_SET_DRAWABLE ;set card drawable mov di, mask MF_FIXUP_DS call ObjMessage mov ax, MSG_CARD_GET_ATTRIBUTES ;get card's attributes mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage mov ax, MSG_CARD_NORMAL_REDRAW ;normal redraw for face down test bp, mask CA_FACE_UP jz redraw mov ax, MSG_CARD_FADE_REDRAW ;fade in for face up redraw: mov di, mask MF_FIXUP_DS call ObjMessage ret DeckGetDealt endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckSetupDrag %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_SETUP_DRAG handler for DeckClass Prepares the deck's drag instance data for dragging. CALLED BY: PASS: *ds:si = deck object cx,dx = mouse position bp = # of children to drag CHANGES: fills in some drag data RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckSetupDrag method DeckClass, MSG_DECK_SETUP_DRAG push cx,dx ;save mouse position push bp mov ax, MSG_VIS_GET_BOUNDS call ObjCallInstanceNoLock Deref_DI Deck_offset mov ds:[di].DI_initRight, cx mov ds:[di].DI_initBottom, dx pop bp mov cx, VUQ_CARD_DIMENSIONS mov ax, MSG_VIS_VUP_QUERY call VisCallParent push dx Deref_DI Deck_offset mov ds:[di].DI_nDragCards, bp dec bp ;bp <- # drag cards - 1 push bp ;save # drag cards - 1 mov ax, ds:[di].DI_offsetFromUpCardX ;ax <- horiz. offset mul bp ;ax <- offset * #cards ; = total offset add cx, ax mov ds:[di].DI_dragWidth, cx ;dragWidth = ;cardWidth + tot.offset mov cx, ds:[di].DI_topCardLeft sub cx,ax ;cx <- left drag bound mov ds:[di].DI_prevLeft, cx mov ds:[di].DI_initLeft, cx pop ax mul ds:[di].DI_offsetFromUpCardY pop dx add dx, ax mov ds:[di].DI_dragHeight, dx ;dragHeight = ;cardHeight + offset mov dx, ds:[di].DI_topCardTop sub dx,ax ;dx <- top drag bound mov ds:[di].DI_prevTop, dx mov ds:[di].DI_initTop, dx pop ax,bx ;restore mouse position sub ax, cx ;get offset from mouse mov ds:[di].DI_dragOffsetX, ax ;left to drag left sub bx, dx ;get offset from mouse mov ds:[di].DI_dragOffsetY, bx ;top to drag top call ObjMarkDirty ret DeckSetupDrag endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckUpCardSelected %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_UP_CARD_SELECTED handler for DeckClass This method determines the number of cards that will be dragged as a result of this card selection CALLED BY: CardStartSelect PASS: *ds:si = deck object cx,dx = mouse bp = # of card selected CHANGES: RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 7/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckUpCardSelected method DeckClass, MSG_DECK_UP_CARD_SELECTED ; ; Our first task is to load cx with: ; ; ch = # of selected card in composite ; cl = low 8 bits of selected CardAttrs, which contains ; info on rank and suit ; push cx,dx ;stack-> mouseX,mouseY push bp ;stack-> # selected ; mouseX, mouseY mov ax, MSG_CARD_GET_ATTRIBUTES call DeckCallNthChild mov cx, bp ;cl <- selected attrs pop dx ;dx <- selected # ;stack-> mouseX, mouseY mov ch, dl ;ch <- selected # push cx ;stack-> selected card ; mouseX, mouseY clr dx ; ; Now we're going to go through our cards, starting with the ; first card, and find out which ones want to be dragged. ; startLoop: ; ; We want to load: ; ; dh = # of card we're checking for dragability in composite ; (so that we can compare its place with that of ; the selected card) ; ; dl = low 8 bits of CardAttrs of card we're examining (so we ; can check things like face up, etc.) ; push dx ;stack-> # of card examining ; selected card ; mouseX, mouseY mov bp, dx mov ax, MSG_DECK_GET_NTH_CARD_ATTRIBUTES call ObjCallInstanceNoLock jc endLoop mov dx, bp ;dl <- nth card attrs pop cx ;cx <- # of card examining ;stack-> selected card ; mouseX, mouseY mov dh, cl ;dh <- n pop cx ;cx <- selected card ;stack-> mouseX, mouseY push cx Deref_DI Deck_offset mov al, ds:[di].DI_deckAttrs clr ah mov bp, ax ; ; Make the query on whether or not the examined card should ; be dragged. ; mov ax, MSG_GAME_QUERY_DRAG_CARD call VisCallParent mov dl, dh mov dh, 0 push dx jnc endLoop ;if we don't want to drag this one, ;then screw all the rest, too. ;doDrag: pop dx inc dx ; push dx jmp startLoop endLoop: pop bp add sp, 2 pop cx,dx tst bp jz endDeckUpCardSelected mov ax, MSG_DECK_DRAGGABLE_CARD_SELECTED call ObjCallInstanceNoLock endDeckUpCardSelected: ret DeckUpCardSelected endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckGetComparisonKit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_GET_COMPARISION_KIT handler for DeckClass. Returns the comparison kit for this deck (see definition of ComparisonKit). CALLED BY: PASS: *ds:si = deck object CHANGES: RETURN: bp = ComparisonKit for this deck DESTROYED: ax, bx, cx, dx, bp PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 10/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckGetComparisonKit method DeckClass, MSG_DECK_GET_COMPARISON_KIT clr bp mov ax, MSG_CARD_GET_ATTRIBUTES call VisCallFirstChild Deref_DI Deck_offset tst bp jz noCard mov dx, bp mov cl, offset CK_TOP_CARD shl dx, cl test bp, mask CA_FACE_UP jz faceDown ;faceUp: mov bp, ds:[di].DI_upCardAC jmp makeKit faceDown: mov bp, ds:[di].DI_downCardAC jmp makeKit noCard: mov bp, ds:[di].DI_noCardAC clr dx makeKit: mov cl, offset CK_CAC shl bp, cl ORNF bp, dx ret DeckGetComparisonKit endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckSetPoints %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_SET_POINTS handler for DeckClass Sets the # of points awarded/penalized for pushing, popping, and turning cards in this deck CALLED BY: PASS: ds:di = deck instance *ds:si = deck object cx = points awarded for pushing a card to this deck dx = points awarded for popping a card from this deck bp = points awarded for flipping over a card in this deck CHANGES: RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 10/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckSetPoints method DeckClass, MSG_DECK_SET_POINTS mov ds:[di].DI_pushPoints, cx mov ds:[di].DI_popPoints, dx mov ds:[di].DI_flipPoints, bp call ObjMarkDirty ret DeckSetPoints endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckSetUpSpreads %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_SET_UP_SPREADS handler for DeckClass CALLED BY: PASS: ds:di = deck instance cx, dx = x,y spreads for face up cards RETURN: nothing DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- jon 27 nov 1992 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckSetUpSpreads method dynamic DeckClass, MSG_DECK_SET_UP_SPREADS .enter mov ds:[di].DI_offsetFromUpCardX, cx mov ds:[di].DI_offsetFromUpCardY, dx call ObjMarkDirty .leave ret DeckSetUpSpreads endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckSetDownSpreads %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_SET_DOWN_SPREADS handler for DeckClass CALLED BY: PASS: ds:di = deck instance cx, dx = x,y spreads for face down cards RETURN: nothing DESTROYED: nothing REVISION HISTORY: Name Date Description ---- ---- ----------- jon 27 nov 1992 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckSetDownSpreads method dynamic DeckClass, MSG_DECK_SET_DOWN_SPREADS .enter mov ds:[di].DI_offsetFromDownCardX, cx mov ds:[di].DI_offsetFromDownCardY, dx call ObjMarkDirty .leave ret DeckSetDownSpreads endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckSetAttrs %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Sets deck's attrs to value passed CALLED BY: PASS: ds:di = deck instance *ds:si = deck object cl = DeckAttrs CHANGES: RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 10/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckSetAttrs method DeckClass, MSG_DECK_SET_ATTRS mov ds:[di].DI_deckAttrs, cl call ObjMarkDirty ret DeckSetAttrs endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckMove %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_VIS_SET_POSITION handler for DeckClass Moves the deck's vis bounds and sets DI_topCardLeft and DI_topCardTop to the new location (the assumption is that the deck has no cards when you move it). CALLED BY: PASS: cx, dx = horizontal, vertical displacements CHANGES: RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jon 12/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckMove method DeckClass, MSG_VIS_SET_POSITION call VisSetPosition Deref_DI Deck_offset mov ds:[di].DI_topCardLeft, cx mov ds:[di].DI_topCardTop, dx call ObjMarkDirty ret DeckMove endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckChangeKidsBacks %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_CHANGE_KIDS_BACKS handler for DeckClass Marks any face down children as dirty, indicating that their bitmap has changed. CALLED BY: PASS: *ds:si = deck object CHANGES: RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 10/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckChangeKidsBacks method DeckClass, MSG_DECK_CHANGE_KIDS_BACKS mov ax, MSG_CARD_MARK_DIRTY_IF_FACE_DOWN call VisSendToChildren ret DeckChangeKidsBacks endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckSprayCards %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: MSG_DECK_SPRAY_CARDS handler for DeckClass Creates cool card fan visual effect with the cards in this deck. CALLED BY: PASS: ds:di = deck instance *ds:si = deck object bp = gstate (ready for first card) cx = distance from origin along y-axis to draw cards (radius of the fan) dx = # degrees to rotate the gstate after each card is drawn CHANGES: RETURN: nothing DESTROYED: PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jon 10/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckSprayCards method DeckClass, MSG_DECK_SPRAY_CARDS mov bx, ds:[di].DI_nCards neg cx ;cx <- -length startLoop: dec bx ;test for more cards js done xchg bx, dx ;dx<-# kid, bx <-angle push dx ;save # push si ;save deck offset push cx, bp ;save -length. gstate clr cx mov ax, MSG_VIS_FIND_CHILD call ObjCallInstanceNoLock jnc callChild add sp, 8 jmp done callChild: mov si, dx ;si <- card offset mov dx, bx ;dx <- angle mov bx, cx ;bx <- card handle pop cx, bp ;cx <- -length, gstate mov ax, MSG_CARD_SPRAY_DRAW mov di, mask MF_FIXUP_DS or mask MF_FORCE_QUEUE call ObjMessage pop si ;si <- deck offset pop bx ;bx <- kid # jmp startLoop done: ret DeckSprayCards endm DeckGetNCards method DeckClass, MSG_DECK_GET_N_CARDS mov cx, ds:[di].DI_nCards ret DeckGetNCards endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckCallNthChild %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Common routine to find the deck's Nth child and send a method to it. CALLED BY: PASS: bp = Nth child ax = method number to send to Nth child *ds:si = deck object cx,dx = arguments to pass to card CHANGES: RETURN: carry set if Nth child was not found carry returned from method if child was found DESTROYED: bp, cx, dx, di PSEUDO CODE/STRATEGY: search for nth card if found, send the method KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 10/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckCallNthChild proc near ; ; get the OD of the nth card ; push si push ax, cx, dx mov dx, bp clr cx mov ax, MSG_VIS_FIND_CHILD call ObjCallInstanceNoLock pop ax, bx, si jc afterCall xchg bx, cx xchg si, dx mov di, mask MF_FIXUP_DS or mask MF_CALL call ObjMessage afterCall: pop si ret DeckCallNthChild endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DeckCallParentWithSelf %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Loads the deck's OD into cx:dx and calls the deck's paren with the passed method. CALLED BY: PASS: *ds:si = deck object ax = method number for parent bp = additional data to pass to parent CHANGES: RETURN: return values from parent method handler DESTROYED: bp, cx, dx, PSEUDO CODE/STRATEGY: KNOWN BUGS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- jon 12/19/90 initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DeckCallParentWithSelf proc near mov cx, ds:[LMBH_handle] mov dx, si call VisCallParent ret DeckCallParentWithSelf endp CardsCodeResource ends
25.017773
84
0.594045
3026f1b42159fd686ebba17bc93d65d3f038266c
7,956
asm
Assembly
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca.log_21829_1822.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca.log_21829_1822.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca.log_21829_1822.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
3
2020-07-14T17:07:07.000Z
2022-03-21T01:12:22.000Z
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r14 push %r15 push %r9 push %rcx push %rsi lea addresses_UC_ht+0x630, %r14 and $13607, %r15 mov (%r14), %si inc %r9 lea addresses_WC_ht+0x41b0, %r10 nop nop nop nop and $42422, %r13 mov (%r10), %r14 nop nop nop cmp $6414, %r13 lea addresses_WC_ht+0x2e0, %r9 clflush (%r9) nop nop nop and %rcx, %rcx mov $0x6162636465666768, %r14 movq %r14, %xmm3 and $0xffffffffffffffc0, %r9 movaps %xmm3, (%r9) nop nop nop nop add $43915, %r15 lea addresses_A_ht+0xab04, %rcx xor $51785, %r14 movl $0x61626364, (%rcx) nop dec %rsi lea addresses_WC_ht+0x18bb4, %r9 nop nop add $52944, %r10 movups (%r9), %xmm3 vpextrq $1, %xmm3, %r15 nop nop nop nop add $23857, %r13 lea addresses_WC_ht+0x4450, %rcx nop nop nop inc %r14 movl $0x61626364, (%rcx) nop nop nop nop add $41948, %r9 lea addresses_D_ht+0xc4b0, %r13 nop nop nop nop sub %r14, %r14 movw $0x6162, (%r13) nop nop add %r10, %r10 lea addresses_A_ht+0xcdb0, %r15 and %r9, %r9 mov $0x6162636465666768, %r10 movq %r10, (%r15) nop nop cmp %r10, %r10 lea addresses_D_ht+0x7b0, %r13 dec %rsi mov (%r13), %r14w nop xor $36661, %rcx lea addresses_A_ht+0x28b0, %r9 and $40857, %r14 mov (%r9), %r15 nop nop nop sub %r13, %r13 lea addresses_D_ht+0x1c1b0, %r9 nop nop nop sub %rcx, %rcx movb $0x61, (%r9) nop nop nop and %r14, %r14 lea addresses_D_ht+0x7230, %r9 nop xor %r15, %r15 movups (%r9), %xmm4 vpextrq $1, %xmm4, %r13 nop sub $61327, %r10 lea addresses_A_ht+0x4ab0, %r15 nop nop nop cmp %r10, %r10 movb $0x61, (%r15) nop nop sub $65384, %r10 lea addresses_WT_ht+0xce80, %rsi clflush (%rsi) nop nop nop nop add %r14, %r14 movw $0x6162, (%rsi) and %rsi, %rsi lea addresses_D_ht+0xb9b0, %r13 nop nop nop nop nop sub %r10, %r10 vmovups (%r13), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $1, %xmm0, %r9 nop nop nop nop nop xor %r10, %r10 pop %rsi pop %rcx pop %r9 pop %r15 pop %r14 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %r15 push %r8 push %rax push %rbx push %rcx // Store lea addresses_normal+0x118f0, %rax nop cmp %r13, %r13 mov $0x5152535455565758, %r14 movq %r14, %xmm6 movups %xmm6, (%rax) nop nop lfence // Store lea addresses_RW+0x14365, %rcx nop nop nop add %r15, %r15 movw $0x5152, (%rcx) nop nop nop nop sub $6514, %rax // Faulty Load lea addresses_WC+0x129b0, %r8 nop nop nop nop sub $11469, %rcx movb (%r8), %r15b lea oracles, %r8 and $0xff, %r15 shlq $12, %r15 mov (%r8,%r15,1), %r15 pop %rcx pop %rbx pop %rax pop %r8 pop %r15 pop %r14 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_normal'}} {'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_RW'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': True, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 2, 'NT': True, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': True, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 4, 'NT': True, 'type': 'addresses_A_ht'}} {'src': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_D_ht'}} {'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_A_ht'}} {'src': {'congruent': 9, 'AVXalign': False, 'same': True, 'size': 2, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_D_ht'}} {'src': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_A_ht'}} {'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WT_ht'}} {'src': {'congruent': 10, 'AVXalign': False, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
33.428571
2,999
0.649698
d6644d1b21c8fb8590c3e30da41be8503de81e59
773
asm
Assembly
oeis/141/A141194.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/141/A141194.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/141/A141194.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A141194: Primes of the form 16k+7. ; Submitted by Jamie Morken(s4) ; 7,23,71,103,151,167,199,263,311,359,439,487,503,599,631,647,727,743,823,839,887,919,967,983,1031,1063,1223,1303,1319,1367,1399,1447,1511,1543,1559,1607,1783,1831,1847,1879,2039,2087,2311,2423,2503,2551,2647,2663,2711,2791,2887,2903,2999,3079,3191,3271,3319,3463,3511,3527,3559,3607,3623,3671,3719,3767,3847,3863,3911,3943,4007,4231,4327,4391,4423,4519,4567,4583,4663,4679,4759,4871,4903,4919,4951,4967,4999,5303,5351,5399,5431,5479,5527,5591,5623,5639,5783,5879,5927,6007 mov $1,6 mov $2,$0 pow $2,2 lpb $2 mov $3,$1 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,16 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 sub $2,1 lpe mov $0,$1 add $0,1
36.809524
473
0.711514
4d1144fc5084d7d7f1aeef8d6c2d461fa94915b2
336
asm
Assembly
programs/oeis/047/A047365.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/047/A047365.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
programs/oeis/047/A047365.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
; A047365: Numbers that are congruent to {0, 3, 4, 5} mod 7. ; 0,3,4,5,7,10,11,12,14,17,18,19,21,24,25,26,28,31,32,33,35,38,39,40,42,45,46,47,49,52,53,54,56,59,60,61,63,66,67,68,70,73,74,75,77,80,81,82,84,87,88,89,91,94,95,96,98,101,102,103,105,108,109,110 mov $1,$0 lpb $0 trn $0,3 add $1,$0 trn $0,1 add $1,2 sub $1,$0 lpe
28
195
0.616071
0aa49c982ad57b3d08095e798542427f9c69d2c2
162
asm
Assembly
src/PJ/rexlib/mathlib/sqrt.asm
AnimatorPro/Animator-Pro
6d0b68cd94bb5cfde2cdd05e9a7c8ee1e1cb3cbb
[ "BSD-3-Clause" ]
119
2015-01-10T15:13:50.000Z
2022-01-24T04:54:34.000Z
src/PJ/rexlib/mathlib/sqrt.asm
AnimatorPro/Animator-Pro
6d0b68cd94bb5cfde2cdd05e9a7c8ee1e1cb3cbb
[ "BSD-3-Clause" ]
6
2015-10-22T20:14:59.000Z
2021-07-10T03:25:21.000Z
src/PJ/rexlib/mathlib/sqrt.asm
AnimatorPro/Animator-Pro
6d0b68cd94bb5cfde2cdd05e9a7c8ee1e1cb3cbb
[ "BSD-3-Clause" ]
27
2015-04-24T22:55:30.000Z
2022-01-21T13:54:00.000Z
include mathhost.i CGROUP group code code segment dword 'CODE' assume cs:CGROUP,ds:CGROUP MATHLIB_2JUMP sqrt _r_ml_sqrt math_sqrt code ends end
13.5
40
0.740741
0112dc77aa04c09d5f83de738eb5f013d28e635c
345
asm
Assembly
libsrc/msx/msx_lpt.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
libsrc/msx/msx_lpt.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
libsrc/msx/msx_lpt.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
; ; MSX specific routines ; by Stefano Bodrato, December 2007 ; ; int msx_lpt(); ; ; Check if the line printer is ready (1=ready, 0 if not) ; ; $Id: msx_lpt.asm,v 1.3 2015/01/19 01:32:57 pauloscustodio Exp $ ; PUBLIC msx_lpt EXTERN msxbios INCLUDE "msxbios.def" msx_lpt: ld ix,LPTSTT call msxbios ld hl,0 ret z inc l ret
14.375
65
0.666667
5a7b96ba8bcacc335132fa04356d75b2c969eb7f
2,364
asm
Assembly
TVSW/Model Verification/Esercitazioni/SluiceGateMotorCtl.asm
samuelexferri/unibg-workspace
41533f215599e5e7c937a054b25881ef02f29ac8
[ "MIT" ]
null
null
null
TVSW/Model Verification/Esercitazioni/SluiceGateMotorCtl.asm
samuelexferri/unibg-workspace
41533f215599e5e7c937a054b25881ef02f29ac8
[ "MIT" ]
null
null
null
TVSW/Model Verification/Esercitazioni/SluiceGateMotorCtl.asm
samuelexferri/unibg-workspace
41533f215599e5e7c937a054b25881ef02f29ac8
[ "MIT" ]
null
null
null
asm SluiceGateMotorCtl //from the paper "The Abstract State Machines Method for High-Level System Design and Analysis" by Egon Boerger import ../STDL/StandardLibrary import ../STDL/CTLlibrary signature: domain Minutes subsetof Integer enum domain PhaseDomain = { FULLYCLOSED | OPENING | FULLYOPENED | CLOSING } enum domain DirectionDomain = { CLOCKWISE | ANTICLOCKWISE } enum domain MotorDomain = { ON | OFF } dynamic controlled phase: PhaseDomain dynamic controlled dir: DirectionDomain dynamic controlled motor: MotorDomain dynamic monitored passed: Minutes -> Boolean dynamic monitored event_top: Boolean dynamic monitored event_bottom: Boolean definitions: domain Minutes = {10, 170} rule r_start_to_raise = par dir := CLOCKWISE motor := ON endpar rule r_start_to_lower = par dir := ANTICLOCKWISE motor := ON endpar rule r_stop_motor = motor := OFF //if the state is FULLYCLOSED either it remains FULLYCLOSED or it becomes OPENING CTLSPEC ag(phase=FULLYCLOSED implies ax(phase=FULLYCLOSED or phase=OPENING)) CTLSPEC ag(phase=OPENING implies ax(phase=OPENING or phase=FULLYOPENED)) CTLSPEC ag(phase=FULLYOPENED implies ax(phase=FULLYOPENED or phase=CLOSING)) CTLSPEC ag(phase=CLOSING implies ax(phase=CLOSING or phase=FULLYCLOSED)) //properties on the relationship between the state and the motor CTLSPEC ag(phase=FULLYCLOSED implies motor = OFF) CTLSPEC ag(phase=FULLYOPENED implies motor = OFF) CTLSPEC ag(phase=OPENING implies motor = ON) CTLSPEC ag(phase=CLOSING implies motor = ON) //liveness CTLSPEC ag(phase = FULLYOPENED implies ef(phase = FULLYCLOSED)) CTLSPEC ag(phase = FULLYCLOSED implies ef(phase = FULLYOPENED)) main rule r_Main = par if(phase=FULLYCLOSED) then if(passed(170)) then par r_start_to_raise[] phase := OPENING endpar endif endif if(phase=OPENING) then if(event_top) then par r_stop_motor[] phase := FULLYOPENED endpar endif endif if(phase=FULLYOPENED) then if(passed(10)) then par r_start_to_lower[] phase := CLOSING endpar endif endif if(phase=CLOSING) then if(event_bottom) then par r_stop_motor[] phase := FULLYCLOSED endpar endif endif endpar default init s0: function phase = FULLYCLOSED function motor = OFF
25.419355
111
0.724196
9d86c7649544a805c04b5b7e428c83e6cb5770a0
18,768
asm
Assembly
target/cos_117/disasm/iop_overlay1/BMGET.asm
jrrk2/cray-sim
52c9639808d6890517092637b188282c00cce4f7
[ "BSL-1.0" ]
49
2020-10-09T12:29:16.000Z
2022-03-12T02:33:35.000Z
target/cos_117/disasm/iop_overlay1/BMGET.asm
jrrk2/cray-sim
52c9639808d6890517092637b188282c00cce4f7
[ "BSL-1.0" ]
1
2021-12-29T15:59:25.000Z
2021-12-29T15:59:25.000Z
target/cos_117/disasm/iop_overlay1/BMGET.asm
jrrk2/cray-sim
52c9639808d6890517092637b188282c00cce4f7
[ "BSL-1.0" ]
6
2021-04-12T06:10:32.000Z
2022-02-08T23:11:19.000Z
0x0000 (0x000000) 0x101D- f:00010 d: 29 | A = 29 (0x001D) 0x0001 (0x000002) 0x2926- f:00024 d: 294 | OR[294] = A 0x0002 (0x000004) 0x1001- f:00010 d: 1 | A = 1 (0x0001) 0x0003 (0x000006) 0x2927- f:00024 d: 295 | OR[295] = A 0x0004 (0x000008) 0x1126- f:00010 d: 294 | A = 294 (0x0126) 0x0005 (0x00000A) 0x5800- f:00054 d: 0 | B = A 0x0006 (0x00000C) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0007 (0x00000E) 0x7C09- f:00076 d: 9 | R = OR[9] 0x0008 (0x000010) 0x2006- f:00020 d: 6 | A = OR[6] 0x0009 (0x000012) 0x140C- f:00012 d: 12 | A = A + 12 (0x000C) 0x000A (0x000014) 0x2908- f:00024 d: 264 | OR[264] = A 0x000B (0x000016) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x000C (0x000018) 0x291F- f:00024 d: 287 | OR[287] = A 0x000D (0x00001A) 0x2006- f:00020 d: 6 | A = OR[6] 0x000E (0x00001C) 0x140D- f:00012 d: 13 | A = A + 13 (0x000D) 0x000F (0x00001E) 0x2908- f:00024 d: 264 | OR[264] = A 0x0010 (0x000020) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x0011 (0x000022) 0x2920- f:00024 d: 288 | OR[288] = A 0x0012 (0x000024) 0x2006- f:00020 d: 6 | A = OR[6] 0x0013 (0x000026) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B) 0x0014 (0x000028) 0x2908- f:00024 d: 264 | OR[264] = A 0x0015 (0x00002A) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x0016 (0x00002C) 0x211F- f:00020 d: 287 | A = OR[287] 0x0017 (0x00002E) 0x8402- f:00102 d: 2 | P = P + 2 (0x0019), A = 0 0x0018 (0x000030) 0x700A- f:00070 d: 10 | P = P + 10 (0x0022) 0x0019 (0x000032) 0x2120- f:00020 d: 288 | A = OR[288] 0x001A (0x000034) 0x8402- f:00102 d: 2 | P = P + 2 (0x001C), A = 0 0x001B (0x000036) 0x7007- f:00070 d: 7 | P = P + 7 (0x0022) 0x001C (0x000038) 0x102A- f:00010 d: 42 | A = 42 (0x002A) 0x001D (0x00003A) 0x2926- f:00024 d: 294 | OR[294] = A 0x001E (0x00003C) 0x1126- f:00010 d: 294 | A = 294 (0x0126) 0x001F (0x00003E) 0x5800- f:00054 d: 0 | B = A 0x0020 (0x000040) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0021 (0x000042) 0x7C09- f:00076 d: 9 | R = OR[9] 0x0022 (0x000044) 0x2104- f:00020 d: 260 | A = OR[260] 0x0023 (0x000046) 0x290D- f:00024 d: 269 | OR[269] = A 0x0024 (0x000048) 0x2104- f:00020 d: 260 | A = OR[260] 0x0025 (0x00004A) 0x1403- f:00012 d: 3 | A = A + 3 (0x0003) 0x0026 (0x00004C) 0x1A00-0xFFFC f:00015 d: 0 | A = A & 65532 (0xFFFC) 0x0028 (0x000050) 0x2904- f:00024 d: 260 | OR[260] = A 0x0029 (0x000052) 0x2104- f:00020 d: 260 | A = OR[260] 0x002A (0x000054) 0x2922- f:00024 d: 290 | OR[290] = A 0x002B (0x000056) 0x1020- f:00010 d: 32 | A = 32 (0x0020) 0x002C (0x000058) 0x1408- f:00012 d: 8 | A = A + 8 (0x0008) 0x002D (0x00005A) 0x1404- f:00012 d: 4 | A = A + 4 (0x0004) 0x002E (0x00005C) 0x2504- f:00022 d: 260 | A = A + OR[260] 0x002F (0x00005E) 0x2904- f:00024 d: 260 | OR[260] = A 0x0030 (0x000060) 0x2104- f:00020 d: 260 | A = OR[260] 0x0031 (0x000062) 0x2705- f:00023 d: 261 | A = A - OR[261] 0x0032 (0x000064) 0xB234- f:00131 d: 52 | R = OR[52], C = 1 0x0033 (0x000066) 0x000B- f:00000 d: 11 | PASS | **** non-standard encoding with D:0x000B **** 0x0034 (0x000068) 0x210D- f:00020 d: 269 | A = OR[269] 0x0035 (0x00006A) 0x3904- f:00034 d: 260 | (OR[260]) = A 0x0036 (0x00006C) 0x2D04- f:00026 d: 260 | OR[260] = OR[260] + 1 0x0037 (0x00006E) 0x2122- f:00020 d: 290 | A = OR[290] 0x0038 (0x000070) 0x1420- f:00012 d: 32 | A = A + 32 (0x0020) 0x0039 (0x000072) 0x2921- f:00024 d: 289 | OR[289] = A 0x003A (0x000074) 0x2121- f:00020 d: 289 | A = OR[289] 0x003B (0x000076) 0x1408- f:00012 d: 8 | A = A + 8 (0x0008) 0x003C (0x000078) 0x2923- f:00024 d: 291 | OR[291] = A 0x003D (0x00007A) 0x2122- f:00020 d: 290 | A = OR[290] 0x003E (0x00007C) 0x1408- f:00012 d: 8 | A = A + 8 (0x0008) 0x003F (0x00007E) 0x2908- f:00024 d: 264 | OR[264] = A 0x0040 (0x000080) 0x211F- f:00020 d: 287 | A = OR[287] 0x0041 (0x000082) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x0042 (0x000084) 0x2122- f:00020 d: 290 | A = OR[290] 0x0043 (0x000086) 0x1409- f:00012 d: 9 | A = A + 9 (0x0009) 0x0044 (0x000088) 0x2908- f:00024 d: 264 | OR[264] = A 0x0045 (0x00008A) 0x2120- f:00020 d: 288 | A = OR[288] 0x0046 (0x00008C) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x0047 (0x00008E) 0x2122- f:00020 d: 290 | A = OR[290] 0x0048 (0x000090) 0x140A- f:00012 d: 10 | A = A + 10 (0x000A) 0x0049 (0x000092) 0x2908- f:00024 d: 264 | OR[264] = A 0x004A (0x000094) 0x1003- f:00010 d: 3 | A = 3 (0x0003) 0x004B (0x000096) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x004C (0x000098) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x004D (0x00009A) 0x2924- f:00024 d: 292 | OR[292] = A 0x004E (0x00009C) 0x1800-0x0CFF f:00014 d: 0 | A = 3327 (0x0CFF) 0x0050 (0x0000A0) 0x2913- f:00024 d: 275 | OR[275] = A 0x0051 (0x0000A2) 0x2113- f:00020 d: 275 | A = OR[275] 0x0052 (0x0000A4) 0x1402- f:00012 d: 2 | A = A + 2 (0x0002) 0x0053 (0x0000A6) 0x2908- f:00024 d: 264 | OR[264] = A 0x0054 (0x0000A8) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x0055 (0x0000AA) 0x291A- f:00024 d: 282 | OR[282] = A 0x0056 (0x0000AC) 0x2113- f:00020 d: 275 | A = OR[275] 0x0057 (0x0000AE) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001) 0x0058 (0x0000B0) 0x2908- f:00024 d: 264 | OR[264] = A 0x0059 (0x0000B2) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x005A (0x0000B4) 0x291B- f:00024 d: 283 | OR[283] = A 0x005B (0x0000B6) 0x7042- f:00070 d: 66 | P = P + 66 (0x009D) 0x005C (0x0000B8) 0x100D- f:00010 d: 13 | A = 13 (0x000D) 0x005D (0x0000BA) 0x2926- f:00024 d: 294 | OR[294] = A 0x005E (0x0000BC) 0x2124- f:00020 d: 292 | A = OR[292] 0x005F (0x0000BE) 0x2927- f:00024 d: 295 | OR[295] = A 0x0060 (0x0000C0) 0x1800-0x016D f:00014 d: 0 | A = 365 (0x016D) 0x0062 (0x0000C4) 0x2928- f:00024 d: 296 | OR[296] = A 0x0063 (0x0000C6) 0x1126- f:00010 d: 294 | A = 294 (0x0126) 0x0064 (0x0000C8) 0x5800- f:00054 d: 0 | B = A 0x0065 (0x0000CA) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18) 0x0067 (0x0000CE) 0x7C09- f:00076 d: 9 | R = OR[9] 0x0068 (0x0000D0) 0x2006- f:00020 d: 6 | A = OR[6] 0x0069 (0x0000D2) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B) 0x006A (0x0000D4) 0x2908- f:00024 d: 264 | OR[264] = A 0x006B (0x0000D6) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x006C (0x0000D8) 0x2925- f:00024 d: 293 | OR[293] = A 0x006D (0x0000DA) 0x8402- f:00102 d: 2 | P = P + 2 (0x006F), A = 0 0x006E (0x0000DC) 0x7004- f:00070 d: 4 | P = P + 4 (0x0072) 0x006F (0x0000DE) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0070 (0x0000E0) 0x291C- f:00024 d: 284 | OR[284] = A 0x0071 (0x0000E2) 0x7056- f:00070 d: 86 | P = P + 86 (0x00C7) 0x0072 (0x0000E4) 0x100E- f:00010 d: 14 | A = 14 (0x000E) 0x0073 (0x0000E6) 0x2926- f:00024 d: 294 | OR[294] = A 0x0074 (0x0000E8) 0x2124- f:00020 d: 292 | A = OR[292] 0x0075 (0x0000EA) 0x2927- f:00024 d: 295 | OR[295] = A 0x0076 (0x0000EC) 0x2125- f:00020 d: 293 | A = OR[293] 0x0077 (0x0000EE) 0x2928- f:00024 d: 296 | OR[296] = A 0x0078 (0x0000F0) 0x2122- f:00020 d: 290 | A = OR[290] 0x0079 (0x0000F2) 0x2929- f:00024 d: 297 | OR[297] = A 0x007A (0x0000F4) 0x1126- f:00010 d: 294 | A = 294 (0x0126) 0x007B (0x0000F6) 0x5800- f:00054 d: 0 | B = A 0x007C (0x0000F8) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18) 0x007E (0x0000FC) 0x7C09- f:00076 d: 9 | R = OR[9] 0x007F (0x0000FE) 0x2006- f:00020 d: 6 | A = OR[6] 0x0080 (0x000100) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B) 0x0081 (0x000102) 0x2908- f:00024 d: 264 | OR[264] = A 0x0082 (0x000104) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x0083 (0x000106) 0x1026- f:00010 d: 38 | A = 38 (0x0026) 0x0084 (0x000108) 0x2926- f:00024 d: 294 | OR[294] = A 0x0085 (0x00010A) 0x211F- f:00020 d: 287 | A = OR[287] 0x0086 (0x00010C) 0x2927- f:00024 d: 295 | OR[295] = A 0x0087 (0x00010E) 0x2120- f:00020 d: 288 | A = OR[288] 0x0088 (0x000110) 0x2928- f:00024 d: 296 | OR[296] = A 0x0089 (0x000112) 0x2123- f:00020 d: 291 | A = OR[291] 0x008A (0x000114) 0x2929- f:00024 d: 297 | OR[297] = A 0x008B (0x000116) 0x1001- f:00010 d: 1 | A = 1 (0x0001) 0x008C (0x000118) 0x292A- f:00024 d: 298 | OR[298] = A 0x008D (0x00011A) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x008E (0x00011C) 0x292B- f:00024 d: 299 | OR[299] = A 0x008F (0x00011E) 0x1126- f:00010 d: 294 | A = 294 (0x0126) 0x0090 (0x000120) 0x5800- f:00054 d: 0 | B = A 0x0091 (0x000122) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x0092 (0x000124) 0x7C09- f:00076 d: 9 | R = OR[9] 0x0093 (0x000126) 0x2123- f:00020 d: 291 | A = OR[291] 0x0094 (0x000128) 0x1400- f:00012 d: 0 | A = A + 0 (0x0000) 0x0095 (0x00012A) 0x2908- f:00024 d: 264 | OR[264] = A 0x0096 (0x00012C) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x0097 (0x00012E) 0x291A- f:00024 d: 282 | OR[282] = A 0x0098 (0x000130) 0x2123- f:00020 d: 291 | A = OR[291] 0x0099 (0x000132) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001) 0x009A (0x000134) 0x2908- f:00024 d: 264 | OR[264] = A 0x009B (0x000136) 0x3108- f:00030 d: 264 | A = (OR[264]) 0x009C (0x000138) 0x291B- f:00024 d: 283 | OR[283] = A 0x009D (0x00013A) 0x1028- f:00010 d: 40 | A = 40 (0x0028) 0x009E (0x00013C) 0x2926- f:00024 d: 294 | OR[294] = A 0x009F (0x00013E) 0x1800-0x0030 f:00014 d: 0 | A = 48 (0x0030) 0x00A1 (0x000142) 0x2927- f:00024 d: 295 | OR[295] = A 0x00A2 (0x000144) 0x211B- f:00020 d: 283 | A = OR[283] 0x00A3 (0x000146) 0x2928- f:00024 d: 296 | OR[296] = A 0x00A4 (0x000148) 0x1064- f:00010 d: 100 | A = 100 (0x0064) 0x00A5 (0x00014A) 0x2929- f:00024 d: 297 | OR[297] = A 0x00A6 (0x00014C) 0x1011- f:00010 d: 17 | A = 17 (0x0011) 0x00A7 (0x00014E) 0x292A- f:00024 d: 298 | OR[298] = A 0x00A8 (0x000150) 0x1012- f:00010 d: 18 | A = 18 (0x0012) 0x00A9 (0x000152) 0x292B- f:00024 d: 299 | OR[299] = A 0x00AA (0x000154) 0x1126- f:00010 d: 294 | A = 294 (0x0126) 0x00AB (0x000156) 0x5800- f:00054 d: 0 | B = A 0x00AC (0x000158) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18) 0x00AE (0x00015C) 0x7C09- f:00076 d: 9 | R = OR[9] 0x00AF (0x00015E) 0x1028- f:00010 d: 40 | A = 40 (0x0028) 0x00B0 (0x000160) 0x2926- f:00024 d: 294 | OR[294] = A 0x00B1 (0x000162) 0x1800-0x001B f:00014 d: 0 | A = 27 (0x001B) 0x00B3 (0x000166) 0x2927- f:00024 d: 295 | OR[295] = A 0x00B4 (0x000168) 0x211D- f:00020 d: 285 | A = OR[285] 0x00B5 (0x00016A) 0x2928- f:00024 d: 296 | OR[296] = A 0x00B6 (0x00016C) 0x211E- f:00020 d: 286 | A = OR[286] 0x00B7 (0x00016E) 0x2929- f:00024 d: 297 | OR[297] = A 0x00B8 (0x000170) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x00B9 (0x000172) 0x292A- f:00024 d: 298 | OR[298] = A 0x00BA (0x000174) 0x211A- f:00020 d: 282 | A = OR[282] 0x00BB (0x000176) 0x292B- f:00024 d: 299 | OR[299] = A 0x00BC (0x000178) 0x1001- f:00010 d: 1 | A = 1 (0x0001) 0x00BD (0x00017A) 0x292C- f:00024 d: 300 | OR[300] = A 0x00BE (0x00017C) 0x100E- f:00010 d: 14 | A = 14 (0x000E) 0x00BF (0x00017E) 0x292D- f:00024 d: 301 | OR[301] = A 0x00C0 (0x000180) 0x1010- f:00010 d: 16 | A = 16 (0x0010) 0x00C1 (0x000182) 0x292E- f:00024 d: 302 | OR[302] = A 0x00C2 (0x000184) 0x1126- f:00010 d: 294 | A = 294 (0x0126) 0x00C3 (0x000186) 0x5800- f:00054 d: 0 | B = A 0x00C4 (0x000188) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18) 0x00C6 (0x00018C) 0x7C09- f:00076 d: 9 | R = OR[9] 0x00C7 (0x00018E) 0x2121- f:00020 d: 289 | A = OR[289] 0x00C8 (0x000190) 0x2524- f:00022 d: 292 | A = A + OR[292] 0x00C9 (0x000192) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001) 0x00CA (0x000194) 0x291A- f:00024 d: 282 | OR[282] = A 0x00CB (0x000196) 0x211C- f:00020 d: 284 | A = OR[284] 0x00CC (0x000198) 0x391A- f:00034 d: 282 | (OR[282]) = A 0x00CD (0x00019A) 0x2D24- f:00026 d: 292 | OR[292] = OR[292] + 1 0x00CE (0x00019C) 0x4200- f:00041 d: 0 | C = 1, io 0000 (IOR) = BZ 0x00CF (0x00019E) 0x1604- f:00013 d: 4 | A = A - 4 (0x0004) 0x00D0 (0x0001A0) 0x8874- f:00104 d: 116 | P = P - 116 (0x005C), C = 0 0x00D1 (0x0001A2) 0x2121- f:00020 d: 289 | A = OR[289] 0x00D2 (0x0001A4) 0x1400- f:00012 d: 0 | A = A + 0 (0x0000) 0x00D3 (0x0001A6) 0x2908- f:00024 d: 264 | OR[264] = A 0x00D4 (0x0001A8) 0x1003- f:00010 d: 3 | A = 3 (0x0003) 0x00D5 (0x0001AA) 0x3908- f:00034 d: 264 | (OR[264]) = A 0x00D6 (0x0001AC) 0x101E- f:00010 d: 30 | A = 30 (0x001E) 0x00D7 (0x0001AE) 0x2926- f:00024 d: 294 | OR[294] = A 0x00D8 (0x0001B0) 0x211F- f:00020 d: 287 | A = OR[287] 0x00D9 (0x0001B2) 0x2927- f:00024 d: 295 | OR[295] = A 0x00DA (0x0001B4) 0x2120- f:00020 d: 288 | A = OR[288] 0x00DB (0x0001B6) 0x2928- f:00024 d: 296 | OR[296] = A 0x00DC (0x0001B8) 0x1001- f:00010 d: 1 | A = 1 (0x0001) 0x00DD (0x0001BA) 0x2929- f:00024 d: 297 | OR[297] = A 0x00DE (0x0001BC) 0x1126- f:00010 d: 294 | A = 294 (0x0126) 0x00DF (0x0001BE) 0x5800- f:00054 d: 0 | B = A 0x00E0 (0x0001C0) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x00E1 (0x0001C2) 0x7C09- f:00076 d: 9 | R = OR[9] 0x00E2 (0x0001C4) 0x1029- f:00010 d: 41 | A = 41 (0x0029) 0x00E3 (0x0001C6) 0x2926- f:00024 d: 294 | OR[294] = A 0x00E4 (0x0001C8) 0x1800-0x013B f:00014 d: 0 | A = 315 (0x013B) 0x00E6 (0x0001CC) 0x2927- f:00024 d: 295 | OR[295] = A 0x00E7 (0x0001CE) 0x2118- f:00020 d: 280 | A = OR[280] 0x00E8 (0x0001D0) 0x2928- f:00024 d: 296 | OR[296] = A 0x00E9 (0x0001D2) 0x2119- f:00020 d: 281 | A = OR[281] 0x00EA (0x0001D4) 0x2929- f:00024 d: 297 | OR[297] = A 0x00EB (0x0001D6) 0x2121- f:00020 d: 289 | A = OR[289] 0x00EC (0x0001D8) 0x292A- f:00024 d: 298 | OR[298] = A 0x00ED (0x0001DA) 0x1126- f:00010 d: 294 | A = 294 (0x0126) 0x00EE (0x0001DC) 0x5800- f:00054 d: 0 | B = A 0x00EF (0x0001DE) 0x1000- f:00010 d: 0 | A = 0 (0x0000) 0x00F0 (0x0001E0) 0x7C09- f:00076 d: 9 | R = OR[9] 0x00F1 (0x0001E2) 0x0000- f:00000 d: 0 | PASS 0x00F2 (0x0001E4) 0x0000- f:00000 d: 0 | PASS 0x00F3 (0x0001E6) 0x0000- f:00000 d: 0 | PASS
79.86383
127
0.456202
46ed89a531dbf83dae59f96272e5ef07ac33650c
53
asm
Assembly
audio/sfx/snare7_2.asm
AmateurPanda92/pokemon-rby-dx
f7ba1cc50b22d93ed176571e074a52d73360da93
[ "MIT" ]
9
2020-07-12T19:44:21.000Z
2022-03-03T23:32:40.000Z
audio/sfx/snare7_2.asm
JStar-debug2020/pokemon-rby-dx
c2fdd8145d96683addbd8d9075f946a68d1527a1
[ "MIT" ]
7
2020-07-16T10:48:52.000Z
2021-01-28T18:32:02.000Z
audio/sfx/snare7_2.asm
JStar-debug2020/pokemon-rby-dx
c2fdd8145d96683addbd8d9075f946a68d1527a1
[ "MIT" ]
2
2021-03-28T18:33:43.000Z
2021-05-06T13:12:09.000Z
SFX_Snare7_2_Ch7: noisenote 0, 8, 2, 35 endchannel
13.25
22
0.754717
cc7262f37ab55fe3aa42bcbb9796c809bb0e421d
1,596
asm
Assembly
libsrc/_DEVELOPMENT/stdio/z80/input_helpers/__stdio_scanf_c.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/_DEVELOPMENT/stdio/z80/input_helpers/__stdio_scanf_c.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/_DEVELOPMENT/stdio/z80/input_helpers/__stdio_scanf_c.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
SECTION code_clib SECTION code_stdio PUBLIC __stdio_scanf_c EXTERN STDIO_SEEK_CUR EXTERN __stdio_recv_input_read EXTERN l_addu_hl_bc, asm0_fseek_unlocked __stdio_scanf_c: ; %c converter called from vfscanf() ; ; enter : ix = FILE * ; bc = field width (0 means default) ; hl = void *p (0 means assignment suppression) ; ; exit : carry set if error ; ; uses : all except ix ; DEFAULT FIELD WIDTH ld a,b or c jr nz, width_specified inc c ; default is one char width_specified: ld a,h or l jr z, assignment_suppressed ; READ CHARS FROM STREAM ex de,hl ; de = void *buffer call __stdio_recv_input_read ret c ; any kind of error is a failure exx inc hl ; number of assigned items++ exx ret assignment_suppressed: ; SEEK PAST CHARS FROM STREAM ; forward seek is always successful even if it passes end of file ld l,c ld h,b ld de,0 ; dehl = forward seek offset ld c,STDIO_SEEK_CUR push hl ; save forward seek offset exx push de ; save chars read from stream push hl ; save items assigned exx call asm0_fseek_unlocked pop de ; de = items assigned pop hl ; hl = chars read from stream pop bc ; bc = forward seek offset call l_addu_hl_bc ex de,hl exx or a ret
19.228916
68
0.550125
c4cb7ad1c5aeb4402f7f66d775d1ecedc07249ca
404
asm
Assembly
lab09/4-5-print-string-len/print-string-len.asm
adinasm/iocla-demos
a4109ed9fd3a34b097299f941617a6380267c003
[ "MIT" ]
null
null
null
lab09/4-5-print-string-len/print-string-len.asm
adinasm/iocla-demos
a4109ed9fd3a34b097299f941617a6380267c003
[ "MIT" ]
null
null
null
lab09/4-5-print-string-len/print-string-len.asm
adinasm/iocla-demos
a4109ed9fd3a34b097299f941617a6380267c003
[ "MIT" ]
null
null
null
%include "../utils/printf32.asm" section .data mystring db "This is my string", 0 section .text extern puts extern printf global main main: push ebp mov ebp, esp mov eax, mystring xor ecx, ecx test_one_byte: mov bl, byte [eax] test bl, bl je out inc eax inc ecx jmp test_one_byte out: PRINTF32 `[PRINTF32]: %d\n[printf]: \x0`, ecx leave ret
13.032258
49
0.621287
1a44988c02c048d9a93bf73c5368181d2b371663
623
asm
Assembly
libsrc/msx/msx_vwrite.asm
andydansby/z88dk-mk2
51c15f1387293809c496f5eaf7b196f8a0e9b66b
[ "ClArtistic" ]
1
2020-09-15T08:35:49.000Z
2020-09-15T08:35:49.000Z
libsrc/msx/msx_vwrite.asm
andydansby/z88dk-MK2
51c15f1387293809c496f5eaf7b196f8a0e9b66b
[ "ClArtistic" ]
null
null
null
libsrc/msx/msx_vwrite.asm
andydansby/z88dk-MK2
51c15f1387293809c496f5eaf7b196f8a0e9b66b
[ "ClArtistic" ]
null
null
null
; ; MSX specific routines ; ; GFX - a small graphics library ; Copyright (C) 2004 Rafael de Oliveira Jannone ; ; extern void msx_vwrite(void *source, u_int dest, u_int count) ; ; Transfer count bytes from RAM to VRAM (BIOS paged version) ; ; $Id: msx_vwrite.asm,v 1.7 2009/06/22 21:44:17 dom Exp $ ; XLIB msx_vwrite LIB msxbios IF FORmsx INCLUDE "msxbios.def" ELSE INCLUDE "svibios.def" ENDIF msx_vwrite: ld ix,2 add ix,sp ld c, (ix+0) ; count ld b, (ix+1) ld e, (ix+2) ; dest ld d, (ix+3) ld l, (ix+4) ; source ld h, (ix+5) ld ix,LDIRVM jp msxbios
14.488372
63
0.611557
4dbd3fff2836e5dad7f26761b1d2377167f443f0
6,800
asm
Assembly
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_115.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_115.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_115.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 %r15 push %r8 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_WC_ht+0xd379, %r14 cmp $52693, %rdi mov $0x6162636465666768, %rbp movq %rbp, %xmm1 vmovups %ymm1, (%r14) nop nop add $37012, %r8 lea addresses_normal_ht+0xa900, %rbx nop nop nop nop dec %r15 mov $0x6162636465666768, %r11 movq %r11, %xmm1 vmovups %ymm1, (%rbx) cmp $60341, %r15 lea addresses_WC_ht+0xffd0, %r11 nop nop nop nop sub %rbp, %rbp mov $0x6162636465666768, %rbx movq %rbx, %xmm4 movups %xmm4, (%r11) and $40686, %r8 lea addresses_WC_ht+0x2354, %r8 nop nop nop nop nop cmp $42088, %rbx mov $0x6162636465666768, %rbp movq %rbp, %xmm7 vmovups %ymm7, (%r8) nop nop and $3739, %r8 lea addresses_A_ht+0x13210, %rsi lea addresses_UC_ht+0x110b0, %rdi nop nop nop dec %rbx mov $79, %rcx rep movsw nop nop nop nop nop dec %rbx lea addresses_D_ht+0x1eb10, %rsi lea addresses_WC_ht+0x1a890, %rdi nop nop nop nop nop add $55293, %rbx mov $81, %rcx rep movsq nop nop add $43993, %r15 lea addresses_WT_ht+0xad80, %r15 and %rbp, %rbp mov (%r15), %r8d xor $38087, %r11 lea addresses_D_ht+0x19550, %rdi inc %rsi mov $0x6162636465666768, %rbx movq %rbx, (%rdi) nop nop nop nop nop and $2181, %r8 pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r8 pop %r15 pop %r14 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r13 push %r15 push %r8 push %rbp // Store lea addresses_US+0x1a4e8, %r11 nop nop nop nop sub $14933, %r13 movl $0x51525354, (%r11) cmp %r11, %r11 // Store lea addresses_RW+0x1150, %r13 nop add %r12, %r12 mov $0x5152535455565758, %r10 movq %r10, %xmm7 movups %xmm7, (%r13) nop nop nop nop inc %r15 // Store lea addresses_PSE+0xfa50, %r8 xor %r11, %r11 mov $0x5152535455565758, %r13 movq %r13, (%r8) nop nop nop nop inc %r15 // Faulty Load lea addresses_D+0x1a950, %r12 nop nop nop nop sub $61611, %r15 mov (%r12), %r11 lea oracles, %rbp and $0xff, %r11 shlq $12, %r11 mov (%rbp,%r11,1), %r11 pop %rbp pop %r8 pop %r15 pop %r13 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': True, 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 3}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': False, 'congruent': 11}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 8}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_D', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 7}} {'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 2}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 2}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 1}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 6}} {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 5}} {'36': 21829} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
35.602094
2,999
0.658824
f7591b1207954b95c06a73dd2a47a9e9dfa1e2da
1,011
nasm
Assembly
MdePkg/Library/BaseLib/Ia32/MultU64x32.nasm
nicklela/edk2
dfafa8e45382939fb5dc78e9d37b97b500a43613
[ "Python-2.0", "Zlib", "BSD-2-Clause", "MIT", "BSD-2-Clause-Patent", "BSD-3-Clause" ]
3,861
2019-09-04T10:10:11.000Z
2022-03-31T15:46:28.000Z
MdePkg/Library/BaseLib/Ia32/MultU64x32.nasm
nicklela/edk2
dfafa8e45382939fb5dc78e9d37b97b500a43613
[ "Python-2.0", "Zlib", "BSD-2-Clause", "MIT", "BSD-2-Clause-Patent", "BSD-3-Clause" ]
1,199
2015-01-12T08:00:01.000Z
2022-03-29T18:14:42.000Z
MdePkg/Library/BaseLib/Ia32/MultU64x32.nasm
nicklela/edk2
dfafa8e45382939fb5dc78e9d37b97b500a43613
[ "Python-2.0", "Zlib", "BSD-2-Clause", "MIT", "BSD-2-Clause-Patent", "BSD-3-Clause" ]
1,850
2015-01-01T11:28:12.000Z
2022-03-31T18:10:59.000Z
;------------------------------------------------------------------------------ ; ; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; SPDX-License-Identifier: BSD-2-Clause-Patent ; ; Module Name: ; ; MultU64x32.nasm ; ; Abstract: ; ; Calculate the product of a 64-bit integer and a 32-bit integer ; ;------------------------------------------------------------------------------ SECTION .text ;------------------------------------------------------------------------------ ; UINT64 ; EFIAPI ; InternalMathMultU64x32 ( ; IN UINT64 Multiplicand, ; IN UINT32 Multiplier ; ); ;------------------------------------------------------------------------------ global ASM_PFX(InternalMathMultU64x32) ASM_PFX(InternalMathMultU64x32): mov ecx, [esp + 12] mov eax, ecx imul ecx, [esp + 8] ; overflow not detectable mul dword [esp + 4] add edx, ecx ret
28.885714
80
0.386746
f21e9adfef61db1615a3cf61b9529f576f80f999
181
asm
Assembly
programs/oeis/138/A138718.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/138/A138718.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/138/A138718.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A138718: Group number of the elements of the n-th column of the periodic table of the elements with 18 columns. ; 1,2,3,4,5,6,7,8,8,8,1,2,3,4,5,6,7,8 mod $0,10 min $0,7 add $0,1
25.857143
113
0.679558
e6c01e027d7aafaab83a967c3e5e9e480e868ca6
450
asm
Assembly
lab4/max/maxfunc.asm
samdsk/lab_arch2
45ac71c5647b2a7985f2391686f22ebab685ba67
[ "MIT" ]
null
null
null
lab4/max/maxfunc.asm
samdsk/lab_arch2
45ac71c5647b2a7985f2391686f22ebab685ba67
[ "MIT" ]
null
null
null
lab4/max/maxfunc.asm
samdsk/lab_arch2
45ac71c5647b2a7985f2391686f22ebab685ba67
[ "MIT" ]
null
null
null
#function calcola max tra due numeri # int max(a,b) # if a<b return b # else return a .text .globl max max: #input $a0 <- a, $a1 <- b, output $v0 <- max value #prologo addi $sp $sp -8 sw $s0 4($sp) sw $s1 0($sp) #corpo move $s0 $a0 move $s1 $a1 #if a<b $v0 <- b slt $t0 $s0 $s1 beqz $t0 a_Max_b #a>b #a<b move $v0 $s1 j finish a_Max_b: move $v0 $s0 finish: #epilogo lw $s0 4($sp) lw $s1 0($sp) addi $sp $sp 8 jr $ra
12.5
51
0.568889
9582b2660889c574c61f0bfbfb56c54499f33447
440
asm
Assembly
oeis/075/A075753.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/075/A075753.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/075/A075753.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A075753: Smallest prime factor of n-th odd triangular number. ; Submitted by Jon Maiga ; 3,3,3,3,5,7,3,3,3,3,11,5,3,3,3,3,5,19,3,3,3,3,23,5,3,3,3,3,29,31,3,3,3,3,5,37,3,3,3,3,41,5,3,3,3,3,5,7,3,3,3,3,53,5,3,3,3,3,7,11,3,3,3,3,5,7,3,3,3,3,11,5,3,3,3,3,5,79,3,3,3,3,83,5,3,3,3,3,89,7,3,3,3,3,5,97,3,3,3 mov $2,$0 mul $0,2 mod $2,2 add $0,$2 seq $0,121937 ; a(n) = least m >= 2 such that (n mod m) > (n+2 mod m). div $0,2 mul $0,2 add $0,1
33.846154
213
0.579545
b9597a6235abc7bf9deb6fdec6da4b1bb1be24e4
722
asm
Assembly
atari_st/hello.asm
michaelcmartin/bumbershoot
d465d18997c5651bb1d71488705b0d6e1271660c
[ "MIT" ]
20
2016-06-22T10:04:48.000Z
2022-03-13T23:16:10.000Z
atari_st/hello.asm
michaelcmartin/bumbershoot
d465d18997c5651bb1d71488705b0d6e1271660c
[ "MIT" ]
null
null
null
atari_st/hello.asm
michaelcmartin/bumbershoot
d465d18997c5651bb1d71488705b0d6e1271660c
[ "MIT" ]
2
2016-12-19T02:31:06.000Z
2020-02-04T02:56:27.000Z
;;; Hello world for the Atari ST (non-GEM) ;;; This uses BIOS and GEMDOS calls to output a string to the TOS ;;; console, then read a key from it to give the string a chance to ;;; be read before returning control to GEM. move.l #msg,a3 lp: clr.w d0 move.b (a3)+,d0 beq.s done move.w d0,-(a7) ; Character to print move.w #2,-(a7) ; Print to console move #3,-(a7) ; Bconout function trap #13 ; BIOS call addq.l #6,a7 bra.s lp done: move.w #2,-(a7) ; Read from console move.w #2,-(a7) ; Bconin function trap #13 ; BIOS call addq.l #4,a7 clr.w -(a7) ; Pterm0 function trap #1 ; GEMDOS call msg: dc.b "Hello, world!",13,10,13,10 dc.b "Now waiting for the world",13,10 dc.b "to press a key...",0
27.769231
67
0.644044
b12a91069024ca059586da76a265e79154af976b
2,067
asm
Assembly
libsrc/graphics/w_multipoint_callee.asm
rjcorrig/z88dk
c49c26bb232c17ea5a45d21bb81b6343572b7f4c
[ "ClArtistic" ]
null
null
null
libsrc/graphics/w_multipoint_callee.asm
rjcorrig/z88dk
c49c26bb232c17ea5a45d21bb81b6343572b7f4c
[ "ClArtistic" ]
null
null
null
libsrc/graphics/w_multipoint_callee.asm
rjcorrig/z88dk
c49c26bb232c17ea5a45d21bb81b6343572b7f4c
[ "ClArtistic" ]
null
null
null
; ; Z88 Graphics Functions - Small C+ stubs ; ; Stefano Bodrato 19/7/2007 ; ; ; $Id: w_multipoint_callee.asm $ ; ; CALLER LINKAGE FOR FUNCTION POINTERS ; ----- bool multipoint(int hv, int length, int x, int y) ;Usage: ;pick a vertical or horizontal bit bar, up to 16 bits long SECTION code_graphics PUBLIC multipoint_callee PUBLIC _multipoint_callee PUBLIC ASMDISP_MULTIPOINT_CALLEE EXTERN w_pointxy EXTERN swapgfxbk EXTERN swapgfxbk1 .multipoint_callee ._multipoint_callee pop af ; ret addr pop de ; y pop hl ; x pop bc ex af,af ld a,c ; length pop bc ; h/v ld b,a ex af,af push af ; ret addr .asmentry push ix call swapgfxbk ld a,b rr c ld bc,0 jr nc,horizontal .vertical sla c rl b push af push hl push de push bc call w_pointxy pop bc pop de pop hl jr z,jv inc bc .jv pop af inc de dec a jr nz,vertical jr exit .horizontal sla c rl b push af push hl push de push bc call w_pointxy pop bc pop de pop hl jr z,jh inc bc .jh pop af inc hl dec a jr nz,horizontal .exit call swapgfxbk1 pop ix ld h,b ld l,c ret DEFC ASMDISP_MULTIPOINT_CALLEE = # asmentry - multipoint_callee
20.465347
63
0.391388
1720318f578b4b757ffcf1287314f4f3ed3f9cbf
1,168
asm
Assembly
Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xca_notsx.log_17_419.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xca_notsx.log_17_419.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xca_notsx.log_17_419.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 %rax push %rcx push %rdi push %rsi lea addresses_WC_ht+0xf897, %rsi lea addresses_WC_ht+0xf0b3, %rdi nop nop nop nop add $111, %rax mov $120, %rcx rep movsq nop nop nop nop nop sub %rcx, %rcx pop %rsi pop %rdi pop %rcx pop %rax ret .global s_faulty_load s_faulty_load: push %r11 push %r8 push %r9 push %rax push %rbp push %rdx // Faulty Load lea addresses_US+0x5897, %r11 nop xor %r8, %r8 vmovups (%r11), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $0, %xmm5, %rdx lea oracles, %r8 and $0xff, %rdx shlq $12, %rdx mov (%r8,%rdx,1), %rdx pop %rdx pop %rbp pop %rax pop %r9 pop %r8 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_US', 'NT': False, 'AVXalign': True, 'size': 8, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_WC_ht'}} {'00': 17} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
17.432836
148
0.655822
abac8604a1c33d6308567e6558cd526800445910
1,172
asm
Assembly
y2s2/csa/practicals/prac8/7-ex3.2.asm
ouldevloper/university
4bb4a7e86912b46aa625900d2985b4d1e436cf4e
[ "MIT" ]
8
2019-06-22T14:29:51.000Z
2021-09-22T16:58:12.000Z
y2s2/csa/practicals/prac8/7-ex3.2.asm
ouldevloper/university
4bb4a7e86912b46aa625900d2985b4d1e436cf4e
[ "MIT" ]
1
2020-06-30T06:38:00.000Z
2020-07-08T06:37:57.000Z
y2s2/csa/practicals/prac8/7-ex3.2.asm
ouldevloper/university
4bb4a7e86912b46aa625900d2985b4d1e436cf4e
[ "MIT" ]
9
2020-04-04T12:59:50.000Z
2022-03-27T22:44:58.000Z
; 7-ex3.2.asm ; Allow user to enter D/C ; display Diploma/Certificate respectively ; ask user if want to repeat, if yes, cont. .MODEL SMALL .STACK 100 .DATA opText DB 'Enter code (D/C): $' nl DB 13,10,'$' op DB ? dipl DB 'Diploma$' cert DB 'Certificate$' conti DB 'Continue(Y/N): $' .CODE MAIN PROC MOV AX,@DATA MOV DS,AX QUERY: ; ask for operator MOV AH, 09h LEA DX, opText INT 21h MOV AH, 01h INT 21h MOV op, AL CALL newline ; check if not diploma CMP op, 'C' JNE DIP LEA DX, cert JMP cont DIP: LEA DX, dipl JMP cont CONT: MOV AH, 09h INT 21H CALL newline ; ask if continue MOV AH, 9H LEA DX, conti INT 21H MOV AH, 01H INT 21H MOV op, AL CALL newline CMP op, 'Y' JNE FIN JMP QUERY FIN: MOV AX,4C00H INT 21H MAIN ENDP newline PROC MOV AH, 09h LEA DX, nl INT 21h RET newline ENDP END MAIN
14.292683
43
0.476109
b223f026774e3f726b09324cc8786ce8511391b0
7,793
asm
Assembly
bahamut/source/chapter-credits.asm
higan-emu/bahamut-lagoon-translation-kit
6f08de5b92b597c0b9ecebd485cc975b99acfc13
[ "0BSD" ]
2
2021-08-15T04:10:10.000Z
2021-08-15T20:14:13.000Z
bahamut/source/chapter-credits.asm
higan-emu/bahamut-lagoon-translation-kit
6f08de5b92b597c0b9ecebd485cc975b99acfc13
[ "0BSD" ]
1
2022-02-16T02:46:39.000Z
2022-02-16T04:30:29.000Z
bahamut/source/chapter-credits.asm
higan-emu/bahamut-lagoon-translation-kit
6f08de5b92b597c0b9ecebd485cc975b99acfc13
[ "0BSD" ]
1
2021-12-25T11:34:57.000Z
2021-12-25T11:34:57.000Z
namespace chapter { seek(codeCursor) namespace openingCredits { constant tileCount = $095f //number of tiles to transfer to VRAM constant lineNumber = $0960 //current line number being rendered //------ //da3b22 lda [$76],y ;load the next character //da3b24 cmp #$f0 ;test if it's a control code //------ function main { inline hook(define address, define index, variable lines) { cmp.w #${address}; jne return{#} //transfer static tiledata line to WRAM lda.w lineNumber; and #$0003; mul( 896); add.w #opening.block{index}; tax lda.w lineNumber; and #$0003; mul(1024); add.w #$e2c0; tay lda.w #896-1; mvn $7e=opening.block{index}>>16 leave //store amount of tiles needed to transfer lda.b #28; sta.w tileCount //if this is the last line of text, return #$fd (string terminal with no wait) //otherwise, return #$fe (line feed), so that this function will be called again lda.b #$fe ldy.w lineNumber; cpy.w #lines-1; bcc +; dec; + sec; rtl return{#}: } enter lda $76 //hooks arranged in the order they appear onscreen hook(a402,0,1) hook(a43f,1,2) hook(a48c,2,2) hook(a4b9,3,2) hook(a4e5,4,3) hook(a52c,5,2) hook(a55f,6,2) hook(a592,7,2) hook(a5c4,8,3) hook(a609,9,2) hook(a637,a,3) hook(a684,b,2) hook(a6b7,c,2) hook(a6ec,d,4) hook(a74f,e,2) hook(a77f,f,2) hook(a7af,g,2) hook(a7d9,h,2) leave lda #$fd; sec; rtl } } namespace endingCredits { enqueue pc seek($da2856); jsl disableColorMath seek($da758b); jsl main; jmp $7599 dequeue pc constant eventNumber = $7e0310 //$f8 => ending credits constant tilemap = $7e6000 constant hdmaTable = $7ed790 //the original game enabled color math on BG3 during the ending credits. //this had the effect of dramatically reducing readability of the text. //the byte in ROM that controls this is shared by several places in the game. //this routine ensures that the byte is only modified during the ending credits. //------ //da2856 lda [$28],y ;load value to write to $2131 (CGADDSUB) //da2858 sta $71 ;save value for later use //------ function disableColorMath { lda $28; cmp #$f0; beq +; lda [$28],y; sta $71; rtl; + lda $29; cmp #$08; beq +; lda [$28],y; sta $71; rtl; + lda $2a; cmp #$c7; beq +; lda [$28],y; sta $71; rtl; + cpy #$0017; beq +; lda [$28],y; sta $71; rtl; + lda eventNumber; cmp #$f8; beq +; lda [$28],y; sta $71; rtl; + lda [$28],y; and #$fb; sta $71; rtl //clear BG3 color math enable bit } //------ //da758b lda [$76],y ;load the next tile //da758d cmp #$ff ;check for the terminal //da758f beq $7599 ;if found, finish rendering //da7591 jsr $759a ;otherwise, transfer tile to tilemap //da7594 inx #2 //da7596 iny //da7597 bra $758b //------ function main { macro hook(define address) { cmp.w #${address}; bne +; jsl {address}; leave; rtl; + } enter lda #$0000; sta hdmaTable //disable HDMA BG3VOFS table lda $76 //hooks arranged in the order they appear onscreen hook(a711) hook(a746) hook(a793) hook(a7d1) hook(a82f) hook(a976) hook(a927) hook(a8a5) hook(a9d6) hook(aa3d) hook(aa9e) hook(aae8) hook(ab5d) hook(ab7b) leave; rtl } //A => tile count //X => tile index //Y => tilemap index function writeLine { enter; ldb #$7e pha; phx; pla; plx ora #$2000 loop: { sta.w tilemap+$00,y; inc #2 iny #2; dex; bne loop } leave; rtl } macro write(define index) { enter; ldb #$00 vwait() lda.w #ending.block{index} >> 0; sta $4302 lda.w #ending.block{index} >> 8; sta $4303 lda.w #ending.block{index}.size; sta $4305 lda.w #$6090 >> 1; sta $2116; sep #$20 lda #$80; sta $2115 lda #$01; sta $4300 lda #$18; sta $4301 lda #$01; sta $420b leave } macro write(variable vramIndex, variable mapIndex) { lda.w #28 ldx.w #vramIndex*28*2+9 ldy.w #mapIndex*64+$04 jsl writeLine ldy.w #mapIndex*64+$44; inx jsl writeLine } //Presented By Square function a711 { write(0) write(0,12) write(1,14) rtl } //Project Leader function a746 { write(1) write(0, 2) write(1, 4) rtl } //Director + Story Event Producer function a793 { write(2) write(0, 2) write(1, 4) write(2, 7) write(3, 9) rtl } //Main Programmers function a7d1 { write(3) write(0, 2) write(1, 4) write(2, 6) write(3, 8) rtl } //Story Event Planner + Simulation Planner + Field Planner function a82f { write(4) write(0, 2) write(1, 4) write(2, 7) write(3, 9) write(4,12) write(5,14) rtl } //Special Effects Programmer + Special Effects Graphic Designer function a976 { write(5) write(0, 2) write(1, 4) write(2, 7) write(3, 9) rtl } //Assistant Director + Event Planner function a927 { write(6) write(0, 2) write(1, 4) write(2, 7) write(3, 9) rtl } //Music Composer + Sound Engineer + Sound Programmer function a8a5 { write(7) write(0, 2) write(1, 4) write(2, 7) write(3, 9) write(4,12) write(5,14) rtl } //Character Graphic Designers + Monster Graphic Designer function a9d6 { write(8) write(0, 2) write(1, 4) write(2, 6) write(3, 9) write(4,11) rtl } //Event Background Graphic Designer + Field Graphic Designers function aa3d { write(9) write(0, 2) write(1, 4) write(2, 7) write(3, 9) write(4,11) rtl } //Special Thanks function aa9e { write(a) write(0, 2) write(1, 4) write(2, 6) write(3, 8) write(4,10) write(5,12) rtl } //Special Thanks function aae8 { write(b) write(0, 2) write(1, 4) write(2, 6) write(3, 8) write(4,10) write(5,12) write(6,14) rtl } //Supervisor function ab5d { write(c) write(0,12) write(1,14) rtl } //Executive Producer function ab7b { write(d) write(0,12) write(1,14) rtl } } namespace endingGraphic { enqueue pc seek($d5f159); jsl hook; nop dequeue pc //the original "The End" graphic was comprised of only 4 sprite list entries. //the new graphic needs 24 sprite list entries, but there is no space for it. //so the original graphic is disabled, and the OAM WRAM table is manually set up. //------ //d5f159 lda #$01 ;#$01 = enable; #$00 = disable //d5f15b sta $0720 ;enable drawing sprite 2 ("The End" graphic) //------ function hook { //disable the original graphic OAM transfer request. //as this was the only sprite onscreen, this disables all OAM WRAM table writes. stz $0720 enter; ldb #$7e //clear the entire OAM WRAM table lda #$e000; ldx.w #0 -;sta $6ca0,x; stz $6ca2,x; inx #4; cpx #$0200; bcc - //clear lower table -;stz $6ca0,x; stz $6ca2,x; inx #4; cpx #$0220; bcc - //clear upper table //transfer 8x3 sprites to OAM WRAM table macro line(variable line) { macro item(variable item) { variable x = $40 + item * 16 //centered horizontally variable y = $58 + line * 16 //centered vertically variable tile = line * 32 + item * 2 variable slot = line * 8 + item * 1 lda.w #x<<0|y<<8; sta.w $6ca0+slot*4 lda.w #$3100|tile; sta.w $6ca2+slot*4 } item(0); item(1); item(2); item(3); item(4); item(5); item(6); item(7) } line(0); line(1); line(2) leave; rtl } } codeCursor = pc() }
22.720117
86
0.580008
294ec87a19b38b0cc8aa43dd3edaaaf13293e69a
5,977
asm
Assembly
HW2-MIPS Assembly Language/source/hw2.asm
akifkartal03/CSE331-Computer-Organization
378ef3c754a5886dc27694a2bf931c341baad586
[ "MIT" ]
1
2022-03-19T23:17:33.000Z
2022-03-19T23:17:33.000Z
HW2-MIPS Assembly Language/source/hw2.asm
akifkartal03/CSE331-Computer-Organization
378ef3c754a5886dc27694a2bf931c341baad586
[ "MIT" ]
null
null
null
HW2-MIPS Assembly Language/source/hw2.asm
akifkartal03/CSE331-Computer-Organization
378ef3c754a5886dc27694a2bf931c341baad586
[ "MIT" ]
null
null
null
.data #int arr[MAX_SIZE]; arr: .space 400 # MAX_SIZE is 100, it can be modified.(400=100*4). subset: .space 400 #for bonus part pos: .asciiz "Possible!" notPos: .asciiz "Not possible!" msg1: .asciiz "Enter size of Array:" msg2: .asciiz "Enter target sum number:" msg3: .asciiz "Enter array elements one by one\n" opPar: .asciiz "( " clsPar: .asciiz ")" space: .asciiz " " newLine: .asciiz "\n" # don't use memory for other variables for better performance. # I will use registers to store and retrieve the other variables. .text main: #int arraySize ==> t0 register #int num ==> t1 register #int returnVal ==> t3 register. #cin >> arraySize; li $v0, 4 la $a0, msg1 syscall li $v0, 5 syscall move $t0, $v0 sll $t0, $t0, 2 # multiply arraySize with 4 to traverse array in misp #cin >> num; li $v0, 4 la $a0, msg2 syscall li $v0, 5 syscall move $t1, $v0 #for(int i = 0; i < arraySize; ++i) { cin >> arr[i];} li $v0, 4 la $a0, msg3 syscall addi $s0, $zero, 0 # int i = 0 Loop: beq $s0, $t0, AfterLoop # i < arraySize li $v0, 5 syscall move $t2, $v0 sw $t2, arr($s0) # cin >> arr[i] addi $s0, $s0, 4 # ++i j Loop AfterLoop: #adjust the arguments move $a0,$t1 # a0 is num move $a2, $t0 # a2 is arraySize #arr is global in misp # returnVal = CheckSumPossibility(num, arr, arraySize); jal CheckSumPossibility move $t3,$v0 # if(returnVal == 1){ cout << "Possible!" << endl;} beq $t3,1 Possible # else{cout << "Not possible!" << endl;} li $v0, 4 la $a0, notPos syscall # exit the program(return 0) li $v0,10 syscall # write possible with subset Possible: #cout << "Possible!" li $v0, 4 la $a0, pos syscall #cout << " "; li $v0,4 la $a0,space syscall # cout << "("; li $v0,4 la $a0,opPar syscall addi $t7, $zero, 0 # int i = 0 Loop4: beq $t7, $a3, AfterLoop4 # i < size lw $t2, subset($t7) li $v0,1 #cout << arr[i]; move $a0,$t2 syscall li $v0,4 la $a0,space #cout << " "; syscall addi $t7, $t7, 4 # i++ j Loop4 AfterLoop4: # cout << ")" ; li $v0,4 la $a0,clsPar syscall # cout << endl; li $v0,4 la $a0,newLine syscall # exit the program(return 0) li $v0,10 syscall CheckSumPossibility: #save return adress addi $sp, $sp, -4 sw $ra,0($sp) # int total_sum = 0, current_sum = 0, index = 0, res = 0 k = 0; li $a1,0 # k (subset index) # since we already run out of argument registers we have to use temp register for arguments li $t4,0 # total_sum li $t5,0 # current_sum li $t6,0 # index li $v1,0 # res # Calculate total sum of given array # for(int i = 0; i < size; ++i) { total_sum += arr[i];} addi $t7, $zero, 0 # int i = 0 Loop2: beq $t7, $a2, AfterLoop2 # i < size lw $t2, arr($t7) add $t4, $t4, $t2 #total_sum += arr[i] addi $t7, $t7, 4 # i++ j Loop2 AfterLoop2: #if (num <= 0) bgt $a0,$zero,secondIf return0: #return 0; move $v0,$v1 #return res with v0 register lw $ra , 0($sp) addi $sp, $sp, 4 jr $ra secondIf: # if (total_sum < num) bge $t4,$a0,thirdIf j return0 thirdIf: # if (total_sum == num) bne $t4,$a0,checkWithBacktracking j return1 checkWithBacktracking: # call recursive function jal CheckSumPossibilityHelper # return res; move $v0,$v1 #return res with v0 register lw $ra , 0($sp) addi $sp, $sp, 4 jr $ra return1: # copy orijinal array as subset addi $t7, $zero, 0 # int i = 0 Loop3: beq $t7, $a2, AfterLoop3 # i < size lw $t2, arr($t7) sw $t2, subset($t7) # subset[i] = arr[i] addi $t7, $t7, 4 # i++ j Loop3 AfterLoop3: # return 1; li $v1,1 # res move $v0,$v1 #return res with v0 register move $a3,$a2 # k = size lw $ra , 0($sp) addi $sp, $sp, 4 jr $ra CheckSumPossibilityHelper: # parameters and registers as in contract. # num = a0 # total_sum = t4 # k = a1 # current_sum = t5 = 0 # size = a2 # index = t6 = 0 # res = v1 # t0,t1,t2,t3,t7 are free to use. # arr = arr # subset = subset = empty #save imptortant parameters in stack addi $sp, $sp, -20 sw $ra, 0($sp) # return adress sw $t4, 4($sp) # total_sum sw $t5, 8($sp) # current_sum sw $t6, 12($sp) # index sw $a1, 16($sp) # k (subset index) #if (current_sum == num) bne $t5,$a0,checkSum #return 1; move $a3,$a1 li $v1,1 j return checkSum: # if (current_sum == 0) bne $t4,$zero,secondBase # k = 0; li $a1,0 secondBase: # if (index >= size) blt $t6,$a2,recurPart # return; j return # else recurPart: # if (current_sum + arr[index] <= num && res == 0) lw $t7, arr($t6) # arr[index] add $t2, $t5,$t7 bgt $t2,$a0,secondCheck # res == 0 bne $v1,$zero,secondCheck # subset[k] = arr[index]; # k = k + 1; sw $t7, subset($a1) addi $a1, $a1, 4 # k++ #total_sum - arr[index] sub $t4,$t4,$t7 #current_sum + arr[index] add $t5,$t5,$t7 # index + 1 addi $t6,$t6,4 # CheckSumPossibilityHelper(num, arr, size, total_sum - arr[index], current_sum + arr[index], index + 1, res); jal ,CheckSumPossibilityHelper # restore parameters in stack for other calls lw $a1, 16($sp) lw $t6, 12($sp) lw $t5, 8($sp) lw $t4, 4($sp) lw $ra , 0($sp) secondCheck: # if (current_sum + total_sum - arr[index] >= num && res == 0) lw $t7, arr($t6) add $t2, $t5,$t4 sub $t1, $t2,$t7 blt $t1, $a0,return # res == 0 bne $v1,$zero,return lw $t7, arr($t6) #arr[index] #total_sum - arr[index] sub $t4,$t4,$t7 # index + 1 addi $t6,$t6,4 # CheckSumPossibilityHelper(num, arr, size, total_sum - arr[index], current_sum, index + 1, res); jal ,CheckSumPossibilityHelper return: #return; # restore parameters in stack for other calls lw $a1, 16($sp) lw $t6, 12($sp) lw $t5, 8($sp) lw $t4, 4($sp) lw $ra , 0($sp) addi $sp, $sp, 20 jr $ra
22.554717
113
0.57922
ef955ecfef3322e2e606a94f3d55b4d5eb74c55d
386
asm
Assembly
programs/oeis/160/A160928.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/160/A160928.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/160/A160928.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A160928: a(n) = n - reversal(n-1) ; 1,1,1,1,1,1,1,1,1,1,10,1,-8,-17,-26,-35,-44,-53,-62,-71,19,10,1,-8,-17,-26,-35,-44,-53,-62,28,19,10,1,-8,-17,-26,-35,-44,-53,37,28,19,10,1,-8,-17,-26,-35,-44,46,37,28,19,10,1,-8,-17,-26,-35,55,46,37,28,19,10,1,-8 lpb $0 mov $2,$0 div $0,10 mod $2,10 mov $3,$2 mov $2,$0 mov $0,9 sub $1,$3 add $1,$2 lpe mul $1,9 add $1,1 mov $0,$1
22.705882
214
0.512953
edf7691d751067f687c50d36fa77392313629cd5
9,894
asm
Assembly
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_1693.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_1693.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_1693.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 %r8 push %r9 push %rax push %rbp push %rcx push %rdi push %rsi lea addresses_UC_ht+0x14dad, %r9 nop add %rbp, %rbp mov $0x6162636465666768, %r11 movq %r11, %xmm5 movups %xmm5, (%r9) nop and %rax, %rax lea addresses_UC_ht+0x11707, %rsi lea addresses_A_ht+0x2607, %rdi nop cmp %r8, %r8 mov $31, %rcx rep movsq cmp %r8, %r8 lea addresses_WT_ht+0xe207, %rax nop nop nop sub %r9, %r9 movups (%rax), %xmm5 vpextrq $0, %xmm5, %rcx nop nop nop nop xor $19250, %rax lea addresses_normal_ht+0x10d77, %rcx sub $57415, %r8 mov $0x6162636465666768, %rsi movq %rsi, %xmm0 movups %xmm0, (%rcx) nop nop nop inc %rbp lea addresses_normal_ht+0x1e07, %rsi lea addresses_WT_ht+0x1c207, %rdi xor $44853, %r9 mov $78, %rcx rep movsw sub %r11, %r11 lea addresses_WT_ht+0x1a5c, %r9 nop nop and $1621, %rdi mov (%r9), %ax nop nop nop nop nop xor %rbp, %rbp lea addresses_UC_ht+0xe807, %rbp nop add %rdi, %rdi movb (%rbp), %al nop nop xor %rsi, %rsi lea addresses_D_ht+0x13a07, %rdi clflush (%rdi) nop nop nop nop nop xor %rsi, %rsi mov $0x6162636465666768, %r11 movq %r11, %xmm4 movups %xmm4, (%rdi) nop nop sub %r9, %r9 lea addresses_normal_ht+0x176b7, %rcx nop nop nop nop and %r8, %r8 mov (%rcx), %bp nop nop lfence lea addresses_WC_ht+0x7207, %r8 nop nop nop nop and $42894, %rbp mov $0x6162636465666768, %rcx movq %rcx, (%r8) nop nop cmp $16687, %rcx lea addresses_normal_ht+0x367, %rsi lea addresses_A_ht+0x2e07, %rdi nop xor $22821, %r8 mov $85, %rcx rep movsw nop nop nop nop and $15013, %r9 lea addresses_D_ht+0x6d07, %rax nop nop nop nop and $50168, %rbp mov $0x6162636465666768, %rsi movq %rsi, %xmm1 movups %xmm1, (%rax) nop inc %rbp lea addresses_UC_ht+0x4e07, %r8 nop nop nop nop nop and $55281, %rbp vmovups (%r8), %ymm6 vextracti128 $0, %ymm6, %xmm6 vpextrq $1, %xmm6, %rsi cmp %r8, %r8 lea addresses_normal_ht+0x7e07, %rsi nop nop nop nop nop and %rdi, %rdi movups (%rsi), %xmm0 vpextrq $1, %xmm0, %r11 nop nop nop cmp $2100, %r11 pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r9 pop %r8 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r9 push %rbx push %rcx push %rdi push %rdx push %rsi // Store lea addresses_UC+0x1ae07, %r9 nop nop nop nop nop mfence mov $0x5152535455565758, %rsi movq %rsi, %xmm7 movups %xmm7, (%r9) nop nop nop and $38145, %r9 // Load lea addresses_RW+0x1bf0f, %rdx clflush (%rdx) nop nop nop nop nop inc %r9 mov (%rdx), %edi nop nop nop nop nop and $20993, %rdi // Store lea addresses_D+0xee0d, %rcx nop nop nop sub %rbx, %rbx movb $0x51, (%rcx) nop nop nop nop nop inc %r10 // REPMOV lea addresses_A+0x4a07, %rsi lea addresses_D+0xe007, %rdi nop nop nop nop and %r12, %r12 mov $24, %rcx rep movsb nop add %rdx, %rdx // Store lea addresses_normal+0x547, %rdx nop dec %rbx movw $0x5152, (%rdx) nop sub %r9, %r9 // Store lea addresses_D+0xe7, %rdx nop nop nop nop nop cmp $20678, %rbx movb $0x51, (%rdx) nop nop nop nop inc %r12 // Store lea addresses_PSE+0x43d6, %r12 nop nop nop nop sub %r10, %r10 mov $0x5152535455565758, %rsi movq %rsi, %xmm4 vmovups %ymm4, (%r12) nop nop nop add %rbx, %rbx // Store lea addresses_PSE+0x6b27, %r10 nop nop nop xor %rsi, %rsi movb $0x51, (%r10) nop nop nop add $48574, %rdi // Load lea addresses_D+0x1fe07, %rcx nop nop nop nop nop and $5819, %rdx mov (%rcx), %rsi nop nop nop nop nop add $38121, %rbx // Faulty Load lea addresses_UC+0xd607, %r12 nop nop nop nop nop add %rdi, %rdi mov (%r12), %rbx lea oracles, %r9 and $0xff, %rbx shlq $12, %rbx mov (%r9,%rbx,1), %rbx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r9 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 11}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 3}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_A'}, 'dst': {'same': True, 'congruent': 9, 'type': 'addresses_D'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 6}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 5}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 4}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D', 'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 10}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 1}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_A_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 10}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 2}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}, 'dst': {'same': True, 'congruent': 5, 'type': 'addresses_WT_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 0}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 9}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 9}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 4}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 9}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_A_ht'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 4}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 10}} {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 11}} {'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 */
27.870423
2,999
0.651405
47170747d936f09a037227b9ab9eff6961211600
175
asm
Assembly
data/pokemon/dex_entries/snubbull.asm
AtmaBuster/pokeplat-gen2
fa83b2e75575949b8f72cb2c48f7a1042e97f70f
[ "blessing" ]
6
2021-06-19T06:41:19.000Z
2022-02-15T17:12:33.000Z
data/pokemon/dex_entries/snubbull.asm
AtmaBuster/pokeplat-gen2-old
01e42c55db5408d72d89133dc84a46c699d849ad
[ "blessing" ]
null
null
null
data/pokemon/dex_entries/snubbull.asm
AtmaBuster/pokeplat-gen2-old
01e42c55db5408d72d89133dc84a46c699d849ad
[ "blessing" ]
3
2021-01-15T18:45:40.000Z
2021-10-16T03:35:27.000Z
db "FAIRY@" ; species name db "In truth, it is a" next "cowardly #MON." next "It growls eagerly" page "in order to hide" next "its fear from its" next "opponent.@"
17.5
27
0.645714
16a34fe87f01c2f0254f412ed6a822a644b72762
719
asm
Assembly
src/mappers/mapper3.asm
DigiDwrf/neon64v2-easybuild
94fa46fbc8ddb2af593cb42162df58f65a03ebc4
[ "0BSD" ]
36
2020-07-08T11:27:17.000Z
2022-03-15T08:38:52.000Z
src/mappers/mapper3.asm
DigiDwrf/neon64v2-easybuild
94fa46fbc8ddb2af593cb42162df58f65a03ebc4
[ "0BSD" ]
19
2020-07-12T23:14:03.000Z
2021-12-14T07:57:40.000Z
src/mappers/mapper3.asm
DigiDwrf/neon64v2-easybuild
94fa46fbc8ddb2af593cb42162df58f65a03ebc4
[ "0BSD" ]
6
2021-07-17T09:57:46.000Z
2022-03-13T07:50:25.000Z
// Mapper 3: CNROM scope Mapper3: { Init: addi sp, 8 sw ra, -8(sp) jal MapPrgRom16_32 nop // 0x8000-0x1'0000 la_gp(t1, Write) lli t2, 0 lli t3, 0x80 - sw t1, cpu_write_map + 0x80 * 4 (t2) addi t3, -1 bnez t3,- addi t2, 4 jal Write_after_shift lli t0, 0 lw ra, -8(sp) jr ra addi sp, -8 Write: // cpu_t0: data // cpu_t1: address (unused) // TODO save the bank for save states sll t0, cpu_t0, chrrom_page_shift Write_after_shift: // 8K bank 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) jr ra sd t0, ppu_map + 6*4 (r0) }
14.673469
38
0.614743
179af08dd003865e67ddf4349628f9c72a7bc0da
1,821
asm
Assembly
Ch15_sub1/02.Kernel64/Source/AssemblyUtility.asm
ybjeon01/my-operating-system-programming-skills
02b233bac30acd6bc530889250fc3cacc861e0f3
[ "MIT" ]
null
null
null
Ch15_sub1/02.Kernel64/Source/AssemblyUtility.asm
ybjeon01/my-operating-system-programming-skills
02b233bac30acd6bc530889250fc3cacc861e0f3
[ "MIT" ]
null
null
null
Ch15_sub1/02.Kernel64/Source/AssemblyUtility.asm
ybjeon01/my-operating-system-programming-skills
02b233bac30acd6bc530889250fc3cacc861e0f3
[ "MIT" ]
null
null
null
[BITS 64] SECTION .text ; I/O port related functions global kInPortByte, kOutPortByte ; GDT, IDT, and TSS related functions global kLoadGDTR, kLoadTR, kLoadIDTR ; interrupt related functions global kEnableInterrupt, kDisableInterrupt, kReadRFLAGS ;; I/O port related functions ; function that reads one byte from port ; this function follows IA-32e mode function convention ; param: ; port address (word): memory address where data is stored ; return: ; a byte value from the port I/O address kInPortByte: push rdx mov rax, 0 ; initialize register to zero mov rdx, rdi ; move first parameter (port addr) to rax in al, dx ; read byte pop rdx ret ; function that writes one byte to port ; this function follows IA-32e mode function convention ; param: ; port address (word): I/O port address to write data ; data (byte): data to write kOutPortByte: push rdx push rax mov rdx, rdi ; move first parameter (port addr) to rdi mov rax, rsi ; move second parameter (data) to rax out dx, al ; write byte pop rax pop rdx ret ;; GDT, IDT, and TSS related functions ; function that loads GDTR address to register ; param: ; qwGDTRAddress: address of GDTR kLoadGDTR: lgdt [rdi] ret ; function that loads TSS descriptor offset to TR register ; param: ; wTSSSegmentOffset: TSS descriptor offset in GDT kLoadTR: ltr di; ret ; function that loads IDTR address to register ; param: ; qwIDTRAddress: address of IDTR kLoadIDTR: lidt [rdi] ret ;; interrupt related functions ; function that activates interrupt kEnableInterrupt: sti ret ; function that deactivates interrupt kDisableInterrupt: cli ret ; function that returns RFLAGS kReadRFLAGS: pushfq ; push RFLAGS to stack pop rax ret
19.580645
60
0.706755
57a11e658677b04c890e8eee4888f9c1eee339b6
184
asm
Assembly
libsrc/_DEVELOPMENT/math/float/math16/lm16/c/sdcc/___uchar2h.asm
ahjelm/z88dk
c4de367f39a76b41f6390ceeab77737e148178fa
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/_DEVELOPMENT/math/float/math16/lm16/c/sdcc/___uchar2h.asm
C-Chads/z88dk
a4141a8e51205c6414b4ae3263b633c4265778e6
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/_DEVELOPMENT/math/float/math16/lm16/c/sdcc/___uchar2h.asm
C-Chads/z88dk
a4141a8e51205c6414b4ae3263b633c4265778e6
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
SECTION code_fp_math16 PUBLIC ___uchar2h PUBLIC _f16_u8 EXTERN cm16_sdcc___uchar2h defc ___uchar2h = cm16_sdcc___uchar2h defc _f16_u8 = cm16_sdcc___uchar2h
16.727273
41
0.75
f78fa76f760bffb4d198383603e662d35797b721
831
asm
Assembly
programs/oeis/241/A241235.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/241/A241235.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/241/A241235.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A241235: a(n) = number of times n appears in A006949. ; 3,3,1,4,1,2,1,5,1,2,1,3,1,2,1,6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,7,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,8,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,9,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,7,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,5,1,2,1,3,1,2,1,4,1,2 mov $3,$0 mov $5,2 lpb $5,1 mov $0,$3 sub $5,1 add $0,$5 sub $0,1 mov $6,2 lpb $0,1 sub $0,1 div $0,2 add $6,2 add $6,$0 lpe mov $2,$5 mov $4,$6 lpb $2,1 mov $1,$4 sub $2,1 lpe lpe lpb $3,1 sub $1,$4 mov $3,0 lpe add $1,1
27.7
501
0.494585
211d06d343853fce7d95f2df4d9bf702334b60a0
255
asm
Assembly
libsrc/_DEVELOPMENT/adt/wa_priority_queue/c/sccz80/wa_priority_queue_capacity.asm
teknoplop/z88dk
bb03fbfd6b2ab0f397a1358559089f9cd3706485
[ "ClArtistic" ]
8
2017-01-18T12:02:17.000Z
2021-06-12T09:40:28.000Z
libsrc/_DEVELOPMENT/adt/wa_priority_queue/c/sccz80/wa_priority_queue_capacity.asm
teknoplop/z88dk
bb03fbfd6b2ab0f397a1358559089f9cd3706485
[ "ClArtistic" ]
1
2017-03-06T07:41:56.000Z
2017-03-06T07:41:56.000Z
libsrc/_DEVELOPMENT/adt/wa_priority_queue/c/sccz80/wa_priority_queue_capacity.asm
teknoplop/z88dk
bb03fbfd6b2ab0f397a1358559089f9cd3706485
[ "ClArtistic" ]
3
2017-03-07T03:19:40.000Z
2021-09-15T17:59:19.000Z
; size_t wa_priority_queue_capacity(wa_priority_queue_t *q) SECTION code_clib SECTION code_adt_wa_priority_queue PUBLIC wa_priority_queue_capacity EXTERN asm_wa_priority_queue_capacity defc wa_priority_queue_capacity = asm_wa_priority_queue_capacity
21.25
64
0.898039
892f1dad4171725b3412dfd776ef98f66994e4da
1,061
asm
Assembly
programs/oeis/048/A048765.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/048/A048765.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/048/A048765.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A048765: Smallest factorial >= n. ; 1,2,6,6,6,6,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720 mov $1,1 lpb $0,1 add $1,1 div $0,$1 lpe fac $1
106.1
971
0.727615
4b7c122f34073a7ab0162597e1d7e314adcba0a7
516
asm
Assembly
oeis/083/A083504.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/083/A083504.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/083/A083504.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A083504: Triangle read by rows: for 1 <= k <= n, T(n, k) is the total perimeter of all squares contained in a square grid with n rows and k columns. ; Submitted by Jon Maiga ; 4,8,24,12,40,80,16,56,120,200,20,72,160,280,420,24,88,200,360,560,784,28,104,240,440,700,1008,1344,32,120,280,520,840,1232,1680,2160,36,136,320,600,980,1456,2016,2640,3300,40,152,360,680,1120,1680,2352,3120 lpb $0 add $1,1 sub $0,$1 lpe mov $2,$1 mov $1,$0 add $1,3 bin $1,$0 mul $2,2 sub $2,$0 add $2,2 mul $2,$1 mov $0,$2 mul $0,2
27.157895
208
0.672481
208aabc15423f8a8b83f154f1ec2331acb534a2a
1,020
asm
Assembly
oeis/054/A054122.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/054/A054122.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/054/A054122.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A054122: T(2n,n), array T as in A054120. ; Submitted by Jon Maiga ; 1,3,18,114,750,5058,34692,240852,1687446,11906610,84490428,602335836,4310670156,30950436468,222844189320,1608369633384,11632913018598,84294762019218,611831430746124,4447397950230540,32371184905812900,235903427053567548,1721017084595790648,12568107181683475224,91865411903864197500,672047085129841986708,4920221640077152454232,36048054914892722170392,264282752352590081673816,1938766727863905265477800,14230953376546971221271312,104514810282715296779621328,767966569518781783218467718 mov $7,$0 mov $9,2 lpb $9 mov $0,$7 mov $1,0 mov $2,0 mov $5,0 sub $9,1 add $0,$9 sub $0,1 mov $3,$0 mov $4,1 lpb $3 mul $1,$3 mul $4,$3 add $1,$4 mul $1,$3 cmp $4,0 add $5,$4 mov $6,$5 cmp $6,0 add $5,$6 div $1,$5 div $1,$5 add $2,$1 mul $1,3 sub $3,1 div $4,$5 lpe mov $0,$2 mul $0,3 add $0,1 mov $10,$9 mul $10,$0 add $8,$10 lpe min $7,1 mul $7,$0 mov $0,$8 sub $0,$7
22.666667
485
0.681373
a594e7c7f6dbfdfeba8c48c4afe7e209923873b0
5,940
asm
Assembly
template.asm
harshboi/Assembly-and-Computer-Architecture
42e00d8b311a00a7765ec9ca211383a1511e2c2d
[ "BSD-3-Clause" ]
null
null
null
template.asm
harshboi/Assembly-and-Computer-Architecture
42e00d8b311a00a7765ec9ca211383a1511e2c2d
[ "BSD-3-Clause" ]
null
null
null
template.asm
harshboi/Assembly-and-Computer-Architecture
42e00d8b311a00a7765ec9ca211383a1511e2c2d
[ "BSD-3-Clause" ]
null
null
null
TITLE Program Template (template.asm) ; Author: Harshvardhan Singh ; Course / Project ID: CS 271 Date: 1/26/2018 ; Description: Program 2 INCLUDE Irvine32.inc ;.386 ;.model flat,stdcall ;.stack 4096 ExitProcess proto,dwExitCode:dword _min EQU 10 _max EQU 200 _lo EQU 100 _hi EQU 999 .data ; declare variables here name WORD DUP(?) _title BYTE "Sorting Random Integers Programmed by Harshvardhan",0 description BYTE "This program generates random numbers in the range [100 .. 999], displays the original list, sorts the list, and calculates the median value. Finally, it displays the list sorted in descending order. ",0 question0 BYTE "How many numbers should be generated? [10 .. 200]: ",0 output0 BYTE "The unsorted random numbers:",0 output1 BYTE "The median is ",0 output2 BYTE "The sorted list is:",0 error BYTE "Out of range. Try again.",0 min DWORD _min max DWORD _max lo DWORD _lo hi DWORD _hi num_gen DWORD ? array DWORD _max DUP(?) j DWORD ? temp DWORD ? temp1 DWORD ? spaces BYTE " ",0 mybytes BYTE 12h,34h,56h,78h b WORD 1234h .code main proc ; write your code here CALL Randomize push OFFSET _title push OFFSET description CALL introduction push OFFSET num_gen CALL getdata push OFFSET array ;0 36 PUSH num_gen ;4 32 PUSH lo ;8 28 PUSH hi ;12 24 16 CALL fillarray ;16 20 push num_gen ;4 as array is still on the stack0 CALL _SORT push num_gen CALL sorted invoke ExitProcess,0 main ENDP ;--------------------------------------------------------------------------------------------------------- ; INTRODUCTION ; Print general information about the program ;--------------------------------------------------------------------------------------------------------- introduction PROC push edx ; Pushes all the flags push ebp mov ebp,esp mov edx, OFFSET _title CALL WriteString CALL CRLF CALL CRLF mov edx, OFFSET description CALL WriteString CALL CRLF CALL CRLF pop ebp pop edx ret 8 introduction ENDP ;--------------------------------------------------------------------------------------------------------- ;GETDATA ; gets the range of numbers ; ALL VALUES POPPED INSIDE + ADDRESS OF NUM_GEN ;--------------------------------------------------------------------------------------------------------- getdata PROC push eax push edx push esp push ebp mov edx, OFFSET question0 CALL WriteString Call ReadInt CALL CRLF mov ebp, [esp+20] mov [ebp], eax validate: cmp eax, min jl error_detected cmp eax, max jg error_detected jmp all_good error_detected: mov edx, OFFSET error CALL WriteString CALL CRLF mov edx, OFFSET question0 CALL WriteString CALL ReadInt mov [ebp],eax jmp validate all_good: pop ebp pop esp pop edx pop eax ret 4 getdata ENDP ;--------------------------------------------------------------------------------------------------------- ;FILLARRAY ;Fills the array with random numbers ;--------------------------------------------------------------------------------------------------------- fillarray PROC push eax ;20 push ecx ;24 push edx ;28 push ebp ;32 mov ebp,esp ; Moves the offset of the stack pointer mov esi,[ebp+32] ; Moves the OFFSET of the arraymov mov ecx,[ebp+28] ; Moves the total number of array elements to be obtained mov temp,ecx mov edx, 0 L1: mov eax,[ebp+20] ; Move the value for max into eax ;mov temp,eax sub eax,[ebp+24] ; subtract low from eax (high) ;mov temp,eax inc eax ; Increment for the random range function to stop at the previous value CALL RandomRange add eax, [ebp+24] ; Gets a value in the range 100, 999 mov [esi+edx],eax mov eax,[esi+edx] mov temp,eax add edx,4 loop L1 pop ebp pop edx pop ecx pop eax ret 12 ; Will not pop the array fillarray ENDP ;--------------------------------------------------------------------------------------------------------- ; Sort ; Will sort the array ;--------------------------------------------------------------------------------------------------------- _SORT PROC push ebp push eax push ecx mov ebp, esp mov ecx, [ebp+16] ; ecx = num_gen upper_loop: mov edi, [ebp+20] ;array's current element mov eax, ecx lower_loop: mov edx, [edi] mov ebx, [edi+4] cmp ebx, edx jle next_iteration ; Performs the comparison mov [edi], ebx ; Will switch the numbers mov [edi+4], edx next_iteration: add edi, 4 loop lower_loop mov ecx, eax loop upper_loop pop ecx pop eax pop ebp ret 4 _SORT ENDP ;--------------------------------------------------------------------------------------------------------- ; Sorted ; Prints the sorted array ;--------------------------------------------------------------------------------------------------------- SORTED PROC mov edx, OFFSET output0 CALL WriteString CALL CRLF mov ebp,esp mov ecx,[ebp+4] mov edi,[ebp+8] mov eax,0 mov ebx,0 mov edx,0 mov esi,0 L1: mov eax,[edi+4*ebx] cmp edx,10 jge _placeholder _back: CALL WriteDec mov esi,edx mov edx, OFFSET spaces CALL WriteString mov edx,esi mov esi,0 inc edx add ebx,1 loop L1 JMP EXITt _placeholder: CALL CRLF mov edx,0 jmp _back exitt: ret 8 SORTED ENDP end main
20.989399
224
0.497643
166a473dac42dc20eaffa33f1e3b669d2c92891d
938
asm
Assembly
programs/oeis/100/A100661.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/100/A100661.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/100/A100661.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A100661: Quet transform of A006519 (see A101387 for definition). Also, least k such that n+k has at most k ones in its binary representation. ; 1,2,1,2,3,2,1,2,3,2,3,4,3,2,1,2,3,2,3,4,3,2,3,4,3,4,5,4,3,2,1,2,3,2,3,4,3,2,3,4,3,4,5,4,3,2,3,4,3,4,5,4,3,4,5,4,5,6,5,4,3,2,1,2,3,2,3,4,3,2,3,4,3,4,5,4,3,2,3,4,3,4,5,4,3,4,5,4,5,6,5,4,3,2,3,4,3,4,5,4,3,4,5,4,5,6,5,4,3,4,5,4,5,6,5,4,5,6,5,6,7,6,5,4,3,2,1,2,3,2,3,4,3,2,3,4,3,4,5,4,3,2,3,4,3,4,5,4,3,4,5,4,5,6,5,4,3,2,3,4,3,4,5,4,3,4,5,4,5,6,5,4,3,4,5,4,5,6,5,4,5,6,5,6,7,6,5,4,3,2,3,4,3,4,5,4,3,4,5,4,5,6,5,4,3,4,5,4,5,6,5,4,5,6,5,6,7,6,5,4,3,4,5,4,5,6,5,4,5,6,5,6,7,6,5,4,5,6,5,6,7,6,5,6,7,6,7,8,7,6 mov $3,2 mov $5,$0 lpb $3,1 mov $0,$5 sub $3,1 add $0,$3 cal $0,87805 ; Partial sums of b(k) where {b(k)}_{k>=0} = limit n ->infty {A080578(k)-2k : k=2^n,2^n+1,2^n+2,......}. 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
42.636364
501
0.537313
e839353c9220752c3e1e1f0ea21ed6075c0a44df
306
asm
Assembly
programs/oeis/122/A122606.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/122/A122606.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/122/A122606.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A122606: n^(n+1) mod 7. ; 0,1,1,4,2,1,6,0,1,2,5,1,5,1,0,1,4,1,4,4,6,0,1,1,3,2,6,1,0,1,2,2,1,2,6,0,1,4,6,4,3,1,0,1,1,4,2,1,6,0,1,2,5,1,5,1,0,1,4,1,4,4,6,0,1,1,3,2,6,1,0,1,2,2,1,2,6,0,1,4,6,4,3,1,0,1,1,4,2,1,6,0,1,2,5,1,5,1,0,1,4,1,4,4,6 mov $1,$0 mov $2,$0 lpb $0,1 sub $0,1 mul $1,$2 mod $1,7 lpe
27.818182
211
0.496732
2d304b32ebcfd3cb277d5a2f6b18f3da5541508f
6,476
asm
Assembly
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1782.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_1782.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_1782.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 %r9 push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0x2a05, %rsi lea addresses_WC_ht+0x2285, %rdi nop nop nop nop nop and $10782, %r9 mov $7, %rcx rep movsq nop nop nop nop sub %r11, %r11 lea addresses_WC_ht+0x13c85, %rdx clflush (%rdx) xor %r13, %r13 movups (%rdx), %xmm0 vpextrq $1, %xmm0, %r11 dec %r9 lea addresses_normal_ht+0x189dd, %rdx nop nop nop nop and %r11, %r11 movups (%rdx), %xmm2 vpextrq $0, %xmm2, %rdi nop nop nop cmp $59035, %r9 lea addresses_WC_ht+0xe29d, %rdx dec %rcx mov $0x6162636465666768, %r11 movq %r11, %xmm5 and $0xffffffffffffffc0, %rdx vmovaps %ymm5, (%rdx) nop sub $5331, %r13 lea addresses_WT_ht+0x1e291, %r9 and $20103, %rdx movw $0x6162, (%r9) nop nop nop nop nop sub $36970, %rcx lea addresses_WC_ht+0x1ae05, %r9 clflush (%r9) nop nop and $12388, %rdx mov $0x6162636465666768, %r13 movq %r13, %xmm3 vmovups %ymm3, (%r9) xor %rcx, %rcx lea addresses_D_ht+0x1035d, %r11 nop nop nop nop nop and $28964, %rdi mov $0x6162636465666768, %rdx movq %rdx, %xmm5 and $0xffffffffffffffc0, %r11 movntdq %xmm5, (%r11) nop xor %r13, %r13 lea addresses_A_ht+0x19efd, %r13 nop xor $26505, %rsi mov (%r13), %di sub $2059, %rsi lea addresses_WT_ht+0x1ca07, %r11 nop cmp %rsi, %rsi mov (%r11), %r13d nop nop nop nop dec %rcx lea addresses_WT_ht+0x1685, %rdi nop nop nop nop nop sub %r13, %r13 mov $0x6162636465666768, %r11 movq %r11, %xmm5 and $0xffffffffffffffc0, %rdi movaps %xmm5, (%rdi) nop nop nop nop dec %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %r9 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %r9 push %rcx push %rsi // Faulty Load lea addresses_PSE+0x1de85, %r10 nop and %r9, %r9 movb (%r10), %r14b lea oracles, %rcx and $0xff, %r14 shlq $12, %r14 mov (%rcx,%r14,1), %r14 pop %rsi pop %rcx pop %r9 pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': True, 'type': 'addresses_PSE'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 7, 'same': True, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'} {'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 9, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 3, 'same': True, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 2, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 2, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 7, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'} {'dst': {'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 2, 'same': True, 'type': 'addresses_D_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 3, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 11, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
39.248485
2,999
0.659049
d7570dd3ad59e2f40ed689bd6e53f821eeb4760e
449
asm
Assembly
programs/oeis/057/A057040.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/057/A057040.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/057/A057040.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A057040: Let R(i,j) be the rectangle with antidiagonals 1; 2,3; 4,5,6; ...; each k is an R(i(k),j(k)) and A057040(n)=i(F(n)), where F(n) is the n-th Fibonacci number. ; 1,1,1,2,2,2,3,6,6,10,11,8,2,26,15,41,1,28,86,95,68,133,216,8,334,115,167,605,638,635,649,1568,1393,2511,1805,5436,3092,2108,4105,10490,5638,10918,5147,26402 seq $0,71 ; a(n) = Fibonacci(n) - 1. seq $0,25675 ; Exponent of 8 (value of j) in n-th number of form 7^i*8^j. add $0,1
64.142857
168
0.654788
ee3c7abaaaebb64988c87519678fe9db3b5f8d44
286
asm
Assembly
programs/oeis/040/A040601.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/040/A040601.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/040/A040601.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A040601: Continued fraction for sqrt(627). ; 25,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50,25,50 pow $1,$0 sub $1,2 gcd $1,$0 mul $1,25 mov $0,$1
31.777778
190
0.65035
2ffb76587ada527a0a17a0fa562fdd8367710b21
620
asm
Assembly
programs/oeis/084/A084626.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/084/A084626.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/084/A084626.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A084626: Floor(C(n+6,6)/C(n+2,2)). ; 1,2,4,8,14,22,33,47,66,91,121,158,204,258,323,399,487,590,708,843,996,1170,1365,1583,1827,2097,2397,2728,3091,3490,3927,4403,4921,5483,6092,6751,7462,8227,9050,9933,10879,11891,12972,14125,15353,16660,18048,19521,21083,22737,24486,26334,28284,30341,32509,34790,37189,39711,42358,45136,48048,51098,54292,57633,61126,64775,68586,72562,76708,81030,85531,90218,95095,100166,105438,110916,116604,122508,128633,134985,141570,148393,155459,162775,170346,178178,186277,194649,203300,212236,221464,230989,240818,250958,261415,272195,283305,294751,306541,318682 add $0,6 bin $0,4 div $0,15
88.571429
553
0.787097
af7b6b3898c730d7d3cea75eb8c901b52a2d5fb7
108
asm
Assembly
installer/binary.asm
speccytools/spectranet-index-module
d23b03c3b11ce4fb07129392ff5a16b4651e69ca
[ "MIT" ]
null
null
null
installer/binary.asm
speccytools/spectranet-index-module
d23b03c3b11ce4fb07129392ff5a16b4651e69ca
[ "MIT" ]
null
null
null
installer/binary.asm
speccytools/spectranet-index-module
d23b03c3b11ce4fb07129392ff5a16b4651e69ca
[ "MIT" ]
null
null
null
global module_binary global module_binary_size module_binary: binary "../build/spectranet-index__.bin"
18
44
0.805556
650e7fb9175fb48b49542e7d1d0281cde94f0e5a
1,963
asm
Assembly
unittests/ASM/H0F3A/0_66_21.asm
cobalt2727/FEX
13087f8425aeaad28dc81bed46a83e1d72ff0db8
[ "MIT" ]
628
2020-03-06T14:01:32.000Z
2022-03-31T06:35:14.000Z
unittests/ASM/H0F3A/0_66_21.asm
cobalt2727/FEX
13087f8425aeaad28dc81bed46a83e1d72ff0db8
[ "MIT" ]
576
2020-03-06T08:25:12.000Z
2022-03-30T04:05:29.000Z
unittests/ASM/H0F3A/0_66_21.asm
cobalt2727/FEX
13087f8425aeaad28dc81bed46a83e1d72ff0db8
[ "MIT" ]
38
2020-03-07T06:10:00.000Z
2022-03-29T09:27:36.000Z
%ifdef CONFIG { "RegData": { "XMM0": ["0x4142434465666768", "0x5152535455565758"], "XMM1": ["0x4142434461626364", "0x5152535455565758"], "XMM2": ["0x7576777845464748", "0x5152535455565758"], "XMM3": ["0x4142434445464748", "0x5152535471727374"], "XMM4": ["0x4142434445464748", "0x7576777855565758"], "XMM5": ["0x4142434445464748", "0x5152535475767778"], "XMM6": ["0x7576777845464748", "0x5152535455565758"], "XMM7": ["0x4142434475767778", "0x5152535455565758"], "XMM8": ["0x0000000065666768", "0x5152535455565758"], "XMM9": ["0x0000000061626364", "0x5152535455565758"], "XMM10": ["0x0000000000000000", "0x0000000000000000"] } } %endif mov rdx, 0xe0000000 mov rax, 0x4142434445464748 mov [rdx + 8 * 0], rax mov rax, 0x5152535455565758 mov [rdx + 8 * 1], rax mov rax, 0x6162636465666768 mov [rdx + 8 * 2], rax mov rax, 0x7172737475767778 mov [rdx + 8 * 3], rax movapd xmm0, [rdx] movapd xmm1, [rdx] movapd xmm2, [rdx] movapd xmm3, [rdx] movapd xmm4, [rdx] movapd xmm5, [rdx] movapd xmm6, [rdx] movapd xmm7, [rdx] movapd xmm8, [rdx] movapd xmm9, [rdx] movapd xmm10, [rdx] movapd xmm15, [rdx + 8 * 2] ; Simple move Reg<-Reg insertps xmm0, xmm15, ((0b00 << 6) | (0b00 << 4) | (0b0000)) insertps xmm1, xmm15, ((0b01 << 6) | (0b00 << 4) | (0b0000)) insertps xmm2, xmm15, ((0b10 << 6) | (0b01 << 4) | (0b0000)) insertps xmm3, xmm15, ((0b11 << 6) | (0b10 << 4) | (0b0000)) ; Simple move Reg<-Mem insertps xmm4, [rdx + 8 * 3], ((0b00 << 6) | (0b11 << 4) | (0b0000)) insertps xmm5, [rdx + 8 * 3], ((0b01 << 6) | (0b10 << 4) | (0b0000)) insertps xmm6, [rdx + 8 * 3], ((0b10 << 6) | (0b01 << 4) | (0b0000)) insertps xmm7, [rdx + 8 * 3], ((0b11 << 6) | (0b00 << 4) | (0b0000)) ; Simple move Reg<-Reg with mask insertps xmm8, xmm15, ((0b00 << 6) | (0b00 << 4) | (0b0010)) insertps xmm9, xmm15, ((0b01 << 6) | (0b00 << 4) | (0b0010)) ; Full ZMask insertps xmm10, xmm15, ((0b00 << 6) | (0b00 << 4) | (0b1111)) hlt
30.671875
68
0.617422
b649cc58b49a4e7794610bfc7375de45a443a186
471
asm
Assembly
programs/oeis/019/A019429.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/019/A019429.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/019/A019429.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A019429: Continued fraction for tan(1/6). ; 0,5,1,16,1,28,1,40,1,52,1,64,1,76,1,88,1,100,1,112,1,124,1,136,1,148,1,160,1,172,1,184,1,196,1,208,1,220,1,232,1,244,1,256,1,268,1,280,1,292,1,304,1,316,1,328,1,340,1,352,1,364,1,376,1,388,1,400,1,412,1,424,1,436,1,448,1,460,1,472,1,484,1,496,1,508,1,520,1,532,1,544,1,556,1,568,1,580,1,592 seq $0,19428 ; Continued fraction for tan(1/5). sub $0,9 mov $2,8 add $2,$0 add $1,$2 add $2,4 div $2,5 add $1,$2 add $1,1 mov $0,$1
33.642857
292
0.641189
394fcd9ad9fd29cea08bbfe142d2f6b713a1d179
80
asm
Assembly
src/main/fragment/mos6502-common/(_deref_qwuc1)_derefidx_vbuyy=vwum1.asm
jbrandwood/kickc
d4b68806f84f8650d51b0e3ef254e40f38b0ffad
[ "MIT" ]
2
2022-03-01T02:21:14.000Z
2022-03-01T04:33:35.000Z
src/main/fragment/mos6502-common/(_deref_qwuc1)_derefidx_vbuyy=vwum1.asm
jbrandwood/kickc
d4b68806f84f8650d51b0e3ef254e40f38b0ffad
[ "MIT" ]
null
null
null
src/main/fragment/mos6502-common/(_deref_qwuc1)_derefidx_vbuyy=vwum1.asm
jbrandwood/kickc
d4b68806f84f8650d51b0e3ef254e40f38b0ffad
[ "MIT" ]
null
null
null
lda {c1} sta $fe lda {c1}+1 sta $ff lda m1 sta ($fe),y iny lda m1+1 sta ($fe),y
8
11
0.5875
5de6c7faf4fd2389e33ea21e61ae0d064231a5e3
15,555
asm
Assembly
sources/ippcp/asm_ia32/pcpsha512w7as.asm
dongbinghua/ipp-crypto
5f6c4afec3d86f0f586cd9344963111fd5c04213
[ "Apache-2.0" ]
233
2018-07-20T13:17:16.000Z
2022-03-29T03:14:40.000Z
sources/ippcp/asm_ia32/pcpsha512w7as.asm
dongbinghua/ipp-crypto
5f6c4afec3d86f0f586cd9344963111fd5c04213
[ "Apache-2.0" ]
39
2018-10-19T22:46:28.000Z
2022-03-15T07:56:37.000Z
sources/ippcp/asm_ia32/pcpsha512w7as.asm
dongbinghua/ipp-crypto
5f6c4afec3d86f0f586cd9344963111fd5c04213
[ "Apache-2.0" ]
60
2018-07-29T18:21:10.000Z
2022-03-13T02:46:39.000Z
;=============================================================================== ; Copyright 2014-2021 Intel Corporation ; ; Licensed under the Apache License, Version 2.0 (the "License"); ; you may not use this file except in compliance with the License. ; You may obtain a copy of the License at ; ; http://www.apache.org/licenses/LICENSE-2.0 ; ; Unless required by applicable law or agreed to in writing, software ; distributed under the License is distributed on an "AS IS" BASIS, ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ; See the License for the specific language governing permissions and ; limitations under the License. ;=============================================================================== ; ; ; Purpose: Cryptography Primitive. ; Message block processing according to SHA512 ; ; Content: ; UpdateSHA512 ; ; %include "asmdefs.inc" %include "ia_emm.inc" %include "pcpvariant.inc" %if (_ENABLE_ALG_SHA512_) %if (_IPP >= _IPP_W7) && (_IPP < _IPP_G9) ;; ;; ENDIANNESS ;; %if (_IPP >= _IPP_V8) %macro ENDIANNESS 2.nolist %xdefine %%xmm %1 %xdefine %%masks %2 pshufb %%xmm, %%masks %endmacro %else %macro ENDIANNESS 2.nolist %xdefine %%xmm %1 %xdefine %%tmp %2 pshuflw %%xmm,%%xmm, 00011011b pshufhw %%xmm,%%xmm, 00011011b movdqa %%tmp,%%xmm psrlw %%tmp,8 psllw %%xmm,8 por %%xmm,%%tmp %endmacro %endif ;; ;; Rotate Right ;; %macro PRORQ 3.nolist %xdefine %%mm %1 %xdefine %%nbits %2 %xdefine %%tmp %3 movdqa %%tmp,%%mm psrlq %%mm,%%nbits psllq %%tmp,(64-%%nbits) por %%mm,%%tmp %endmacro ;; ;; Init and Update W: ;; ;; j = 0-15 ;; W[j] = ENDIANNESS(src) ;; ;; j = 16-79 ;; W[j] = SIGMA1(W[j- 2]) + W[j- 7] ;; +SIGMA0(W[j-15]) + W[j-16] ;; ;; SIGMA0(x) = ROR64(x,1) ^ROR64(x,8) ^LSR64(x,7) ;; SIGMA1(x) = ROR64(x,19)^ROR64(x,61)^LSR64(x,6) ;; %macro SIGMA0 4.nolist %xdefine %%sigma %1 %xdefine %%x %2 %xdefine %%t1 %3 %xdefine %%t2 %4 movdqa %%sigma, %%x psrlq %%x, 7 movdqa %%t1,%%sigma PRORQ %%sigma, 1, %%t2 pxor %%sigma, %%x PRORQ %%t1,8, %%t2 pxor %%sigma, %%t1 %endmacro %macro SIGMA1 4.nolist %xdefine %%sigma %1 %xdefine %%x %2 %xdefine %%t1 %3 %xdefine %%t2 %4 movdqa %%sigma, %%x psrlq %%x, 6 movdqa %%t1,%%sigma PRORQ %%sigma, 19, %%t2 pxor %%sigma, %%x PRORQ %%t1,61, %%t2 pxor %%sigma, %%t1 %endmacro ;; ;; SHA512 step ;; ;; Ipp64u T1 = H + SUM1(E) + CHJ(E,F,G) + K_SHA512[t] + W[t]; ;; Ipp64u T2 = SUM0(A) + MAJ(A,B,C); ;; D+= T1; ;; H = T1 + T2; ;; ;; where ;; SUM1(x) = ROR64(x,14) ^ ROR64(x,18) ^ ROR64(x,41) ;; SUM0(x) = ROR64(x,28) ^ ROR64(x,34) ^ ROR64(x,39) ;; ;; CHJ(x,y,z) = (x & y) ^ (~x & z) => x&(y^z) ^z ;; MAJ(x,y,z) = (x & y) ^ (x & z) ^ (y & z) = (x&y)^((x^y)&z) ;; ;; Input: ;; A,B,C,D,E,F,G,H - 8 digest's values ;; pW - pointer to the W array ;; pK512 - pointer to the constants ;; pBuffer - temporary buffer ;; Output: ;; A,B,C,D*,E,F,G,H* - 8 digest's values (D and H updated) ;; pW - pointer to the W array ;; pK512 - pointer to the constants ;; pBuffer - temporary buffer (changed) ;; %macro CHJ 5.nolist %xdefine %%R %1 %xdefine %%E %2 %xdefine %%F %3 %xdefine %%G %4 %xdefine %%T %5 movdqa %%R,%%F ; R=f pxor %%R,%%G ; R=(f^g) pand %%R,%%E ; R=e & (f^g) pxor %%R,%%G ; R=e & (f^g) ^g %endmacro %macro MAJ 5.nolist %xdefine %%R %1 %xdefine %%A %2 %xdefine %%B %3 %xdefine %%C %4 %xdefine %%T %5 movdqa %%T,%%B ; T=b movdqa %%R,%%A ; R=a pxor %%T,%%A ; T=a^b pand %%R,%%B ; R=a&b pand %%T,%%C ; T=(a^b)&c pxor %%R,%%T ; R=(a&b)^((a^b)&c) %endmacro %macro SUM0 3.nolist %xdefine %%R %1 %xdefine %%X %2 %xdefine %%tmp %3 movdqa %%R,%%X PRORQ %%R,28,%%tmp ; R=ROR(X,28) PRORQ %%X,34,%%tmp ; X=ROR(X,34) pxor %%R,%%X PRORQ %%X,(39-34),%%tmp ; X=ROR(x,39) pxor %%R,%%X %endmacro %macro SUM1 3.nolist %xdefine %%R %1 %xdefine %%X %2 %xdefine %%tmp %3 movdqa %%R,%%X PRORQ %%R,14,%%tmp ; R=ROR(X,14) PRORQ %%X,18,%%tmp ; X=ROR(X,18) pxor %%R,%%X PRORQ %%X,(41-18),%%tmp ; X=ROR(x,41) pxor %%R,%%X %endmacro %macro SHA512_STEP 11.nolist %xdefine %%A %1 %xdefine %%B %2 %xdefine %%C %3 %xdefine %%D %4 %xdefine %%E %5 %xdefine %%F %6 %xdefine %%G %7 %xdefine %%H %8 %xdefine %%pW %9 %xdefine %%pK512 %10 %xdefine %%pBuffer %11 movdqa oword [%%pBuffer+0*sizeof(oword)],%%E ; save E movdqa oword [%%pBuffer+1*sizeof(oword)],%%A ; save A movdqa oword [%%pBuffer+2*sizeof(oword)],%%D ; save D movdqa oword [%%pBuffer+3*sizeof(oword)],%%H ; save H CHJ %%D,%%E,%%F,%%G, %%H ; t1 = h+CHJ(e,f,g)+pW[]+pK512[] movq %%H, qword [%%pW] paddq %%D, %%H ; +[pW] movq %%H, qword [%%pK512] paddq %%D, %%H ; +[pK512] paddq %%D,oword [%%pBuffer+3*sizeof(oword)] movdqa oword [%%pBuffer+3*sizeof(oword)],%%D ; save t1 MAJ %%H,%%A,%%B,%%C, %%D ; t2 = MAJ(a,b,c) movdqa oword [%%pBuffer+4*sizeof(oword)],%%H ; save t2 SUM1 %%D,%%E,%%H ; D = SUM1(e) paddq %%D,oword [%%pBuffer+3*sizeof(oword)] ; t1 = h+CHJ(e,f,g)+pW[]+pK512[] + SUM1(e) SUM0 %%H,%%A,%%E ; H = SUM0(a) paddq %%H,oword [%%pBuffer+4*sizeof(oword)] ; t2 = MAJ(a,b,c)+SUM0(a) paddq %%H,%%D ; h = t1+t2 paddq %%D,oword [%%pBuffer+2*sizeof(oword)] ; d+= t1 movdqa %%E,oword [%%pBuffer+0*sizeof(oword)] ; restore E movdqa %%A,oword [%%pBuffer+1*sizeof(oword)] ; restore A %endmacro segment .text align=IPP_ALIGN_FACTOR %if (_IPP >= _IPP_V8) align IPP_ALIGN_FACTOR SWP_BYTE: pByteSwp DB 7,6,5,4,3,2,1,0, 15,14,13,12,11,10,9,8 %endif ;******************************************************************************************* ;* Purpose: Update internal digest according to message block ;* ;* void UpdateSHA512(DigestSHA512 digest, const Ipp64u* mblk, int mlen, const void* pParam) ;* ;******************************************************************************************* ;; ;; Lib = W7, V8, P8 ;; ;; Caller = ippsSHA512Update ;; Caller = ippsSHA512Final ;; Caller = ippsSHA512MessageDigest ;; ;; Caller = ippsSHA384Update ;; Caller = ippsSHA384Final ;; Caller = ippsSHA384MessageDigest ;; ;; Caller = ippsHMACSHA512Update ;; Caller = ippsHMACSHA512Final ;; Caller = ippsHMACSHA512MessageDigest ;; ;; Caller = ippsHMACSHA384Update ;; Caller = ippsHMACSHA384Final ;; Caller = ippsHMACSHA384MessageDigest ;; align IPP_ALIGN_FACTOR IPPASM UpdateSHA512,PUBLIC USES_GPR esi,edi %xdefine digest [esp + ARG_1 + 0*sizeof(dword)] ; digest address %xdefine mblk [esp + ARG_1 + 1*sizeof(dword)] ; buffer address %xdefine mlen [esp + ARG_1 + 2*sizeof(dword)] ; buffer length %xdefine pSHA512 [esp + ARG_1 + 3*sizeof(dword)] ; address of SHA constants %xdefine MBS_SHA512 (128) ; SHA512 block data size %assign sSize 5 ; size of save area (oword) %assign dSize 8 ; size of digest (oword) %assign wSize 80 ; W values queue (qword) %assign stackSize (sSize*sizeof(oword)+dSize*sizeof(oword)+wSize*sizeof(qword)+sizeof(dword)) ; stack size (bytes) %assign sOffset 0 ; save area %assign dOffset sOffset+sSize*sizeof(oword) ; digest offset %assign wOffset dOffset+dSize*sizeof(oword) ; W values offset %assign acualOffset wOffset+wSize*sizeof(qword) ; actual stack size offset mov edi,digest ; digest address mov esi,mblk ; source data address mov eax,mlen ; source data length mov edx, pSHA512 ; table constant address sub esp,stackSize ; allocate local buffer (probably unaligned) mov ecx,esp and esp,-16 ; 16-byte aligned stack sub ecx,esp add ecx,stackSize ; acual stack size (bytes) mov [esp+acualOffset],ecx movq xmm0,qword [edi+sizeof(qword)*0] ; A = digest[0] movq xmm1,qword [edi+sizeof(qword)*1] ; B = digest[1] movq xmm2,qword [edi+sizeof(qword)*2] ; C = digest[2] movq xmm3,qword [edi+sizeof(qword)*3] ; D = digest[3] movq xmm4,qword [edi+sizeof(qword)*4] ; E = digest[4] movq xmm5,qword [edi+sizeof(qword)*5] ; F = digest[5] movq xmm6,qword [edi+sizeof(qword)*6] ; G = digest[6] movq xmm7,qword [edi+sizeof(qword)*7] ; H = digest[7] movdqa oword [esp+dOffset+sizeof(oword)*0], xmm0 movdqa oword [esp+dOffset+sizeof(oword)*1], xmm1 movdqa oword [esp+dOffset+sizeof(oword)*2], xmm2 movdqa oword [esp+dOffset+sizeof(oword)*3], xmm3 movdqa oword [esp+dOffset+sizeof(oword)*4], xmm4 movdqa oword [esp+dOffset+sizeof(oword)*5], xmm5 movdqa oword [esp+dOffset+sizeof(oword)*6], xmm6 movdqa oword [esp+dOffset+sizeof(oword)*7], xmm7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; process next data block ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; .sha512_block_loop: ;; ;; initialize the first 16 qwords in the array W (remember about endian) ;; %if (_IPP >= _IPP_V8) ;movdqa xmm1, oword pByteSwp ; load shuffle mask LD_ADDR ecx, SWP_BYTE movdqa xmm1, oword [ecx+(pByteSwp-SWP_BYTE)] %endif mov ecx,0 align IPP_ALIGN_FACTOR .loop1: movdqu xmm0, oword [esi+ecx*sizeof(qword)] ; swap input ENDIANNESS xmm0, xmm1 movdqa oword [esp+wOffset+ecx*sizeof(qword)],xmm0 add ecx,sizeof(oword)/sizeof(qword) cmp ecx,16 jl .loop1 ;; ;; initialize another 80-16 qwords in the array W ;; align IPP_ALIGN_FACTOR .loop2: movdqa xmm1,oword [esp+ecx*sizeof(qword)+wOffset- 2*sizeof(qword)] ; xmm1 = W[j-2] SIGMA1 xmm0,xmm1,xmm2,xmm3 movdqu xmm5,oword [esp+ecx*sizeof(qword)+wOffset-15*sizeof(qword)] ; xmm5 = W[j-15] SIGMA0 xmm4,xmm5,xmm6,xmm3 movdqu xmm7,oword [esp+ecx*sizeof(qword)+wOffset- 7*sizeof(qword)] ; W[j-7] paddq xmm0,xmm4 paddq xmm7,oword [esp+ecx*sizeof(qword)+wOffset-16*sizeof(qword)] ; W[j-16] paddq xmm0,xmm7 movdqa oword [esp+ecx*sizeof(qword)+wOffset],xmm0 add ecx,sizeof(oword)/sizeof(qword) cmp ecx,80 jl .loop2 ;; ;; init A,B,C,D,E,F,G,H by the internal digest ;; movdqa xmm0,oword [esp+dOffset+sizeof(oword)*0] ; A = digest[0] movdqa xmm1,oword [esp+dOffset+sizeof(oword)*1] ; B = digest[1] movdqa xmm2,oword [esp+dOffset+sizeof(oword)*2] ; C = digest[2] movdqa xmm3,oword [esp+dOffset+sizeof(oword)*3] ; D = digest[3] movdqa xmm4,oword [esp+dOffset+sizeof(oword)*4] ; E = digest[4] movdqa xmm5,oword [esp+dOffset+sizeof(oword)*5] ; F = digest[5] movdqa xmm6,oword [esp+dOffset+sizeof(oword)*6] ; G = digest[6] movdqa xmm7,oword [esp+dOffset+sizeof(oword)*7] ; H = digest[7] ;; ;; perform 0-79 steps ;; xor ecx,ecx align IPP_ALIGN_FACTOR .loop3: ;; A, B, C, D, E, F, G, H W[], K[], buffer ;; -------------------------------------------------------------------------------------------------------------------------------------- SHA512_STEP xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7, {esp+ecx*sizeof(qword)+wOffset+sizeof(qword)*0},{edx+ecx*sizeof(qword)+sizeof(qword)*0}, {esp} SHA512_STEP xmm7,xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6, {esp+ecx*sizeof(qword)+wOffset+sizeof(qword)*1},{edx+ecx*sizeof(qword)+sizeof(qword)*1}, {esp} SHA512_STEP xmm6,xmm7,xmm0,xmm1,xmm2,xmm3,xmm4,xmm5, {esp+ecx*sizeof(qword)+wOffset+sizeof(qword)*2},{edx+ecx*sizeof(qword)+sizeof(qword)*2}, {esp} SHA512_STEP xmm5,xmm6,xmm7,xmm0,xmm1,xmm2,xmm3,xmm4, {esp+ecx*sizeof(qword)+wOffset+sizeof(qword)*3},{edx+ecx*sizeof(qword)+sizeof(qword)*3}, {esp} SHA512_STEP xmm4,xmm5,xmm6,xmm7,xmm0,xmm1,xmm2,xmm3, {esp+ecx*sizeof(qword)+wOffset+sizeof(qword)*4},{edx+ecx*sizeof(qword)+sizeof(qword)*4}, {esp} SHA512_STEP xmm3,xmm4,xmm5,xmm6,xmm7,xmm0,xmm1,xmm2, {esp+ecx*sizeof(qword)+wOffset+sizeof(qword)*5},{edx+ecx*sizeof(qword)+sizeof(qword)*5}, {esp} SHA512_STEP xmm2,xmm3,xmm4,xmm5,xmm6,xmm7,xmm0,xmm1, {esp+ecx*sizeof(qword)+wOffset+sizeof(qword)*6},{edx+ecx*sizeof(qword)+sizeof(qword)*6}, {esp} SHA512_STEP xmm1,xmm2,xmm3,xmm4,xmm5,xmm6,xmm7,xmm0, {esp+ecx*sizeof(qword)+wOffset+sizeof(qword)*7},{edx+ecx*sizeof(qword)+sizeof(qword)*7}, {esp} add ecx,8 cmp ecx,80 jl .loop3 ;; ;; update digest ;; paddq xmm0,oword [esp+dOffset+sizeof(oword)*0] ; A += digest[0] paddq xmm1,oword [esp+dOffset+sizeof(oword)*1] ; B += digest[1] paddq xmm2,oword [esp+dOffset+sizeof(oword)*2] ; C += digest[2] paddq xmm3,oword [esp+dOffset+sizeof(oword)*3] ; D += digest[3] paddq xmm4,oword [esp+dOffset+sizeof(oword)*4] ; E += digest[4] paddq xmm5,oword [esp+dOffset+sizeof(oword)*5] ; F += digest[5] paddq xmm6,oword [esp+dOffset+sizeof(oword)*6] ; G += digest[6] paddq xmm7,oword [esp+dOffset+sizeof(oword)*7] ; H += digest[7] movdqa oword [esp+dOffset+sizeof(oword)*0],xmm0 ; digest[0] = A movdqa oword [esp+dOffset+sizeof(oword)*1],xmm1 ; digest[1] = B movdqa oword [esp+dOffset+sizeof(oword)*2],xmm2 ; digest[2] = C movdqa oword [esp+dOffset+sizeof(oword)*3],xmm3 ; digest[3] = D movdqa oword [esp+dOffset+sizeof(oword)*4],xmm4 ; digest[4] = E movdqa oword [esp+dOffset+sizeof(oword)*5],xmm5 ; digest[5] = F movdqa oword [esp+dOffset+sizeof(oword)*6],xmm6 ; digest[6] = G movdqa oword [esp+dOffset+sizeof(oword)*7],xmm7 ; digest[7] = H add esi, MBS_SHA512 sub eax, MBS_SHA512 jg .sha512_block_loop movq qword [edi+sizeof(qword)*0], xmm0 ; A = digest[0] movq qword [edi+sizeof(qword)*1], xmm1 ; B = digest[1] movq qword [edi+sizeof(qword)*2], xmm2 ; C = digest[2] movq qword [edi+sizeof(qword)*3], xmm3 ; D = digest[3] movq qword [edi+sizeof(qword)*4], xmm4 ; E = digest[4] movq qword [edi+sizeof(qword)*5], xmm5 ; F = digest[5] movq qword [edi+sizeof(qword)*6], xmm6 ; G = digest[6] movq qword [edi+sizeof(qword)*7], xmm7 ; H = digest[7] add esp,[esp+acualOffset] REST_GPR ret ENDFUNC UpdateSHA512 %endif ;; (_IPP >= _IPP_W7) && (_IPP < _IPP_G9) %endif ;; _ENABLE_ALG_SHA512_
33.596112
150
0.538541
f297aea75060c561bf6cd90bf1f856f209b04e38
1,181
asm
Assembly
programs/oeis/048/A048514.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/048/A048514.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/048/A048514.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A048514: a(n) = T(0,n)+T(1,n-1)+...+T(n,0), array T given by A048505. ; 1,3,13,54,190,587,1659,4412,11244,27785,67089,159106,371930,859159,1964855,4454968,10025240,22411221,49804909,110097630,242217766,530575683,1157623603,2516577524,5452589700,11777599457 mov $37,$0 mov $39,$0 add $39,1 lpb $39,1 clr $0,37 mov $0,$37 sub $39,1 sub $0,$39 mov $34,$0 mov $36,$0 add $36,1 lpb $36,1 clr $0,34 mov $0,$34 sub $36,1 sub $0,$36 mov $31,$0 mov $33,$0 add $33,1 lpb $33,1 mov $0,$31 sub $33,1 sub $0,$33 mov $27,$0 mov $29,2 lpb $29,1 mov $0,$27 sub $29,1 add $0,$29 sub $0,1 cal $0,84851 ; Binomial transform of binomial(n+2,2). sub $0,1 mov $26,$0 cmp $26,0 add $0,$26 add $0,1 mul $0,2 add $0,2 mov $1,$0 mov $30,$29 lpb $30,1 mov $28,$1 sub $30,1 lpe lpe lpb $27,1 mov $27,0 sub $28,$1 lpe mov $1,$28 sub $1,4 div $1,2 add $32,$1 lpe add $35,$32 lpe add $38,$35 lpe mov $1,$38
18.746032
186
0.475868
17ff4a7f8ce629bc978dfe9dc40674cfccb99c92
590
asm
Assembly
programs/oeis/324/A324772.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/324/A324772.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/324/A324772.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A324772: The "Octanacci" sequence: Trajectory of 0 under the morphism 0->{0,1,0}, 1->{0}. ; 0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0 mov $3,2 mov $5,$0 lpb $3 mov $0,$5 sub $3,1 add $0,$3 sub $0,1 add $6,1 lpb $6 add $0,1 max $0,0 seq $0,49473 ; Nearest integer to n/sqrt(2). sub $6,1 lpe mov $2,$3 mul $2,$0 add $1,$2 mov $4,$0 lpe min $5,1 mul $5,$4 sub $1,$5 add $1,1 mod $1,2 mov $0,$1
20.344828
201
0.520339
4750ab173e1087b316bb623cd1b5a7c14e448171
913
asm
Assembly
data/pokemon/base_stats/gabite.asm
AtmaBuster/pokeplat-gen2
fa83b2e75575949b8f72cb2c48f7a1042e97f70f
[ "blessing" ]
6
2021-06-19T06:41:19.000Z
2022-02-15T17:12:33.000Z
data/pokemon/base_stats/gabite.asm
AtmaBuster/pokeplat-gen2-old
01e42c55db5408d72d89133dc84a46c699d849ad
[ "blessing" ]
null
null
null
data/pokemon/base_stats/gabite.asm
AtmaBuster/pokeplat-gen2-old
01e42c55db5408d72d89133dc84a46c699d849ad
[ "blessing" ]
2
2021-08-11T19:47:07.000Z
2022-01-01T07:07:56.000Z
db 0 ; species ID placeholder db 68, 90, 65, 82, 50, 55 ; hp atk def spd sat sdf db DRAGON, GROUND ; type db 45 ; catch rate db 114 ; base exp db NO_ITEM, BERRY ; items db GENDER_F50 ; gender ratio db 40 ; step cycles to hatch INCBIN "gfx/pokemon/gabite/front.dimensions" db GROWTH_SLOW ; growth rate dn EGG_DRAGON, EGG_MONSTER ; egg groups db 70 ; happiness ; tm/hm learnset tmhm DRAGON_CLAW, ROAR, TOXIC, HIDDEN_POWER, SUNNY_DAY, PROTECT, RAIN_DANCE, FRUSTRATION, IRON_TAIL, EARTHQUAKE, RETURN, DIG, DOUBLE_TEAM, FLAMETHROWER, SANDSTORM, FIRE_BLAST, ROCK_TOMB, AERIAL_ACE, FACADE, SECRET_POWER, REST, ATTRACT, ENDURE, DRAGON_PULSE, SHADOW_CLAW, STONE_EDGE, STEALTH_ROCK, CAPTIVATE, ROCK_SLIDE, SLEEP_TALK, NATURAL_GIFT, SWAGGER, SUBSTITUTE, CUT, STRENGTH, ROCK_SMASH, ROCK_CLIMB, DRACO_METEOR, EARTH_POWER, FURY_CUTTER, IRON_HEAD, MUD_SLAP, OUTRAGE, SNORE, SWIFT, TWISTER ; end
45.65
499
0.751369
84cf35c23e17a19f7e47f0d00c7474c9a38e2b6c
4,108
asm
Assembly
Library/Ruler/rulerTables.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
504
2018-11-18T03:35:53.000Z
2022-03-29T01:02:51.000Z
Library/Ruler/rulerTables.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
96
2018-11-19T21:06:50.000Z
2022-03-06T10:26:48.000Z
Library/Ruler/rulerTables.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
73
2018-11-19T20:46:53.000Z
2022-03-29T00:59:26.000Z
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1991 -- All Rights Reserved PROJECT: PC GEOS MODULE: GeoCalc FILE: rulerTables.asm AUTHOR: Gene Anderson, Jun 18, 1991 ROUTINES: Name ---- pointsScaleTable - 100 points / interval picasScaleTable - 6 picas = 1 inch / interval inchScaleTable - 1 inch / interval metricScaleTable - 1 cm / interval REVISION HISTORY: Name Date Description ---- ---- ----------- Gene 6/18/91 Initial revision DESCRIPTION: $Id: rulerTables.asm,v 1.1 97/04/07 10:42:51 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RulerBasicCode segment resource ;------------------------------------------------------------------------------ ; points ;------------------------------------------------------------------------------ pointsTickTable RulerTick \ <<MIT_POINT MPM_100_POINT>, MAX_TICK_HEIGHT>, <<MIT_POINT MPM_25_POINT>, MAX_TICK_HEIGHT/4>, <<MIT_POINT MPM_50_POINT>, MAX_TICK_HEIGHT/2>, <<MIT_POINT MPM_25_POINT>, MAX_TICK_HEIGHT/4> pointsScaleTable RulerScale <\ < <0,25>, ;size (100 points)/4 100, ;value (100 points) length pointsTickTable, ;# of entries offset pointsTickTable, ;offset of table < <<0x8000,0>, 100, <MIT_POINT MPM_50_POINT>>, ;50%: 50 point incs <<0x4000,0>, 500, <MIT_POINT MPM_100_POINT>>, ;25%: 100 point incs <> >> ;------------------------------------------------------------------------------ ; picas ;------------------------------------------------------------------------------ picasTickTable RulerTick \ <<MIT_PICA MPM_INCH>, MAX_TICK_HEIGHT>, <<MIT_PICA MPM_PICA>, MAX_TICK_HEIGHT/2>, <<MIT_PICA MPM_PICA>, MAX_TICK_HEIGHT/2>, <<MIT_PICA MPM_PICA>, MAX_TICK_HEIGHT/2>, <<MIT_PICA MPM_PICA>, MAX_TICK_HEIGHT/2>, <<MIT_PICA MPM_PICA>, MAX_TICK_HEIGHT/2> picasScaleTable RulerScale <\ < <0,12>, ;size (12 points = 1 pica) 6, ;value (6 picas = 1 inch) length picasTickTable, ;# of entries offset picasTickTable, ;offset of table < <<0x5555,0>, 1, <MIT_PICA MPM_INCH>>, ;33%: 1" incs, 5" labels <>, <> >> ;------------------------------------------------------------------------------ ; inches ;------------------------------------------------------------------------------ inchTickTable RulerTick \ <<MIT_US MUSM_ONE_INCH>, MAX_TICK_HEIGHT>, <<MIT_US MUSM_EIGHTH_INCH>, 1>, <<MIT_US MUSM_QUARTER_INCH>, MAX_TICK_HEIGHT/4+1>, <<MIT_US MUSM_EIGHTH_INCH>, 1>, <<MIT_US MUSM_HALF_INCH>, MAX_TICK_HEIGHT/2+1>, <<MIT_US MUSM_EIGHTH_INCH>, 1>, <<MIT_US MUSM_QUARTER_INCH>, MAX_TICK_HEIGHT/4+1>, <<MIT_US MUSM_EIGHTH_INCH>, 1> inchScaleTable RulerScale <\ < <0,9>, ;size (72 points)/8 1, ;value (1 inch) length inchTickTable, ;# of entries offset inchTickTable, ;offset of table < <<0xc000,0>, 1, <MIT_US MUSM_QUARTER_INCH>>, ;75%: 1/4" incs, 1" lbls <<0x8000,0>, 2, <MIT_US MUSM_HALF_INCH>>, ;50%: 1/2" incs, 2" lbls <<0x5555,0>, 5, <MIT_US MUSM_ONE_INCH>> ;33%: 1" incs, 5" lbls >> ;------------------------------------------------------------------------------ ; metric ;------------------------------------------------------------------------------ metricTickTable RulerTick \ <<MIT_METRIC MMM_CENTIMETER>, MAX_TICK_HEIGHT>, <<MIT_METRIC MMM_MILLIMETER>, 1>, <<MIT_METRIC MMM_MILLIMETER>, 1>, <<MIT_METRIC MMM_MILLIMETER>, 1>, <<MIT_METRIC MMM_MILLIMETER>, 1>, <<MIT_METRIC MMM_HALF_CENTIMETER>, MAX_TICK_HEIGHT/2+1>, <<MIT_METRIC MMM_MILLIMETER>, 1>, <<MIT_METRIC MMM_MILLIMETER>, 1>, <<MIT_METRIC MMM_MILLIMETER>, 1>, <<MIT_METRIC MMM_MILLIMETER>, 1> metricScaleTable RulerScale <\ < <0xd5ab,0x2>, ;size (28.3464576 points)/10 1, ;value (1 centimeter) length metricTickTable, ;# of entries offset metricTickTable, ;offset of table < <<0xe666,0>, 2, <MIT_METRIC MMM_HALF_CENTIMETER>>, ;90%: 5mm incs <<0x8000,0>, 5, <MIT_METRIC MMM_CENTIMETER>>, ;50%: 1cm incs <> >> RulerBasicCode ends
32.603175
80
0.541383
4931796b5c8673789e8e642feab4b5aded8f8149
2,995
asm
Assembly
programs/oeis/024/A024005.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/024/A024005.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/024/A024005.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A024005: a(n) = 1 - n^7. ; 1,0,-127,-2186,-16383,-78124,-279935,-823542,-2097151,-4782968,-9999999,-19487170,-35831807,-62748516,-105413503,-170859374,-268435455,-410338672,-612220031,-893871738,-1279999999,-1801088540,-2494357887,-3404825446,-4586471423,-6103515624,-8031810175,-10460353202,-13492928511,-17249876308,-21869999999,-27512614110,-34359738367,-42618442976,-52523350143,-64339296874,-78364164095,-94931877132,-114415582591,-137231006678,-163839999999,-194754273880,-230539333247,-271818611106,-319277809663,-373669453124,-435817657215,-506623120462,-587068342271,-678223072848,-781249999999,-897410677850,-1028071702527,-1174711139836,-1338925209983,-1522435234374,-1727094849535,-1954897493192,-2207984167551,-2488651484818,-2799359999999,-3142742836020,-3521614606207,-3938980639166,-4398046511103,-4902227890624,-5455160701055,-6060711605322,-6722988818431,-7446353252588,-8235429999999,-9095120158390,-10030613004287,-11047398519096,-12151280273023,-13348388671874,-14645194571775,-16048523266852,-17565568854911,-19203908986158,-20971519999999,-22876792454960,-24928547056767,-27136050989626,-29509034655743,-32057708828124,-34792782221695,-37725479487782,-40867559636991,-44231334895528,-47829689999999,-51676101935730,-55784660123647,-60170087060756,-64847759419263,-69833729609374,-75144747810815,-80798284478112,-86812553324671,-93206534790698,-99999999999999,-107213535210700,-114868566764927,-122987386542486,-131593177923583,-140710042265624,-150363025899135,-160578147647842,-171382426877951,-182803912081668,-194871709999999,-207616015289870,-221068140740607,-235260548044816,-250226879128703,-266001988046874,-282621973446655,-300124211606972,-318547390056831,-337931541778438,-358318079999999,-379749833583240,-402271083010687,-425927596977746,-450766669594623,-476837158203124,-504189521813375,-532875860165502,-562949953421311,-594467302491008,-627485169999999,-662062621900810,-698260569735167,-736141813551276,-775771085481343,-817215093984374,-860542568759295,-905824306333432,-953133216331391,-1002544368429378,-1054135039999999,-1107984764452580,-1164175380274047,-1222791080775406,-1283918464548863,-1347646586640624,-1414067010444415,-1483273860320762,-1555363874947071,-1630436461403548,-1708593749999999,-1789940649848550,-1874584905187327,-1962637152460136,-2054210978157183,-2149422977421874,-2248392813428735,-2351243277537492,-2458100350228351,-2569093262823518,-2684354559999999,-2804020163098720,-2928229434235007,-3057125241215466,-3190854023266303,-3329565857578124,-3473414526672255,-3622557586593622,-3777156435935231,-3937376385699288,-4103386729999999,-4275360817613090,-4453476124377087,-4637914326451396,-4828861374436223,-5026507568359374,-5231047633534975,-5442680797299152,-5661610866627711,-5888046306640858,-6122200319999999,-6364290927201660,-6614541047773567,-6873178582377926,-7140436495826943,-7416552901015624,-7701771143776895,-7996339888664082,-8300513205665791,-8614550657858228,-8938717389999999 pow $0,7 mov $1,1 sub $1,$0
427.857143
2,938
0.862771
7526d0f08aafa622a603402f023c6aa1f374f124
6,237
asm
Assembly
lab_11/01-buttonclick/main.asm
ak-karimzai/asm
e5433922cbb69cae3c03be86447e0e83fbd8cb0b
[ "Unlicense" ]
null
null
null
lab_11/01-buttonclick/main.asm
ak-karimzai/asm
e5433922cbb69cae3c03be86447e0e83fbd8cb0b
[ "Unlicense" ]
null
null
null
lab_11/01-buttonclick/main.asm
ak-karimzai/asm
e5433922cbb69cae3c03be86447e0e83fbd8cb0b
[ "Unlicense" ]
2
2021-06-07T06:29:31.000Z
2021-06-08T16:52:03.000Z
; Name : buttonclick.asm ; ; Build : nasm -felf64 -o buttonclick.o -l buttonclick.lst buttonclick.asm ; ld -s -m elf_x86_64 buttonclick.o -o buttonclick -lc --dynamic-linker /lib64/ld-linux-x86-64.so.2 `pkg-config --libs gtk+-2.0` ; Description : events and signals intro ; ; Remark : run this program from a terminal ; ; C - source : http://zetcode.com/tutorials/gtktutorial/gtkevents/ ; asm - source: https://github.com/agguro/gtk-programming ; bits 64 [list -] extern exit extern gtk_button_new_with_label extern gtk_container_add extern gtk_fixed_new extern gtk_fixed_put extern gtk_init extern gtk_main extern gtk_main_quit extern gtk_widget_set_size_request extern gtk_widget_show_all extern gtk_window_new extern gtk_window_set_default_size extern gtk_window_set_position extern gtk_window_set_title extern g_print extern g_signal_connect_data extern gtk_spin_button_new_with_range extern gtk_button_new_with_label extern gtk_label_new extern gtk_label_set_text extern gtk_spin_button_get_value_as_int extern g_strdup_printf extern g_free %define GTK_WIN_POS_CENTER 1 %define GTK_WINDOW_TOPLEVEL 0 %define NULL 0 [list +] section .data window: .handle: dq 0 .title: db "GtkButton", 0 fixed: .handle: dq 0 button: .handle: dq 0 .label: db "Click", 0 button_new: .handle: dq 0 .label: db "Add", 0 res_label: .handle: dq 0 .label: dq "0", 0 int_format dq "Res: %d", 0 spin_a: .handle dq 0 spin_b: .handle dq 0 res_str: dq 0 signal: .clicked: db "clicked", 0 .destroy: db "destroy", 0 message: .clicked: db "Clicked", 10, 0 section .text global _start _start: xor rdi, rdi ; no commandline arguments will be passed xor rsi, rsi call gtk_init mov rdi, GTK_WINDOW_TOPLEVEL call gtk_window_new mov qword[window.handle], rax mov rsi, window.title mov rdi, qword[window.handle] call gtk_window_set_title mov rdx, 200 mov rsi, 260 mov rdi, qword[window.handle] call gtk_window_set_default_size mov rsi, GTK_WIN_POS_CENTER mov rdi, qword[window.handle] call gtk_window_set_position call gtk_fixed_new mov qword[fixed.handle], rax mov rsi, qword[fixed.handle] mov rdi, qword[window.handle] call gtk_container_add mov rdi, button_new.label call gtk_button_new_with_label mov qword[button_new.handle], rax mov rcx, 150 mov rdx, 70 mov rsi, qword[button_new.handle] mov rdi, qword[fixed.handle] call gtk_fixed_put mov rdx, 35 mov rsi, 100 mov rdi, qword[button_new.handle] call gtk_widget_set_size_request mov rdi, __?float64?__(-2147483648.0) movq XMM0, rdi mov rsi, __?float64?__(+2147483647.0) movq XMM1, rsi mov rdx, __?float64?__(1.0) movq XMM2, rdx call gtk_spin_button_new_with_range mov qword[spin_a.handle], rax mov rcx, 20 mov rdx, 8 mov rsi, qword[spin_a.handle] mov rdi, qword[fixed.handle] call gtk_fixed_put mov rdx, 0 mov rsi, 250 mov rdi, qword[spin_a.handle] call gtk_widget_set_size_request mov rdi, __?float64?__(-2147483648.0) movq XMM0, rdi mov rsi, __?float64?__(+2147483647.0) movq XMM1, rsi mov rdx, __?float64?__(1.0) movq XMM2, rdx call gtk_spin_button_new_with_range mov qword[spin_b.handle], rax mov rcx, 60 mov rdx, 8 mov rsi, qword[spin_b.handle] mov rdi, qword[fixed.handle] call gtk_fixed_put mov rdx, 0 mov rsi, 250 mov rdi, qword[spin_b.handle] call gtk_widget_set_size_request call gtk_label_new mov qword[res_label.handle], rax mov rdi,qword[res_label.handle] mov rsi,res_label.label call gtk_label_set_text mov rcx, 100 mov rdx, 20 mov rsi, qword[res_label.handle] mov rdi, qword[fixed.handle] call gtk_fixed_put mov rdx, 35 mov rsi, 200 mov rdi, qword[res_label.handle] call gtk_widget_set_size_request xor r9d, r9d xor r8d, r8d mov rcx, NULL mov rdx, button_clicked mov rsi, signal.clicked mov rdi, qword[button_new.handle] call g_signal_connect_data xor r9d, r9d xor r8d, r8d mov rcx, NULL mov rdx, gtk_main_quit mov rsi, signal.destroy mov rdi, qword[window.handle] call g_signal_connect_data mov rdi, qword[window.handle] call gtk_widget_show_all call gtk_main xor rdi, rdi call exit button_clicked: push rsi mov rdi, qword[spin_a] call gtk_spin_button_get_value_as_int mov rdx, rax mov rdi, qword[spin_b] call gtk_spin_button_get_value_as_int add rdx, rax mov rcx, rdx mov rsi, rcx mov rax, 1 mov rdi, int_format call g_strdup_printf mov [res_str], rax mov rdi, qword[res_label.handle] mov rsi, [res_str] call gtk_label_set_text mov rdi, [res_str] call g_free mov qword[res_str], 0 pop rsi ret
26.096234
142
0.550906
b23583c99da5a1732ef8f9ce12ba780c2837cd3b
2,309
asm
Assembly
kdevice32.asm
satadriver/LiunuxOS
693174ac2b3e503d72782fc7a14f18c8a4f2756c
[ "Apache-2.0" ]
null
null
null
kdevice32.asm
satadriver/LiunuxOS
693174ac2b3e503d72782fc7a14f18c8a4f2756c
[ "Apache-2.0" ]
null
null
null
kdevice32.asm
satadriver/LiunuxOS
693174ac2b3e503d72782fc7a14f18c8a4f2756c
[ "Apache-2.0" ]
null
null
null
.386p Kernel Segment public para use32 assume cs:Kernel ;parm:dststr __strCmosTimer proc push ebp mov ebp,esp push edi push edx sub esp,40h mov edi,ss:[ebp+8] cld mov al,32h call __getCmosTimerAsc stosw mov al,9 call __getCmosTimerAsc stosw mov al,'/' stosb mov al,8 call __getCmosTimerAsc stosw mov al,'/' stosb mov al,7 call __getCmosTimerAsc stosw mov al,' ' stosb mov al,4 call __getCmosTimerAsc stosw mov al,':' stosb mov al,2 call __getCmosTimerAsc stosw mov al,':' stosb mov al,0 call __getCmosTimerAsc stosw mov al,' ' stosb mov al,6 call __getCmosTimerBCD push edi push eax call __int2Week add esp,8 add edi,eax mov eax,0 stosd add esp,40h pop edx pop edi mov esp,ebp pop ebp ret __strCmosTimer endp ;port = al ;need to check bit7 in port 70h,if 1 then wait to 0 __getCmosTimerAsc proc push edx ;cli ;shutdown nmi ;or al,80h ;mov dl,al ;in al,70h ;and al,80h ;or al,dl out 70h,al in al,71h ;bcd to ascii mov ah,al shr ah,4 and ah,0fh and al,0fh add ah,30h add al,30h xchg al,ah movzx eax,ax pop edx ;sti ret __getCmosTimerAsc endp ;port = al ;param:port __getCmosTimerBCD proc push edx ;cli ;shutdown nmi ;or al,80h ;mov dl,al ;in al,70h ;and al,80h ;or al,dl out 70h,al in al,71h movzx eax,al pop edx ;sti ret __getCmosTimerBCD endp __waitPs2Out proc in al,64h test al,1 jz __waitPs2Out ret __waitPs2Out endp __waitPs2In proc in al,64h test al,2 jnz __waitPs2In ret __waitPs2In endp __setKbdLed proc push edx mov edx,eax ;disable keyboard call __waitPs2In mov al,0adh out 64h,al ;send ED command to 8048,not 8042 in cpu bridge call __waitPs2In mov al,0edh out 60h,al ;任何时候收到一个来自于60h端口的合法命令或合法数据之后,都回复一个FAh call __waitPs2Out in al,60h cmp al,0fah call __waitPs2In ;send command data to 8048 mov eax,edx out 60h,al call __waitPs2Out ;here u get return byte 0fah,but why can't read it out ? in al,60h cmp al,0fah ;break the waiting ;call __waitPs2In ;mov al,80h ;out 60h,al ;call __waitPs2Out ;in al,60h ;cmp al,0fah ;enable keyboard call __waitPs2In mov al,0aeh out 64h,al pop edx ret __setKbdLed endp Kernel ends
10.591743
82
0.679515
61dbdde5cc69ca1d50d5f5f1dd80dfe9032857cc
3,201
asm
Assembly
Web/asm/examples/Pixel Bounce (LCD).asm
visrealm/vrcpu
f42ae80bd1e89e3877b88f1766f5facc5841594f
[ "MIT" ]
102
2019-09-24T21:12:05.000Z
2022-02-20T06:51:25.000Z
Web/asm/examples/Pixel Bounce (LCD).asm
visrealm/vrcpu
f42ae80bd1e89e3877b88f1766f5facc5841594f
[ "MIT" ]
null
null
null
Web/asm/examples/Pixel Bounce (LCD).asm
visrealm/vrcpu
f42ae80bd1e89e3877b88f1766f5facc5841594f
[ "MIT" ]
13
2019-09-25T19:52:10.000Z
2021-09-24T00:44:40.000Z
; Bounce a pixel around the display ; Note: The emulator isn't fast enough to run this one ; It looks much more convincing on the real device DISPLAY_MODE = LCD_CMD_DISPLAY | LCD_CMD_DISPLAY_ON _PIXELX = 0x00 ; pixel overall position _PIXELY = 0x01 _CHARX = 0x02 ; character the pixel is at _CHARY = 0x03 _PIXEL_OFFSETX = 0x04 ; location within the character _PIXEL_OFFSETY = 0x05 _LAST_CHARX = 0x06 ; last character position _LAST_CHARY = 0x07 _DIR_X = 0x08 _DIR_Y = 0x09 CHAR_WIDTH = 5 CHAR_HEIGHT = 8 PIXEL_POS_X = 0 PIXEL_POS_Y = 0 initializeDisplay: clra lcc #LCD_INITIALIZE lcc #DISPLAY_MODE lcc #LCD_CMD_CLEAR sto Ra, _LAST_CHARX ; clear lastChar positions sto Ra, _LAST_CHARY inc Ra sto Ra, _DIR_Y inc Ra sto Ra, _DIR_X ; movement direction ; set pixel location data Ra, PIXEL_POS_X sto Ra, _PIXELX data Ra, PIXEL_POS_Y sto Ra, _PIXELY call clearChar drawPixel: checkXBounds: lod Ra, _PIXELX tst Ra jn .fixNeg data Rb, 79 cmp Rb, Ra jnn .done .fixPos: data Ra, 79 sto Ra, _PIXELX jmp .reverse .fixNeg: data Ra, 0 sto Ra, _PIXELX .reverse: lod Rb, _DIR_X data Rc, 0 sub Rc mov Rb, Rc sto Rb, _DIR_X inc Rd .done: checkYBounds: lod Ra, _PIXELY tst Ra jn .fixNeg data Rb, 15 cmp Rb, Ra jnn .done .fixPos: data Ra, 15 sto Ra, _PIXELY jmp .reverse .fixNeg: data Ra, 0 sto Ra, _PIXELY .reverse: lod Rb, _DIR_Y data Rc, 0 sub Rc mov Rb, Rc sto Rb, _DIR_Y inc Rd .done: ; compute X location and offset data Rb, CHAR_WIDTH lod Ra, _PIXELX call div8 sto Rc, _CHARX sto Ra, _PIXEL_OFFSETX ; compute Y location and offset data Rb, CHAR_HEIGHT lod Ra, _PIXELY call div8 sto Rc, _CHARY sto Ra, _PIXEL_OFFSETY call clearLastCharacter ; Set CGRAM address to _PIXEL_OFFSETY lod Ra, _PIXEL_OFFSETY data Rb, LCD_CMD_SET_CGRAM_ADDR or Ra lcc Ra data Ra, 4 lod Rb, _PIXEL_OFFSETX sub Ra data Rb, 0x01 tst Ra jz .donePixelShift .checkShift: lsr dec Ra jnz .checkShift .donePixelShift: lcd Rb ; update the custom character with the pixel location call outputCharacter lod Ra, _PIXELX lod Rb, _DIR_X add Ra sto Ra, _PIXELX lod Ra, _PIXELY lod Rb, _DIR_Y add Ra sto Ra, _PIXELY jmp drawPixel outputCharacter: lod Ra, _CHARX sto Ra, _LAST_CHARX lod Rb, _CHARY sto Rb, _LAST_CHARY tst Rb jz .doneOffset data Rb, 0x40 or Ra .doneOffset: data Rb, LCD_CMD_SET_DRAM_ADDR add Ra lcc Ra ; set the dram location lcd #0 ; output the character ret clearLastCharacter: lod Ra, _LAST_CHARX lod Rb, _LAST_CHARY tst Rb jz .doneOffset data Rb, 0x40 or Ra .doneOffset: data Rb, LCD_CMD_SET_DRAM_ADDR add Ra lcc Ra ; set the dram location lcd #32 ; output space call clearChar ; clear the last custom character data too ret clearChar: lcc #LCD_CMD_SET_CGRAM_ADDR data Rb, CHAR_HEIGHT data Ra, 0 .next: lcd Ra dec Rb jnz .next ret ; function div8 - divide two 8-bit integers ; Ra: dividend ; Rb: divisor ; returns: ; Rc: result ; Ra: remainder div8: data Rc, 0x00 .step: cmp Rb, Ra jz .add jc .return .add: inc Rc sub Ra jnz .step .return: ret
14.819444
61
0.69572
a9d58ab13e648bb6f5243b5d739e8ad0c71759eb
623
asm
Assembly
programs/oeis/186/A186145.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/186/A186145.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/186/A186145.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A186145: Rank of n^2 when {i^2: i>=1} and {j^3>: j>=1} are jointly ranked with i^2 before j^3 when i^2=j^3. Complement of A186146. ; 1,3,5,6,7,9,10,11,13,14,15,17,18,19,21,22,23,24,26,27,28,29,31,32,33,34,35,37,38,39,40,42,43,44,45,46,48,49,50,51,52,54,55,56,57,58,60,61,62,63,64,65,67,68,69,70,71,72,74,75,76,77,78,79,81,82,83,84,85,86,88,89,90,91,92,93,95,96,97,98,99,100,102,103,104,105,106,107,108,110,111,112,113,114,115,116,118,119,120,121 mov $1,$0 add $0,7 add $1,1 pow $1,2 sub $1,1 seq $1,48766 ; Integer part of cube root of n. Or, number of cubes <= n. Or, n appears 3n^2 + 3n + 1 times. add $0,$1 sub $0,6
51.916667
314
0.65008
276cb0557ccf4c6ee803e27b6d99f6f24cea7448
547
asm
Assembly
libsrc/_DEVELOPMENT/l/sccz80/crt0_long/l_long_div_u.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
libsrc/_DEVELOPMENT/l/sccz80/crt0_long/l_long_div_u.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
libsrc/_DEVELOPMENT/l/sccz80/crt0_long/l_long_div_u.asm
meesokim/z88dk
5763c7778f19a71d936b3200374059d267066bb2
[ "ClArtistic" ]
null
null
null
; ; Small C+ Long Library Functions ; ; Divide 2 32 bit numbers ; ; Hopefully this routine does work! ; ; I think the use of ix is unavoidable in this case..unless you know ; otherwise! ; ; This is for unsigned quantities..separate routine for signed.. ; ; Replaced use of ix with bcbc' SECTION code_l_sccz80 PUBLIC l_long_div_u EXTERN l_divu_32_32x32 l_long_div_u: ; dehl = divisor ; stack = dividend, ret exx pop bc pop hl pop de push bc jp l_divu_32_32x32 - 1
16.088235
74
0.636197
db192e87440e0f99eba84034370058f79462abef
6,534
asm
Assembly
yasmandel.asm
jarekratajski/yamandel
fd5012ea7557bc97a7881122e6fe5407a985aa27
[ "BSD-3-Clause" ]
2
2020-03-22T13:29:47.000Z
2020-03-22T16:27:18.000Z
yasmandel.asm
jarekratajski/yamandel
fd5012ea7557bc97a7881122e6fe5407a985aa27
[ "BSD-3-Clause" ]
null
null
null
yasmandel.asm
jarekratajski/yamandel
fd5012ea7557bc97a7881122e6fe5407a985aa27
[ "BSD-3-Clause" ]
null
null
null
; mandelbrot calculation in assembly using simple vectorization ; naively written it is in fact slower than code generated by gcc ; (as expected) ; this code was refactor for a smarter vectorization global mandelbrotAsm extern printf, getline, stdin %define winDataOnStack 1*8h %define positionOnStack 2*8h %define startRowOnStack 3*8h %define rowsOnStack 4*8h %define imageOnStack 5*8h %define tmpValStack 6*8 %define winData_widthOffset 2*8h %define winData_heightOffset 2*8h + 4 %define position_scale_offset 0*8h %define position_right_offset 1*8h %define position_down_offset 2*8h %define position_iterations_offset 3*8h; %define position_colorTable_offset 4*8h %macro debugIntValue 1 mov rsi, %1 lea rdi, [rel debugIntValMsg] sub rsp, 64 ; stack space xor rax, rax call printf WRT ..plt add rsp, 64 %endmacro %macro debugDoubleValue 1 push rax push rsi push rdi push r8 push r9 mov rax,rax mov rsi, %1 movq xmm0, %1 ;movlps xmm0, qword %1 mov rax,1 lea rdi, [rel debugDoubleValMsg] sub rsp, 64+8 ; stack space call printf WRT ..plt add rsp, 64+8 pop r9 pop r8 pop rdi pop rsi pop rax %endmacro section .text ;https://wiki.osdev.org/System_V_ABI ; x86 64 calling conv RDI, RSI, RDX, RCX, R8, R9, [XYZ]MM0–7 ; callee saves r12-r15, rbx,rbp mandelbrotAsm: push r15 push r14 push r13 push r12 sub rsp, 128+8 ; needed for correct stack frame alignment (printf) mov qword [rsp+positionOnStack], rsi mov qword [rsp +winDataOnStack], rdi mov dword [rsp +startRowOnStack], edx mov dword [rsp +rowsOnStack], ecx mov [rsp +imageOnStack], r8 xor r15,r15 xor r14,r14 ;xor r12,r12 mov r10, [rsp + winDataOnStack] mov r15d, dword [r10 + winData_widthOffset] ;mov r15h, dword[r10 + winData_widthOffset] mov r14d, dword [rsp +startRowOnStack] mov r13, [ rsp + positionOnStack] mov rax, r14 mul r15 shl rax, 2 mov rdx, rax CVTPI2PD xmm7, [r10 + winData_widthOffset] ; (height, width) movhlps xmm4, xmm7 ; height in xmm4 movhlps xmm3, xmm7 ; height in xmm3 movq xmm5, [rel const_minus_2] divsd xmm4, xmm5 ; height / -2.0 CVTSI2SD xmm5, r14 ; startRow addsd xmm4, xmm5 ;startrow + height /-2.0 movq xmm5, [rel const_plus_4] mulsd xmm4, xmm5 ; * 4.0 divsd xmm4, xmm3 ; xmm4 almost c_im_ (/height) movq xmm6, [r13 + position_scale_offset] ; scale mulsd xmm4, xmm6 movq xmm5, [ r13 + position_down_offset] ; down addsd xmm4, xmm5 ; c_im ; xmm4 was -2 -> OK! movq r9, xmm4 movq xmm12, r9 ;movq r9, xmm4 ; ??? ;debugDoubleValue r9 movq xmm1, [r13 + position_right_offset] movq xmm14, xmm6 ; scale movq xmm3, [rel const_minus_2] mulsd xmm14, xmm3 addsd xmm14, xmm1 ;xmm2 c_re_left -> was -2 OK ;movq r9, xmm14 ;debugDoubleValue r9 movq xmm5, [rel const_plus_4] ; again plus 4 movlhps xmm5, xmm5 ;xmm5 has 4,4 - confirmed movlhps xmm6, xmm6 ; scale, scale mulpd xmm5, xmm6 ; confirmed divpd xmm5, xmm7 ;(/ width / height ;checking {0.0020833333333333333, 0.0037037037037037038} movhlps xmm11, xmm5 mov r8d, dword [rsp + rowsOnStack] add r8, r14 ; end row mov r12d, dword [r13 + position_iterations_offset] movq xmm15, [rel const_plus_4] ; again plus 4 movq xmm8, [rel const_plus_4] ; again plus 4 mov rdi, [r13 +position_colorTable_offset] mov r13, [rsp + imageOnStack] ; small sumarry where we are ; xmm5 - {im_step, re_step} - MOVED to ymm6, ymm7 ; xmm11 {im_step} ; xmm14 - { , c_re_left} ; xmm12 - { , c_im} ; xmm15 - 4 ; r14 - startRow (will use as index) ; r15 -width ; r8 - endRow ; r12 iterations ; r13 image ;RDI colortable ;rdx pixeladddr rowsLoop: ;main rows loop on r14 up to r8 ( ; xmm1 - c_re movq xmm1, xmm14 ; start from c_re_left ;main cols loop on r11 up to r15 xor r11,r11 colsLoop: xorps xmm0,xmm0 ; {x,y} xor r10,r10 ; iteration iterationsLoop: movhlps xmm8, xmm0 ; y in xmm 8 movlhps xmm8, xmm0 ; {y, x} in xmm 8 movhlps xmm9, xmm8 ; y in xmm 9 movlhps xmm9, xmm8 ; {x, y} in xmm 9 mulpd xmm0,xmm0 ; double sqx = x*x; double sqy = y*y; xorps xmm2, xmm2 VHADDPD xmm2, xmm0, xmm2 ; xmm2 lower has sqx + sqy CMPNLTSD xmm2, xmm15 ; xompare with 4 /bug movq rax, xmm2 cmp rax, 0xffffffff je endloop cmp r10,r12 jg endloop mulpd xmm9,xmm8; {x*y,x*y} addsd xmm9,xmm9; *2 addsd xmm9, xmm12; x*y*2 + c_im (y) ; sqx-sqy+c_re pxor xmm10,xmm10 HSUBPD xmm0, xmm10; probably{ --, x*x -y*y} ADDSD xmm0, xmm1 ; +c_re ; x_new movlhps xmm0, xmm9 inc r10 jmp iterationsLoop endloop: ;we have in r10 iterations ; r13 img' ;RDI colortable ;rdx pixeladddr mov eax, dword [rdi+r10*4] mov dword [r13 + rdx], eax ; ;c_re = c_re+re_step; addsd xmm1, xmm5 ;pixeladr++; add rdx, 4h ;inc col and test with r15 inc r11 cmp r11,r15 jl colsLoop ;c_im = c_im + im_step; addsd xmm12, xmm11 ;inc row and test r14 up to r8 inc r14 cmp r14, r8 jl rowsLoop add rsp, 128+8 pop r12 pop r13 pop r14 pop r15 ret section .rodata debugIntValMsg: db "Deine int val = %d",10,0 debugDoubleValMsg: db "Deine double val = %f",10,0 const_minus_2: dq -2.0 const_plus_2: dq 2.0 const_plus_4: dq 4.0
25.034483
103
0.546832
d3e5789346a934a2a8d365826ed1ca8c146e5678
1,434
asm
Assembly
kernel/kernel.asm
pixie-grasper/operating-system
5a48872f67ef6cdcfbd454e73c6a9c3be7f1eea2
[ "MIT" ]
1
2016-05-14T11:00:13.000Z
2016-05-14T11:00:13.000Z
kernel/kernel.asm
pixie-grasper/operating-system
5a48872f67ef6cdcfbd454e73c6a9c3be7f1eea2
[ "MIT" ]
null
null
null
kernel/kernel.asm
pixie-grasper/operating-system
5a48872f67ef6cdcfbd454e73c6a9c3be7f1eea2
[ "MIT" ]
1
2021-09-08T10:16:46.000Z
2021-09-08T10:16:46.000Z
section .text vstart=0x00042000 bits 64 %include "macro.asm" entry: mov rsp, 0x00080000 call memory.init jc error.notenoughmemory call descriptor_tables.init call console_out.init mov rax, msg.initializing call console_out.prints call interrupts.init call objects.init call device.init ldid a, [device.boot] testid a jz error.failed mov rax, msg.ok call console_out.prints ; list-up files mov rax, msg.listupping call console_out.prints ldid a, [device.boot] call iso9660.begin testid a jz end or edx, -1 call iso9660.ls call objects.unref mov rax, msg.nl call console_out.prints mov rax, msg.ok call console_out.prints jmp end error: .notenoughmemory: mov rax, msg.nem call console_out.prints@us ; console_out is not initialized, use unsafe function jmp end .failed: mov rax, msg.bad call console_out.prints jmp end end: hlt jmp end %include "console-out.asm" %include "descriptor-tables.asm" %include "device.asm" %include "iso9660.asm" %include "memory.asm" %include "objects.asm" msg: .initializing: db 'Initializing... ', 0 .listupping: db 'List up files... ', 0x0a, 0 .ok: db 'OK.', 0x0a, 0 .bad: db 'Failed.', 0 .nem: db 'Not enough memory.', 0 .nl: db 0x0a, 0 ; one page for the GDT, one for the IDT, one for the TLS global_page_size equ 3 global_page_addr: dd 0 TLS: .memory.tablelookahead equ 0 ; .. 3 .objects.heap equ 8 ; .. 15
18.623377
83
0.706416
44989d44a86fa889f01ad48df463ed02ed2db44e
329
asm
Assembly
programs/oeis/055/A055566.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/055/A055566.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
programs/oeis/055/A055566.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
; A055566: Sum of digits of n^5. ; 0,1,5,9,7,11,27,22,26,27,1,14,27,25,29,36,31,35,45,37,5,18,25,29,36,40,35,36,28,23,9,34,29,36,31,35,36,46,41,36,7,29,27,31,35,36,46,32,45,43,11,27,22,44,36,37,41,36,52,47,27,40,35,45,37,32,36,25,47,36,22,35 pow $0,5 mov $1,1 lpb $0 mov $2,$0 div $0,10 mod $2,10 add $1,$2 lpe sub $1,1
25.307692
208
0.610942
64eefcd4ffe1fc686f0d5974193d50de475904be
293
asm
Assembly
programs/oeis/154/A154955.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/154/A154955.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/154/A154955.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A154955: a(1) = 1, a(2) = -1, followed by 0, 0, 0, ... . ; 1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 sub $1,$0 pow $1,$1 mov $0,$1
41.857143
202
0.481229
051791e0bdea67b15d5783ec7e96bd98c490f545
11,365
asm
Assembly
bubblesort/code.asm
mateusragazzi/MIPS-Codes
fbdb3b753cdcb7ba4b3c0d97158ba679a2c32b92
[ "Apache-2.0" ]
2
2019-04-25T19:05:38.000Z
2019-05-19T06:45:54.000Z
bubblesort/code.asm
mateusragazzi/MIPS-Codes
fbdb3b753cdcb7ba4b3c0d97158ba679a2c32b92
[ "Apache-2.0" ]
null
null
null
bubblesort/code.asm
mateusragazzi/MIPS-Codes
fbdb3b753cdcb7ba4b3c0d97158ba679a2c32b92
[ "Apache-2.0" ]
2
2019-04-25T19:09:10.000Z
2019-05-19T07:11:44.000Z
#------------------------------------------------------------------------------ # Programa BubleSort: ordenação pelo método da bolha #------------------------------------------------------------------------------ # Para visualização correta do programa fonte, configure editor no MARS: # Ir em Settings -> Editor # Selecionar Tab Size = 3 (dar Apply and Close) #------------------------------------------------------------------------------ # Para executar programa no MARS: # Ir em Settings -> Memory Configuration # Selecionar Default (dar Apply and Close) # Montar programa # Ir em Tools -> Bitmap display # Configurar display bitmap com: # Unit Width in Pixels: 32 # Unit Height in Pixels: 32 # Display Width in Pixels: 512 # Display Height in Pixels: 64 # Base address for display: ($gp) # Dar "Connect to MIPS" # Executar programa # Antes de executar de novo, dar "Reset" #------------------------------------------------------------------------------ .text # Área de código #------------------------------------------------------------------------------ # PROGRAMA PRINCIPAL # Ordena vetor pelo método BubbleSort # Mostra no dispaly bitmap, cores correspondentes aos elementos do vetor # Possui chamadas aninhadas de rotinas # Algoritmo: # Imprime mensagem inicial # mostra_vetor() # trocou = true # limite = n-1 # while (limite > 0) AND (trocou) # trocou = false # for (i = 0 ; i < limite ; i++) # if vetor[i] > vetor[i+1] # troca(&vetor[i], &vetor[i+1]) // Troca elementos vetor[i] e vetor[i+1] # trocou = true # mostra_vetor() # limite-- # Encerra execução do programa # Uso dos registradores: # $s0: limite # $s1: endereco inicial do vetor # $s2: trocou (boolean) # $s3: i - for # $s4: n # $t0: end memoria de vet[i] # $t1: condicoes # $t2: end memoria de vet[i + 1] # $t3: vet[i] # $t4: vet[i + 1] # Inicialização main: addi $v0, $zero, 4 # Chamada ao sistema para escrever string na tela la $a0, msg1 # $a0 = endereço da string a ser escrita na tela syscall addi $v0, $zero, 4 # Chamada ao sistema para escrever string na tela la $a0, msgN # $a0 = endereço da string a ser escrita na tela syscall li $v0, 5 # chamada do sistema para ler um inteiro syscall move $s4, $v0 # lê n - $s4 = n la $s1, vetor # $s1 = endereço inicial do vetor jal ler_vetor addi $s0, $s4, -1 # limite = n - 1 addi $s2, $zero, 1 # trocou = 1 (true) jal mostra_vetor while: slt $t1, $s0, $zero # n($s0) < 0 = ( true ($t1): 1, false ($t1): 0 ) bne $t1, $zero, fimloop # limite < 0 false, fimloop beq $s2, $zero, fimloop # trocou($s2) == zero, fimloop add $s2, $zero, $zero # trocou = false addi $s3, $zero, 0 # i = 0 for: slt $t1, $s3, $s0 # i($s3) < limite($s0) beq $t1, $zero, endfor # testa condicao #vetor[i] sll $t3, $s3, 2 # $t3 = 4 * i add $t0, $s1, $t3 # $t0 = $s1 + (4 * i) lw $t3, 0 ($t0) # $t3 = vet[$t0] -> $t3 = vet[i] #vetor[i+1] addi $t4, $s3, 1 # $t4 = i + 1 sll $t4, $t4, 2 # $t4 = 4 * $t4 (i + 1) add $t2, $s1, $t4 # $t2 = $s1 + (4 * (i + 1)) lw $t4, 0 ($t2) # $t4 = vet[$t2] -> $t4 = vet[i + 1] #if slt $t1, $t4, $t3 # vetor[i] > vetor[i+1] # vetor[i+1] <= vetor[i] beq $t1, $zero, fimif # testa condicao # metodo troca add $a0, $zero, $t0 # parametro 1: end memo de vet(i) - $t0 add $a1, $zero, $t2 # parametro 2: end memo de vet(i + 1) - $t2 jal troca addi $s2, $zero, 1 # trocou = true # fim metodo troca fimif: addi $s3, $s3, 1 # i++ j for # return to for structure endfor: jal mostra_vetor subi $s0, $s0, 1 # limite-- j while fimloop: addi $v0, $zero, 10 # Chamada ao sistema para encerrar programa syscall #------------------------------------------------------------------------------ # ROTINA troca($a0, $a1) # Troca valores dos elementos do vetor na memória # Parâmetros: # $a0: endereço de vetor[i] na memória # $a1: endereço de vetor[i+1] na memória # Uso dos registradores: # $t0: vet[i] # $t1: vet[i + 1] troca: lw $t0, 0 ($a0) # $t0 = vet[$a0] -> $t0 = vet[i] lw $t1, 0 ($a1) # $t1 = vet[$a1] -> $t1 = vet[i + 1] sw $t1, ($a0) # vet[i] = $t1 sw $t0, ($a1) # vet[i + 1] = $t0 jr $ra #------------------------------------------------------------------------------ # ROTINA ler_vetor # Ler vetor com a entrada do usuário # Algoritmo: # for j = 0 ; j < n ; j++ # vet[j] = numero_do_usuario # Uso dos registradores: # #s1: endereco de memoria de vetor # $s4: n # $s5: i # $t1: condicoes # $t2: inteiro lido ler_vetor: addi $sp, $sp, -4 # adiciona mais um nivel na pilha sw $ra, 0, ($sp) # salvo o retorno para a main na pilha addi $s5, $zero, 0 # i = 0 for_ler: slt $t1, $s5, $s4 # $t1 = i($s5) < n($s4) beq $t1, $zero, endfor_ler # condicao (i < n) addi $v0, $zero, 4 # Chamada ao sistema para escrever string na tela la $a0, msgLerI # $a0 = endereço da string a ser escrita na tela syscall li $v0, 5 # chamada do sistema para ler um inteiro syscall move $t2, $v0 # lê inteiro sll $t3, $s5, 2 # $t3 = 4 * i add $t3, $s1, $t3 # $t3 = $s1 + (4 * i) sw $t2, 0 ($t3) addi $s5, $s5, 1 # i++ j for_ler # retorna loop endfor_ler: lw $ra, 0, ($sp) # lê o retorno para a main da pilha addi $sp, $sp, 4 # limpa pilha jr $ra # retorna para a main #------------------------------------------------------------------------------ # ROTINA mostra_vetor # Mostra no display bitmap cor correspondente a todos os elementos de vetor # Possui chamada aninhada de rotina # Algoritmo: # for j = 0 ; j < n ; j++ # mostra_elemento_vetor(j) # Uso dos registradores: # $s4: n # $s5: i # $t1: condicoes # $t2 = vet[i] # $t3 = n - 1 mostra_vetor: addi $v0, $zero, 4 # Chamada ao sistema para escrever string na tela la $a0, msgMostrarVet # $a0 = endereço da string a ser escrita na tela syscall addi $sp, $sp, -4 # adiciona mais um nivel na pilha sw $ra, 0, ($sp) # salvo o retorno para a main na pilha addi $s5, $zero, 0 # i = 0 for_vet: slt $t1, $s5, $s4 # $t1 = i($s5) < n($s4) beq $t1, $zero, endfor_vet # condicao (i < n) addi $a0, $s5, 0 # adiciona como parâmetro (i) jal mostra_elemento_vetor sll $t2, $s5, 2 # $t2 = 4 * i add $t2, $s1, $t2 # $t2 = $s1 + (4 * i) lw $t2, 0 ($t2) # $t2 = vet[i] li $v0, 1 # serviço para printar um integer add $a0, $t2, $zero # carrega inteiro em $a syscall subi $t3, $s4, 1 # $t3 = n - 1 slt $t1, $s5, $t3 # $t1 = i($s5) < n - 1($t3) beq $t1, $zero, endSeparar # condicao (i < (n - 1)) addi $v0, $zero, 4 # Chamada ao sistema para escrever string na tela la $a0, separar # $a0 = endereço da string a ser escrita na tela syscall endSeparar: addi $s5, $s5, 1 # i++ j for_vet # retorna loop endfor_vet: addi $v0, $zero, 4 # Chamada ao sistema para escrever string na tela la $a0, pularLinha # $a0 = endereço da string a ser escrita na tela syscall lw $ra, 0, ($sp) # lê o retorno para a main da pilha addi $sp, $sp, 4 # limpa pilha jr $ra # retorna para a main #------------------------------------------------------------------------------ # ROTINA mostra_elemento_vetor(índice) # Mostra no display bitmap cor correspondente ao elemento vetor[índice] # Algoritmo: # Salva registradores na pilha # Lê vetor[índice] da memória # Lê escala_ azul[vetor[índice]] da memória (cor com que elemento deve ser desenhado) # Calcula endereço no display onde elemento do vetor deve ser desenhado: endereço inicial do display + índice * 4 # Escreve cor nessa posição do display # Restaura registradores da pilha # Parâmetros: # $a0: índice do elemento do vetor (entre 0 e n - 1, corresponde à coluna no display em que elemento é desenhado) # Uso dos registradores: # $t0: endereço inicial de vetor na memória # $t1: endereço de vetor[índice] na memória # $t2: vetor[índice] (entre 0 e n - 1, corresponde ao índice da cor com que elemento é desenhado) # $t3: endereço inicial do vetor escala_ azul na memória # $t4: endereço de escala_ azul[vetor[índice]] na memória # $t5: escala_ azul[vetor[índice]] (cor com que elemento deve ser desenhado) # $t6: endereço no display onde elemento do vetor deve ser desenhado # $gp: endereço inicial do display # Prólogo mostra_elemento_vetor: addi $sp, $sp, -4 # aloca espaço na pilha sw $ra, 0, ($sp) # salva o retorno para a mostra_vetor na pilha addi $sp, $sp, -28 # Aloca espaço para 7 palavras na pilha sw $t0, 0 ($sp) # Salva $t0, $t1, $t2, $t3, $t4, $t5, $t6 na pilha sw $t1, 4 ($sp) sw $t2, 8 ($sp) sw $t3, 12 ($sp) sw $t4, 16 ($sp) sw $t5, 20 ($sp) sw $t6, 24 ($sp) # Lê vetor[índice] da memória la $t0, vetor # $t0 = endereço inicial de vetor na memória sll $t1, $a0, 2 # $t1 = índice * 4 add $t1, $t0, $t1 # $t1 = endereço de vetor[índice] na memória lw $t2, 0 ($t1) # $t2 = vetor[índice] (índice da cor com que elemento é desenhado) # Lê escala_ azul[vetor[índice]] da memória la $t3, escala_azul # $t3 = endereço inicial do vetor escala_ azul na memória sll $t4, $t2, 2 # $t4 = vetor[índice] * 4 add $t4, $t3, $t4 # $t4 = endereço de escala_ azul[vetor[índice]] na memória lw $t5, 0 ($t4) # $t5 = escala_ azul[vetor[índice]] (cor com que elemento é desenhado) # Calcula endereço no display onde elemento do vetor deve ser desenhado sll $t6, $a0, 2 # $t6 = índice * 4 add $t6, $gp, $t6 # $t6 = endereço inicial do display + índice * 4 sw $t5, 0 ($t6) # Escreve cor do elemento do vetor na área de memória do display bitmap: mostrado no display # Epílogo lw $t0, 0 ($sp) # Restaura $t0, $t1, $t2, $t3, $t4, $t5, $t6 da pilha lw $t1, 4 ($sp) lw $t2, 8 ($sp) lw $t3, 12 ($sp) lw $t4, 16 ($sp) lw $t5, 20 ($sp) lw $t6, 24 ($sp) addi $sp, $sp, 28 # Libera espaço de 7 palavras na pilha lw $ra, 0 ($sp) # leio o retorno para mostra_vetor addi $sp, $sp, 4 # retira mostra_vetor da pilha jr $ra # Retorna da rotina #------------------------------------------------------------------------------ .data # Área de dados #------------------------------------------------------------------------------ # Variáveis e estruturas de dados do programa n: .word 16 # Número de elementos do vetor (no máximo 16) # Vetor a ser ordenado (com 16 valores entre 0 e 15) vetor: .word 9 1 10 2 6 13 15 0 12 5 7 14 4 3 11 8 #vetor: .word 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 #vetor: .word 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 #vetor: .word 9 1 10 2 9 6 13 15 13 0 12 5 6 0 5 7 # Strings para impressão de mensagens msg1: .asciiz "\nOrdenação\n" msgN: .asciiz "\nDigite um N para o vetor:\n" msgLerI: .asciiz "\nDigite um valor:\n" msgMostrarVet: .asciiz "\nMostrando vetor:\n" pularLinha: .asciiz "\n" separar: .asciiz ", " msg2: .asciiz "Tecle enter" # Escala de 16 cores em azul escala_azul: .word 0x00CCFFFF, 0x00BEEEFB, 0x00B0DDF8, 0x00A3CCF4, 0x0095BBF1, 0x0088AAEE, 0x007A99EA, 0x006C88E7, 0x005F77E3, 0x005166E0, 0x004455DD, 0x003644D9, 0x002833D6, 0x001B22D2, 0x000D11CF, 0x000000CC #------------------------------------------------------------------------------
38.788396
210
0.561285
e2120384b23c918c56bbf8e99290ac2d0cd19f92
929
asm
Assembly
programs/oeis/279/A279539.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/279/A279539.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/279/A279539.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A279539: Sum of ceilings of natural logs of first n integers. ; 0,1,3,5,7,9,11,14,17,20,23,26,29,32,35,38,41,44,47,50,54,58,62,66,70,74,78,82,86,90,94,98,102,106,110,114,118,122,126,130,134,138,142,146,150,154,158,162,166,170,174,178,182,186,191,196,201,206,211,216,221,226,231,236,241,246,251,256,261,266,271,276,281,286 mov $14,$0 mov $16,$0 lpb $16,1 clr $0,14 mov $0,$14 sub $16,1 sub $0,$16 mov $11,$0 mov $13,$0 lpb $13,1 mov $0,$11 sub $13,1 sub $0,$13 mov $7,$0 mov $9,2 lpb $9,1 mov $0,$7 sub $9,1 add $0,$9 sub $0,1 mul $0,6 mov $1,0 lpb $0,1 div $0,2 add $1,2 sub $0,$1 lpe mul $1,2 mov $10,$9 lpb $10,1 mov $8,$1 sub $10,1 lpe lpe lpb $7,1 mov $7,0 sub $8,$1 lpe mov $1,$8 div $1,4 add $12,$1 lpe add $15,$12 lpe mov $1,$15
18.959184
259
0.501615
b1a8e7f4adb57a81c2ee29a5019d1b4145625a9a
1,510
asm
Assembly
bin/JWASM/Samples/CrtExe.asm
Abd-Beltaji/ASMEMU
4122099e188e951357407152c4666346e45871d3
[ "MIT" ]
3
2022-03-08T16:53:42.000Z
2022-03-18T21:55:57.000Z
bin/JWASM/Samples/CrtExe.asm
Abd-Beltaji/ASMEMU
4122099e188e951357407152c4666346e45871d3
[ "MIT" ]
null
null
null
bin/JWASM/Samples/CrtExe.asm
Abd-Beltaji/ASMEMU
4122099e188e951357407152c4666346e45871d3
[ "MIT" ]
null
null
null
;--- this is a simple startup procedure, for 32- and 64-bit, ;--- if a console application is to use msvcrt.dll ;--- instead of a static CRT. if ( type near ) ne 0ff08h .386 .MODEL FLAT _cdecl textequ <c> WINAPI textequ <stdcall> pattr textequ <> else _cdecl textequ <> WINAPI textequ <> pattr textequ <frame> option frame:auto option win64:3 endif option casemap:none LPVOID typedef ptr STARTUPINFOA struct 8 cb DWORD ? lpReserved LPVOID ? lpDesktop LPVOID ? lpTitle LPVOID ? dwX DWORD ? dwY DWORD ? dwXSize DWORD ? dwYSize DWORD ? dwXCountChars DWORD ? dwYCountChars DWORD ? dwFillAttribute DWORD ? dwFlags DWORD ? wShowWindow WORD ? cbReserved2 WORD ? lpReserved2 LPVOID ? hStdInput LPVOID ? hStdOutput LPVOID ? hStdError LPVOID ? STARTUPINFOA ends __getmainargs proto _cdecl :ptr, :ptr, :ptr, :dword, :ptr exit proto _cdecl :dword main proto _cdecl :dword, :ptr, :ptr .CODE mainCRTStartup proc _cdecl pattr local argc:dword local argv:LPVOID local environ:LPVOID local _si:STARTUPINFOA mov _si.cb, sizeof STARTUPINFOA if 1 GetStartupInfoA proto WINAPI :ptr STARTUPINFOA invoke GetStartupInfoA, addr _si endif invoke __getmainargs, addr argc, addr argv, addr environ, 0, addr _si invoke main, argc, argv, environ invoke exit, eax mainCRTStartup endp end mainCRTStartup
21.884058
73
0.655629
b79ebf8990caeed9f80ca07ce6ab4478f0a5d07b
825
asm
Assembly
oeis/142/A142393.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/142/A142393.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/142/A142393.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A142393: Primes congruent to 42 mod 47. ; Submitted by Christian Krause ; 89,277,653,1123,1217,1499,2063,2251,2909,3191,3943,4507,4789,6011,6199,6481,6763,6857,7703,8737,8831,9677,10429,10711,10993,11087,11369,11839,11933,12497,12967,13249,13907,14753,15787,15881,16069,16633,17291,17573,17761,18043,18701,20393,21521,21803,21991,22273,22367,24247,24623,25469,25657,25939,26597,26879,27067,27631,28289,28477,28571,28759,30169,31391,32143,32237,32707,32801,33083,33647,34211,34963,35339,35527,35809,36373,36467,36749,37313,37501,37783,38629,38723,39569,40039,40697,41543 mov $1,11 mov $2,$0 add $2,2 pow $2,2 lpb $2 add $1,30 mov $3,$1 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,17 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 sub $2,1 lpe mov $0,$1 add $0,31
35.869565
497
0.735758
9c34127647a519f991d4fb065c1c690532a6924b
636
asm
Assembly
win64/lesson03.asm
mashingan/notes-asmtutor
88532e0b364a63cd1e7578a537807795d429fc2f
[ "MIT" ]
1
2021-11-05T06:41:49.000Z
2021-11-05T06:41:49.000Z
win64/lesson03.asm
mashingan/notes-asmtutor
88532e0b364a63cd1e7578a537807795d429fc2f
[ "MIT" ]
null
null
null
win64/lesson03.asm
mashingan/notes-asmtutor
88532e0b364a63cd1e7578a537807795d429fc2f
[ "MIT" ]
null
null
null
format PE64 console entry start include 'win64w.inc' section '.data' readable msg db 'Hello the new brave isekai!', 0dh, 0Ah, 0 section '.text' code readable executable start: mov rbx, msg mov rcx, rbx .nextchar: cmp byte [rcx], 0 jz .finished inc rcx jmp .nextchar .finished: sub rcx, rbx invoke GetStdHandle, STD_OUTPUT_HANDLE push 0 mov rbx, rsp invoke WriteConsoleA, rax, msg, rcx, rbx, 0 pop rax ; discard invoke ExitProcess, 0 section '.idata' import data readable library kernel32, 'kernel32.dll' include 'api\kernel32.inc'
19.875
53
0.63522
f876b7bbe4d24af1a9bb827ee3a54345e266f38a
276
asm
Assembly
programs/oeis/047/A047308.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/047/A047308.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/047/A047308.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A047308: Numbers that are congruent to {0, 3, 4, 5, 6} mod 7. ; 0,3,4,5,6,7,10,11,12,13,14,17,18,19,20,21,24,25,26,27,28,31,32,33,34,35,38,39,40,41,42,45,46,47,48,49,52,53,54,55,56,59,60,61,62,63,66,67,68,69,70,73,74,75,76,77 mov $1,$0 add $1,4 div $1,5 mul $1,2 add $1,$0
30.666667
163
0.623188
a80dc61a81adb4137bdbb5eed2755d8b5b7f77be
1,454
asm
Assembly
src/LKS/old/Collision_map.asm
Kannagi/LKS
363ccbfbe93a78e227349967053075ba67f4e50c
[ "MIT" ]
6
2019-04-18T12:08:23.000Z
2021-07-07T08:07:28.000Z
src/LKS/old/Collision_map.asm
Kannagi/LKS
363ccbfbe93a78e227349967053075ba67f4e50c
[ "MIT" ]
null
null
null
src/LKS/old/Collision_map.asm
Kannagi/LKS
363ccbfbe93a78e227349967053075ba67f4e50c
[ "MIT" ]
null
null
null
.MACRO LKS_COLLISION_MAP0 lda LKS_BG.Addressc+2 sta LKS_ZP+2 lda LKS_BG.Addressc sta LKS_ZP lda LKS_SPRITE.PX,y clc adc #8<<2 sta MEM_TEMP+2 adc LKS_SPRITE.VX,y lsr lsr lsr lsr lsr lsr sta MEM_TEMP+0 ;------- lda MEM_TEMP+2 lsr lsr lsr lsr lsr lsr sta MEM_TEMP+2 ;---------------- lda LKS_SPRITE.PY,y clc adc #$10<<2 sta MEM_TEMP+6 adc LKS_SPRITE.VY,y asl asl and #$FF00 ora #$0010 sta WRMPYA lda MEM_TEMP+6 asl asl and #$FF00 ora #$0010 sta MEM_TEMP+6 lda RDMPYL asl asl sta MEM_TEMP+4 ;----- lda MEM_TEMP+6 sta WRMPYA LKS_cycle8 lda RDMPYL asl asl sta MEM_TEMP+6 .ENDM .MACRO LKS_COLLISION_MAP1 lda MEM_TEMP+(2*\1) clc adc MEM_TEMP+(2*\2) tay lda [LKS_ZP],y .ENDM .MACRO LKS_COLLISION_MAP2 lda MEM_TEMP+(2*\1) clc adc MEM_TEMP+(2*\2) sta MEM_TEMP +8 adc #64 tay lda [LKS_ZP],y sta MEM_TEMP +10 lda MEM_TEMP +8 tay lda [LKS_ZP],y .ENDM LKS_Collision_Map: rep #$20 tyx phy LKS_COLLISION_MAP0 LKS_COLLISION_MAP2 0,3 ;vx bit #$101 beq + lda #0 sta LKS_SPRITE.VX,x /* lda MEM_TEMP+0 dec a asl asl asl asl asl asl clc adc #8<<2 sta LKS_SPRITE.PX,x */ +: lda MEM_TEMP+10 bit #$101 beq + lda #0 sta LKS_SPRITE.VX,x +: LKS_COLLISION_MAP2 1,2 ;vy bit #$0101 beq + lda #0 sta LKS_SPRITE.VY,x +: lda MEM_TEMP+10 bit #$101 beq + lda #0 sta LKS_SPRITE.VY,x +: ply sep #$20 rtl
9.441558
27
0.626547
81a649647e448151fb7d6edab8e12c0d12f8eca1
303
asm
Assembly
programs/oeis/133/A133016.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/133/A133016.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
programs/oeis/133/A133016.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
; A133016: Even imperfect numbers, divided by 2. ; 1,2,4,5,6,7,8,9,10,11,12,13,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64 mov $1,3 add $1,$0 mov $2,8 lpb $2 add $1,1 sub $2,$1 sub $1,2 lpe
25.25
179
0.627063
8245fb1963793fc37e5cb82ef8e648dfe14de46c
475
asm
Assembly
oeis/161/A161583.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/161/A161583.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/161/A161583.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A161583: The list of the k values in the common solutions to the 2 equations 15*k+1=A^2, 19*k+1=B^2. ; Submitted by Christian Krause ; 0,17,4896,1405152,403273745,115738159680,33216448554432,9533004996962321,2735939217679631712,785205022469057339040,225351105509401776672785,64674982076175840847750272,18561494504756956921527655296,5327084247883170460637589319697 mov $3,1 lpb $0 sub $0,1 mov $1,$3 mul $1,15 add $2,$1 add $3,$2 lpe pow $3,2 mov $0,$3 div $0,15
29.6875
230
0.774737
2d451ebb437934c09eba6918f57fff73fe5fa230
1,978
asm
Assembly
src/02/translate.asm
MyLanPangzi/Computer-Organization
088ad8be26a79dddbfc470753f0f4dc3fa0373c9
[ "MIT" ]
null
null
null
src/02/translate.asm
MyLanPangzi/Computer-Organization
088ad8be26a79dddbfc470753f0f4dc3fa0373c9
[ "MIT" ]
null
null
null
src/02/translate.asm
MyLanPangzi/Computer-Organization
088ad8be26a79dddbfc470753f0f4dc3fa0373c9
[ "MIT" ]
null
null
null
.data word: .asciiz "alpha ","bravo ","china ","delta ","echo ","foxtrot ","golf ","hotel ","india ","juliet ","kilo ","lima ","mary ","november","oscar ","paper ","quebec ","research","sierra ","tango ","uniform ","victor ","whisky ","x-ray ","yankee ","zulu " Word: .asciiz "Alpha ","Bravo ","China ","Delta ","Echo ","Foxtrot ","Golf ","Hotel ","India ","Juliet ","Kilo ","Lima ","Mary ","November","Oscar ","Paper ","Quebec ","Research","Sierra ","Tango ","Uniform ","Victor ","Whisky ","X-ray ","Yankee ","Zulu " num: .asciiz "Zero ", "First ","Second ","Third ","Fourth ","Fifth ","Sixth ","Seventh ","Eighth ","Ninth " a_z: .word 0x61 0x7a A_Z: .word 0x41 0x5a n0_9: .word 0x30 0x39 .macro print_str (%str) .data msg: .asciiz %str .text li $v0, 4 la $a0, msg syscall .end_macro .macro read li $v0, 12 syscall .end_macro # 读入字符串 a # 判断字符串在哪个范围内 # 根据范围,计算出偏移量 # 打印最终结果 .text .globl start start: print_str ("Enter a char (max 1 length, enter ? quit): ") #读取字符串 read move $s3, $v0 print_str ("\n") #判断是否为? li $t0, 0x3f beq $t0, $s3, exit # 循环三次,判断在哪个范围内打印了,如果没有打印,则打印* li $t7, 0 #循环初始变量 li $t8, 3 #循环结束条件 for: mul $t5, $t7, 8 # 边界范围偏移量 la $t0, a_z #加载边界范围基础地址 add $t0, $t5, $t0 #基础地址 + 偏移量 lw $t1, 0($t0) #上界 lw $t2, 4($t0) #下界 bge $s3, $t1, gt # 判断大于下界,如果是判断是否大于上界 j endfor #小于下界则进行下一轮循环 gt: bgt $s3, $t2, endfor #大于上界则进行下一轮循环 sub $t0, $s3, $t1 #算出单词偏移量 li $t2, 9 #偏移量单位 9 mul $t0, $t2, $t0 #单词最终偏移量 mul $t5, $t7, 234 #单词段基址偏移量单位26 * 9 la $t1, word #单词段基础地址 add $t1, $t5, $t1 #单词段最终地址= 基址+偏移量 add $a0, $t1, $t0 #单词地址=单词段最终地址+单词最终偏移量 li $v0, 4 #加载打印服务 syscall #打印 print_str("\n") j start #重新开始输入 endfor: addi $t7, $t7, 1 blt $t7, $t8, for print_str("*\n") #其他字符打印* j start #继续下一轮 exit: print_str("Bye")
27.09589
303
0.542973
ee57f21311928590997405b1f58381886619dc9d
518
asm
Assembly
oeis/345/A345939.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/345/A345939.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/345/A345939.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A345939: a(n) = (n-1) / gcd(n-1, uphi(n)), where uphi is unitary totient (or unitary phi) function, A047994. ; Submitted by Christian Krause ; 0,1,1,1,1,5,1,1,1,9,1,11,1,13,7,1,1,17,1,19,5,21,1,23,1,25,1,3,1,29,1,1,8,33,17,35,1,37,19,39,1,41,1,43,11,45,1,47,1,49,25,17,1,53,27,55,14,57,1,59,1,61,31,1,4,13,1,67,17,23,1,71,1,73,37,25,19,77,1,79,1,81,1,83,21,85,43,87,1,89,5,91,23,93,47,95,1,97,49,11 mov $2,$0 seq $0,47994 ; Unitary totient (or unitary phi) function uphi(n). mov $1,$0 gcd $1,$2 div $2,$1 mov $0,$2
47.090909
257
0.633205
5351e8b005b3a644dccd2920bb57b55b88b934f6
1,363
asm
Assembly
nand2tetris/projects/04/fill/Fill.asm
nickrechard/introPChardware
eb6d4183e9bd129a505e73aa47411afc5ac53ce3
[ "MIT" ]
null
null
null
nand2tetris/projects/04/fill/Fill.asm
nickrechard/introPChardware
eb6d4183e9bd129a505e73aa47411afc5ac53ce3
[ "MIT" ]
null
null
null
nand2tetris/projects/04/fill/Fill.asm
nickrechard/introPChardware
eb6d4183e9bd129a505e73aa47411afc5ac53ce3
[ "MIT" ]
null
null
null
// This file is part of www.nand2tetris.org // and the book "The Elements of Computing Systems" // by Nisan and Schocken, MIT Press. // File name: projects/04/Fill.asm // Runs an infinite loop that listens to the keyboard input. // When a key is pressed (any key), the program blackens the screen, // i.e. writes "black" in every pixel; // the screen should remain fully black as long as the key is pressed. // When no key is pressed, the program clears the screen, i.e. writes // "white" in every pixel; // the screen should remain fully clear as long as no key is pressed. // Pseudocode // if RAM[24576]!=0 // loop all register for screen and write -1,(16 1s) // else // go to top and start over. // Put your code here. (START) @16384 D=A @i M=D // i=16384 (LOOP) @i D=M @24576 D=D-A // D=i-24576 @START D; JGE // if i>=24576, jump to start @24576 D=M // get the value in keyboard memory @BLACK D; JNE // RAM[24756]!=0 jump to (BLACK) @i // else write 0.(WHITE) A=M M=0 // write RAM[i]=0 @STEP 0;JMP // after write, go to step to increment i (BLACK) @i A=M M=-1 // write RAM[i]=-1 @STEP 0;JMP // after write, go to step to increment i (STEP) @i M=M+1 // i++ @LOOP 0;JMP // loop @START 0;JMP // jump to start infinite loop
22.716667
72
0.608217
82b4fa0d5beef4694cf2a7fec7305e69ef5d53a3
666
asm
Assembly
oeis/015/A015570.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/015/A015570.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/015/A015570.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A015570: Expansion of x/(1 - 7*x - 11*x^2). ; Submitted by Jamie Morken(s4) ; 0,1,7,60,497,4139,34440,286609,2385103,19848420,165175073,1374558131,11438832720,95191968481,792170939287,6592308228300,54860037930257,456535656023099,3799210009394520,31616362282015729,263105846077449823,2189520907644321780,18220810660362200513,151630404606622943171,1261841749510344807840,10500826697245266029761,87386046125330655094567,727211416547012511989340,6051726423207724789965617,50361410544471211161642059,419098864466583450821116200,3487667567255267478525876049 mov $1,1 lpb $0 sub $0,1 mov $2,$3 mul $2,21 mul $3,2 add $3,$1 mul $1,5 add $1,$2 lpe mov $0,$3
41.625
475
0.818318
a456c9a9f82230e7d87599cc9af4e1c20c6b67ac
418
asm
Assembly
programs/oeis/244/A244174.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/244/A244174.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/244/A244174.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A244174: Number of compositions of 3n in which the minimal multiplicity of parts equals n. ; 1,3,7,21,71,253,925,3433,12871,48621,184757,705433,2704157,10400601,40116601,155117521,601080391,2333606221,9075135301,35345263801,137846528821,538257874441,2104098963721,8233430727601,32247603683101,126410606437753,495918532948105,1946939425648113,7648690600760441 mov $1,$0 mul $1,2 bin $1,$0 div $1,2 mul $1,2 add $1,1
41.8
267
0.815789
b1b9f27fb3f57e18ab6b9f0661cbfa00adee6c8d
2,961
asm
Assembly
babysteps/fuck.asm
ilya101010/asm_studies
8014446d021b0f3d50f091fd88cbf3ea726fc160
[ "WTFPL" ]
1
2019-09-17T01:06:02.000Z
2019-09-17T01:06:02.000Z
babysteps/fuck.asm
ilya101010/asm_studies
8014446d021b0f3d50f091fd88cbf3ea726fc160
[ "WTFPL" ]
null
null
null
babysteps/fuck.asm
ilya101010/asm_studies
8014446d021b0f3d50f091fd88cbf3ea726fc160
[ "WTFPL" ]
null
null
null
Use16 org 0x7C00 start: cli ; disabling interrupts mov ax, cs ; segment registers' init mov ds, ax mov es, ax mov ss, ax mov sp, 0x7C00 ; stack backwards => ok mov ax, 0xB800 mov gs, ax ; Использовал для вывода текста прямой доступ к видеопамяти mov cx, 24 call clrscr lp0: mov si, state call k_puts call shift_string loop lp0 jmp $ ; И уходим в бесконечный цикл iterate: mov si, state call eval ; magic; si = refferals; di = output mov si, newstate call clr_str ret eval: ; the idea is to pass one byte through all of the string => 78 iterations (check: 0M000000, where M is the magic) pusha mov si, state call shift_string mov si, tmp call clr_str mov di, newstate mov si, state call strcpy popa ret magic: pusha lodsb and al, 7 ; first 3 bits mov cl, al mov dl, 126 ; example rule shl dl, cl and dl, 1 test dl, dl jz pal0 jnz pal1 bk1: stosb popa ret shift_string: ; RIGHT direction! include si push di push si mov di, tmp pushad mov cx, 10 mov dx, 0 add si, 10 add di, 10 push 0 in4: lodsw sub si, 4 shr ax, 1 pop dx pushf shl dx, 15 ; carry flag from %111 stays in stack or ax, dx popf jc push1 jnc push0 back1: stosw sub di, 4 loop in4 pop dx ; bit from first word add si, 8 add di, 8 lodsw shl dx, 15 test dx, dx or ax, dx stosw popad xchg si, di call strcpy pop si pop di ret ; >>>>>>>>>> Util put_hash: push ax mov al, 0x23 mov ah, 0x0E int 0x10 pop ax ret put_space: push ax mov al, 0x20 mov ah, 0x0E int 0x10 pop ax ret ps: call put_space jmp back0 ph: call put_hash jmp back0 strcpy: ; just for 80 bits pusha mov cx, 5 rep movsw popa ret push1: push 1 jmp back1 push0: push 0 jmp back1 clr_str: pusha mov cx, 5 mov di, si clrl: lodsw mov ax, 0 stosw loop clrl popa ret pal0: pushf and al, 253 popf jmp bk1 pal1: pushf or al, 2 popf jmp back1 clrscr: pusha mov dx, 0 ; set cursor to top left-most corner of screen mov bh, 0 ; page mov ah, 0x2 ; ah = 2 => set cursor int 0x10 ; moving cursor mov cx, 2000 ; print 2000 = 80*45 chars mov bh, 0 mov bl, 0xF0 ; gray bg/white fg mov al, 0x20 ; blank char mov ah, 0x9 int 0x10 popa ret k_puts: ; important: we _are_ outputing bits from the smallest => biggest pusha mov cx, 10 in1: ; 10 bytes mov dl, 1; mask lodsb ; 8 bits => AL in2: ; passing through bits test al, dl jz ps jnz ph back0: shl dl, 1 jnc in2 ; carry != 1 => NOT overflow in dl => NOT finish (8 bits in dl) loop in1 popa ret ; >>>>>>>>>> vars in memory state dw 0x3, 0,0,0,0x8000 ; 2 hex symbols => 8 binary states newstate dw 0,0,0,0,0 ; place to copy; how to dup?! tmp dw 0,0,0,0,0 ; place to copy; how to dup?! rule db 126 ; >>>>>>>>>> boot sector stuff times 510-($-$$) db 0 db 0x55, 0xaa
14.1
119
0.623438
7ae397fe83e396c691851fae187979e738667791
5,148
asm
Assembly
experiment08/5a_MOV_LD_ST.asm
EmilyClaire/space_invader
ccd376d404b5b1b99a99d2adf116bff42af40bdf
[ "MIT" ]
null
null
null
experiment08/5a_MOV_LD_ST.asm
EmilyClaire/space_invader
ccd376d404b5b1b99a99d2adf116bff42af40bdf
[ "MIT" ]
null
null
null
experiment08/5a_MOV_LD_ST.asm
EmilyClaire/space_invader
ccd376d404b5b1b99a99d2adf116bff42af40bdf
[ "MIT" ]
null
null
null
;------------------------------------------------ ;--- Programmers: Mattics Phi, John Inlow | ;--- Date: 2.27.11 | ;--- V.1 | ;--- | ;--- Required working instructions: | ;--- Tests in this order: | ;--- MOV (Reg/Imm) | ;--- MOV (Reg/Reg) | ;--- ST (Reg/Reg) | ;--- LD (Reg/Reg) | ;--- ST (Reg/Imm) | ;--- LD (Reg/Imm) | ;------------------------------------------------ .EQU LED_PORT = 0x40 .EQU INSIDE_FOR_COUNT = 0xBA .EQU MIDDLE_FOR_COUNT = 0xBA .EQU OUTSIDE_FOR_COUNT = 0xBA .DSEG .ORG 0x00 .CSEG .ORG 0x40 main: MOV R31, 0x00 ;------------------------------------------------ ;--- MOV (Reg/Imm) | ;------------------------------------------------ mov_imm: MOV R10, 0xFF CMP R10, 0xFF BRNE mov_reg OR R31, 0x80 OUT R31, LED_PORT ;------------------------------------------------ ;--- END MOV | ;------------------------------------------------ ;------------------------------------------------ ;--- Delay Loop | ;------------------------------------------------ MOV R1, OUTSIDE_FOR_COUNT OUTSIDE_FOR1: SUB R1, 0x01 MOV R2, MIDDLE_FOR_COUNT MIDDLE_FOR1: SUB R2, 0x01 MOV R3, INSIDE_FOR_COUNT INSIDE_FOR1: SUB R3, 0x01 BRNE INSIDE_FOR1 OR R2, 0x00 BRNE MIDDLE_FOR1 OR R1, 0x00 BRNE OUTSIDE_FOR1 ;------------------------------------------------ ;--- End Delay Loop | ;------------------------------------------------ ;------------------------------------------------ ;--- MOV (Reg/Reg) | ;------------------------------------------------ mov_reg: MOV R11, R10 CMP R11, 0xFF BRNE st_reg OR R31, 0x40 OUT R31, LED_PORT ;------------------------------------------------ ;--- END MOV | ;------------------------------------------------ ;------------------------------------------------ ;--- Delay Loop | ;------------------------------------------------ MOV R1, OUTSIDE_FOR_COUNT OUTSIDE_FOR2: SUB R1, 0x01 MOV R2, MIDDLE_FOR_COUNT MIDDLE_FOR2: SUB R2, 0x01 MOV R3, INSIDE_FOR_COUNT INSIDE_FOR2: SUB R3, 0x01 BRNE INSIDE_FOR2 OR R2, 0x00 BRNE MIDDLE_FOR2 OR R1, 0x00 BRNE OUTSIDE_FOR2 ;------------------------------------------------ ;--- End Delay Loop | ;------------------------------------------------ ;------------------------------------------------ ;--- ST (Reg/Reg) | ;------------------------------------------------ st_reg: MOV R12, 0x09 ST R11, (R12) CMP R12, 0x09 BRNE ld_reg OR R31, 0x20 OUT R31, LED_PORT ;------------------------------------------------ ;--- END ST | ;------------------------------------------------ ;------------------------------------------------ ;--- Delay Loop | ;------------------------------------------------ MOV R1, OUTSIDE_FOR_COUNT OUTSIDE_FOR3: SUB R1, 0x01 MOV R2, MIDDLE_FOR_COUNT MIDDLE_FOR3: SUB R2, 0x01 MOV R3, INSIDE_FOR_COUNT INSIDE_FOR3: SUB R3, 0x01 BRNE INSIDE_FOR3 OR R2, 0x00 BRNE MIDDLE_FOR3 OR R1, 0x00 BRNE OUTSIDE_FOR3 ;------------------------------------------------ ;--- End Delay Loop | ;------------------------------------------------ ;------------------------------------------------ ;--- LD (Reg/Reg) | ;------------------------------------------------ ld_reg: LD R13, (R12) CMP R13, 0xFF BRNE st_ld_imm OR R31, 0x10 OUT R31, LED_PORT ;------------------------------------------------ ;--- END LD | ;------------------------------------------------ ;------------------------------------------------ ;--- Delay Loop | ;------------------------------------------------ MOV R1, OUTSIDE_FOR_COUNT OUTSIDE_FOR4: SUB R1, 0x01 MOV R2, MIDDLE_FOR_COUNT MIDDLE_FOR4: SUB R2, 0x01 MOV R3, INSIDE_FOR_COUNT INSIDE_FOR4: SUB R3, 0x01 BRNE INSIDE_FOR4 OR R2, 0x00 BRNE MIDDLE_FOR4 OR R1, 0x00 BRNE OUTSIDE_FOR4 ;------------------------------------------------ ;--- End Delay Loop | ;------------------------------------------------ ;------------------------------------------------ ;--- LD/ST (Reg/Imm) | ;------------------------------------------------ st_ld_imm: ST R11, 0x10 LD R14, 0x10 CMP R14, 0xFF BRNE fail OR R31, 0x0F OUT R31, LED_PORT ;------------------------------------------------ ;--- END LD | ;------------------------------------------------ ;------------------------------------------------ ;--- Delay Loop | ;------------------------------------------------ MOV R1, OUTSIDE_FOR_COUNT OUTSIDE_FOR5: SUB R1, 0x01 MOV R2, MIDDLE_FOR_COUNT MIDDLE_FOR5: SUB R2, 0x01 MOV R3, INSIDE_FOR_COUNT INSIDE_FOR5: SUB R3, 0x01 BRNE INSIDE_FOR5 OR R2, 0x00 BRNE MIDDLE_FOR5 OR R1, 0x00 BRNE OUTSIDE_FOR5 ;------------------------------------------------ ;--- End Delay Loop | ;------------------------------------------------ fail: BRN main;
21.813559
49
0.328671
07680141a096c1b8f03bd9e9eb7e9fec1fc31e73
651
asm
Assembly
oeis/212/A212335.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/212/A212335.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/212/A212335.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A212335: Expansion of 1/(1-22*x+22*x^2-x^3). ; Submitted by Jamie Morken(s1) ; 1,22,462,9681,202840,4249960,89046321,1865722782,39091132102,819048051361,17160917946480,359560228824720,7533603887372641,157846121406000742,3307234945638642942,69294087737005501041,1451868607531476878920,30419946670424008956280,637367011471372711202961,13354287294228402926305902,279802666167325088741220982,5862501702219598460639334721,122832733080444242584684808160,2573624892987109495817741636640,53923290019648855169587889561281,1129815465519638849065527939150262 add $0,1 lpb $0 sub $0,1 mov $1,$3 mul $1,19 add $2,1 add $2,$1 add $3,$2 lpe mov $0,$3
43.4
470
0.835637
0b1ec204104b442738a564b9ec0171659fa0f53c
288
asm
Assembly
libsrc/target/newbrain/warm_reset.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
640
2017-01-14T23:33:45.000Z
2022-03-30T11:28:42.000Z
libsrc/target/newbrain/warm_reset.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
1,600
2017-01-15T16:12:02.000Z
2022-03-31T12:11:12.000Z
libsrc/target/newbrain/warm_reset.asm
jpoikela/z88dk
7108b2d7e3a98a77de99b30c9a7c9199da9c75cb
[ "ClArtistic" ]
215
2017-01-17T10:43:03.000Z
2022-03-23T17:25:02.000Z
; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 05/04/2007 ; ; ; warm reset: foolishly jump to BASIC entry ; ; ; ; $Id: warm_reset.asm,v 1.4 2016-06-19 20:33:40 dom Exp $ ; SECTION code_clib PUBLIC warm_reset PUBLIC _warm_reset .warm_reset ._warm_reset jp 49373
13.714286
57
0.701389
d26bd2d8e00bc9149f580931acd48fdec06840c0
625
asm
Assembly
oeis/170/A170760.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
11
2021-08-22T19:44:55.000Z
2022-03-20T16:47:57.000Z
oeis/170/A170760.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
9
2021-08-29T13:15:54.000Z
2022-03-09T19:52:31.000Z
oeis/170/A170760.asm
neoneye/loda-programs
84790877f8e6c2e821b183d2e334d612045d29c0
[ "Apache-2.0" ]
3
2021-08-22T20:56:47.000Z
2021-09-29T06:26:12.000Z
; A170760: Expansion of g.f.: (1+x)/(1-40*x). ; 1,41,1640,65600,2624000,104960000,4198400000,167936000000,6717440000000,268697600000000,10747904000000000,429916160000000000,17196646400000000000,687865856000000000000,27514634240000000000000,1100585369600000000000000,44023414784000000000000000,1760936591360000000000000000,70437463654400000000000000000,2817498546176000000000000000000,112699941847040000000000000000000,4507997673881600000000000000000000,180319906955264000000000000000000000,7212796278210560000000000000000000000 add $0,1 mov $3,1 lpb $0 sub $0,1 add $2,$3 div $3,$2 mul $2,40 lpe mov $0,$2 div $0,40
44.642857
481
0.8496
6474798e17e8114e3d89432894b5df5e5cdf7c75
101
asm
Assembly
tests/data/src/test_ld_a_16.asm
protoCall7/PZ80emu
2ff78d206bda4a173bfca0700462cd5f1cb3d637
[ "BSD-3-Clause" ]
1
2016-03-07T23:18:59.000Z
2016-03-07T23:18:59.000Z
tests/data/src/test_ld_a_16.asm
protoCall7/PZ80emu
2ff78d206bda4a173bfca0700462cd5f1cb3d637
[ "BSD-3-Clause" ]
3
2015-12-13T00:27:06.000Z
2017-10-20T18:39:25.000Z
tests/data/src/test_ld_a_16.asm
protoCall7/PZ80emu
2ff78d206bda4a173bfca0700462cd5f1cb3d637
[ "BSD-3-Clause" ]
null
null
null
; set up registers ld bc,0x0050 ld de,0x0060 ld a,0xFF ; load ram ld (bc),a ld (de),a ld (0x0070),a
10.1
18
0.663366
bd0e00b11cd79e16e58ed9f2d28990d5f22cf845
758
asm
Assembly
libsrc/sdcard/sd_write_sector.asm
andydansby/z88dk-mk2
51c15f1387293809c496f5eaf7b196f8a0e9b66b
[ "ClArtistic" ]
1
2020-09-15T08:35:49.000Z
2020-09-15T08:35:49.000Z
libsrc/sdcard/sd_write_sector.asm
andydansby/z88dk-MK2
51c15f1387293809c496f5eaf7b196f8a0e9b66b
[ "ClArtistic" ]
null
null
null
libsrc/sdcard/sd_write_sector.asm
andydansby/z88dk-MK2
51c15f1387293809c496f5eaf7b196f8a0e9b66b
[ "ClArtistic" ]
null
null
null
; ; Old School Computer Architecture - SD Card driver ; Taken from the OSCA Bootcode by Phil Ruston 2011 ; Port by Stefano Bodrato, 2012 ; ; int sd_write_sector(struct SD_INFO descriptor, long sector, unsigned char *address); ; ; sd_card_info and card_select must be accessible, ; a good place to put them is in the vars declared in the CRT0 stub ; ; on exit: 0 if all OK or error code ; ; $Id: sd_write_sector.asm,v 1.4 2012/09/20 21:13:16 stefano Exp $ ; XLIB sd_write_sector LIB sd_write_sector_callee XREF ASMDISP_SD_WRITE_SECTOR_CALLEE sd_write_sector: pop af ; ret addr pop hl ; dst addr exx pop hl ; sector pos lsb pop de ; sector pos msb pop ix ; SD_INFO struct push af jp sd_write_sector_callee + ASMDISP_SD_WRITE_SECTOR_CALLEE
22.969697
86
0.754617
cc9271b5f7ef7ecc9cabcc63655ff0b9e910e373
9,060
asm
Assembly
Driver/IFS/DOS/Common/dosWaitPost.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
504
2018-11-18T03:35:53.000Z
2022-03-29T01:02:51.000Z
Driver/IFS/DOS/Common/dosWaitPost.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
96
2018-11-19T21:06:50.000Z
2022-03-06T10:26:48.000Z
Driver/IFS/DOS/Common/dosWaitPost.asm
steakknife/pcgeos
95edd7fad36df400aba9bab1d56e154fc126044a
[ "Apache-2.0" ]
73
2018-11-19T20:46:53.000Z
2022-03-29T00:59:26.000Z
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1992 -- All Rights Reserved PROJECT: PC GEOS MODULE: FILE: dosWaitPost.asm AUTHOR: Adam de Boor, Mar 10, 1992 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- Adam 3/10/92 Initial revision DESCRIPTION: Hooking of BIOS WAIT/POST calls for those systems that support them. $Id: dosWaitPost.asm,v 1.1 97/04/10 11:54:58 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Init segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DOSWaitPostInit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Initialize support of wait/post CALLED BY: Version-specific init code PASS: ds = dgroup RETURN: nothing DESTROYED: ax, bx, cx, dx, di, es, si PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 3/10/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ waitPostKeyStr char 'waitpost', 0 DOSWaitPostInit proc near .enter ; ; See if [system]::waitpost enabled in the ini file. ; push ds segmov ds, cs, cx ; ds, cx <- cs mov si, offset systemCatStr mov dx, offset waitPostKeyStr call InitFileReadBoolean pop ds jc done ; => doesn't exist, so leave w/p off tst ax jz done ; => w/p turned off ; ; It's set true, but make sure we didn't just crash. If we did, the ; crash could well be our fault, so we leave w/p off... ; call SysGetConfig test al, mask SCF_CRASHED jnz done ; ; Start guardian timer ; mov ds:[dosWPCount], 0 mov ds:[dosWaitPostOn], TRUE mov al, TIMER_ROUTINE_CONTINUAL mov bx, segment DOSWaitPostGuardian mov si, offset DOSWaitPostGuardian mov cx, WP_GUARD_INTERVAL mov di, cx mov dx, ds ; pass dgroup in ax call TimerStart mov ds:[dosWPGuardian], bx mov ds:[dosWPGuardianID], ax ; ; And intercept wait/post interrupt. ; mov ax, WAIT_POST_INTERRUPT mov bx, segment DOSWaitPostHandler mov cx, offset DOSWaitPostHandler segmov es, ds mov di, offset dosWaitPostSave call SysCatchInterrupt done: .leave ret DOSWaitPostInit endp Init ends if FULL_EXECUTE_IN_PLACE ResidentXIP segment resource else Resident segment resource endif if TEST_WAIT_POST WaitPostCall struct WPC_function BiosWaitFunctions WPC_type BiosWaitTypes WPC_sem Semaphore WPC_thread hptr.HandleThread WPC_time sword WaitPostCall ends WP_HISTORY_SIZE equ 100 idata segment wpHistory WaitPostCall WP_HISTORY_SIZE dup (<>) wpPtr word 0 maxWaits word 0 idata ends endif if CATCH_MISSED_COM1_INTERRUPTS idata segment waitPostIntCount sword -1 waitPostAX word 0 idata ends endif if TEST_WAIT_POST COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DOSWaitPostStoreHistory %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Record the current call in the wait/post history log CALLED BY: DOSWaitPostHandler PASS: ah = WaitPostFunctions al = BiosWaitTypes ds = dgroup RETURN: nothing DESTROYED: bx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 3/10/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DOSWaitPostStoreHistory proc near .enter pushf mov bx, ds:[wpPtr] mov ds:[wpHistory][bx].WPC_function, ah mov ds:[wpHistory][bx].WPC_type, al mov ax, ds:[dosWPSem].Sem_value mov ds:[wpHistory][bx].WPC_sem.Sem_value, ax mov ax, ds:[dosWPSem].Sem_queue mov ds:[wpHistory][bx].WPC_sem.Sem_queue, ax push bx mov ax, TGIT_THREAD_HANDLE clr bx call ThreadGetInfo pop bx mov ds:[wpHistory][bx].WPC_thread, ax push bx call TimerGetCount pop bx mov ds:[wpHistory][bx].WPC_time, ax add bx, size WaitPostCall cmp bx, (size WaitPostCall) * WP_HISTORY_SIZE jnz done clr bx done: mov ds:[wpPtr], bx push cs call safePopf .leave ret safePopf: iret DOSWaitPostStoreHistory endp endif COMMENT @---------------------------------------------------------------------- FUNCTION: DOSWaitPostHandler DESCRIPTION: Handle INT 15h on the 286 or 386. This interrupt provides a mechanism for catching BIOS wait loops CALLED BY: INT 15h PASS: ah - function code (BiosWaitFunctions) BWF_WAIT - About to enter busy loop BWF_POST - Ready to exit busy loop Other - pass on al - type code (BiosWaitTypes) RETURN: DESTROYED: REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 10/90 Initial version ardeb 3/11/92 brought into IFS driver ------------------------------------------------------------------------------@ DOSWaitPostHandler proc far push bx push ax push ds push cx FXIP< call LoadVarSegDSFar > NOFXIP< call LoadVarSegDS > ; ; go to code appropriate for function call... ; tst ds:[dosWPDisabled] ; if we've turned this off, ; then bypass jnz passOn cmp ah, BWF_WAIT jz handleWait cmp ah, BWF_POST jz handlePost ; unknown function, pass it on passOn: pop cx mov bx, offset dosWaitPostSave jmp DOSPassOnInterrupt handleWait: inc ds:[dosWPCount] cmp ds:[dosWPCount], WP_DISABLE_THRESHOLD jnz noMax mov ds:[dosWPDisabled], TRUE jmp passOn noMax: ; ; Determine max wait time for the operation. If it's not one of ; the operations we support, just pass the call on. ; mov cx, FIXED_DISK_TIMEOUT cmp al, BWT_FIXED_DISK jz waitCommon mov cx, FLOPPY_DISK_TIMEOUT cmp al, BWT_FLOPPY_DISK jz waitCommon mov cx, FLOPPY_MOTOR_TIMEOUT cmp al, BWT_FLOPPY_MOTOR_START jnz passOn waitCommon: if TEST_WAIT_POST call DOSWaitPostStoreHistory endif PTimedSem ds, dosWPSem, cx, TRASH_AX_BX_CX, NO_EC if TEST_WAIT_POST jnc noTimeout mov ah, BWF_WAIT_TIMEOUT call DOSWaitPostStoreHistory noTimeout: endif jmp exit handlePost: ; ; Field a post call, waking up the thread that's waiting on dosWPSem, ; if something actually is. ; CheckHack <BWT_FLOPPY_DISK eq 1 AND BWT_FIXED_DISK eq 0> cmp al, BWT_FLOPPY_DISK ja passOn if TEST_WAIT_POST call DOSWaitPostStoreHistory endif ; XXX: what if the thing just timed out? unlikely, but unhappy ; nonetheless VSem ds, dosWPSem, TRASH_AX_BX, NO_EC exit: ; ; Common exit code. Restore registers and return with carry flag ; set properly. ; pop cx pop ds lahf andnf ah, mask CPU_CARRY shr 8 mov bx, sp ornf ss:[bx+8], ah ; 8 = 2 (ax) + 2 (bx) + 2 (ip) + 2 (cs) pop ax pop bx iret DOSWaitPostHandler endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DOSWaitPostGuardian %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Guardian routine for wait/post. Zeroes dosWPCount so DOSWaitPostHandler can tell when it is receiving too many calls. CALLED BY: Continual Timer PASS: ax = dgroup RETURN: nothing DESTROYED: anything PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 3/10/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DOSWaitPostGuardian proc far .enter mov ds, ax if TEST_WAIT_POST mov ax, ds:[dosWPCount] cmp ax, ds:[dosWPMaxCount] jbe zeroCounter mov ds:[dosWPMaxCount], ax zeroCounter: endif mov ds:[dosWPCount], 0 .leave ret DOSWaitPostGuardian endp if FULL_EXECUTE_IN_PLACE ResidentXIP ends Resident segment resource endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DOSWaitPostExit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Reset wait/post vector if we grabbed it. CALLED BY: DOSExit PASS: ds = dgroup RETURN: nothing DESTROYED: ax, es, di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ardeb 3/11/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DOSWaitPostExit proc near .enter tst ds:[dosWaitPostOn] jz done mov ax, WAIT_POST_INTERRUPT mov di, offset dosWaitPostSave segmov es, ds call SysResetInterrupt done: .leave ret DOSWaitPostExit endp Resident ends
20.923788
80
0.590508
05bf0a6461d14faefb9ec4398bbf5abb2b2a004f
275
asm
Assembly
libsrc/stdio/spectrum/getk.asm
grancier/z180
e83f35e36c9b4d1457e40585019430e901c86ed9
[ "ClArtistic" ]
null
null
null
libsrc/stdio/spectrum/getk.asm
grancier/z180
e83f35e36c9b4d1457e40585019430e901c86ed9
[ "ClArtistic" ]
null
null
null
libsrc/stdio/spectrum/getk.asm
grancier/z180
e83f35e36c9b4d1457e40585019430e901c86ed9
[ "ClArtistic" ]
1
2019-12-03T23:57:48.000Z
2019-12-03T23:57:48.000Z
; ; Devilishly simple Spectrum Routines ; ; getk() Read key status ; ; 17/5/99 djm ; ; ; $Id: getk.asm,v 1.6 2016/03/09 22:25:54 dom Exp $ ; SECTION code_clib PUBLIC getk PUBLIC _getk .getk ._getk ld h,0 ld a,(23560) ld l,a and a ret z xor a ld (23560),a ret
10.576923
51
0.632727
87aa09eab3dd4c5290428b4dceb9946bd498e27e
58,089
asm
Assembly
src/qt/qtwebkit/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
zwollerob/PhantomJS_AMR6VL
71c126e98a8c32950158d04d0bd75823cd008b99
[ "BSD-3-Clause" ]
null
null
null
src/qt/qtwebkit/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
zwollerob/PhantomJS_AMR6VL
71c126e98a8c32950158d04d0bd75823cd008b99
[ "BSD-3-Clause" ]
null
null
null
src/qt/qtwebkit/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
zwollerob/PhantomJS_AMR6VL
71c126e98a8c32950158d04d0bd75823cd008b99
[ "BSD-3-Clause" ]
null
null
null
# Copyright (C) 2011, 2012 Apple Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF # THE POSSIBILITY OF SUCH DAMAGE. # Crash course on the language that this is written in (which I just call # "assembly" even though it's more than that): # # - Mostly gas-style operand ordering. The last operand tends to be the # destination. So "a := b" is written as "mov b, a". But unlike gas, # comparisons are in-order, so "if (a < b)" is written as # "bilt a, b, ...". # # - "b" = byte, "h" = 16-bit word, "i" = 32-bit word, "p" = pointer. # Currently this is just 32-bit so "i" and "p" are interchangeable # except when an op supports one but not the other. # # - In general, valid operands for macro invocations and instructions are # registers (eg "t0"), addresses (eg "4[t0]"), base-index addresses # (eg "7[t0, t1, 2]"), absolute addresses (eg "0xa0000000[]"), or labels # (eg "_foo" or ".foo"). Macro invocations can also take anonymous # macros as operands. Instructions cannot take anonymous macros. # # - Labels must have names that begin with either "_" or ".". A "." label # is local and gets renamed before code gen to minimize namespace # pollution. A "_" label is an extern symbol (i.e. ".globl"). The "_" # may or may not be removed during code gen depending on whether the asm # conventions for C name mangling on the target platform mandate a "_" # prefix. # # - A "macro" is a lambda expression, which may be either anonymous or # named. But this has caveats. "macro" can take zero or more arguments, # which may be macros or any valid operands, but it can only return # code. But you can do Turing-complete things via continuation passing # style: "macro foo (a, b) b(a) end foo(foo, foo)". Actually, don't do # that, since you'll just crash the assembler. # # - An "if" is a conditional on settings. Any identifier supplied in the # predicate of an "if" is assumed to be a #define that is available # during code gen. So you can't use "if" for computation in a macro, but # you can use it to select different pieces of code for different # platforms. # # - Arguments to macros follow lexical scoping rather than dynamic scoping. # Const's also follow lexical scoping and may override (hide) arguments # or other consts. All variables (arguments and constants) can be bound # to operands. Additionally, arguments (but not constants) can be bound # to macros. # Below we have a bunch of constant declarations. Each constant must have # a corresponding ASSERT() in LLIntData.cpp. # Value representation constants. const Int32Tag = -1 const BooleanTag = -2 const NullTag = -3 const UndefinedTag = -4 const CellTag = -5 const EmptyValueTag = -6 const DeletedValueTag = -7 const LowestTag = DeletedValueTag # Utilities macro dispatch(advance) addp advance * 4, PC jmp [PC] end macro dispatchBranchWithOffset(pcOffset) lshifti 2, pcOffset addp pcOffset, PC jmp [PC] end macro dispatchBranch(pcOffset) loadi pcOffset, t0 dispatchBranchWithOffset(t0) end macro dispatchAfterCall() loadi ArgumentCount + TagOffset[cfr], PC jmp [PC] end macro cCall2(function, arg1, arg2) if ARM or ARMv7 or ARMv7_TRADITIONAL move arg1, t0 move arg2, t1 call function elsif X86 poke arg1, 0 poke arg2, 1 call function elsif MIPS or SH4 move arg1, a0 move arg2, a1 call function elsif C_LOOP cloopCallSlowPath function, arg1, arg2 else error end end # This barely works. arg3 and arg4 should probably be immediates. macro cCall4(function, arg1, arg2, arg3, arg4) if ARM or ARMv7 or ARMv7_TRADITIONAL move arg1, t0 move arg2, t1 move arg3, t2 move arg4, t3 call function elsif X86 poke arg1, 0 poke arg2, 1 poke arg3, 2 poke arg4, 3 call function elsif MIPS or SH4 move arg1, a0 move arg2, a1 move arg3, a2 move arg4, a3 call function elsif C_LOOP error else error end end macro callSlowPath(slowPath) cCall2(slowPath, cfr, PC) move t0, PC move t1, cfr end # Debugging operation if you'd like to print an operand in the instruction stream. fromWhere # should be an immediate integer - any integer you like; use it to identify the place you're # debugging from. operand should likewise be an immediate, and should identify the operand # in the instruction stream you'd like to print out. macro traceOperand(fromWhere, operand) cCall4(_llint_trace_operand, cfr, PC, fromWhere, operand) move t0, PC move t1, cfr end # Debugging operation if you'd like to print the value of an operand in the instruction # stream. Same as traceOperand(), but assumes that the operand is a register, and prints its # value. macro traceValue(fromWhere, operand) cCall4(_llint_trace_value, cfr, PC, fromWhere, operand) move t0, PC move t1, cfr end # Call a slowPath for call opcodes. macro callCallSlowPath(advance, slowPath, action) addp advance * 4, PC, t0 storep t0, ArgumentCount + TagOffset[cfr] cCall2(slowPath, cfr, PC) move t1, cfr action(t0) end macro callWatchdogTimerHandler(throwHandler) storei PC, ArgumentCount + TagOffset[cfr] cCall2(_llint_slow_path_handle_watchdog_timer, cfr, PC) move t1, cfr btpnz t0, throwHandler loadi ArgumentCount + TagOffset[cfr], PC end macro checkSwitchToJITForLoop() checkSwitchToJIT( 1, macro () storei PC, ArgumentCount + TagOffset[cfr] cCall2(_llint_loop_osr, cfr, PC) move t1, cfr btpz t0, .recover jmp t0 .recover: loadi ArgumentCount + TagOffset[cfr], PC end) end # Index, tag, and payload must be different registers. Index is not # changed. macro loadConstantOrVariable(index, tag, payload) bigteq index, FirstConstantRegisterIndex, .constant loadi TagOffset[cfr, index, 8], tag loadi PayloadOffset[cfr, index, 8], payload jmp .done .constant: loadp CodeBlock[cfr], payload loadp CodeBlock::m_constantRegisters + VectorBufferOffset[payload], payload # There is a bit of evil here: if the index contains a value >= FirstConstantRegisterIndex, # then value << 3 will be equal to (value - FirstConstantRegisterIndex) << 3. loadp TagOffset[payload, index, 8], tag loadp PayloadOffset[payload, index, 8], payload .done: end macro loadConstantOrVariableTag(index, tag) bigteq index, FirstConstantRegisterIndex, .constant loadi TagOffset[cfr, index, 8], tag jmp .done .constant: loadp CodeBlock[cfr], tag loadp CodeBlock::m_constantRegisters + VectorBufferOffset[tag], tag # There is a bit of evil here: if the index contains a value >= FirstConstantRegisterIndex, # then value << 3 will be equal to (value - FirstConstantRegisterIndex) << 3. loadp TagOffset[tag, index, 8], tag .done: end # Index and payload may be the same register. Index may be clobbered. macro loadConstantOrVariable2Reg(index, tag, payload) bigteq index, FirstConstantRegisterIndex, .constant loadi TagOffset[cfr, index, 8], tag loadi PayloadOffset[cfr, index, 8], payload jmp .done .constant: loadp CodeBlock[cfr], tag loadp CodeBlock::m_constantRegisters + VectorBufferOffset[tag], tag # There is a bit of evil here: if the index contains a value >= FirstConstantRegisterIndex, # then value << 3 will be equal to (value - FirstConstantRegisterIndex) << 3. lshifti 3, index addp index, tag loadp PayloadOffset[tag], payload loadp TagOffset[tag], tag .done: end macro loadConstantOrVariablePayloadTagCustom(index, tagCheck, payload) bigteq index, FirstConstantRegisterIndex, .constant tagCheck(TagOffset[cfr, index, 8]) loadi PayloadOffset[cfr, index, 8], payload jmp .done .constant: loadp CodeBlock[cfr], payload loadp CodeBlock::m_constantRegisters + VectorBufferOffset[payload], payload # There is a bit of evil here: if the index contains a value >= FirstConstantRegisterIndex, # then value << 3 will be equal to (value - FirstConstantRegisterIndex) << 3. tagCheck(TagOffset[payload, index, 8]) loadp PayloadOffset[payload, index, 8], payload .done: end # Index and payload must be different registers. Index is not mutated. Use # this if you know what the tag of the variable should be. Doing the tag # test as part of loading the variable reduces register use, but may not # be faster than doing loadConstantOrVariable followed by a branch on the # tag. macro loadConstantOrVariablePayload(index, expectedTag, payload, slow) loadConstantOrVariablePayloadTagCustom( index, macro (actualTag) bineq actualTag, expectedTag, slow end, payload) end macro loadConstantOrVariablePayloadUnchecked(index, payload) loadConstantOrVariablePayloadTagCustom( index, macro (actualTag) end, payload) end macro writeBarrier(tag, payload) # Nothing to do, since we don't have a generational or incremental collector. end macro valueProfile(tag, payload, profile) if VALUE_PROFILER storei tag, ValueProfile::m_buckets + TagOffset[profile] storei payload, ValueProfile::m_buckets + PayloadOffset[profile] end end # Entrypoints into the interpreter # Expects that CodeBlock is in t1, which is what prologue() leaves behind. macro functionArityCheck(doneLabel, slow_path) loadi PayloadOffset + ArgumentCount[cfr], t0 biaeq t0, CodeBlock::m_numParameters[t1], doneLabel cCall2(slow_path, cfr, PC) # This slow_path has a simple protocol: t0 = 0 => no error, t0 != 0 => error move t1, cfr btiz t0, .continue loadp JITStackFrame::vm[sp], t1 loadp VM::callFrameForThrow[t1], t0 jmp VM::targetMachinePCForThrow[t1] .continue: # Reload CodeBlock and PC, since the slow_path clobbered it. loadp CodeBlock[cfr], t1 loadp CodeBlock::m_instructions[t1], PC jmp doneLabel end # Instruction implementations _llint_op_enter: traceExecution() loadp CodeBlock[cfr], t2 // t2<CodeBlock> = cfr.CodeBlock loadi CodeBlock::m_numVars[t2], t2 // t2<size_t> = t2<CodeBlock>.m_numVars btiz t2, .opEnterDone move UndefinedTag, t0 move 0, t1 .opEnterLoop: subi 1, t2 storei t0, TagOffset[cfr, t2, 8] storei t1, PayloadOffset[cfr, t2, 8] btinz t2, .opEnterLoop .opEnterDone: dispatch(1) _llint_op_create_activation: traceExecution() loadi 4[PC], t0 bineq TagOffset[cfr, t0, 8], EmptyValueTag, .opCreateActivationDone callSlowPath(_llint_slow_path_create_activation) .opCreateActivationDone: dispatch(2) _llint_op_init_lazy_reg: traceExecution() loadi 4[PC], t0 storei EmptyValueTag, TagOffset[cfr, t0, 8] storei 0, PayloadOffset[cfr, t0, 8] dispatch(2) _llint_op_create_arguments: traceExecution() loadi 4[PC], t0 bineq TagOffset[cfr, t0, 8], EmptyValueTag, .opCreateArgumentsDone callSlowPath(_llint_slow_path_create_arguments) .opCreateArgumentsDone: dispatch(2) _llint_op_create_this: traceExecution() loadi 8[PC], t0 loadp PayloadOffset[cfr, t0, 8], t0 loadp JSFunction::m_allocationProfile + ObjectAllocationProfile::m_allocator[t0], t1 loadp JSFunction::m_allocationProfile + ObjectAllocationProfile::m_structure[t0], t2 btpz t1, .opCreateThisSlow allocateJSObject(t1, t2, t0, t3, .opCreateThisSlow) loadi 4[PC], t1 storei CellTag, TagOffset[cfr, t1, 8] storei t0, PayloadOffset[cfr, t1, 8] dispatch(4) .opCreateThisSlow: callSlowPath(_llint_slow_path_create_this) dispatch(4) _llint_op_get_callee: traceExecution() loadi 4[PC], t0 loadp PayloadOffset + Callee[cfr], t1 loadp 8[PC], t2 valueProfile(CellTag, t1, t2) storei CellTag, TagOffset[cfr, t0, 8] storei t1, PayloadOffset[cfr, t0, 8] dispatch(3) _llint_op_convert_this: traceExecution() loadi 4[PC], t0 bineq TagOffset[cfr, t0, 8], CellTag, .opConvertThisSlow loadi PayloadOffset[cfr, t0, 8], t0 loadp JSCell::m_structure[t0], t0 bbb Structure::m_typeInfo + TypeInfo::m_type[t0], ObjectType, .opConvertThisSlow loadi 8[PC], t1 valueProfile(CellTag, t0, t1) dispatch(3) .opConvertThisSlow: callSlowPath(_llint_slow_path_convert_this) dispatch(3) _llint_op_new_object: traceExecution() loadpFromInstruction(3, t0) loadp ObjectAllocationProfile::m_allocator[t0], t1 loadp ObjectAllocationProfile::m_structure[t0], t2 allocateJSObject(t1, t2, t0, t3, .opNewObjectSlow) loadi 4[PC], t1 storei CellTag, TagOffset[cfr, t1, 8] storei t0, PayloadOffset[cfr, t1, 8] dispatch(4) .opNewObjectSlow: callSlowPath(_llint_slow_path_new_object) dispatch(4) _llint_op_mov: traceExecution() loadi 8[PC], t1 loadi 4[PC], t0 loadConstantOrVariable(t1, t2, t3) storei t2, TagOffset[cfr, t0, 8] storei t3, PayloadOffset[cfr, t0, 8] dispatch(3) _llint_op_not: traceExecution() loadi 8[PC], t0 loadi 4[PC], t1 loadConstantOrVariable(t0, t2, t3) bineq t2, BooleanTag, .opNotSlow xori 1, t3 storei t2, TagOffset[cfr, t1, 8] storei t3, PayloadOffset[cfr, t1, 8] dispatch(3) .opNotSlow: callSlowPath(_llint_slow_path_not) dispatch(3) _llint_op_eq: traceExecution() loadi 12[PC], t2 loadi 8[PC], t0 loadConstantOrVariable(t2, t3, t1) loadConstantOrVariable2Reg(t0, t2, t0) bineq t2, t3, .opEqSlow bieq t2, CellTag, .opEqSlow bib t2, LowestTag, .opEqSlow loadi 4[PC], t2 cieq t0, t1, t0 storei BooleanTag, TagOffset[cfr, t2, 8] storei t0, PayloadOffset[cfr, t2, 8] dispatch(4) .opEqSlow: callSlowPath(_llint_slow_path_eq) dispatch(4) _llint_op_eq_null: traceExecution() loadi 8[PC], t0 loadi 4[PC], t3 assertNotConstant(t0) loadi TagOffset[cfr, t0, 8], t1 loadi PayloadOffset[cfr, t0, 8], t0 bineq t1, CellTag, .opEqNullImmediate loadp JSCell::m_structure[t0], t1 btbnz Structure::m_typeInfo + TypeInfo::m_flags[t1], MasqueradesAsUndefined, .opEqNullMasqueradesAsUndefined move 0, t1 jmp .opEqNullNotImmediate .opEqNullMasqueradesAsUndefined: loadp CodeBlock[cfr], t0 loadp CodeBlock::m_globalObject[t0], t0 cpeq Structure::m_globalObject[t1], t0, t1 jmp .opEqNullNotImmediate .opEqNullImmediate: cieq t1, NullTag, t2 cieq t1, UndefinedTag, t1 ori t2, t1 .opEqNullNotImmediate: storei BooleanTag, TagOffset[cfr, t3, 8] storei t1, PayloadOffset[cfr, t3, 8] dispatch(3) _llint_op_neq: traceExecution() loadi 12[PC], t2 loadi 8[PC], t0 loadConstantOrVariable(t2, t3, t1) loadConstantOrVariable2Reg(t0, t2, t0) bineq t2, t3, .opNeqSlow bieq t2, CellTag, .opNeqSlow bib t2, LowestTag, .opNeqSlow loadi 4[PC], t2 cineq t0, t1, t0 storei BooleanTag, TagOffset[cfr, t2, 8] storei t0, PayloadOffset[cfr, t2, 8] dispatch(4) .opNeqSlow: callSlowPath(_llint_slow_path_neq) dispatch(4) _llint_op_neq_null: traceExecution() loadi 8[PC], t0 loadi 4[PC], t3 assertNotConstant(t0) loadi TagOffset[cfr, t0, 8], t1 loadi PayloadOffset[cfr, t0, 8], t0 bineq t1, CellTag, .opNeqNullImmediate loadp JSCell::m_structure[t0], t1 btbnz Structure::m_typeInfo + TypeInfo::m_flags[t1], MasqueradesAsUndefined, .opNeqNullMasqueradesAsUndefined move 1, t1 jmp .opNeqNullNotImmediate .opNeqNullMasqueradesAsUndefined: loadp CodeBlock[cfr], t0 loadp CodeBlock::m_globalObject[t0], t0 cpneq Structure::m_globalObject[t1], t0, t1 jmp .opNeqNullNotImmediate .opNeqNullImmediate: cineq t1, NullTag, t2 cineq t1, UndefinedTag, t1 andi t2, t1 .opNeqNullNotImmediate: storei BooleanTag, TagOffset[cfr, t3, 8] storei t1, PayloadOffset[cfr, t3, 8] dispatch(3) macro strictEq(equalityOperation, slowPath) loadi 12[PC], t2 loadi 8[PC], t0 loadConstantOrVariable(t2, t3, t1) loadConstantOrVariable2Reg(t0, t2, t0) bineq t2, t3, .slow bib t2, LowestTag, .slow bineq t2, CellTag, .notString loadp JSCell::m_structure[t0], t2 loadp JSCell::m_structure[t1], t3 bbneq Structure::m_typeInfo + TypeInfo::m_type[t2], StringType, .notString bbeq Structure::m_typeInfo + TypeInfo::m_type[t3], StringType, .slow .notString: loadi 4[PC], t2 equalityOperation(t0, t1, t0) storei BooleanTag, TagOffset[cfr, t2, 8] storei t0, PayloadOffset[cfr, t2, 8] dispatch(4) .slow: callSlowPath(slowPath) dispatch(4) end _llint_op_stricteq: traceExecution() strictEq(macro (left, right, result) cieq left, right, result end, _llint_slow_path_stricteq) _llint_op_nstricteq: traceExecution() strictEq(macro (left, right, result) cineq left, right, result end, _llint_slow_path_nstricteq) _llint_op_inc: traceExecution() loadi 4[PC], t0 bineq TagOffset[cfr, t0, 8], Int32Tag, .opIncSlow loadi PayloadOffset[cfr, t0, 8], t1 baddio 1, t1, .opIncSlow storei t1, PayloadOffset[cfr, t0, 8] dispatch(2) .opIncSlow: callSlowPath(_llint_slow_path_pre_inc) dispatch(2) _llint_op_dec: traceExecution() loadi 4[PC], t0 bineq TagOffset[cfr, t0, 8], Int32Tag, .opDecSlow loadi PayloadOffset[cfr, t0, 8], t1 bsubio 1, t1, .opDecSlow storei t1, PayloadOffset[cfr, t0, 8] dispatch(2) .opDecSlow: callSlowPath(_llint_slow_path_pre_dec) dispatch(2) _llint_op_to_number: traceExecution() loadi 8[PC], t0 loadi 4[PC], t1 loadConstantOrVariable(t0, t2, t3) bieq t2, Int32Tag, .opToNumberIsInt biaeq t2, LowestTag, .opToNumberSlow .opToNumberIsInt: storei t2, TagOffset[cfr, t1, 8] storei t3, PayloadOffset[cfr, t1, 8] dispatch(3) .opToNumberSlow: callSlowPath(_llint_slow_path_to_number) dispatch(3) _llint_op_negate: traceExecution() loadi 8[PC], t0 loadi 4[PC], t3 loadConstantOrVariable(t0, t1, t2) bineq t1, Int32Tag, .opNegateSrcNotInt btiz t2, 0x7fffffff, .opNegateSlow negi t2 storei Int32Tag, TagOffset[cfr, t3, 8] storei t2, PayloadOffset[cfr, t3, 8] dispatch(3) .opNegateSrcNotInt: bia t1, LowestTag, .opNegateSlow xori 0x80000000, t1 storei t1, TagOffset[cfr, t3, 8] storei t2, PayloadOffset[cfr, t3, 8] dispatch(3) .opNegateSlow: callSlowPath(_llint_slow_path_negate) dispatch(3) macro binaryOpCustomStore(integerOperationAndStore, doubleOperation, slowPath) loadi 12[PC], t2 loadi 8[PC], t0 loadConstantOrVariable(t2, t3, t1) loadConstantOrVariable2Reg(t0, t2, t0) bineq t2, Int32Tag, .op1NotInt bineq t3, Int32Tag, .op2NotInt loadi 4[PC], t2 integerOperationAndStore(t3, t1, t0, .slow, t2) dispatch(5) .op1NotInt: # First operand is definitely not an int, the second operand could be anything. bia t2, LowestTag, .slow bib t3, LowestTag, .op1NotIntOp2Double bineq t3, Int32Tag, .slow ci2d t1, ft1 jmp .op1NotIntReady .op1NotIntOp2Double: fii2d t1, t3, ft1 .op1NotIntReady: loadi 4[PC], t1 fii2d t0, t2, ft0 doubleOperation(ft1, ft0) stored ft0, [cfr, t1, 8] dispatch(5) .op2NotInt: # First operand is definitely an int, the second operand is definitely not. loadi 4[PC], t2 bia t3, LowestTag, .slow ci2d t0, ft0 fii2d t1, t3, ft1 doubleOperation(ft1, ft0) stored ft0, [cfr, t2, 8] dispatch(5) .slow: callSlowPath(slowPath) dispatch(5) end macro binaryOp(integerOperation, doubleOperation, slowPath) binaryOpCustomStore( macro (int32Tag, left, right, slow, index) integerOperation(left, right, slow) storei int32Tag, TagOffset[cfr, index, 8] storei right, PayloadOffset[cfr, index, 8] end, doubleOperation, slowPath) end _llint_op_add: traceExecution() binaryOp( macro (left, right, slow) baddio left, right, slow end, macro (left, right) addd left, right end, _llint_slow_path_add) _llint_op_mul: traceExecution() binaryOpCustomStore( macro (int32Tag, left, right, slow, index) const scratch = int32Tag # We know that we can reuse the int32Tag register since it has a constant. move right, scratch bmulio left, scratch, slow btinz scratch, .done bilt left, 0, slow bilt right, 0, slow .done: storei Int32Tag, TagOffset[cfr, index, 8] storei scratch, PayloadOffset[cfr, index, 8] end, macro (left, right) muld left, right end, _llint_slow_path_mul) _llint_op_sub: traceExecution() binaryOp( macro (left, right, slow) bsubio left, right, slow end, macro (left, right) subd left, right end, _llint_slow_path_sub) _llint_op_div: traceExecution() binaryOpCustomStore( macro (int32Tag, left, right, slow, index) ci2d left, ft0 ci2d right, ft1 divd ft0, ft1 bcd2i ft1, right, .notInt storei int32Tag, TagOffset[cfr, index, 8] storei right, PayloadOffset[cfr, index, 8] jmp .done .notInt: stored ft1, [cfr, index, 8] .done: end, macro (left, right) divd left, right end, _llint_slow_path_div) macro bitOp(operation, slowPath, advance) loadi 12[PC], t2 loadi 8[PC], t0 loadConstantOrVariable(t2, t3, t1) loadConstantOrVariable2Reg(t0, t2, t0) bineq t3, Int32Tag, .slow bineq t2, Int32Tag, .slow loadi 4[PC], t2 operation(t1, t0, .slow) storei t3, TagOffset[cfr, t2, 8] storei t0, PayloadOffset[cfr, t2, 8] dispatch(advance) .slow: callSlowPath(slowPath) dispatch(advance) end _llint_op_lshift: traceExecution() bitOp( macro (left, right, slow) lshifti left, right end, _llint_slow_path_lshift, 4) _llint_op_rshift: traceExecution() bitOp( macro (left, right, slow) rshifti left, right end, _llint_slow_path_rshift, 4) _llint_op_urshift: traceExecution() bitOp( macro (left, right, slow) urshifti left, right bilt right, 0, slow end, _llint_slow_path_urshift, 4) _llint_op_bitand: traceExecution() bitOp( macro (left, right, slow) andi left, right end, _llint_slow_path_bitand, 5) _llint_op_bitxor: traceExecution() bitOp( macro (left, right, slow) xori left, right end, _llint_slow_path_bitxor, 5) _llint_op_bitor: traceExecution() bitOp( macro (left, right, slow) ori left, right end, _llint_slow_path_bitor, 5) _llint_op_check_has_instance: traceExecution() loadi 12[PC], t1 loadConstantOrVariablePayload(t1, CellTag, t0, .opCheckHasInstanceSlow) loadp JSCell::m_structure[t0], t0 btbz Structure::m_typeInfo + TypeInfo::m_flags[t0], ImplementsDefaultHasInstance, .opCheckHasInstanceSlow dispatch(5) .opCheckHasInstanceSlow: callSlowPath(_llint_slow_path_check_has_instance) dispatch(0) _llint_op_instanceof: traceExecution() # Actually do the work. loadi 12[PC], t0 loadi 4[PC], t3 loadConstantOrVariablePayload(t0, CellTag, t1, .opInstanceofSlow) loadp JSCell::m_structure[t1], t2 bbb Structure::m_typeInfo + TypeInfo::m_type[t2], ObjectType, .opInstanceofSlow loadi 8[PC], t0 loadConstantOrVariablePayload(t0, CellTag, t2, .opInstanceofSlow) # Register state: t1 = prototype, t2 = value move 1, t0 .opInstanceofLoop: loadp JSCell::m_structure[t2], t2 loadi Structure::m_prototype + PayloadOffset[t2], t2 bpeq t2, t1, .opInstanceofDone btinz t2, .opInstanceofLoop move 0, t0 .opInstanceofDone: storei BooleanTag, TagOffset[cfr, t3, 8] storei t0, PayloadOffset[cfr, t3, 8] dispatch(4) .opInstanceofSlow: callSlowPath(_llint_slow_path_instanceof) dispatch(4) _llint_op_is_undefined: traceExecution() loadi 8[PC], t1 loadi 4[PC], t0 loadConstantOrVariable(t1, t2, t3) storei BooleanTag, TagOffset[cfr, t0, 8] bieq t2, CellTag, .opIsUndefinedCell cieq t2, UndefinedTag, t3 storei t3, PayloadOffset[cfr, t0, 8] dispatch(3) .opIsUndefinedCell: loadp JSCell::m_structure[t3], t1 btbnz Structure::m_typeInfo + TypeInfo::m_flags[t1], MasqueradesAsUndefined, .opIsUndefinedMasqueradesAsUndefined move 0, t1 storei t1, PayloadOffset[cfr, t0, 8] dispatch(3) .opIsUndefinedMasqueradesAsUndefined: loadp CodeBlock[cfr], t3 loadp CodeBlock::m_globalObject[t3], t3 cpeq Structure::m_globalObject[t1], t3, t1 storei t1, PayloadOffset[cfr, t0, 8] dispatch(3) _llint_op_is_boolean: traceExecution() loadi 8[PC], t1 loadi 4[PC], t2 loadConstantOrVariableTag(t1, t0) cieq t0, BooleanTag, t0 storei BooleanTag, TagOffset[cfr, t2, 8] storei t0, PayloadOffset[cfr, t2, 8] dispatch(3) _llint_op_is_number: traceExecution() loadi 8[PC], t1 loadi 4[PC], t2 loadConstantOrVariableTag(t1, t0) storei BooleanTag, TagOffset[cfr, t2, 8] addi 1, t0 cib t0, LowestTag + 1, t1 storei t1, PayloadOffset[cfr, t2, 8] dispatch(3) _llint_op_is_string: traceExecution() loadi 8[PC], t1 loadi 4[PC], t2 loadConstantOrVariable(t1, t0, t3) storei BooleanTag, TagOffset[cfr, t2, 8] bineq t0, CellTag, .opIsStringNotCell loadp JSCell::m_structure[t3], t0 cbeq Structure::m_typeInfo + TypeInfo::m_type[t0], StringType, t1 storei t1, PayloadOffset[cfr, t2, 8] dispatch(3) .opIsStringNotCell: storep 0, PayloadOffset[cfr, t2, 8] dispatch(3) macro loadPropertyAtVariableOffsetKnownNotInline(propertyOffset, objectAndStorage, tag, payload) assert(macro (ok) bigteq propertyOffset, firstOutOfLineOffset, ok end) negi propertyOffset loadp JSObject::m_butterfly[objectAndStorage], objectAndStorage loadi TagOffset + (firstOutOfLineOffset - 2) * 8[objectAndStorage, propertyOffset, 8], tag loadi PayloadOffset + (firstOutOfLineOffset - 2) * 8[objectAndStorage, propertyOffset, 8], payload end macro loadPropertyAtVariableOffset(propertyOffset, objectAndStorage, tag, payload) bilt propertyOffset, firstOutOfLineOffset, .isInline loadp JSObject::m_butterfly[objectAndStorage], objectAndStorage negi propertyOffset jmp .ready .isInline: addp sizeof JSObject - (firstOutOfLineOffset - 2) * 8, objectAndStorage .ready: loadi TagOffset + (firstOutOfLineOffset - 2) * 8[objectAndStorage, propertyOffset, 8], tag loadi PayloadOffset + (firstOutOfLineOffset - 2) * 8[objectAndStorage, propertyOffset, 8], payload end macro resolveGlobal(size, slow) # Operands are as follows: # 4[PC] Destination for the load. # 8[PC] Property identifier index in the code block. # 12[PC] Structure pointer, initialized to 0 by bytecode generator. # 16[PC] Offset in global object, initialized to 0 by bytecode generator. loadp CodeBlock[cfr], t0 loadp CodeBlock::m_globalObject[t0], t0 loadp JSCell::m_structure[t0], t1 bpneq t1, 12[PC], slow loadi 16[PC], t1 loadPropertyAtVariableOffsetKnownNotInline(t1, t0, t2, t3) loadi 4[PC], t0 storei t2, TagOffset[cfr, t0, 8] storei t3, PayloadOffset[cfr, t0, 8] loadi (size - 1) * 4[PC], t0 valueProfile(t2, t3, t0) end _llint_op_init_global_const: traceExecution() loadi 8[PC], t1 loadi 4[PC], t0 loadConstantOrVariable(t1, t2, t3) writeBarrier(t2, t3) storei t2, TagOffset[t0] storei t3, PayloadOffset[t0] dispatch(5) _llint_op_init_global_const_check: traceExecution() loadp 12[PC], t2 loadi 8[PC], t1 loadi 4[PC], t0 btbnz [t2], .opInitGlobalConstCheckSlow loadConstantOrVariable(t1, t2, t3) writeBarrier(t2, t3) storei t2, TagOffset[t0] storei t3, PayloadOffset[t0] dispatch(5) .opInitGlobalConstCheckSlow: callSlowPath(_llint_slow_path_init_global_const_check) dispatch(5) # We only do monomorphic get_by_id caching for now, and we do not modify the # opcode. We do, however, allow for the cache to change anytime if fails, since # ping-ponging is free. At best we get lucky and the get_by_id will continue # to take fast path on the new cache. At worst we take slow path, which is what # we would have been doing anyway. macro getById(getPropertyStorage) traceExecution() loadi 8[PC], t0 loadi 16[PC], t1 loadConstantOrVariablePayload(t0, CellTag, t3, .opGetByIdSlow) loadi 20[PC], t2 getPropertyStorage( t3, t0, macro (propertyStorage, scratch) bpneq JSCell::m_structure[t3], t1, .opGetByIdSlow loadi 4[PC], t1 loadi TagOffset[propertyStorage, t2], scratch loadi PayloadOffset[propertyStorage, t2], t2 storei scratch, TagOffset[cfr, t1, 8] storei t2, PayloadOffset[cfr, t1, 8] loadi 32[PC], t1 valueProfile(scratch, t2, t1) dispatch(9) end) .opGetByIdSlow: callSlowPath(_llint_slow_path_get_by_id) dispatch(9) end _llint_op_get_by_id: getById(withInlineStorage) _llint_op_get_by_id_out_of_line: getById(withOutOfLineStorage) _llint_op_get_array_length: traceExecution() loadi 8[PC], t0 loadp 16[PC], t1 loadConstantOrVariablePayload(t0, CellTag, t3, .opGetArrayLengthSlow) loadp JSCell::m_structure[t3], t2 arrayProfile(t2, t1, t0) btiz t2, IsArray, .opGetArrayLengthSlow btiz t2, IndexingShapeMask, .opGetArrayLengthSlow loadi 4[PC], t1 loadp 32[PC], t2 loadp JSObject::m_butterfly[t3], t0 loadi -sizeof IndexingHeader + IndexingHeader::u.lengths.publicLength[t0], t0 bilt t0, 0, .opGetArrayLengthSlow valueProfile(Int32Tag, t0, t2) storep t0, PayloadOffset[cfr, t1, 8] storep Int32Tag, TagOffset[cfr, t1, 8] dispatch(9) .opGetArrayLengthSlow: callSlowPath(_llint_slow_path_get_by_id) dispatch(9) _llint_op_get_arguments_length: traceExecution() loadi 8[PC], t0 loadi 4[PC], t1 bineq TagOffset[cfr, t0, 8], EmptyValueTag, .opGetArgumentsLengthSlow loadi ArgumentCount + PayloadOffset[cfr], t2 subi 1, t2 storei Int32Tag, TagOffset[cfr, t1, 8] storei t2, PayloadOffset[cfr, t1, 8] dispatch(4) .opGetArgumentsLengthSlow: callSlowPath(_llint_slow_path_get_arguments_length) dispatch(4) macro putById(getPropertyStorage) traceExecution() loadi 4[PC], t3 loadi 16[PC], t1 loadConstantOrVariablePayload(t3, CellTag, t0, .opPutByIdSlow) loadi 12[PC], t2 getPropertyStorage( t0, t3, macro (propertyStorage, scratch) bpneq JSCell::m_structure[t0], t1, .opPutByIdSlow loadi 20[PC], t1 loadConstantOrVariable2Reg(t2, scratch, t2) writeBarrier(scratch, t2) storei scratch, TagOffset[propertyStorage, t1] storei t2, PayloadOffset[propertyStorage, t1] dispatch(9) end) end _llint_op_put_by_id: putById(withInlineStorage) .opPutByIdSlow: callSlowPath(_llint_slow_path_put_by_id) dispatch(9) _llint_op_put_by_id_out_of_line: putById(withOutOfLineStorage) macro putByIdTransition(additionalChecks, getPropertyStorage) traceExecution() loadi 4[PC], t3 loadi 16[PC], t1 loadConstantOrVariablePayload(t3, CellTag, t0, .opPutByIdSlow) loadi 12[PC], t2 bpneq JSCell::m_structure[t0], t1, .opPutByIdSlow additionalChecks(t1, t3) loadi 20[PC], t1 getPropertyStorage( t0, t3, macro (propertyStorage, scratch) addp t1, propertyStorage, t3 loadConstantOrVariable2Reg(t2, t1, t2) writeBarrier(t1, t2) storei t1, TagOffset[t3] loadi 24[PC], t1 storei t2, PayloadOffset[t3] storep t1, JSCell::m_structure[t0] dispatch(9) end) end macro noAdditionalChecks(oldStructure, scratch) end macro structureChainChecks(oldStructure, scratch) const protoCell = oldStructure # Reusing the oldStructure register for the proto loadp 28[PC], scratch assert(macro (ok) btpnz scratch, ok end) loadp StructureChain::m_vector[scratch], scratch assert(macro (ok) btpnz scratch, ok end) bieq Structure::m_prototype + TagOffset[oldStructure], NullTag, .done .loop: loadi Structure::m_prototype + PayloadOffset[oldStructure], protoCell loadp JSCell::m_structure[protoCell], oldStructure bpneq oldStructure, [scratch], .opPutByIdSlow addp 4, scratch bineq Structure::m_prototype + TagOffset[oldStructure], NullTag, .loop .done: end _llint_op_put_by_id_transition_direct: putByIdTransition(noAdditionalChecks, withInlineStorage) _llint_op_put_by_id_transition_direct_out_of_line: putByIdTransition(noAdditionalChecks, withOutOfLineStorage) _llint_op_put_by_id_transition_normal: putByIdTransition(structureChainChecks, withInlineStorage) _llint_op_put_by_id_transition_normal_out_of_line: putByIdTransition(structureChainChecks, withOutOfLineStorage) _llint_op_get_by_val: traceExecution() loadi 8[PC], t2 loadConstantOrVariablePayload(t2, CellTag, t0, .opGetByValSlow) loadp JSCell::m_structure[t0], t2 loadp 16[PC], t3 arrayProfile(t2, t3, t1) loadi 12[PC], t3 loadConstantOrVariablePayload(t3, Int32Tag, t1, .opGetByValSlow) loadp JSObject::m_butterfly[t0], t3 andi IndexingShapeMask, t2 bieq t2, Int32Shape, .opGetByValIsContiguous bineq t2, ContiguousShape, .opGetByValNotContiguous .opGetByValIsContiguous: biaeq t1, -sizeof IndexingHeader + IndexingHeader::u.lengths.publicLength[t3], .opGetByValOutOfBounds loadi TagOffset[t3, t1, 8], t2 loadi PayloadOffset[t3, t1, 8], t1 jmp .opGetByValDone .opGetByValNotContiguous: bineq t2, DoubleShape, .opGetByValNotDouble biaeq t1, -sizeof IndexingHeader + IndexingHeader::u.lengths.publicLength[t3], .opGetByValOutOfBounds loadd [t3, t1, 8], ft0 bdnequn ft0, ft0, .opGetByValSlow # FIXME: This could be massively optimized. fd2ii ft0, t1, t2 loadi 4[PC], t0 jmp .opGetByValNotEmpty .opGetByValNotDouble: subi ArrayStorageShape, t2 bia t2, SlowPutArrayStorageShape - ArrayStorageShape, .opGetByValSlow biaeq t1, -sizeof IndexingHeader + IndexingHeader::u.lengths.vectorLength[t3], .opGetByValOutOfBounds loadi ArrayStorage::m_vector + TagOffset[t3, t1, 8], t2 loadi ArrayStorage::m_vector + PayloadOffset[t3, t1, 8], t1 .opGetByValDone: loadi 4[PC], t0 bieq t2, EmptyValueTag, .opGetByValOutOfBounds .opGetByValNotEmpty: storei t2, TagOffset[cfr, t0, 8] storei t1, PayloadOffset[cfr, t0, 8] loadi 20[PC], t0 valueProfile(t2, t1, t0) dispatch(6) .opGetByValOutOfBounds: if VALUE_PROFILER loadpFromInstruction(4, t0) storeb 1, ArrayProfile::m_outOfBounds[t0] end .opGetByValSlow: callSlowPath(_llint_slow_path_get_by_val) dispatch(6) _llint_op_get_argument_by_val: # FIXME: At some point we should array profile this. Right now it isn't necessary # since the DFG will never turn a get_argument_by_val into a GetByVal. traceExecution() loadi 8[PC], t0 loadi 12[PC], t1 bineq TagOffset[cfr, t0, 8], EmptyValueTag, .opGetArgumentByValSlow loadConstantOrVariablePayload(t1, Int32Tag, t2, .opGetArgumentByValSlow) addi 1, t2 loadi ArgumentCount + PayloadOffset[cfr], t1 biaeq t2, t1, .opGetArgumentByValSlow negi t2 loadi 4[PC], t3 loadi ThisArgumentOffset + TagOffset[cfr, t2, 8], t0 loadi ThisArgumentOffset + PayloadOffset[cfr, t2, 8], t1 loadi 20[PC], t2 storei t0, TagOffset[cfr, t3, 8] storei t1, PayloadOffset[cfr, t3, 8] valueProfile(t0, t1, t2) dispatch(6) .opGetArgumentByValSlow: callSlowPath(_llint_slow_path_get_argument_by_val) dispatch(6) _llint_op_get_by_pname: traceExecution() loadi 12[PC], t0 loadConstantOrVariablePayload(t0, CellTag, t1, .opGetByPnameSlow) loadi 16[PC], t0 bpneq t1, PayloadOffset[cfr, t0, 8], .opGetByPnameSlow loadi 8[PC], t0 loadConstantOrVariablePayload(t0, CellTag, t2, .opGetByPnameSlow) loadi 20[PC], t0 loadi PayloadOffset[cfr, t0, 8], t3 loadp JSCell::m_structure[t2], t0 bpneq t0, JSPropertyNameIterator::m_cachedStructure[t3], .opGetByPnameSlow loadi 24[PC], t0 loadi [cfr, t0, 8], t0 subi 1, t0 biaeq t0, JSPropertyNameIterator::m_numCacheableSlots[t3], .opGetByPnameSlow bilt t0, JSPropertyNameIterator::m_cachedStructureInlineCapacity[t3], .opGetByPnameInlineProperty addi firstOutOfLineOffset, t0 subi JSPropertyNameIterator::m_cachedStructureInlineCapacity[t3], t0 .opGetByPnameInlineProperty: loadPropertyAtVariableOffset(t0, t2, t1, t3) loadi 4[PC], t0 storei t1, TagOffset[cfr, t0, 8] storei t3, PayloadOffset[cfr, t0, 8] dispatch(7) .opGetByPnameSlow: callSlowPath(_llint_slow_path_get_by_pname) dispatch(7) macro contiguousPutByVal(storeCallback) biaeq t3, -sizeof IndexingHeader + IndexingHeader::u.lengths.publicLength[t0], .outOfBounds .storeResult: loadi 12[PC], t2 storeCallback(t2, t1, t0, t3) dispatch(5) .outOfBounds: biaeq t3, -sizeof IndexingHeader + IndexingHeader::u.lengths.vectorLength[t0], .opPutByValOutOfBounds if VALUE_PROFILER loadp 16[PC], t2 storeb 1, ArrayProfile::m_mayStoreToHole[t2] end addi 1, t3, t2 storei t2, -sizeof IndexingHeader + IndexingHeader::u.lengths.publicLength[t0] jmp .storeResult end _llint_op_put_by_val: traceExecution() loadi 4[PC], t0 loadConstantOrVariablePayload(t0, CellTag, t1, .opPutByValSlow) loadp JSCell::m_structure[t1], t2 loadp 16[PC], t3 arrayProfile(t2, t3, t0) loadi 8[PC], t0 loadConstantOrVariablePayload(t0, Int32Tag, t3, .opPutByValSlow) loadp JSObject::m_butterfly[t1], t0 andi IndexingShapeMask, t2 bineq t2, Int32Shape, .opPutByValNotInt32 contiguousPutByVal( macro (operand, scratch, base, index) loadConstantOrVariablePayload(operand, Int32Tag, scratch, .opPutByValSlow) storei Int32Tag, TagOffset[base, index, 8] storei scratch, PayloadOffset[base, index, 8] end) .opPutByValNotInt32: bineq t2, DoubleShape, .opPutByValNotDouble contiguousPutByVal( macro (operand, scratch, base, index) const tag = scratch const payload = operand loadConstantOrVariable2Reg(operand, tag, payload) bineq tag, Int32Tag, .notInt ci2d payload, ft0 jmp .ready .notInt: fii2d payload, tag, ft0 bdnequn ft0, ft0, .opPutByValSlow .ready: stored ft0, [base, index, 8] end) .opPutByValNotDouble: bineq t2, ContiguousShape, .opPutByValNotContiguous contiguousPutByVal( macro (operand, scratch, base, index) const tag = scratch const payload = operand loadConstantOrVariable2Reg(operand, tag, payload) writeBarrier(tag, payload) storei tag, TagOffset[base, index, 8] storei payload, PayloadOffset[base, index, 8] end) .opPutByValNotContiguous: bineq t2, ArrayStorageShape, .opPutByValSlow biaeq t3, -sizeof IndexingHeader + IndexingHeader::u.lengths.vectorLength[t0], .opPutByValOutOfBounds bieq ArrayStorage::m_vector + TagOffset[t0, t3, 8], EmptyValueTag, .opPutByValArrayStorageEmpty .opPutByValArrayStorageStoreResult: loadi 12[PC], t2 loadConstantOrVariable2Reg(t2, t1, t2) writeBarrier(t1, t2) storei t1, ArrayStorage::m_vector + TagOffset[t0, t3, 8] storei t2, ArrayStorage::m_vector + PayloadOffset[t0, t3, 8] dispatch(5) .opPutByValArrayStorageEmpty: if VALUE_PROFILER loadp 16[PC], t1 storeb 1, ArrayProfile::m_mayStoreToHole[t1] end addi 1, ArrayStorage::m_numValuesInVector[t0] bib t3, -sizeof IndexingHeader + IndexingHeader::u.lengths.publicLength[t0], .opPutByValArrayStorageStoreResult addi 1, t3, t1 storei t1, -sizeof IndexingHeader + IndexingHeader::u.lengths.publicLength[t0] jmp .opPutByValArrayStorageStoreResult .opPutByValOutOfBounds: if VALUE_PROFILER loadpFromInstruction(4, t0) storeb 1, ArrayProfile::m_outOfBounds[t0] end .opPutByValSlow: callSlowPath(_llint_slow_path_put_by_val) dispatch(5) _llint_op_jmp: traceExecution() dispatchBranch(4[PC]) macro jumpTrueOrFalse(conditionOp, slow) loadi 4[PC], t1 loadConstantOrVariablePayload(t1, BooleanTag, t0, .slow) conditionOp(t0, .target) dispatch(3) .target: dispatchBranch(8[PC]) .slow: callSlowPath(slow) dispatch(0) end macro equalNull(cellHandler, immediateHandler) loadi 4[PC], t0 assertNotConstant(t0) loadi TagOffset[cfr, t0, 8], t1 loadi PayloadOffset[cfr, t0, 8], t0 bineq t1, CellTag, .immediate loadp JSCell::m_structure[t0], t2 cellHandler(t2, Structure::m_typeInfo + TypeInfo::m_flags[t2], .target) dispatch(3) .target: dispatchBranch(8[PC]) .immediate: ori 1, t1 immediateHandler(t1, .target) dispatch(3) end _llint_op_jeq_null: traceExecution() equalNull( macro (structure, value, target) btbz value, MasqueradesAsUndefined, .opJeqNullNotMasqueradesAsUndefined loadp CodeBlock[cfr], t0 loadp CodeBlock::m_globalObject[t0], t0 bpeq Structure::m_globalObject[structure], t0, target .opJeqNullNotMasqueradesAsUndefined: end, macro (value, target) bieq value, NullTag, target end) _llint_op_jneq_null: traceExecution() equalNull( macro (structure, value, target) btbz value, MasqueradesAsUndefined, target loadp CodeBlock[cfr], t0 loadp CodeBlock::m_globalObject[t0], t0 bpneq Structure::m_globalObject[structure], t0, target end, macro (value, target) bineq value, NullTag, target end) _llint_op_jneq_ptr: traceExecution() loadi 4[PC], t0 loadi 8[PC], t1 loadp CodeBlock[cfr], t2 loadp CodeBlock::m_globalObject[t2], t2 bineq TagOffset[cfr, t0, 8], CellTag, .opJneqPtrBranch loadp JSGlobalObject::m_specialPointers[t2, t1, 4], t1 bpeq PayloadOffset[cfr, t0, 8], t1, .opJneqPtrFallThrough .opJneqPtrBranch: dispatchBranch(12[PC]) .opJneqPtrFallThrough: dispatch(4) macro compare(integerCompare, doubleCompare, slowPath) loadi 4[PC], t2 loadi 8[PC], t3 loadConstantOrVariable(t2, t0, t1) loadConstantOrVariable2Reg(t3, t2, t3) bineq t0, Int32Tag, .op1NotInt bineq t2, Int32Tag, .op2NotInt integerCompare(t1, t3, .jumpTarget) dispatch(4) .op1NotInt: bia t0, LowestTag, .slow bib t2, LowestTag, .op1NotIntOp2Double bineq t2, Int32Tag, .slow ci2d t3, ft1 jmp .op1NotIntReady .op1NotIntOp2Double: fii2d t3, t2, ft1 .op1NotIntReady: fii2d t1, t0, ft0 doubleCompare(ft0, ft1, .jumpTarget) dispatch(4) .op2NotInt: ci2d t1, ft0 bia t2, LowestTag, .slow fii2d t3, t2, ft1 doubleCompare(ft0, ft1, .jumpTarget) dispatch(4) .jumpTarget: dispatchBranch(12[PC]) .slow: callSlowPath(slowPath) dispatch(0) end _llint_op_switch_imm: traceExecution() loadi 12[PC], t2 loadi 4[PC], t3 loadConstantOrVariable(t2, t1, t0) loadp CodeBlock[cfr], t2 loadp CodeBlock::m_rareData[t2], t2 muli sizeof SimpleJumpTable, t3 # FIXME: would be nice to peephole this! loadp CodeBlock::RareData::m_immediateSwitchJumpTables + VectorBufferOffset[t2], t2 addp t3, t2 bineq t1, Int32Tag, .opSwitchImmNotInt subi SimpleJumpTable::min[t2], t0 biaeq t0, SimpleJumpTable::branchOffsets + VectorSizeOffset[t2], .opSwitchImmFallThrough loadp SimpleJumpTable::branchOffsets + VectorBufferOffset[t2], t3 loadi [t3, t0, 4], t1 btiz t1, .opSwitchImmFallThrough dispatchBranchWithOffset(t1) .opSwitchImmNotInt: bib t1, LowestTag, .opSwitchImmSlow # Go to slow path if it's a double. .opSwitchImmFallThrough: dispatchBranch(8[PC]) .opSwitchImmSlow: callSlowPath(_llint_slow_path_switch_imm) dispatch(0) _llint_op_switch_char: traceExecution() loadi 12[PC], t2 loadi 4[PC], t3 loadConstantOrVariable(t2, t1, t0) loadp CodeBlock[cfr], t2 loadp CodeBlock::m_rareData[t2], t2 muli sizeof SimpleJumpTable, t3 loadp CodeBlock::RareData::m_characterSwitchJumpTables + VectorBufferOffset[t2], t2 addp t3, t2 bineq t1, CellTag, .opSwitchCharFallThrough loadp JSCell::m_structure[t0], t1 bbneq Structure::m_typeInfo + TypeInfo::m_type[t1], StringType, .opSwitchCharFallThrough bineq JSString::m_length[t0], 1, .opSwitchCharFallThrough loadp JSString::m_value[t0], t0 btpz t0, .opSwitchOnRope loadp StringImpl::m_data8[t0], t1 btinz StringImpl::m_hashAndFlags[t0], HashFlags8BitBuffer, .opSwitchChar8Bit loadh [t1], t0 jmp .opSwitchCharReady .opSwitchChar8Bit: loadb [t1], t0 .opSwitchCharReady: subi SimpleJumpTable::min[t2], t0 biaeq t0, SimpleJumpTable::branchOffsets + VectorSizeOffset[t2], .opSwitchCharFallThrough loadp SimpleJumpTable::branchOffsets + VectorBufferOffset[t2], t2 loadi [t2, t0, 4], t1 btiz t1, .opSwitchCharFallThrough dispatchBranchWithOffset(t1) .opSwitchCharFallThrough: dispatchBranch(8[PC]) .opSwitchOnRope: callSlowPath(_llint_slow_path_switch_char) dispatch(0) _llint_op_new_func: traceExecution() btiz 12[PC], .opNewFuncUnchecked loadi 4[PC], t1 bineq TagOffset[cfr, t1, 8], EmptyValueTag, .opNewFuncDone .opNewFuncUnchecked: callSlowPath(_llint_slow_path_new_func) .opNewFuncDone: dispatch(4) macro arrayProfileForCall() if VALUE_PROFILER loadi 12[PC], t3 bineq ThisArgumentOffset + TagOffset[cfr, t3, 8], CellTag, .done loadi ThisArgumentOffset + PayloadOffset[cfr, t3, 8], t0 loadp JSCell::m_structure[t0], t0 loadp 20[PC], t1 storep t0, ArrayProfile::m_lastSeenStructure[t1] .done: end end macro doCall(slowPath) loadi 4[PC], t0 loadi 16[PC], t1 loadp LLIntCallLinkInfo::callee[t1], t2 loadConstantOrVariablePayload(t0, CellTag, t3, .opCallSlow) bineq t3, t2, .opCallSlow loadi 12[PC], t3 addp 24, PC lshifti 3, t3 addp cfr, t3 # t3 contains the new value of cfr loadp JSFunction::m_scope[t2], t0 storei t2, Callee + PayloadOffset[t3] storei t0, ScopeChain + PayloadOffset[t3] loadi 8 - 24[PC], t2 storei PC, ArgumentCount + TagOffset[cfr] storep cfr, CallerFrame[t3] storei t2, ArgumentCount + PayloadOffset[t3] storei CellTag, Callee + TagOffset[t3] storei CellTag, ScopeChain + TagOffset[t3] move t3, cfr callTargetFunction(t1) .opCallSlow: slowPathForCall(6, slowPath) end _llint_op_tear_off_activation: traceExecution() loadi 4[PC], t0 bieq TagOffset[cfr, t0, 8], EmptyValueTag, .opTearOffActivationNotCreated callSlowPath(_llint_slow_path_tear_off_activation) .opTearOffActivationNotCreated: dispatch(2) _llint_op_tear_off_arguments: traceExecution() loadi 4[PC], t0 subi 1, t0 # Get the unmodifiedArgumentsRegister bieq TagOffset[cfr, t0, 8], EmptyValueTag, .opTearOffArgumentsNotCreated callSlowPath(_llint_slow_path_tear_off_arguments) .opTearOffArgumentsNotCreated: dispatch(3) _llint_op_ret: traceExecution() checkSwitchToJITForEpilogue() loadi 4[PC], t2 loadConstantOrVariable(t2, t1, t0) doReturn() _llint_op_call_put_result: loadi 4[PC], t2 loadi 8[PC], t3 storei t1, TagOffset[cfr, t2, 8] storei t0, PayloadOffset[cfr, t2, 8] valueProfile(t1, t0, t3) traceExecution() # Needs to be here because it would clobber t1, t0 dispatch(3) _llint_op_ret_object_or_this: traceExecution() checkSwitchToJITForEpilogue() loadi 4[PC], t2 loadConstantOrVariable(t2, t1, t0) bineq t1, CellTag, .opRetObjectOrThisNotObject loadp JSCell::m_structure[t0], t2 bbb Structure::m_typeInfo + TypeInfo::m_type[t2], ObjectType, .opRetObjectOrThisNotObject doReturn() .opRetObjectOrThisNotObject: loadi 8[PC], t2 loadConstantOrVariable(t2, t1, t0) doReturn() _llint_op_to_primitive: traceExecution() loadi 8[PC], t2 loadi 4[PC], t3 loadConstantOrVariable(t2, t1, t0) bineq t1, CellTag, .opToPrimitiveIsImm loadp JSCell::m_structure[t0], t2 bbneq Structure::m_typeInfo + TypeInfo::m_type[t2], StringType, .opToPrimitiveSlowCase .opToPrimitiveIsImm: storei t1, TagOffset[cfr, t3, 8] storei t0, PayloadOffset[cfr, t3, 8] dispatch(3) .opToPrimitiveSlowCase: callSlowPath(_llint_slow_path_to_primitive) dispatch(3) _llint_op_next_pname: traceExecution() loadi 12[PC], t1 loadi 16[PC], t2 loadi PayloadOffset[cfr, t1, 8], t0 bieq t0, PayloadOffset[cfr, t2, 8], .opNextPnameEnd loadi 20[PC], t2 loadi PayloadOffset[cfr, t2, 8], t2 loadp JSPropertyNameIterator::m_jsStrings[t2], t3 loadi PayloadOffset[t3, t0, 8], t3 addi 1, t0 storei t0, PayloadOffset[cfr, t1, 8] loadi 4[PC], t1 storei CellTag, TagOffset[cfr, t1, 8] storei t3, PayloadOffset[cfr, t1, 8] loadi 8[PC], t3 loadi PayloadOffset[cfr, t3, 8], t3 loadp JSCell::m_structure[t3], t1 bpneq t1, JSPropertyNameIterator::m_cachedStructure[t2], .opNextPnameSlow loadp JSPropertyNameIterator::m_cachedPrototypeChain[t2], t0 loadp StructureChain::m_vector[t0], t0 btpz [t0], .opNextPnameTarget .opNextPnameCheckPrototypeLoop: bieq Structure::m_prototype + TagOffset[t1], NullTag, .opNextPnameSlow loadp Structure::m_prototype + PayloadOffset[t1], t2 loadp JSCell::m_structure[t2], t1 bpneq t1, [t0], .opNextPnameSlow addp 4, t0 btpnz [t0], .opNextPnameCheckPrototypeLoop .opNextPnameTarget: dispatchBranch(24[PC]) .opNextPnameEnd: dispatch(7) .opNextPnameSlow: callSlowPath(_llint_slow_path_next_pname) # This either keeps the PC where it was (causing us to loop) or sets it to target. dispatch(0) _llint_op_catch: # This is where we end up from the JIT's throw trampoline (because the # machine code return address will be set to _llint_op_catch), and from # the interpreter's throw trampoline (see _llint_throw_trampoline). # The JIT throwing protocol calls for the cfr to be in t0. The throwing # code must have known that we were throwing to the interpreter, and have # set VM::targetInterpreterPCForThrow. move t0, cfr loadp JITStackFrame::vm[sp], t3 loadi VM::targetInterpreterPCForThrow[t3], PC loadi VM::exception + PayloadOffset[t3], t0 loadi VM::exception + TagOffset[t3], t1 storei 0, VM::exception + PayloadOffset[t3] storei EmptyValueTag, VM::exception + TagOffset[t3] loadi 4[PC], t2 storei t0, PayloadOffset[cfr, t2, 8] storei t1, TagOffset[cfr, t2, 8] traceExecution() # This needs to be here because we don't want to clobber t0, t1, t2, t3 above. dispatch(2) # Gives you the scope in t0, while allowing you to optionally perform additional checks on the # scopes as they are traversed. scopeCheck() is called with two arguments: the register # holding the scope, and a register that can be used for scratch. Note that this does not # use t3, so you can hold stuff in t3 if need be. macro getDeBruijnScope(deBruijinIndexOperand, scopeCheck) loadp ScopeChain + PayloadOffset[cfr], t0 loadi deBruijinIndexOperand, t2 btiz t2, .done loadp CodeBlock[cfr], t1 bineq CodeBlock::m_codeType[t1], FunctionCode, .loop btbz CodeBlock::m_needsActivation[t1], .loop loadi CodeBlock::m_activationRegister[t1], t1 # Need to conditionally skip over one scope. bieq TagOffset[cfr, t1, 8], EmptyValueTag, .noActivation scopeCheck(t0, t1) loadp JSScope::m_next[t0], t0 .noActivation: subi 1, t2 btiz t2, .done .loop: scopeCheck(t0, t1) loadp JSScope::m_next[t0], t0 subi 1, t2 btinz t2, .loop .done: end _llint_op_get_scoped_var: traceExecution() # Operands are as follows: # 4[PC] Destination for the load. # 8[PC] Index of register in the scope. # 12[PC] De Bruijin index. getDeBruijnScope(12[PC], macro (scope, scratch) end) loadi 4[PC], t1 loadi 8[PC], t2 loadp JSVariableObject::m_registers[t0], t0 loadi TagOffset[t0, t2, 8], t3 loadi PayloadOffset[t0, t2, 8], t0 storei t3, TagOffset[cfr, t1, 8] storei t0, PayloadOffset[cfr, t1, 8] loadi 16[PC], t1 valueProfile(t3, t0, t1) dispatch(5) _llint_op_put_scoped_var: traceExecution() getDeBruijnScope(8[PC], macro (scope, scratch) end) loadi 12[PC], t1 loadConstantOrVariable(t1, t3, t2) loadi 4[PC], t1 writeBarrier(t3, t2) loadp JSVariableObject::m_registers[t0], t0 storei t3, TagOffset[t0, t1, 8] storei t2, PayloadOffset[t0, t1, 8] dispatch(4) _llint_op_end: traceExecution() checkSwitchToJITForEpilogue() loadi 4[PC], t0 assertNotConstant(t0) loadi TagOffset[cfr, t0, 8], t1 loadi PayloadOffset[cfr, t0, 8], t0 doReturn() _llint_throw_from_slow_path_trampoline: # When throwing from the interpreter (i.e. throwing from LLIntSlowPaths), so # the throw target is not necessarily interpreted code, we come to here. # This essentially emulates the JIT's throwing protocol. loadp JITStackFrame::vm[sp], t1 loadp VM::callFrameForThrow[t1], t0 jmp VM::targetMachinePCForThrow[t1] _llint_throw_during_call_trampoline: preserveReturnAddressAfterCall(t2) loadp JITStackFrame::vm[sp], t1 loadp VM::callFrameForThrow[t1], t0 jmp VM::targetMachinePCForThrow[t1] macro nativeCallTrampoline(executableOffsetToFunction) storep 0, CodeBlock[cfr] loadp CallerFrame[cfr], t0 loadi ScopeChain + PayloadOffset[t0], t1 storei CellTag, ScopeChain + TagOffset[cfr] storei t1, ScopeChain + PayloadOffset[cfr] if X86 loadp JITStackFrame::vm + 4[sp], t3 # Additional offset for return address storep cfr, VM::topCallFrame[t3] peek 0, t1 storep t1, ReturnPC[cfr] move cfr, t2 # t2 = ecx subp 16 - 4, sp loadi Callee + PayloadOffset[cfr], t1 loadp JSFunction::m_executable[t1], t1 move t0, cfr call executableOffsetToFunction[t1] addp 16 - 4, sp loadp JITStackFrame::vm + 4[sp], t3 elsif ARM or ARMv7 or ARMv7_TRADITIONAL loadp JITStackFrame::vm[sp], t3 storep cfr, VM::topCallFrame[t3] move t0, t2 preserveReturnAddressAfterCall(t3) storep t3, ReturnPC[cfr] move cfr, t0 loadi Callee + PayloadOffset[cfr], t1 loadp JSFunction::m_executable[t1], t1 move t2, cfr call executableOffsetToFunction[t1] restoreReturnAddressBeforeReturn(t3) loadp JITStackFrame::vm[sp], t3 elsif MIPS or SH4 loadp JITStackFrame::vm[sp], t3 storep cfr, VM::topCallFrame[t3] move t0, t2 preserveReturnAddressAfterCall(t3) storep t3, ReturnPC[cfr] move cfr, t0 loadi Callee + PayloadOffset[cfr], t1 loadp JSFunction::m_executable[t1], t1 move t2, cfr move t0, a0 call executableOffsetToFunction[t1] restoreReturnAddressBeforeReturn(t3) loadp JITStackFrame::vm[sp], t3 elsif C_LOOP loadp JITStackFrame::vm[sp], t3 storep cfr, VM::topCallFrame[t3] move t0, t2 preserveReturnAddressAfterCall(t3) storep t3, ReturnPC[cfr] move cfr, t0 loadi Callee + PayloadOffset[cfr], t1 loadp JSFunction::m_executable[t1], t1 move t2, cfr cloopCallNative executableOffsetToFunction[t1] restoreReturnAddressBeforeReturn(t3) loadp JITStackFrame::vm[sp], t3 else error end bineq VM::exception + TagOffset[t3], EmptyValueTag, .exception ret .exception: preserveReturnAddressAfterCall(t1) # This is really only needed on X86 loadi ArgumentCount + TagOffset[cfr], PC callSlowPath(_llint_throw_from_native_call) jmp _llint_throw_from_slow_path_trampoline end
30.42902
128
0.694693
2d3032856a493864c5b5a36e5d578f123ed5a2f6
52,714
asm
Assembly
ls.asm
joeofportland/project4final
4140c7c9293205eb6dcdadb5c8ed537e8e5c2f59
[ "MIT-0" ]
null
null
null
ls.asm
joeofportland/project4final
4140c7c9293205eb6dcdadb5c8ed537e8e5c2f59
[ "MIT-0" ]
null
null
null
ls.asm
joeofportland/project4final
4140c7c9293205eb6dcdadb5c8ed537e8e5c2f59
[ "MIT-0" ]
null
null
null
_ls: file format elf32-i386 Disassembly of section .text: 00000000 <fmtname>: #include "user.h" #include "fs.h" char* fmtname(char *path) { 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 53 push %ebx 4: 83 ec 24 sub $0x24,%esp static char buf[DIRSIZ+1]; char *p; // Find first character after last slash. for(p=path+strlen(path); p >= path && *p != '/'; p--) 7: 8b 45 08 mov 0x8(%ebp),%eax a: 89 04 24 mov %eax,(%esp) d: e8 dd 03 00 00 call 3ef <strlen> 12: 8b 55 08 mov 0x8(%ebp),%edx 15: 01 d0 add %edx,%eax 17: 89 45 f4 mov %eax,-0xc(%ebp) 1a: eb 04 jmp 20 <fmtname+0x20> 1c: 83 6d f4 01 subl $0x1,-0xc(%ebp) 20: 8b 45 f4 mov -0xc(%ebp),%eax 23: 3b 45 08 cmp 0x8(%ebp),%eax 26: 72 0a jb 32 <fmtname+0x32> 28: 8b 45 f4 mov -0xc(%ebp),%eax 2b: 0f b6 00 movzbl (%eax),%eax 2e: 3c 2f cmp $0x2f,%al 30: 75 ea jne 1c <fmtname+0x1c> ; p++; 32: 83 45 f4 01 addl $0x1,-0xc(%ebp) // Return blank-padded name. if(strlen(p) >= DIRSIZ) 36: 8b 45 f4 mov -0xc(%ebp),%eax 39: 89 04 24 mov %eax,(%esp) 3c: e8 ae 03 00 00 call 3ef <strlen> 41: 83 f8 0d cmp $0xd,%eax 44: 76 05 jbe 4b <fmtname+0x4b> return p; 46: 8b 45 f4 mov -0xc(%ebp),%eax 49: eb 5f jmp aa <fmtname+0xaa> memmove(buf, p, strlen(p)); 4b: 8b 45 f4 mov -0xc(%ebp),%eax 4e: 89 04 24 mov %eax,(%esp) 51: e8 99 03 00 00 call 3ef <strlen> 56: 89 44 24 08 mov %eax,0x8(%esp) 5a: 8b 45 f4 mov -0xc(%ebp),%eax 5d: 89 44 24 04 mov %eax,0x4(%esp) 61: c7 04 24 54 0e 00 00 movl $0xe54,(%esp) 68: e8 11 05 00 00 call 57e <memmove> memset(buf+strlen(p), ' ', DIRSIZ-strlen(p)); 6d: 8b 45 f4 mov -0xc(%ebp),%eax 70: 89 04 24 mov %eax,(%esp) 73: e8 77 03 00 00 call 3ef <strlen> 78: ba 0e 00 00 00 mov $0xe,%edx 7d: 89 d3 mov %edx,%ebx 7f: 29 c3 sub %eax,%ebx 81: 8b 45 f4 mov -0xc(%ebp),%eax 84: 89 04 24 mov %eax,(%esp) 87: e8 63 03 00 00 call 3ef <strlen> 8c: 05 54 0e 00 00 add $0xe54,%eax 91: 89 5c 24 08 mov %ebx,0x8(%esp) 95: c7 44 24 04 20 00 00 movl $0x20,0x4(%esp) 9c: 00 9d: 89 04 24 mov %eax,(%esp) a0: e8 71 03 00 00 call 416 <memset> return buf; a5: b8 54 0e 00 00 mov $0xe54,%eax } aa: 83 c4 24 add $0x24,%esp ad: 5b pop %ebx ae: 5d pop %ebp af: c3 ret 000000b0 <ls>: void ls(char *path) { b0: 55 push %ebp b1: 89 e5 mov %esp,%ebp b3: 57 push %edi b4: 56 push %esi b5: 53 push %ebx b6: 81 ec 5c 02 00 00 sub $0x25c,%esp char buf[512], *p; int fd; struct dirent de; struct stat st; if((fd = open(path, 0)) < 0){ bc: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) c3: 00 c4: 8b 45 08 mov 0x8(%ebp),%eax c7: 89 04 24 mov %eax,(%esp) ca: e8 34 05 00 00 call 603 <open> cf: 89 45 e4 mov %eax,-0x1c(%ebp) d2: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) d6: 79 20 jns f8 <ls+0x48> printf(2, "ls: cannot open %s\n", path); d8: 8b 45 08 mov 0x8(%ebp),%eax db: 89 44 24 08 mov %eax,0x8(%esp) df: c7 44 24 04 57 0b 00 movl $0xb57,0x4(%esp) e6: 00 e7: c7 04 24 02 00 00 00 movl $0x2,(%esp) ee: e8 98 06 00 00 call 78b <printf> return; f3: e9 01 02 00 00 jmp 2f9 <ls+0x249> } if(fstat(fd, &st) < 0){ f8: 8d 85 bc fd ff ff lea -0x244(%ebp),%eax fe: 89 44 24 04 mov %eax,0x4(%esp) 102: 8b 45 e4 mov -0x1c(%ebp),%eax 105: 89 04 24 mov %eax,(%esp) 108: e8 0e 05 00 00 call 61b <fstat> 10d: 85 c0 test %eax,%eax 10f: 79 2b jns 13c <ls+0x8c> printf(2, "ls: cannot stat %s\n", path); 111: 8b 45 08 mov 0x8(%ebp),%eax 114: 89 44 24 08 mov %eax,0x8(%esp) 118: c7 44 24 04 6b 0b 00 movl $0xb6b,0x4(%esp) 11f: 00 120: c7 04 24 02 00 00 00 movl $0x2,(%esp) 127: e8 5f 06 00 00 call 78b <printf> close(fd); 12c: 8b 45 e4 mov -0x1c(%ebp),%eax 12f: 89 04 24 mov %eax,(%esp) 132: e8 b4 04 00 00 call 5eb <close> return; 137: e9 bd 01 00 00 jmp 2f9 <ls+0x249> } switch(st.type){ 13c: 0f b7 85 bc fd ff ff movzwl -0x244(%ebp),%eax 143: 98 cwtl 144: 83 f8 01 cmp $0x1,%eax 147: 74 53 je 19c <ls+0xec> 149: 83 f8 02 cmp $0x2,%eax 14c: 0f 85 9c 01 00 00 jne 2ee <ls+0x23e> case T_FILE: printf(1, "%s %d %d %d\n", fmtname(path), st.type, st.ino, st.size); 152: 8b bd cc fd ff ff mov -0x234(%ebp),%edi 158: 8b b5 c4 fd ff ff mov -0x23c(%ebp),%esi 15e: 0f b7 85 bc fd ff ff movzwl -0x244(%ebp),%eax 165: 0f bf d8 movswl %ax,%ebx 168: 8b 45 08 mov 0x8(%ebp),%eax 16b: 89 04 24 mov %eax,(%esp) 16e: e8 8d fe ff ff call 0 <fmtname> 173: 89 7c 24 14 mov %edi,0x14(%esp) 177: 89 74 24 10 mov %esi,0x10(%esp) 17b: 89 5c 24 0c mov %ebx,0xc(%esp) 17f: 89 44 24 08 mov %eax,0x8(%esp) 183: c7 44 24 04 7f 0b 00 movl $0xb7f,0x4(%esp) 18a: 00 18b: c7 04 24 01 00 00 00 movl $0x1,(%esp) 192: e8 f4 05 00 00 call 78b <printf> break; 197: e9 52 01 00 00 jmp 2ee <ls+0x23e> case T_DIR: if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){ 19c: 8b 45 08 mov 0x8(%ebp),%eax 19f: 89 04 24 mov %eax,(%esp) 1a2: e8 48 02 00 00 call 3ef <strlen> 1a7: 83 c0 10 add $0x10,%eax 1aa: 3d 00 02 00 00 cmp $0x200,%eax 1af: 76 19 jbe 1ca <ls+0x11a> printf(1, "ls: path too long\n"); 1b1: c7 44 24 04 8c 0b 00 movl $0xb8c,0x4(%esp) 1b8: 00 1b9: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1c0: e8 c6 05 00 00 call 78b <printf> break; 1c5: e9 24 01 00 00 jmp 2ee <ls+0x23e> } strcpy(buf, path); 1ca: 8b 45 08 mov 0x8(%ebp),%eax 1cd: 89 44 24 04 mov %eax,0x4(%esp) 1d1: 8d 85 e0 fd ff ff lea -0x220(%ebp),%eax 1d7: 89 04 24 mov %eax,(%esp) 1da: e8 a1 01 00 00 call 380 <strcpy> p = buf+strlen(buf); 1df: 8d 85 e0 fd ff ff lea -0x220(%ebp),%eax 1e5: 89 04 24 mov %eax,(%esp) 1e8: e8 02 02 00 00 call 3ef <strlen> 1ed: 8d 95 e0 fd ff ff lea -0x220(%ebp),%edx 1f3: 01 d0 add %edx,%eax 1f5: 89 45 e0 mov %eax,-0x20(%ebp) *p++ = '/'; 1f8: 8b 45 e0 mov -0x20(%ebp),%eax 1fb: 8d 50 01 lea 0x1(%eax),%edx 1fe: 89 55 e0 mov %edx,-0x20(%ebp) 201: c6 00 2f movb $0x2f,(%eax) while(read(fd, &de, sizeof(de)) == sizeof(de)){ 204: e9 be 00 00 00 jmp 2c7 <ls+0x217> if(de.inum == 0) 209: 0f b7 85 d0 fd ff ff movzwl -0x230(%ebp),%eax 210: 66 85 c0 test %ax,%ax 213: 75 05 jne 21a <ls+0x16a> continue; 215: e9 ad 00 00 00 jmp 2c7 <ls+0x217> memmove(p, de.name, DIRSIZ); 21a: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp) 221: 00 222: 8d 85 d0 fd ff ff lea -0x230(%ebp),%eax 228: 83 c0 02 add $0x2,%eax 22b: 89 44 24 04 mov %eax,0x4(%esp) 22f: 8b 45 e0 mov -0x20(%ebp),%eax 232: 89 04 24 mov %eax,(%esp) 235: e8 44 03 00 00 call 57e <memmove> p[DIRSIZ] = 0; 23a: 8b 45 e0 mov -0x20(%ebp),%eax 23d: 83 c0 0e add $0xe,%eax 240: c6 00 00 movb $0x0,(%eax) if(stat(buf, &st) < 0){ 243: 8d 85 bc fd ff ff lea -0x244(%ebp),%eax 249: 89 44 24 04 mov %eax,0x4(%esp) 24d: 8d 85 e0 fd ff ff lea -0x220(%ebp),%eax 253: 89 04 24 mov %eax,(%esp) 256: e8 88 02 00 00 call 4e3 <stat> 25b: 85 c0 test %eax,%eax 25d: 79 20 jns 27f <ls+0x1cf> printf(1, "ls: cannot stat %s\n", buf); 25f: 8d 85 e0 fd ff ff lea -0x220(%ebp),%eax 265: 89 44 24 08 mov %eax,0x8(%esp) 269: c7 44 24 04 6b 0b 00 movl $0xb6b,0x4(%esp) 270: 00 271: c7 04 24 01 00 00 00 movl $0x1,(%esp) 278: e8 0e 05 00 00 call 78b <printf> continue; 27d: eb 48 jmp 2c7 <ls+0x217> } printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size); 27f: 8b bd cc fd ff ff mov -0x234(%ebp),%edi 285: 8b b5 c4 fd ff ff mov -0x23c(%ebp),%esi 28b: 0f b7 85 bc fd ff ff movzwl -0x244(%ebp),%eax 292: 0f bf d8 movswl %ax,%ebx 295: 8d 85 e0 fd ff ff lea -0x220(%ebp),%eax 29b: 89 04 24 mov %eax,(%esp) 29e: e8 5d fd ff ff call 0 <fmtname> 2a3: 89 7c 24 14 mov %edi,0x14(%esp) 2a7: 89 74 24 10 mov %esi,0x10(%esp) 2ab: 89 5c 24 0c mov %ebx,0xc(%esp) 2af: 89 44 24 08 mov %eax,0x8(%esp) 2b3: c7 44 24 04 7f 0b 00 movl $0xb7f,0x4(%esp) 2ba: 00 2bb: c7 04 24 01 00 00 00 movl $0x1,(%esp) 2c2: e8 c4 04 00 00 call 78b <printf> break; } strcpy(buf, path); p = buf+strlen(buf); *p++ = '/'; while(read(fd, &de, sizeof(de)) == sizeof(de)){ 2c7: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) 2ce: 00 2cf: 8d 85 d0 fd ff ff lea -0x230(%ebp),%eax 2d5: 89 44 24 04 mov %eax,0x4(%esp) 2d9: 8b 45 e4 mov -0x1c(%ebp),%eax 2dc: 89 04 24 mov %eax,(%esp) 2df: e8 f7 02 00 00 call 5db <read> 2e4: 83 f8 10 cmp $0x10,%eax 2e7: 0f 84 1c ff ff ff je 209 <ls+0x159> printf(1, "ls: cannot stat %s\n", buf); continue; } printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size); } break; 2ed: 90 nop } close(fd); 2ee: 8b 45 e4 mov -0x1c(%ebp),%eax 2f1: 89 04 24 mov %eax,(%esp) 2f4: e8 f2 02 00 00 call 5eb <close> } 2f9: 81 c4 5c 02 00 00 add $0x25c,%esp 2ff: 5b pop %ebx 300: 5e pop %esi 301: 5f pop %edi 302: 5d pop %ebp 303: c3 ret 00000304 <main>: int main(int argc, char *argv[]) { 304: 55 push %ebp 305: 89 e5 mov %esp,%ebp 307: 83 e4 f0 and $0xfffffff0,%esp 30a: 83 ec 20 sub $0x20,%esp int i; if(argc < 2){ 30d: 83 7d 08 01 cmpl $0x1,0x8(%ebp) 311: 7f 11 jg 324 <main+0x20> ls("."); 313: c7 04 24 9f 0b 00 00 movl $0xb9f,(%esp) 31a: e8 91 fd ff ff call b0 <ls> exit(); 31f: e8 9f 02 00 00 call 5c3 <exit> } for(i=1; i<argc; i++) 324: c7 44 24 1c 01 00 00 movl $0x1,0x1c(%esp) 32b: 00 32c: eb 1f jmp 34d <main+0x49> ls(argv[i]); 32e: 8b 44 24 1c mov 0x1c(%esp),%eax 332: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 339: 8b 45 0c mov 0xc(%ebp),%eax 33c: 01 d0 add %edx,%eax 33e: 8b 00 mov (%eax),%eax 340: 89 04 24 mov %eax,(%esp) 343: e8 68 fd ff ff call b0 <ls> if(argc < 2){ ls("."); exit(); } for(i=1; i<argc; i++) 348: 83 44 24 1c 01 addl $0x1,0x1c(%esp) 34d: 8b 44 24 1c mov 0x1c(%esp),%eax 351: 3b 45 08 cmp 0x8(%ebp),%eax 354: 7c d8 jl 32e <main+0x2a> ls(argv[i]); exit(); 356: e8 68 02 00 00 call 5c3 <exit> 0000035b <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 35b: 55 push %ebp 35c: 89 e5 mov %esp,%ebp 35e: 57 push %edi 35f: 53 push %ebx asm volatile("cld; rep stosb" : 360: 8b 4d 08 mov 0x8(%ebp),%ecx 363: 8b 55 10 mov 0x10(%ebp),%edx 366: 8b 45 0c mov 0xc(%ebp),%eax 369: 89 cb mov %ecx,%ebx 36b: 89 df mov %ebx,%edi 36d: 89 d1 mov %edx,%ecx 36f: fc cld 370: f3 aa rep stos %al,%es:(%edi) 372: 89 ca mov %ecx,%edx 374: 89 fb mov %edi,%ebx 376: 89 5d 08 mov %ebx,0x8(%ebp) 379: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 37c: 5b pop %ebx 37d: 5f pop %edi 37e: 5d pop %ebp 37f: c3 ret 00000380 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 380: 55 push %ebp 381: 89 e5 mov %esp,%ebp 383: 83 ec 10 sub $0x10,%esp char *os; os = s; 386: 8b 45 08 mov 0x8(%ebp),%eax 389: 89 45 fc mov %eax,-0x4(%ebp) while((*s++ = *t++) != 0) 38c: 90 nop 38d: 8b 45 08 mov 0x8(%ebp),%eax 390: 8d 50 01 lea 0x1(%eax),%edx 393: 89 55 08 mov %edx,0x8(%ebp) 396: 8b 55 0c mov 0xc(%ebp),%edx 399: 8d 4a 01 lea 0x1(%edx),%ecx 39c: 89 4d 0c mov %ecx,0xc(%ebp) 39f: 0f b6 12 movzbl (%edx),%edx 3a2: 88 10 mov %dl,(%eax) 3a4: 0f b6 00 movzbl (%eax),%eax 3a7: 84 c0 test %al,%al 3a9: 75 e2 jne 38d <strcpy+0xd> ; return os; 3ab: 8b 45 fc mov -0x4(%ebp),%eax } 3ae: c9 leave 3af: c3 ret 000003b0 <strcmp>: int strcmp(const char *p, const char *q) { 3b0: 55 push %ebp 3b1: 89 e5 mov %esp,%ebp while(*p && *p == *q) 3b3: eb 08 jmp 3bd <strcmp+0xd> p++, q++; 3b5: 83 45 08 01 addl $0x1,0x8(%ebp) 3b9: 83 45 0c 01 addl $0x1,0xc(%ebp) } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 3bd: 8b 45 08 mov 0x8(%ebp),%eax 3c0: 0f b6 00 movzbl (%eax),%eax 3c3: 84 c0 test %al,%al 3c5: 74 10 je 3d7 <strcmp+0x27> 3c7: 8b 45 08 mov 0x8(%ebp),%eax 3ca: 0f b6 10 movzbl (%eax),%edx 3cd: 8b 45 0c mov 0xc(%ebp),%eax 3d0: 0f b6 00 movzbl (%eax),%eax 3d3: 38 c2 cmp %al,%dl 3d5: 74 de je 3b5 <strcmp+0x5> p++, q++; return (uchar)*p - (uchar)*q; 3d7: 8b 45 08 mov 0x8(%ebp),%eax 3da: 0f b6 00 movzbl (%eax),%eax 3dd: 0f b6 d0 movzbl %al,%edx 3e0: 8b 45 0c mov 0xc(%ebp),%eax 3e3: 0f b6 00 movzbl (%eax),%eax 3e6: 0f b6 c0 movzbl %al,%eax 3e9: 29 c2 sub %eax,%edx 3eb: 89 d0 mov %edx,%eax } 3ed: 5d pop %ebp 3ee: c3 ret 000003ef <strlen>: uint strlen(char *s) { 3ef: 55 push %ebp 3f0: 89 e5 mov %esp,%ebp 3f2: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) 3f5: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 3fc: eb 04 jmp 402 <strlen+0x13> 3fe: 83 45 fc 01 addl $0x1,-0x4(%ebp) 402: 8b 55 fc mov -0x4(%ebp),%edx 405: 8b 45 08 mov 0x8(%ebp),%eax 408: 01 d0 add %edx,%eax 40a: 0f b6 00 movzbl (%eax),%eax 40d: 84 c0 test %al,%al 40f: 75 ed jne 3fe <strlen+0xf> ; return n; 411: 8b 45 fc mov -0x4(%ebp),%eax } 414: c9 leave 415: c3 ret 00000416 <memset>: void* memset(void *dst, int c, uint n) { 416: 55 push %ebp 417: 89 e5 mov %esp,%ebp 419: 83 ec 0c sub $0xc,%esp stosb(dst, c, n); 41c: 8b 45 10 mov 0x10(%ebp),%eax 41f: 89 44 24 08 mov %eax,0x8(%esp) 423: 8b 45 0c mov 0xc(%ebp),%eax 426: 89 44 24 04 mov %eax,0x4(%esp) 42a: 8b 45 08 mov 0x8(%ebp),%eax 42d: 89 04 24 mov %eax,(%esp) 430: e8 26 ff ff ff call 35b <stosb> return dst; 435: 8b 45 08 mov 0x8(%ebp),%eax } 438: c9 leave 439: c3 ret 0000043a <strchr>: char* strchr(const char *s, char c) { 43a: 55 push %ebp 43b: 89 e5 mov %esp,%ebp 43d: 83 ec 04 sub $0x4,%esp 440: 8b 45 0c mov 0xc(%ebp),%eax 443: 88 45 fc mov %al,-0x4(%ebp) for(; *s; s++) 446: eb 14 jmp 45c <strchr+0x22> if(*s == c) 448: 8b 45 08 mov 0x8(%ebp),%eax 44b: 0f b6 00 movzbl (%eax),%eax 44e: 3a 45 fc cmp -0x4(%ebp),%al 451: 75 05 jne 458 <strchr+0x1e> return (char*)s; 453: 8b 45 08 mov 0x8(%ebp),%eax 456: eb 13 jmp 46b <strchr+0x31> } char* strchr(const char *s, char c) { for(; *s; s++) 458: 83 45 08 01 addl $0x1,0x8(%ebp) 45c: 8b 45 08 mov 0x8(%ebp),%eax 45f: 0f b6 00 movzbl (%eax),%eax 462: 84 c0 test %al,%al 464: 75 e2 jne 448 <strchr+0xe> if(*s == c) return (char*)s; return 0; 466: b8 00 00 00 00 mov $0x0,%eax } 46b: c9 leave 46c: c3 ret 0000046d <gets>: char* gets(char *buf, int max) { 46d: 55 push %ebp 46e: 89 e5 mov %esp,%ebp 470: 83 ec 28 sub $0x28,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 473: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 47a: eb 4c jmp 4c8 <gets+0x5b> cc = read(0, &c, 1); 47c: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 483: 00 484: 8d 45 ef lea -0x11(%ebp),%eax 487: 89 44 24 04 mov %eax,0x4(%esp) 48b: c7 04 24 00 00 00 00 movl $0x0,(%esp) 492: e8 44 01 00 00 call 5db <read> 497: 89 45 f0 mov %eax,-0x10(%ebp) if(cc < 1) 49a: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 49e: 7f 02 jg 4a2 <gets+0x35> break; 4a0: eb 31 jmp 4d3 <gets+0x66> buf[i++] = c; 4a2: 8b 45 f4 mov -0xc(%ebp),%eax 4a5: 8d 50 01 lea 0x1(%eax),%edx 4a8: 89 55 f4 mov %edx,-0xc(%ebp) 4ab: 89 c2 mov %eax,%edx 4ad: 8b 45 08 mov 0x8(%ebp),%eax 4b0: 01 c2 add %eax,%edx 4b2: 0f b6 45 ef movzbl -0x11(%ebp),%eax 4b6: 88 02 mov %al,(%edx) if(c == '\n' || c == '\r') 4b8: 0f b6 45 ef movzbl -0x11(%ebp),%eax 4bc: 3c 0a cmp $0xa,%al 4be: 74 13 je 4d3 <gets+0x66> 4c0: 0f b6 45 ef movzbl -0x11(%ebp),%eax 4c4: 3c 0d cmp $0xd,%al 4c6: 74 0b je 4d3 <gets+0x66> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 4c8: 8b 45 f4 mov -0xc(%ebp),%eax 4cb: 83 c0 01 add $0x1,%eax 4ce: 3b 45 0c cmp 0xc(%ebp),%eax 4d1: 7c a9 jl 47c <gets+0xf> break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 4d3: 8b 55 f4 mov -0xc(%ebp),%edx 4d6: 8b 45 08 mov 0x8(%ebp),%eax 4d9: 01 d0 add %edx,%eax 4db: c6 00 00 movb $0x0,(%eax) return buf; 4de: 8b 45 08 mov 0x8(%ebp),%eax } 4e1: c9 leave 4e2: c3 ret 000004e3 <stat>: int stat(char *n, struct stat *st) { 4e3: 55 push %ebp 4e4: 89 e5 mov %esp,%ebp 4e6: 83 ec 28 sub $0x28,%esp int fd; int r; fd = open(n, O_RDONLY); 4e9: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 4f0: 00 4f1: 8b 45 08 mov 0x8(%ebp),%eax 4f4: 89 04 24 mov %eax,(%esp) 4f7: e8 07 01 00 00 call 603 <open> 4fc: 89 45 f4 mov %eax,-0xc(%ebp) if(fd < 0) 4ff: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 503: 79 07 jns 50c <stat+0x29> return -1; 505: b8 ff ff ff ff mov $0xffffffff,%eax 50a: eb 23 jmp 52f <stat+0x4c> r = fstat(fd, st); 50c: 8b 45 0c mov 0xc(%ebp),%eax 50f: 89 44 24 04 mov %eax,0x4(%esp) 513: 8b 45 f4 mov -0xc(%ebp),%eax 516: 89 04 24 mov %eax,(%esp) 519: e8 fd 00 00 00 call 61b <fstat> 51e: 89 45 f0 mov %eax,-0x10(%ebp) close(fd); 521: 8b 45 f4 mov -0xc(%ebp),%eax 524: 89 04 24 mov %eax,(%esp) 527: e8 bf 00 00 00 call 5eb <close> return r; 52c: 8b 45 f0 mov -0x10(%ebp),%eax } 52f: c9 leave 530: c3 ret 00000531 <atoi>: int atoi(const char *s) { 531: 55 push %ebp 532: 89 e5 mov %esp,%ebp 534: 83 ec 10 sub $0x10,%esp int n; n = 0; 537: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while('0' <= *s && *s <= '9') 53e: eb 25 jmp 565 <atoi+0x34> n = n*10 + *s++ - '0'; 540: 8b 55 fc mov -0x4(%ebp),%edx 543: 89 d0 mov %edx,%eax 545: c1 e0 02 shl $0x2,%eax 548: 01 d0 add %edx,%eax 54a: 01 c0 add %eax,%eax 54c: 89 c1 mov %eax,%ecx 54e: 8b 45 08 mov 0x8(%ebp),%eax 551: 8d 50 01 lea 0x1(%eax),%edx 554: 89 55 08 mov %edx,0x8(%ebp) 557: 0f b6 00 movzbl (%eax),%eax 55a: 0f be c0 movsbl %al,%eax 55d: 01 c8 add %ecx,%eax 55f: 83 e8 30 sub $0x30,%eax 562: 89 45 fc mov %eax,-0x4(%ebp) atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 565: 8b 45 08 mov 0x8(%ebp),%eax 568: 0f b6 00 movzbl (%eax),%eax 56b: 3c 2f cmp $0x2f,%al 56d: 7e 0a jle 579 <atoi+0x48> 56f: 8b 45 08 mov 0x8(%ebp),%eax 572: 0f b6 00 movzbl (%eax),%eax 575: 3c 39 cmp $0x39,%al 577: 7e c7 jle 540 <atoi+0xf> n = n*10 + *s++ - '0'; return n; 579: 8b 45 fc mov -0x4(%ebp),%eax } 57c: c9 leave 57d: c3 ret 0000057e <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 57e: 55 push %ebp 57f: 89 e5 mov %esp,%ebp 581: 83 ec 10 sub $0x10,%esp char *dst, *src; dst = vdst; 584: 8b 45 08 mov 0x8(%ebp),%eax 587: 89 45 fc mov %eax,-0x4(%ebp) src = vsrc; 58a: 8b 45 0c mov 0xc(%ebp),%eax 58d: 89 45 f8 mov %eax,-0x8(%ebp) while(n-- > 0) 590: eb 17 jmp 5a9 <memmove+0x2b> *dst++ = *src++; 592: 8b 45 fc mov -0x4(%ebp),%eax 595: 8d 50 01 lea 0x1(%eax),%edx 598: 89 55 fc mov %edx,-0x4(%ebp) 59b: 8b 55 f8 mov -0x8(%ebp),%edx 59e: 8d 4a 01 lea 0x1(%edx),%ecx 5a1: 89 4d f8 mov %ecx,-0x8(%ebp) 5a4: 0f b6 12 movzbl (%edx),%edx 5a7: 88 10 mov %dl,(%eax) { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 5a9: 8b 45 10 mov 0x10(%ebp),%eax 5ac: 8d 50 ff lea -0x1(%eax),%edx 5af: 89 55 10 mov %edx,0x10(%ebp) 5b2: 85 c0 test %eax,%eax 5b4: 7f dc jg 592 <memmove+0x14> *dst++ = *src++; return vdst; 5b6: 8b 45 08 mov 0x8(%ebp),%eax } 5b9: c9 leave 5ba: c3 ret 000005bb <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 5bb: b8 01 00 00 00 mov $0x1,%eax 5c0: cd 40 int $0x40 5c2: c3 ret 000005c3 <exit>: SYSCALL(exit) 5c3: b8 02 00 00 00 mov $0x2,%eax 5c8: cd 40 int $0x40 5ca: c3 ret 000005cb <wait>: SYSCALL(wait) 5cb: b8 03 00 00 00 mov $0x3,%eax 5d0: cd 40 int $0x40 5d2: c3 ret 000005d3 <pipe>: SYSCALL(pipe) 5d3: b8 04 00 00 00 mov $0x4,%eax 5d8: cd 40 int $0x40 5da: c3 ret 000005db <read>: SYSCALL(read) 5db: b8 05 00 00 00 mov $0x5,%eax 5e0: cd 40 int $0x40 5e2: c3 ret 000005e3 <write>: SYSCALL(write) 5e3: b8 10 00 00 00 mov $0x10,%eax 5e8: cd 40 int $0x40 5ea: c3 ret 000005eb <close>: SYSCALL(close) 5eb: b8 15 00 00 00 mov $0x15,%eax 5f0: cd 40 int $0x40 5f2: c3 ret 000005f3 <kill>: SYSCALL(kill) 5f3: b8 06 00 00 00 mov $0x6,%eax 5f8: cd 40 int $0x40 5fa: c3 ret 000005fb <exec>: SYSCALL(exec) 5fb: b8 07 00 00 00 mov $0x7,%eax 600: cd 40 int $0x40 602: c3 ret 00000603 <open>: SYSCALL(open) 603: b8 0f 00 00 00 mov $0xf,%eax 608: cd 40 int $0x40 60a: c3 ret 0000060b <mknod>: SYSCALL(mknod) 60b: b8 11 00 00 00 mov $0x11,%eax 610: cd 40 int $0x40 612: c3 ret 00000613 <unlink>: SYSCALL(unlink) 613: b8 12 00 00 00 mov $0x12,%eax 618: cd 40 int $0x40 61a: c3 ret 0000061b <fstat>: SYSCALL(fstat) 61b: b8 08 00 00 00 mov $0x8,%eax 620: cd 40 int $0x40 622: c3 ret 00000623 <link>: SYSCALL(link) 623: b8 13 00 00 00 mov $0x13,%eax 628: cd 40 int $0x40 62a: c3 ret 0000062b <mkdir>: SYSCALL(mkdir) 62b: b8 14 00 00 00 mov $0x14,%eax 630: cd 40 int $0x40 632: c3 ret 00000633 <chdir>: SYSCALL(chdir) 633: b8 09 00 00 00 mov $0x9,%eax 638: cd 40 int $0x40 63a: c3 ret 0000063b <dup>: SYSCALL(dup) 63b: b8 0a 00 00 00 mov $0xa,%eax 640: cd 40 int $0x40 642: c3 ret 00000643 <getpid>: SYSCALL(getpid) 643: b8 0b 00 00 00 mov $0xb,%eax 648: cd 40 int $0x40 64a: c3 ret 0000064b <sbrk>: SYSCALL(sbrk) 64b: b8 0c 00 00 00 mov $0xc,%eax 650: cd 40 int $0x40 652: c3 ret 00000653 <sleep>: SYSCALL(sleep) 653: b8 0d 00 00 00 mov $0xd,%eax 658: cd 40 int $0x40 65a: c3 ret 0000065b <uptime>: SYSCALL(uptime) 65b: b8 0e 00 00 00 mov $0xe,%eax 660: cd 40 int $0x40 662: c3 ret 00000663 <date>: SYSCALL(date) 663: b8 16 00 00 00 mov $0x16,%eax 668: cd 40 int $0x40 66a: c3 ret 0000066b <timem>: SYSCALL(timem) 66b: b8 17 00 00 00 mov $0x17,%eax 670: cd 40 int $0x40 672: c3 ret 00000673 <getuid>: SYSCALL(getuid) 673: b8 18 00 00 00 mov $0x18,%eax 678: cd 40 int $0x40 67a: c3 ret 0000067b <getgid>: SYSCALL(getgid) 67b: b8 19 00 00 00 mov $0x19,%eax 680: cd 40 int $0x40 682: c3 ret 00000683 <getppid>: SYSCALL(getppid) 683: b8 1a 00 00 00 mov $0x1a,%eax 688: cd 40 int $0x40 68a: c3 ret 0000068b <setuid>: SYSCALL(setuid) 68b: b8 1b 00 00 00 mov $0x1b,%eax 690: cd 40 int $0x40 692: c3 ret 00000693 <setgid>: SYSCALL(setgid) 693: b8 1c 00 00 00 mov $0x1c,%eax 698: cd 40 int $0x40 69a: c3 ret 0000069b <getprocs>: SYSCALL(getprocs) 69b: b8 1d 00 00 00 mov $0x1d,%eax 6a0: cd 40 int $0x40 6a2: c3 ret 000006a3 <setpriority>: SYSCALL(setpriority) 6a3: b8 1e 00 00 00 mov $0x1e,%eax 6a8: cd 40 int $0x40 6aa: c3 ret 000006ab <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 6ab: 55 push %ebp 6ac: 89 e5 mov %esp,%ebp 6ae: 83 ec 18 sub $0x18,%esp 6b1: 8b 45 0c mov 0xc(%ebp),%eax 6b4: 88 45 f4 mov %al,-0xc(%ebp) write(fd, &c, 1); 6b7: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 6be: 00 6bf: 8d 45 f4 lea -0xc(%ebp),%eax 6c2: 89 44 24 04 mov %eax,0x4(%esp) 6c6: 8b 45 08 mov 0x8(%ebp),%eax 6c9: 89 04 24 mov %eax,(%esp) 6cc: e8 12 ff ff ff call 5e3 <write> } 6d1: c9 leave 6d2: c3 ret 000006d3 <printint>: static void printint(int fd, int xx, int base, int sgn) { 6d3: 55 push %ebp 6d4: 89 e5 mov %esp,%ebp 6d6: 56 push %esi 6d7: 53 push %ebx 6d8: 83 ec 30 sub $0x30,%esp static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 6db: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) if(sgn && xx < 0){ 6e2: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 6e6: 74 17 je 6ff <printint+0x2c> 6e8: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 6ec: 79 11 jns 6ff <printint+0x2c> neg = 1; 6ee: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) x = -xx; 6f5: 8b 45 0c mov 0xc(%ebp),%eax 6f8: f7 d8 neg %eax 6fa: 89 45 ec mov %eax,-0x14(%ebp) 6fd: eb 06 jmp 705 <printint+0x32> } else { x = xx; 6ff: 8b 45 0c mov 0xc(%ebp),%eax 702: 89 45 ec mov %eax,-0x14(%ebp) } i = 0; 705: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) do{ buf[i++] = digits[x % base]; 70c: 8b 4d f4 mov -0xc(%ebp),%ecx 70f: 8d 41 01 lea 0x1(%ecx),%eax 712: 89 45 f4 mov %eax,-0xc(%ebp) 715: 8b 5d 10 mov 0x10(%ebp),%ebx 718: 8b 45 ec mov -0x14(%ebp),%eax 71b: ba 00 00 00 00 mov $0x0,%edx 720: f7 f3 div %ebx 722: 89 d0 mov %edx,%eax 724: 0f b6 80 40 0e 00 00 movzbl 0xe40(%eax),%eax 72b: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1) }while((x /= base) != 0); 72f: 8b 75 10 mov 0x10(%ebp),%esi 732: 8b 45 ec mov -0x14(%ebp),%eax 735: ba 00 00 00 00 mov $0x0,%edx 73a: f7 f6 div %esi 73c: 89 45 ec mov %eax,-0x14(%ebp) 73f: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 743: 75 c7 jne 70c <printint+0x39> if(neg) 745: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 749: 74 10 je 75b <printint+0x88> buf[i++] = '-'; 74b: 8b 45 f4 mov -0xc(%ebp),%eax 74e: 8d 50 01 lea 0x1(%eax),%edx 751: 89 55 f4 mov %edx,-0xc(%ebp) 754: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1) while(--i >= 0) 759: eb 1f jmp 77a <printint+0xa7> 75b: eb 1d jmp 77a <printint+0xa7> putc(fd, buf[i]); 75d: 8d 55 dc lea -0x24(%ebp),%edx 760: 8b 45 f4 mov -0xc(%ebp),%eax 763: 01 d0 add %edx,%eax 765: 0f b6 00 movzbl (%eax),%eax 768: 0f be c0 movsbl %al,%eax 76b: 89 44 24 04 mov %eax,0x4(%esp) 76f: 8b 45 08 mov 0x8(%ebp),%eax 772: 89 04 24 mov %eax,(%esp) 775: e8 31 ff ff ff call 6ab <putc> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 77a: 83 6d f4 01 subl $0x1,-0xc(%ebp) 77e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 782: 79 d9 jns 75d <printint+0x8a> putc(fd, buf[i]); } 784: 83 c4 30 add $0x30,%esp 787: 5b pop %ebx 788: 5e pop %esi 789: 5d pop %ebp 78a: c3 ret 0000078b <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 78b: 55 push %ebp 78c: 89 e5 mov %esp,%ebp 78e: 83 ec 38 sub $0x38,%esp char *s; int c, i, state; uint *ap; state = 0; 791: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) ap = (uint*)(void*)&fmt + 1; 798: 8d 45 0c lea 0xc(%ebp),%eax 79b: 83 c0 04 add $0x4,%eax 79e: 89 45 e8 mov %eax,-0x18(%ebp) for(i = 0; fmt[i]; i++){ 7a1: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 7a8: e9 7c 01 00 00 jmp 929 <printf+0x19e> c = fmt[i] & 0xff; 7ad: 8b 55 0c mov 0xc(%ebp),%edx 7b0: 8b 45 f0 mov -0x10(%ebp),%eax 7b3: 01 d0 add %edx,%eax 7b5: 0f b6 00 movzbl (%eax),%eax 7b8: 0f be c0 movsbl %al,%eax 7bb: 25 ff 00 00 00 and $0xff,%eax 7c0: 89 45 e4 mov %eax,-0x1c(%ebp) if(state == 0){ 7c3: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 7c7: 75 2c jne 7f5 <printf+0x6a> if(c == '%'){ 7c9: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 7cd: 75 0c jne 7db <printf+0x50> state = '%'; 7cf: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp) 7d6: e9 4a 01 00 00 jmp 925 <printf+0x19a> } else { putc(fd, c); 7db: 8b 45 e4 mov -0x1c(%ebp),%eax 7de: 0f be c0 movsbl %al,%eax 7e1: 89 44 24 04 mov %eax,0x4(%esp) 7e5: 8b 45 08 mov 0x8(%ebp),%eax 7e8: 89 04 24 mov %eax,(%esp) 7eb: e8 bb fe ff ff call 6ab <putc> 7f0: e9 30 01 00 00 jmp 925 <printf+0x19a> } } else if(state == '%'){ 7f5: 83 7d ec 25 cmpl $0x25,-0x14(%ebp) 7f9: 0f 85 26 01 00 00 jne 925 <printf+0x19a> if(c == 'd'){ 7ff: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp) 803: 75 2d jne 832 <printf+0xa7> printint(fd, *ap, 10, 1); 805: 8b 45 e8 mov -0x18(%ebp),%eax 808: 8b 00 mov (%eax),%eax 80a: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp) 811: 00 812: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) 819: 00 81a: 89 44 24 04 mov %eax,0x4(%esp) 81e: 8b 45 08 mov 0x8(%ebp),%eax 821: 89 04 24 mov %eax,(%esp) 824: e8 aa fe ff ff call 6d3 <printint> ap++; 829: 83 45 e8 04 addl $0x4,-0x18(%ebp) 82d: e9 ec 00 00 00 jmp 91e <printf+0x193> } else if(c == 'x' || c == 'p'){ 832: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp) 836: 74 06 je 83e <printf+0xb3> 838: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp) 83c: 75 2d jne 86b <printf+0xe0> printint(fd, *ap, 16, 0); 83e: 8b 45 e8 mov -0x18(%ebp),%eax 841: 8b 00 mov (%eax),%eax 843: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 84a: 00 84b: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) 852: 00 853: 89 44 24 04 mov %eax,0x4(%esp) 857: 8b 45 08 mov 0x8(%ebp),%eax 85a: 89 04 24 mov %eax,(%esp) 85d: e8 71 fe ff ff call 6d3 <printint> ap++; 862: 83 45 e8 04 addl $0x4,-0x18(%ebp) 866: e9 b3 00 00 00 jmp 91e <printf+0x193> } else if(c == 's'){ 86b: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp) 86f: 75 45 jne 8b6 <printf+0x12b> s = (char*)*ap; 871: 8b 45 e8 mov -0x18(%ebp),%eax 874: 8b 00 mov (%eax),%eax 876: 89 45 f4 mov %eax,-0xc(%ebp) ap++; 879: 83 45 e8 04 addl $0x4,-0x18(%ebp) if(s == 0) 87d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 881: 75 09 jne 88c <printf+0x101> s = "(null)"; 883: c7 45 f4 a1 0b 00 00 movl $0xba1,-0xc(%ebp) while(*s != 0){ 88a: eb 1e jmp 8aa <printf+0x11f> 88c: eb 1c jmp 8aa <printf+0x11f> putc(fd, *s); 88e: 8b 45 f4 mov -0xc(%ebp),%eax 891: 0f b6 00 movzbl (%eax),%eax 894: 0f be c0 movsbl %al,%eax 897: 89 44 24 04 mov %eax,0x4(%esp) 89b: 8b 45 08 mov 0x8(%ebp),%eax 89e: 89 04 24 mov %eax,(%esp) 8a1: e8 05 fe ff ff call 6ab <putc> s++; 8a6: 83 45 f4 01 addl $0x1,-0xc(%ebp) } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 8aa: 8b 45 f4 mov -0xc(%ebp),%eax 8ad: 0f b6 00 movzbl (%eax),%eax 8b0: 84 c0 test %al,%al 8b2: 75 da jne 88e <printf+0x103> 8b4: eb 68 jmp 91e <printf+0x193> putc(fd, *s); s++; } } else if(c == 'c'){ 8b6: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp) 8ba: 75 1d jne 8d9 <printf+0x14e> putc(fd, *ap); 8bc: 8b 45 e8 mov -0x18(%ebp),%eax 8bf: 8b 00 mov (%eax),%eax 8c1: 0f be c0 movsbl %al,%eax 8c4: 89 44 24 04 mov %eax,0x4(%esp) 8c8: 8b 45 08 mov 0x8(%ebp),%eax 8cb: 89 04 24 mov %eax,(%esp) 8ce: e8 d8 fd ff ff call 6ab <putc> ap++; 8d3: 83 45 e8 04 addl $0x4,-0x18(%ebp) 8d7: eb 45 jmp 91e <printf+0x193> } else if(c == '%'){ 8d9: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 8dd: 75 17 jne 8f6 <printf+0x16b> putc(fd, c); 8df: 8b 45 e4 mov -0x1c(%ebp),%eax 8e2: 0f be c0 movsbl %al,%eax 8e5: 89 44 24 04 mov %eax,0x4(%esp) 8e9: 8b 45 08 mov 0x8(%ebp),%eax 8ec: 89 04 24 mov %eax,(%esp) 8ef: e8 b7 fd ff ff call 6ab <putc> 8f4: eb 28 jmp 91e <printf+0x193> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 8f6: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp) 8fd: 00 8fe: 8b 45 08 mov 0x8(%ebp),%eax 901: 89 04 24 mov %eax,(%esp) 904: e8 a2 fd ff ff call 6ab <putc> putc(fd, c); 909: 8b 45 e4 mov -0x1c(%ebp),%eax 90c: 0f be c0 movsbl %al,%eax 90f: 89 44 24 04 mov %eax,0x4(%esp) 913: 8b 45 08 mov 0x8(%ebp),%eax 916: 89 04 24 mov %eax,(%esp) 919: e8 8d fd ff ff call 6ab <putc> } state = 0; 91e: 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++){ 925: 83 45 f0 01 addl $0x1,-0x10(%ebp) 929: 8b 55 0c mov 0xc(%ebp),%edx 92c: 8b 45 f0 mov -0x10(%ebp),%eax 92f: 01 d0 add %edx,%eax 931: 0f b6 00 movzbl (%eax),%eax 934: 84 c0 test %al,%al 936: 0f 85 71 fe ff ff jne 7ad <printf+0x22> putc(fd, c); } state = 0; } } } 93c: c9 leave 93d: c3 ret 0000093e <free>: static Header base; static Header *freep; void free(void *ap) { 93e: 55 push %ebp 93f: 89 e5 mov %esp,%ebp 941: 83 ec 10 sub $0x10,%esp Header *bp, *p; bp = (Header*)ap - 1; 944: 8b 45 08 mov 0x8(%ebp),%eax 947: 83 e8 08 sub $0x8,%eax 94a: 89 45 f8 mov %eax,-0x8(%ebp) for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 94d: a1 6c 0e 00 00 mov 0xe6c,%eax 952: 89 45 fc mov %eax,-0x4(%ebp) 955: eb 24 jmp 97b <free+0x3d> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 957: 8b 45 fc mov -0x4(%ebp),%eax 95a: 8b 00 mov (%eax),%eax 95c: 3b 45 fc cmp -0x4(%ebp),%eax 95f: 77 12 ja 973 <free+0x35> 961: 8b 45 f8 mov -0x8(%ebp),%eax 964: 3b 45 fc cmp -0x4(%ebp),%eax 967: 77 24 ja 98d <free+0x4f> 969: 8b 45 fc mov -0x4(%ebp),%eax 96c: 8b 00 mov (%eax),%eax 96e: 3b 45 f8 cmp -0x8(%ebp),%eax 971: 77 1a ja 98d <free+0x4f> free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 973: 8b 45 fc mov -0x4(%ebp),%eax 976: 8b 00 mov (%eax),%eax 978: 89 45 fc mov %eax,-0x4(%ebp) 97b: 8b 45 f8 mov -0x8(%ebp),%eax 97e: 3b 45 fc cmp -0x4(%ebp),%eax 981: 76 d4 jbe 957 <free+0x19> 983: 8b 45 fc mov -0x4(%ebp),%eax 986: 8b 00 mov (%eax),%eax 988: 3b 45 f8 cmp -0x8(%ebp),%eax 98b: 76 ca jbe 957 <free+0x19> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ 98d: 8b 45 f8 mov -0x8(%ebp),%eax 990: 8b 40 04 mov 0x4(%eax),%eax 993: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 99a: 8b 45 f8 mov -0x8(%ebp),%eax 99d: 01 c2 add %eax,%edx 99f: 8b 45 fc mov -0x4(%ebp),%eax 9a2: 8b 00 mov (%eax),%eax 9a4: 39 c2 cmp %eax,%edx 9a6: 75 24 jne 9cc <free+0x8e> bp->s.size += p->s.ptr->s.size; 9a8: 8b 45 f8 mov -0x8(%ebp),%eax 9ab: 8b 50 04 mov 0x4(%eax),%edx 9ae: 8b 45 fc mov -0x4(%ebp),%eax 9b1: 8b 00 mov (%eax),%eax 9b3: 8b 40 04 mov 0x4(%eax),%eax 9b6: 01 c2 add %eax,%edx 9b8: 8b 45 f8 mov -0x8(%ebp),%eax 9bb: 89 50 04 mov %edx,0x4(%eax) bp->s.ptr = p->s.ptr->s.ptr; 9be: 8b 45 fc mov -0x4(%ebp),%eax 9c1: 8b 00 mov (%eax),%eax 9c3: 8b 10 mov (%eax),%edx 9c5: 8b 45 f8 mov -0x8(%ebp),%eax 9c8: 89 10 mov %edx,(%eax) 9ca: eb 0a jmp 9d6 <free+0x98> } else bp->s.ptr = p->s.ptr; 9cc: 8b 45 fc mov -0x4(%ebp),%eax 9cf: 8b 10 mov (%eax),%edx 9d1: 8b 45 f8 mov -0x8(%ebp),%eax 9d4: 89 10 mov %edx,(%eax) if(p + p->s.size == bp){ 9d6: 8b 45 fc mov -0x4(%ebp),%eax 9d9: 8b 40 04 mov 0x4(%eax),%eax 9dc: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 9e3: 8b 45 fc mov -0x4(%ebp),%eax 9e6: 01 d0 add %edx,%eax 9e8: 3b 45 f8 cmp -0x8(%ebp),%eax 9eb: 75 20 jne a0d <free+0xcf> p->s.size += bp->s.size; 9ed: 8b 45 fc mov -0x4(%ebp),%eax 9f0: 8b 50 04 mov 0x4(%eax),%edx 9f3: 8b 45 f8 mov -0x8(%ebp),%eax 9f6: 8b 40 04 mov 0x4(%eax),%eax 9f9: 01 c2 add %eax,%edx 9fb: 8b 45 fc mov -0x4(%ebp),%eax 9fe: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; a01: 8b 45 f8 mov -0x8(%ebp),%eax a04: 8b 10 mov (%eax),%edx a06: 8b 45 fc mov -0x4(%ebp),%eax a09: 89 10 mov %edx,(%eax) a0b: eb 08 jmp a15 <free+0xd7> } else p->s.ptr = bp; a0d: 8b 45 fc mov -0x4(%ebp),%eax a10: 8b 55 f8 mov -0x8(%ebp),%edx a13: 89 10 mov %edx,(%eax) freep = p; a15: 8b 45 fc mov -0x4(%ebp),%eax a18: a3 6c 0e 00 00 mov %eax,0xe6c } a1d: c9 leave a1e: c3 ret 00000a1f <morecore>: static Header* morecore(uint nu) { a1f: 55 push %ebp a20: 89 e5 mov %esp,%ebp a22: 83 ec 28 sub $0x28,%esp char *p; Header *hp; if(nu < 4096) a25: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp) a2c: 77 07 ja a35 <morecore+0x16> nu = 4096; a2e: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp) p = sbrk(nu * sizeof(Header)); a35: 8b 45 08 mov 0x8(%ebp),%eax a38: c1 e0 03 shl $0x3,%eax a3b: 89 04 24 mov %eax,(%esp) a3e: e8 08 fc ff ff call 64b <sbrk> a43: 89 45 f4 mov %eax,-0xc(%ebp) if(p == (char*)-1) a46: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp) a4a: 75 07 jne a53 <morecore+0x34> return 0; a4c: b8 00 00 00 00 mov $0x0,%eax a51: eb 22 jmp a75 <morecore+0x56> hp = (Header*)p; a53: 8b 45 f4 mov -0xc(%ebp),%eax a56: 89 45 f0 mov %eax,-0x10(%ebp) hp->s.size = nu; a59: 8b 45 f0 mov -0x10(%ebp),%eax a5c: 8b 55 08 mov 0x8(%ebp),%edx a5f: 89 50 04 mov %edx,0x4(%eax) free((void*)(hp + 1)); a62: 8b 45 f0 mov -0x10(%ebp),%eax a65: 83 c0 08 add $0x8,%eax a68: 89 04 24 mov %eax,(%esp) a6b: e8 ce fe ff ff call 93e <free> return freep; a70: a1 6c 0e 00 00 mov 0xe6c,%eax } a75: c9 leave a76: c3 ret 00000a77 <malloc>: void* malloc(uint nbytes) { a77: 55 push %ebp a78: 89 e5 mov %esp,%ebp a7a: 83 ec 28 sub $0x28,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; a7d: 8b 45 08 mov 0x8(%ebp),%eax a80: 83 c0 07 add $0x7,%eax a83: c1 e8 03 shr $0x3,%eax a86: 83 c0 01 add $0x1,%eax a89: 89 45 ec mov %eax,-0x14(%ebp) if((prevp = freep) == 0){ a8c: a1 6c 0e 00 00 mov 0xe6c,%eax a91: 89 45 f0 mov %eax,-0x10(%ebp) a94: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) a98: 75 23 jne abd <malloc+0x46> base.s.ptr = freep = prevp = &base; a9a: c7 45 f0 64 0e 00 00 movl $0xe64,-0x10(%ebp) aa1: 8b 45 f0 mov -0x10(%ebp),%eax aa4: a3 6c 0e 00 00 mov %eax,0xe6c aa9: a1 6c 0e 00 00 mov 0xe6c,%eax aae: a3 64 0e 00 00 mov %eax,0xe64 base.s.size = 0; ab3: c7 05 68 0e 00 00 00 movl $0x0,0xe68 aba: 00 00 00 } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ abd: 8b 45 f0 mov -0x10(%ebp),%eax ac0: 8b 00 mov (%eax),%eax ac2: 89 45 f4 mov %eax,-0xc(%ebp) if(p->s.size >= nunits){ ac5: 8b 45 f4 mov -0xc(%ebp),%eax ac8: 8b 40 04 mov 0x4(%eax),%eax acb: 3b 45 ec cmp -0x14(%ebp),%eax ace: 72 4d jb b1d <malloc+0xa6> if(p->s.size == nunits) ad0: 8b 45 f4 mov -0xc(%ebp),%eax ad3: 8b 40 04 mov 0x4(%eax),%eax ad6: 3b 45 ec cmp -0x14(%ebp),%eax ad9: 75 0c jne ae7 <malloc+0x70> prevp->s.ptr = p->s.ptr; adb: 8b 45 f4 mov -0xc(%ebp),%eax ade: 8b 10 mov (%eax),%edx ae0: 8b 45 f0 mov -0x10(%ebp),%eax ae3: 89 10 mov %edx,(%eax) ae5: eb 26 jmp b0d <malloc+0x96> else { p->s.size -= nunits; ae7: 8b 45 f4 mov -0xc(%ebp),%eax aea: 8b 40 04 mov 0x4(%eax),%eax aed: 2b 45 ec sub -0x14(%ebp),%eax af0: 89 c2 mov %eax,%edx af2: 8b 45 f4 mov -0xc(%ebp),%eax af5: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; af8: 8b 45 f4 mov -0xc(%ebp),%eax afb: 8b 40 04 mov 0x4(%eax),%eax afe: c1 e0 03 shl $0x3,%eax b01: 01 45 f4 add %eax,-0xc(%ebp) p->s.size = nunits; b04: 8b 45 f4 mov -0xc(%ebp),%eax b07: 8b 55 ec mov -0x14(%ebp),%edx b0a: 89 50 04 mov %edx,0x4(%eax) } freep = prevp; b0d: 8b 45 f0 mov -0x10(%ebp),%eax b10: a3 6c 0e 00 00 mov %eax,0xe6c return (void*)(p + 1); b15: 8b 45 f4 mov -0xc(%ebp),%eax b18: 83 c0 08 add $0x8,%eax b1b: eb 38 jmp b55 <malloc+0xde> } if(p == freep) b1d: a1 6c 0e 00 00 mov 0xe6c,%eax b22: 39 45 f4 cmp %eax,-0xc(%ebp) b25: 75 1b jne b42 <malloc+0xcb> if((p = morecore(nunits)) == 0) b27: 8b 45 ec mov -0x14(%ebp),%eax b2a: 89 04 24 mov %eax,(%esp) b2d: e8 ed fe ff ff call a1f <morecore> b32: 89 45 f4 mov %eax,-0xc(%ebp) b35: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) b39: 75 07 jne b42 <malloc+0xcb> return 0; b3b: b8 00 00 00 00 mov $0x0,%eax b40: eb 13 jmp b55 <malloc+0xde> nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ b42: 8b 45 f4 mov -0xc(%ebp),%eax b45: 89 45 f0 mov %eax,-0x10(%ebp) b48: 8b 45 f4 mov -0xc(%ebp),%eax b4b: 8b 00 mov (%eax),%eax b4d: 89 45 f4 mov %eax,-0xc(%ebp) return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } b50: e9 70 ff ff ff jmp ac5 <malloc+0x4e> } b55: c9 leave b56: c3 ret
34.725955
73
0.435824
a7ec672996bbc9de83c66f127e399c41580aa4ae
403
asm
Assembly
programs/oeis/181/A181888.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/181/A181888.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/181/A181888.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A181888: Second column of triangle in A182971. ; 0,0,9,64,259,784,1974,4368,8778,16368,28743,48048,77077,119392,179452,262752,375972,527136,725781,983136,1312311,1728496,2249170,2894320,3686670,4651920,5818995,7220304,8892009,10874304,13211704,15953344,19153288,22870848,27170913,32124288,37808043,44305872,51708462,60113872 add $0,3 mov $1,$0 bin $0,5 mov $2,$1 mul $2,5 add $2,2 mul $0,$2 div $0,3
33.583333
277
0.779156
22e779c77dfacb0b6ef386da9b9cdcf5b923f4b4
5,445
asm
Assembly
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xa0_notsx.log_7_1479.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
9
2020-08-13T19:41:58.000Z
2022-03-30T12:22:51.000Z
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xa0_notsx.log_7_1479.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
1
2021-04-29T06:29:35.000Z
2021-05-13T21:02:30.000Z
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xa0_notsx.log_7_1479.asm
ljhsiun2/medusa
67d769b8a2fb42c538f10287abaf0e6dbb463f0c
[ "MIT" ]
3
2020-07-14T17:07:07.000Z
2022-03-21T01:12:22.000Z
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r14 push %r9 push %rax push %rbp push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0x182d, %r9 nop inc %r14 movb $0x61, (%r9) nop nop nop nop nop cmp $54974, %rbx lea addresses_A_ht+0x10d, %rax nop nop nop nop nop sub $28219, %rdx vmovups (%rax), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $0, %xmm0, %r12 nop nop and %rbp, %rbp lea addresses_A_ht+0x1616d, %rbx nop nop nop nop xor %r12, %r12 vmovups (%rbx), %ymm3 vextracti128 $1, %ymm3, %xmm3 vpextrq $1, %xmm3, %rdx nop nop nop nop sub $12060, %rbx lea addresses_A_ht+0x135ad, %rbp nop nop nop cmp %rbx, %rbx mov $0x6162636465666768, %rdx movq %rdx, %xmm7 and $0xffffffffffffffc0, %rbp movaps %xmm7, (%rbp) nop nop sub $29512, %rdx lea addresses_WC_ht+0xd1bd, %r14 nop nop nop add %r12, %r12 mov (%r14), %dx nop nop dec %r14 lea addresses_WC_ht+0x1782f, %rsi lea addresses_A_ht+0x1ebf7, %rdi clflush (%rsi) clflush (%rdi) nop nop inc %rdx mov $109, %rcx rep movsl and %rsi, %rsi lea addresses_normal_ht+0x3aeb, %rsi lea addresses_WC_ht+0x12021, %rdi nop nop nop nop nop cmp %rbp, %rbp mov $101, %rcx rep movsb nop nop nop inc %rcx lea addresses_D_ht+0x6bad, %rsi nop nop dec %r14 mov (%rsi), %eax nop inc %rcx lea addresses_WT_ht+0xbe6d, %rsi lea addresses_WC_ht+0x1abd, %rdi nop nop dec %rax mov $82, %rcx rep movsl nop nop nop nop and $62818, %rsi lea addresses_normal_ht+0xf4ad, %rsi lea addresses_WC_ht+0x521c, %rdi sub %r14, %r14 mov $74, %rcx rep movsl nop nop nop nop sub %rbx, %rbx lea addresses_WT_ht+0x35cd, %rdi nop nop nop nop sub $8916, %rsi mov $0x6162636465666768, %r14 movq %r14, (%rdi) nop nop sub $57995, %rdi lea addresses_A_ht+0x14fad, %r9 nop nop nop add %rdi, %rdi and $0xffffffffffffffc0, %r9 movaps (%r9), %xmm7 vpextrq $1, %xmm7, %r14 sub %rsi, %rsi lea addresses_WC_ht+0x1b9ed, %rax clflush (%rax) nop nop nop xor $51025, %rcx mov (%rax), %rbp nop nop add %rsi, %rsi lea addresses_A_ht+0x1c6a8, %rsi nop nop nop xor %r9, %r9 mov $0x6162636465666768, %rdx movq %rdx, %xmm2 movups %xmm2, (%rsi) nop nop nop nop dec %rbp lea addresses_WC_ht+0xacb1, %rsi lea addresses_A_ht+0x48ad, %rdi nop add %r12, %r12 mov $124, %rcx rep movsw nop nop nop nop nop xor %rbx, %rbx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %rax pop %r9 pop %r14 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r13 push %r14 push %r15 push %rbp push %rcx // Load lea addresses_RW+0x1d82d, %r15 nop nop cmp %r11, %r11 mov (%r15), %r13d cmp $55928, %rcx // Store lea addresses_PSE+0x6fad, %rbp nop nop nop add %r10, %r10 movl $0x51525354, (%rbp) sub $46566, %r13 // Faulty Load lea addresses_US+0x27ad, %r13 nop nop nop nop and %r14, %r14 mov (%r13), %rcx lea oracles, %r11 and $0xff, %rcx shlq $12, %rcx mov (%r11,%rcx,1), %rcx pop %rcx pop %rbp pop %r15 pop %r14 pop %r13 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_US', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'src': {'type': 'addresses_RW', 'AVXalign': False, 'size': 4, 'NT': True, 'same': False, 'congruent': 6}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 11}} [Faulty Load] {'src': {'type': 'addresses_US', 'AVXalign': True, 'size': 8, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 7}} {'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 6}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': True, 'size': 16, 'NT': True, 'same': True, 'congruent': 9}} {'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 2, 'NT': True, 'same': False, 'congruent': 1}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}} {'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}} {'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}} {'src': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 1}} {'src': {'type': 'addresses_A_ht', 'AVXalign': True, 'size': 16, 'NT': False, 'same': False, 'congruent': 11}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 6}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}} {'src': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}} {'00': 7} 00 00 00 00 00 00 00 */
20.469925
152
0.650321