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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1bf7c367a49c52df5fb4a277893b04cb3f85b933 | 151 | asm | Assembly | other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/fzero.lzh/fzero/calculate_usa.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/fzero.lzh/fzero/calculate_usa.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/fzero.lzh/fzero/calculate_usa.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | Name: calculate_usa.asm
Type: file
Size: 31108
Last-Modified: '1993-07-20T07:13:20Z'
SHA-1: 69AB7E2D705CEFE9F7503FEEF830302AE4318DC9
Description: null
| 21.571429 | 47 | 0.821192 |
80fc93e129b8e2ce974a4e532e97ca0e9df14fd1 | 2,901 | asm | Assembly | sfx_engine/TABs-Func.asm | GSoftwareDevelopment/sfx-tracker | c10d7512c460c2049c9a01cd4beb0a1b945582a7 | [
"MIT",
"Unlicense"
] | 9 | 2021-05-18T19:50:58.000Z | 2021-07-30T21:21:26.000Z | sfx_engine/TABs-Func.asm | GSoftwareDevelopment/Mole | 419c61a60dc01aa278cc10b9cf40f13524328220 | [
"MIT",
"Unlicense"
] | 35 | 2021-07-27T10:30:25.000Z | 2021-08-31T18:46:49.000Z | sfx_engine/TABs-Func.asm | GSoftwareDevelopment/Mole | 419c61a60dc01aa278cc10b9cf40f13524328220 | [
"MIT",
"Unlicense"
] | null | null | null | check_TAB_Function
; current order is in A register
cmp #$FF ; check TABEND function
bne check_TABFn_REPEAT
TABFn_TAB_END
lda SONG_Ofs ; get current SONG offset
cmp #$FF ; If the offset points to a value other than $FF
beq play_TAB_again ;
jsr SONG_process ; ...it means that SONG is played.
jmp tick_start
play_TAB_again
ldy #0 ; set TAB offset to begin
jmp fetch_TAB_pointer+2
check_TABFn_REPEAT
cmp #$C0 ; check REPEAT function
beq TAB_FN_Blank_NoteOff
TAB_FN_Loop
and #%00111111 ; extract value from order (repeat times)
beq fetch_next_tab_row ; =0 REPEAT zero times? :| Can't possible
; originally, it was a conditional jump `BNE TAB_FN_JumpTo`,
; which means, the TAB function JUMP TO
TAB_FN_Repeat
sta _regTemp ; temporary store value from order (repeat value)
; check current loop
lda SFX_CHANNELS_ADDR+_tabRep,x ; get current repeat value
beq TAB_FN_RepeatSet ; =0 set loop
TAB_FN_ContinueLoop
dec SFX_CHANNELS_ADDR+_tabRep,x ; decrase current repeat value
bne TAB_FN_JumpTo ; if current repeat value <>0 jump to position...
iny ; increment current TAB offset to next row
; end of loop
bne fetch_next_TAB_row
jsr SONG_process ; if TAB offset is wrap, process TRACK step
jmp tick_start
fetch_next_TAB_row
jmp fetch_TAB_row ; fetch next TAB row
TAB_FN_RepeatSet
lda _regTemp
sta SFX_CHANNELS_ADDR+_tabRep,x
TAB_FN_JumpTo
lda TABParam ; set jump position
asl @ ; multiply by 2 to get TAB offest
tay ; store in TAB offset register
jmp fetch_TAB_row ; get new TAB line
TAB_FN_Blank_NoteOff
lda TABParam ; get row value
bpl TAB_FN_Blank ; check BLANK (positive value) or NOTE OFF (negative)
TAB_FN_NoteOff
lda #SFX_OFF ; turn off current SFX
sta SFX_CHANNELS_ADDR+_chnOfs,x
lda #$00
sta chnCtrl
.ifdef MAIN.@DEFINES.SFX_previewChannels
sta SFX_CHANNELS_ADDR+_chnCtrl,x
.endif
jsr turn_off_Audio_channel
jmp next_player_tick
TAB_FN_Blank
; This function does nothing with registers
| 37.675325 | 108 | 0.523613 |
36381568b245e5e5bb53d409d4b6f6724e4da47b | 1,338 | asm | Assembly | hlpline.asm | majioa/unpklite | e6c96158537e3310d34a1097d83d233b5fa565cd | [
"MIT"
] | null | null | null | hlpline.asm | majioa/unpklite | e6c96158537e3310d34a1097d83d233b5fa565cd | [
"MIT"
] | null | null | null | hlpline.asm | majioa/unpklite | e6c96158537e3310d34a1097d83d233b5fa565cd | [
"MIT"
] | null | null | null | ASSUME CS:CGR,DS:CGR
CGR GROUP COD,DAT
COD SEGMENT BYTE
ORG 100H
HLP1 PROC NEAR
PUSH CS
POP DS
MOV SI,80H
PUSH CS
POP ES
LEA AX,FIRST_
LEA BX,SECOND_
LEA DX,NEW_
CALL READ_LINE
JC WRITE_ERROR
INT 20H
WRITE_ERROR:
DEC AX
LEA SI,NONE_COMMAND_
OR AX,AX
JZ PRINT_ERROR
DEC AX
LEA SI,REPEAT_USE_COMMAND_
OR AX,AX
JZ PRINT_ERROR
DEC AX
LEA SI,ABSENT_SYMBOL_OF_BEGIN_COMMAND_
OR AX,AX
JZ PRINT_ERROR
DEC AX
LEA SI,NONE_STRING_
OR AX,AX
JZ PRINT_ERROR
DEC AX
LEA SI,UNRECOGNIZEBLE_SYMBOL_
OR AX,AX
JZ PRINT_ERROR
DEC AX
LEA SI,UNNECESSARY_COMMAND_
OR AX,AX
JZ PRINT_ERROR
DEC AX
LEA SI,UNNECESSARY_SWITCH_
PRINT_ERROR:
MOV AH,3
XOR BH,BH
INT 10H
XOR CH,CH
MOV CL,DH
XOR DH,DH
MOV [X],DX
MOV [Y],CX
CALL WRITE_WORD
INT 20H
ENDP
include readline.lib
INCLUDE WRWORD.LIB
INCLUDE WRITESYM.LIB
ENDS
DAT SEGMENT BYTE
NONE_COMMAND_ DB 'None command',0
REPEAT_USE_COMMAND_ DB 'Repeat using command',0
ABSENT_SYMBOL_OF_BEGIN_COMMAND_ DB 'Absent symbol of begin command',0
NONE_STRING_ DB 'None string',0
UNRECOGNIZEBLE_SYMBOL_ DB 'Unrecognizeble symbol',0
UNNECESSARY_COMMAND_ DB 'Unnecessary command',0
UNNECESSARY_SWITCH_ DB 'Unnecessary switch',0
FIRST_ DB '/XYZ',0FFH
SECOND_ DB 'XABC',0FEH,'ZW',0FFH
NEW_ DW 3 DUP (0)
ENDS
END HLP1
| 18.328767 | 70 | 0.733931 |
cd18211918391b9c60f5e0088295dfcc3cd8d7ce | 266 | asm | Assembly | src/kernel/x64/idt_asm.asm | 7E00h/septos | d8f43c98a49c69efef1ec8b0c05420c47784dab8 | [
"Unlicense"
] | 1 | 2021-09-30T16:17:52.000Z | 2021-09-30T16:17:52.000Z | src/kernel/x64/idt_asm.asm | 7E00h/septos | d8f43c98a49c69efef1ec8b0c05420c47784dab8 | [
"Unlicense"
] | null | null | null | src/kernel/x64/idt_asm.asm | 7E00h/septos | d8f43c98a49c69efef1ec8b0c05420c47784dab8 | [
"Unlicense"
] | null | null | null | BITS 64
global _asm_lidt
global _asm_sti
global _asm_cli
global _asm_default_handler
section .text
_asm_lidt:
; RDI contains address of table
lidt [rdi]
ret
_asm_sti:
sti
ret
_asm_cli:
cli
ret
align 4
_asm_default_handler:
iretq | 10.64 | 35 | 0.710526 |
fdab5c1b780bee8131070d6b359922455a56ee73 | 2,018 | asm | Assembly | maps/old/DarkCaveBlackthornEntrance.asm | AtmaBuster/pokeplat-gen2 | fa83b2e75575949b8f72cb2c48f7a1042e97f70f | [
"blessing"
] | 6 | 2021-06-19T06:41:19.000Z | 2022-02-15T17:12:33.000Z | maps/DarkCaveBlackthornEntrance.asm | TastySnax12/pokecrystal16-493-plus | 9de36c8803c9bdf4b8564ed547f988b0b66f0c41 | [
"blessing"
] | null | null | null | maps/DarkCaveBlackthornEntrance.asm | TastySnax12/pokecrystal16-493-plus | 9de36c8803c9bdf4b8564ed547f988b0b66f0c41 | [
"blessing"
] | 3 | 2021-01-15T18:45:40.000Z | 2021-10-16T03:35:27.000Z | object_const_def ; object_event constants
const DARKCAVEBLACKTHORNENTRANCE_PHARMACIST
const DARKCAVEBLACKTHORNENTRANCE_POKE_BALL1
const DARKCAVEBLACKTHORNENTRANCE_POKE_BALL2
DarkCaveBlackthornEntrance_MapScripts:
db 0 ; scene scripts
db 0 ; callbacks
DarkCaveBlackthornEntrancePharmacistScript:
faceplayer
opentext
checkevent EVENT_GOT_BLACKGLASSES_IN_DARK_CAVE
iftrue .GotBlackglasses
writetext DarkCaveBlackthornEntrancePharmacistText1
buttonsound
verbosegiveitem BLACKGLASSES
iffalse .PackFull
setevent EVENT_GOT_BLACKGLASSES_IN_DARK_CAVE
.GotBlackglasses:
writetext DarkCaveBlackthornEntrancePharmacistText2
waitbutton
.PackFull:
closetext
end
DarkCaveBlackthornEntranceRevive:
itemball REVIVE
DarkCaveBlackthornEntranceTMSnore:
tmhmball TM_SNORE
DarkCaveBlackthornEntrancePharmacistText1:
text "Whoa! You startled"
line "me there!"
para "I had my BLACK-"
line "GLASSES on, so I"
para "didn't notice you"
line "at all."
para "What am I doing"
line "here?"
para "Hey, don't you"
line "worry about it."
para "I'll give you a"
line "pair of BLACK-"
cont "GLASSES, so forget"
cont "you saw me, OK?"
done
DarkCaveBlackthornEntrancePharmacistText2:
text "BLACKGLASSES ups"
line "the power of dark-"
cont "type moves."
done
DarkCaveBlackthornEntrance_MapEvents:
db 0, 0 ; filler
db 2 ; warp events
warp_event 23, 3, ROUTE_45, 1
warp_event 3, 25, DARK_CAVE_VIOLET_ENTRANCE, 2
db 0 ; coord events
db 0 ; bg events
db 3 ; object events
object_event 7, 3, SPRITE_PHARMACIST, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, DarkCaveBlackthornEntrancePharmacistScript, -1
object_event 21, 24, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, DarkCaveBlackthornEntranceRevive, EVENT_DARK_CAVE_BLACKTHORN_ENTRANCE_REVIVE
object_event 7, 22, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_TMHMBALL, 0, DarkCaveBlackthornEntranceTMSnore, EVENT_DARK_CAVE_BLACKTHORN_ENTRANCE_TM_SNORE
| 26.207792 | 182 | 0.805253 |
df323c471434ca0d12adf7589a530b7b0f6251f6 | 573 | asm | Assembly | oeis/318/A318605.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/318/A318605.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/318/A318605.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A318605: Decimal expansion of geometric progression constant for Coxeter's Loxodromic Sequence of Tangent Circles.
; Submitted by Christian Krause
; 2,8,9,0,0,5,3,6,3,8,2,6,3,9,6,3,8,1,2,4,5,7,0,0,9,2,9,6,1,0,3,1,2,9,6,0,9,4,3,5,9,1,7,2,2,1,6,4,5,8,5,9,1,1,0,7,5,2,0,8,9,0,0,5,2,4,4,5,5,8,0,3,8,3,5,4,9,7,0,4,6,1,5,3,7,5,9,1,4,1,9,1,7,7,8,5,1,3,9,6
mov $2,2
mov $3,$0
mul $3,4
add $3,2
lpb $3
add $6,$2
add $1,$6
mov $7,$2
add $2,$1
sub $3,1
add $5,$2
add $6,$5
lpe
mov $2,$1
mov $4,10
pow $4,$0
add $5,$7
mov $1,$5
div $2,$4
div $1,$2
mov $0,$1
mod $0,10
| 21.222222 | 201 | 0.581152 |
a85ba767de12ff769e472a4741256bdfd7016d55 | 5,535 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_21829_708.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.log_21829_708.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.log_21829_708.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r15
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x9716, %rsi
xor %r11, %r11
mov $0x6162636465666768, %r10
movq %r10, %xmm7
vmovups %ymm7, (%rsi)
add %rdi, %rdi
lea addresses_normal_ht+0x4dd6, %r12
nop
nop
nop
nop
inc %rax
vmovups (%r12), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $0, %xmm5, %r15
nop
nop
nop
nop
nop
xor $17656, %r12
lea addresses_D_ht+0x1796, %r15
nop
nop
dec %rdi
movw $0x6162, (%r15)
nop
nop
nop
nop
add %r12, %r12
lea addresses_A_ht+0x6e96, %rsi
lea addresses_WC_ht+0x4716, %rdi
nop
nop
nop
nop
nop
sub $56060, %r12
mov $16, %rcx
rep movsw
nop
cmp %rcx, %rcx
lea addresses_A_ht+0x1e5d6, %rsi
lea addresses_normal_ht+0x14899, %rdi
add %r11, %r11
mov $21, %rcx
rep movsb
nop
cmp $63905, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r15
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r15
push %r9
push %rbp
push %rbx
push %rcx
// Store
lea addresses_PSE+0x10796, %rbx
nop
nop
nop
nop
inc %r9
mov $0x5152535455565758, %r12
movq %r12, (%rbx)
xor %rcx, %rcx
// Faulty Load
lea addresses_RW+0x6096, %rbp
nop
xor $20157, %r15
vmovups (%rbp), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $1, %xmm0, %r13
lea oracles, %rbx
and $0xff, %r13
shlq $12, %r13
mov (%rbx,%r13,1), %r13
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r15
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_PSE'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_D_ht'}}
{'src': {'congruent': 9, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_WC_ht'}}
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_normal_ht'}}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
| 43.242188 | 2,999 | 0.661608 |
1e8f9b65c35ca34599d9a02bc6e82ac4290e96ce | 367 | asm | Assembly | programs/oeis/023/A023973.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/023/A023973.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/023/A023973.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A023973: First bit in fractional part of binary expansion of 6th root of n.
; 0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
lpb $0,1
mov $1,$0
div $1,7
mov $0,$1
pow $0,2
sub $0,11
mov $1,1
lpe
| 30.583333 | 205 | 0.547684 |
2fa321389aec1f45a0f58c70a6572b736b777dee | 4,799 | asm | Assembly | Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_287.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_287.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_287.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r15
push %r8
push %r9
push %rbp
push %rcx
push %rdi
lea addresses_WC_ht+0xcc28, %r8
and $41402, %rbp
movups (%r8), %xmm5
vpextrq $0, %xmm5, %r14
nop
nop
nop
nop
sub %rdi, %rdi
lea addresses_normal_ht+0x117e8, %r15
nop
add %r9, %r9
movb (%r15), %cl
nop
nop
nop
nop
cmp $33038, %rdi
lea addresses_UC_ht+0x1e468, %r8
nop
nop
nop
nop
nop
dec %r14
movw $0x6162, (%r8)
nop
sub %r14, %r14
lea addresses_A_ht+0x1e5f4, %rcx
nop
nop
dec %r15
mov $0x6162636465666768, %r8
movq %r8, %xmm7
movups %xmm7, (%rcx)
nop
cmp %rdi, %rdi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r15
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r14
push %r15
push %rbx
push %rsi
// Faulty Load
lea addresses_UC+0xc7e8, %r15
nop
nop
nop
nop
sub %rsi, %rsi
mov (%r15), %r10w
lea oracles, %rsi
and $0xff, %r10
shlq $12, %r10
mov (%rsi,%r10,1), %r10
pop %rsi
pop %rbx
pop %r15
pop %r14
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': True, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 6, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 10, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 6, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 2, 'size': 16, 'same': False, 'NT': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 48.474747 | 2,999 | 0.659304 |
0862a30e439d6193e6d778c617507b46fc7859ec | 494 | asm | Assembly | programs/oeis/213/A213526.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/213/A213526.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/213/A213526.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A213526: a(n) = 3*n AND n, where AND is the bitwise AND operator.
; 0,1,2,1,4,5,2,5,8,9,10,1,4,5,10,13,16,17,18,17,20,21,2,5,8,9,10,17,20,21,26,29,32,33,34,33,36,37,34,37,40,41,42,1,4,5,10,13,16,17,18,17,20,21,34,37,40,41,42,49,52,53,58,61,64,65,66,65,68,69,66,69,72,73,74,65,68,69,74,77,80,81,82,81,84,85,2,5,8,9,10,17,20,21,26,29,32,33,34,33
lpb $0
mov $2,$0
add $3,$0
mul $0,2
seq $2,184616 ; Negated negative parts of the nonadjacent forms
mul $2,2
add $3,$2
sub $0,$3
lpe
| 38 | 277 | 0.62753 |
1cc2ec1b9ff1204ba6e282da6f9096d2c04b816b | 14,251 | asm | Assembly | sources/ippcp/asm_intel64/pcpsha1m7as.asm | ipuustin/ipp-crypto | fdaee86cc138576c79d2578e8ceae8953b5faf96 | [
"Apache-2.0"
] | 30 | 2017-07-26T20:03:19.000Z | 2021-10-14T23:38:54.000Z | sources/ippcp/asm_intel64/pcpsha1m7as.asm | ipuustin/ipp-crypto | fdaee86cc138576c79d2578e8ceae8953b5faf96 | [
"Apache-2.0"
] | 9 | 2018-09-25T18:32:42.000Z | 2022-02-18T12:23:40.000Z | sources/ippcp/asm_intel64/pcpsha1m7as.asm | ipuustin/ipp-crypto | fdaee86cc138576c79d2578e8ceae8953b5faf96 | [
"Apache-2.0"
] | 14 | 2017-08-31T19:53:23.000Z | 2021-02-27T01:08:14.000Z | ;===============================================================================
; Copyright 2015-2020 Intel Corporation
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;===============================================================================
;
;
; Purpose: Cryptography Primitive.
; Message block processing according to SHA1
;
; Content:
; UpdateSHA1
;
;
%include "asmdefs.inc"
%include "ia_32e.inc"
%include "pcpvariant.inc"
%if (_ENABLE_ALG_SHA1_)
%if (_SHA_NI_ENABLING_ == _FEATURE_OFF_) || (_SHA_NI_ENABLING_ == _FEATURE_TICKTOCK_)
%if (_IPP32E >= _IPP32E_M7) && (_IPP32E < _IPP32E_U8 )
;;
;; Magic functions defined in FIPS 180-1
;;
%macro MAGIC_F0 4-5.nolist
%xdefine %%regF %1
%xdefine %%regB %2
%xdefine %%regC %3
%xdefine %%regD %4
%xdefine %%regT %5
mov %%regF,%%regC
xor %%regF,%%regD
and %%regF,%%regB
xor %%regF,%%regD
%endmacro
%macro MAGIC_F1 4-5.nolist
%xdefine %%regF %1
%xdefine %%regB %2
%xdefine %%regC %3
%xdefine %%regD %4
%xdefine %%regT %5
mov %%regF,%%regD
xor %%regF,%%regC
xor %%regF,%%regB
%endmacro
%macro MAGIC_F2 5.nolist
%xdefine %%regF %1
%xdefine %%regB %2
%xdefine %%regC %3
%xdefine %%regD %4
%xdefine %%regT %5
mov %%regF,%%regB
mov %%regT,%%regB
or %%regF,%%regC
and %%regT,%%regC
and %%regF,%%regD
or %%regF,%%regT
%endmacro
%macro MAGIC_F3 4-5.nolist
%xdefine %%regF %1
%xdefine %%regB %2
%xdefine %%regC %3
%xdefine %%regD %4
%xdefine %%regT %5
MAGIC_F1 {%%regF},{%%regB},{%%regC},{%%regD},{%%regT}
%endmacro
;;
;; single SHA1 step
;;
;; Ipp32u tmp = ROL(A,5) + MAGIC_Fi(B,C,D) + E + W[t] + CNT[i];
;; E = D;
;; D = C;
;; C = ROL(B,30);
;; B = A;
;; A = tmp;
;;
%macro SHA1_STEP 10.nolist
%xdefine %%regA %1
%xdefine %%regB %2
%xdefine %%regC %3
%xdefine %%regD %4
%xdefine %%regE %5
%xdefine %%regT %6
%xdefine %%regF %7
%xdefine %%memW %8
%xdefine %%immCNT %9
%xdefine %%MAGIC %10
add %%regE,%%immCNT
add %%regE,[%%memW]
mov %%regT,%%regA
rol %%regT,5
add %%regE,%%regT
%%MAGIC %%regF,%%regB,%%regC,%%regD,%%regT ;; FUN = MAGIC_Fi(B,C,D)
rol %%regB,30
add %%regE,%%regF
%endmacro
%macro SHA1_RND0 8.nolist
%xdefine %%regA %1
%xdefine %%regB %2
%xdefine %%regC %3
%xdefine %%regD %4
%xdefine %%regE %5
%xdefine %%regT %6
%xdefine %%regF %7
%xdefine %%nr %8
%assign %%immCNT 05A827999h
mov r13d,%%immCNT
MAGIC_F0 %%regF,%%regB,%%regC,%%regD ;; FUN = MAGIC_Fi(B,C,D)
ror %%regB,(32-30)
mov %%regT,%%regA
rol %%regT,5
add %%regE,[rsp+(((%%nr) & 0Fh)*4)]
; lea regE,[regE+regF+immCNT] ; substituted with 2 adds because of gnu as bug
add r13d, %%regF
add %%regE, r13d
add %%regE,%%regT
%endmacro
%macro SHA1_RND1 8.nolist
%xdefine %%regA %1
%xdefine %%regB %2
%xdefine %%regC %3
%xdefine %%regD %4
%xdefine %%regE %5
%xdefine %%regT %6
%xdefine %%regF %7
%xdefine %%nr %8
%assign %%immCNT 06ED9EBA1h
mov r13d,%%immCNT
MAGIC_F1 {%%regF},{%%regB},{%%regC},{%%regD} ;; FUN = MAGIC_Fi(B,C,D)
ror %%regB,(32-30)
mov %%regT,%%regA
rol %%regT,5
add %%regE,[rsp+(((%%nr) & 0Fh)*4)]
; lea regE,[regE+regF+immCNT] ; substituted with 2 adds because of gnu as bug
add r13d, %%regF
add %%regE, r13d
add %%regE,%%regT
%endmacro
%macro SHA1_RND2 8.nolist
%xdefine %%regA %1
%xdefine %%regB %2
%xdefine %%regC %3
%xdefine %%regD %4
%xdefine %%regE %5
%xdefine %%regT %6
%xdefine %%regF %7
%xdefine %%nr %8
%ifndef _VXWORKS
%assign %%immCNT 08F1BBCDCh
%else
%assign %%immCNT -1894007588
%endif
mov r13d,%%immCNT
MAGIC_F2 %%regF,%%regB,%%regC,%%regD,%%regT ;; FUN = MAGIC_Fi(B,C,D)
ror %%regB,(32-30)
mov %%regT,%%regA
rol %%regT,5
add %%regE,[rsp+(((%%nr) & 0Fh)*4)]
; lea regE,[regE+regF+immCNT] ; substituted with 2 adds because of gnu as bug
add r13d, %%regF
add %%regE, r13d
add %%regE,%%regT
%endmacro
%macro SHA1_RND3 8.nolist
%xdefine %%regA %1
%xdefine %%regB %2
%xdefine %%regC %3
%xdefine %%regD %4
%xdefine %%regE %5
%xdefine %%regT %6
%xdefine %%regF %7
%xdefine %%nr %8
%ifndef _VXWORKS
%assign %%immCNT 0CA62C1D6h
%else
%assign %%immCNT -899497514
%endif
mov r13d,%%immCNT
MAGIC_F3 {%%regF},{%%regB},{%%regC},{%%regD} ;; FUN = MAGIC_Fi(B,C,D)
ror %%regB,(32-30)
mov %%regT,%%regA
rol %%regT,5
add %%regE,[rsp+(((%%nr) & 0Fh)*4)]
; lea regE,[regE+regF+immCNT] ; substituted with 2 adds because of gnu as bug
add r13d, %%regF
add %%regE, r13d
add %%regE,%%regT
%endmacro
;;
;; ENDIANNESS
;;
%macro ENDIANNESS 2.nolist
%xdefine %%dst %1
%xdefine %%src %2
%ifnidn %%dst,%%src
mov %%dst,%%src
%endif
bswap %%dst
%endmacro
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Following Macros are especially for new implementation of SHA1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
%macro UPDATE 2-3.nolist
%xdefine %%nr %1
%xdefine %%regU %2
%xdefine %%regT %3
%ifempty %%regT
mov %%regU,[rsp+((%%nr-16) & 0Fh)*4]
xor %%regU,[rsp+((%%nr-14) & 0Fh)*4]
xor %%regU,[rsp+((%%nr-8) & 0Fh)*4]
xor %%regU,[rsp+((%%nr-3) & 0Fh)*4]
%else
mov %%regU,[rsp+((%%nr-16) & 0Fh)*4]
mov %%regT,[rsp+((%%nr-14) & 0Fh)*4]
xor %%regU,%%regT
mov %%regT,[rsp+((%%nr-8) & 0Fh)*4]
xor %%regU,%%regT
mov %%regT,[rsp+((%%nr-3) & 0Fh)*4]
xor %%regU,%%regT
%endif
rol %%regU,1
mov [rsp+(%%nr & 0Fh)*4],%%regU
%endmacro
segment .text align=IPP_ALIGN_FACTOR
;*****************************************************************************************
;* Purpose: Update internal digest according to message block
;*
;* void UpdateSHA1(DigestSHA1 digest, const Ipp32u* mblk, int mlen, const void* pParam)
;*
;*****************************************************************************************
;;
;; Lib = M7
;;
;; Caller = ippsSHA1Update
;; Caller = ippsSHA1Final
;; Caller = ippsSHA1MessageDigest
;;
;; Caller = ippsHMACSHA1Update
;; Caller = ippsHMACSHA1Final
;; Caller = ippsHMACSHA1MessageDigest
;;
align IPP_ALIGN_FACTOR
IPPASM UpdateSHA1,PUBLIC
%assign LOCAL_FRAME 16*4
USES_GPR rbx,rsi,rdi,r8,r9,r10,r11,r12,r13
USES_XMM
COMP_ABI 4
%xdefine MBS_SHA1 (64)
movsxd rdx, edx
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; process next data block
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.sha1_block_loop:
;;
;; init A, B, C, D, E by the internal digest
;;
mov r8d, [rdi+0*4] ; r8d = digest[0] (A)
mov r9d, [rdi+1*4] ; r9d = digest[1] (B)
mov r10d,[rdi+2*4] ; r10d= digest[2] (C)
mov r11d,[rdi+3*4] ; r11d= digest[3] (D)
mov r12d,[rdi+4*4] ; r12d= digest[4] (E)
;;
;; initialize the first 16 words in the array W (remember about endian)
;;
xor rcx,rcx
.loop1:
mov eax,[rsi+rcx*4+0*4]
ENDIANNESS eax,eax
mov [rsp+rcx*4+0*4],eax
mov ebx,[rsi+rcx*4+1*4]
ENDIANNESS ebx,ebx
mov [rsp+rcx*4+1*4],ebx
add rcx,2
cmp rcx,16
jl .loop1
;;
;; perform 0-79 steps
;;
;; A, B, C, D, E, TMP,FUN, round
;; -----------------------------------
SHA1_RND0 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 0
UPDATE 16, eax
SHA1_RND0 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 1
UPDATE 17, eax
SHA1_RND0 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 2
UPDATE 18, eax
SHA1_RND0 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 3
UPDATE 19, eax
SHA1_RND0 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 4
UPDATE 20, eax
SHA1_RND0 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 5
UPDATE 21, eax
SHA1_RND0 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 6
UPDATE 22, eax
SHA1_RND0 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 7
UPDATE 23, eax
SHA1_RND0 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 8
UPDATE 24, eax
SHA1_RND0 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 9
UPDATE 25, eax
SHA1_RND0 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 10
UPDATE 26, eax
SHA1_RND0 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 11
UPDATE 27, eax
SHA1_RND0 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 12
UPDATE 28, eax
SHA1_RND0 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 13
UPDATE 29, eax
SHA1_RND0 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 14
UPDATE 30, eax
SHA1_RND0 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 15
UPDATE 31, eax
SHA1_RND0 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 16
UPDATE 32, eax
SHA1_RND0 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 17
UPDATE 33, eax
SHA1_RND0 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 18
UPDATE 34, eax
SHA1_RND0 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 19
UPDATE 35, eax
SHA1_RND1 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 20
UPDATE 36, eax
SHA1_RND1 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 21
UPDATE 37, eax
SHA1_RND1 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 22
UPDATE 38, eax
SHA1_RND1 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 23
UPDATE 39, eax
SHA1_RND1 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 24
UPDATE 40, eax
SHA1_RND1 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 25
UPDATE 41, eax
SHA1_RND1 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 26
UPDATE 42, eax
SHA1_RND1 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 27
UPDATE 43, eax
SHA1_RND1 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 28
UPDATE 44, eax
SHA1_RND1 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 29
UPDATE 45, eax
SHA1_RND1 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 30
UPDATE 46, eax
SHA1_RND1 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 31
UPDATE 47, eax
SHA1_RND1 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 32
UPDATE 48, eax
SHA1_RND1 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 33
UPDATE 49, eax
SHA1_RND1 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 34
UPDATE 50, eax
SHA1_RND1 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 35
UPDATE 51, eax
SHA1_RND1 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 36
UPDATE 52, eax
SHA1_RND1 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 37
UPDATE 53, eax
SHA1_RND1 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 38
UPDATE 54, eax
SHA1_RND1 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 39
UPDATE 55, eax
SHA1_RND2 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 40
UPDATE 56, eax
SHA1_RND2 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 41
UPDATE 57, eax
SHA1_RND2 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 42
UPDATE 58, eax
SHA1_RND2 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 43
UPDATE 59, eax
SHA1_RND2 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 44
UPDATE 60, eax
SHA1_RND2 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 45
UPDATE 61, eax
SHA1_RND2 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 46
UPDATE 62, eax
SHA1_RND2 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 47
UPDATE 63, eax
SHA1_RND2 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 48
UPDATE 64, eax
SHA1_RND2 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 49
UPDATE 65, eax
SHA1_RND2 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 50
UPDATE 66, eax
SHA1_RND2 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 51
UPDATE 67, eax
SHA1_RND2 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 52
UPDATE 68, eax
SHA1_RND2 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 53
UPDATE 69, eax
SHA1_RND2 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 54
UPDATE 70, eax
SHA1_RND2 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 55
UPDATE 71, eax
SHA1_RND2 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 56
UPDATE 72, eax
SHA1_RND2 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 57
UPDATE 73, eax
SHA1_RND2 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 58
UPDATE 74, eax
SHA1_RND2 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 59
UPDATE 75, eax
SHA1_RND3 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 60
UPDATE 76, eax
SHA1_RND3 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 61
UPDATE 77, eax
SHA1_RND3 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 62
UPDATE 78, eax
SHA1_RND3 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 63
UPDATE 79, eax
SHA1_RND3 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 64
SHA1_RND3 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 65
SHA1_RND3 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 66
SHA1_RND3 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 67
SHA1_RND3 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 68
SHA1_RND3 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 69
SHA1_RND3 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 70
SHA1_RND3 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 71
SHA1_RND3 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 72
SHA1_RND3 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 73
SHA1_RND3 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 74
SHA1_RND3 r8d,r9d,r10d,r11d,r12d, ecx,ebx, 75
SHA1_RND3 r12d,r8d,r9d,r10d,r11d, ecx,ebx, 76
SHA1_RND3 r11d,r12d,r8d,r9d,r10d, ecx,ebx, 77
SHA1_RND3 r10d,r11d,r12d,r8d,r9d, ecx,ebx, 78
SHA1_RND3 r9d,r10d,r11d,r12d,r8d, ecx,ebx, 79
;;
;; update digest
;;
add [rdi+0*4],r8d ; advance digest
add [rdi+1*4],r9d
add [rdi+2*4],r10d
add [rdi+3*4],r11d
add [rdi+4*4],r12d
add rsi, MBS_SHA1
sub rdx, MBS_SHA1
jg .sha1_block_loop
REST_XMM
REST_GPR
ret
ENDFUNC UpdateSHA1
%endif ;; (_IPP32E >= _IPP32E_M7) AND (_IPP32E < _IPP32E_U8 )
%endif ;; _FEATURE_OFF_ / _FEATURE_TICKTOCK_
%endif ;; _ENABLE_ALG_SHA1_
| 28.332008 | 90 | 0.56382 |
d5bd014a762755d7d063746a29cb8733fd534729 | 4,902 | asm | Assembly | src/utils/graphics.asm | Quatroctus/Startaste | 0a51f573d8db67e021f61a863fc84f43328312eb | [
"MIT"
] | 1 | 2019-02-18T23:37:48.000Z | 2019-02-18T23:37:48.000Z | src/utils/graphics.asm | Quatroctus/Startaste | 0a51f573d8db67e021f61a863fc84f43328312eb | [
"MIT"
] | 4 | 2018-05-02T01:58:07.000Z | 2021-04-15T05:37:10.000Z | src/utils/graphics.asm | Quatroctus/Startaste | 0a51f573d8db67e021f61a863fc84f43328312eb | [
"MIT"
] | 1 | 2021-04-14T23:57:45.000Z | 2021-04-14T23:57:45.000Z | ; Graphics routines for Protected Mode
; ============================================ ;
; Put Character Routine
; Arguments: bl: Row, dl: Column, cx: Character and Color
; Outputs: None (changes display)
; ============================================ ;
graphics_put_char:
pusha
; calaculate the address of the character.
mov dh, 0 ; ax + dl might result in overflow so we set dh to 0
mov eax, COLUMNS
mul bl ; row * columns
add ax, dx ; (row * columns) + colum
mov bx, 2
mul bx ; multiply everything by 2 because every character takes 2 bytes.
add eax, VID_MEM
.draw:
mov [eax], cx
.done:
popa
ret
; ============================================ ;
; Clear Screen Routine
; Arguments: cl: Main Color, ch: Top Color, si: Top Message
; Outputs: None (changes display)
; ============================================ ;
graphics_clear:
pusha
mov eax, VID_MEM ; must use 32-bit register for addressing otherwise it thinks it's a different location.
mov dx, 0
mov bl, ' ' ; set the background character color and character.
mov bh, cl
.top_msg:
mov cl, [si] ; get the first character of the Top Message
cmp cl, 0 ; make sure it's not a null character (strings are null-terminated)
je .top_msg_finish
mov [eax], cx ; if it isn't then we can put it into video memory
add eax, 2 ; increase the pointer to video memory by 2 bytes (one for character, one for color)
inc si ; and increment the counter and string pointer by 1
inc dx
cmp dx, COLUMNS ; if the counter has reached the end of the row, then we don't need to print the rest of the message.
jne .top_msg
jmp .repeat
.top_msg_finish:
mov cl, ' ' ; put the character that we are printing, a space, into lower bytes of cx
.top_msg_finish_:
mov [eax], cx ; put a space at the video memory
add eax, 2 ; add 2 to the video memeory pointer again, and increment the counter
inc dx
cmp dx, COLUMNS ; if the counter has reached the end of a row then we can stop.
jne .top_msg_finish_
.repeat:
mov [eax], bx
add eax, 2
inc dx
cmp dx, ROWS*COLUMNS
jne .repeat
.move_cursor:
mov bl, 0
mov dl, 0
call graphics_move_cursor
.done:
popa
ret
; ============================================ ;
; Print String Routine
; Arguments: si: String (null-term), bl: Row, dl: Column, ch: Color
; Outputs: None (changes display)
; ============================================ ;
graphics_print_string:
pusha
; calaculate the address of the character.
mov dh, 0 ; ax + dl might result in overflow so we set dh to 0
mov eax, COLUMNS
mul bl ; row * columns
add ax, dx ; (row * columns) + colum
mov bx, 2
mul bx ; multiply everything by 2 because every character takes 2 bytes.
add eax, VID_MEM
mov edx, eax
mov ah, ch
.repeat:
lodsb
cmp al, 0
je .done
; the character and character is now in cx and ready to be printed.
mov [edx], ax
add edx, 2
jmp .repeat
.done:
popa
ret
; ============================================ ;
; Get Cursor Routine
; Arguments: None
; Outputs: bl: Row, dl: Column
; ============================================ ;
graphics_get_cursor:
push ax
mov bx, [GRAPHICS_CURSOR_ROW]
mov dx, [GRAPHICS_CURSOR_COLUMN]
.done:
pop ax
ret
; ============================================ ;
; Move Cursor Routine
; Arguments: bl: Row, dl: Column
; Outputs: None (changes display)
; ============================================ ;
graphics_move_cursor:
pusha
; set the cursor position variable
mov [GRAPHICS_CURSOR_ROW], bl
mov [GRAPHICS_CURSOR_COLUMN], dl
; calaculate the address of the character.
mov dh, 0 ; ax + dl might result in overflow so we set dh to 0
mov eax, COLUMNS
mul bl ; row * columns
add ax, dx ; (row * columns) + column
mov ebx, eax ; it must be stored in bx so we can access it later on
.low_byte:
mov al, 0x0f
mov dx, 0x03D4
out dx, al
mov al, bl
mov dx, 0x03D5
out dx, al
.high_byte:
mov al, 0x0e
mov dx, 0x03D4
out dx, al
mov al, bh
mov dx, 0x03D5
out dx, al
.done:
popa
ret
; ============================================ ;
; Set Page Routine
; Arguments: ax: Page
; Outputs: None (changes display)
; ============================================ ;
graphics_set_page:
pusha
.done:
popa
ret
; ============================================ ;
; Get Page Routine
; Arguments: None
; Outputs: ax: Page
; ============================================ ;
graphics_get_page:
mov ax, [GRAPHICS_PAGE]
.done:
ret
; define cursor position variables
GRAPHICS_CURSOR_ROW db 0
GRAPHICS_CURSOR_COLUMN db 0
GRAPHICS_PAGE db 0
| 26.641304 | 127 | 0.552224 |
e24528a1eaabe6e49668416b97c683d42e1b62a2 | 1,415 | asm | Assembly | source/jni/u2/credits/include.asm | Falken42/SecondReality | b998d193a066523cb4ca2b86c8041bea1bddfcb4 | [
"Unlicense"
] | 9 | 2015-05-13T21:02:00.000Z | 2018-04-15T16:32:27.000Z | source/jni/u2/credits/include.asm | falken42/SecondReality | b998d193a066523cb4ca2b86c8041bea1bddfcb4 | [
"Unlicense"
] | null | null | null | source/jni/u2/credits/include.asm | falken42/SecondReality | b998d193a066523cb4ca2b86c8041bea1bddfcb4 | [
"Unlicense"
] | null | null | null | IDEAL
SEGMENT kakka1 para use16 private 'FAR_DATA'
PUBLIC C pic1
LABEL pic1 BYTE
INCLUDE "pic01.inc"
ENDS
SEGMENT kakka2 para use16 private 'FAR_DATA'
PUBLIC C pic2
LABEL pic2 BYTE
INCLUDE "pic02.inc"
ENDS
SEGMENT kakka3 para use16 private 'FAR_DATA'
PUBLIC C pic3
LABEL pic3 BYTE
INCLUDE "pic03.inc"
ENDS
SEGMENT kakka4 para use16 private 'FAR_DATA'
PUBLIC C pic4
LABEL pic4 BYTE
INCLUDE "pic04.inc"
ENDS
SEGMENT kakka5 para use16 private 'FAR_DATA'
PUBLIC C pic5
LABEL pic5 BYTE
INCLUDE "pic05.inc"
ENDS
SEGMENT kakka5b para use16 private 'FAR_DATA'
PUBLIC C pic5b
LABEL pic5b BYTE
INCLUDE "pic05b.inc"
ENDS
SEGMENT kakka6 para use16 private 'FAR_DATA'
PUBLIC C pic6
LABEL pic6 BYTE
INCLUDE "pic06.inc"
ENDS
SEGMENT kakka7 para use16 private 'FAR_DATA'
PUBLIC C pic7
LABEL pic7 BYTE
INCLUDE "pic07.inc"
ENDS
SEGMENT kakka8 para use16 private 'FAR_DATA'
PUBLIC C pic8
LABEL pic8 BYTE
INCLUDE "pic08.inc"
ENDS
SEGMENT kakka9 para use16 private 'FAR_DATA'
PUBLIC C pic9
LABEL pic9 BYTE
INCLUDE "pic09.inc"
ENDS
SEGMENT kakka10 para use16 private 'FAR_DATA'
PUBLIC C pic10
LABEL pic10 BYTE
INCLUDE "pic10.inc"
ENDS
SEGMENT kakka10b para use16 private 'FAR_DATA'
PUBLIC C pic10b
LABEL pic10b BYTE
INCLUDE "pic10b.inc"
ENDS
SEGMENT asdf byte use16 private 'FAR_DATA'
PUBLIC C font
LABEL font WORD
INCLUDE 'fona.inc'
ENDS
END | 17.469136 | 47 | 0.74841 |
aaa57b1e403c893eb24bdf6ed92786e2621c8822 | 132 | asm | Assembly | libsrc/_DEVELOPMENT/math/float/am9511/lam32/c/sccz80/l_f32_div.asm | ahjelm/z88dk | c4de367f39a76b41f6390ceeab77737e148178fa | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/math/float/am9511/lam32/c/sccz80/l_f32_div.asm | C-Chads/z88dk | a4141a8e51205c6414b4ae3263b633c4265778e6 | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/math/float/am9511/lam32/c/sccz80/l_f32_div.asm | C-Chads/z88dk | a4141a8e51205c6414b4ae3263b633c4265778e6 | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
SECTION code_fp_am9511
PUBLIC l_f32_div
EXTERN cam32_sccz80_fdiv_callee
defc l_f32_div = cam32_sccz80_fdiv_callee
| 18.857143 | 45 | 0.780303 |
1e5cfa2f0afaf4c374258dbffdf69cf859ec66df | 3,548 | asm | Assembly | CS101/MIPS/matriz1.asm | Am3ra/CS | b31026280917479b86cf4f1be1261b247513d550 | [
"MIT"
] | 1 | 2018-08-22T20:17:01.000Z | 2018-08-22T20:17:01.000Z | CS101/MIPS/matriz1.asm | Am3ra/CS | b31026280917479b86cf4f1be1261b247513d550 | [
"MIT"
] | null | null | null | CS101/MIPS/matriz1.asm | Am3ra/CS | b31026280917479b86cf4f1be1261b247513d550 | [
"MIT"
] | null | null | null | .data
mat1: .space 9
mat2: .space 9
mat3: .space 9
message1: .asciiz "Ingrese # positivo, mat A: "
message2: .asciiz "Ingrese # positivo, mat B: "
wrong: .asciiz "El numero deberia ser positivo porfavor: "
newline: .asciiz "\n"
dim: .byte 03
space: .asciiz " "
.text
_main:
la $s0, mat1 #s0 will be mat 1 pointer
la $s1, mat2 #s1 will be mat 2 pointer
la $s2, mat3 #s2 will be mat 3 pointer
lb $s3, dim #s3 will be DIM
mul $s4, $s3, $s3 #s4 will be DIM*DIM
#prepare arguments for Read Matrix A
la $a0, message1 #prepare message to be sent
la $a1, ($s0) #t1 will be temporary pointer
la $a2, ($s4) #maximum size of array elements
jal readMatrix
#prepare arguments for Read Matrix B
la $a0, message2 #prepare message to be sent
la $a1, ($s1) #a1 will be temporary pointer
la $a2, ($s4) #maximum size of array elements
jal readMatrix
#prepere arguments for Matrix Mult
jal multiplyMatrix
#prepare Arguments for printing matrix C
la $a1, ($s2) #temporary pointer for array to be printed
la $a2, ($s4) #maximum index of array elements
la $a3, ($s3) #Dimension
jal printMatrix
li $v0, 10 #end program
syscall
readMatrix:
li $t0, 0 #t0 will be loop counter for reading input
la $t2, ($a0)
loop1:
li $v0, 4 #print string asking for number
syscall
input:
li $v0, 5
syscall #read input of 1 byte
bgez $v0, good_job #validate number is equal to or greater than zero.
nop
la $a0, wrong #print error requesting correct number
li $v0, 4
syscall
b input
good_job:
la $a0, ($t2)
sb $v0, ($a1) #store byte at pointer
addi $a1, $a1, 1 #move pointer by 4 bytes
addi $t0, $t0, 1 #add 1 to counter
bne $t0, $a2, loop1
nop
jr $ra
nop
printMatrix:
li $t0, 1 #row counter
li $t1, 0 #total counter
s:
lbu $a0, ($a1)
li $v0, 1 #print loaded byte
syscall
la $a0, space
li $v0, 4 #print space
syscall
bne $t0, $a3, end
la $a0, newline #if row end then print newline
li $v0, 4
li $t0, 0
syscall
end:
addi $a1, $a1, 1 #move pointer by 1 bytes
addi $t0, $t0, 1
addi $t1, $t1, 1
bne $t1, $a2, s #return to beginning of loop
nop
jr $ra #return to main program
nop
multiplyMatrix:
li $t0, 0 #matrix 1 row counter
li $t1, 0 #matrix 2 column counter
li $t2, 0 #matrix 1 and 2 element counter
la $t3, ($s0) #temporary pointer A
la $t4, ($s1) #temporary pointer B
la $s7, ($s2) #temporary pointer C
la $t5, ($s3) #row/column max
li $t6, 0 #counter for sum
li $t7, 0 #intermediate arithmetic results
inner:
lbu $t8, ($t3) #load Values A, B
lbu $t9, ($t4)
mul $t7, $t8, $t9
add $t6, $t6, $t7 #add to sum A X B
addi $t3, $t3, 1 #move A pinter 1 column right
add $t4, $t4, $t5 #move B pointer 1 row down
addi $t2, $t2, 1 #add to iteratot/counter
bne $t2, $t5, inner #check inner element/ number of columnsA | number of rowsB
li $t2, 0 #reset t2
sb $t6, ($s7) #store result into C
addi $s7, $s7, 1 #move C pointer
li $t6, 0
addi $t1, $t1, 1 #move counter
subu $t3, $t3, $t5 #move pointer A to beginning of row
add $t4, $t1, $s1 #move pointer B to top of column t1
bne $t1, $t5, inner #check m2 column
li $t1, 0 #reset t1
add $t3, $t3, $t5 #move pointer A to beginning of next row
la $t4, ($s1) #reset M2 pointer
addi $t0, $t0, 1
bne $t0, $t5, inner #check m1 row
jr $ra #back to main | 21.373494 | 80 | 0.610767 |
2f85f529f4736cbde5f3b9a7c2bd78c242f50ed1 | 757 | asm | Assembly | oeis/001/A001756.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/001/A001756.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/001/A001756.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A001756: a(n) = A059366(n,n-3) = A059366(n,3) for n >= 3, where the triangle A059366 arises from the expansion of a trigonometric integral.
; Submitted by Jamie Morken(s3)
; 15,60,450,4500,55125,793800,13097700,243243000,5016886875,113716102500,2808787731750,75071235739500,2158298027510625,66409170077250000,2177272076104125000,75769068248423550000,2789248824895091934375,108288483790044745687500,4421779754760160448906250,189438353703935295021562500,8496310163621497981717078125,398112819095407334000457375000,19453240023980131093204167187500,989577862089424059958646765625000,52323929457978297170313447732421875,2871537248653848948706802011555312500
mov $1,$0
add $0,3
bin $0,$1
seq $1,97801 ; a(n) = (2*n)!/(n!*2^(n-1)).
mul $0,$1
div $0,2
mul $0,15
| 63.083333 | 480 | 0.828269 |
4a4fcd62f1d6e47c56daabdd1391c7df231a2832 | 246 | asm | Assembly | run/programs/int2hex.asm | thecodewarrior/KotlinToyCPU | a3e6655efed5fa318d0354ace5141894d4f1176d | [
"MIT"
] | null | null | null | run/programs/int2hex.asm | thecodewarrior/KotlinToyCPU | a3e6655efed5fa318d0354ace5141894d4f1176d | [
"MIT"
] | null | null | null | run/programs/int2hex.asm | thecodewarrior/KotlinToyCPU | a3e6655efed5fa318d0354ace5141894d4f1176d | [
"MIT"
] | null | null | null |
mov 0xf12ae3, r4
mov 28, r3
loop:
shr r4, r3, r2
and r2, 0xf, r2
mov 0, r0
ldr'b r1 [:digits, r2]
pcall 0
cmp r3, 0
eq? jmp :end
sub r3, 4, r3
jmp :loop
end:
halt
digits: %data .ascii "0123456789abcdef"
| 12.947368 | 39 | 0.552846 |
7193c757ba89ec3bf77c449e7eb7f18b25e599ba | 686 | asm | Assembly | oeis/022/A022291.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/022/A022291.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/022/A022291.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A022291: Expansion of 1/((1-x)(1-5x)(1-6x)(1-9x)).
; Submitted by Jon Maiga
; 1,21,292,3402,36043,360843,3485854,32899944,305751325,2812114305,25683350056,233457113526,2115260975647,19123756383207,172639882457698,1556953539144948,14031940169321809,126404565100316349,1138348475732949580,10249404462435071010,92270368456236338611,830588281918498998531,7476227312372961462502,67291657363156669864512,605658660085016098230853,5451130776193811146970553,49061395860961447131049264,441559885313181651184114254,3974082949771935353458979335,35767010672497864791812149215
add $0,2
lpb $0
sub $0,1
add $2,2
mul $2,5
sub $2,9
mul $3,9
add $3,$1
mul $1,6
add $1,$2
lpe
mov $0,$3
| 40.352941 | 486 | 0.817784 |
3aed477addec6e37a4c2770f58027d1cb45edf91 | 26,291 | asm | Assembly | echo/echo_sli.asm | s390guy/simh_tests | 545ca36d735f1136594c14ccabc8f5020a9d75e8 | [
"MIT"
] | 1 | 2021-12-01T01:32:22.000Z | 2021-12-01T01:32:22.000Z | echo/echo_sli.asm | s390guy/simh_tests | 545ca36d735f1136594c14ccabc8f5020a9d75e8 | [
"MIT"
] | null | null | null | echo/echo_sli.asm | s390guy/simh_tests | 545ca36d735f1136594c14ccabc8f5020a9d75e8 | [
"MIT"
] | null | null | null | * Copyright 2021 Harold Grovesteen
*
* MIT License:
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in 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:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* 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
* AUTHORS 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 IN
* THE SOFTWARE.
TITLE 'ECHO - CONSOLE ECHO TEST'
* Program Description:
*
* ECHO is a bare-metal program. It requires input/output commands to
* the system's console device. It's purpose is to exercise the console
* device.
*
* The program is executed by means of an IPL from a card deck. Initially
* a line is diplayed explaining the use of the program. Following this
* a prompt is displayed with the keyboard unlocked for user input.
* Whatever is typed is then printed on the next line. This is followed by the
* prompt with user input expected until the user enters 'quit' in lower case.
* without quotes. quit terminates the program normally.
*
* The system interrupt key or console 'cancel' key will interrupt the
* executing program. Display a message. And then return to the normal
* echo functions described above.
*
* Target Platform: SimH
* Target Architecture: S/360
*
* This is a special test version that uses SLI in write CCW's to debug
* a console condition.
*
* Devices Used:
* 01F - Console device
*
* Program Register Usage:
SPACE 1
R0 EQU 0 Base register for access to the ASA. Required by DSECT
* usage, but available for program usage
R1 EQU 1 Device Channel and Unit Address for I/O instructions
R2 EQU 2 I/O Routine Channel-Address Word
R3 EQU 3 Length of data received from the operator
R4 EQU 4 available
R5 EQU 5 available
R6 EQU 6 available
R7 EQU 7 available
R8 EQU 8 available
R9 EQU 9 available
R10 EQU 10 available
R11 EQU 11 Contains zero for STATUS clearing (zero'd from CPU reset).
R12 EQU 12 The global program base register
R13 EQU 13 External Interruption R15 save register
R14 EQU 14 I/O Routine return register. Program is the caller
R15 EQU 15 Subroutine return register. I/O routine is the caller
SPACE 1
* Disabled Wait State PSW's address field values used by the program:
* X'000000' - Successful execution of the program
* Note: Restart interruptions are not available on S/360 systems.
* X'000018' - Unexpected External interruption occurred.
* Old External PSW at address X'18'
* X'000020' - Unexpected Supervisor interruption occurred.
* Old Supervisor PSW at address X'20'
* X'000028' - Unexpected Program interruption occurred.
* Old Program PSW address X'28'
* X'000030' - Unexpected Machine Check interruption occurred.
* Old Machine Check PSW at address X'30'
* X'000038' - Unexpected Input/Output interruption occurred.
* Old Input/Output PSW at address X'38'
* X'1xccuu' - Device or channel not operational. ccuu=Device Address
* X'2xccuu' - Device or channel busy. ccuu=Device Address
* X'3xccuu' - Device storing of CSW missed ccuu=Device Address
* X'4xccuu' - Unexpected device interruption. ccuu=Device Address
* X'5xddcc' - Console Status problem. dd=device status, cc=channel status
* X'6x00ss' - Console Device sense data. ss=general sense byte
* Sense data reporting is not yet enabled.
* Note: The 'x' in the above wait state codes indicates the program position
* in which the error was detected.
EJECT
* See all object data and macro generated model statements in the listing
PRINT DATA,GEN
SPACE 1
* Inform the SATK macros of the architecture being targeted. Inferred from
* the ASMA -t command-line argument.
ARCHLVL
* Ensure interrupt traps are loaded by iplasma.py before program execution
* begins. This macro will create the memory region that will also contain
* the IPL PSW. The region name defaults to ASAREGN. iplasma.py knows how
* to deal with this situation.
ASASECT ASALOAD
ASAIPL IA=PGMSTART Define the bare-metal program's IPL PSW
TITLE 'ECHO - POSITION 00 - PROGRAM INITIALIZATION'
*
* The Bare-Metal Echo Program
*
SPACE 1
PGMSECT START X'2000',ECHOSLI Start a second region for the program itself
* This results in ECHO.bin being created in the list directed IPL directory
USING ASA,0 Give me instruction access to the ASA CSECT
PGMSTART BALR R12,0 Establish my base register
USING *,R12 Tell the assembler
SPACE 3
* Determine if the console device, subchannel and channel are ready for use.
LH R1,CONDEV Console device address in I/O inst. register
TIO 0(R1) Determine if the console is there
BC B'0001',DEVNOAVL ..No, CC=3 might have a different config address
BC B'0010',DEVBUSY ..No, CC=2 console device or channel is busy
BC B'0100',CSWSTRD ..No, CC=1 CSW stored in ASA at X'40'
* Console device is available (CC=0)!
TITLE 'ECHO - POSITION 01 - GET CONSOLE INPUT'
* Send operator prompt and accept the operator's input
ECHOMAIN DS 0H Query operator and echo data
MVI PGMRTN,ECHOGET Displaying the query...
CLI EISTATUS,EIENABLE Are the external interrupts enabled?
BE INITECHO ..Yes, do not need to do anything.
BAL R15,EXTENA Enable external interruptions
INITECHO DS 0H Bypass external interruptions when already enabled
MVI CANATTN,X'00' Clear cancel/ATTN state
MVI DATA,X'00' Clear the input...
MVC DATA+1(L'DATA-1),DATA ...I/O area.
LA R2,GETDATA Locate the initial CCW
BAL R15,DOIO Request console input
B CNCLHND ..Accept CANCEL and wait for ATTN
* ..On success, echo the operator's response
SPACE 1
* Calculate the length of the operator's input string (may be zero).
LH R3,INLEN Fetch the lengh of the input area
SH R3,CSW+6 Calculate actual bytes read
BZ ECHOCR If no data, operator just hit ENTER
CH R3,QUITLEN Was only four bytes entered?
BNE CONSECHO ..No, echo the input
SPACE 1
CKQUIT DS 0H Check if quit was entered (only when four bytes entered)e
CLC QUIT,DATA Did operator enter quit
BE FINISH ..Yes, end the program.
* ..No, echo the operator's input (fall through)
TITLE 'ECHO - POSITION 02 - ECHO INPUT BACK TO THE CONSOLE'
*
* Echo operator's input data on the console
*
CONSECHO DS 0H Echo operator's input back to the operator
MVI PGMRTN,ECHODATA Displaying the query response..
STH R3,PUTLEN Update the CCW with the actual output length
LA R2,PUTDATA Locate the initial CCW
BAL R15,DOIO Echo the operator's input
B ECHOMAIN ..Ignore CANCEL from operator during echo
B ECHOMAIN On success, return to the main echo loop
SPACE 1
ECHOCR DS 0H Simply echo a carriage return
* Note: a different channel program is required to handle the case where the
* operator has hit only the ENTER key. This results in a calculated length
* of zero (detected above). Zero can not be used as the length of a device
* directed CCW. This logic (functionaly identical to the preceding logic in
* CONSECHO)transmits one byte of data, a new line (carriage return) character
* without the CCW itself adding the carriage return. This logic has a CCW
* lengthfield of one, which IS valid.
MVI PGMRTN,ECHOCRCH Displaying the query response, just a CR
LA R2,PUTCR Point to the CCW that outputs just a CR
BAL R15,DOIO Use subroutine to perform the I/O
B ECHOMAIN ..Ignore CANCEL from the operator
B ECHOMAIN On success, return to the main echo loop
TITLE 'ECHO - CANCEL/ATTN HANDLERS'
CNCLHND DS 0H Handle a CANCEL (UNIT EXCEPTION) from the console
MVI PGMRTN,CNCLPOS CANCEL being handled
OI CANATTN,CANHIT Set existence of the cancel state
LA R2,PUTCNCL Display that a CANCEL was detected
BAL R15,DOIO Perform the console display
B ATTNWAIT ..Ignore CANCEL from the operator
* Wait for an I/O interruption
ATTNWAIT BAL R15,IOWAIT Wait for an I/O interruption
TM CSW+4,X'80' Does the interrupt contain an ATTN?
BNO ATTNWAIT ..No, continue waiting
* ATTENTION detected
OI CANATTN,ATTNHIT ATTN hit (turning off cancel state)
LA R2,PUTATTN Display that an ATTN was detected
BAL R15,DOIO Use subroutine to perform the I/O
B ECHOMAIN ..Ignore CANCEL from the operator
B ECHOMAIN On success, return to the main echo loop
TITLE 'ECHO - INPUT/OUTPUT ROUTINE'
*
* CONSOLE INPUT/OUTPUT ROUTINE
*
* Register Usage:
* R1 - Device address performing the I/O in low-order 16 bits
* R2 - Address of the first CCW of the I/O request, bits 0-7 zeros, 8-31 address
* R11 - Zero (0), used to clear accumulated status field
* R15 - Routine return address:
* Return Conventions:
* R15+0 CANCEL signaled by operator
* R15+4 Normal termination
SPACE 1
DOIO DS 0H
STH R11,STATUS Clear status for console I/O operation
ST R2,CAW Tell the I/O request its address in ASA
SIO 0(R1) Request console channel program to start, did it?
BC B'0001',DEVNOAVL ..No, CC=3 don't know why, but tell someone.
BC B'0010',DEVBUSY ..No, CC=2 console device or channel is busy
BC B'0100',CSWSTRD ..No, CC=1 CSW stored in ASA at X'40'
* Transfer initiated (CC=0)...
POLL TIO 0(R1) Test the I/O progress.
BC B'0010',POLL CC=2, data still being sent, cont. polling
BC B'0001',DEVNOAVL CC=3, don't know why, but tell someone.
BC B'1000',NOCSW CC=0, missed CSW, don't know why abort
* CSW stored (CC=1), analyze for result.
OC STATUS,CSW+4 Accummulate Device and Channel status
CLI STATUS+1,X'00' Did the channel have a problem?
BNE CSWACCUM ..Yes, end with a device/channel error
* Test for abnormal status for a console device
TM STATUS,X'C2' Was a device error reported?
* ATTN, STATUS MODIFIER, and UNIT CHECK are treated as errors. ATTN is only
* possible when no I/O operation (from SIO through DEVICE END) is occurring.
BNZ CSWACCUM ..Yes, end with a device/channel error
* Channel end, control unit end and busy are ignored.
TM STATUS,X'04' Device finally done?
* If DEVICE END not present, the program continues to test for it
BNO POLL ..No, Check again...
SPACE 1
* Check for normal conditions and return to caller
TM STATUS,X'01' UNIT EXCEPTION present?
BNO 4(,R15) ..No, return to caller +4 (Normal end)
* UNIT EXCEPTION, is treated as normal. UNIT EXCEPTION is
* generated by the operator hitting the CANCEL key. Not all console
* emulations support CANCEL from the operator.
BR R15 ..Yes, return to caller +0 (Handle CANCEL)
TITLE 'ECHO - INTERRUPTION HANDLERS AND WAIT ROUTINES'
*
* I/O WAIT SUBROUTINE
*
* Register usage:
* R1 - Device Channel/Unit address
* R12 - Global program base address
* R15 - Subroutine return address
*
* Side Effects:
* External interrupts are disabled following this routine
*
* Abnormal Terminations:
* Interrupt from unexpected device received.
SPACE 1
IOWAIT MVC IONPSW(8),CONT Set up continuation PSW for after I/O interrupt
LPSW WAIT Wait for I/O interruption and CSW from channel
IODONE EQU * The bare-metal program continues here after I/O
MVC IONPSW(8),IOTRAP Restore I/O trap PSW
* Did the interruption come from the expected device?
CH R1,IOOPSW+2 Is the interrupt from the expected device?
BER R15 ..Yes, return to caller
B DEVUNKN ..No, end program with an error
SPACE 1
WAIT PSW360 X'F8',0,2,0,0 Causes CPU to wait for I/O interruption
* Channels 0-4 enabled for interrupts
CONT PSW360 0,0,0,0,IODONE Causes the CPU to continue after waiting
IOTRAP PSW360 0,0,2,0,X'38' I/O trap New PSW (restored after I/O)
SPACE 3
*
* DISABLE EXTERNAL INTERRUPTS
*
* Register usage:
* R12 - Global program base address
* R15 - Routine return address
*
* Side Effects:
* Input/output interruptions disabled for all channels
SPACE 1
EXTDIS DS 0H
LPSW EXTDPSW Disable external interruptions
* Execution continues with the following instruction
EXTDISC MVC EXTNPSW,EXTTRAP Trap any unexpected external interruptions
BR R15 Return to caller
SPACE 1
EXTTRAP PSW360 0,0,0,0,X'58' External interruption trap PSW
* Disable external interruptions and continue with the routine
EXTDPSW PSW360 0,0,0,0,EXTDISC
SPACE 3
*
* ENABLE EXTERNAL INTERRUPTS
*
* Register usage:
* R12 - Global program base address
* R15 - Routine return address
*
* Side Effects:
* Input/output interruptions disabled for all channels
SPACE 1
EXTENA DS 0H
MVC EXTNPSW,EXTHPSW Set external interrupt handler
* Actual external interruptions are not yet enabled.
* Return to caller and simulataneously set external interruptions
ST R15,EXTCPSW+4 Return to caller when the PSW is loaded
MVI EISTATUS,EIENABLE External inteerupts are enabled by the LPSW
LPSW EXTCPSW This instruction enables external interruptions
* Theoretically an external interruption may occur following this
* instruction, but control has already been returned to the caller.
SPACE 1
* Pass control to interrupt handler when an external interrupt occurs, but
* disable any more external interruptions while in the handler.
EXTHPSW PSW360 X'00',0,0,0,EXTHDL
* Enables actual external interruptions while returning to the caller.
EXTCPSW PSW360 X'01',0,0,0,0
SPACE 3
*
* EXTERNAL INTERRUPT HANDLER
*
* Register usage:
* R12 - Global program base address
*
* Two bytes of external interruption information is stored within the
* exernal old PSW at address X'1A'. The old PSW format is:
*
* 18 19 1A 1B 1C 1D 1E 1F
* +0 +8 +16 +24 +32 +40 +48 +56
* +--------+--------+--------+--------+--------+--------+--------+--------+
* |........|........|00000000|TKS00000|........|........|........|........|
* +--------+--------+--------+--------+--------+--------+--------+--------+
*
* Where:
* T == a timer interruption (X'80')
* K == the interrupt key has been hit (X'40')
* S == an external signal has occurred (X'20')
*
* This handler ignores timer and external signals. Only the interrupt key
* is recognized. When an external interruption is ignored, control returns
* to the point of the interruption with external interrupts enabled.
*
* When an interrupt key is detected, any current I/O operation is halted and
* the interrupt key is treated as a cancel, namely waiting for ATTN being
* recognized.
SPACE 1
EXTHDL DS 0H
* The external new PSW that passes control to this point also disables
* external interruptions
TM EXTOPSW+3,X'40' Is this an interrupt key interruption?
BO EXTKEY ..Yes, handle the interrupt key
LPSW EXTOPSW ..No, just return to interrupted logic
* External interrupts are enabled when this PSW is loaded.
SPACE 1
EXTKEY DS 0H Treat the interrupt key like a cancel
MVI PGMRTN,EXTPOS Handling an external interrupt
MVI EISTATUS,X'00' External interrupts disabled
* HALT any I/O operation being executed
HIO 0(R1) Halt the I/O..
BC B'0001',DEVNOAVL CC=3, Device not available, abend
* BC B'1000',AVAILWAT CC=0, Interruption pending in subchannel
* BC B'0100',AVAILWAT CC=1, CSW stored, wait for availability
* BC B'0010',AVAILWAT CC=2, Burst ended on selector channel
SPACE 1
* Wait for the device to become available
* AVAILWAT DS 0H Wait for device to become available
STH R11,STATUS Clear status for console availability
AVAILTST TIO 0(R1) Test the device path
BC B'0010',AVAILTST CC=2, device still busy, cont. checking
BC B'0100',EXTCSW CC=1, CSW stored check it...
BC B'1000',EXTAVAIL CC=0, device is available, continue
BC B'0001',DEVNOAVL CC=3, don't know why, but tell someone.
SPACE 1
EXTCSW DS 0H CSW stored, see if the device and channel are available
OC STATUS,CSW+4 Accummulate Device and Channel status
CLI STATUS+1,X'00' Did the channel have a problem?
BNE CSWACCUM ..Yes, end with a device/channel error
TM STATUS,X'0C' Channel end and device end?
BNO AVAILTST ..No, wait for them to become available
SPACE 1
EXTAVAIL DS 0H Console device now available
LA R2,PUTINKY Point to the CCW that outputs interrupt key msg
BAL R15,DOIO Use subroutine to perform the I/O
B ATTNWAIT ..Ignore CANCEL from the operator
B ATTNWAIT On success, return to the main echo loop
* These branches leave the interrupt handler with external interrupts disabled.
* The external interrupt key is treated as a "cancel". The difference is the
* source: console I/O for the CANCEL key, the program itself for the external
* key interruption.
TITLE 'ECHO - DATA AREAS'
*
* Channel Command Words
*
CC EQU X'40' Command Chain
SLI EQU X'20' Suppress Length Indication
SPACE 1
* Doubleword aligned data
GETDATA CCW X'01',ENTER,CC+SLI,L'ENTER Display 'ENTER: ' on console
* Command-chain (X'40') to the next CCW
CCW X'0A',DATA,SLI,L'DATA Read operator's data
* Suppress Length Indicator - operator's data varies
SPACE 1
PUTATTN CCW X'09',ATTNSTR,SLI,ATTNSTRL Display ATTN string
SPACE 1
PUTCNCL CCW X'09',CNCLSTR,SLI,CNCLSTRL Display the CANCEL string
SPACE 1
PUTCR CCW X'01',CRDATA,SLI,L'CRDATA Echo just a CR
SPACE 1
PUTDATA CCW X'09',DATA,SLI,0 Echo operator's data
ORG PUTDATA+6
PUTLEN DS HL2 Echo'd data's length
SPACE 1
PUTINKY CCW X'09',INKYDAT,SLI,INKYDATL '** INTRP KEY **' message sent
SPACE 1
*
* I/O related information
*
* Half-word aligned data
DS 0H Align half words
CONDEV DC XL2'001F' Console device address
STATUS DC XL2'0000' Used to accumulate unit and channel status
SPACE 1
INLEN DC Y(L'DATA) Input data length (Could also use prev. CCW)
QUITLEN DC Y(L'QUIT) Length of quit literal
SPACE 3
* Unaligned data
SPACE 1
* Program position used in building abend address
INIT EQU X'00' Program initialization
ECHOGET EQU X'01' Operator prompt and input retrieved
ECHODATA EQU X'02' Echoing data from the operator
ECHOCRCH EQU X'03' Echo just a new line character (carriage return)
ATTNPOS EQU X'04' ATTN handler
CNCLPOS EQU X'05' CANCEL handler
EXTPOS EQU X'06' Interruption key being handled
PGMRTN DC AL1(INIT) Initialize program position data
SPACE 1
* CANCEL/ATTN status
CANATTN DC XL1'00'
CANHIT EQU X'80' A cancel key was detected (control-c)
ATTNHIT EQU X'40' An ATTN key was detected (esc)
SPACE 1
* EXTERNAL INTERRUPTION PSW STATE
EISTATUS DC XL1'00' External interrupts disabled
EIENABLE EQU X'80' External interrupts enabled
SPACE 1
* ECHO program data areas
ATTNSTR DC XL1'15',C'** ATTN **'
ATTNSTRL EQU *-ATTNSTR
CNCLSTR DC XL1'15',C'** CANCEL **'
CNCLSTRL EQU *-CNCLSTR
CRDATA DC XL1'15' Just a new line (carriage return) character
ENTER DC C'ENTER: ' Operator prompt
INKYDAT DC XL1'15',C'** INTRP KEY **'
INKYDATL EQU *-INKYDAT
QUIT DC C'quit' 'quit' entered by operator terminates the program
DATA DC XL80'00'
TITLE 'ECHO - PROGRAM TERMINATIONS'
*
* NORMAL PROGARM TERMINATION
*
* Register usage:
* R12 - Global program base address
* Normal Termination:
* Termination code X'000000'
SPACE 1
FINISH LPSW DONE Normally Terminate the program
SPACE 3
*
* REPORT DEVICE NOT OPERATIONAL - Uses Format 1 ABEND
*
* Register usage:
* R1 - Device Channel/Unit address
* R12 - Global program base address
* Abnormal Termination:
* Format 1 ABEND code X'1x'
SPACE 1
DEVNOAVL DS 0H
STH 1,FMT1CUU Set the failing device address
MVI FMT1CODE,X'10' Set the abend code
OC FMT1CODE,PGMRTN Set where the abend was detected
LPSW DONE End execution abnormally
SPACE 3
*
* REPORT DEVICE BUSY - Uses Format 1 ABEND
*
* Register usage:
* R1 - Device Channel/Unit address
* R12 - Global program base address
* Abnormal Termination:
* Format 1 ABEND code X'2x
SPACE 1
DEVBUSY DS 0H
STH 1,FMT1CUU Set the failing device address
MVI FMT1CODE,X'20' Set the abend code
OC FMT1CODE,PGMRTN Set where the abend was detected
LPSW DONE End execution abnormally
SPACE 1
*
* REPORT STORING OF CSW MISSING - Uses Format 1 ABEND
*
* Register usage:
* R1 - Device Channel/Unit address
* R12 - Global program base address
* Abnormal Termination:
* Format 1 ABEND code X'3x
SPACE 1
NOCSW DS 0H
STH 1,FMT1CUU Set the failing device address
MVI FMT1CODE,X'30' Set the abend code
OC FMT1CODE,PGMRTN Set where the abend was detected
LPSW DONE End execution abnormally
SPACE 3
*
* REPORT UNEXPECTED DEVICE RESPONSE - Uses Format 1 ABEND PSW
*
* Register usage:
* R1 - Device Channel/Unit address
* R12 - Global program base address
* Abnormal Termination:
* Format 1 ABEND code X'4x'
SPACE 1
DEVUNKN DS 0H
MVC FMT1CUU,IOOPSW+2 Set the unexpected device address
MVI FMT1CODE,X'40' Set the abend code
OC FMT1CODE,PGMRTN Set where the abend was detected
LPSW DONE End execution abnormally
SPACE 3
*
* REPORT CONSOLE DEVICE OR CHANNEL ERROR STATUS - Uses Format 2 ABEND PSW
*
* Register usage:
* R1 - Device Channel/Unit address
* R12 - Global program base address
* Abnormal Termination:
* Format 2 ABEND code X'5x'
SPACE 1
CSWACCUM DS 0H Store the accumulated status in the abort PSW
MVC FMT2STAT,STATUS Move accumulated status to abort PSW
B CODE50 Set up format 2 abend code
CSWSTRD DS 0H
MVC FMT2STAT,CSW+4 Move stored CSW status to the abort PSW
SPACE 1
CODE50 DS 0H
MVI FMT2CODE,X'50' Set the abend code
OC FMT2CODE,PGMRTN Set where the abend was detected
LPSW DONE End execution abnormally
SPACE 3
*
* REPORT CONSOLE DEVICE SENSE - Uses Format 3 ABEND PSW
*
* Register usage:
* R1 - Device Channel/Unit address
* R12 - Global program base address
* Abnormal Termination:
* Format 3 ABEND code X'6x'
*
*ABENDSNS DS 0H
* MVC FMT3SNS,SENSDATA Move the generic sense byte abend PSW
* MVI FMT3CODE,X'60' Set the abend code
* LPSW DONE
SPACE 3
*
* TERMINATION PSW Formats
*
DONE PSW360 0,0,2,0,0
ORG *-3
FORMAT DS 0AL3
* Format 1 ABEND FORMAT
FMT1CODE DS X'00' aa - Abend codes: 1x, 2x, 3x, 4x - x=program position
FMT1CUU DS H'0' ccuu - address of device causing the termination
ORG FORMAT
* Format 2 ABEND FORMAT
FMT2CODE DS X'00' aa - Abend Code: 5x - x=program position
FMT2STAT DS H'00' ddcc - dd=console device status, cc=channel status
ORG FORMAT
* Format 3 ABEND FORMAT
FMT3CODE DS X'00' aa - Abend Code: 50
DS X'00' not used: X'00'
FMT3SNS DS X'00' ss - console device generic sense data
SPACE 3
*
* Hardware Assigned Storage Locations
*
SPACE 1
* This DSECT allows symbolic access to these locations. The DSECT created is
* named ASA.
ASA ASAREA DSECT=YES
END
| 45.018836 | 82 | 0.641132 |
3be0c795fb3c036c037818ca2ac20cec82f03f87 | 1,692 | asm | Assembly | media/materials/programs/OffsetMapping_specular.asm | Sphinkie/LongForgottenEarth | 9008e4381091579e38feee03c56c5e3435419474 | [
"MIT"
] | null | null | null | media/materials/programs/OffsetMapping_specular.asm | Sphinkie/LongForgottenEarth | 9008e4381091579e38feee03c56c5e3435419474 | [
"MIT"
] | null | null | null | media/materials/programs/OffsetMapping_specular.asm | Sphinkie/LongForgottenEarth | 9008e4381091579e38feee03c56c5e3435419474 | [
"MIT"
] | null | null | null | // ------------------------------------------------------------------------------------------------
// Pixel Shader for doing bump mapping with parallax plus diffuse and specular lighting by nfz
// ------------------------------------------------------------------------------------------------
// uv TEXCOORD0
// lightDir TEXCOORD1
// eyeDir TEXCOORD2
// half TEXCOORD3
// Parameters:
// lightDiffuse c0
// lightSpecular c1
// Parallax scale and bias c2
// normal/height map texunit 0 - height map in alpha channel
// diffuse texture texunit 1
ps.1.4
texld r0, t0 // get height
texcrd r2.xyz, t0 // get uv coordinates
texcrd r3.xyz, t2 // get eyedir vector
mad r0.xyz, r0.a, c2.x, c2.y // displacement = height * scale + bias
mad r2.xyz, r3, r0, r2 // newtexcoord = eyedir * displacement + uv
phase
texld r0, r2.xyz // get normal N using newtexcoord
texld r1, r2.xyz // get diffuse texture using newtexcoord
texcrd r4.xyz, t1 // get lightdir vector
texcrd r5.xyz, t3 // get half angle vector
dp3_sat r5.rgb, r0_bx2, r5 // N dot H - spec calc
dp3_sat r4.rgb, r0_bx2, r4 // N dot L - diffuse calc
+ mul r5.a, r5.r, r5.r
mul r0.rgb, r4, r1 // colour = diffusetex * N dot L
+ mul r5.a, r5.a, r5.a
mul r5.rgb, r5.a, r5.a
mul r5.rgb, r5, r5
mul r5.rgb, r5, r5
mul r5.rgb, r5, c1 // specular = (N dot H)^32 * specularlight
mad r0.rgb, r0, c0, r5 // colour = diffusetex * (N dot L)* diffuselight + specular
+ mov r0.a, c2.b
| 34.530612 | 99 | 0.500591 |
19f77de4cc60706abad798b593de19232ae978c7 | 9,900 | asm | Assembly | helium/tables.asm | viznut/demoscene | 0a9b663a18ce5c31a1243fbdb85794325eeed1d8 | [
"CC0-1.0"
] | 14 | 2021-01-06T12:13:48.000Z | 2021-02-10T20:39:48.000Z | helium/tables.asm | viznut/demoscene | 0a9b663a18ce5c31a1243fbdb85794325eeed1d8 | [
"CC0-1.0"
] | null | null | null | helium/tables.asm | viznut/demoscene | 0a9b663a18ce5c31a1243fbdb85794325eeed1d8 | [
"CC0-1.0"
] | null | null | null | ; da evil command language
; { byte delay; /* in 1/18.2-sex */
; commandcode; }
; |
; |
; \ /
; v
; 1;txt;0 set text (neg vals = go down H*16, left L*16)
; 2..5 fade in/out
; 6;byte set fxbits
; 1 starfield
; 2 vec.engine
; 4 phongball
; 8 use bg image (instead of clearing scr)
; 16 gokhlop picture
; 32 tunnel
; 128 gokhlop eye mode (all da text blink)
; 128+64 = no sTarBaTTLE aiming grid
; 7;paldata;0 set palette
; inits with 0,0,0
; db howmanycols, r_add, g_add, b_add
; where r/g/b max is 255 (not 63)
; 8;objdata set object
; db numfaces
; db col1,col2, vtx0,vtx1,vtx2
; vertexnums are like 4x8x8 coords
; 9 ;addr recall a command (like a subroutine)
; 10 precalc phongball
; 11 calc a cheezeplanet image
; 12 ;a;b;c;z set 3d rotator values (db angles a,b,c; db zoom)
; 13 ;da;db;dc;dz set 3d rotator deltas
; 14 calc tunneltab
; 15 init the tunnel
; 16 lazer gun
; 17 explosion
; 18 textcolor
; 19 fAkEgOurAuD on/off
; else end demo
dezign: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
db 0 ;;;;;;;;;;;;;;;;;;
defapalli:
db 7 ; the first palette
; b g r
db 16,5,2,4 ; 0..96
db 16,2,6,1
db 16,-7,-2,-3
db 16,2,0,2
db 16,8,-4,0
db 16,-8,2,0
db 32,6,3,1
db 32,-6,-2,-1
db 32,3,4,5
db 32,-3,-3,-5
db 16,7,2,1
db 16,-7,4,-2
lametext:
db 0
db 0,6,1 ; starfields
db 0,2 ; fadein
db 16
db 1,-022,"in",-011,"the",-011,"year",-047,"897392",-022,".. .",0
db 48
db 1,-026,"a",-011,"xillion",-012,"light",-010,"years"
db -03b,"away .. .",0
db 32,2 ; fadeout
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
db 16,10 ; prephongball
db 16,6,4+1 ; phongball+stars
db 0,1,0 ; no text
db 0,2 ; fadein
db 16
db 1,-058,"a",-028,"tiny",-010,"planet",-02e,"shines",-018,"..",0
db 80,1,-016,"lonely",0
db 16,1,-042,"peaceful",0
db 16,1,-071,"impossible",0
db 16,1,0
db 16,1,-077,"...",-030,"sigh",0
db 16,2 ; fadeout
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
db 16,11 ; calc da planet image
db 16,6,8 ; show it
db 0,2 ; fadein
db 0,1,-065,"'hELiUM'",-036,"asm'97 pc 4k",0
db 0,19
db 10,14 ; calc tUNNELTAB
db 72-10,2 ; ..& fadeout
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
db 32
db 13,66,16,62,1 ; vec init pos
db 0,12,3,0,7,26 ; vec rotodeltaz
db 0,6,1+2 ; vex on
db 0,1,0 ; no text
db 0,2 ; fadeiN
db 16,1,-011,"patrol ship $F6",-011,"scanning ..",0
db 64-16,12,3,2,7,0 ; zooming stops
db 16,12,0,0,0,0 ; rotation ztopzz
db 0,1," hey,",-02c,"what's that?",0
db 32,1,-045,"*gasp*",0 ; da great escape
db 0,12,12,8,20,-104
db 14,6,0 ; blank for a sec
db 0,1,0
db 10, ; new rotoxiez
db 13,66+64,55,-80-64,01a
db 0,12,-7,-11,0,-20
db 0 ; da evil ship
gokhship:db 8,12
db 051,015, 101q,104q,162q ; warpengine #0
db 051,015, 101q,162q,002q
db 051,015, 104q,162q,002q
pvalo0: db 0c0,0b7, 101q,104q,002q ; rear lightz
db 051,015, 104q,107q,166q ; warpengine #1
db 051,015, 104q,166q,006q
db 051,015, 107q,166q,006q
pvalo1: db 0c0,0b7, 104q,107q,006q ; rear lightz
db 051,015, 131q,137q,174q ; torso
db 051,015, 131q,174q,234q
db 051,015, 137q,174q,234q
pvalo2: db 0c0,0b7, 131q,137q,234q ; rear lightz
db 0,6,1+2 ; fx back on
db 0,1,-021,"the",-01f,"EVIL",-010,"gokhlops",0
db 56,2 ; fadeout
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
db 32,
db 15,1 ; tUNNEL init
db 0,13,66,16,62,01a ; vec init pos
db 0,12,2,6,5,-20
db 0
patship:db 8,8
shipc:;=default obby, the brave patrol ship
db 0a0,088, 120q,214q,242q ; pohja ; 0<->1
db 0a0,088, 160q,274q,242q
db 0a0,088, 214q,274q,246q
db 0a0,088, 214q,274q,242q
db 0c0,060, 224q,246q,044q ; kupu
db 0c0,060, 264q,246q,044q
db 0c0,060, 224q,242q,044q
db 0c0,060, 264q,242q,044q
db 0,6,34 ; tunnel+vex
db 0,2
db 0,1,-024,"entering",-025,"hyberwormtunnel",0
db 64,2
db 32,
db 13,66+64,55,-95-64,018 ; da evil
db 0,12,-7,-11,0,-20 ;^-75
db 0,9
dw offset gokhship
db 0,6,32+2+16
db 0,2
db 0,1,-023,"this is",-017,"captain qzzfw",-014,"speaking",0
db 64,1,-014,"you are",-017,"violating the",-012,"helium squidoid"
db -013,"civil rights",0
db 16,6,32+16
db 32+16,1,-013,"your world",-017,"will be",-017,"exbobolated",0
db 64,1,0
db 32,2
db 32
gokhpalli: ; the red/yellow gOkhlop viewpoint
db 7
db 64, 0,0,2
db 32, 0,1,2
db 62, 0,1,1
db 66, 1,1,0
db 32, 3,2,0
db 0
db 0,6,32+2
db 0,2
db 0,9
dw offset patship
db 0,13,66,16,62,1
db 0,12,7,8,0,10;7
db 0,19 ;fAKeGoURaUD
db 0
alientext:
db 1,32, 7,21,9,32,15,25,25,28,0
db 32,6,32+2+128
db 64-16,1,32,25,25,24,0
db 8,16 ; FEUERHH!!
db 16,12,5,-15,-5,-40
db 0,6,32+2
db 16,1,0
db 16,12,7,8,1,25
db 32,9
dw alientext
db 16,6,32+2+128
db 16,16
db 0,1,0
db 0,6,32+2
db 16,17 ; eKSPLOOSON
db 0,6,32
db 64,2 ;koe!
db 16,6,4+2+1
db 0,10 ; prephongball
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
db 48,9 ; dA sHiP lANdS on dA pHonGbALL
dw offset gokhship
db 0,9
dw offset defapalli
db 0,13,66+64,55,-95-64,01a
db 0,12,2,-1,0,-24
db 0,2
db 64,2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
db 16,6,4+1+16+64
db 0,13,0,0,0,018
db 0,12,6,2,1,0
db 16,9
dw gokhpalli
db 0,2
db 0,18,0f0
db 0,1,-028,"there's",-022,"a small gokhlop",0
db 64,1,-022,".. living",-026,"in your head",0
db 64,1,-025,"listen",-028,"how it cries:",0
db 64,1,-035,"HELIUM",0
db 0,6,4+1+16+128+64
db 64,2
db 16,080
;;;;;;;;;;;;;;;;;;;;;;;;;;;; MUSiC ;;;;;;;;;;;;;;;;;;;;;;;;;;
k equ 255
musaseqs:
;$2
db 12,k,k,k,19,k,12,k,24,k,12,k,19+12,k,12,k ;$02
;$4
db 12,k,15+12,k,19+12,k,12,15+12
db 19+12,12,15+12,19,12+12,12,15+12,19+12
;$6
db 12,12,24,12,24,k,12,k,24,12,24,k,12,k,12,k
;$8
db 12,12,24,12,24,k,12,24,12,k,12,24,12,k,17,k
db 000
seqlist: db 000,050,030
db 032,032
db 052,053
db 032,032
db 033,002
db 000,000
db 040,050
db 054,054
db 074,074
db 044,014
db 004,003, -21
vecpic0:
db 19 ; # polys
db 0d1,0d7,064,088,08d ; dgreen fACE ;pfiip
db 0b2,0b6,0e1,002,003 ; bLACk mOUTH
db 0e1,0e7,0b6,002,003
db 0b2,0b3,0c2,070,073 ; cyan teeth
db 0b3,0b5,0c4,070,073
db 0b5,0b6,0c6,070,073
db 0d2,0e1,0e3,070,073
db 0d4,0e3,0e5,070,073
db 0d6,0e5,0e7,070,073
db 0b2,0e1,0d0,088,08d ; jawz
db 0b6,0e7,0c8,088,08d
db 0e1,0e7,0f2,088,08d ; joopsi
db 0f2,0f6,0e7,088,08d
db 022,017,072,088,08d ; dgreen forehead
db 086,017,072,088,08d
db 061,092,064,0c0,0b6 ; yellow iCe
db 061,064,053,0c0,0b6
db 075,068,096,0c0,0b6
db 075,068,056,0c0,0b6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; eMPTY tABLES
tab0:
paltemp: dw 3*768 dup ?
sintable: dw 256+64 dup ?
unitvex: dw 3*3 dup ?
vertexgrid: db 256*3 dup ?
anglez: dw 3*2 dup ?
tab1: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
tablgt equ tab1-tab0
tempstore:
| 28.862974 | 75 | 0.393232 |
7be745776c8bfbe2ce12ecd06c2e30641849f3aa | 1,233 | asm | Assembly | programs/oeis/263/A263085.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/263/A263085.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/263/A263085.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A263085: Partial sums of A099774 (A099774(n) = number of divisors of n-th odd number).
; 1,3,5,7,10,12,14,18,20,22,26,28,31,35,37,39,43,47,49,53,55,57,63,65,68,72,74,78,82,84,86,92,96,98,102,104,106,112,116,118,123,125,129,133,135,139,143,147,149,155,157,159,167,169,171,175,177,181,187,191,194,198,202,204,208,210,214,222,224,226,230,234,238,244,246,248,254,258,260,264,268,270,278,280,283,289,291,297,301,303,305,309,313,317,325,327,329,337,339,341,345,349,353,359,363,365,369,373,377,381,385,387,396,398,400,408,410,414,418,420,422,428,434,438,442,444,448,456,458,462,468,470,474,478,480,482,490,496,498,504,506,508,516,520,523,527,529,533,541,545,549,553,557,559,563,565,567,579,581,585,589,593,599,603,607,609,615,619,621,625,629,633,641,643,645,653,655,659,667,669,672,678,682,684,690,694,696,704,708,710,714,716,724,730,732,736,740,744,746,754,756,760,770,774,776,780,784,788,792,794,796,802,808,812,820,822,824,832,836,838,847,849,853,857,859,863,867,875,877,885,887,889,897,899,903,907,911,917,923,925,929,937,941,943,947,949,953,965,969,971
mov $2,2
mov $3,4
mov $5,1
mov $6,$0
lpb $0,1
sub $0,1
add $3,2
div $4,$5
add $3,$4
sub $3,1
mov $4,$0
add $5,$2
lpe
mov $0,$3
sub $0,1
mov $1,$0
sub $1,2
add $1,$6
| 56.045455 | 963 | 0.701541 |
ac9de56e868b538287fca778bec4efc92b59163b | 18,105 | asm | Assembly | src/test/ref/test-division.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | 2 | 2022-03-01T02:21:14.000Z | 2022-03-01T04:33:35.000Z | src/test/ref/test-division.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | null | null | null | src/test/ref/test-division.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | null | null | null | // Test the binary division library
/// @file
/// A lightweight library for printing on the C64.
///
/// Printing with this library is done by calling print_ function for each element
// Commodore 64 PRG executable file
.file [name="test-division.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)
.label print_screen = $400
.label print_line_cursor = $f
.label print_char_cursor = 7
// Remainder after unsigned 16-bit division
.label rem16u = 2
// Remainder after signed 16 bit division
.label rem16s = 2
.segment Code
main: {
// print_cls()
jsr print_cls
// test_8u()
jsr test_8u
// test_16u()
jsr test_16u
// test_8s()
jsr test_8s
// test_16s()
jsr test_16s
// }
rts
}
// Clear the screen. Also resets current line/char cursor.
print_cls: {
// memset(print_screen, ' ', 1000)
jsr memset
// }
rts
}
test_8u: {
.label dividend = $11
.label divisor = $12
.label res = 9
.label i = $13
lda #<print_screen
sta.z print_line_cursor
lda #>print_screen
sta.z print_line_cursor+1
lda #<print_screen
sta.z print_char_cursor
lda #>print_screen
sta.z print_char_cursor+1
lda #0
sta.z i
__b1:
// byte dividend = dividends[i]
ldy.z i
lda dividends,y
sta.z dividend
// byte divisor = divisors[i]
lda divisors,y
sta.z divisor
// byte res = div8u(dividend, divisor)
ldx.z dividend
jsr div8u
// byte res = div8u(dividend, divisor)
sta.z res
// print_uchar(dividend)
jsr print_uchar
// print_str(" / ")
lda #<str
sta.z print_str.str
lda #>str
sta.z print_str.str+1
jsr print_str
// print_uchar(divisor)
lda.z divisor
sta.z print_uchar.b
jsr print_uchar
// print_str(" = ")
lda #<str1
sta.z print_str.str
lda #>str1
sta.z print_str.str+1
jsr print_str
// print_uchar(res)
lda.z res
sta.z print_uchar.b
jsr print_uchar
// print_str(" ")
lda #<str2
sta.z print_str.str
lda #>str2
sta.z print_str.str+1
jsr print_str
// print_uchar(rem8u)
stx.z print_uchar.b
jsr print_uchar
// print_ln()
jsr print_ln
// for( byte i: 0..5 )
inc.z i
lda #6
cmp.z i
bne __b11
// }
rts
__b11:
lda.z print_line_cursor
sta.z print_char_cursor
lda.z print_line_cursor+1
sta.z print_char_cursor+1
jmp __b1
.segment Data
dividends: .byte $ff, $ff, $ff, $ff, $ff, $ff
divisors: .byte 5, 7, $b, $d, $11, $13
}
.segment Code
test_16u: {
.label dividend = $d
.label divisor = $a
.label res = 5
.label i = $13
lda #0
sta.z i
__b1:
// word dividend = dividends[i]
lda.z i
asl
tax
lda dividends,x
sta.z dividend
lda dividends+1,x
sta.z dividend+1
// word divisor = divisors[i]
lda divisors,x
sta.z divisor
lda divisors+1,x
sta.z divisor+1
// word res = div16u(dividend, divisor)
lda.z dividend
sta.z div16u.dividend
lda.z dividend+1
sta.z div16u.dividend+1
jsr div16u
// print_uint(dividend)
lda.z print_line_cursor
sta.z print_char_cursor
lda.z print_line_cursor+1
sta.z print_char_cursor+1
// print_uint(dividend)
jsr print_uint
// print_str(" / ")
lda #<str
sta.z print_str.str
lda #>str
sta.z print_str.str+1
jsr print_str
// print_uint(divisor)
lda.z divisor
sta.z print_uint.w
lda.z divisor+1
sta.z print_uint.w+1
jsr print_uint
// print_str(" = ")
lda #<str1
sta.z print_str.str
lda #>str1
sta.z print_str.str+1
jsr print_str
// print_uint(res)
lda.z res
sta.z print_uint.w
lda.z res+1
sta.z print_uint.w+1
jsr print_uint
// print_str(" ")
lda #<str2
sta.z print_str.str
lda #>str2
sta.z print_str.str+1
jsr print_str
// print_uint(rem16u)
lda.z rem16u
sta.z print_uint.w
lda.z rem16u+1
sta.z print_uint.w+1
jsr print_uint
// print_ln()
jsr print_ln
// for( byte i : 0..5)
inc.z i
lda #6
cmp.z i
bne __b1
// }
rts
.segment Data
dividends: .word $ffff, $ffff, $ffff, $ffff, $ffff, $ffff
divisors: .word 5, 7, $b, $d, $11, $13
}
.segment Code
test_8s: {
.label dividend = $11
.label divisor = $16
.label res = 4
.label i = $13
lda #0
sta.z i
__b1:
// signed byte dividend = dividends[i]
ldy.z i
lda dividends,y
sta.z dividend
// signed byte divisor = divisors[i]
lda divisors,y
sta.z divisor
// signed byte res = div8s(dividend, divisor)
ldx.z dividend
tay
jsr div8s
sta.z res
// print_schar(dividend)
lda.z print_line_cursor
sta.z print_char_cursor
lda.z print_line_cursor+1
sta.z print_char_cursor+1
// print_schar(dividend)
jsr print_schar
// print_str(" / ")
lda #<str
sta.z print_str.str
lda #>str
sta.z print_str.str+1
jsr print_str
// print_schar(divisor)
lda.z divisor
sta.z print_schar.b
jsr print_schar
// print_str(" = ")
lda #<str1
sta.z print_str.str
lda #>str1
sta.z print_str.str+1
jsr print_str
// print_schar(res)
lda.z res
sta.z print_schar.b
jsr print_schar
// print_str(" ")
lda #<str2
sta.z print_str.str
lda #>str2
sta.z print_str.str+1
jsr print_str
// print_schar(rem8s)
stx.z print_schar.b
jsr print_schar
// print_ln()
jsr print_ln
// for( byte i: 0..5 )
inc.z i
lda #6
cmp.z i
bne __b1
// }
rts
.segment Data
dividends: .byte $7f, -$7f, -$7f, $7f, $7f, $7f
divisors: .byte 5, 7, -$b, -$d, $11, $13
}
.segment Code
test_16s: {
.label dividend = $d
.label divisor = $14
.label res = 5
.label i = $13
lda #0
sta.z i
__b1:
// signed word dividend = dividends[i]
lda.z i
asl
tax
lda dividends,x
sta.z dividend
lda dividends+1,x
sta.z dividend+1
// signed word divisor = divisors[i]
lda divisors,x
sta.z divisor
lda divisors+1,x
sta.z divisor+1
// signed word res = div16s(dividend, divisor)
jsr div16s
// print_sint(dividend)
lda.z print_line_cursor
sta.z print_char_cursor
lda.z print_line_cursor+1
sta.z print_char_cursor+1
// print_sint(dividend)
jsr print_sint
// print_str(" / ")
lda #<str
sta.z print_str.str
lda #>str
sta.z print_str.str+1
jsr print_str
// print_sint(divisor)
lda.z divisor
sta.z print_sint.w
lda.z divisor+1
sta.z print_sint.w+1
jsr print_sint
// print_str(" = ")
lda #<str1
sta.z print_str.str
lda #>str1
sta.z print_str.str+1
jsr print_str
// print_sint(res)
lda.z res
sta.z print_sint.w
lda.z res+1
sta.z print_sint.w+1
jsr print_sint
// print_str(" ")
lda #<str2
sta.z print_str.str
lda #>str2
sta.z print_str.str+1
jsr print_str
// print_sint(rem16s)
lda.z rem16s
sta.z print_sint.w
lda.z rem16s+1
sta.z print_sint.w+1
jsr print_sint
// print_ln()
jsr print_ln
// for( byte i: 0..5)
inc.z i
lda #6
cmp.z i
bne __b1
// }
rts
.segment Data
dividends: .word $7fff, $7fff, -$7fff, -$7fff, $7fff, -$7fff
divisors: .word 5, -7, $b, -$d, -$11, $13
}
.segment Code
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
// void * memset(void *str, char c, unsigned int num)
memset: {
.const c = ' '
.const num = $3e8
.label str = print_screen
.label end = str+num
.label dst = $d
lda #<str
sta.z dst
lda #>str
sta.z dst+1
__b1:
// for(char* dst = str; dst!=end; dst++)
lda.z dst+1
cmp #>end
bne __b2
lda.z dst
cmp #<end
bne __b2
// }
rts
__b2:
// *dst = c
lda #c
ldy #0
sta (dst),y
// for(char* dst = str; dst!=end; dst++)
inc.z dst
bne !+
inc.z dst+1
!:
jmp __b1
}
// Performs division on two 8 bit unsigned chars
// Returns dividend/divisor.
// The remainder will be set into the global variable rem8u
// Implemented using simple binary division
// __register(A) char div8u(__register(X) char dividend, __register(A) char divisor)
div8u: {
// divr8u(dividend, divisor, 0)
stx.z divr8u.dividend
sta.z divr8u.divisor
jsr divr8u
// divr8u(dividend, divisor, 0)
lda.z divr8u.return
// }
rts
}
// Print a char as HEX
// void print_uchar(__zp($11) char b)
print_uchar: {
.label b = $11
// b>>4
lda.z b
lsr
lsr
lsr
lsr
// print_char(print_hextab[b>>4])
tay
lda print_hextab,y
// Table of hexadecimal digits
jsr print_char
// b&$f
lda #$f
and.z b
// print_char(print_hextab[b&$f])
tay
lda print_hextab,y
jsr print_char
// }
rts
}
// Print a zero-terminated string
// void print_str(__zp($d) char *str)
print_str: {
.label str = $d
__b1:
// while(*str)
ldy #0
lda (str),y
cmp #0
bne __b2
// }
rts
__b2:
// print_char(*(str++))
ldy #0
lda (str),y
jsr print_char
// print_char(*(str++));
inc.z str
bne !+
inc.z str+1
!:
jmp __b1
}
// Print a newline
print_ln: {
__b1:
// print_line_cursor + $28
lda #$28
clc
adc.z print_line_cursor
sta.z print_line_cursor
bcc !+
inc.z print_line_cursor+1
!:
// while (print_line_cursor<print_char_cursor)
lda.z print_line_cursor+1
cmp.z print_char_cursor+1
bcc __b1
bne !+
lda.z print_line_cursor
cmp.z print_char_cursor
bcc __b1
!:
// }
rts
}
// Performs division on two 16 bit unsigned ints
// Returns the quotient dividend/divisor.
// The remainder will be set into the global variable rem16u
// Implemented using simple binary division
// __zp(5) unsigned int div16u(__zp(7) unsigned int dividend, __zp($a) unsigned int divisor)
div16u: {
.label return = 5
.label dividend = 7
.label divisor = $a
// divr16u(dividend, divisor, 0)
jsr divr16u
// divr16u(dividend, divisor, 0)
// }
rts
}
// Print a unsigned int as HEX
// void print_uint(__zp($d) unsigned int w)
print_uint: {
.label w = $d
// print_uchar(BYTE1(w))
lda.z w+1
sta.z print_uchar.b
jsr print_uchar
// print_uchar(BYTE0(w))
lda.z w
sta.z print_uchar.b
jsr print_uchar
// }
rts
}
// Perform division on two signed 8-bit numbers
// Returns dividend/divisor.
// The remainder will be set into the global variable rem8s.
// Implemented using simple binary division
// Follows the C99 standard by truncating toward zero on negative results.
// See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf section 6.5.5
// __register(A) signed char div8s(__register(X) signed char dividend, __register(Y) signed char divisor)
div8s: {
.label neg = $12
// if(dividend<0)
cpx #0
bmi __b1
lda #0
sta.z neg
__b2:
// if(divisor<0)
cpy #0
bmi __b3
tya
__b4:
// char resultu = div8u(dividendu, divisoru)
jsr div8u
// char resultu = div8u(dividendu, divisoru)
tay
// if(neg==0)
lda.z neg
beq __b5
// rem8s = -(signed char)rem8u
txa
eor #$ff
clc
adc #1
tax
// return -(signed char)resultu;
tya
eor #$ff
clc
adc #1
// }
rts
__b5:
tya
rts
__b3:
// -divisor
tya
eor #$ff
clc
adc #1
tay
// neg = neg ^ 1
lda #1
eor.z neg
sta.z neg
tya
jmp __b4
__b1:
// -dividend
txa
eor #$ff
clc
adc #1
tax
lda #1
sta.z neg
jmp __b2
}
// Print a signed char as HEX
// void print_schar(__zp($11) signed char b)
print_schar: {
.label b = $11
// if(b<0)
lda.z b
bmi __b1
// print_char(' ')
lda #' '
jsr print_char
__b2:
// print_uchar((char)b)
jsr print_uchar
// }
rts
__b1:
// print_char('-')
lda #'-'
jsr print_char
// b = -b
lda.z b
eor #$ff
clc
adc #1
sta.z b
jmp __b2
}
// Perform division on two signed 16-bit numbers
// Returns dividend/divisor.
// The remainder will be set into the global variable rem16s.
// Implemented using simple binary division
// Follows the C99 standard by truncating toward zero on negative results.
// See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf section 6.5.5
// __zp(5) int div16s(__zp($d) int dividend, __zp($14) int divisor)
div16s: {
.label return = 5
.label dividend = $d
.label divisor = $14
// divr16s(dividend, divisor, 0)
lda.z dividend
sta.z divr16s.dividend
lda.z dividend+1
sta.z divr16s.dividend+1
lda.z divisor
sta.z divr16s.divisor
lda.z divisor+1
sta.z divr16s.divisor+1
jsr divr16s
// }
rts
}
// Print a signed int as HEX
// void print_sint(__zp($d) int w)
print_sint: {
.label w = $d
// if(w<0)
lda.z w+1
bmi __b1
// print_char(' ')
lda #' '
jsr print_char
__b2:
// print_uint((unsigned int)w)
jsr print_uint
// }
rts
__b1:
// print_char('-')
lda #'-'
jsr print_char
// w = -w
lda #0
sec
sbc.z w
sta.z w
lda #0
sbc.z w+1
sta.z w+1
jmp __b2
}
// Performs division on two 8 bit unsigned chars and an initial remainder
// Returns dividend/divisor.
// The final remainder will be set into the global variable rem8u
// Implemented using simple binary division
// __zp(4) char divr8u(__zp(9) char dividend, __zp($c) char divisor, __register(Y) char rem)
divr8u: {
.label dividend = 9
.label divisor = $c
.label quotient = 4
.label return = 4
ldx #0
txa
sta.z quotient
tay
__b1:
// rem = rem << 1
tya
asl
tay
// dividend & $80
lda #$80
and.z dividend
// if( (dividend & $80) != 0 )
cmp #0
beq __b2
// rem = rem | 1
tya
ora #1
tay
__b2:
// dividend = dividend << 1
asl.z dividend
// quotient = quotient << 1
asl.z quotient
// if(rem>=divisor)
cpy.z divisor
bcc __b3
// quotient++;
inc.z quotient
// rem = rem - divisor
tya
sec
sbc.z divisor
tay
__b3:
// for( char i : 0..7)
inx
cpx #8
bne __b1
// rem8u = rem
tya
tax
// }
rts
}
// Print a single char
// void print_char(__register(A) char ch)
print_char: {
// *(print_char_cursor++) = ch
ldy #0
sta (print_char_cursor),y
// *(print_char_cursor++) = ch;
inc.z print_char_cursor
bne !+
inc.z print_char_cursor+1
!:
// }
rts
}
// Performs division on two 16 bit unsigned ints and an initial remainder
// Returns the quotient dividend/divisor.
// The final remainder will be set into the global variable rem16u
// Implemented using simple binary division
// __zp(5) unsigned int divr16u(__zp(7) unsigned int dividend, __zp($a) unsigned int divisor, __zp(2) unsigned int rem)
divr16u: {
.label rem = 2
.label dividend = 7
.label quotient = 5
.label return = 5
.label divisor = $a
ldx #0
txa
sta.z quotient
sta.z quotient+1
sta.z rem
sta.z rem+1
__b1:
// rem = rem << 1
asl.z rem
rol.z rem+1
// BYTE1(dividend)
lda.z dividend+1
// BYTE1(dividend) & $80
and #$80
// if( (BYTE1(dividend) & $80) != 0 )
cmp #0
beq __b2
// rem = rem | 1
lda #1
ora.z rem
sta.z rem
__b2:
// dividend = dividend << 1
asl.z dividend
rol.z dividend+1
// quotient = quotient << 1
asl.z quotient
rol.z quotient+1
// if(rem>=divisor)
lda.z rem+1
cmp.z divisor+1
bcc __b3
bne !+
lda.z rem
cmp.z divisor
bcc __b3
!:
// quotient++;
inc.z quotient
bne !+
inc.z quotient+1
!:
// rem = rem - divisor
lda.z rem
sec
sbc.z divisor
sta.z rem
lda.z rem+1
sbc.z divisor+1
sta.z rem+1
__b3:
// for( char i : 0..15)
inx
cpx #$10
bne __b1
// rem16u = rem
// }
rts
}
// Perform division on two signed 16-bit numbers with an initial remainder.
// Returns dividend/divisor. The remainder will be set into the global variable rem16s.
// Implemented using simple binary division
// Follows the C99 standard by truncating toward zero on negative results.
// See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf section 6.5.5
// __zp(5) int divr16s(__zp(7) int dividend, __zp($a) int divisor, int rem)
divr16s: {
.label dividendu = 7
.label divisoru = $a
.label resultu = 5
.label return = 5
.label dividend = 7
.label divisor = $a
// if(dividend<0 || rem<0)
lda.z dividend+1
bmi __b1
ldy #0
__b2:
// if(divisor<0)
lda.z divisor+1
bmi __b3
__b4:
// unsigned int resultu = divr16u(dividendu, divisoru, remu)
jsr divr16u
// unsigned int resultu = divr16u(dividendu, divisoru, remu)
// if(neg==0)
cpy #0
beq __breturn
// rem16s = -(signed int)rem16u
lda #0
sec
sbc.z rem16s
sta.z rem16s
lda #0
sbc.z rem16s+1
sta.z rem16s+1
// return -(signed int)resultu;
lda #0
sec
sbc.z return
sta.z return
lda #0
sbc.z return+1
sta.z return+1
__breturn:
// }
rts
__b3:
// -divisor
lda #0
sec
sbc.z divisoru
sta.z divisoru
lda #0
sbc.z divisoru+1
sta.z divisoru+1
// neg = neg ^ 1
tya
eor #1
tay
jmp __b4
__b1:
// -dividend
lda #0
sec
sbc.z dividendu
sta.z dividendu
lda #0
sbc.z dividendu+1
sta.z dividendu+1
ldy #1
jmp __b2
}
.segment Data
print_hextab: .text "0123456789abcdef"
str: .text " / "
.byte 0
str1: .text " = "
.byte 0
str2: .text " "
.byte 0
| 20.715103 | 119 | 0.59166 |
aba9cb79662bd076abf914e200852e044c5c90ae | 253 | asm | Assembly | libsrc/_DEVELOPMENT/ctype/c/sdcc_iy/isodigit_fastcall.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/ctype/c/sdcc_iy/isodigit_fastcall.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/ctype/c/sdcc_iy/isodigit_fastcall.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
; int isodigit(int c)
SECTION code_clib
SECTION code_ctype
PUBLIC _isodigit_fastcall
EXTERN asm_isodigit, error_zc
_isodigit_fastcall:
inc h
dec h
jp nz, error_zc
ld a,l
call asm_isodigit
ld l,h
ret c
inc l
ret
| 10.12 | 29 | 0.675889 |
fcb843ff5c881590a5ae70bed8c2e6d00e850529 | 1,284 | asm | Assembly | src/d2_functions/d2win_functions/d2win_load_mpq_shim.asm | IAmTrial/D2Template89 | 98a480d8d2465d842d68617f66526e3ba7e05fac | [
"Apache-2.0"
] | null | null | null | src/d2_functions/d2win_functions/d2win_load_mpq_shim.asm | IAmTrial/D2Template89 | 98a480d8d2465d842d68617f66526e3ba7e05fac | [
"Apache-2.0"
] | null | null | null | src/d2_functions/d2win_functions/d2win_load_mpq_shim.asm | IAmTrial/D2Template89 | 98a480d8d2465d842d68617f66526e3ba7e05fac | [
"Apache-2.0"
] | null | null | null | ; D2Template89
; Copyright 2021 Mir Drualga
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
global _D2_D2Win_LoadMpq_1_11_Shim
extern _D2_D2Win_LoadMpq_FuncPtr
section .data
section .bss
section .text
; struct D2MpqArchiveHandle* D2_D2Win_LoadMpq_1_11_Shim(
; const char* dll_file_name,
; const char* mpq_file_name,
; const char* mpq_name,
; i32 is_set_err_on_drive_query_fail,
; void* (*on_fail_callback)(void),
; i32 priority)
_D2_D2Win_LoadMpq_1_11_Shim:
push ebp
mov ebp, esp
push ecx
push edx
mov eax, dword [ebp + 28]
push dword [ebp + 24]
push dword [ebp + 20]
push dword [ebp + 16]
push dword [ebp + 12]
push dword [ebp + 8]
call dword [_D2_D2Win_LoadMpq_FuncPtr]
pop edx
pop ecx
leave
ret
| 24.226415 | 74 | 0.718069 |
3b7f4a8901294af25f83a34da02095cdc834cab0 | 1,051 | asm | Assembly | sbsext/ext/close.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | sbsext/ext/close.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | sbsext/ext/close.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | * Close BASIC channels V0.0 1985 Tony Tebby
*
section exten
*
xdef close
*
xref ut_chget get channel
xref ut_chlook look for channel in table
*
include dev8_sbsext_ext_keys
*
* d4 s pointer to channel table
* d6 s channel number
* a0 s channel ID
*
close
cmp.l a3,a5 any parameters?
beq.s cls_all ... none, close all
cls_ploop
bsr.l ut_chget get a channel
bsr.s cls_chan and close it
cmp.l a3,a5 end of list?
bgt.s cls_ploop ... no
rts ... done
cls_all
moveq #-1,d6 do not default
addq.w #4,d6 start with channel #3
cls_aloop
bsr.l ut_chlook look in table
bsr.s cls_chan
addq.w #1,d6 next channel number
cmp.l bv_chp(a6),d4 end of table yet?
blt.s cls_aloop
rts
*
cls_chan
bne.s cls_no if error, check for not open (OK)
moveq #-1,d0 channel ID -1 for closed file
move.l d0,(a6,d4.l)
moveq #io.close,d0 close channel
trap #2
cls_ok
moveq #0,d0
rts
cls_no
moveq #err.no,d1 not open value
cmp.l d0,d1 was it not open?
beq.s cls_ok ... yes, ok
addq.l #4,sp ... no, quit
rts
end
| 20.211538 | 49 | 0.680304 |
e256f08b020f4974e9d6591ed31cea74266161be | 401 | asm | Assembly | sk/sfx/42.asm | Cancer52/flamedriver | 9ee6cf02c137dcd63e85a559907284283421e7ba | [
"0BSD"
] | 9 | 2017-10-09T20:28:45.000Z | 2021-06-29T21:19:20.000Z | sk/sfx/42.asm | Cancer52/flamedriver | 9ee6cf02c137dcd63e85a559907284283421e7ba | [
"0BSD"
] | 12 | 2018-08-01T13:52:20.000Z | 2022-02-21T02:19:37.000Z | sk/sfx/42.asm | Cancer52/flamedriver | 9ee6cf02c137dcd63e85a559907284283421e7ba | [
"0BSD"
] | 2 | 2018-02-17T19:50:36.000Z | 2019-10-30T19:28:06.000Z | Sound_42_Header:
smpsHeaderStartSong 3
smpsHeaderVoice Sound_42_Voices
smpsHeaderTempoSFX $01
smpsHeaderChanSFX $01
smpsHeaderSFXChannel cPSG3, Sound_42_PSG3, $10, $00
; PSG3 Data
Sound_42_PSG3:
smpsPSGform $E7
smpsPSGvoice sTone_17
dc.b nCs6, $04
smpsModSet $02, $01, $06, $07
dc.b nE5, $10
smpsStop
; Song seems to not use any FM voices
Sound_42_Voices:
| 20.05 | 52 | 0.713217 |
e42999afe08b04797ab4b5a941f294836c3dc0a4 | 710 | asm | Assembly | programs/requ_aux.asm | cid0rz/CTS-Cidorz-Train-System | e7b7c8b09c80d1f49ee631069dadb393ec2e241b | [
"MIT"
] | 5 | 2020-10-02T13:45:24.000Z | 2022-02-06T12:28:34.000Z | programs/requ_aux.asm | cid0rz/CTS-Cidorz-Train-System | e7b7c8b09c80d1f49ee631069dadb393ec2e241b | [
"MIT"
] | 1 | 2020-10-20T12:38:36.000Z | 2020-10-22T16:26:23.000Z | programs/requ_aux.asm | cid0rz/CTS-Cidorz-Train-System | e7b7c8b09c80d1f49ee631069dadb393ec2e241b | [
"MIT"
] | 1 | 2020-12-22T12:32:20.000Z | 2020-12-22T12:32:20.000Z | ##REQ STATION ORDER HANDLER
:start
clr
hlt ;this configuration allows you to start reading data straight after the RUN signal
mov r6 green1 ;pointer will start here, this records Z the number of trains to wait
mov out1 1[virtual-signal=signal-D] ;requester stations just need to pint the train back to depot with D=1 signal
:wait_for_train
btr [virtual-signal=signal-destination] ;when a train leaves smart-train-stop will emit 1 tick signal of this type
sub r6 1 ;account for teh train just left
bgt r6 0 :wait_for_train ;check if there are more trains to come
mov out1 1[virtual-signal=signal-fcpu-run] ;if no more trains send main requester fCPU RUN signal
mov out1 0
jmp :start
| 50.714286 | 117 | 0.761972 |
6843a08fe552b2c3b85e411d5da786bc84370f4c | 742 | asm | Assembly | oeis/064/A064549.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/064/A064549.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/064/A064549.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A064549: a(n) = n * Product_{primes p|n} p.
; Submitted by Simon Strandgaard
; 1,4,9,8,25,36,49,16,27,100,121,72,169,196,225,32,289,108,361,200,441,484,529,144,125,676,81,392,841,900,961,64,1089,1156,1225,216,1369,1444,1521,400,1681,1764,1849,968,675,2116,2209,288,343,500,2601,1352,2809,324,3025,784,3249,3364,3481,1800,3721,3844,1323,128,4225,4356,4489,2312,4761,4900,5041,432,5329,5476,1125,2888,5929,6084,6241,800,243,6724,6889,3528,7225,7396,7569,1936,7921,2700,8281,4232,8649,8836,9025,576,9409,1372,3267,1000
add $0,1
mov $1,1
mov $2,2
lpb $0
mov $3,$0
lpb $3
mov $4,$0
mod $4,$2
add $2,1
cmp $4,0
cmp $4,0
sub $3,$4
lpe
mov $5,$2
lpb $0
dif $0,$2
mul $5,$2
lpe
mul $1,$5
lpe
mov $0,$1
| 28.538462 | 438 | 0.656334 |
79fd4c82e305004b9772ce7efaa29258e9081195 | 668 | asm | Assembly | oeis/272/A272130.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/272/A272130.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/272/A272130.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A272130: a(n) = 16*n^3 + 10*n^2 + 4*n + 1.
; Submitted by Jamie Morken(s1)
; 1,31,177,535,1201,2271,3841,6007,8865,12511,17041,22551,29137,36895,45921,56311,68161,81567,96625,113431,132081,152671,175297,200055,227041,256351,288081,322327,359185,398751,441121,486391,534657,586015,640561,698391,759601,824287,892545,964471,1040161,1119711,1203217,1290775,1382481,1478431,1578721,1683447,1792705,1906591,2025201,2148631,2276977,2410335,2548801,2692471,2841441,2995807,3155665,3321111,3492241,3669151,3851937,4040695,4235521,4436511,4643761,4857367,5077425,5304031,5537281
mul $0,4
mov $1,$0
add $1,1
add $0,$1
mul $0,$1
add $0,4
mul $1,$0
mov $0,$1
div $0,8
add $0,1
| 44.533333 | 494 | 0.772455 |
f21e4295ea9e3d83c0c6b45b5b1445dd04c77948 | 389 | asm | Assembly | oeis/112/A112610.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | null | null | null | oeis/112/A112610.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | null | null | null | oeis/112/A112610.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | null | null | null | ; A112610: Number of representations of n as a sum of two squares and two triangular numbers.
; Submitted by Simon Strandgaard
; 1,6,13,14,18,32,31,30,48,38,42,78,57,54,80,62,84,96,74,96,121,108,90,128,98,102,192,110,114,182,133,156,176,160,138,192,180,150,234,158,192,288,183,174,240,182,228,320,194,198,272,252,240,288,256,252,403,230
mul $0,2
seq $0,8438 ; Sum of divisors of 2*n + 1.
| 55.571429 | 209 | 0.724936 |
0cbef029e665025b02d18a5102271379efb3311f | 690 | asm | Assembly | oeis/059/A059929.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/059/A059929.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/059/A059929.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A059929: a(n) = Fibonacci(n)*Fibonacci(n+2).
; Submitted by Jon Maiga
; 0,2,3,10,24,65,168,442,1155,3026,7920,20737,54288,142130,372099,974170,2550408,6677057,17480760,45765226,119814915,313679522,821223648,2149991425,5628750624,14736260450,38580030723,101003831722,264431464440,692290561601,1812440220360,4745030099482,12422650078083,32522920134770,85146110326224,222915410843905,583600122205488,1527884955772562,4000054745112195,10472279279564026,27416783093579880,71778070001175617,187917426909946968,491974210728665290,1288005205276048899,3372041405099481410
mov $2,1
lpb $0
sub $0,1
add $1,$4
add $2,1
mov $3,$2
add $4,$1
add $1,$2
add $2,$4
mov $4,$3
lpe
mov $0,$3
| 40.588235 | 492 | 0.798551 |
2d0e27cb57944ba46ddbbd87f356bbb8b5d89239 | 296 | asm | Assembly | programs/oeis/084/A084631.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/084/A084631.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/084/A084631.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A084631: Floor(C(n+8,8)/C(n+2,2)).
; 1,3,7,16,33,61,107,178,286,442,663,969,1384,1938,2664,3605,4807,6325,8222,10571,13455,16965,21206,26295,32364,39556,48032,57970,69564,83028,98595,116522,137085,160585,187349,217730,252109,290895,334529,383484
mov $1,$0
add $1,8
bin $1,6
mul $1,2
div $1,56
| 32.888889 | 210 | 0.726351 |
eda43defb095d21ed6f10fcc276dc60e311b7875 | 1,012 | asm | Assembly | external/source/shellcode/windows/x86/src/stage/stage_shell.asm | loathsomeguy/metasploit-framework | 86ae268af14899ccedaa5716b5905e18104bddca | [
"BSD-2-Clause",
"BSD-3-Clause"
] | 47 | 2021-01-20T15:30:47.000Z | 2022-03-31T07:51:01.000Z | external/source/shellcode/windows/x86/src/stage/stage_shell.asm | hellorubbish/vipermsf | 9df632bd854160175600d97271694240030cb9fe | [
"BSD-2-Clause",
"BSD-3-Clause"
] | 1 | 2021-05-31T13:03:30.000Z | 2021-05-31T13:03:30.000Z | external/source/shellcode/windows/x86/src/stage/stage_shell.asm | hellorubbish/vipermsf | 9df632bd854160175600d97271694240030cb9fe | [
"BSD-2-Clause",
"BSD-3-Clause"
] | 27 | 2021-01-22T05:06:46.000Z | 2022-03-31T03:28:15.000Z | ;-----------------------------------------------------------------------------;
; Author: Stephen Fewer (stephen_fewer[at]harmonysecurity[dot]com)
; Compatible: Windows 7, 2008, Vista, 2003, XP, 2000, NT4
; Version: 1.0 (28 July 2009)
; Size: 240 bytes
; Build: >build.py stage_shell
;-----------------------------------------------------------------------------;
[BITS 32]
[ORG 0]
; By here EDI will be our socket and EBP will be the address of 'api_call' from stage 1.
; We reset EBP to the address of 'api_call' as found in this blob to avoid any problems
; if the old stage 1 location gets munged.
cld ; Clear the direction flag.
call start ; Call start, this pushes the address of 'api_call' onto the stack.
%include "./src/block/block_api.asm"
start: ;
pop ebp ; Pop off the address of 'api_call' for calling later.
%include "./src/block/block_shell.asm"
; Perform the call to our EXITFUNC.
%include "./src/block/block_exitfunk.asm" | 46 | 92 | 0.567194 |
a00bf137d435c1fa611d22a130ceadfcc6cfdbba | 849 | asm | Assembly | cards/bn6/ItemCards/137-F009 Vic's Vengeance.asm | RockmanEXEZone/MMBN-Mod-Card-Kit | d591ddca5566dbb323dc19c11e69410fa4073d1b | [
"Unlicense"
] | 10 | 2017-12-05T14:25:38.000Z | 2022-02-21T04:28:00.000Z | cards/bn6/ItemCards/137-F009 Vic's Vengeance.asm | RockmanEXEZone/MMBN-Mod-Card-Kit | d591ddca5566dbb323dc19c11e69410fa4073d1b | [
"Unlicense"
] | null | null | null | cards/bn6/ItemCards/137-F009 Vic's Vengeance.asm | RockmanEXEZone/MMBN-Mod-Card-Kit | d591ddca5566dbb323dc19c11e69410fa4073d1b | [
"Unlicense"
] | null | null | null | .include "defaults_item.asm"
table_file_jp equ "exe6-utf8.tbl"
table_file_en equ "bn6-utf8.tbl"
game_code_len equ 3
game_code equ 0x4252354A // BR5J
game_code_2 equ 0x42523545 // BR5E
game_code_3 equ 0x42523550 // BR5P
card_type equ 0
card_id equ 29
card_no equ "029"
card_sub equ "Item Card 029"
card_sub_x equ 62
card_desc_len equ 1
card_desc_1 equ "Vic's Vengeance"
card_desc_2 equ ""
card_desc_3 equ ""
card_name_jp_full equ "執念深さ"
card_name_jp_game equ "入道のしゅうねんぶかさ"
card_name_en_full equ "Vic's Vengeance"
card_name_en_game equ "Vic's Vengeance"
card_game_desc_jp_len equ 3
card_game_desc_jp_1 equ "入道のしゅうねんぶかさ!"
card_game_desc_jp_2 equ "エネミーサーチ 2コ"
card_game_desc_jp_3 equ "を手に入れた!"
card_game_desc_en_len equ 2
card_game_desc_en_1 equ "Vic's vengeance!"
card_game_desc_en_2 equ "Got 2 LocEnemy!"
card_game_desc_en_3 equ "" | 28.3 | 42 | 0.796231 |
da88dc7a7123e703713654796585001c1d324d9a | 11,326 | asm | Assembly | texmap/john.asm | arbruijn/d1dos | 00b969f31fd475530e7e24d7e9759c70705634e0 | [
"Unlicense"
] | 2 | 2022-01-15T17:56:45.000Z | 2022-02-16T17:58:02.000Z | texmap/john.asm | arbruijn/d1dos | 00b969f31fd475530e7e24d7e9759c70705634e0 | [
"Unlicense"
] | 1 | 2022-02-16T18:08:42.000Z | 2022-02-21T07:42:27.000Z | texmap/john.asm | arbruijn/d1dos | 00b969f31fd475530e7e24d7e9759c70705634e0 | [
"Unlicense"
] | null | null | null | ;THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
;SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
;END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
;ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
;IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
;SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
;FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
;CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
;AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
;COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
align 4
TopOfLoop4:
add ebx, DU1
add ebp, DV1
add ecx, DZ1
; Done with ebx, ebp, ecx until next iteration
push ebx
push ecx
push ebp
push edi
; Find fixed U1
mov eax, ebx
PDIV
mov ebx, eax ; ebx = U1 until pop's
; Find fixed V1
mov eax, ebp
PDIV
mov ebp, eax ; ebp = V1 until pop's
mov ecx, U0 ; ecx = U0 until pop's
mov edi, V0 ; edi = V0 until pop's
; Make ESI = V0:U0 in 6:10,6:10 format
mov eax, ecx
shr eax, 6
mov esi, edi
shl esi, 10
mov si, ax
; Make EDX = DV:DU in 6:10,6:10 format
mov eax, ebx
sub eax, ecx
sar eax, NBITS+6
mov edx, ebp
sub edx, edi
shl edx, 10-NBITS ; EDX = V1-V0/ 4 in 6:10 int:frac
mov dx, ax ; put delta u in low word
; Save the U1 and V1 so we don't have to divide on the next iteration
mov U0, ebx
mov V0, ebp
pop edi ; Restore EDI before using it
; LIGHTING CODE
mov ebx, _fx_l
mov ebp, _fx_dl_dx1
REPT (1 SHL (NBITS-2))
REPT 2
mov eax, esi ; get u,v
shr eax, 26 ; shift out all but int(v)
shld ax,si,6 ; shift in u, shifting up v
add esi, edx ; inc u,v
mov al, es:[eax] ; get pixel from source bitmap
mov ah, bh ; form lighting table lookup value
add ebx, ebp ; update lighting value
mov cl, fs:[eax] ; xlat thru lighting table into dest buffer
; eax = 0
; ebx = l in fixed 24.8 (really 8.8)
; ecx = (dv << 16) | du (in fixed 8.8)
; edx = free
; esi = ptr to source bitmap
; edi = destination ptr
; ebp = dldx (in fixed 24.8) (really 8.8)
; MEM [0..3] = (u<<16) | v (in fixed 8.8)
; Code for 8-bit destination, lighting
mov al, [0] ; get u
mov ah, [2] ; get v
add [0], ecx ; inc u,v
mov al, [esi+eax] ; get source pixel
mov ah, bh ; form lighting lookup value
mov al, FadeTable[eax] ; get lit pixel
mov ah, [edi] ; get prev pixel
mov al, Transparent[eax] ; get transluscent pixel value
mov [edi], al ; write pixel to frame buffer
inc edi ; inc dest
add ebx, ebp ; inc lighting value
; Code for 8-bit destination, no lighting
mov al, [0] ; get u
mov ah, [2] ; get v
add [0], ecx ; inc u,v
mov al, [esi+eax] ; get source pixel
mov [edi], al ; write pixel to frame buffer
inc edi ; inc dest
add ebx, ebp ; inc dl
; old way
mov eax,ebp ; clear for
add ebp,edx ; update v coordinate
shr eax,26 ; shift in v coordinate
shld eax,ebx,6 ; shift in u coordinate while shifting up v coordinate
add ebx,ecx ; update u coordinate
mov al,[esi+eax] ; get pixel from source bitmap
mov [edi],al
inc edi
; Code for 15-bit destination, with fade table in hardware
mov al, ch ; get u,v
mov ah, dh ;
mov al, es:[eax]
mov ah, bh
mov [edi], ax ; write pixel to frame buffer
add edi, 2
add ecx, esi
bswap esi
add edx, esi
bswap esi
add ebx, ebp
; Code for 15-bit destination, with RGB 15 bit in hardware...
mov al, ch ; get u,v
mov ah, dh ;
mov al, es:[eax]
mov ah, bh
mov ax, gs:[eax*2]
mov [edi], ax ; write pixel to frame buffer
add edi, 2
add ecx, esi
bswap esi
add edx, esi
bswap esi
add ebx, ebp
mov eax, esi ; get u,v
shr eax, 26 ; shift out all but int(v)
shld ax,si,6 ; shift in u, shifting up v
add esi, edx ; inc u,v
mov al, es:[eax] ; get pixel from source bitmap
mov ah, bh ; form lighting table lookup value
esi, ebp
esi, ebp,
; Do odd pixel
mov eax, esi ; get u,v
shr eax, 26 ; shift out all but int(v)
shld ax,si,6 ; shift in u, shifting up v
add esi, edx ; inc u,v
mov al, es:[eax] ; get pixel from source bitmap
mov ah, bh ; form lighting table lookup value
add ebx, ebp ; update lighting value
mov ch, fs:[eax] ; xlat thru lighting table into dest buffer
ror ecx, 16 ; move to next double dest pixel position
ENDM
mov [edi],ecx ; Draw 4 pixels to display
add edi,4
ENDM
; LIGHTING CODE
mov _fx_l, ebx
pop ebp
pop ecx
pop ebx
dec _loop_count
jnz TopOfLoop4
mov eax, esi ; get u,v
shr eax, 26 ; shift out all but int(v)
shld ax,si,6 ; shift in u, shifting up v
add esi, edx ; inc u,v
mov al, es:[eax] ; get pixel from source bitmap
cmp al,255
je skipa1
mov ah, bh ; form lighting table lookup value
add ebx, ebp ; update lighting value
mov al, fs:[eax] ; xlat thru lighting table into dest buffer
mov [edi],al
mov eax, esi ; get u,v
shr eax, 26 ; shift out all but int(v)
shld ax,si,6 ; shift in u, shifting up v
add esi, edx ; inc u,v
mov al, es:[eax] ; get pixel from source bitmap
mov ah, bh ; form lighting table lookup value
add ebx, ebp ; update lighting value
mov al, fs:[eax] ; xlat thru lighting table into dest buffer
mov ah, [edi] ; get pixel already drawn here
mov al, gs:[eax] ; lookup in translation table
mov [edi],al ; write pixel
; Code for 8-bit destination, lighting, transluscency
mov dx, [edi]
mov al, [0] ; get u
mov ah, [2] ; get v
add [0], ecx ; inc u,v
mov al, [esi+eax] ; get source pixel
mov ah, bh ; form lighting lookup value
mov al, FadeTable[eax] ; get lit pixel
mov ah, dl ; get prev pixel
add ebx, ebp ; inc lighting value
mov dl, TransTable[eax] ; get transluscent pixel value
mov al, [0] ; get u
mov ah, [2] ; get v
add [0], ecx ; inc u,v
mov al, [esi+eax] ; get source pixel
mov ah, bh ; form lighting lookup value
mov al, FadeTable[eax] ; get lit pixel
mov ah, dh ; get prev pixel
add ebx, ebp ; inc lighting value
mov dh, TransTable[eax] ; get transluscent pixel value
mov [edi], dx ; write 2 pixels to frame buffer
inc edi ; move to next pixel
inc edi ; move to next pixel
; compute v coordinate
mov eax,ebp ; get v
cdq
idiv ecx ; eax = (v/z)
and eax,3fh ; mask with height-1
mov ebx,eax
; compute u coordinate
mov eax,esi ; get u
cdq
idiv ecx ; eax = (u/z)
shl eax,26
shld ebx,eax,6 ; ebx = v*64+u
; read 1 pixel
movzx eax,byte ptr es:[ebx] ; get pixel from source bitmap
; LIGHTING CODE
mov ebx, _fx_l ; get temp copy of lighting value
mov ah, bh ; get lighting level
add ebx, _fx_dl_dx ; update lighting value
mov al, fs:[eax] ; xlat pixel thru lighting tables
mov _fx_l, ebx ; save temp copy of lighting value
mov [edi],al
inc edi
; update deltas
add ebp,_fx_dv_dx
add esi,_fx_du_dx
add ecx,_fx_dz_dx
xchg esi, ebx
dec _loop_count
jns tmap_loop
fix fixdiv(fix a,fix b);
#pragma aux fixdiv parm [eax] [ebx] modify exact [eax edx] = \
"cdq " \
"idiv ebx" \
fix u = u0;
fix v = v0;
fix z = z0;
fix l = l0;
for ( x=x1; x<=x2; x++ ) {
if ( z < zbuffer[x] ) {
zbuffer[x] = z;
color = bitmap[(u/z)&63][(v/z)&63];
if ( color != xparent ) {
color = LightingTable[color][f2i(l)&31];
pixel[x] = color;
}
}
u += du;
v += dv;
z += dz;
l += dl;
}
;================ PERSPECTIVE TEXTURE MAP INNER LOOPS ========================
;
; Usage in loop:
; eax division, pixel value
; ebx source pixel pointer
; ecx z
; edx division
; ebp v
; esi u
; edi destination pixel pointer
rept niters
mov eax, [_fx_z] ; get z-value
cmp zbuffer[edi], eax ; check if closer
jge skip1 ; don't do if z farther away
mov zbuffer[edi], eax ; update z-buffer
mov eax,[_fx_v] ; get v
cdq ; sign extend into edx:eax
idiv [_fx_z] ; eax = (v/z)
and eax,63 ; mask with height-1
mov ebx,eax ; start build bitmap address
mov eax,[_fx_u] ; get u
cdq ; sign extend into edx:eax
idiv [_fx_z] ; eax = (u/z)
shl eax,26 ; continue building bitmap address
shld ebx,eax,6 ; ebx = v*64+u
mov al,byte ptr es:[ebx] ; get pixel from source bitmap
cmp al,255 ; check if it's transparent
je skip1 ; don't write if transparent
mov bx, [_fx_l] ; get lighting value
mov bl, al ; build lighting table lookup index
mov al, lighting[ebx] ; lookup lighting value
mov video[edi],al ; write the pixel
skip1: inc edi ; go to next pixel address
add [_fx_l],[_fx_dl_dx] ; increment lighting
add [_fx_u],[_fx_du_dx] ; increment u
add [_fx_v],[_fx_dv_dx] ; incrememt v
add [_fx_z],[_fx_dz_dx] ; increment z
je _div_0_abort ; would be dividing by 0, so abort
endm
mov eax, F1_0
mov ebx, [z]
mov edx,eax
sar edx,16
shl eax,16
idiv ebx
"imul edx" \
"shrd eax,edx,16";
// assume 8.12 fixed point
rept niters
mov eax, [_fx_z] ; get z-value
cmp zbuffer[edi], eax ; check if closer
jge skip1 ; don't do if z farther away
mov zbuffer[edi], eax ; update z-buffer
mov eax,[_fx_v] ; get v
cdq
idiv eax, [z]
mov ebx,eax ; start build bitmap address
mov eax,[_fx_u] ; get u
imul eax, [z]
shl eax,26 ; continue building bitmap address
shld ebx,eax,6 ; ebx = v*64+u
mov al,byte ptr es:[ebx] ; get pixel from source bitmap
cmp al,255 ; check if it's transparent
je skip1 ; don't write if transparent
mov bx, [_fx_l] ; get lighting value
mov bl, al ; build lighting table lookup index
mov al, lighting[ebx] ; lookup lighting value
mov video[edi],al ; write the pixel
skip1: inc edi ; go to next pixel address
add [_fx_l],[_fx_dl_dx] ; increment lighting
add [_fx_u],[_fx_du_dx] ; increment u
add [_fx_v],[_fx_dv_dx] ; incrememt v
add [_fx_z],[_fx_dz_dx] ; increment z
je _div_0_abort ; would be dividing by 0, so abort
endm
;================ PERSPECTIVE TEXTURE MAP INNER LOOPS ========================
;
; Usage in loop:
; eax division, pixel value
; ebx source pixel pointer
; ecx z
; edx division
; ebp v
; esi u
; edi destination pixel pointer
rept niters
cmp zbuffer[edi], ecx ; check if closer
jge skip1 ; don't do if z farther away
mov zbuffer[edi], ecx ; update z-buffer
mov eax,[_fx_v] ; get v
mov edx,[_fx_u] ; get u
idiv ecx ; eax = (v/z)
and eax,63 ; mask with height-1
mov ebx,eax ; start build bitmap address
mov eax,[_fx_u] ; get u
cdq ; sign extend into edx:eax
idiv ecx ; eax = (u/z)
shl eax,26 ; continue building bitmap address
shld ebx,eax,6 ; ebx = v*64+u
mov al,byte ptr es:[ebx] ; get pixel from source bitmap
cmp al,255 ; check if it's transparent
je skip1 ; don't write if transparent
mov bx, [_fx_l] ; get lighting value
mov bl, al ; build lighting table lookup index
mov al, lighting[ebx] ; lookup lighting value
mov video[edi],al ; write the pixel
skip1: inc edi ; go to next pixel address
add [_fx_l],[_fx_dl_dx] ; increment lighting
add [_fx_u],[_fx_du_dx] ; increment u
add [_fx_v],[_fx_dv_dx] ; incrememt v
add ecx,[_fx_dz_dx] ; increment z
je _div_0_abort ; would be dividing by 0, so abort
endm
| 25.740909 | 78 | 0.644623 |
b3e7fee52dc35c92fce58b5a4345453d59af0125 | 379 | asm | Assembly | data/mapObjects/ViridianMart.asm | AmateurPanda92/pokemon-rby-dx | f7ba1cc50b22d93ed176571e074a52d73360da93 | [
"MIT"
] | 9 | 2020-07-12T19:44:21.000Z | 2022-03-03T23:32:40.000Z | data/mapObjects/ViridianMart.asm | JStar-debug2020/pokemon-rby-dx | c2fdd8145d96683addbd8d9075f946a68d1527a1 | [
"MIT"
] | 7 | 2020-07-16T10:48:52.000Z | 2021-01-28T18:32:02.000Z | data/mapObjects/ViridianMart.asm | JStar-debug2020/pokemon-rby-dx | c2fdd8145d96683addbd8d9075f946a68d1527a1 | [
"MIT"
] | 2 | 2021-03-28T18:33:43.000Z | 2021-05-06T13:12:09.000Z | ViridianMart_Object:
db $0 ; border block
db 2 ; warps
warp 3, 7, 1, -1
warp 4, 7, 1, -1
db 0 ; signs
db 3 ; objects
object SPRITE_MART_GUY, 0, 5, STAY, RIGHT, 1 ; person
object SPRITE_BUG_CATCHER, 5, 5, WALK, 1, 2 ; person
object SPRITE_BLACK_HAIR_BOY_1, 3, 3, STAY, NONE, 3 ; person
; warp-to
warp_to 3, 7, VIRIDIAN_MART_WIDTH
warp_to 4, 7, VIRIDIAN_MART_WIDTH
| 21.055556 | 61 | 0.686016 |
f1d4d85733fc872483a11903feac3c4bacc89c52 | 385 | asm | Assembly | oeis/052/A052594.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/052/A052594.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/052/A052594.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A052594: E.g.f. x(1+x-2x^2)/(1-2x).
; Submitted by Christian Krause
; 0,1,6,24,192,1920,23040,322560,5160960,92897280,1857945600,40874803200,980995276800,25505877196800,714164561510400,21424936845312000,685597979049984000,23310331287699456000
mov $2,2
cmp $2,$0
add $2,2
lpb $0
add $3,1
lpb $3
mul $2,$0
sub $0,$3
mul $2,2
div $3,10
lpe
lpe
mov $0,$2
div $0,4
| 20.263158 | 174 | 0.688312 |
85c270a979799e52da0a17aaa1505e99b723e367 | 4,998 | asm | Assembly | mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/string.asm | gb-archive/really-old-stuff | ffb39a518cad47e23353b3420b88e2f3521fd3d7 | [
"Apache-2.0"
] | 10 | 2016-10-27T20:46:02.000Z | 2021-11-01T15:49:13.000Z | mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/string.asm | gb-archive/really-old-stuff | ffb39a518cad47e23353b3420b88e2f3521fd3d7 | [
"Apache-2.0"
] | null | null | null | mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/string.asm | gb-archive/really-old-stuff | ffb39a518cad47e23353b3420b88e2f3521fd3d7 | [
"Apache-2.0"
] | 2 | 2015-03-11T14:28:08.000Z | 2017-11-02T10:57:57.000Z | ; String library
#include once <free.asm>
__STR_ISNULL: ; Returns A = FF if HL is 0, 0 otherwise
ld a, h
or l
sub 1 ; Only CARRY if HL is NULL
sbc a, a ; Only FF if HL is NULL (0 otherwise)
ret
__STRCMP: ; Compares strings at HL, DE: Returns 0 if EQual, -1 if HL < DE, +1 if HL > DE
; A register is preserved and returned in A'
PROC ; __FASTCALL__
LOCAL __STRCMPZERO
LOCAL __STRCMPEXIT
LOCAL __STRCMPLOOP
LOCAL __NOPRESERVEBC
LOCAL __EQULEN
LOCAL __EQULEN1
LOCAL __HLZERO
ex af, af' ; Saves current A register in A' (it's used by STRXX comparison functions)
ld a, h
or l
jr z, __HLZERO
ld a, d
or e
ld a, 1
ret z ; Returns +1 if HL is not NULL and DE is NULL
ld c, (hl)
inc hl
ld b, (hl)
inc hl ; BC = LEN(a$)
push hl ; HL = &a$, saves it
ex de, hl
ld e, (hl)
inc hl
ld d, (hl)
inc hl
ex de, hl ; HL = LEN(b$), de = &b$
; At this point Carry is cleared, and A reg. = 1
sbc hl, bc ; Carry if len(b$) > len(a$)
jr z, __EQULEN ; Jump if they have the same length so A reg. = 0
jr c, __EQULEN1 ; Jump if len(b$) > len(a$) so A reg. = 1
__NOPRESERVEBC:
add hl, bc ; Restore HL (original length)
ld b, h ; len(b$) <= len(a$)
ld c, l ; so BC = hl
dec a ; At this point A register = 0, it must be -1 since len(a$) > len(b$)
__EQULEN:
dec a ; A = 0 if len(a$) = len(b$), -1 otherwise
__EQULEN1:
pop hl ; Recovers A$ pointer
push af ; Saves A for later (Value to return if strings reach the end)
ld a, b
or c
jr z, __STRCMPZERO ; empty string being compared
; At this point: BC = lesser length, DE and HL points to b$ and a$ chars respectively
__STRCMPLOOP:
ld a, (de)
cpi
jr nz, __STRCMPEXIT ; (HL) != (DE). Examine carry
jp po, __STRCMPZERO ; END of string (both are equal)
inc de
jp __STRCMPLOOP
__STRCMPZERO:
pop af ; This is -1 if len(a$) < len(b$), +1 if len(b$) > len(a$), 0 otherwise
ret
__STRCMPEXIT: ; Sets A with the following value
dec hl ; Get back to the last char
cp (hl)
sbc a, a ; A = -1 if carry => (DE) < (HL); 0 otherwise (DE) > (HL)
cpl ; A = -1 if (HL) < (DE), 0 otherwise
add a, a ; A = A * 2 (thus -2 or 0)
inc a ; A = A + 1 (thus -1 or 1)
pop bc ; Discard top of the stack
ret
__HLZERO:
or d
or e
ret z ; Returns 0 (EQ) if HL == DE == NULL
ld a, -1
ret ; Returns -1 if HL is NULL and DE is not NULL
ENDP
; The following routines perform string comparison operations (<, >, ==, etc...)
; On return, A will contain 0 for False, other value for True
; Register A' will determine whether the incoming strings (HL, DE) will be freed
; from dynamic memory on exit:
; Bit 0 => 1 means HL will be freed.
; Bit 1 => 1 means DE will be freed.
__STREQ: ; Compares a$ == b$ (HL = ptr a$, DE = ptr b$). Returns FF (True) or 0 (False)
push hl
push de
call __STRCMP
pop de
pop hl
;inc a ; If A == -1, return 0
;jp z, __FREE_STR
;dec a ;
;dec a ; Return -1 if a = 0 (True), returns 0 if A == 1 (False)
sub 1
sbc a, a
jp __FREE_STR
__STRNE: ; Compares a$ != b$ (HL = ptr a$, DE = ptr b$). Returns FF (True) or 0 (False)
push hl
push de
call __STRCMP
pop de
pop hl
;jp z, __FREE_STR
;ld a, 0FFh ; Returns 0xFFh (True)
jp __FREE_STR
__STRLT: ; Compares a$ < b$ (HL = ptr a$, DE = ptr b$). Returns FF (True) or 0 (False)
push hl
push de
call __STRCMP
pop de
pop hl
jp z, __FREE_STR ; Returns 0 if A == B
dec a ; Returns 0 if A == 1 => a$ > b$
;jp z, __FREE_STR
;inc a ; A = FE now (-2). Set it to FF and return
jp __FREE_STR
__STRLE: ; Compares a$ <= b$ (HL = ptr a$, DE = ptr b$). Returns FF (True) or 0 (False)
push hl
push de
call __STRCMP
pop de
pop hl
dec a ; Returns 0 if A == 1 => a$ < b$
;jp z, __FREE_STR
;ld a, 0FFh ; A = FE now (-2). Set it to FF and return
jp __FREE_STR
__STRGT: ; Compares a$ > b$ (HL = ptr a$, DE = ptr b$). Returns FF (True) or 0 (False)
push hl
push de
call __STRCMP
pop de
pop hl
jp z, __FREE_STR ; Returns 0 if A == B
inc a ; Returns 0 if A == -1 => a$ < b$
;jp z, __FREE_STR ; Returns 0 if A == B
;ld a, 0FFh ; A = FE now (-2). Set it to FF and return
jp __FREE_STR
__STRGE: ; Compares a$ >= b$ (HL = ptr a$, DE = ptr b$). Returns FF (True) or 0 (False)
push hl
push de
call __STRCMP
pop de
pop hl
inc a ; Returns 0 if A == -1 => a$ < b$
;jr z, __FREE_STR
;ld a, 0FFh ; A = FE now (-2). Set it to FF and return
__FREE_STR: ; This exit point will test A' for bits 0 and 1
; If bit 0 is 1 => Free memory from HL pointer
; If bit 1 is 1 => Free memory from DE pointer
; Finally recovers A, to return the result
PROC
LOCAL __FREE_STR2
LOCAL __FREE_END
ex af, af'
bit 0, a
jr z, __FREE_STR2
push af
push de
call __MEM_FREE
pop de
pop af
__FREE_STR2:
bit 1, a
jr z, __FREE_END
ex de, hl
call __MEM_FREE
__FREE_END:
ex af, af'
ret
ENDP
| 22.017621 | 88 | 0.598639 |
f931cbe30091952a6795ec300ed5845c2f6c9436 | 677 | asm | Assembly | oeis/323/A323768.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/323/A323768.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/323/A323768.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A323768: a(n) = Sum_{k=0..floor(n/2)} binomial(n-k,k)^k.
; Submitted by Christian Krause
; 1,1,2,3,5,14,43,171,1234,9075,94295,1685324,28688843,804627839,34189166176,1379425012899,106952499421507,10394354507270548,1052079100669253203,221582922117645427461,48152920476428200426258,13152336142340905111739041,7119693088810253296207226731,3482555622457387054623800189244,2725547146521064087801934090866785,3537747513675521829561248283150592525,4063273671178623579535513665531655696826,9270479602017895009983340480832276987397837,27271203986134269495107225418321095753752676521
lpb $0
sub $0,1
add $2,1
mov $3,$0
bin $3,$2
pow $3,$2
add $1,$3
lpe
add $1,1
mov $0,$1
| 45.133333 | 484 | 0.828656 |
da6859b1bef6979525dfd9bd6306e352f21fea9f | 1,075 | asm | Assembly | Code/utils.asm | LeifBloomquist/VICMIDI | 29c43bd537bd7cdb2db395c594a7804abb98915d | [
"MIT"
] | 7 | 2016-04-04T04:26:50.000Z | 2021-03-02T13:17:38.000Z | Code/utils.asm | LeifBloomquist/VICMIDI | 29c43bd537bd7cdb2db395c594a7804abb98915d | [
"MIT"
] | 2 | 2021-03-02T12:34:11.000Z | 2021-03-03T16:32:44.000Z | Code/utils.asm | LeifBloomquist/VICMIDI | 29c43bd537bd7cdb2db395c594a7804abb98915d | [
"MIT"
] | 2 | 2017-05-24T13:12:59.000Z | 2021-07-21T05:34:52.000Z | ; VIC Version by Schema/AIC (Leif Bloomquist)
; Original by Six/Style (Oliver VieBrooks)
; Fast POKE of hex value to screen
; also see HEXPOKE macro
; print hex char $ of number in a at location referenced by screen_temp
hexstr
ldy #$00
pha
and #$f0
clc
lsr
lsr
lsr
lsr
tax
lda hexstring,x
sta ($22),y
iny
pla
and #$0f
tax
lda hexstring,x
sta ($22),y
rts
; print hex char $ of number in a SLOW!
hexx dc.b $00
printhexstr:
stx hexx
pha
and #$f0
clc
lsr
lsr
lsr
lsr
tax
lda hexstring,x
jsr $ffd2
pla
and #$0f
tax
lda hexstring,x
jsr $ffd2
ldx hexx
rts
hexstring
.byte "0123456789ABCDEF"
; ==============================================================
; Most defaults are NTSC. This code overrides for PAL.
; ==============================================================
setup_pal:
lda $EDE4
cmp #$0C
beq DOPAL
; NTSC System detected
lda #$00
sta bank
jmp showbank ; There's an rts there
; PAL System detected
DOPAL
lda #$01
sta bank
jmp showbank ; There's an rts there
; EOF! | 13.782051 | 72 | 0.579535 |
1cd7c565ce06b512526da4e80bdf2d91c6ee3207 | 136 | asm | Assembly | libsrc/fcntl/dummy/lseek.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/fcntl/dummy/lseek.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/fcntl/dummy/lseek.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | ; $Id: lseek.asm,v 1.2 2015/01/19 01:32:43 pauloscustodio Exp $
PUBLIC lseek
.lseek
ld hl,1 ;non zero is error
ld d,h
ld e,l
ret
| 13.6 | 63 | 0.661765 |
1a474d5573cf5a89728857fd4c2a59d7bfff8661 | 67,657 | asm | Assembly | base/mvdm/wow16/kernel31/3gcompac.asm | npocmaka/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | base/mvdm/wow16/kernel31/3gcompac.asm | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | base/mvdm/wow16/kernel31/3gcompac.asm | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | TITLE GCOMPACT - Global memory compactor
.sall
.xlist
include kernel.inc
.list
WM_COMPACTING = 041h
.386p
include protect.inc
DataBegin
externB Kernel_Flags
externW WinFlags
externW Win386_Blocks
externW PagingFlags
externD gcompact_start
externD gcompact_timer
externD pPostMessage
externD NextCandidate
fSwitchStacks DB 0
fUpDown DB 0
DataEnd
externFP GlobalCompact
ifdef WOW
externFP VirtualFree
endif
sBegin CODE
assumes CS,CODE
assumes fs, nothing
externNP glrudel
externNP gmarkfree
externNP gcheckfree
externNP gdel_free
externNP gsplice
externNP gnotify
externNP genter
externNP gleave
externNP Enter_gmove_stack
externNP Leave_gmove_stack
if KDEBUG
externFP ValidateFreeSpaces
endif
externNP set_selector_address32
ifndef WOW_x86
externNP get_rover_232
endif
externNP AssociateSelector32
externNP alloc_arena_header
externNP free_arena_header
externNP mark_sel_NP
externNP PreAllocArena
externNP DPMIProc
externNP get_physical_address
if KDEBUG
externNP CheckGlobalHeap
endif
;-----------------------------------------------------------------------;
; gcompact ;
; ;
; Compacts the global heap. ;
; ;
; Arguments: ;
; DX = minimum #contiguous bytes needed ;
; DS:DI = address of global heap information ;
; ;
; Returns: ;
; AX = size of largest contiguous free block ;
; ES:DI = arena header of largest contiguous free block ;
; DX = minimum #contiguous bytes needed ;
; ;
; Error Returns: ;
; ;
; Registers Preserved: ;
; SI ;
; ;
; Registers Destroyed: ;
; CX ;
; ;
; Calls: ;
; gcmpheap ;
; gcheckfree ;
; gdiscard ;
; ;
; History: ;
; ;
; Thu Sep 25, 1986 05:34:32p -by- David N. Weise [davidw] ;
; Added this nifty comment block. ;
;-----------------------------------------------------------------------;
assumes ds, nothing
assumes es, nothing
cProc gcompact,<PUBLIC,NEAR>
cBegin nogen
CheckKernelDS fs
ReSetKernelDS fs
push esi
smov es,40h
mov ax,es:[6Ch] ; get the BIOS ticker count
sub gcompact_timer.lo,ax
or Kernel_Flags[1],kf1_MEMORYMOVED
mov si, [di].gi_cmpflags
push si
push si
test WinFlags[1], WF1_PAGING
jz short @F
; First time:
or [di].gi_cmpflags, GA_NOCOMPACT ; No movement
@@:
gcompactl:
if KDEBUG
call ValidateFreeSpaces
endif
push edx ; Save requested size
cmp [di].gi_reserve,edi ; Is there a reserve swap area?
je short gcompact1 ; No, then dont compact lower heap
mov esi,[di].phi_first ; Yes, compact lower heap
mov ebx,pga_next
call gcmpheap
gcompact1:
mov esi,[di].phi_last ; Compact upper heap
mov ebx,pga_prev
call gcmpheap
pop edx ; Get requested size
mov esi,eax ; ES points to largest free block
or eax,eax ; Did we find a free block?
jz short gcompact2 ; No, try discarding
call gcheckfree ; Yes, see if block big enough
jae short gcompactxx ; Yes, all done
gcompact2: ; Discarding allowed?
cmp [di].hi_freeze,di ; Heap frozen?
jne short gcompactxx ; Yes, return
test [di].gi_cmpflags,GA_NODISCARD
jnz short gcompactx ; No, return
test WinFlags[1], WF1_PAGING
jnz short @F
test [di].gi_cmpflags, GA_NOCOMPACT ; Ignore flag if paging
jnz short gcompactx
@@:
push esi
call gdiscard ; No, try discarding
pop ecx ; Saved ESI may be bogus if gdiscard
; discarded anything...
jnz short gcompactl ; Compact again if anything discarded
mov esi, ecx ; Nothing discarded so ES OK.
gcompactx:
test WinFlags[1], WF1_PAGING
jz short gcompactxx
pop si ; Original flags
mov [di].gi_cmpflags, si
or si, GA_NOCOMPACT+GA_NODISCARD
push si ; Abort next time
test [di].gi_cmpflags, GA_NOCOMPACT
jz short gcompactl
gcompactxx:
add sp,2 ; Toss working flags
push ax
push dx
push es
mov ax,40h
mov es,ax
mov ax,es:[6Ch]
mov si,ax
cmp pPostMessage.sel,0 ; is there a USER around yet?
jz short tock
add gcompact_timer.lo,ax
sub ax,gcompact_start.lo
cmp ax,546 ; 30 secs X 18.2 tics/second
jb short tock
cmp ax,1092 ; 60 secs
ja short tick
mov cx,gcompact_timer.lo ; poor resolution of timer!
jcxz short tick
xchg ax,cx
xor dx,dx
xchg ah,al ; shl 8 DX:AX
xchg dl,al
div cx
cmp ax,32 ; < 12.5% ?
jb short tick
mov ah,al
mov bx,-1 ; broadcast
mov cx,WM_COMPACTING
xor dx,dx
cCall pPostMessage,<bx, cx, ax, dx, dx>
tick: mov gcompact_start.lo,si
mov gcompact_timer.lo,0
tock: pop es
pop dx
pop ax
pop [di].gi_cmpflags
pop esi ; Restore SI
ret
UnSetKernelDS fs
cEnd nogen
;-----------------------------------------------------------------------;
; gcmpheap ;
; ;
; ;
; Arguments: ;
; EBX = pga_prev or pga_next ;
; EDX = minimum #contiguous bytes needed ;
; DS:DI = address of global heap information ;
; FS = Kernel DATA ;
; ;
; Returns: ;
; EAX = largest free block ;
; ;
; Error Returns: ;
; ;
; Registers Preserved: ;
; ;
; Registers Destroyed: ;
; AX,CX ;
; ;
; Calls: ;
; gslide ;
; gbestfit ;
; ;
; History: ;
; ;
; Thu Sep 25, 1986 05:38:16p -by- David N. Weise [davidw] ;
; Added this nifty comment block. ;
;-----------------------------------------------------------------------;
assumes ds,nothing
assumes es,nothing
cProc gcmpheap,<PUBLIC,NEAR>
cBegin nogen
CheckKernelDS fs
ReSetKernelDS fs
mov NextCandidate, -1
xor eax,eax ; Nothing found yet
push eax ; Save largest free block so far
gchloop:
cmp ds:[esi].pga_owner,di
je short gchfreefnd
cmp ds:[esi].pga_owner, GA_NOT_THERE
jne short gchnext
mov NextCandidate, -1
gchnext:
mov esi, ds:[esi+ebx]
cmp esi, ds:[esi+ebx] ; Sentinel?
jne short gchloop ; no, continue
gchexit:
pop eax ; Return largest free block in AX
ret
gchfreefnd:
test [di].gi_cmpflags,GA_NOCOMPACT
jnz short gchmaxfree ; No, just compute max free.
cmp [di].hi_freeze,di ; Heap frozen?
jne short gchmaxfree ; Yes, just compute max free.
push esi
test [di].gi_cmpflags,COMPACT_ALLOC
jz short no_hack
call gcheckfree ; Allocating, this big enough?
jb short no_hack ; yes, STOP NOW!
cmp bl,pga_prev ; Compacting upper heap?
jnz short no_hack
test [di].gi_cmpflags,GA_DISCCODE
jz short no_hack
cmp edx,ds:[esi].pga_size
ja short no_hack
mov esi,ds:[esi].pga_next
test ds:[esi].pga_flags,GA_DISCCODE
jnz short hack
cmp ds:[esi].pga_owner,GA_SENTINAL
jz short hack
cmp ds:[esi].pga_owner,GA_NOT_THERE
jnz short no_hack
hack:
pop esi
pop eax
mov eax,esi
ret
no_hack:
pop esi
test byte ptr WinFlags[1], WF1_PAGING ; Paging?
jnz short best_it ; yes, don't slide
call PreAllocArena
jz short gchmaxfree
push edx
call gslide
pop edx
jnz short gchfreefnd
best_it:
push edx
call gfirstfit
pop edx
gchmaxfree:
cmp bl,pga_prev ; Compacting upper heap?
jne short gchnext ; No, dont compute largest free block
cmp ds:[esi].pga_owner,di ; Is current free?
jne gchnext ; No, ignore it then
pop eax ; Recover largest free block so far
push edx
cmp esi,eax ; Same as current?
je short gchmf2 ; Yes, no change then
push eax
cmp ds:[di].gi_reserve,edi ; Is there a code reserve area?
je short gchmf0 ; No, continue
test ds:[di].gi_cmpflags,GA_DISCCODE ; If allocating disc
jnz short gchmf0 ; code ignore the fence
mov ax, [di].gi_disfence_hi
shl eax, 16
mov ax, [di].gi_disfence_lo
mov edx, ds:[esi].pga_size ; Size of this block
add edx, ds:[esi].pga_address ; End of this block
sub eax, edx ; Fence above it?
jae short gchmf0 ; yes, use the whole block
neg eax ; Amount above the fence
cmp eax, ds:[di].gi_reserve ; Above reserve?
jae short gchmf0 ; yes, use all of it
sub edx, eax ; Subtract off that above fence
ja short gchmf00 ; Use as size of block
pop eax
jmps gchmf2
gchmf0:
mov edx, ds:[esi].pga_size ; Size of this block
gchmf00:
pop eax
or eax,eax ; First time?
jz short gchmf1 ; Yes, special case
cmp edx, ds:[eax].pga_size ; Is it bigger?
jb short gchmf2 ; No, do nothing
gchmf1:
mov eax,esi ; Yes, remember biggest free block
gchmf2:
pop edx
push eax ; Save largest free block so far
test PagingFlags, 2 ; Idle time compaction!
jnz gchexit
jmp gchnext ; Go process next block
UnSetKernelDS fs
cEnd nogen
;-----------------------------------------------------------------------;
; gslide ;
; ;
; Sees if next/previous block can slide into the passed free block. ;
; ;
; Arguments: ;
; FS:ESI = free block ;
; DS:DI = address of global heap information ;
; CX = #arena entries left to examine ;
; EBX = pga_next or pga_prev ;
; ;
; Returns: ;
; ZF = 0 if block found and moved into passed free block ;
; FS:ESI points to new free block ;
; FS:EDX points to new free block ;
; ;
; ZF = 1 if no block found ;
; FS:ESI points to original free block ;
; ;
; Error Returns: ;
; ;
; Registers Preserved: ;
; ;
; Registers Destroyed: ;
; EAX,EDX ;
; ;
; Calls: ;
; ;
; History: ;
; ;
; Thu Sep 25, 1986 05:58:25p -by- David N. Weise [davidw] ;
; Added this nifty comment block. ;
;-----------------------------------------------------------------------;
assumes ds, nothing
assumes es, nothing
cProc gslide,<PUBLIC,NEAR>
cBegin nogen
push esi
mov esi,ds:[ebx+esi]
mov edx,esi ; Source of move in EDX
call gmoveable
pop esi
jz short gslide_no_move
call gmovebusy ; Handle exact fits etc!!
call gpagingcandidate
if KDEBUG
cmp edx, ds:[esi+ebx] ; Are we adjacent?
je short gslide_adjacent
int 3
int 3
gslide_adjacent:
endif
mov esi, edx
or esi, esi ; ZF = 0
gslide_no_move:
ret
cEnd nogen
;-----------------------------------------------------------------------;
; gmove ;
; ;
; Moves a moveable block into the top part of a free block. The low ;
; order bit of the source and destination may be either set or reset. ;
; If set, then this routine does NOT move the arena header paragraph. ;
; If the bit is reset, then the arena header is moved. Only the low ;
; order bit of EDX is examined, and the low order bit of ESI is assumed ;
; to the same. ;
; ;
; Arguments: ;
; DS:DI = master object ;
; ES:0 = address of destination block ;
; FS:ESI = arena of destination block ;
; FS:EDX = arena of source block ;
; ECX = # bytes to move ;
; ;
; Returns: ;
; DS:DI = master object (it may have moved) ;
; ;
; Error Returns: ;
; ;
; Registers Preserved: ;
; AX,BX,CX,DX,DI,SI,ES ;
; ;
; Registers Destroyed: ;
; none ;
; ;
; Calls: ;
; gnotify ;
; ;
; History: ;
; ;
; Thu Sep 25, 1986 03:31:51p -by- David N. Weise [davidw] ;
; Added this nifty comment block. ;
;-----------------------------------------------------------------------;
assumes ds, nothing
assumes es, nothing
cProc gmove,<PUBLIC,NEAR>
cBegin nogen
CheckKernelDS fs
ReSetKernelDS fs
push es
pushad
mov eax, edx
push esi ; Save destination
mov edx, ecx ; # bytes passed in in ECX
mov bx, ds:[eax].pga_handle ; BX = handle of source
Handle_To_Sel bl
mov cx, bx ; CX = client data address of dest.
push eax
push edx ; Save #paragraphs
mov ax, GN_MOVE
push cx ; Save client data address
call gnotify ; Call global notify procedure
pop cx
pop edx ; EDX = #paragraphs to move
pop esi ; ESI = source arena
pop edi ; EDI = destination arena
; Save DS value AFTER call to gnotify, as the master object might be the
; block we are moving and thus changed by the global heap notify proc.
push gs
smov gs, ds
mov ax,ss ; Are we about to move the stack?
cmp ax,cx
mov cx,0 ; ...assume no
jne short stack_no_move
mov cx, ax ; Selector does not change!
call Enter_gmove_stack ; switch to temporary stack
stack_no_move:
mov fSwitchStacks,cl ; Remember if we switched
xor cx, cx ; Ready for result of compare
mov eax, gs:[edi].pga_address
cmp gs:[esi].pga_address, eax
adc ch, 0
mov fUpDown,ch
mov ecx, edx ; # bytes to move
shr ecx, 2 ; # dwords to move
jecxz all_done
cmp fUpDown, 0
jnz short move_it_up
; MOVE IT DOWN
cld
xor esi, esi
jmps move_it
move_it_up:
std
mov esi, ecx
dec esi
shl esi,2
move_it:
mov ds, bx ; DS:SI = first word in source block
mov edi, esi
ifdef WOW_x86
smov es,FLAT_SEL ; 23:EAX => pga_address or taget
add edi,eax
endif; WOW_x86
rep movs dword ptr [edi], dword ptr [esi]
; 386 BUG, ECX, ESI, EDI ARE NOW TRASHED
all_done:
smov ds, gs
cCall set_selector_address32,<bx,eax> ; Update source selector
cmp fSwitchStacks,cl ; Switch to new stack if any
je short move_exit
call Leave_gmove_stack
move_exit:
pop gs
popad
pop es
cld ; Protect people like MarkCl from themselves
ret
UnSetKernelDS fs
cEnd nogen
;-----------------------------------------------------------------------;
; gbestfit ;
; ;
; Searches for the largest moveable block that will fit in the passed ;
; free block. ;
; ;
; Arguments: ;
; DS:ESI = free block ;
; DS:DI = address of global heap information ;
; CX = #arena entries left to examine ;
; EBX = pga_next or pga_prev ;
; ;
; Returns: ;
; ZF = 1 if block found & moved into free block w/ no extra room. ;
; DS:ESI = busy block before/after new busy block. ;
; ;
; ZF = 0 if DS:ESI points to a free block, either the ;
; original one or what is left over after moving a block ;
; into it. ;
; ;
; Error Returns: ;
; ;
; Registers Preserved: ;
; ;
; Registers Destroyed: ;
; DX,SI ;
; ;
; Calls: ;
; gmoveable ;
; gmovebusy ;
; ;
; History: ;
; ;
; Thu Sep 25, 1986 05:52:12p -by- David N. Weise [davidw] ;
; Added this nifty comment block. ;
;-----------------------------------------------------------------------;
assumes ds,nothing
assumes es,nothing
cProc gfirstfit,<PUBLIC,NEAR>
cBegin nogen
CheckKernelDS fs
ReSetKernelDS fs
push ecx
mov edx, esi ; Save free block
gbfrestart:
call PreAllocArena ; Abort if no free arenas
jz short gbfabort
mov eax,ds:[edx].pga_size ; Compute max size to look for
jmps gbfnext
gbfloop:
cmp ds:[esi].pga_owner,di ; Is this block busy?
je short gbfnext ; No, continue
cmp ds:[esi].pga_size,eax ; Yes, is block bigger than max size?
ja short gbfnext ; Yes, continue
cmp ds:[esi].pga_owner,GA_NOT_THERE ; Is this even here?
je short gbfnext ; No, continue
call gmoveable ; Yes, is it moveable
jnz short gbffound
gbfnext: ; No, continue
mov esi, ds:[esi+ebx] ; Skip past this block
cmp esi, ds:[esi+ebx] ; Sentinel?
jne gbfloop
gbfabort:
mov esi, edx ; Return original free block in ESI
jmps gfirstfit1 ; Nothing found!
gbffound:
xchg edx, esi ; Source of move
call gmovebusy ; Yes, move it into free block
mov NextCandidate, -1
call gpagingcandidate
mov NextCandidate, -1
xchg esi, edx ; Put free block in esi
call gwin386discard
xchg esi, edx
cmp edx, ds:[esi+ebx] ; Blocks adjacent?
je short gfirstfit1 ; Yes, may have coalesced.
; Return busy block in ESI
mov esi, ds:[esi+ebx] ; Get block after busy block
cmp ds:[esi].pga_owner,di ; Is this block busy?
jne short gfirstfit1 ; Yes, fit was exact
xchg edx, esi ; EDX is new free block
jmps gbfrestart ; Start search from old busy block
gfirstfit1:
pop ecx
ret
UnSetKernelDS fs
cEnd nogen
;-----------------------------------------------------------------------;
; gmovebusy ;
; ;
; Subroutine to move a busy block to a free block of the same size, ;
; preserving the appropriate arena header fields, freeing the old ;
; busy block and updating the handle table entry to point to the ;
; new location of the block. ;
; ;
; [tonyg] ;
; The above has been inaccurate for a while - the destination is NOT ;
; necessarily free, NOR is it always the same size! ;
; ;
; It will now handle everything gslidecommon used to do! ;
; ;
; Arguments: ;
; BX = ga_prev or ga_next ;
; DS:EDX = old busy block location ;
; DS:ESI = new busy block location ;
; DS:DI = address of global heap information ;
; ;
; Returns: ;
; DS:ESI = points to new busy block arena header ;
; DS:EDX = points to free block where block used to be ;
; (may be coalesced) ;
; ;
; Error Returns: ;
; ;
; Registers Preserved: ;
; EBX,ECX ;
; ;
; Registers Destroyed: ;
; EAX ;
; ;
; Calls: ;
; ;
; History: ;
; ;
; Mon Jun 22, 1987 11:39:56p -by- David N. Weise [davidw] ;
; Made it jump off to gslidecommon when appropriate. ;
; ;
; Mon Oct 27, 1986 10:17:16p -by- David N. Weise [davidw] ;
; Made the lru list be linked arenas, so we must keep the list correct ;
; here. ;
; ;
; Thu Sep 25, 1986 05:49:25p -by- David N. Weise [davidw] ;
; Added this nifty comment block. ;
;-----------------------------------------------------------------------;
assumes ds, nothing
assumes es, nothing
cProc gmovebusy,<PUBLIC,NEAR>
cBegin nogen
if KDEBUG
cmp ds:[esi].pga_owner, GA_NOT_THERE
jne short @F
AAARRRGGGHHH:
int 3
int 3
@@:
cmp ds:[edx].pga_owner, GA_NOT_THERE
je AAARRRGGGHHH
endif
push ecx
mov ecx,ds:[edx].pga_size ; ECX = size of source
cmp ds:[esi].pga_owner,di ; Is destination busy?
jne gmbexactfit ; Yes, then don't create extra block
mov eax, ds:[esi].pga_freeprev
call gdel_free ; Take off free list now!
cmp ecx,ds:[esi].pga_size ; No, source and destination same size?
je short gmbexactfit ; Yes, then don't create extra block
jb short gmbsplice ; Destination is larger, split it
if KDEBUG
; MUST BE ADJACENT IF DESTINATION
cmp ds:[esi+ebx], edx ; SMALLER THAN SOURCE!!!
je short gmb_adjust
int 3
int 3
gmb_adjust:
endif
push ecx ; source length
push ds:[esi].pga_size ; destination length
cmp bl, pga_next
je short gmb_down
; Moving busy block up
mov eax, ds:[edx].pga_address ; Correct destination address
add eax, ds:[esi].pga_size
mov ds:[esi].pga_address, eax
call gmb_gmove
jmps gmb_adjusted
gmb_down: ; Moving busy block down
call gmb_gmove
mov ecx, ds:[esi].pga_address ; Correct new free block address
add ecx, ds:[edx].pga_size
mov ds:[edx].pga_address, ecx
gmb_adjusted:
pop ds:[edx].pga_size ; Swap sizes
pop ds:[esi].pga_size
jmps gmb_moved
gmbsplice:
push ecx
push edx
mov edx, ecx ; # bytes in block to make
cmp bl, pga_prev
je short gmb_backward
call gsplice ; Split the block
jmps gmb_spliced
gmb_backward:
neg edx
add edx, ds:[esi].pga_size ; Second block will be used
call gsplice
xchg esi, edx
gmb_spliced:
mov ds:[esi].pga_owner,1 ; Mark new block busy
push esi ; New free block
mov esi, edx ; Block to free
mov edx, eax
call gmarkfree
pop esi ; New free block
pop edx ; Source for copy
pop ecx
gmbexactfit:
call gmb_gmove
gmb_moved:
mov eax, esi
mov esi, edx
xor edx, edx
call gmarkfree ; Free old block
mov ecx,esi ; New free block
mov esi,eax ; New block
or dx,dx
jz short gmb1
mov ds:[esi].pga_handle,dx ; Set back link to handle in new block
cCall AssociateSelector32,<dx,esi> ; Associate with new arena
xor dx,dx ; Set Z flag
gmb1:
mov edx,ecx
gmbexit:
pop ecx
ret
cEnd nogen
;
; Common code for gmovebusy
;
cProc gmb_gmove,<PUBLIC,NEAR>
cBegin nogen
push ecx ; # bytes to move
push dword ptr ds:[edx].pga_count
push ds:[edx].pga_owner
push ds:[edx].pga_lruprev
push ds:[edx].pga_lrunext
pop ds:[esi].pga_lrunext ; Copy client words to new header
pop ds:[esi].pga_lruprev
pop ds:[esi].pga_owner
pop dword ptr ds:[esi].pga_count
cmp ds:[esi].pga_lruprev,edi
jz short no_link
cmp [di].gi_lruchain,edx
jnz short didnt_move_head
mov [di].gi_lruchain,esi
didnt_move_head:
mov ecx,ds:[edx].pga_lruprev
mov ds:[ecx].pga_lrunext,esi ; Update the lru list
mov ecx,ds:[edx].pga_lrunext
mov ds:[ecx].pga_lruprev,esi ; Update the lru list
no_link:
pop ecx
ifndef WOW_x86
call get_rover_232
endif
jmp gmove ; Move the client data
cEnd nogen
;-----------------------------------------------------------------------;
; gmoveable ;
; ;
; Tests if an ojbect is moveable. Non moveable blocks are: ;
; Fixed blocks, moveable blocks that are locked, moveable blocks ;
; going up, discardable code going down. ;
; ;
; Arguments: ;
; FS:ESI = arena header of object ;
; DS:DI = address of global heap information ;
; BX = ga_next or ga_prev ;
; ;
; Returns: ;
; ZF = 0 if object moveable ;
; ZF = 1 if object not moveable ;
; ;
; Error Returns: ;
; ;
; Registers Preserved: ;
; All ;
; ;
; Registers Destroyed: ;
; ;
; Calls: ;
; nothing ;
; ;
; History: ;
; ;
; Wed Oct 15, 1986 05:04:39p -by- David N. Weise [davidw] ;
; Moved he_count to ga_count. ;
; ;
; Thu Sep 25, 1986 05:42:17p -by- David N. Weise [davidw] ;
; Added this nifty comment block. ;
;-----------------------------------------------------------------------;
assumes ds, nothing
assumes es, nothing
cProc gmoveable,<PUBLIC,NEAR>
cBegin nogen
test ds:[esi].pga_handle,GA_FIXED ; If no handle then fixed
jnz short gmfixed
cmp ds:[esi].pga_count,bh ; If locked then fixed
jne short gmfixed
test ds:[esi].pga_flags,GA_DISCCODE ; If discardable code
jz short gmnotcode
cmp bl,pga_next ; Discardable code can only
ret ; move up in memory
gmnotcode:
cmp [di].gi_reserve,edi ; If no reserved code area?
je short gmokay ; Then anything can move up
cmp bl,pga_prev ; Otherwise can only move down
ret ; in memory
gmfixed:
or bh,bh ; Return with ZF = 1 if
ret ; not moveable
gmokay:
or esi,esi
ret
cEnd nogen
;-----------------------------------------------------------------------;
; gdiscard ;
; ;
; Subroutine to walk LRU chain, discarding objects until the #paras ;
; discarded, plus the biggest free block is greater than the #paras ;
; we are looking for. ;
; ;
; Arguments: ;
; EAX = size of largest free block so far ;
; EDX = minimum #bytes needed ;
; DS:DI = address of global heap information ;
; ;
; Returns: ;
; ZF = 0 if one or more objects discarded. ;
; ZF = 1 if no objects discarded. ;
; ;
; Error Returns: ;
; ;
; Registers Preserved: ;
; AX,DX,DI ;
; ;
; Registers Destroyed: ;
; BX,CX,ES ;
; ;
; Calls: ;
; ;
; History: ;
; Mon Oct 27, 1986 09:34:45p -by- David N. Weise [davidw] ;
; The glru list was reworked to link the arenas, not using the handle ;
; table as a middle man. Because of this change glruprev was moved ;
; inline and the code shortened up again. ;
; ;
; Wed Oct 15, 1986 05:04:39p -by- David N. Weise [davidw] ;
; Moved he_count to ga_count. ;
; ;
; Thu Sep 25, 1986 05:45:31p -by- David N. Weise [davidw] ;
; Shortened it up a bit and added this nifty comment block. ;
;-----------------------------------------------------------------------;
assumes ds, nothing
assumes es, nothing
cProc gdiscard,<PUBLIC,NEAR>
cBegin nogen
push eax
push edx
mov [di].hi_ncompact,0 ; Clear compaction flag
sub edx,eax ; How much to discard before
mov [di].hi_distotal,edx ; compacting again.
xor ebx,ebx ; EBX = amount of DISCCODE below fence
test [di].gi_cmpflags,GA_DISCCODE
jnz short fence_not_in_effect0
mov cx,[di].gi_lrucount
jcxz fence_not_in_effect0 ; All done if LRU chain empty
mov ax, [di].gi_disfence_hi
shl eax, 16
mov ax, [di].gi_disfence_lo
push edx
mov edx, eax
add edx, ds:[edi].gi_reserve
mov esi,[di].gi_lruchain ; ESI -> most recently used (ga_lruprev
gdloop0: ; is the least recently used)
mov esi,ds:[esi].pga_lruprev ; Move to next block in LRU chain
test ds:[esi].pga_flags,GA_DISCCODE ; Discardable code?
jz short gdloop0a ; No, ignore
cmp edx, ds:[esi].pga_address
jbe short gdinclude
cmp eax, ds:[esi].pga_address ; Yes, is this code fenced off?
jbe short gdloop0a ; No, ignore
gdinclude:
add ebx,ds:[esi].pga_size ; Yes, accumulate size of discardable
gdloop0a: ; code below the fence
loop gdloop0
pop edx
fence_not_in_effect0:
mov esi,[di].gi_lruchain
cmp [di].gi_lrucount, 0
je short gdexit
push ds:[esi].pga_lruprev
push [di].gi_lrucount
gdloop:
pop cx
pop eax
jcxz gdexit ; No more see if we discarded anything
mov esi, eax ; ES on stack may be invalid if count 0
dec cx
push ds:[esi].pga_lruprev ; Save next handle from LRU chain
push cx
cmp ds:[esi].pga_count,0 ; Is this handle locked?
jne short gdloop ; Yes, ignore it then
test [di].gi_cmpflags,GA_DISCCODE
jnz short fence_not_in_effect
test ds:[esi].pga_flags,GA_DISCCODE
jz short fence_not_in_effect
or ebx,ebx ; Discardable code below fence?
jz short gdloop ; No, cant discard then
cmp ebx,ds:[esi].pga_size ; Yes, more than size of this block?
jb short gdloop ; No, cant discard then
sub ebx,ds:[esi].pga_size ; Yes, reduce size of code below fence
fence_not_in_effect:
push ebx
call DiscardCodeSegment
pop ebx
jnz short discarded_something
test [di].hi_ncompact,10h ; did a GlobalNotify proc free enough?
jz short gdloop
jmps enough_discarded
discarded_something:
test [di].hi_ncompact,10h ; did a GlobalNotify proc free enough?
jnz short enough_discarded
or [di].hi_ncompact,1 ; Remember we discarded something
sub [di].hi_distotal,eax ; Have we discarded enough yet?
ja short gdloop ; No, look at next handle
enough_discarded:
pop cx ; Flush enumeration counter
pop ecx ; and saved ESI
gdexit:
cmp [di].hi_ncompact,0 ; Return with Z flag set or clear
pop edx
pop eax
ret
cEnd nogen
;-----------------------------------------------------------------------;
; DiscardCodeSegment ;
; ;
; Discards the given segment. Calls gnotify to fix stacks, entry ;
; points, thunks, and prologs. Then glrudel removes it from the lru ;
; list and gmarkfree finally gets rid of it. ;
; ;
; Arguments: ;
; DS:DI => BurgerMaster ;
; ES = Address of segment to discard ;
; ;
; Returns: ;
; AX = size discarded ;
; ZF = 0 ok ;
; ;
; Error Returns: ;
; ;
; Registers Preserved: ;
; DI,SI,DS,ES ;
; ;
; Registers Destroyed: ;
; BX,CX,DX ;
; ;
; Calls: ;
; gnotify ;
; glrudel ;
; gmarkfree ;
; ;
; History: ;
; ;
; Fri Jun 12, 1987 -by- Bob Matthews [bobm] ;
; Made FAR. ;
; ;
; Sun Apr 19, 1987 12:05:40p -by- David N. Weise [davidw] ;
; Moved it here from InitTask, so that FirstTime could use it. ;
;-----------------------------------------------------------------------;
assumes ds, nothing
assumes es, nothing
cProc DiscardCodeSegment,<PUBLIC,NEAR>
cBegin nogen
push esi
mov bx,ds:[esi].pga_handle ; BX = handle
mov al,GN_DISCARD ; AX = GN_DISCARD
call gnotify
jz short cant_discard ; Skip this handle if not discardable
call glrudel ; Delete handle from LRU chain
push ds:[esi].pga_owner ; Save owner field
mov eax,ds:[esi].pga_size ; Save size
xor edx,edx
call gmarkfree ; Free the block associated with this handle
mov bx,dx
pop cx ; Owner
cCall mark_sel_NP,<bx,cx>
cant_discard:
pop esi
ret
cEnd nogen
;-----------------------------------------------------------------------;
; ShrinkHeap ;
; ;
; Tries to return DPMI memory blocks to DPMI memory manager. ;
; ;
; Arguments: ;
; ;
; Returns: ;
; ;
; Error Returns: ;
; ;
; Registers Preserved: ;
; ;
; Registers Destroyed: ;
; ;
; Calls: ;
; InnerShrinkHeap ;
; ;
;-----------------------------------------------------------------------;
assumes ds, nothing
assumes es, nothing
cProc ShrinkHeap,<PUBLIC,NEAR>
cBegin nogen
push ds
GENTER32
ReSetKernelDS FS
cCall InnerShrinkHeap
jnz short sh_maybe_more
and PagingFlags, NOT 8 ; Don't call back if # win386
; didn't change
sh_maybe_more:
GLEAVE32
UnSetKernelDS FS
pop ds
ret
cEnd nogen
;-----------------------------------------------------------------------;
; InnerShrinkHeap ;
; ;
; Checks heap to see if there are any blocks to return to Win386 ;
; Compacts if there are Win386 blocks around AND there is more ;
; than 512k free. ;
; Returns any completely free Win386 block to Win386. ;
; ;
; Arguments: ;
; FS = Kernel's DS ;
; EDI = 0 ;
; ;
; Returns: ;
; Z flag set if no blocks returned, Z clear if 1 or more returned.;
; ;
; Error Returns: ;
; ;
; Registers Preserved: ;
; All ;
; ;
; Registers Destroyed: ;
; ;
; Calls: ;
; UnlinkWin386Block ;
; ;
;-----------------------------------------------------------------------;
assumes ds, nothing
assumes es, nothing
cProc InnerShrinkHeap,<PUBLIC,NEAR>
cBegin nogen
CheckKernelDS FS
ReSetKernelDS FS
pushad
push Win386_Blocks
cmp Win386_Blocks, 0
je short sh_done
; First count up free blocks
mov esi, [edi].phi_first
scan_loop:
mov esi, [esi].pga_freenext
scan_next:
cmp esi, [esi].pga_next ; Sentinel?
je short sh_done ; yes, all done
mov ebx, [esi].pga_prev
cmp [ebx].pga_owner, GA_NOT_THERE
jne short scan_loop
mov ecx, [esi].pga_next
cmp [ecx].pga_owner, GA_NOT_THERE
jne short scan_loop
mov eax, [ecx].pga_next ; Block after NOT_THERE block
cmp eax, [eax].pga_next ; Sentinel?
je short sh_done ; yes, don't try to unlink
; Have block to return
push [esi].pga_freeprev ; Current block will be freed
cCall UnlinkWin386Block
pop esi ; Continue before block freed
jmps scan_loop
sh_done:
pop ax ; Starting value of Win386_Blocks
cmp ax, Win386_Blocks ; Set Z flag if heap didn't shrink
popad
UnSetKernelDS FS
ret
cEnd
;-----------------------------------------------------------------------;
; UnlinkWin386Block ;
; ;
; Returns a block to Win386 and unlinks it from the heap. ;
; ;
; Arguments: ;
; EBX Block previous to block to be unlinked ;
; ESI Block to be unlinked ;
; ECX Block after to block to be unlinked ;
; ;
; Returns: ;
; ESI Block previous to EBX ;
; ;
; Error Returns: ;
; ;
; Registers Preserved: ;
; ECX, DX, EDI, DS, ES ;
; ;
; Registers Destroyed: ;
; EAX, EBX, EDX ;
; ;
; Calls: ;
; GlobalCompact ;
; UnlinkWin386Block ;
; ;
; History: ;
; ;
;-----------------------------------------------------------------------;
assumes ds, nothing
assumes es, nothing
cProc UnlinkWin386Block,<PUBLIC,NEAR>
cBegin nogen
CheckKernelDS FS
ReSetKernelDS FS
push dx
mov edx, [ecx].pga_next ; Block after all this
cmp edx, [edx].pga_next ; Last sentinel?
je RSHORT dont_do_it ; Never free last block
if KDEBUG
push edx
mov eax, [esi].pga_size
mov edx, eax
shr edx, 16
krDebugOut <DEB_TRACE OR DEB_krMemMan>, "UnlinkWin386Block: releasing #dx#AX bytes"
pop edx
endif
push esi
call gdel_free ; Remove from free list
ifdef WOW
push edx
push ebx
push ecx
mov eax,MEM_RELEASE
mov edi,[esi].pga_size
cCall VirtualFree,<[ebx].pga_lrunext,edi,eax>
pop ecx
pop ebx
pop edx
else
mov esi, [ebx].pga_lrunext ; Saved WIN386 handle
mov di, si
shr esi, 16 ; Put in SI:DI
DPMICALL 0502h ; Free Memory Block
endif; WOW
xor edi, edi
pop esi
dec Win386_Blocks
mov eax, [ebx].pga_prev ; Block before all this
mov [eax].pga_next, edx ; Unlink them.
mov [edx].pga_prev, eax
cCall free_arena_header,<ebx> ; Free the arena headers
cCall free_arena_header,<esi>
cCall free_arena_header,<ecx>
mov esi, eax ; For gfreeall
sub [edi].hi_count, 3
if KDEBUG
call CheckGlobalHeap
endif
dont_do_it:
pop dx
ret
UnSetKernelDS FS
cEnd nogen
cProc gpagingcandidate,<PUBLIC,NEAR>
cBegin nogen
CheckKernelDS FS
ReSetKernelDS FS
test byte ptr WinFlags[1], WF1_PAGING ; Paging?
jz short gpc_not_paging
pushad
mov ebx, ds:[esi].pga_address
mov esi, ds:[esi].pga_size
add esi, ebx ; End of region
shr ebx, 12
shr esi, 12
cmp ebx, NextCandidate
jb short gpc_use_this_page
mov ebx, NextCandidate ; Start the region here
gpc_use_this_page:
cmp esi, ebx
jne short call_win386
mov NextCandidate, ebx
jmps gpc_done
call_win386:
mov NextCandidate, -1
sub esi, ebx ; number of pages
mov di, si
shr esi, 16
mov cx, bx
shr ebx, 16
DPMICALL 0700h ; Page Candidate
gpc_done:
popad
gpc_not_paging:
ret
UnSetKernelDS FS
cEnd nogen
assumes ds, nothing
assumes es, nothing
cProc gwin386discard,<PUBLIC,NEAR>
cBegin nogen
CheckKernelDS FS
ReSetKernelDS FS
cmp ds:[esi].pga_size, 4096
jb short not_a_chance ; Quick exit
cmp ds:[esi].pga_size, 16*1024
jb short inform_later
pushad
mov ebx, ds:[esi].pga_address
mov esi, ds:[esi].pga_size
mov di, si
shr esi, 16 ; SI:DI is # bytes to discard
mov cx, bx
shr ebx, 16 ; BX:CX is first bytes to discard
DPMICALL 0703h
popad
jmps not_a_chance
inform_later:
or PagingFlags, 1
not_a_chance:
ret
UnSetKernelDS FS
cEnd nogen
cProc DiscardFreeBlocks,<PUBLIC,NEAR>
cBegin nogen
push es
push ds
GENTER32
ReSetKernelDS FS
and PagingFlags, NOT 1
mov esi, ds:[di].phi_first
mov esi, ds:[esi].pga_freenext
dfb_next:
cmp esi, ds:[esi].pga_next ; Sentinel?
je short dfb_done ; yes, all done
push esi
push edi
cmp ds:[esi].pga_size, 4096
jb short no_win386discard ; Quick exit
mov ebx, ds:[esi].pga_address
mov esi, ds:[esi].pga_size
add esi, ebx ; First byte past block
shr esi, 12 ; Page of this byte
add ebx, 0fffh
shr ebx, 12 ; First page we can discard
sub esi, ebx ; # pages we can discard
jbe short no_win386discard ; none to discard
mov di, si
shr esi, 16 ; SI:DI is # pages to discard
mov cx, bx
shr ebx, 16 ; BX:CX is first page to discard
DPMICALL 0701h ; Say goodbye, pages
no_win386discard:
pop edi
pop esi
mov esi, ds:[esi].pga_freenext
jmps dfb_next
dfb_done:
GLEAVE32
UnSetKernelDS FS
pop ds
pop es
ret
cEnd nogen
;---------------------------------------------------------------------------
;
; guc_findfree
;
; helper function for guncompact
;
; finds the next free block below the address
; in ECX into which the block pointed to by ESI will fit.
;
; Entry:
; ECX = maximum address (desired swap area)
; DS:DI = global heap info
; ESI = arena of block to move
;
; Exit:
; Carry clear if block found, set if not
; EDX = free block arena
;
; Uses:
; EAX, EDX
;
; Preserves:
; EBX, ECX, ESI, EDI
;
; History:
; Fri Jun 7, 1991 9:38 -by- Craig Critchley [craigc]
; Wrote it...
;
;--------------------------------------------------------------------------
cProc guc_findfree, <NEAR, PUBLIC>
cBegin nogen
mov edx, ds:[di].phi_last
mov edx, ds:[edx].pga_freeprev
gucff_check:
cmp edx, ds:[edx].pga_prev ; if at start, not found
jz short gucff_notfound
mov eax, ds:[edx].pga_address ; is it out of swap area
add eax, ds:[edx].pga_size
cmp eax, ecx
jae short gucff_nextblock
mov eax, ds:[esi].pga_size ; does it fit
cmp ds:[edx].pga_size, eax
jb short gucff_nextblock
clc ; return it in EDX
ret
gucff_nextblock:
mov edx, ds:[edx].pga_freeprev ; previous free block
jmp short gucff_check
gucff_notfound:
stc ; return error
ret
cEnd nogen
;-----------------------------------------------------------------------------
;
; guncompact -
;
; this function moves segments that are not free or discardable code
; out of the intended swap area. don't take the name too seriously.
;
; Entry:
; ECX = size of intended swap area
; DS:DI = global heap info
; FS = global heap
;
; Exit:
; Carry clear if space could be cleared, set if not
;
; Registers used:
; EAX, EBX, ECX, EDX, ESI
;
; Called by:
; greserve
;
; Calls:
; gmoveable
; gmovebusy
;
; History:
; Fri Jun 7, 1991 9:38 -by- Craig Critchley [craigc]
; Wrote it...
;
;-----------------------------------------------------------------------------
cProc guncompact, <NEAR, PUBLIC>
cBegin <nogen>
mov edx, [di].phi_last ; point to last block
mov ebx, pga_prev
sub ecx, ds:[edx].pga_address ; find desired code fence
neg ecx
guc_trymovingblock:
mov esi, ds:[edx+ebx] ; block under current one...
cmp ds:[esi].pga_owner, 0 ; don't move free blocks
jz short guc_skipblock
test ds:[esi].pga_flags, GA_DISCCODE ; don't move discardable code
jnz short guc_skipblock
cmp ds:[esi].pga_owner, GA_NOT_THERE ; ignore not-there's
jz short guc_skipblock
call gmoveable ; can this block be moved?
jz short guc_error ; if not, swap area toast
push edx
call guc_findfree ; find a block to move it into
pop eax
jc short guc_error ; error if didn't find one
push eax
xchg edx, esi
call gmovebusy ; move it
xchg edx, esi
pop edx
;;; can we just fall thru the block ought to be free now...
jmp short guc_trymovingblock ; move what's there now
guc_skipblock:
mov edx, esi ; this block now first cleared
cmp ds:[edx].pga_address, ecx ; big enough?
ja short guc_trymovingblock
guc_done:
clc ; success-o-mundo!!
ret
guc_error:
stc ; if not, we could not
ret ; clear swap area
cEnd <nogen>
sEnd CODE
end
| 43.038804 | 97 | 0.349956 |
ab1d1b739de65efc2c29e96b971729c69a679495 | 2,262 | asm | Assembly | src/common.asm | ronaaron/reva | edc8cbef27219ecf8ff00ad9afdf92687796e7a2 | [
"MIT"
] | 9 | 2020-07-30T06:46:51.000Z | 2022-02-01T22:30:24.000Z | src/common.asm | ronaaron/reva | edc8cbef27219ecf8ff00ad9afdf92687796e7a2 | [
"MIT"
] | 1 | 2020-07-30T06:08:02.000Z | 2020-07-30T06:08:02.000Z | src/common.asm | ronaaron/reva | edc8cbef27219ecf8ff00ad9afdf92687796e7a2 | [
"MIT"
] | 3 | 2020-07-30T06:46:54.000Z | 2022-02-01T22:34:14.000Z | ; The "new core" uses NASM so it can be compiled anywhere NASM runs
%define k *1024
%define DICTSIZE 2000 k
%define CODESIZE 2000 k
%define STACKSIZE 2 k
%define TIBSIZE 1 k
%define HEADERSIZE (save_header_end - save_header)
%define XT_FIELD 4
%define NAME_FIELD 8
%define CLASS_FIELD -4
%define FUNCALIGN align 4 ; on Mac it's 16!
%define swap xchg eax, dword [esi]
%macro dup 0
lea esi, [esi-4]
mov [esi], eax
%endmacro
%macro drop2 0
lodsd
lodsd
%endmacro
%define drop lodsd
%macro rot 0
push eax
mov eax, [esi+4]
mov ebx, [esi]
mov [esi+4], ebx
pop dword [esi]
%endmacro
%macro mrot 0
push eax
mov ebx, [esi+4]
mov eax, [esi]
mov [esi], ebx
pop dword [esi+4]
%endmacro
%macro upsh 1
dup
mov eax, %1
%endmacro
%macro upop 1
mov %1, eax
drop
%endmacro
%macro countstr 1
%%start_of_string:
db (%%eos-%%start_of_string-1)
db %1
%%eos:
%endmacro
%macro PROC 1 ; xt name
%if (OS==MAC)
GLOBAL %1
%endif
FUNCALIGN
%1:
%endmacro
%macro ENDP 1
%endmacro
%macro DEFER 1-2 ; xt,fun
%if (OS==MAC)
GLOBAL %1
%endif
PROC %1
%ifempty %2
dd noop
%else
dd %2
%endif
ENDP %1
%endmacro
%macro DEFERCALL 1
%if (OS==MAC)
call dword [%1]
%else
call dword [%1]
%endif
%endmacro
%macro DEFERJMP 1
%if (OS==MAC)
jmp dword [%1]
%else
jmp dword [%1]
%endif
%endmacro
%macro VARNEW 1-2
FUNCALIGN
%ifempty %2
%1: dd 0
%else
%1: dd %2
%endif
%endmacro
%define mylink 0
%macro DICT 2-3 ; name, xt, class
align 4
%ifempty %3
dd fclass
%else
dd %3
%endif
%%us:
;%2.dict:
dd mylink
%define mylink %%us
dd %2
countstr %1
%endmacro
; This is for debugging!
%macro GOTHERE 0-1
%ifempty %1
upsh '*'
%else
upsh %1
%endif
call emit
%endmacro
%macro stdcall 1-9 ;proc,[arg] ; indirectly call STDCALL procedure
%define _j %1
%rep %0-1
%rotate -1
push %1
%endrep
call _j
%endmacro
%macro ccall 1-9
%define _j %1
push esi
push ebp
mov ebp, esp
%if (OS==MAC)
%assign __params %0-1
; necessary on Mac:
sub esp, 010h
and esp, 0fffffff0h
; stack is aligned on 16 -byte boundary. now adjust for parameters
%if __params > 0
sub esp, 4*(4-(__params % 4))
%endif
%endif
; push arguments in reverse order:
%rep %0-1
%rotate -1
push %1
%endrep
; call the routine
;int3
call _j
mov esp, ebp
pop ebp
pop esi
%endmacro
| 13 | 68 | 0.671972 |
af52f34232d18172990da33b77d6ad71db5d118a | 5,570 | asm | Assembly | Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2_notsx.log_1549_1184.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2_notsx.log_1549_1184.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2_notsx.log_1549_1184.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 %r15
push %r9
push %rbp
push %rsi
lea addresses_normal_ht+0x11647, %r10
nop
nop
nop
sub $4371, %rsi
mov (%r10), %r15w
nop
nop
nop
nop
add $32265, %r10
lea addresses_WC_ht+0x53a7, %rsi
cmp %r14, %r14
movl $0x61626364, (%rsi)
cmp %r9, %r9
lea addresses_WT_ht+0xb047, %rbp
nop
nop
and $19247, %rsi
movb $0x61, (%rbp)
nop
nop
nop
nop
add %r10, %r10
pop %rsi
pop %rbp
pop %r9
pop %r15
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
// Store
lea addresses_normal+0x19e47, %rdi
nop
nop
nop
nop
nop
inc %r11
movl $0x51525354, (%rdi)
nop
nop
nop
nop
inc %rdi
// REPMOV
lea addresses_WT+0x15e47, %rsi
lea addresses_WC+0x1947, %rdi
nop
nop
nop
nop
nop
and %r12, %r12
mov $105, %rcx
rep movsq
xor %rax, %rax
// Store
lea addresses_D+0x1c453, %rcx
nop
xor $13925, %rbp
mov $0x5152535455565758, %rax
movq %rax, (%rcx)
nop
nop
nop
inc %r10
// Load
mov $0x907, %rsi
nop
nop
nop
add $19172, %r11
mov (%rsi), %cx
nop
inc %rsi
// Faulty Load
lea addresses_A+0x4e47, %rcx
dec %r12
vmovups (%rcx), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $1, %xmm5, %rax
lea oracles, %rcx
and $0xff, %rax
shlq $12, %rax
mov (%rcx,%rax,1), %rax
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WC', 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_P', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': True}}
{'00': 1549}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 40.071942 | 2,999 | 0.655476 |
6c7643a58e2e03c1b21a5b4d1450d0abca8e13e2 | 500 | asm | Assembly | libsrc/stdio/_printf.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | null | null | null | libsrc/stdio/_printf.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | null | null | null | libsrc/stdio/_printf.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | null | null | null |
MODULE _printf
SECTION code_clib
PUBLIC _printf
EXTERN asm_printf
EXTERN fputc_callee
EXTERN __sgoioblk
;sdcc version
_printf:
ld hl,4
add hl,sp ;points to ap
pop bc ;ret address
pop de ;fmt
push de
push bc
IF !__CPU_INTEL__
push ix ;save ix
ENDIF
ld bc,__sgoioblk+10 ;file
push bc
ld bc,fputc_callee
push bc
ld bc,0 ;flag
push bc
push de ;fmt
push hl ;argument
call asm_printf
pop bc
pop bc
pop bc
pop bc
pop bc
IF !__CPU_INTEL__
pop ix ;restore ix
ENDIF
ret
| 11.111111 | 26 | 0.722 |
71a8a4511640bbed28a75176e980bef87e386b65 | 88,619 | asm | Assembly | TestData/nano_jpeg.32.asm | robertmuth/Cwerg | fdf30b06c93b4620c0a45b448b6d92acb81c35f0 | [
"Apache-2.0"
] | 171 | 2020-01-30T16:58:07.000Z | 2022-03-27T22:12:17.000Z | TestData/nano_jpeg.32.asm | robertmuth/Cwerg | fdf30b06c93b4620c0a45b448b6d92acb81c35f0 | [
"Apache-2.0"
] | 14 | 2021-05-15T02:12:09.000Z | 2022-03-16T04:16:18.000Z | TestData/nano_jpeg.32.asm | robertmuth/Cwerg | fdf30b06c93b4620c0a45b448b6d92acb81c35f0 | [
"Apache-2.0"
] | 5 | 2021-03-01T20:52:13.000Z | 2022-03-07T06:35:03.000Z | ############################################################
# ../nanojpeg.c
############################################################
.mem __static_4_counts 1 RW
.data 16 [0]
.fun mymemset NORMAL [] = [A32 S32 U32]
.bbl %start
poparg ptr:A32
poparg value:S32
poparg num:U32
.reg S32 [i]
mov i = 0
bra for_1_cond
.bbl for_1
conv %S8_1:S8 = value
lea %A32_2:A32 = ptr i
st %A32_2 0 = %S8_1
.bbl for_1_next
add %S32_3:S32 = i 1
mov i = %S32_3
.bbl for_1_cond
conv %U32_4:U32 = i
blt %U32_4 num for_1
bra for_1_exit
.bbl for_1_exit
ret
.fun mymemcpy NORMAL [] = [A32 A32 U32]
.bbl %start
poparg destination:A32
poparg source:A32
poparg num:U32
.reg S32 [i]
mov i = 0
bra for_1_cond
.bbl for_1
lea %A32_5:A32 = source i
ld %S8_6:S8 = %A32_5 0
lea %A32_7:A32 = destination i
st %A32_7 0 = %S8_6
.bbl for_1_next
add %S32_8:S32 = i 1
mov i = %S32_8
.bbl for_1_cond
conv %U32_9:U32 = i
blt %U32_9 num for_1
bra for_1_exit
.bbl for_1_exit
ret
.mem nj 4 RW
.data 525000 [0]
.mem njZZ 1 RW
.data 1 [0 1 8 16 9 2 3 10 17 24 32 25 18 11 4 5 12 19 26 33 40 48 41 34 27 20 13 6 7 14 21 28 35 42 49 56 57 50 43 36 29 22 15 23 30 37 44 51 58 59 52 45 38 31 39 46 53 60 61 54 47 55 62 63]
.fun njGetWidth NORMAL [S32] = []
.reg S32 [%out]
.bbl %start
lea %A32_10:A32 = nj
lea %A32_11:A32 = %A32_10 16
ld %S32_12:S32 = %A32_11 0
mov %out = %S32_12
pusharg %out
ret
.fun njGetHeight NORMAL [S32] = []
.reg S32 [%out]
.bbl %start
lea %A32_13:A32 = nj
lea %A32_14:A32 = %A32_13 20
ld %S32_15:S32 = %A32_14 0
mov %out = %S32_15
pusharg %out
ret
.fun njIsColor NORMAL [S32] = []
.reg S32 [%out]
.bbl %start
lea %A32_16:A32 = nj
lea %A32_17:A32 = %A32_16 40
ld %U32_18:U32 = %A32_17 0
bne %U32_18 1 if_1_true
bra if_1_false
.bbl if_1_true
mov %out = 1
pusharg %out
ret
bra if_1_end
.bbl if_1_false
mov %out = 0
pusharg %out
ret
.bbl if_1_end
.fun njGetImage NORMAL [A32] = []
.reg A32 [%out]
.bbl %start
lea %A32_19:A32 = nj
lea %A32_20:A32 = %A32_19 40
ld %U32_21:U32 = %A32_20 0
beq %U32_21 1 if_1_true
bra if_1_false
.bbl if_1_true
lea %A32_22:A32 = nj
lea %A32_23:A32 = %A32_22 44
lea %A32_24:A32 = %A32_23 40
ld %A32_25:A32 = %A32_24 0
mov %out = %A32_25
pusharg %out
ret
bra if_1_end
.bbl if_1_false
lea %A32_26:A32 = nj
lea %A32_27:A32 = %A32_26 524996
ld %A32_28:A32 = %A32_27 0
mov %out = %A32_28
pusharg %out
ret
.bbl if_1_end
.fun njGetImageSize NORMAL [S32] = []
.reg S32 [%out]
.bbl %start
lea %A32_29:A32 = nj
lea %A32_30:A32 = %A32_29 16
ld %S32_31:S32 = %A32_30 0
lea %A32_32:A32 = nj
lea %A32_33:A32 = %A32_32 20
ld %S32_34:S32 = %A32_33 0
mul %S32_35:S32 = %S32_31 %S32_34
conv %U32_36:U32 = %S32_35
lea %A32_37:A32 = nj
lea %A32_38:A32 = %A32_37 40
ld %U32_39:U32 = %A32_38 0
mul %U32_40:U32 = %U32_36 %U32_39
conv %S32_41:S32 = %U32_40
mov %out = %S32_41
pusharg %out
ret
.fun njClip NORMAL [U8] = [S32]
.reg U8 [%out]
.bbl %start
poparg x:S32
blt x 0 if_2_true
bra if_2_false
.bbl if_2_true
mov %out = 0
pusharg %out
ret
bra if_2_end
.bbl if_2_false
blt 255:S32 x if_1_true
bra if_2_end
.bbl if_1_true
mov %out = 255
pusharg %out
ret
.bbl if_2_end
conv %U8_42:U8 = x
mov %out = %U8_42
pusharg %out
ret
.fun njRowIDCT NORMAL [] = [A32]
.bbl %start
poparg blk:A32
.reg S32 [x0]
.reg S32 [x1]
.reg S32 [x2]
.reg S32 [x3]
.reg S32 [x4]
.reg S32 [x5]
.reg S32 [x6]
.reg S32 [x7]
.reg S32 [x8]
lea %A32_43:A32 = blk 16
ld %S32_44:S32 = %A32_43 0
shl %S32_45:S32 = %S32_44 11
mov x1 = %S32_45
lea %A32_46:A32 = blk 24
ld %S32_47:S32 = %A32_46 0
mov x2 = %S32_47
or %S32_48:S32 = %S32_45 %S32_47
lea %A32_49:A32 = blk 8
ld %S32_50:S32 = %A32_49 0
mov x3 = %S32_50
or %S32_51:S32 = %S32_48 %S32_50
lea %A32_52:A32 = blk 4
ld %S32_53:S32 = %A32_52 0
mov x4 = %S32_53
or %S32_54:S32 = %S32_51 %S32_53
lea %A32_55:A32 = blk 28
ld %S32_56:S32 = %A32_55 0
mov x5 = %S32_56
or %S32_57:S32 = %S32_54 %S32_56
lea %A32_58:A32 = blk 20
ld %S32_59:S32 = %A32_58 0
mov x6 = %S32_59
or %S32_60:S32 = %S32_57 %S32_59
lea %A32_61:A32 = blk 12
ld %S32_62:S32 = %A32_61 0
mov x7 = %S32_62
or %S32_63:S32 = %S32_60 %S32_62
bne %S32_63 0 if_1_end
bra if_1_true
.bbl if_1_true
ld %S32_64:S32 = blk 0
shl %S32_65:S32 = %S32_64 3
lea %A32_66:A32 = blk 28
st %A32_66 0 = %S32_65
lea %A32_67:A32 = blk 24
st %A32_67 0 = %S32_65
lea %A32_68:A32 = blk 20
st %A32_68 0 = %S32_65
lea %A32_69:A32 = blk 16
st %A32_69 0 = %S32_65
lea %A32_70:A32 = blk 12
st %A32_70 0 = %S32_65
lea %A32_71:A32 = blk 8
st %A32_71 0 = %S32_65
lea %A32_72:A32 = blk 4
st %A32_72 0 = %S32_65
st blk 0 = %S32_65
ret
.bbl if_1_end
ld %S32_73:S32 = blk 0
shl %S32_74:S32 = %S32_73 11
add %S32_75:S32 = %S32_74 128
mov x0 = %S32_75
add %S32_76:S32 = x4 x5
mul %S32_77:S32 = %S32_76 565
mov x8 = %S32_77
sub %S32_78:S32 = 2841:S32 565
mul %S32_79:S32 = x4 %S32_78
add %S32_80:S32 = x8 %S32_79
mov x4 = %S32_80
add %S32_81:S32 = 2841:S32 565
mul %S32_82:S32 = x5 %S32_81
sub %S32_83:S32 = x8 %S32_82
mov x5 = %S32_83
add %S32_84:S32 = x6 x7
mul %S32_85:S32 = %S32_84 2408
mov x8 = %S32_85
sub %S32_86:S32 = 2408:S32 1609
mul %S32_87:S32 = x6 %S32_86
sub %S32_88:S32 = x8 %S32_87
mov x6 = %S32_88
add %S32_89:S32 = 2408:S32 1609
mul %S32_90:S32 = x7 %S32_89
sub %S32_91:S32 = x8 %S32_90
mov x7 = %S32_91
add %S32_92:S32 = x0 x1
mov x8 = %S32_92
sub %S32_93:S32 = x0 x1
mov x0 = %S32_93
add %S32_94:S32 = x3 x2
mul %S32_95:S32 = %S32_94 1108
mov x1 = %S32_95
add %S32_96:S32 = 2676:S32 1108
mul %S32_97:S32 = x2 %S32_96
sub %S32_98:S32 = x1 %S32_97
mov x2 = %S32_98
sub %S32_99:S32 = 2676:S32 1108
mul %S32_100:S32 = x3 %S32_99
add %S32_101:S32 = x1 %S32_100
mov x3 = %S32_101
add %S32_102:S32 = x4 x6
mov x1 = %S32_102
sub %S32_103:S32 = x4 x6
mov x4 = %S32_103
add %S32_104:S32 = x5 x7
mov x6 = %S32_104
sub %S32_105:S32 = x5 x7
mov x5 = %S32_105
add %S32_106:S32 = x8 x3
mov x7 = %S32_106
sub %S32_107:S32 = x8 x3
mov x8 = %S32_107
add %S32_108:S32 = x0 x2
mov x3 = %S32_108
sub %S32_109:S32 = x0 x2
mov x0 = %S32_109
add %S32_110:S32 = x4 x5
mul %S32_111:S32 = %S32_110 181
add %S32_112:S32 = %S32_111 128
shr %S32_113:S32 = %S32_112 8
mov x2 = %S32_113
sub %S32_114:S32 = x4 x5
mul %S32_115:S32 = %S32_114 181
add %S32_116:S32 = %S32_115 128
shr %S32_117:S32 = %S32_116 8
mov x4 = %S32_117
add %S32_118:S32 = x7 x1
shr %S32_119:S32 = %S32_118 8
st blk 0 = %S32_119
add %S32_120:S32 = x3 x2
shr %S32_121:S32 = %S32_120 8
lea %A32_122:A32 = blk 4
st %A32_122 0 = %S32_121
add %S32_123:S32 = x0 x4
shr %S32_124:S32 = %S32_123 8
lea %A32_125:A32 = blk 8
st %A32_125 0 = %S32_124
add %S32_126:S32 = x8 x6
shr %S32_127:S32 = %S32_126 8
lea %A32_128:A32 = blk 12
st %A32_128 0 = %S32_127
sub %S32_129:S32 = x8 x6
shr %S32_130:S32 = %S32_129 8
lea %A32_131:A32 = blk 16
st %A32_131 0 = %S32_130
sub %S32_132:S32 = x0 x4
shr %S32_133:S32 = %S32_132 8
lea %A32_134:A32 = blk 20
st %A32_134 0 = %S32_133
sub %S32_135:S32 = x3 x2
shr %S32_136:S32 = %S32_135 8
lea %A32_137:A32 = blk 24
st %A32_137 0 = %S32_136
sub %S32_138:S32 = x7 x1
shr %S32_139:S32 = %S32_138 8
lea %A32_140:A32 = blk 28
st %A32_140 0 = %S32_139
ret
.fun njColIDCT NORMAL [] = [A32 A32 S32]
.bbl %start
poparg blk:A32
poparg out:A32
poparg stride:S32
.reg S32 [x0]
.reg S32 [x1]
.reg S32 [x2]
.reg S32 [x3]
.reg S32 [x4]
.reg S32 [x5]
.reg S32 [x6]
.reg S32 [x7]
.reg S32 [x8]
mul %S32_141:S32 = 8:S32 4
mul %S32_142:S32 = %S32_141 4
lea %A32_143:A32 = blk %S32_142
ld %S32_144:S32 = %A32_143 0
shl %S32_145:S32 = %S32_144 8
mov x1 = %S32_145
mul %S32_146:S32 = 8:S32 6
mul %S32_147:S32 = %S32_146 4
lea %A32_148:A32 = blk %S32_147
ld %S32_149:S32 = %A32_148 0
mov x2 = %S32_149
or %S32_150:S32 = %S32_145 %S32_149
mul %S32_151:S32 = 8:S32 2
mul %S32_152:S32 = %S32_151 4
lea %A32_153:A32 = blk %S32_152
ld %S32_154:S32 = %A32_153 0
mov x3 = %S32_154
or %S32_155:S32 = %S32_150 %S32_154
mul %S32_156:S32 = 8:S32 1
mul %S32_157:S32 = %S32_156 4
lea %A32_158:A32 = blk %S32_157
ld %S32_159:S32 = %A32_158 0
mov x4 = %S32_159
or %S32_160:S32 = %S32_155 %S32_159
mul %S32_161:S32 = 8:S32 7
mul %S32_162:S32 = %S32_161 4
lea %A32_163:A32 = blk %S32_162
ld %S32_164:S32 = %A32_163 0
mov x5 = %S32_164
or %S32_165:S32 = %S32_160 %S32_164
mul %S32_166:S32 = 8:S32 5
mul %S32_167:S32 = %S32_166 4
lea %A32_168:A32 = blk %S32_167
ld %S32_169:S32 = %A32_168 0
mov x6 = %S32_169
or %S32_170:S32 = %S32_165 %S32_169
mul %S32_171:S32 = 8:S32 3
mul %S32_172:S32 = %S32_171 4
lea %A32_173:A32 = blk %S32_172
ld %S32_174:S32 = %A32_173 0
mov x7 = %S32_174
or %S32_175:S32 = %S32_170 %S32_174
bne %S32_175 0 if_3_end
bra if_3_true
.bbl if_3_true
ld %S32_176:S32 = blk 0
add %S32_177:S32 = %S32_176 32
shr %S32_178:S32 = %S32_177 6
add %S32_179:S32 = %S32_178 128
pusharg %S32_179
bsr njClip
poparg %U8_180:U8
conv %S32_181:S32 = %U8_180
mov x1 = %S32_181
mov x0 = 8
bra for_1_cond
.bbl for_1
conv %U8_182:U8 = x1
st out 0 = %U8_182
lea %A32_183:A32 = out stride
mov out = %A32_183
.bbl for_1_next
sub %S32_184:S32 = x0 1
mov x0 = %S32_184
.bbl for_1_cond
bne x0 0 for_1
bra for_1_exit
.bbl for_1_exit
ret
.bbl if_3_end
ld %S32_185:S32 = blk 0
shl %S32_186:S32 = %S32_185 8
add %S32_187:S32 = %S32_186 8192
mov x0 = %S32_187
add %S32_188:S32 = x4 x5
mul %S32_189:S32 = %S32_188 565
add %S32_190:S32 = %S32_189 4
mov x8 = %S32_190
sub %S32_191:S32 = 2841:S32 565
mul %S32_192:S32 = x4 %S32_191
add %S32_193:S32 = x8 %S32_192
shr %S32_194:S32 = %S32_193 3
mov x4 = %S32_194
add %S32_195:S32 = 2841:S32 565
mul %S32_196:S32 = x5 %S32_195
sub %S32_197:S32 = x8 %S32_196
shr %S32_198:S32 = %S32_197 3
mov x5 = %S32_198
add %S32_199:S32 = x6 x7
mul %S32_200:S32 = %S32_199 2408
add %S32_201:S32 = %S32_200 4
mov x8 = %S32_201
sub %S32_202:S32 = 2408:S32 1609
mul %S32_203:S32 = x6 %S32_202
sub %S32_204:S32 = x8 %S32_203
shr %S32_205:S32 = %S32_204 3
mov x6 = %S32_205
add %S32_206:S32 = 2408:S32 1609
mul %S32_207:S32 = x7 %S32_206
sub %S32_208:S32 = x8 %S32_207
shr %S32_209:S32 = %S32_208 3
mov x7 = %S32_209
add %S32_210:S32 = x0 x1
mov x8 = %S32_210
sub %S32_211:S32 = x0 x1
mov x0 = %S32_211
add %S32_212:S32 = x3 x2
mul %S32_213:S32 = %S32_212 1108
add %S32_214:S32 = %S32_213 4
mov x1 = %S32_214
add %S32_215:S32 = 2676:S32 1108
mul %S32_216:S32 = x2 %S32_215
sub %S32_217:S32 = x1 %S32_216
shr %S32_218:S32 = %S32_217 3
mov x2 = %S32_218
sub %S32_219:S32 = 2676:S32 1108
mul %S32_220:S32 = x3 %S32_219
add %S32_221:S32 = x1 %S32_220
shr %S32_222:S32 = %S32_221 3
mov x3 = %S32_222
add %S32_223:S32 = x4 x6
mov x1 = %S32_223
sub %S32_224:S32 = x4 x6
mov x4 = %S32_224
add %S32_225:S32 = x5 x7
mov x6 = %S32_225
sub %S32_226:S32 = x5 x7
mov x5 = %S32_226
add %S32_227:S32 = x8 x3
mov x7 = %S32_227
sub %S32_228:S32 = x8 x3
mov x8 = %S32_228
add %S32_229:S32 = x0 x2
mov x3 = %S32_229
sub %S32_230:S32 = x0 x2
mov x0 = %S32_230
add %S32_231:S32 = x4 x5
mul %S32_232:S32 = %S32_231 181
add %S32_233:S32 = %S32_232 128
shr %S32_234:S32 = %S32_233 8
mov x2 = %S32_234
sub %S32_235:S32 = x4 x5
mul %S32_236:S32 = %S32_235 181
add %S32_237:S32 = %S32_236 128
shr %S32_238:S32 = %S32_237 8
mov x4 = %S32_238
add %S32_239:S32 = x7 x1
shr %S32_240:S32 = %S32_239 14
add %S32_241:S32 = %S32_240 128
pusharg %S32_241
bsr njClip
poparg %U8_242:U8
st out 0 = %U8_242
lea %A32_243:A32 = out stride
mov out = %A32_243
add %S32_244:S32 = x3 x2
shr %S32_245:S32 = %S32_244 14
add %S32_246:S32 = %S32_245 128
pusharg %S32_246
bsr njClip
poparg %U8_247:U8
st out 0 = %U8_247
lea %A32_248:A32 = out stride
mov out = %A32_248
add %S32_249:S32 = x0 x4
shr %S32_250:S32 = %S32_249 14
add %S32_251:S32 = %S32_250 128
pusharg %S32_251
bsr njClip
poparg %U8_252:U8
st out 0 = %U8_252
lea %A32_253:A32 = out stride
mov out = %A32_253
add %S32_254:S32 = x8 x6
shr %S32_255:S32 = %S32_254 14
add %S32_256:S32 = %S32_255 128
pusharg %S32_256
bsr njClip
poparg %U8_257:U8
st out 0 = %U8_257
lea %A32_258:A32 = out stride
mov out = %A32_258
sub %S32_259:S32 = x8 x6
shr %S32_260:S32 = %S32_259 14
add %S32_261:S32 = %S32_260 128
pusharg %S32_261
bsr njClip
poparg %U8_262:U8
st out 0 = %U8_262
lea %A32_263:A32 = out stride
mov out = %A32_263
sub %S32_264:S32 = x0 x4
shr %S32_265:S32 = %S32_264 14
add %S32_266:S32 = %S32_265 128
pusharg %S32_266
bsr njClip
poparg %U8_267:U8
st out 0 = %U8_267
lea %A32_268:A32 = out stride
mov out = %A32_268
sub %S32_269:S32 = x3 x2
shr %S32_270:S32 = %S32_269 14
add %S32_271:S32 = %S32_270 128
pusharg %S32_271
bsr njClip
poparg %U8_272:U8
st out 0 = %U8_272
lea %A32_273:A32 = out stride
mov out = %A32_273
sub %S32_274:S32 = x7 x1
shr %S32_275:S32 = %S32_274 14
add %S32_276:S32 = %S32_275 128
pusharg %S32_276
bsr njClip
poparg %U8_277:U8
st out 0 = %U8_277
ret
.fun __static_1_njShowBits NORMAL [S32] = [S32]
.reg S32 [%out]
.bbl %start
poparg bits:S32
.reg U8 [newbyte]
bne bits 0 if_2_end
bra if_2_true
.bbl if_2_true
mov %out = 0
pusharg %out
ret
.bbl if_2_end
bra while_1_cond
.bbl while_1
lea %A32_278:A32 = nj
lea %A32_279:A32 = %A32_278 8
ld %S32_280:S32 = %A32_279 0
ble %S32_280 0 if_3_true
bra if_3_end
.bbl if_3_true
lea %A32_281:A32 = nj
lea %A32_282:A32 = %A32_281 524728
ld %S32_283:S32 = %A32_282 0
shl %S32_284:S32 = %S32_283 8
or %S32_285:S32 = %S32_284 255
lea %A32_286:A32 = nj
lea %A32_287:A32 = %A32_286 524728
st %A32_287 0 = %S32_285
lea %A32_288:A32 = nj
lea %A32_289:A32 = %A32_288 524732
ld %S32_290:S32 = %A32_289 0
add %S32_291:S32 = %S32_290 8
lea %A32_292:A32 = nj
lea %A32_293:A32 = %A32_292 524732
st %A32_293 0 = %S32_291
bra while_1_cond
.bbl if_3_end
lea %A32_294:A32 = nj
lea %A32_295:A32 = %A32_294 4
ld %A32_296:A32 = %A32_295 0
ld %U8_297:U8 = %A32_296 0
mov newbyte = %U8_297
lea %A32_298:A32 = nj
lea %A32_299:A32 = %A32_298 4
ld %A32_300:A32 = %A32_299 0
lea %A32_301:A32 = %A32_300 1
lea %A32_302:A32 = nj
lea %A32_303:A32 = %A32_302 4
st %A32_303 0 = %A32_301
lea %A32_304:A32 = nj
lea %A32_305:A32 = %A32_304 8
ld %S32_306:S32 = %A32_305 0
sub %S32_307:S32 = %S32_306 1
lea %A32_308:A32 = nj
lea %A32_309:A32 = %A32_308 8
st %A32_309 0 = %S32_307
lea %A32_310:A32 = nj
lea %A32_311:A32 = %A32_310 524732
ld %S32_312:S32 = %A32_311 0
add %S32_313:S32 = %S32_312 8
lea %A32_314:A32 = nj
lea %A32_315:A32 = %A32_314 524732
st %A32_315 0 = %S32_313
lea %A32_316:A32 = nj
lea %A32_317:A32 = %A32_316 524728
ld %S32_318:S32 = %A32_317 0
shl %S32_319:S32 = %S32_318 8
conv %S32_320:S32 = newbyte
or %S32_321:S32 = %S32_319 %S32_320
lea %A32_322:A32 = nj
lea %A32_323:A32 = %A32_322 524728
st %A32_323 0 = %S32_321
conv %S32_324:S32 = newbyte
beq %S32_324 255 if_6_true
bra while_1_cond
.bbl if_6_true
lea %A32_325:A32 = nj
lea %A32_326:A32 = %A32_325 8
ld %S32_327:S32 = %A32_326 0
bne %S32_327 0 if_5_true
bra if_5_false
.bbl if_5_true
.reg U8 [marker]
lea %A32_328:A32 = nj
lea %A32_329:A32 = %A32_328 4
ld %A32_330:A32 = %A32_329 0
ld %U8_331:U8 = %A32_330 0
mov marker = %U8_331
lea %A32_332:A32 = nj
lea %A32_333:A32 = %A32_332 4
ld %A32_334:A32 = %A32_333 0
lea %A32_335:A32 = %A32_334 1
lea %A32_336:A32 = nj
lea %A32_337:A32 = %A32_336 4
st %A32_337 0 = %A32_335
lea %A32_338:A32 = nj
lea %A32_339:A32 = %A32_338 8
ld %S32_340:S32 = %A32_339 0
sub %S32_341:S32 = %S32_340 1
lea %A32_342:A32 = nj
lea %A32_343:A32 = %A32_342 8
st %A32_343 0 = %S32_341
blt 255:U8 marker switch_344_default
.jtb switch_344_tab 256 switch_344_default [0 switch_344_0 255 switch_344_255 217 switch_344_217]
switch marker switch_344_tab
.bbl switch_344_0
.bbl switch_344_255
bra switch_344_end
.bbl switch_344_217
lea %A32_345:A32 = nj
lea %A32_346:A32 = %A32_345 8
mov %S32_347:S32 = 0
st %A32_346 0 = %S32_347
bra switch_344_end
.bbl switch_344_default
conv %S32_348:S32 = marker
and %S32_349:S32 = %S32_348 248
bne %S32_349 208 if_4_true
bra if_4_false
.bbl if_4_true
lea %A32_350:A32 = nj
mov %S32_351:S32 = 5
st %A32_350 0 = %S32_351
bra if_4_end
.bbl if_4_false
lea %A32_352:A32 = nj
lea %A32_353:A32 = %A32_352 524728
ld %S32_354:S32 = %A32_353 0
shl %S32_355:S32 = %S32_354 8
conv %S32_356:S32 = marker
or %S32_357:S32 = %S32_355 %S32_356
lea %A32_358:A32 = nj
lea %A32_359:A32 = %A32_358 524728
st %A32_359 0 = %S32_357
lea %A32_360:A32 = nj
lea %A32_361:A32 = %A32_360 524732
ld %S32_362:S32 = %A32_361 0
add %S32_363:S32 = %S32_362 8
lea %A32_364:A32 = nj
lea %A32_365:A32 = %A32_364 524732
st %A32_365 0 = %S32_363
.bbl if_4_end
.bbl switch_344_end
bra while_1_cond
.bbl if_5_false
lea %A32_366:A32 = nj
mov %S32_367:S32 = 5
st %A32_366 0 = %S32_367
.bbl while_1_cond
lea %A32_368:A32 = nj
lea %A32_369:A32 = %A32_368 524732
ld %S32_370:S32 = %A32_369 0
blt %S32_370 bits while_1
bra while_1_exit
.bbl while_1_exit
lea %A32_371:A32 = nj
lea %A32_372:A32 = %A32_371 524728
ld %S32_373:S32 = %A32_372 0
lea %A32_374:A32 = nj
lea %A32_375:A32 = %A32_374 524732
ld %S32_376:S32 = %A32_375 0
sub %S32_377:S32 = %S32_376 bits
shr %S32_378:S32 = %S32_373 %S32_377
shl %S32_379:S32 = 1:S32 bits
sub %S32_380:S32 = %S32_379 1
and %S32_381:S32 = %S32_378 %S32_380
mov %out = %S32_381
pusharg %out
ret
.fun njSkipBits NORMAL [] = [S32]
.bbl %start
poparg bits:S32
lea %A32_382:A32 = nj
lea %A32_383:A32 = %A32_382 524732
ld %S32_384:S32 = %A32_383 0
blt %S32_384 bits if_1_true
bra if_1_end
.bbl if_1_true
pusharg bits
bsr __static_1_njShowBits
poparg %S32_385:S32
.bbl if_1_end
lea %A32_386:A32 = nj
lea %A32_387:A32 = %A32_386 524732
ld %S32_388:S32 = %A32_387 0
sub %S32_389:S32 = %S32_388 bits
lea %A32_390:A32 = nj
lea %A32_391:A32 = %A32_390 524732
st %A32_391 0 = %S32_389
ret
.fun njGetBits NORMAL [S32] = [S32]
.reg S32 [%out]
.bbl %start
poparg bits:S32
.reg S32 [res]
pusharg bits
bsr __static_1_njShowBits
poparg %S32_392:S32
mov res = %S32_392
pusharg bits
bsr njSkipBits
mov %out = res
pusharg %out
ret
.fun njByteAlign NORMAL [] = []
.bbl %start
lea %A32_393:A32 = nj
lea %A32_394:A32 = %A32_393 524732
ld %S32_395:S32 = %A32_394 0
and %S32_396:S32 = %S32_395 248
lea %A32_397:A32 = nj
lea %A32_398:A32 = %A32_397 524732
st %A32_398 0 = %S32_396
ret
.fun __static_2_njSkip NORMAL [] = [S32]
.bbl %start
poparg count:S32
lea %A32_399:A32 = nj
lea %A32_400:A32 = %A32_399 4
ld %A32_401:A32 = %A32_400 0
lea %A32_402:A32 = %A32_401 count
lea %A32_403:A32 = nj
lea %A32_404:A32 = %A32_403 4
st %A32_404 0 = %A32_402
lea %A32_405:A32 = nj
lea %A32_406:A32 = %A32_405 8
ld %S32_407:S32 = %A32_406 0
sub %S32_408:S32 = %S32_407 count
lea %A32_409:A32 = nj
lea %A32_410:A32 = %A32_409 8
st %A32_410 0 = %S32_408
lea %A32_411:A32 = nj
lea %A32_412:A32 = %A32_411 12
ld %S32_413:S32 = %A32_412 0
sub %S32_414:S32 = %S32_413 count
lea %A32_415:A32 = nj
lea %A32_416:A32 = %A32_415 12
st %A32_416 0 = %S32_414
lea %A32_417:A32 = nj
lea %A32_418:A32 = %A32_417 8
ld %S32_419:S32 = %A32_418 0
blt %S32_419 0 if_1_true
bra if_1_end
.bbl if_1_true
lea %A32_420:A32 = nj
mov %S32_421:S32 = 5
st %A32_420 0 = %S32_421
.bbl if_1_end
ret
.fun njDecode16 NORMAL [U16] = [A32]
.reg U16 [%out]
.bbl %start
poparg pos:A32
ld %U8_422:U8 = pos 0
conv %S32_423:S32 = %U8_422
shl %S32_424:S32 = %S32_423 8
lea %A32_425:A32 = pos 1
ld %U8_426:U8 = %A32_425 0
conv %S32_427:S32 = %U8_426
or %S32_428:S32 = %S32_424 %S32_427
conv %U16_429:U16 = %S32_428
mov %out = %U16_429
pusharg %out
ret
.fun __static_3_njDecodeLength NORMAL [] = []
.bbl %start
lea %A32_430:A32 = nj
lea %A32_431:A32 = %A32_430 8
ld %S32_432:S32 = %A32_431 0
blt %S32_432 2 while_1
bra if_4_end
.bbl while_1
lea %A32_433:A32 = nj
mov %S32_434:S32 = 5
st %A32_433 0 = %S32_434
ret
.bbl while_1_cond
bne 0:S32 0 while_1
bra if_4_end
.bbl if_4_end
lea %A32_435:A32 = nj
lea %A32_436:A32 = %A32_435 4
ld %A32_437:A32 = %A32_436 0
pusharg %A32_437
bsr njDecode16
poparg %U16_438:U16
conv %S32_439:S32 = %U16_438
lea %A32_440:A32 = nj
lea %A32_441:A32 = %A32_440 12
st %A32_441 0 = %S32_439
lea %A32_442:A32 = nj
lea %A32_443:A32 = %A32_442 12
ld %S32_444:S32 = %A32_443 0
lea %A32_445:A32 = nj
lea %A32_446:A32 = %A32_445 8
ld %S32_447:S32 = %A32_446 0
blt %S32_447 %S32_444 while_2
bra if_6_end
.bbl while_2
lea %A32_448:A32 = nj
mov %S32_449:S32 = 5
st %A32_448 0 = %S32_449
ret
.bbl while_2_cond
bne 0:S32 0 while_2
bra if_6_end
.bbl if_6_end
mov %S32_450:S32 = 2
pusharg %S32_450
bsr __static_2_njSkip
ret
.fun njSkipMarker NORMAL [] = []
.bbl %start
bsr __static_3_njDecodeLength
lea %A32_451:A32 = nj
lea %A32_452:A32 = %A32_451 12
ld %S32_453:S32 = %A32_452 0
pusharg %S32_453
bsr __static_2_njSkip
ret
.fun njDecodeSOF NORMAL [] = []
.bbl %start
.reg S32 [i]
.reg S32 [ssxmax]
mov ssxmax = 0
.reg S32 [ssymax]
mov ssymax = 0
.reg A32 [c]
bsr __static_3_njDecodeLength
.bbl while_1
lea %A32_454:A32 = nj
lea %A32_455:A32 = %A32_454 0
ld %S32_456:S32 = %A32_455 0
bne %S32_456 0 if_17_true
bra while_1_cond
.bbl if_17_true
ret
.bbl while_1_cond
bne 0:S32 0 while_1
bra while_1_exit
.bbl while_1_exit
lea %A32_457:A32 = nj
lea %A32_458:A32 = %A32_457 12
ld %S32_459:S32 = %A32_458 0
blt %S32_459 9 while_2
bra if_20_end
.bbl while_2
lea %A32_460:A32 = nj
mov %S32_461:S32 = 5
st %A32_460 0 = %S32_461
ret
.bbl while_2_cond
bne 0:S32 0 while_2
bra if_20_end
.bbl if_20_end
lea %A32_462:A32 = nj
lea %A32_463:A32 = %A32_462 4
ld %A32_464:A32 = %A32_463 0
ld %U8_465:U8 = %A32_464 0
conv %S32_466:S32 = %U8_465
bne %S32_466 8 while_3
bra if_22_end
.bbl while_3
lea %A32_467:A32 = nj
mov %S32_468:S32 = 2
st %A32_467 0 = %S32_468
ret
.bbl while_3_cond
bne 0:S32 0 while_3
bra if_22_end
.bbl if_22_end
lea %A32_469:A32 = nj
lea %A32_470:A32 = %A32_469 4
ld %A32_471:A32 = %A32_470 0
lea %A32_472:A32 = %A32_471 1
pusharg %A32_472
bsr njDecode16
poparg %U16_473:U16
conv %S32_474:S32 = %U16_473
lea %A32_475:A32 = nj
lea %A32_476:A32 = %A32_475 20
st %A32_476 0 = %S32_474
lea %A32_477:A32 = nj
lea %A32_478:A32 = %A32_477 4
ld %A32_479:A32 = %A32_478 0
lea %A32_480:A32 = %A32_479 3
pusharg %A32_480
bsr njDecode16
poparg %U16_481:U16
conv %S32_482:S32 = %U16_481
lea %A32_483:A32 = nj
lea %A32_484:A32 = %A32_483 16
st %A32_484 0 = %S32_482
lea %A32_485:A32 = nj
lea %A32_486:A32 = %A32_485 16
ld %S32_487:S32 = %A32_486 0
bne %S32_487 0 branch_50
bra while_4
.bbl branch_50
lea %A32_488:A32 = nj
lea %A32_489:A32 = %A32_488 20
ld %S32_490:S32 = %A32_489 0
bne %S32_490 0 if_24_end
bra while_4
.bbl while_4
lea %A32_491:A32 = nj
mov %S32_492:S32 = 5
st %A32_491 0 = %S32_492
ret
.bbl while_4_cond
bne 0:S32 0 while_4
bra if_24_end
.bbl if_24_end
lea %A32_493:A32 = nj
lea %A32_494:A32 = %A32_493 4
ld %A32_495:A32 = %A32_494 0
lea %A32_496:A32 = %A32_495 5
ld %U8_497:U8 = %A32_496 0
conv %U32_498:U32 = %U8_497
lea %A32_499:A32 = nj
lea %A32_500:A32 = %A32_499 40
st %A32_500 0 = %U32_498
mov %S32_501:S32 = 6
pusharg %S32_501
bsr __static_2_njSkip
lea %A32_502:A32 = nj
lea %A32_503:A32 = %A32_502 40
ld %U32_504:U32 = %A32_503 0
blt 3:U32 %U32_504 switch_505_default
.jtb switch_505_tab 4 switch_505_default [1 switch_505_1 3 switch_505_3]
switch %U32_504 switch_505_tab
.bbl switch_505_1
.bbl switch_505_3
bra switch_505_end
.bbl switch_505_default
.bbl while_5
lea %A32_506:A32 = nj
mov %S32_507:S32 = 2
st %A32_506 0 = %S32_507
ret
.bbl while_5_cond
bne 0:S32 0 while_5
bra while_5_exit
.bbl while_5_exit
.bbl switch_505_end
lea %A32_508:A32 = nj
lea %A32_509:A32 = %A32_508 12
ld %S32_510:S32 = %A32_509 0
conv %U32_511:U32 = %S32_510
lea %A32_512:A32 = nj
lea %A32_513:A32 = %A32_512 40
ld %U32_514:U32 = %A32_513 0
mul %U32_515:U32 = %U32_514 3
blt %U32_511 %U32_515 while_6
bra if_27_end
.bbl while_6
lea %A32_516:A32 = nj
mov %S32_517:S32 = 5
st %A32_516 0 = %S32_517
ret
.bbl while_6_cond
bne 0:S32 0 while_6
bra if_27_end
.bbl if_27_end
mov i = 0
lea %A32_518:A32 = nj
lea %A32_519:A32 = %A32_518 44
mov c = %A32_519
bra for_15_cond
.bbl for_15
lea %A32_520:A32 = nj
lea %A32_521:A32 = %A32_520 4
ld %A32_522:A32 = %A32_521 0
ld %U8_523:U8 = %A32_522 0
conv %S32_524:S32 = %U8_523
st c 0 = %S32_524
lea %A32_525:A32 = nj
lea %A32_526:A32 = %A32_525 4
ld %A32_527:A32 = %A32_526 0
lea %A32_528:A32 = %A32_527 1
ld %U8_529:U8 = %A32_528 0
conv %S32_530:S32 = %U8_529
shr %S32_531:S32 = %S32_530 4
lea %A32_532:A32 = c 4
st %A32_532 0 = %S32_531
bne %S32_531 0 if_29_end
bra while_7
.bbl while_7
lea %A32_533:A32 = nj
mov %S32_534:S32 = 5
st %A32_533 0 = %S32_534
ret
.bbl while_7_cond
bne 0:S32 0 while_7
bra if_29_end
.bbl if_29_end
lea %A32_535:A32 = c 4
ld %S32_536:S32 = %A32_535 0
lea %A32_537:A32 = c 4
ld %S32_538:S32 = %A32_537 0
sub %S32_539:S32 = %S32_538 1
and %S32_540:S32 = %S32_536 %S32_539
bne %S32_540 0 while_8
bra if_31_end
.bbl while_8
lea %A32_541:A32 = nj
mov %S32_542:S32 = 2
st %A32_541 0 = %S32_542
ret
.bbl while_8_cond
bne 0:S32 0 while_8
bra if_31_end
.bbl if_31_end
lea %A32_543:A32 = nj
lea %A32_544:A32 = %A32_543 4
ld %A32_545:A32 = %A32_544 0
lea %A32_546:A32 = %A32_545 1
ld %U8_547:U8 = %A32_546 0
conv %S32_548:S32 = %U8_547
and %S32_549:S32 = %S32_548 15
lea %A32_550:A32 = c 8
st %A32_550 0 = %S32_549
bne %S32_549 0 if_33_end
bra while_9
.bbl while_9
lea %A32_551:A32 = nj
mov %S32_552:S32 = 5
st %A32_551 0 = %S32_552
ret
.bbl while_9_cond
bne 0:S32 0 while_9
bra if_33_end
.bbl if_33_end
lea %A32_553:A32 = c 8
ld %S32_554:S32 = %A32_553 0
lea %A32_555:A32 = c 8
ld %S32_556:S32 = %A32_555 0
sub %S32_557:S32 = %S32_556 1
and %S32_558:S32 = %S32_554 %S32_557
bne %S32_558 0 while_10
bra if_35_end
.bbl while_10
lea %A32_559:A32 = nj
mov %S32_560:S32 = 2
st %A32_559 0 = %S32_560
ret
.bbl while_10_cond
bne 0:S32 0 while_10
bra if_35_end
.bbl if_35_end
lea %A32_561:A32 = nj
lea %A32_562:A32 = %A32_561 4
ld %A32_563:A32 = %A32_562 0
lea %A32_564:A32 = %A32_563 2
ld %U8_565:U8 = %A32_564 0
conv %S32_566:S32 = %U8_565
lea %A32_567:A32 = c 24
st %A32_567 0 = %S32_566
and %S32_568:S32 = %S32_566 252
bne %S32_568 0 while_11
bra if_37_end
.bbl while_11
lea %A32_569:A32 = nj
mov %S32_570:S32 = 5
st %A32_569 0 = %S32_570
ret
.bbl while_11_cond
bne 0:S32 0 while_11
bra if_37_end
.bbl if_37_end
mov %S32_571:S32 = 3
pusharg %S32_571
bsr __static_2_njSkip
lea %A32_572:A32 = nj
lea %A32_573:A32 = %A32_572 176
ld %S32_574:S32 = %A32_573 0
lea %A32_575:A32 = c 24
ld %S32_576:S32 = %A32_575 0
shl %S32_577:S32 = 1:S32 %S32_576
or %S32_578:S32 = %S32_574 %S32_577
lea %A32_579:A32 = nj
lea %A32_580:A32 = %A32_579 176
st %A32_580 0 = %S32_578
lea %A32_581:A32 = c 4
ld %S32_582:S32 = %A32_581 0
blt ssxmax %S32_582 if_38_true
bra if_38_end
.bbl if_38_true
lea %A32_583:A32 = c 4
ld %S32_584:S32 = %A32_583 0
mov ssxmax = %S32_584
.bbl if_38_end
lea %A32_585:A32 = c 8
ld %S32_586:S32 = %A32_585 0
blt ssymax %S32_586 if_39_true
bra for_15_next
.bbl if_39_true
lea %A32_587:A32 = c 8
ld %S32_588:S32 = %A32_587 0
mov ssymax = %S32_588
.bbl for_15_next
add %S32_589:S32 = i 1
mov i = %S32_589
lea %A32_590:A32 = c 44
mov c = %A32_590
.bbl for_15_cond
conv %U32_591:U32 = i
lea %A32_592:A32 = nj
lea %A32_593:A32 = %A32_592 40
ld %U32_594:U32 = %A32_593 0
blt %U32_591 %U32_594 for_15
bra for_15_exit
.bbl for_15_exit
lea %A32_595:A32 = nj
lea %A32_596:A32 = %A32_595 40
ld %U32_597:U32 = %A32_596 0
beq %U32_597 1 if_41_true
bra if_41_end
.bbl if_41_true
lea %A32_598:A32 = nj
lea %A32_599:A32 = %A32_598 44
mov c = %A32_599
mov ssymax = 1
mov ssxmax = 1
lea %A32_600:A32 = c 8
mov %S32_601:S32 = 1
st %A32_600 0 = %S32_601
lea %A32_602:A32 = c 4
st %A32_602 0 = %S32_601
.bbl if_41_end
shl %S32_603:S32 = ssxmax 3
lea %A32_604:A32 = nj
lea %A32_605:A32 = %A32_604 32
st %A32_605 0 = %S32_603
shl %S32_606:S32 = ssymax 3
lea %A32_607:A32 = nj
lea %A32_608:A32 = %A32_607 36
st %A32_608 0 = %S32_606
lea %A32_609:A32 = nj
lea %A32_610:A32 = %A32_609 16
ld %S32_611:S32 = %A32_610 0
lea %A32_612:A32 = nj
lea %A32_613:A32 = %A32_612 32
ld %S32_614:S32 = %A32_613 0
add %S32_615:S32 = %S32_611 %S32_614
sub %S32_616:S32 = %S32_615 1
lea %A32_617:A32 = nj
lea %A32_618:A32 = %A32_617 32
ld %S32_619:S32 = %A32_618 0
div %S32_620:S32 = %S32_616 %S32_619
lea %A32_621:A32 = nj
lea %A32_622:A32 = %A32_621 24
st %A32_622 0 = %S32_620
lea %A32_623:A32 = nj
lea %A32_624:A32 = %A32_623 20
ld %S32_625:S32 = %A32_624 0
lea %A32_626:A32 = nj
lea %A32_627:A32 = %A32_626 36
ld %S32_628:S32 = %A32_627 0
add %S32_629:S32 = %S32_625 %S32_628
sub %S32_630:S32 = %S32_629 1
lea %A32_631:A32 = nj
lea %A32_632:A32 = %A32_631 36
ld %S32_633:S32 = %A32_632 0
div %S32_634:S32 = %S32_630 %S32_633
lea %A32_635:A32 = nj
lea %A32_636:A32 = %A32_635 28
st %A32_636 0 = %S32_634
mov i = 0
lea %A32_637:A32 = nj
lea %A32_638:A32 = %A32_637 44
mov c = %A32_638
bra for_16_cond
.bbl for_16
lea %A32_639:A32 = nj
lea %A32_640:A32 = %A32_639 16
ld %S32_641:S32 = %A32_640 0
lea %A32_642:A32 = c 4
ld %S32_643:S32 = %A32_642 0
mul %S32_644:S32 = %S32_641 %S32_643
add %S32_645:S32 = %S32_644 ssxmax
sub %S32_646:S32 = %S32_645 1
div %S32_647:S32 = %S32_646 ssxmax
lea %A32_648:A32 = c 12
st %A32_648 0 = %S32_647
lea %A32_649:A32 = nj
lea %A32_650:A32 = %A32_649 20
ld %S32_651:S32 = %A32_650 0
lea %A32_652:A32 = c 8
ld %S32_653:S32 = %A32_652 0
mul %S32_654:S32 = %S32_651 %S32_653
add %S32_655:S32 = %S32_654 ssymax
sub %S32_656:S32 = %S32_655 1
div %S32_657:S32 = %S32_656 ssymax
lea %A32_658:A32 = c 16
st %A32_658 0 = %S32_657
lea %A32_659:A32 = nj
lea %A32_660:A32 = %A32_659 24
ld %S32_661:S32 = %A32_660 0
lea %A32_662:A32 = c 4
ld %S32_663:S32 = %A32_662 0
mul %S32_664:S32 = %S32_661 %S32_663
shl %S32_665:S32 = %S32_664 3
lea %A32_666:A32 = c 20
st %A32_666 0 = %S32_665
lea %A32_667:A32 = c 12
ld %S32_668:S32 = %A32_667 0
blt %S32_668 3 branch_52
bra branch_51
.bbl branch_52
lea %A32_669:A32 = c 4
ld %S32_670:S32 = %A32_669 0
bne %S32_670 ssxmax while_12
bra branch_51
.bbl branch_51
lea %A32_671:A32 = c 16
ld %S32_672:S32 = %A32_671 0
blt %S32_672 3 branch_53
bra if_43_end
.bbl branch_53
lea %A32_673:A32 = c 8
ld %S32_674:S32 = %A32_673 0
bne %S32_674 ssymax while_12
bra if_43_end
.bbl while_12
lea %A32_675:A32 = nj
mov %S32_676:S32 = 2
st %A32_675 0 = %S32_676
ret
.bbl while_12_cond
bne 0:S32 0 while_12
bra if_43_end
.bbl if_43_end
lea %A32_677:A32 = c 20
ld %S32_678:S32 = %A32_677 0
lea %A32_679:A32 = nj
lea %A32_680:A32 = %A32_679 28
ld %S32_681:S32 = %A32_680 0
mul %S32_682:S32 = %S32_678 %S32_681
lea %A32_683:A32 = c 8
ld %S32_684:S32 = %A32_683 0
mul %S32_685:S32 = %S32_682 %S32_684
shl %S32_686:S32 = %S32_685 3
conv %U32_687:U32 = %S32_686
pusharg %U32_687
bsr malloc
poparg %A32_688:A32
lea %A32_689:A32 = c 40
st %A32_689 0 = %A32_688
bne %A32_688 0 for_16_next
bra while_13
.bbl while_13
lea %A32_690:A32 = nj
mov %S32_691:S32 = 3
st %A32_690 0 = %S32_691
ret
.bbl while_13_cond
bne 0:S32 0 while_13
bra for_16_next
.bbl for_16_next
add %S32_692:S32 = i 1
mov i = %S32_692
lea %A32_693:A32 = c 44
mov c = %A32_693
.bbl for_16_cond
conv %U32_694:U32 = i
lea %A32_695:A32 = nj
lea %A32_696:A32 = %A32_695 40
ld %U32_697:U32 = %A32_696 0
blt %U32_694 %U32_697 for_16
bra for_16_exit
.bbl for_16_exit
lea %A32_698:A32 = nj
lea %A32_699:A32 = %A32_698 40
ld %U32_700:U32 = %A32_699 0
beq %U32_700 3 if_49_true
bra if_49_end
.bbl if_49_true
lea %A32_701:A32 = nj
lea %A32_702:A32 = %A32_701 16
ld %S32_703:S32 = %A32_702 0
lea %A32_704:A32 = nj
lea %A32_705:A32 = %A32_704 20
ld %S32_706:S32 = %A32_705 0
mul %S32_707:S32 = %S32_703 %S32_706
conv %U32_708:U32 = %S32_707
lea %A32_709:A32 = nj
lea %A32_710:A32 = %A32_709 40
ld %U32_711:U32 = %A32_710 0
mul %U32_712:U32 = %U32_708 %U32_711
pusharg %U32_712
bsr malloc
poparg %A32_713:A32
lea %A32_714:A32 = nj
lea %A32_715:A32 = %A32_714 524996
st %A32_715 0 = %A32_713
lea %A32_716:A32 = nj
lea %A32_717:A32 = %A32_716 524996
ld %A32_718:A32 = %A32_717 0
bne %A32_718 0 if_49_end
bra while_14
.bbl while_14
lea %A32_719:A32 = nj
mov %S32_720:S32 = 3
st %A32_719 0 = %S32_720
ret
.bbl while_14_cond
bne 0:S32 0 while_14
bra if_49_end
.bbl if_49_end
lea %A32_721:A32 = nj
lea %A32_722:A32 = %A32_721 12
ld %S32_723:S32 = %A32_722 0
pusharg %S32_723
bsr __static_2_njSkip
ret
.fun njDecodeDHT NORMAL [] = []
.bbl %start
.reg S32 [codelen]
.reg S32 [currcnt]
.reg S32 [remain]
.reg S32 [spread]
.reg S32 [i]
.reg S32 [j]
.reg A32 [vlc]
bsr __static_3_njDecodeLength
.bbl while_1
lea %A32_724:A32 = nj
lea %A32_725:A32 = %A32_724 0
ld %S32_726:S32 = %A32_725 0
bne %S32_726 0 if_13_true
bra while_1_cond
.bbl if_13_true
ret
.bbl while_1_cond
bne 0:S32 0 while_1
bra while_1_exit
.bbl while_1_exit
bra while_7_cond
.bbl while_7
lea %A32_727:A32 = nj
lea %A32_728:A32 = %A32_727 4
ld %A32_729:A32 = %A32_728 0
ld %U8_730:U8 = %A32_729 0
conv %S32_731:S32 = %U8_730
mov i = %S32_731
and %S32_732:S32 = i 236
bne %S32_732 0 while_2
bra if_16_end
.bbl while_2
lea %A32_733:A32 = nj
mov %S32_734:S32 = 5
st %A32_733 0 = %S32_734
ret
.bbl while_2_cond
bne 0:S32 0 while_2
bra if_16_end
.bbl if_16_end
and %S32_735:S32 = i 2
bne %S32_735 0 while_3
bra if_18_end
.bbl while_3
lea %A32_736:A32 = nj
mov %S32_737:S32 = 2
st %A32_736 0 = %S32_737
ret
.bbl while_3_cond
bne 0:S32 0 while_3
bra if_18_end
.bbl if_18_end
shr %S32_738:S32 = i 3
or %S32_739:S32 = i %S32_738
and %S32_740:S32 = %S32_739 3
mov i = %S32_740
mov codelen = 1
bra for_9_cond
.bbl for_9
lea %A32_741:A32 = nj
lea %A32_742:A32 = %A32_741 4
ld %A32_743:A32 = %A32_742 0
lea %A32_744:A32 = %A32_743 codelen
ld %U8_745:U8 = %A32_744 0
lea %A32_746:A32 = __static_4_counts
sub %S32_747:S32 = codelen 1
lea %A32_748:A32 = %A32_746 %S32_747
st %A32_748 0 = %U8_745
.bbl for_9_next
add %S32_749:S32 = codelen 1
mov codelen = %S32_749
.bbl for_9_cond
ble codelen 16 for_9
bra for_9_exit
.bbl for_9_exit
mov %S32_750:S32 = 17
pusharg %S32_750
bsr __static_2_njSkip
lea %A32_751:A32 = nj
lea %A32_752:A32 = %A32_751 440
mul %S32_753:S32 = i 65536
mul %S32_754:S32 = %S32_753 2
lea %A32_755:A32 = %A32_752 %S32_754
mov vlc = %A32_755
mov spread = 65536
mov remain = 65536
mov codelen = 1
bra for_12_cond
.bbl for_12
shr %S32_756:S32 = spread 1
mov spread = %S32_756
lea %A32_757:A32 = __static_4_counts
sub %S32_758:S32 = codelen 1
lea %A32_759:A32 = %A32_757 %S32_758
ld %U8_760:U8 = %A32_759 0
conv %S32_761:S32 = %U8_760
mov currcnt = %S32_761
bne currcnt 0 if_20_end
bra for_12_next
.bbl if_20_end
lea %A32_762:A32 = nj
lea %A32_763:A32 = %A32_762 12
ld %S32_764:S32 = %A32_763 0
blt %S32_764 currcnt while_4
bra if_22_end
.bbl while_4
lea %A32_765:A32 = nj
mov %S32_766:S32 = 5
st %A32_765 0 = %S32_766
ret
.bbl while_4_cond
bne 0:S32 0 while_4
bra if_22_end
.bbl if_22_end
sub %S32_767:S32 = 16:S32 codelen
shl %S32_768:S32 = currcnt %S32_767
sub %S32_769:S32 = remain %S32_768
mov remain = %S32_769
blt remain 0 while_5
bra if_24_end
.bbl while_5
lea %A32_770:A32 = nj
mov %S32_771:S32 = 5
st %A32_770 0 = %S32_771
ret
.bbl while_5_cond
bne 0:S32 0 while_5
bra if_24_end
.bbl if_24_end
mov i = 0
bra for_11_cond
.bbl for_11
.reg U8 [code]
lea %A32_772:A32 = nj
lea %A32_773:A32 = %A32_772 4
ld %A32_774:A32 = %A32_773 0
lea %A32_775:A32 = %A32_774 i
ld %U8_776:U8 = %A32_775 0
mov code = %U8_776
mov j = spread
bra for_10_cond
.bbl for_10
conv %U8_777:U8 = codelen
st vlc 0 = %U8_777
lea %A32_778:A32 = vlc 1
st %A32_778 0 = code
lea %A32_779:A32 = vlc 2
mov vlc = %A32_779
.bbl for_10_next
sub %S32_780:S32 = j 1
mov j = %S32_780
.bbl for_10_cond
bne j 0 for_10
bra for_11_next
.bbl for_11_next
add %S32_781:S32 = i 1
mov i = %S32_781
.bbl for_11_cond
blt i currcnt for_11
bra for_11_exit
.bbl for_11_exit
pusharg currcnt
bsr __static_2_njSkip
.bbl for_12_next
add %S32_782:S32 = codelen 1
mov codelen = %S32_782
.bbl for_12_cond
ble codelen 16 for_12
bra for_12_exit
.bbl for_12_exit
bra while_6_cond
.bbl while_6
sub %S32_783:S32 = remain 1
mov remain = %S32_783
mov %U8_784:U8 = 0
st vlc 0 = %U8_784
lea %A32_785:A32 = vlc 2
mov vlc = %A32_785
.bbl while_6_cond
bne remain 0 while_6
bra while_7_cond
.bbl while_7_cond
lea %A32_786:A32 = nj
lea %A32_787:A32 = %A32_786 12
ld %S32_788:S32 = %A32_787 0
ble 17:S32 %S32_788 while_7
bra while_7_exit
.bbl while_7_exit
lea %A32_789:A32 = nj
lea %A32_790:A32 = %A32_789 12
ld %S32_791:S32 = %A32_790 0
bne %S32_791 0 while_8
bra if_31_end
.bbl while_8
lea %A32_792:A32 = nj
mov %S32_793:S32 = 5
st %A32_792 0 = %S32_793
ret
.bbl while_8_cond
bne 0:S32 0 while_8
bra if_31_end
.bbl if_31_end
ret
.fun njDecodeDQT NORMAL [] = []
.bbl %start
.reg S32 [i]
.reg A32 [t]
bsr __static_3_njDecodeLength
.bbl while_1
lea %A32_794:A32 = nj
lea %A32_795:A32 = %A32_794 0
ld %S32_796:S32 = %A32_795 0
bne %S32_796 0 if_6_true
bra while_1_cond
.bbl if_6_true
ret
.bbl while_1_cond
bne 0:S32 0 while_1
bra while_1_exit
.bbl while_1_exit
bra while_3_cond
.bbl while_3
lea %A32_797:A32 = nj
lea %A32_798:A32 = %A32_797 4
ld %A32_799:A32 = %A32_798 0
ld %U8_800:U8 = %A32_799 0
conv %S32_801:S32 = %U8_800
mov i = %S32_801
and %S32_802:S32 = i 252
bne %S32_802 0 while_2
bra if_9_end
.bbl while_2
lea %A32_803:A32 = nj
mov %S32_804:S32 = 5
st %A32_803 0 = %S32_804
ret
.bbl while_2_cond
bne 0:S32 0 while_2
bra if_9_end
.bbl if_9_end
lea %A32_805:A32 = nj
lea %A32_806:A32 = %A32_805 180
ld %S32_807:S32 = %A32_806 0
shl %S32_808:S32 = 1:S32 i
or %S32_809:S32 = %S32_807 %S32_808
lea %A32_810:A32 = nj
lea %A32_811:A32 = %A32_810 180
st %A32_811 0 = %S32_809
lea %A32_812:A32 = nj
lea %A32_813:A32 = %A32_812 184
mul %S32_814:S32 = i 64
lea %A32_815:A32 = %A32_813 %S32_814
mov t = %A32_815
mov i = 0
bra for_5_cond
.bbl for_5
lea %A32_816:A32 = nj
lea %A32_817:A32 = %A32_816 4
ld %A32_818:A32 = %A32_817 0
add %S32_819:S32 = i 1
lea %A32_820:A32 = %A32_818 %S32_819
ld %U8_821:U8 = %A32_820 0
lea %A32_822:A32 = t i
st %A32_822 0 = %U8_821
.bbl for_5_next
add %S32_823:S32 = i 1
mov i = %S32_823
.bbl for_5_cond
blt i 64 for_5
bra for_5_exit
.bbl for_5_exit
mov %S32_824:S32 = 65
pusharg %S32_824
bsr __static_2_njSkip
.bbl while_3_cond
lea %A32_825:A32 = nj
lea %A32_826:A32 = %A32_825 12
ld %S32_827:S32 = %A32_826 0
ble 65:S32 %S32_827 while_3
bra while_3_exit
.bbl while_3_exit
lea %A32_828:A32 = nj
lea %A32_829:A32 = %A32_828 12
ld %S32_830:S32 = %A32_829 0
bne %S32_830 0 while_4
bra if_13_end
.bbl while_4
lea %A32_831:A32 = nj
mov %S32_832:S32 = 5
st %A32_831 0 = %S32_832
ret
.bbl while_4_cond
bne 0:S32 0 while_4
bra if_13_end
.bbl if_13_end
ret
.fun njDecodeDRI NORMAL [] = []
.bbl %start
bsr __static_3_njDecodeLength
.bbl while_1
lea %A32_833:A32 = nj
lea %A32_834:A32 = %A32_833 0
ld %S32_835:S32 = %A32_834 0
bne %S32_835 0 if_3_true
bra while_1_cond
.bbl if_3_true
ret
.bbl while_1_cond
bne 0:S32 0 while_1
bra while_1_exit
.bbl while_1_exit
lea %A32_836:A32 = nj
lea %A32_837:A32 = %A32_836 12
ld %S32_838:S32 = %A32_837 0
blt %S32_838 2 while_2
bra if_6_end
.bbl while_2
lea %A32_839:A32 = nj
mov %S32_840:S32 = 5
st %A32_839 0 = %S32_840
ret
.bbl while_2_cond
bne 0:S32 0 while_2
bra if_6_end
.bbl if_6_end
lea %A32_841:A32 = nj
lea %A32_842:A32 = %A32_841 4
ld %A32_843:A32 = %A32_842 0
pusharg %A32_843
bsr njDecode16
poparg %U16_844:U16
conv %S32_845:S32 = %U16_844
lea %A32_846:A32 = nj
lea %A32_847:A32 = %A32_846 524992
st %A32_847 0 = %S32_845
lea %A32_848:A32 = nj
lea %A32_849:A32 = %A32_848 12
ld %S32_850:S32 = %A32_849 0
pusharg %S32_850
bsr __static_2_njSkip
ret
.fun njGetVLC NORMAL [S32] = [A32 A32]
.reg S32 [%out]
.bbl %start
poparg vlc:A32
poparg code:A32
.reg S32 [value]
mov %S32_852:S32 = 16
pusharg %S32_852
bsr __static_1_njShowBits
poparg %S32_851:S32
mov value = %S32_851
.reg S32 [bits]
mul %S32_853:S32 = value 2
lea %A32_854:A32 = vlc %S32_853
lea %A32_855:A32 = %A32_854 0
ld %U8_856:U8 = %A32_855 0
conv %S32_857:S32 = %U8_856
mov bits = %S32_857
bne bits 0 if_1_end
bra if_1_true
.bbl if_1_true
lea %A32_858:A32 = nj
mov %S32_859:S32 = 5
st %A32_858 0 = %S32_859
mov %out = 0
pusharg %out
ret
.bbl if_1_end
pusharg bits
bsr njSkipBits
mul %S32_860:S32 = value 2
lea %A32_861:A32 = vlc %S32_860
lea %A32_862:A32 = %A32_861 1
ld %U8_863:U8 = %A32_862 0
conv %S32_864:S32 = %U8_863
mov value = %S32_864
bne code 0 if_2_true
bra if_2_end
.bbl if_2_true
conv %U8_865:U8 = value
st code 0 = %U8_865
.bbl if_2_end
and %S32_866:S32 = value 15
mov bits = %S32_866
bne bits 0 if_3_end
bra if_3_true
.bbl if_3_true
mov %out = 0
pusharg %out
ret
.bbl if_3_end
pusharg bits
bsr njGetBits
poparg %S32_867:S32
mov value = %S32_867
sub %S32_868:S32 = bits 1
shl %S32_869:S32 = 1:S32 %S32_868
blt value %S32_869 if_4_true
bra if_4_end
.bbl if_4_true
shl %S32_870:S32 = -1:S32 bits
add %S32_871:S32 = %S32_870 1
add %S32_872:S32 = value %S32_871
mov value = %S32_872
.bbl if_4_end
mov %out = value
pusharg %out
ret
.fun njDecodeBlock NORMAL [] = [A32 A32]
.bbl %start
poparg c:A32
poparg out:A32
.stk code 1 1
lea %A32_873:A32 = code
mov %U8_874:U8 = 0
st %A32_873 0 = %U8_874
.reg S32 [value]
.reg S32 [coef]
mov coef = 0
lea %A32_875:A32 = nj
lea %A32_876:A32 = %A32_875 524736
lea %A32_877:A32 = nj
lea %A32_878:A32 = %A32_877 524736
mov %S32_879:S32 = 0
mov %U32_880:U32 = 256
pusharg %U32_880
pusharg %S32_879
pusharg %A32_876
bsr mymemset
lea %A32_881:A32 = c 36
ld %S32_882:S32 = %A32_881 0
lea %A32_883:A32 = nj
lea %A32_884:A32 = %A32_883 440
lea %A32_885:A32 = c 32
ld %S32_886:S32 = %A32_885 0
mul %S32_887:S32 = %S32_886 65536
mul %S32_888:S32 = %S32_887 2
lea %A32_889:A32 = %A32_884 %S32_888
lea %A32_891:A32 = 0:A32
pusharg %A32_891
pusharg %A32_889
bsr njGetVLC
poparg %S32_890:S32
add %S32_892:S32 = %S32_882 %S32_890
lea %A32_893:A32 = c 36
st %A32_893 0 = %S32_892
lea %A32_894:A32 = c 36
ld %S32_895:S32 = %A32_894 0
lea %A32_896:A32 = nj
lea %A32_897:A32 = %A32_896 184
lea %A32_898:A32 = c 24
ld %S32_899:S32 = %A32_898 0
mul %S32_900:S32 = %S32_899 64
lea %A32_901:A32 = %A32_897 %S32_900
ld %U8_902:U8 = %A32_901 0
conv %S32_903:S32 = %U8_902
mul %S32_904:S32 = %S32_895 %S32_903
lea %A32_905:A32 = nj
lea %A32_906:A32 = %A32_905 524736
st %A32_906 0 = %S32_904
.bbl while_3
lea %A32_907:A32 = nj
lea %A32_908:A32 = %A32_907 440
lea %A32_909:A32 = c 28
ld %S32_910:S32 = %A32_909 0
mul %S32_911:S32 = %S32_910 65536
mul %S32_912:S32 = %S32_911 2
lea %A32_913:A32 = %A32_908 %S32_912
lea %A32_914:A32 = code
pusharg %A32_914
pusharg %A32_913
bsr njGetVLC
poparg %S32_915:S32
mov value = %S32_915
lea %A32_916:A32 = code
ld %U8_917:U8 = %A32_916 0
conv %S32_918:S32 = %U8_917
bne %S32_918 0 if_6_end
bra while_3_exit
.bbl if_6_end
lea %A32_919:A32 = code
ld %U8_920:U8 = %A32_919 0
conv %S32_921:S32 = %U8_920
and %S32_922:S32 = %S32_921 15
bne %S32_922 0 if_8_end
bra branch_14
.bbl branch_14
lea %A32_923:A32 = code
ld %U8_924:U8 = %A32_923 0
conv %S32_925:S32 = %U8_924
bne %S32_925 240 while_1
bra if_8_end
.bbl while_1
lea %A32_926:A32 = nj
mov %S32_927:S32 = 5
st %A32_926 0 = %S32_927
ret
.bbl while_1_cond
bne 0:S32 0 while_1
bra if_8_end
.bbl if_8_end
lea %A32_928:A32 = code
ld %U8_929:U8 = %A32_928 0
conv %S32_930:S32 = %U8_929
shr %S32_931:S32 = %S32_930 4
add %S32_932:S32 = %S32_931 1
add %S32_933:S32 = coef %S32_932
mov coef = %S32_933
blt 63:S32 coef while_2
bra if_10_end
.bbl while_2
lea %A32_934:A32 = nj
mov %S32_935:S32 = 5
st %A32_934 0 = %S32_935
ret
.bbl while_2_cond
bne 0:S32 0 while_2
bra if_10_end
.bbl if_10_end
lea %A32_936:A32 = nj
lea %A32_937:A32 = %A32_936 184
lea %A32_938:A32 = c 24
ld %S32_939:S32 = %A32_938 0
mul %S32_940:S32 = %S32_939 64
add %S32_941:S32 = coef %S32_940
lea %A32_942:A32 = %A32_937 %S32_941
ld %U8_943:U8 = %A32_942 0
conv %S32_944:S32 = %U8_943
mul %S32_945:S32 = value %S32_944
lea %A32_946:A32 = nj
lea %A32_947:A32 = %A32_946 524736
lea %A32_948:A32 = njZZ
lea %A32_949:A32 = %A32_948 coef
ld %S8_950:S8 = %A32_949 0
conv %S32_951:S32 = %S8_950
mul %S32_952:S32 = %S32_951 4
lea %A32_953:A32 = %A32_947 %S32_952
st %A32_953 0 = %S32_945
.bbl while_3_cond
blt coef 63 while_3
bra while_3_exit
.bbl while_3_exit
mov coef = 0
bra for_4_cond
.bbl for_4
lea %A32_954:A32 = nj
lea %A32_955:A32 = %A32_954 524736
mul %S32_956:S32 = coef 4
lea %A32_957:A32 = %A32_955 %S32_956
pusharg %A32_957
bsr njRowIDCT
.bbl for_4_next
add %S32_958:S32 = coef 8
mov coef = %S32_958
.bbl for_4_cond
blt coef 64 for_4
bra for_4_exit
.bbl for_4_exit
mov coef = 0
bra for_5_cond
.bbl for_5
lea %A32_959:A32 = nj
lea %A32_960:A32 = %A32_959 524736
mul %S32_961:S32 = coef 4
lea %A32_962:A32 = %A32_960 %S32_961
lea %A32_963:A32 = out coef
lea %A32_964:A32 = c 20
ld %S32_965:S32 = %A32_964 0
pusharg %S32_965
pusharg %A32_963
pusharg %A32_962
bsr njColIDCT
.bbl for_5_next
add %S32_966:S32 = coef 1
mov coef = %S32_966
.bbl for_5_cond
blt coef 8 for_5
bra for_5_exit
.bbl for_5_exit
ret
.fun njDecodeScan NORMAL [] = []
.bbl %start
.reg S32 [i]
.reg S32 [mbx]
.reg S32 [mby]
.reg S32 [sbx]
.reg S32 [sby]
.reg S32 [rstcount]
lea %A32_967:A32 = nj
lea %A32_968:A32 = %A32_967 524992
ld %S32_969:S32 = %A32_968 0
mov rstcount = %S32_969
.reg S32 [nextrst]
mov nextrst = 0
.reg A32 [c]
bsr __static_3_njDecodeLength
.bbl while_1
lea %A32_970:A32 = nj
lea %A32_971:A32 = %A32_970 0
ld %S32_972:S32 = %A32_971 0
bne %S32_972 0 if_15_true
bra while_1_cond
.bbl if_15_true
ret
.bbl while_1_cond
bne 0:S32 0 while_1
bra while_1_exit
.bbl while_1_exit
lea %A32_973:A32 = nj
lea %A32_974:A32 = %A32_973 12
ld %S32_975:S32 = %A32_974 0
conv %U32_976:U32 = %S32_975
lea %A32_977:A32 = nj
lea %A32_978:A32 = %A32_977 40
ld %U32_979:U32 = %A32_978 0
mul %U32_980:U32 = 2:U32 %U32_979
add %U32_981:U32 = 4:U32 %U32_980
blt %U32_976 %U32_981 while_2
bra if_18_end
.bbl while_2
lea %A32_982:A32 = nj
mov %S32_983:S32 = 5
st %A32_982 0 = %S32_983
ret
.bbl while_2_cond
bne 0:S32 0 while_2
bra if_18_end
.bbl if_18_end
lea %A32_984:A32 = nj
lea %A32_985:A32 = %A32_984 4
ld %A32_986:A32 = %A32_985 0
ld %U8_987:U8 = %A32_986 0
conv %U32_988:U32 = %U8_987
lea %A32_989:A32 = nj
lea %A32_990:A32 = %A32_989 40
ld %U32_991:U32 = %A32_990 0
bne %U32_988 %U32_991 while_3
bra if_20_end
.bbl while_3
lea %A32_992:A32 = nj
mov %S32_993:S32 = 2
st %A32_992 0 = %S32_993
ret
.bbl while_3_cond
bne 0:S32 0 while_3
bra if_20_end
.bbl if_20_end
mov %S32_994:S32 = 1
pusharg %S32_994
bsr __static_2_njSkip
mov i = 0
lea %A32_995:A32 = nj
lea %A32_996:A32 = %A32_995 44
mov c = %A32_996
bra for_9_cond
.bbl for_9
lea %A32_997:A32 = nj
lea %A32_998:A32 = %A32_997 4
ld %A32_999:A32 = %A32_998 0
ld %U8_1000:U8 = %A32_999 0
conv %S32_1001:S32 = %U8_1000
lea %A32_1002:A32 = c 0
ld %S32_1003:S32 = %A32_1002 0
bne %S32_1001 %S32_1003 while_4
bra if_22_end
.bbl while_4
lea %A32_1004:A32 = nj
mov %S32_1005:S32 = 5
st %A32_1004 0 = %S32_1005
ret
.bbl while_4_cond
bne 0:S32 0 while_4
bra if_22_end
.bbl if_22_end
lea %A32_1006:A32 = nj
lea %A32_1007:A32 = %A32_1006 4
ld %A32_1008:A32 = %A32_1007 0
lea %A32_1009:A32 = %A32_1008 1
ld %U8_1010:U8 = %A32_1009 0
conv %S32_1011:S32 = %U8_1010
and %S32_1012:S32 = %S32_1011 238
bne %S32_1012 0 while_5
bra if_24_end
.bbl while_5
lea %A32_1013:A32 = nj
mov %S32_1014:S32 = 5
st %A32_1013 0 = %S32_1014
ret
.bbl while_5_cond
bne 0:S32 0 while_5
bra if_24_end
.bbl if_24_end
lea %A32_1015:A32 = nj
lea %A32_1016:A32 = %A32_1015 4
ld %A32_1017:A32 = %A32_1016 0
lea %A32_1018:A32 = %A32_1017 1
ld %U8_1019:U8 = %A32_1018 0
conv %S32_1020:S32 = %U8_1019
shr %S32_1021:S32 = %S32_1020 4
lea %A32_1022:A32 = c 32
st %A32_1022 0 = %S32_1021
lea %A32_1023:A32 = nj
lea %A32_1024:A32 = %A32_1023 4
ld %A32_1025:A32 = %A32_1024 0
lea %A32_1026:A32 = %A32_1025 1
ld %U8_1027:U8 = %A32_1026 0
conv %S32_1028:S32 = %U8_1027
and %S32_1029:S32 = %S32_1028 1
or %S32_1030:S32 = %S32_1029 2
lea %A32_1031:A32 = c 28
st %A32_1031 0 = %S32_1030
mov %S32_1032:S32 = 2
pusharg %S32_1032
bsr __static_2_njSkip
.bbl for_9_next
add %S32_1033:S32 = i 1
mov i = %S32_1033
lea %A32_1034:A32 = c 44
mov c = %A32_1034
.bbl for_9_cond
conv %U32_1035:U32 = i
lea %A32_1036:A32 = nj
lea %A32_1037:A32 = %A32_1036 40
ld %U32_1038:U32 = %A32_1037 0
blt %U32_1035 %U32_1038 for_9
bra for_9_exit
.bbl for_9_exit
lea %A32_1039:A32 = nj
lea %A32_1040:A32 = %A32_1039 4
ld %A32_1041:A32 = %A32_1040 0
ld %U8_1042:U8 = %A32_1041 0
conv %S32_1043:S32 = %U8_1042
bne %S32_1043 0 while_6
bra branch_40
.bbl branch_40
lea %A32_1044:A32 = nj
lea %A32_1045:A32 = %A32_1044 4
ld %A32_1046:A32 = %A32_1045 0
lea %A32_1047:A32 = %A32_1046 1
ld %U8_1048:U8 = %A32_1047 0
conv %S32_1049:S32 = %U8_1048
bne %S32_1049 63 while_6
bra branch_39
.bbl branch_39
lea %A32_1050:A32 = nj
lea %A32_1051:A32 = %A32_1050 4
ld %A32_1052:A32 = %A32_1051 0
lea %A32_1053:A32 = %A32_1052 2
ld %U8_1054:U8 = %A32_1053 0
conv %S32_1055:S32 = %U8_1054
bne %S32_1055 0 while_6
bra if_27_end
.bbl while_6
lea %A32_1056:A32 = nj
mov %S32_1057:S32 = 2
st %A32_1056 0 = %S32_1057
ret
.bbl while_6_cond
bne 0:S32 0 while_6
bra if_27_end
.bbl if_27_end
lea %A32_1058:A32 = nj
lea %A32_1059:A32 = %A32_1058 12
ld %S32_1060:S32 = %A32_1059 0
pusharg %S32_1060
bsr __static_2_njSkip
mov mby = 0
mov mbx = 0
bra for_14_cond
.bbl for_14
mov i = 0
lea %A32_1061:A32 = nj
lea %A32_1062:A32 = %A32_1061 44
mov c = %A32_1062
bra for_12_cond
.bbl for_12
mov sby = 0
bra for_11_cond
.bbl for_11
mov sbx = 0
bra for_10_cond
.bbl for_10
lea %A32_1063:A32 = c 40
ld %A32_1064:A32 = %A32_1063 0
lea %A32_1065:A32 = c 8
ld %S32_1066:S32 = %A32_1065 0
mul %S32_1067:S32 = mby %S32_1066
add %S32_1068:S32 = %S32_1067 sby
lea %A32_1069:A32 = c 20
ld %S32_1070:S32 = %A32_1069 0
mul %S32_1071:S32 = %S32_1068 %S32_1070
lea %A32_1072:A32 = c 4
ld %S32_1073:S32 = %A32_1072 0
mul %S32_1074:S32 = mbx %S32_1073
add %S32_1075:S32 = %S32_1071 %S32_1074
add %S32_1076:S32 = %S32_1075 sbx
shl %S32_1077:S32 = %S32_1076 3
lea %A32_1078:A32 = %A32_1064 %S32_1077
pusharg %A32_1078
pusharg c
bsr njDecodeBlock
.bbl while_7
lea %A32_1079:A32 = nj
lea %A32_1080:A32 = %A32_1079 0
ld %S32_1081:S32 = %A32_1080 0
bne %S32_1081 0 if_28_true
bra while_7_cond
.bbl if_28_true
ret
.bbl while_7_cond
bne 0:S32 0 while_7
bra for_10_next
.bbl for_10_next
add %S32_1082:S32 = sbx 1
mov sbx = %S32_1082
.bbl for_10_cond
lea %A32_1083:A32 = c 4
ld %S32_1084:S32 = %A32_1083 0
blt sbx %S32_1084 for_10
bra for_11_next
.bbl for_11_next
add %S32_1085:S32 = sby 1
mov sby = %S32_1085
.bbl for_11_cond
lea %A32_1086:A32 = c 8
ld %S32_1087:S32 = %A32_1086 0
blt sby %S32_1087 for_11
bra for_12_next
.bbl for_12_next
add %S32_1088:S32 = i 1
mov i = %S32_1088
lea %A32_1089:A32 = c 44
mov c = %A32_1089
.bbl for_12_cond
conv %U32_1090:U32 = i
lea %A32_1091:A32 = nj
lea %A32_1092:A32 = %A32_1091 40
ld %U32_1093:U32 = %A32_1092 0
blt %U32_1090 %U32_1093 for_12
bra for_12_exit
.bbl for_12_exit
add %S32_1094:S32 = mbx 1
mov mbx = %S32_1094
lea %A32_1095:A32 = nj
lea %A32_1096:A32 = %A32_1095 24
ld %S32_1097:S32 = %A32_1096 0
ble %S32_1097 %S32_1094 if_34_true
bra if_34_end
.bbl if_34_true
mov mbx = 0
add %S32_1098:S32 = mby 1
mov mby = %S32_1098
lea %A32_1099:A32 = nj
lea %A32_1100:A32 = %A32_1099 28
ld %S32_1101:S32 = %A32_1100 0
ble %S32_1101 %S32_1098 for_14_exit
bra if_34_end
.bbl if_34_end
lea %A32_1102:A32 = nj
lea %A32_1103:A32 = %A32_1102 524992
ld %S32_1104:S32 = %A32_1103 0
bne %S32_1104 0 branch_41
bra for_14_cond
.bbl branch_41
sub %S32_1105:S32 = rstcount 1
mov rstcount = %S32_1105
bne %S32_1105 0 for_14_cond
bra if_38_true
.bbl if_38_true
bsr njByteAlign
mov %S32_1107:S32 = 16
pusharg %S32_1107
bsr njGetBits
poparg %S32_1106:S32
mov i = %S32_1106
and %S32_1108:S32 = i 65528
bne %S32_1108 65488 while_8
bra branch_42
.bbl branch_42
and %S32_1109:S32 = i 7
bne %S32_1109 nextrst while_8
bra if_36_end
.bbl while_8
lea %A32_1110:A32 = nj
mov %S32_1111:S32 = 5
st %A32_1110 0 = %S32_1111
ret
.bbl while_8_cond
bne 0:S32 0 while_8
bra if_36_end
.bbl if_36_end
add %S32_1112:S32 = nextrst 1
and %S32_1113:S32 = %S32_1112 7
mov nextrst = %S32_1113
lea %A32_1114:A32 = nj
lea %A32_1115:A32 = %A32_1114 524992
ld %S32_1116:S32 = %A32_1115 0
mov rstcount = %S32_1116
mov i = 0
bra for_13_cond
.bbl for_13
lea %A32_1117:A32 = nj
lea %A32_1118:A32 = %A32_1117 44
mul %S32_1119:S32 = i 44
lea %A32_1120:A32 = %A32_1118 %S32_1119
lea %A32_1121:A32 = %A32_1120 36
mov %S32_1122:S32 = 0
st %A32_1121 0 = %S32_1122
.bbl for_13_next
add %S32_1123:S32 = i 1
mov i = %S32_1123
.bbl for_13_cond
blt i 3 for_13
bra for_14_cond
.bbl for_14_cond
bra for_14
.bbl for_14_exit
lea %A32_1124:A32 = nj
mov %S32_1125:S32 = 6
st %A32_1124 0 = %S32_1125
ret
.fun njUpsampleH NORMAL [] = [A32]
.bbl %start
poparg c:A32
.reg S32 [xmax]
lea %A32_1126:A32 = c 12
ld %S32_1127:S32 = %A32_1126 0
sub %S32_1128:S32 = %S32_1127 3
mov xmax = %S32_1128
.reg A32 [out]
.reg A32 [lin]
.reg A32 [lout]
.reg S32 [x]
.reg S32 [y]
lea %A32_1129:A32 = c 12
ld %S32_1130:S32 = %A32_1129 0
lea %A32_1131:A32 = c 16
ld %S32_1132:S32 = %A32_1131 0
mul %S32_1133:S32 = %S32_1130 %S32_1132
shl %S32_1134:S32 = %S32_1133 1
conv %U32_1135:U32 = %S32_1134
pusharg %U32_1135
bsr malloc
poparg %A32_1136:A32
mov out = %A32_1136
bne out 0 if_5_end
bra while_1
.bbl while_1
lea %A32_1137:A32 = nj
mov %S32_1138:S32 = 3
st %A32_1137 0 = %S32_1138
ret
.bbl while_1_cond
bne 0:S32 0 while_1
bra if_5_end
.bbl if_5_end
lea %A32_1139:A32 = c 40
ld %A32_1140:A32 = %A32_1139 0
mov lin = %A32_1140
mov lout = out
lea %A32_1141:A32 = c 16
ld %S32_1142:S32 = %A32_1141 0
mov y = %S32_1142
bra for_3_cond
.bbl for_3
ld %U8_1143:U8 = lin 0
conv %S32_1144:S32 = %U8_1143
mul %S32_1145:S32 = 139:S32 %S32_1144
lea %A32_1146:A32 = lin 1
ld %U8_1147:U8 = %A32_1146 0
conv %S32_1148:S32 = %U8_1147
mul %S32_1149:S32 = -11:S32 %S32_1148
add %S32_1150:S32 = %S32_1145 %S32_1149
add %S32_1151:S32 = %S32_1150 64
shr %S32_1152:S32 = %S32_1151 7
pusharg %S32_1152
bsr njClip
poparg %U8_1153:U8
st lout 0 = %U8_1153
ld %U8_1154:U8 = lin 0
conv %S32_1155:S32 = %U8_1154
mul %S32_1156:S32 = 104:S32 %S32_1155
lea %A32_1157:A32 = lin 1
ld %U8_1158:U8 = %A32_1157 0
conv %S32_1159:S32 = %U8_1158
mul %S32_1160:S32 = 27:S32 %S32_1159
add %S32_1161:S32 = %S32_1156 %S32_1160
lea %A32_1162:A32 = lin 2
ld %U8_1163:U8 = %A32_1162 0
conv %S32_1164:S32 = %U8_1163
mul %S32_1165:S32 = -3:S32 %S32_1164
add %S32_1166:S32 = %S32_1161 %S32_1165
add %S32_1167:S32 = %S32_1166 64
shr %S32_1168:S32 = %S32_1167 7
pusharg %S32_1168
bsr njClip
poparg %U8_1169:U8
lea %A32_1170:A32 = lout 1
st %A32_1170 0 = %U8_1169
ld %U8_1171:U8 = lin 0
conv %S32_1172:S32 = %U8_1171
mul %S32_1173:S32 = 28:S32 %S32_1172
lea %A32_1174:A32 = lin 1
ld %U8_1175:U8 = %A32_1174 0
conv %S32_1176:S32 = %U8_1175
mul %S32_1177:S32 = 109:S32 %S32_1176
add %S32_1178:S32 = %S32_1173 %S32_1177
lea %A32_1179:A32 = lin 2
ld %U8_1180:U8 = %A32_1179 0
conv %S32_1181:S32 = %U8_1180
mul %S32_1182:S32 = -9:S32 %S32_1181
add %S32_1183:S32 = %S32_1178 %S32_1182
add %S32_1184:S32 = %S32_1183 64
shr %S32_1185:S32 = %S32_1184 7
pusharg %S32_1185
bsr njClip
poparg %U8_1186:U8
lea %A32_1187:A32 = lout 2
st %A32_1187 0 = %U8_1186
mov x = 0
bra for_2_cond
.bbl for_2
lea %A32_1188:A32 = lin x
ld %U8_1189:U8 = %A32_1188 0
conv %S32_1190:S32 = %U8_1189
mul %S32_1191:S32 = -9:S32 %S32_1190
add %S32_1192:S32 = x 1
lea %A32_1193:A32 = lin %S32_1192
ld %U8_1194:U8 = %A32_1193 0
conv %S32_1195:S32 = %U8_1194
mul %S32_1196:S32 = 111:S32 %S32_1195
add %S32_1197:S32 = %S32_1191 %S32_1196
add %S32_1198:S32 = x 2
lea %A32_1199:A32 = lin %S32_1198
ld %U8_1200:U8 = %A32_1199 0
conv %S32_1201:S32 = %U8_1200
mul %S32_1202:S32 = 29:S32 %S32_1201
add %S32_1203:S32 = %S32_1197 %S32_1202
add %S32_1204:S32 = x 3
lea %A32_1205:A32 = lin %S32_1204
ld %U8_1206:U8 = %A32_1205 0
conv %S32_1207:S32 = %U8_1206
mul %S32_1208:S32 = -3:S32 %S32_1207
add %S32_1209:S32 = %S32_1203 %S32_1208
add %S32_1210:S32 = %S32_1209 64
shr %S32_1211:S32 = %S32_1210 7
pusharg %S32_1211
bsr njClip
poparg %U8_1212:U8
shl %S32_1213:S32 = x 1
add %S32_1214:S32 = %S32_1213 3
lea %A32_1215:A32 = lout %S32_1214
st %A32_1215 0 = %U8_1212
lea %A32_1216:A32 = lin x
ld %U8_1217:U8 = %A32_1216 0
conv %S32_1218:S32 = %U8_1217
mul %S32_1219:S32 = -3:S32 %S32_1218
add %S32_1220:S32 = x 1
lea %A32_1221:A32 = lin %S32_1220
ld %U8_1222:U8 = %A32_1221 0
conv %S32_1223:S32 = %U8_1222
mul %S32_1224:S32 = 29:S32 %S32_1223
add %S32_1225:S32 = %S32_1219 %S32_1224
add %S32_1226:S32 = x 2
lea %A32_1227:A32 = lin %S32_1226
ld %U8_1228:U8 = %A32_1227 0
conv %S32_1229:S32 = %U8_1228
mul %S32_1230:S32 = 111:S32 %S32_1229
add %S32_1231:S32 = %S32_1225 %S32_1230
add %S32_1232:S32 = x 3
lea %A32_1233:A32 = lin %S32_1232
ld %U8_1234:U8 = %A32_1233 0
conv %S32_1235:S32 = %U8_1234
mul %S32_1236:S32 = -9:S32 %S32_1235
add %S32_1237:S32 = %S32_1231 %S32_1236
add %S32_1238:S32 = %S32_1237 64
shr %S32_1239:S32 = %S32_1238 7
pusharg %S32_1239
bsr njClip
poparg %U8_1240:U8
shl %S32_1241:S32 = x 1
add %S32_1242:S32 = %S32_1241 4
lea %A32_1243:A32 = lout %S32_1242
st %A32_1243 0 = %U8_1240
.bbl for_2_next
add %S32_1244:S32 = x 1
mov x = %S32_1244
.bbl for_2_cond
blt x xmax for_2
bra for_2_exit
.bbl for_2_exit
lea %A32_1245:A32 = c 20
ld %S32_1246:S32 = %A32_1245 0
lea %A32_1247:A32 = lin %S32_1246
mov lin = %A32_1247
lea %A32_1248:A32 = c 12
ld %S32_1249:S32 = %A32_1248 0
shl %S32_1250:S32 = %S32_1249 1
lea %A32_1251:A32 = lout %S32_1250
mov lout = %A32_1251
lea %A32_1252:A32 = lin -1
ld %U8_1253:U8 = %A32_1252 0
conv %S32_1254:S32 = %U8_1253
mul %S32_1255:S32 = 28:S32 %S32_1254
lea %A32_1256:A32 = lin -2
ld %U8_1257:U8 = %A32_1256 0
conv %S32_1258:S32 = %U8_1257
mul %S32_1259:S32 = 109:S32 %S32_1258
add %S32_1260:S32 = %S32_1255 %S32_1259
lea %A32_1261:A32 = lin -3
ld %U8_1262:U8 = %A32_1261 0
conv %S32_1263:S32 = %U8_1262
mul %S32_1264:S32 = -9:S32 %S32_1263
add %S32_1265:S32 = %S32_1260 %S32_1264
add %S32_1266:S32 = %S32_1265 64
shr %S32_1267:S32 = %S32_1266 7
pusharg %S32_1267
bsr njClip
poparg %U8_1268:U8
lea %A32_1269:A32 = lout -3
st %A32_1269 0 = %U8_1268
lea %A32_1270:A32 = lin -1
ld %U8_1271:U8 = %A32_1270 0
conv %S32_1272:S32 = %U8_1271
mul %S32_1273:S32 = 104:S32 %S32_1272
lea %A32_1274:A32 = lin -2
ld %U8_1275:U8 = %A32_1274 0
conv %S32_1276:S32 = %U8_1275
mul %S32_1277:S32 = 27:S32 %S32_1276
add %S32_1278:S32 = %S32_1273 %S32_1277
lea %A32_1279:A32 = lin -3
ld %U8_1280:U8 = %A32_1279 0
conv %S32_1281:S32 = %U8_1280
mul %S32_1282:S32 = -3:S32 %S32_1281
add %S32_1283:S32 = %S32_1278 %S32_1282
add %S32_1284:S32 = %S32_1283 64
shr %S32_1285:S32 = %S32_1284 7
pusharg %S32_1285
bsr njClip
poparg %U8_1286:U8
lea %A32_1287:A32 = lout -2
st %A32_1287 0 = %U8_1286
lea %A32_1288:A32 = lin -1
ld %U8_1289:U8 = %A32_1288 0
conv %S32_1290:S32 = %U8_1289
mul %S32_1291:S32 = 139:S32 %S32_1290
lea %A32_1292:A32 = lin -2
ld %U8_1293:U8 = %A32_1292 0
conv %S32_1294:S32 = %U8_1293
mul %S32_1295:S32 = -11:S32 %S32_1294
add %S32_1296:S32 = %S32_1291 %S32_1295
add %S32_1297:S32 = %S32_1296 64
shr %S32_1298:S32 = %S32_1297 7
pusharg %S32_1298
bsr njClip
poparg %U8_1299:U8
lea %A32_1300:A32 = lout -1
st %A32_1300 0 = %U8_1299
.bbl for_3_next
sub %S32_1301:S32 = y 1
mov y = %S32_1301
.bbl for_3_cond
bne y 0 for_3
bra for_3_exit
.bbl for_3_exit
lea %A32_1302:A32 = c 12
ld %S32_1303:S32 = %A32_1302 0
shl %S32_1304:S32 = %S32_1303 1
lea %A32_1305:A32 = c 12
st %A32_1305 0 = %S32_1304
lea %A32_1306:A32 = c 12
ld %S32_1307:S32 = %A32_1306 0
lea %A32_1308:A32 = c 20
st %A32_1308 0 = %S32_1307
lea %A32_1309:A32 = c 40
ld %A32_1310:A32 = %A32_1309 0
pusharg %A32_1310
bsr free
lea %A32_1311:A32 = c 40
st %A32_1311 0 = out
ret
.fun njUpsampleV NORMAL [] = [A32]
.bbl %start
poparg c:A32
.reg S32 [w]
lea %A32_1312:A32 = c 12
ld %S32_1313:S32 = %A32_1312 0
mov w = %S32_1313
.reg S32 [s1]
lea %A32_1314:A32 = c 20
ld %S32_1315:S32 = %A32_1314 0
mov s1 = %S32_1315
.reg S32 [s2]
add %S32_1316:S32 = s1 s1
mov s2 = %S32_1316
.reg A32 [out]
.reg A32 [cin]
.reg A32 [cout]
.reg S32 [x]
.reg S32 [y]
lea %A32_1317:A32 = c 12
ld %S32_1318:S32 = %A32_1317 0
lea %A32_1319:A32 = c 16
ld %S32_1320:S32 = %A32_1319 0
mul %S32_1321:S32 = %S32_1318 %S32_1320
shl %S32_1322:S32 = %S32_1321 1
conv %U32_1323:U32 = %S32_1322
pusharg %U32_1323
bsr malloc
poparg %A32_1324:A32
mov out = %A32_1324
bne out 0 if_5_end
bra while_1
.bbl while_1
lea %A32_1325:A32 = nj
mov %S32_1326:S32 = 3
st %A32_1325 0 = %S32_1326
ret
.bbl while_1_cond
bne 0:S32 0 while_1
bra if_5_end
.bbl if_5_end
mov x = 0
bra for_3_cond
.bbl for_3
lea %A32_1327:A32 = c 40
ld %A32_1328:A32 = %A32_1327 0
lea %A32_1329:A32 = %A32_1328 x
mov cin = %A32_1329
lea %A32_1330:A32 = out x
mov cout = %A32_1330
ld %U8_1331:U8 = cin 0
conv %S32_1332:S32 = %U8_1331
mul %S32_1333:S32 = 139:S32 %S32_1332
lea %A32_1334:A32 = cin s1
ld %U8_1335:U8 = %A32_1334 0
conv %S32_1336:S32 = %U8_1335
mul %S32_1337:S32 = -11:S32 %S32_1336
add %S32_1338:S32 = %S32_1333 %S32_1337
add %S32_1339:S32 = %S32_1338 64
shr %S32_1340:S32 = %S32_1339 7
pusharg %S32_1340
bsr njClip
poparg %U8_1341:U8
st cout 0 = %U8_1341
lea %A32_1342:A32 = cout w
mov cout = %A32_1342
ld %U8_1343:U8 = cin 0
conv %S32_1344:S32 = %U8_1343
mul %S32_1345:S32 = 104:S32 %S32_1344
lea %A32_1346:A32 = cin s1
ld %U8_1347:U8 = %A32_1346 0
conv %S32_1348:S32 = %U8_1347
mul %S32_1349:S32 = 27:S32 %S32_1348
add %S32_1350:S32 = %S32_1345 %S32_1349
lea %A32_1351:A32 = cin s2
ld %U8_1352:U8 = %A32_1351 0
conv %S32_1353:S32 = %U8_1352
mul %S32_1354:S32 = -3:S32 %S32_1353
add %S32_1355:S32 = %S32_1350 %S32_1354
add %S32_1356:S32 = %S32_1355 64
shr %S32_1357:S32 = %S32_1356 7
pusharg %S32_1357
bsr njClip
poparg %U8_1358:U8
st cout 0 = %U8_1358
lea %A32_1359:A32 = cout w
mov cout = %A32_1359
ld %U8_1360:U8 = cin 0
conv %S32_1361:S32 = %U8_1360
mul %S32_1362:S32 = 28:S32 %S32_1361
lea %A32_1363:A32 = cin s1
ld %U8_1364:U8 = %A32_1363 0
conv %S32_1365:S32 = %U8_1364
mul %S32_1366:S32 = 109:S32 %S32_1365
add %S32_1367:S32 = %S32_1362 %S32_1366
lea %A32_1368:A32 = cin s2
ld %U8_1369:U8 = %A32_1368 0
conv %S32_1370:S32 = %U8_1369
mul %S32_1371:S32 = -9:S32 %S32_1370
add %S32_1372:S32 = %S32_1367 %S32_1371
add %S32_1373:S32 = %S32_1372 64
shr %S32_1374:S32 = %S32_1373 7
pusharg %S32_1374
bsr njClip
poparg %U8_1375:U8
st cout 0 = %U8_1375
lea %A32_1376:A32 = cout w
mov cout = %A32_1376
lea %A32_1377:A32 = cin s1
mov cin = %A32_1377
lea %A32_1378:A32 = c 16
ld %S32_1379:S32 = %A32_1378 0
sub %S32_1380:S32 = %S32_1379 3
mov y = %S32_1380
bra for_2_cond
.bbl for_2
sub %S32_1381:S32 = 0 s1
lea %A32_1382:A32 = cin %S32_1381
ld %U8_1383:U8 = %A32_1382 0
conv %S32_1384:S32 = %U8_1383
mul %S32_1385:S32 = -9:S32 %S32_1384
ld %U8_1386:U8 = cin 0
conv %S32_1387:S32 = %U8_1386
mul %S32_1388:S32 = 111:S32 %S32_1387
add %S32_1389:S32 = %S32_1385 %S32_1388
lea %A32_1390:A32 = cin s1
ld %U8_1391:U8 = %A32_1390 0
conv %S32_1392:S32 = %U8_1391
mul %S32_1393:S32 = 29:S32 %S32_1392
add %S32_1394:S32 = %S32_1389 %S32_1393
lea %A32_1395:A32 = cin s2
ld %U8_1396:U8 = %A32_1395 0
conv %S32_1397:S32 = %U8_1396
mul %S32_1398:S32 = -3:S32 %S32_1397
add %S32_1399:S32 = %S32_1394 %S32_1398
add %S32_1400:S32 = %S32_1399 64
shr %S32_1401:S32 = %S32_1400 7
pusharg %S32_1401
bsr njClip
poparg %U8_1402:U8
st cout 0 = %U8_1402
lea %A32_1403:A32 = cout w
mov cout = %A32_1403
sub %S32_1404:S32 = 0 s1
lea %A32_1405:A32 = cin %S32_1404
ld %U8_1406:U8 = %A32_1405 0
conv %S32_1407:S32 = %U8_1406
mul %S32_1408:S32 = -3:S32 %S32_1407
ld %U8_1409:U8 = cin 0
conv %S32_1410:S32 = %U8_1409
mul %S32_1411:S32 = 29:S32 %S32_1410
add %S32_1412:S32 = %S32_1408 %S32_1411
lea %A32_1413:A32 = cin s1
ld %U8_1414:U8 = %A32_1413 0
conv %S32_1415:S32 = %U8_1414
mul %S32_1416:S32 = 111:S32 %S32_1415
add %S32_1417:S32 = %S32_1412 %S32_1416
lea %A32_1418:A32 = cin s2
ld %U8_1419:U8 = %A32_1418 0
conv %S32_1420:S32 = %U8_1419
mul %S32_1421:S32 = -9:S32 %S32_1420
add %S32_1422:S32 = %S32_1417 %S32_1421
add %S32_1423:S32 = %S32_1422 64
shr %S32_1424:S32 = %S32_1423 7
pusharg %S32_1424
bsr njClip
poparg %U8_1425:U8
st cout 0 = %U8_1425
lea %A32_1426:A32 = cout w
mov cout = %A32_1426
lea %A32_1427:A32 = cin s1
mov cin = %A32_1427
.bbl for_2_next
sub %S32_1428:S32 = y 1
mov y = %S32_1428
.bbl for_2_cond
bne y 0 for_2
bra for_2_exit
.bbl for_2_exit
lea %A32_1429:A32 = cin s1
mov cin = %A32_1429
ld %U8_1430:U8 = cin 0
conv %S32_1431:S32 = %U8_1430
mul %S32_1432:S32 = 28:S32 %S32_1431
sub %S32_1433:S32 = 0 s1
lea %A32_1434:A32 = cin %S32_1433
ld %U8_1435:U8 = %A32_1434 0
conv %S32_1436:S32 = %U8_1435
mul %S32_1437:S32 = 109:S32 %S32_1436
add %S32_1438:S32 = %S32_1432 %S32_1437
sub %S32_1439:S32 = 0 s2
lea %A32_1440:A32 = cin %S32_1439
ld %U8_1441:U8 = %A32_1440 0
conv %S32_1442:S32 = %U8_1441
mul %S32_1443:S32 = -9:S32 %S32_1442
add %S32_1444:S32 = %S32_1438 %S32_1443
add %S32_1445:S32 = %S32_1444 64
shr %S32_1446:S32 = %S32_1445 7
pusharg %S32_1446
bsr njClip
poparg %U8_1447:U8
st cout 0 = %U8_1447
lea %A32_1448:A32 = cout w
mov cout = %A32_1448
ld %U8_1449:U8 = cin 0
conv %S32_1450:S32 = %U8_1449
mul %S32_1451:S32 = 104:S32 %S32_1450
sub %S32_1452:S32 = 0 s1
lea %A32_1453:A32 = cin %S32_1452
ld %U8_1454:U8 = %A32_1453 0
conv %S32_1455:S32 = %U8_1454
mul %S32_1456:S32 = 27:S32 %S32_1455
add %S32_1457:S32 = %S32_1451 %S32_1456
sub %S32_1458:S32 = 0 s2
lea %A32_1459:A32 = cin %S32_1458
ld %U8_1460:U8 = %A32_1459 0
conv %S32_1461:S32 = %U8_1460
mul %S32_1462:S32 = -3:S32 %S32_1461
add %S32_1463:S32 = %S32_1457 %S32_1462
add %S32_1464:S32 = %S32_1463 64
shr %S32_1465:S32 = %S32_1464 7
pusharg %S32_1465
bsr njClip
poparg %U8_1466:U8
st cout 0 = %U8_1466
lea %A32_1467:A32 = cout w
mov cout = %A32_1467
ld %U8_1468:U8 = cin 0
conv %S32_1469:S32 = %U8_1468
mul %S32_1470:S32 = 139:S32 %S32_1469
sub %S32_1471:S32 = 0 s1
lea %A32_1472:A32 = cin %S32_1471
ld %U8_1473:U8 = %A32_1472 0
conv %S32_1474:S32 = %U8_1473
mul %S32_1475:S32 = -11:S32 %S32_1474
add %S32_1476:S32 = %S32_1470 %S32_1475
add %S32_1477:S32 = %S32_1476 64
shr %S32_1478:S32 = %S32_1477 7
pusharg %S32_1478
bsr njClip
poparg %U8_1479:U8
st cout 0 = %U8_1479
.bbl for_3_next
add %S32_1480:S32 = x 1
mov x = %S32_1480
.bbl for_3_cond
blt x w for_3
bra for_3_exit
.bbl for_3_exit
lea %A32_1481:A32 = c 16
ld %S32_1482:S32 = %A32_1481 0
shl %S32_1483:S32 = %S32_1482 1
lea %A32_1484:A32 = c 16
st %A32_1484 0 = %S32_1483
lea %A32_1485:A32 = c 12
ld %S32_1486:S32 = %A32_1485 0
lea %A32_1487:A32 = c 20
st %A32_1487 0 = %S32_1486
lea %A32_1488:A32 = c 40
ld %A32_1489:A32 = %A32_1488 0
pusharg %A32_1489
bsr free
lea %A32_1490:A32 = c 40
st %A32_1490 0 = out
ret
.fun njConvert NORMAL [] = []
.bbl %start
.reg S32 [i]
.reg A32 [c]
mov i = 0
lea %A32_1491:A32 = nj
lea %A32_1492:A32 = %A32_1491 44
mov c = %A32_1492
bra for_5_cond
.bbl for_5
bra while_3_cond
.bbl while_3
lea %A32_1493:A32 = c 12
ld %S32_1494:S32 = %A32_1493 0
lea %A32_1495:A32 = nj
lea %A32_1496:A32 = %A32_1495 16
ld %S32_1497:S32 = %A32_1496 0
blt %S32_1494 %S32_1497 if_9_true
bra while_1
.bbl if_9_true
pusharg c
bsr njUpsampleH
.bbl while_1
lea %A32_1498:A32 = nj
lea %A32_1499:A32 = %A32_1498 0
ld %S32_1500:S32 = %A32_1499 0
bne %S32_1500 0 if_10_true
bra while_1_cond
.bbl if_10_true
ret
.bbl while_1_cond
bne 0:S32 0 while_1
bra while_1_exit
.bbl while_1_exit
lea %A32_1501:A32 = c 16
ld %S32_1502:S32 = %A32_1501 0
lea %A32_1503:A32 = nj
lea %A32_1504:A32 = %A32_1503 20
ld %S32_1505:S32 = %A32_1504 0
blt %S32_1502 %S32_1505 if_12_true
bra while_2
.bbl if_12_true
pusharg c
bsr njUpsampleV
.bbl while_2
lea %A32_1506:A32 = nj
lea %A32_1507:A32 = %A32_1506 0
ld %S32_1508:S32 = %A32_1507 0
bne %S32_1508 0 if_13_true
bra while_2_cond
.bbl if_13_true
ret
.bbl while_2_cond
bne 0:S32 0 while_2
bra while_3_cond
.bbl while_3_cond
lea %A32_1509:A32 = c 12
ld %S32_1510:S32 = %A32_1509 0
lea %A32_1511:A32 = nj
lea %A32_1512:A32 = %A32_1511 16
ld %S32_1513:S32 = %A32_1512 0
blt %S32_1510 %S32_1513 while_3
bra branch_24
.bbl branch_24
lea %A32_1514:A32 = c 16
ld %S32_1515:S32 = %A32_1514 0
lea %A32_1516:A32 = nj
lea %A32_1517:A32 = %A32_1516 20
ld %S32_1518:S32 = %A32_1517 0
blt %S32_1515 %S32_1518 while_3
bra while_3_exit
.bbl while_3_exit
lea %A32_1519:A32 = c 12
ld %S32_1520:S32 = %A32_1519 0
lea %A32_1521:A32 = nj
lea %A32_1522:A32 = %A32_1521 16
ld %S32_1523:S32 = %A32_1522 0
blt %S32_1520 %S32_1523 while_4
bra branch_25
.bbl branch_25
lea %A32_1524:A32 = c 16
ld %S32_1525:S32 = %A32_1524 0
lea %A32_1526:A32 = nj
lea %A32_1527:A32 = %A32_1526 20
ld %S32_1528:S32 = %A32_1527 0
blt %S32_1525 %S32_1528 while_4
bra for_5_next
.bbl while_4
lea %A32_1529:A32 = nj
mov %S32_1530:S32 = 4
st %A32_1529 0 = %S32_1530
ret
.bbl while_4_cond
bne 0:S32 0 while_4
bra for_5_next
.bbl for_5_next
add %S32_1531:S32 = i 1
mov i = %S32_1531
lea %A32_1532:A32 = c 44
mov c = %A32_1532
.bbl for_5_cond
conv %U32_1533:U32 = i
lea %A32_1534:A32 = nj
lea %A32_1535:A32 = %A32_1534 40
ld %U32_1536:U32 = %A32_1535 0
blt %U32_1533 %U32_1536 for_5
bra for_5_exit
.bbl for_5_exit
lea %A32_1537:A32 = nj
lea %A32_1538:A32 = %A32_1537 40
ld %U32_1539:U32 = %A32_1538 0
beq %U32_1539 3 if_23_true
bra if_23_false
.bbl if_23_true
.reg S32 [x]
.reg S32 [yy]
.reg A32 [prgb]
lea %A32_1540:A32 = nj
lea %A32_1541:A32 = %A32_1540 524996
ld %A32_1542:A32 = %A32_1541 0
mov prgb = %A32_1542
.reg A32 [py]
lea %A32_1543:A32 = nj
lea %A32_1544:A32 = %A32_1543 44
lea %A32_1545:A32 = %A32_1544 40
ld %A32_1546:A32 = %A32_1545 0
mov py = %A32_1546
.reg A32 [pcb]
lea %A32_1547:A32 = nj
lea %A32_1548:A32 = %A32_1547 44
lea %A32_1549:A32 = %A32_1548 44
lea %A32_1550:A32 = %A32_1549 40
ld %A32_1551:A32 = %A32_1550 0
mov pcb = %A32_1551
.reg A32 [pcr]
lea %A32_1552:A32 = nj
lea %A32_1553:A32 = %A32_1552 44
lea %A32_1554:A32 = %A32_1553 88
lea %A32_1555:A32 = %A32_1554 40
ld %A32_1556:A32 = %A32_1555 0
mov pcr = %A32_1556
lea %A32_1557:A32 = nj
lea %A32_1558:A32 = %A32_1557 20
ld %S32_1559:S32 = %A32_1558 0
mov yy = %S32_1559
bra for_7_cond
.bbl for_7
mov x = 0
bra for_6_cond
.bbl for_6
.reg S32 [y]
lea %A32_1560:A32 = py x
ld %U8_1561:U8 = %A32_1560 0
conv %S32_1562:S32 = %U8_1561
shl %S32_1563:S32 = %S32_1562 8
mov y = %S32_1563
.reg S32 [cb]
lea %A32_1564:A32 = pcb x
ld %U8_1565:U8 = %A32_1564 0
conv %S32_1566:S32 = %U8_1565
sub %S32_1567:S32 = %S32_1566 128
mov cb = %S32_1567
.reg S32 [cr]
lea %A32_1568:A32 = pcr x
ld %U8_1569:U8 = %A32_1568 0
conv %S32_1570:S32 = %U8_1569
sub %S32_1571:S32 = %S32_1570 128
mov cr = %S32_1571
mul %S32_1572:S32 = 359:S32 cr
add %S32_1573:S32 = y %S32_1572
add %S32_1574:S32 = %S32_1573 128
shr %S32_1575:S32 = %S32_1574 8
pusharg %S32_1575
bsr njClip
poparg %U8_1576:U8
st prgb 0 = %U8_1576
mul %S32_1577:S32 = 88:S32 cb
sub %S32_1578:S32 = y %S32_1577
mul %S32_1579:S32 = 183:S32 cr
sub %S32_1580:S32 = %S32_1578 %S32_1579
add %S32_1581:S32 = %S32_1580 128
shr %S32_1582:S32 = %S32_1581 8
pusharg %S32_1582
bsr njClip
poparg %U8_1583:U8
lea %A32_1584:A32 = prgb 1
st %A32_1584 0 = %U8_1583
mul %S32_1585:S32 = 454:S32 cb
add %S32_1586:S32 = y %S32_1585
add %S32_1587:S32 = %S32_1586 128
shr %S32_1588:S32 = %S32_1587 8
pusharg %S32_1588
bsr njClip
poparg %U8_1589:U8
lea %A32_1590:A32 = prgb 2
st %A32_1590 0 = %U8_1589
lea %A32_1591:A32 = prgb 3
mov prgb = %A32_1591
.bbl for_6_next
add %S32_1592:S32 = x 1
mov x = %S32_1592
.bbl for_6_cond
lea %A32_1593:A32 = nj
lea %A32_1594:A32 = %A32_1593 16
ld %S32_1595:S32 = %A32_1594 0
blt x %S32_1595 for_6
bra for_6_exit
.bbl for_6_exit
lea %A32_1596:A32 = nj
lea %A32_1597:A32 = %A32_1596 44
lea %A32_1598:A32 = %A32_1597 20
ld %S32_1599:S32 = %A32_1598 0
lea %A32_1600:A32 = py %S32_1599
mov py = %A32_1600
lea %A32_1601:A32 = nj
lea %A32_1602:A32 = %A32_1601 44
lea %A32_1603:A32 = %A32_1602 44
lea %A32_1604:A32 = %A32_1603 20
ld %S32_1605:S32 = %A32_1604 0
lea %A32_1606:A32 = pcb %S32_1605
mov pcb = %A32_1606
lea %A32_1607:A32 = nj
lea %A32_1608:A32 = %A32_1607 44
lea %A32_1609:A32 = %A32_1608 88
lea %A32_1610:A32 = %A32_1609 20
ld %S32_1611:S32 = %A32_1610 0
lea %A32_1612:A32 = pcr %S32_1611
mov pcr = %A32_1612
.bbl for_7_next
sub %S32_1613:S32 = yy 1
mov yy = %S32_1613
.bbl for_7_cond
bne yy 0 for_7
bra for_7_exit
.bbl for_7_exit
bra if_23_end
.bbl if_23_false
lea %A32_1614:A32 = nj
lea %A32_1615:A32 = %A32_1614 44
lea %A32_1616:A32 = %A32_1615 12
ld %S32_1617:S32 = %A32_1616 0
lea %A32_1618:A32 = nj
lea %A32_1619:A32 = %A32_1618 44
lea %A32_1620:A32 = %A32_1619 20
ld %S32_1621:S32 = %A32_1620 0
bne %S32_1617 %S32_1621 if_22_true
bra if_23_end
.bbl if_22_true
.reg A32 [pin]
lea %A32_1622:A32 = nj
lea %A32_1623:A32 = %A32_1622 44
lea %A32_1624:A32 = %A32_1623 40
ld %A32_1625:A32 = %A32_1624 0
lea %A32_1626:A32 = nj
lea %A32_1627:A32 = %A32_1626 44
lea %A32_1628:A32 = %A32_1627 20
ld %S32_1629:S32 = %A32_1628 0
lea %A32_1630:A32 = %A32_1625 %S32_1629
mov pin = %A32_1630
.reg A32 [pout]
lea %A32_1631:A32 = nj
lea %A32_1632:A32 = %A32_1631 44
lea %A32_1633:A32 = %A32_1632 40
ld %A32_1634:A32 = %A32_1633 0
lea %A32_1635:A32 = nj
lea %A32_1636:A32 = %A32_1635 44
lea %A32_1637:A32 = %A32_1636 12
ld %S32_1638:S32 = %A32_1637 0
lea %A32_1639:A32 = %A32_1634 %S32_1638
mov pout = %A32_1639
.reg S32 [__local_26_y]
lea %A32_1640:A32 = nj
lea %A32_1641:A32 = %A32_1640 44
lea %A32_1642:A32 = %A32_1641 16
ld %S32_1643:S32 = %A32_1642 0
sub %S32_1644:S32 = %S32_1643 1
mov __local_26_y = %S32_1644
bra for_8_cond
.bbl for_8
lea %A32_1645:A32 = nj
lea %A32_1646:A32 = %A32_1645 44
lea %A32_1647:A32 = %A32_1646 12
ld %S32_1648:S32 = %A32_1647 0
conv %U32_1649:U32 = %S32_1648
pusharg %U32_1649
pusharg pin
pusharg pout
bsr mymemcpy
lea %A32_1650:A32 = nj
lea %A32_1651:A32 = %A32_1650 44
lea %A32_1652:A32 = %A32_1651 20
ld %S32_1653:S32 = %A32_1652 0
lea %A32_1654:A32 = pin %S32_1653
mov pin = %A32_1654
lea %A32_1655:A32 = nj
lea %A32_1656:A32 = %A32_1655 44
lea %A32_1657:A32 = %A32_1656 12
ld %S32_1658:S32 = %A32_1657 0
lea %A32_1659:A32 = pout %S32_1658
mov pout = %A32_1659
.bbl for_8_next
sub %S32_1660:S32 = __local_26_y 1
mov __local_26_y = %S32_1660
.bbl for_8_cond
bne __local_26_y 0 for_8
bra for_8_exit
.bbl for_8_exit
lea %A32_1661:A32 = nj
lea %A32_1662:A32 = %A32_1661 44
lea %A32_1663:A32 = %A32_1662 12
ld %S32_1664:S32 = %A32_1663 0
lea %A32_1665:A32 = nj
lea %A32_1666:A32 = %A32_1665 44
lea %A32_1667:A32 = %A32_1666 20
st %A32_1667 0 = %S32_1664
.bbl if_23_end
ret
.fun njInit NORMAL [] = []
.bbl %start
lea %A32_1668:A32 = nj
mov %S32_1669:S32 = 0
mov %U32_1670:U32 = 525000
pusharg %U32_1670
pusharg %S32_1669
pusharg %A32_1668
bsr mymemset
ret
.fun njDone NORMAL [] = []
.bbl %start
.reg S32 [i]
mov i = 0
bra for_1_cond
.bbl for_1
lea %A32_1671:A32 = nj
lea %A32_1672:A32 = %A32_1671 44
mul %S32_1673:S32 = i 44
lea %A32_1674:A32 = %A32_1672 %S32_1673
lea %A32_1675:A32 = %A32_1674 40
ld %A32_1676:A32 = %A32_1675 0
bne %A32_1676 0 if_2_true
bra for_1_next
.bbl if_2_true
lea %A32_1677:A32 = nj
lea %A32_1678:A32 = %A32_1677 44
mul %S32_1679:S32 = i 44
lea %A32_1680:A32 = %A32_1678 %S32_1679
lea %A32_1681:A32 = %A32_1680 40
ld %A32_1682:A32 = %A32_1681 0
pusharg %A32_1682
bsr free
.bbl for_1_next
add %S32_1683:S32 = i 1
mov i = %S32_1683
.bbl for_1_cond
blt i 3 for_1
bra for_1_exit
.bbl for_1_exit
lea %A32_1684:A32 = nj
lea %A32_1685:A32 = %A32_1684 524996
ld %A32_1686:A32 = %A32_1685 0
bne %A32_1686 0 if_4_true
bra if_4_end
.bbl if_4_true
lea %A32_1687:A32 = nj
lea %A32_1688:A32 = %A32_1687 524996
ld %A32_1689:A32 = %A32_1688 0
pusharg %A32_1689
bsr free
.bbl if_4_end
bsr njInit
ret
.fun njDecode NORMAL [S32] = [A32 S32]
.reg S32 [%out]
.bbl %start
poparg jpeg:A32
poparg size:S32
bsr njDone
lea %A32_1690:A32 = nj
lea %A32_1691:A32 = %A32_1690 4
st %A32_1691 0 = jpeg
and %S32_1692:S32 = size 2147483647
lea %A32_1693:A32 = nj
lea %A32_1694:A32 = %A32_1693 8
st %A32_1694 0 = %S32_1692
lea %A32_1695:A32 = nj
lea %A32_1696:A32 = %A32_1695 8
ld %S32_1697:S32 = %A32_1696 0
blt %S32_1697 2 if_2_true
bra if_2_end
.bbl if_2_true
mov %out = 1
pusharg %out
ret
.bbl if_2_end
lea %A32_1698:A32 = nj
lea %A32_1699:A32 = %A32_1698 4
ld %A32_1700:A32 = %A32_1699 0
ld %U8_1701:U8 = %A32_1700 0
conv %S32_1702:S32 = %U8_1701
xor %S32_1703:S32 = %S32_1702 255
lea %A32_1704:A32 = nj
lea %A32_1705:A32 = %A32_1704 4
ld %A32_1706:A32 = %A32_1705 0
lea %A32_1707:A32 = %A32_1706 1
ld %U8_1708:U8 = %A32_1707 0
conv %S32_1709:S32 = %U8_1708
xor %S32_1710:S32 = %S32_1709 216
or %S32_1711:S32 = %S32_1703 %S32_1710
bne %S32_1711 0 if_3_true
bra if_3_end
.bbl if_3_true
mov %out = 1
pusharg %out
ret
.bbl if_3_end
mov %S32_1712:S32 = 2
pusharg %S32_1712
bsr __static_2_njSkip
bra while_1_cond
.bbl while_1
lea %A32_1713:A32 = nj
lea %A32_1714:A32 = %A32_1713 8
ld %S32_1715:S32 = %A32_1714 0
blt %S32_1715 2 if_4_true
bra branch_8
.bbl branch_8
lea %A32_1716:A32 = nj
lea %A32_1717:A32 = %A32_1716 4
ld %A32_1718:A32 = %A32_1717 0
ld %U8_1719:U8 = %A32_1718 0
conv %S32_1720:S32 = %U8_1719
bne %S32_1720 255 if_4_true
bra if_4_end
.bbl if_4_true
mov %out = 5
pusharg %out
ret
.bbl if_4_end
mov %S32_1721:S32 = 2
pusharg %S32_1721
bsr __static_2_njSkip
lea %A32_1722:A32 = nj
lea %A32_1723:A32 = %A32_1722 4
ld %A32_1724:A32 = %A32_1723 0
lea %A32_1725:A32 = %A32_1724 -1
ld %U8_1726:U8 = %A32_1725 0
blt 254:U8 %U8_1726 switch_1727_default
.jtb switch_1727_tab 255 switch_1727_default [192 switch_1727_192 196 switch_1727_196 219 switch_1727_219 221 switch_1727_221 218 switch_1727_218 254 switch_1727_254]
switch %U8_1726 switch_1727_tab
.bbl switch_1727_192
bsr njDecodeSOF
bra switch_1727_end
.bbl switch_1727_196
bsr njDecodeDHT
bra switch_1727_end
.bbl switch_1727_219
bsr njDecodeDQT
bra switch_1727_end
.bbl switch_1727_221
bsr njDecodeDRI
bra switch_1727_end
.bbl switch_1727_218
bsr njDecodeScan
bra switch_1727_end
.bbl switch_1727_254
bsr njSkipMarker
bra switch_1727_end
.bbl switch_1727_default
lea %A32_1728:A32 = nj
lea %A32_1729:A32 = %A32_1728 4
ld %A32_1730:A32 = %A32_1729 0
lea %A32_1731:A32 = %A32_1730 -1
ld %U8_1732:U8 = %A32_1731 0
conv %S32_1733:S32 = %U8_1732
and %S32_1734:S32 = %S32_1733 240
beq %S32_1734 224 if_5_true
bra if_5_false
.bbl if_5_true
bsr njSkipMarker
bra while_1_cond
.bbl if_5_false
mov %out = 2
pusharg %out
ret
.bbl switch_1727_end
.bbl while_1_cond
lea %A32_1735:A32 = nj
lea %A32_1736:A32 = %A32_1735 0
ld %S32_1737:S32 = %A32_1736 0
bne %S32_1737 0 while_1_exit
bra while_1
.bbl while_1_exit
lea %A32_1738:A32 = nj
lea %A32_1739:A32 = %A32_1738 0
ld %S32_1740:S32 = %A32_1739 0
bne %S32_1740 6 if_7_true
bra if_7_end
.bbl if_7_true
lea %A32_1741:A32 = nj
lea %A32_1742:A32 = %A32_1741 0
ld %S32_1743:S32 = %A32_1742 0
mov %out = %S32_1743
pusharg %out
ret
.bbl if_7_end
lea %A32_1744:A32 = nj
mov %S32_1745:S32 = 0
st %A32_1744 0 = %S32_1745
bsr njConvert
lea %A32_1746:A32 = nj
lea %A32_1747:A32 = %A32_1746 0
ld %S32_1748:S32 = %A32_1747 0
mov %out = %S32_1748
pusharg %out
ret
.fun write_str NORMAL [] = [A32 S32]
.bbl %start
poparg s:A32
poparg fd:S32
.reg U32 [size]
mov size = 0
bra for_1_cond
.bbl for_1_next
add %U32_1749:U32 = size 1
mov size = %U32_1749
.bbl for_1_cond
lea %A32_1750:A32 = s size
ld %S8_1751:S8 = %A32_1750 0
conv %S32_1752:S32 = %S8_1751
bne %S32_1752 0 for_1_next
bra for_1_exit
.bbl for_1_exit
pusharg size
pusharg s
pusharg fd
bsr write
poparg %S32_1753:S32
ret
.fun write_dec NORMAL [] = [S32 S32]
.bbl %start
poparg fd:S32
poparg a:S32
.stk buf 1 64
.reg S32 [i]
mov i = 63
lea %A32_1754:A32 = buf
lea %A32_1755:A32 = %A32_1754 i
mov %S8_1756:S8 = 0
st %A32_1755 0 = %S8_1756
sub %S32_1757:S32 = i 1
mov i = %S32_1757
.bbl while_1
rem %S32_1758:S32 = a 10
add %S32_1759:S32 = 48:S32 %S32_1758
conv %S8_1760:S8 = %S32_1759
lea %A32_1761:A32 = buf
lea %A32_1762:A32 = %A32_1761 i
st %A32_1762 0 = %S8_1760
sub %S32_1763:S32 = i 1
mov i = %S32_1763
div %S32_1764:S32 = a 10
mov a = %S32_1764
.bbl while_1_cond
bne a 0 while_1
bra while_1_exit
.bbl while_1_exit
lea %A32_1765:A32 = buf
add %S32_1766:S32 = i 1
lea %A32_1767:A32 = %A32_1765 %S32_1766
pusharg fd
pusharg %A32_1767
bsr write_str
ret
.fun main NORMAL [S32] = [S32 A32]
.reg S32 [%out]
.bbl %start
poparg argc:S32
poparg argv:A32
.reg S32 [size]
.reg A32 [buf]
.reg S32 [fd]
blt argc 3 if_1_true
bra if_1_end
.bbl if_1_true
.mem string_const_1 4 RO
.data 1 "Usage: nanojpeg <input.jpg> <output.ppm>\x00"
lea %A32_1768:A32 = string_const_1
pusharg %A32_1768
bsr print_s_ln
mov %out = 2
pusharg %out
ret
.bbl if_1_end
lea %A32_1769:A32 = argv 4
ld %A32_1770:A32 = %A32_1769 0
mov %S32_1772:S32 = 0
mov %S32_1773:S32 = 0
pusharg %S32_1773
pusharg %S32_1772
pusharg %A32_1770
bsr open
poparg %S32_1771:S32
mov fd = %S32_1771
blt fd 0 if_2_true
bra if_2_end
.bbl if_2_true
.mem string_const_2 4 RO
.data 1 "Error opening the input file.\x00"
lea %A32_1774:A32 = string_const_2
pusharg %A32_1774
bsr print_s_ln
mov %out = 1
pusharg %out
ret
.bbl if_2_end
mov %S32_1776:S32 = 0
mov %S32_1777:S32 = 2
pusharg %S32_1777
pusharg %S32_1776
pusharg fd
bsr lseek
poparg %S32_1775:S32
mov size = %S32_1775
conv %U32_1778:U32 = size
pusharg %U32_1778
bsr malloc
poparg %A32_1779:A32
mov buf = %A32_1779
mov %S32_1781:S32 = 0
mov %S32_1782:S32 = 0
pusharg %S32_1782
pusharg %S32_1781
pusharg fd
bsr lseek
poparg %S32_1780:S32
conv %U32_1783:U32 = size
pusharg %U32_1783
pusharg buf
pusharg fd
bsr read
poparg %S32_1784:S32
mov size = %S32_1784
pusharg fd
bsr close
poparg %S32_1785:S32
bsr njInit
pusharg size
pusharg buf
bsr njDecode
poparg %S32_1786:S32
bne %S32_1786 0 if_3_true
bra if_3_end
.bbl if_3_true
pusharg buf
bsr free
.mem string_const_3 4 RO
.data 1 "Error decoding the input file.\x00"
lea %A32_1787:A32 = string_const_3
pusharg %A32_1787
bsr print_s_ln
mov %out = 1
pusharg %out
ret
.bbl if_3_end
pusharg buf
bsr free
lea %A32_1788:A32 = argv 8
ld %A32_1789:A32 = %A32_1788 0
or %S32_1790:S32 = 1:S32 64
or %S32_1791:S32 = %S32_1790 512
add %S32_1792:S32 = 2:S32 4
mul %S32_1793:S32 = %S32_1792 64
pusharg %S32_1793
pusharg %S32_1791
pusharg %A32_1789
bsr open
poparg %S32_1794:S32
mov fd = %S32_1794
blt fd 0 if_4_true
bra if_4_end
.bbl if_4_true
.mem string_const_4 4 RO
.data 1 "Error opening the output file.\x00"
lea %A32_1795:A32 = string_const_4
pusharg %A32_1795
bsr print_s_ln
mov %out = 1
pusharg %out
ret
.bbl if_4_end
bsr njIsColor
poparg %S32_1796:S32
bne %S32_1796 0 if_5_true
bra if_5_false
.bbl if_5_true
.mem string_const_5 4 RO
.data 1 "P6\n\x00"
lea %A32_1797:A32 = string_const_5
pusharg fd
pusharg %A32_1797
bsr write_str
bra if_5_end
.bbl if_5_false
.mem string_const_6 4 RO
.data 1 "P5\n\x00"
lea %A32_1798:A32 = string_const_6
pusharg fd
pusharg %A32_1798
bsr write_str
.bbl if_5_end
bsr njGetWidth
poparg %S32_1799:S32
pusharg %S32_1799
pusharg fd
bsr write_dec
.mem string_const_7 4 RO
.data 1 " \x00"
lea %A32_1800:A32 = string_const_7
pusharg fd
pusharg %A32_1800
bsr write_str
bsr njGetHeight
poparg %S32_1801:S32
pusharg %S32_1801
pusharg fd
bsr write_dec
.mem string_const_8 4 RO
.data 1 "\n\x00"
lea %A32_1802:A32 = string_const_8
pusharg fd
pusharg %A32_1802
bsr write_str
.mem string_const_9 4 RO
.data 1 "255\n\x00"
lea %A32_1803:A32 = string_const_9
pusharg fd
pusharg %A32_1803
bsr write_str
bsr njGetImage
poparg %A32_1804:A32
bsr njGetImageSize
poparg %S32_1805:S32
conv %U32_1806:U32 = %S32_1805
pusharg %U32_1806
pusharg %A32_1804
pusharg fd
bsr write
poparg %S32_1807:S32
pusharg fd
bsr close
poparg %S32_1808:S32
bsr njDone
mov %out = 0
pusharg %out
ret
| 22.017143 | 191 | 0.671244 |
e124dc3ce294804585395c78e834f344e66c15f9 | 310 | asm | Assembly | programs/oeis/021/A021748.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/021/A021748.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/021/A021748.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A021748: Decimal expansion of 1/744.
; 0,0,1,3,4,4,0,8,6,0,2,1,5,0,5,3,7,6,3,4,4,0,8,6,0,2,1,5,0,5,3,7,6,3,4,4,0,8,6,0,2,1,5,0,5,3,7,6,3,4,4,0,8,6,0,2,1,5,0,5,3,7,6,3,4,4,0,8,6,0,2,1,5,0,5,3,7,6,3,4,4,0,8,6,0,2,1,5,0,5,3,7,6,3,4,4,0,8,6
add $0,1
mov $1,10
pow $1,$0
mul $1,5
div $1,3720
mod $1,10
mov $0,$1
| 28.181818 | 199 | 0.541935 |
05d788094e14bbb6611324cdcdfd3fe401fb3d75 | 788 | asm | Assembly | oeis/323/A323225.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/323/A323225.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/323/A323225.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A323225: a(n) = ((2^n*n + i*(1 - i)^n - i*(1 + i)^n))/4, where i is the imaginary unit.
; Submitted by Jon Maiga
; 0,1,3,7,16,38,92,220,512,1160,2576,5648,12288,26592,57280,122816,262144,557184,1179904,2490624,5242880,11009536,23067648,48233472,100663296,209717248,436211712,905973760,1879048192,3892305920,8053047296,16642981888,34359738368,70866993152,146028953600,300647776256,618475290624,1271310188544,2611339853824,5360118923264,10995116277760,22539988893696,46179489415168,94558001037312,193514046488576,395824183902208,809240553848832,1653665483980800,3377699720527872,6896136937799680,14073748852310016
mov $1,1
mov $3,$0
mov $4,1
lpb $0
sub $0,1
add $1,$4
add $2,2
add $2,$0
sub $3,$1
add $4,1
mul $4,2
add $4,$3
mov $3,$2
mul $2,2
lpe
mov $0,$4
div $0,2
| 35.818182 | 498 | 0.751269 |
8f1c409bfad16b500570e0e7d22b6be690800e40 | 583 | asm | Assembly | oeis/258/A258618.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/258/A258618.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/258/A258618.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A258618: a(n) = (4*n+9)*n^2.
; 0,13,68,189,400,725,1188,1813,2624,3645,4900,6413,8208,10309,12740,15525,18688,22253,26244,30685,35600,41013,46948,53429,60480,68125,76388,85293,94864,105125,116100,127813,140288,153549,167620,182525,198288,214933,232484,250965,270400,290813,312228,334669,358160,382725,408388,435173,463104,492205,522500,554013,586768,620789,656100,692725,730688,770013,810724,852845,896400,941413,987908,1035909,1085440,1136525,1189188,1243453,1299344,1356885,1416100,1477013,1539648,1604029,1670180,1738125
mov $1,$0
pow $0,2
add $1,2
mul $1,4
add $1,1
mul $0,$1
| 58.3 | 494 | 0.790738 |
ab3918623b7f51bc05df460f6c0bebd83a316508 | 2,633 | asm | Assembly | QSS/src/kernel/rtl/ctext.asm | vbmacher/qsOS | 40ee57c1aaa9849a62057f4e7d7770e8661f60ba | [
"Apache-2.0"
] | 1 | 2019-09-19T04:27:54.000Z | 2019-09-19T04:27:54.000Z | QSS/src/kernel/rtl/ctext.asm | vbmacher/qsOS | 40ee57c1aaa9849a62057f4e7d7770e8661f60ba | [
"Apache-2.0"
] | null | null | null | QSS/src/kernel/rtl/ctext.asm | vbmacher/qsOS | 40ee57c1aaa9849a62057f4e7d7770e8661f60ba | [
"Apache-2.0"
] | null | null | null | ;
; CTEXT.ASM
;
; (c) Copyright 2005, vbmacher
;
; Part of RTL lib
; console i/o
.model compact
.386
.data
public _attribute
_attribute db 7
x db ?
y db ?
.code
public _gotoxy
public _wherexy
public _cputs
public _cputch
public _textattr
;void gotoxy(int x, int y)
_gotoxy proc c
arg @@x: word, @@y: word
mov dl,byte ptr @@x
mov dh,byte ptr @@y
mov ah,2
xor bh,bh
int 10h
ret
endp
;void wherexy(int *x, int *y)
_wherexy proc c
arg @@x: dword, @@y: dword
mov ah,3
xor bh,bh
int 10h
les bx,@@x
movzx ax,dl
mov es:[bx],ax
les bx,@@y
mov al,dh
mov es:[bx],ax
ret
endp
;void cputs(const char *str);
_cputs proc c
arg @@str: dword
mov ah, 03h ;pozicia kurzoru
xor bh, bh
int 10h
mov [x], dl
mov [y], dh
mov cx, 1
push si
les si,@@str
cld
mov bl, [_attribute]
jmp cPSLods
cTeletype: cmp al, 7 ; bell
je nor
cmp al, 8 ; bs
je nor
cmp al, 10 ; lf
je nor
cmp al, 13 ; cr
jne gra
nor: mov ah, 0eh
int 10h
mov ah, 03h ;pozicia kurzoru
int 10h
mov [x], dl
mov [y], dh
jmp short cPSLods
gra: mov ah,09h
inc byte ptr [x]
int 10h
mov dh, [y] ;nastavenie polohy kurzora
mov dl, [x]
mov ah, 02
int 10h
cPSLods: lods es:byte ptr [si]
or al,al
jnz cTeletype
pop si
ret
endp
;void cputch(int ch);
_cputch proc c
arg @@ch: word
;zistit poziciu kurzoru
mov ah, 03h
xor bh, bh
int 10h
mov [x], dl
mov [y], dh
mov al,byte ptr @@ch
cmp al, 07h
je xnor
cmp al, 08h
je xnor
cmp al, 0ah
je xnor
cmp al, 0dh
jne xgra
xnor: mov ah,0eh
int 10h
ret
xgra: mov ah, 09h
mov cx, 1
mov bl, [_attribute]
inc byte ptr [x]
xintr: int 10h
mov dh, [y] ;nastavenie polohy kurzora
mov dl, [x]
mov ah, 02h
int 10h
ret
endp
;void textattr(unsigned char att);
_textattr proc c
arg @@att: byte
mov al,byte ptr @@att
mov [_attribute], al
ret
endp
end
| 18.284722 | 47 | 0.447019 |
7261957d30d8c94b87b120c426c1a89647140cdf | 396 | asm | Assembly | sorting-algorithms/input.asm | informramiz/Assembly-Language-Programs | 600d8f737a09ef4c133b686918501fba56dd586e | [
"Apache-2.0"
] | null | null | null | sorting-algorithms/input.asm | informramiz/Assembly-Language-Programs | 600d8f737a09ef4c133b686918501fba56dd586e | [
"Apache-2.0"
] | null | null | null | sorting-algorithms/input.asm | informramiz/Assembly-Language-Programs | 600d8f737a09ef4c133b686918501fba56dd586e | [
"Apache-2.0"
] | null | null | null | INPUT PROC ;use di as input and give bx as output and store the string
PUSH AX
PUSH DI
CLD
XOR BX,BX
MOV AH,1
INT 21H
WHILE1:
CMP AL,0DH
JE END_WHILE1
CMP AL,8H
JNE ELSE1
DEC BX
DEC DI
JMP NEXT
ELSE1:
STOSB
INC BX
NEXT:
INT 21H
JMP WHILE1
END_WHILE1:
MOV VALUE,BX
POP DI
POP AX
RET
INPUT ENDP
| 9.658537 | 72 | 0.563131 |
012419a4933a0dd870a54701b400bba2d98ebd0f | 44,587 | asm | Assembly | kill.asm | willtran98/MIT_xv6 | ed247e2bc0a0315bb7c3ac25a55eec599d02fe89 | [
"MIT-0"
] | null | null | null | kill.asm | willtran98/MIT_xv6 | ed247e2bc0a0315bb7c3ac25a55eec599d02fe89 | [
"MIT-0"
] | null | null | null | kill.asm | willtran98/MIT_xv6 | ed247e2bc0a0315bb7c3ac25a55eec599d02fe89 | [
"MIT-0"
] | null | null | null |
_kill: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "stat.h"
#include "user.h"
int
main(int argc, char **argv)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 e4 f0 and $0xfffffff0,%esp
6: 57 push %edi
7: 56 push %esi
8: 53 push %ebx
int i;
if(argc < 2){
printf(2, "usage: kill pid...\n");
exit();
9: bb 01 00 00 00 mov $0x1,%ebx
#include "stat.h"
#include "user.h"
int
main(int argc, char **argv)
{
e: 83 ec 14 sub $0x14,%esp
11: 8b 75 08 mov 0x8(%ebp),%esi
14: 8b 7d 0c mov 0xc(%ebp),%edi
int i;
if(argc < 2){
17: 83 fe 01 cmp $0x1,%esi
1a: 7e 24 jle 40 <main+0x40>
1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
printf(2, "usage: kill pid...\n");
exit();
}
for(i=1; i<argc; i++)
kill(atoi(argv[i]));
20: 8b 04 9f mov (%edi,%ebx,4),%eax
if(argc < 2){
printf(2, "usage: kill pid...\n");
exit();
}
for(i=1; i<argc; i++)
23: 83 c3 01 add $0x1,%ebx
kill(atoi(argv[i]));
26: 89 04 24 mov %eax,(%esp)
29: e8 32 01 00 00 call 160 <atoi>
2e: 89 04 24 mov %eax,(%esp)
31: e8 7f 02 00 00 call 2b5 <kill>
if(argc < 2){
printf(2, "usage: kill pid...\n");
exit();
}
for(i=1; i<argc; i++)
36: 39 de cmp %ebx,%esi
38: 7f e6 jg 20 <main+0x20>
kill(atoi(argv[i]));
exit();
3a: e8 46 02 00 00 call 285 <exit>
3f: 90 nop
main(int argc, char **argv)
{
int i;
if(argc < 2){
printf(2, "usage: kill pid...\n");
40: c7 44 24 04 56 07 00 movl $0x756,0x4(%esp)
47: 00
48: c7 04 24 02 00 00 00 movl $0x2,(%esp)
4f: e8 8c 03 00 00 call 3e0 <printf>
exit();
54: e8 2c 02 00 00 call 285 <exit>
59: 66 90 xchg %ax,%ax
5b: 66 90 xchg %ax,%ax
5d: 66 90 xchg %ax,%ax
5f: 90 nop
00000060 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
60: 55 push %ebp
61: 31 d2 xor %edx,%edx
63: 89 e5 mov %esp,%ebp
65: 8b 45 08 mov 0x8(%ebp),%eax
68: 53 push %ebx
69: 8b 5d 0c mov 0xc(%ebp),%ebx
6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
char *os;
os = s;
while((*s++ = *t++) != 0)
70: 0f b6 0c 13 movzbl (%ebx,%edx,1),%ecx
74: 88 0c 10 mov %cl,(%eax,%edx,1)
77: 83 c2 01 add $0x1,%edx
7a: 84 c9 test %cl,%cl
7c: 75 f2 jne 70 <strcpy+0x10>
;
return os;
}
7e: 5b pop %ebx
7f: 5d pop %ebp
80: c3 ret
81: eb 0d jmp 90 <strcmp>
83: 90 nop
84: 90 nop
85: 90 nop
86: 90 nop
87: 90 nop
88: 90 nop
89: 90 nop
8a: 90 nop
8b: 90 nop
8c: 90 nop
8d: 90 nop
8e: 90 nop
8f: 90 nop
00000090 <strcmp>:
int
strcmp(const char *p, const char *q)
{
90: 55 push %ebp
91: 89 e5 mov %esp,%ebp
93: 53 push %ebx
94: 8b 4d 08 mov 0x8(%ebp),%ecx
97: 8b 55 0c mov 0xc(%ebp),%edx
while(*p && *p == *q)
9a: 0f b6 01 movzbl (%ecx),%eax
9d: 84 c0 test %al,%al
9f: 75 14 jne b5 <strcmp+0x25>
a1: eb 25 jmp c8 <strcmp+0x38>
a3: 90 nop
a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
p++, q++;
a8: 83 c1 01 add $0x1,%ecx
ab: 83 c2 01 add $0x1,%edx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
ae: 0f b6 01 movzbl (%ecx),%eax
b1: 84 c0 test %al,%al
b3: 74 13 je c8 <strcmp+0x38>
b5: 0f b6 1a movzbl (%edx),%ebx
b8: 38 d8 cmp %bl,%al
ba: 74 ec je a8 <strcmp+0x18>
bc: 0f b6 db movzbl %bl,%ebx
bf: 0f b6 c0 movzbl %al,%eax
c2: 29 d8 sub %ebx,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
}
c4: 5b pop %ebx
c5: 5d pop %ebp
c6: c3 ret
c7: 90 nop
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
c8: 0f b6 1a movzbl (%edx),%ebx
cb: 31 c0 xor %eax,%eax
cd: 0f b6 db movzbl %bl,%ebx
d0: 29 d8 sub %ebx,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
}
d2: 5b pop %ebx
d3: 5d pop %ebp
d4: c3 ret
d5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000000e0 <strlen>:
uint
strlen(char *s)
{
e0: 55 push %ebp
int n;
for(n = 0; s[n]; n++)
e1: 31 d2 xor %edx,%edx
return (uchar)*p - (uchar)*q;
}
uint
strlen(char *s)
{
e3: 89 e5 mov %esp,%ebp
int n;
for(n = 0; s[n]; n++)
e5: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
}
uint
strlen(char *s)
{
e7: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
ea: 80 39 00 cmpb $0x0,(%ecx)
ed: 74 0c je fb <strlen+0x1b>
ef: 90 nop
f0: 83 c2 01 add $0x1,%edx
f3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
f7: 89 d0 mov %edx,%eax
f9: 75 f5 jne f0 <strlen+0x10>
;
return n;
}
fb: 5d pop %ebp
fc: c3 ret
fd: 8d 76 00 lea 0x0(%esi),%esi
00000100 <memset>:
void*
memset(void *dst, int c, uint n)
{
100: 55 push %ebp
101: 89 e5 mov %esp,%ebp
103: 8b 55 08 mov 0x8(%ebp),%edx
106: 57 push %edi
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
107: 8b 4d 10 mov 0x10(%ebp),%ecx
10a: 8b 45 0c mov 0xc(%ebp),%eax
10d: 89 d7 mov %edx,%edi
10f: fc cld
110: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
112: 89 d0 mov %edx,%eax
114: 5f pop %edi
115: 5d pop %ebp
116: c3 ret
117: 89 f6 mov %esi,%esi
119: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000120 <strchr>:
char*
strchr(const char *s, char c)
{
120: 55 push %ebp
121: 89 e5 mov %esp,%ebp
123: 8b 45 08 mov 0x8(%ebp),%eax
126: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx
for(; *s; s++)
12a: 0f b6 10 movzbl (%eax),%edx
12d: 84 d2 test %dl,%dl
12f: 75 11 jne 142 <strchr+0x22>
131: eb 15 jmp 148 <strchr+0x28>
133: 90 nop
134: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
138: 83 c0 01 add $0x1,%eax
13b: 0f b6 10 movzbl (%eax),%edx
13e: 84 d2 test %dl,%dl
140: 74 06 je 148 <strchr+0x28>
if(*s == c)
142: 38 ca cmp %cl,%dl
144: 75 f2 jne 138 <strchr+0x18>
return (char*)s;
return 0;
}
146: 5d pop %ebp
147: c3 ret
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
148: 31 c0 xor %eax,%eax
if(*s == c)
return (char*)s;
return 0;
}
14a: 5d pop %ebp
14b: 90 nop
14c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
150: c3 ret
151: eb 0d jmp 160 <atoi>
153: 90 nop
154: 90 nop
155: 90 nop
156: 90 nop
157: 90 nop
158: 90 nop
159: 90 nop
15a: 90 nop
15b: 90 nop
15c: 90 nop
15d: 90 nop
15e: 90 nop
15f: 90 nop
00000160 <atoi>:
return r;
}
int
atoi(const char *s)
{
160: 55 push %ebp
int n;
n = 0;
while('0' <= *s && *s <= '9')
161: 31 c0 xor %eax,%eax
return r;
}
int
atoi(const char *s)
{
163: 89 e5 mov %esp,%ebp
165: 8b 4d 08 mov 0x8(%ebp),%ecx
168: 53 push %ebx
int n;
n = 0;
while('0' <= *s && *s <= '9')
169: 0f b6 11 movzbl (%ecx),%edx
16c: 8d 5a d0 lea -0x30(%edx),%ebx
16f: 80 fb 09 cmp $0x9,%bl
172: 77 1c ja 190 <atoi+0x30>
174: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
n = n*10 + *s++ - '0';
178: 0f be d2 movsbl %dl,%edx
17b: 83 c1 01 add $0x1,%ecx
17e: 8d 04 80 lea (%eax,%eax,4),%eax
181: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
185: 0f b6 11 movzbl (%ecx),%edx
188: 8d 5a d0 lea -0x30(%edx),%ebx
18b: 80 fb 09 cmp $0x9,%bl
18e: 76 e8 jbe 178 <atoi+0x18>
n = n*10 + *s++ - '0';
return n;
}
190: 5b pop %ebx
191: 5d pop %ebp
192: c3 ret
193: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
199: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000001a0 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
1a0: 55 push %ebp
1a1: 89 e5 mov %esp,%ebp
1a3: 56 push %esi
1a4: 8b 45 08 mov 0x8(%ebp),%eax
1a7: 53 push %ebx
1a8: 8b 5d 10 mov 0x10(%ebp),%ebx
1ab: 8b 75 0c mov 0xc(%ebp),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
1ae: 85 db test %ebx,%ebx
1b0: 7e 14 jle 1c6 <memmove+0x26>
n = n*10 + *s++ - '0';
return n;
}
void*
memmove(void *vdst, void *vsrc, int n)
1b2: 31 d2 xor %edx,%edx
1b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
*dst++ = *src++;
1b8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
1bc: 88 0c 10 mov %cl,(%eax,%edx,1)
1bf: 83 c2 01 add $0x1,%edx
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
1c2: 39 da cmp %ebx,%edx
1c4: 75 f2 jne 1b8 <memmove+0x18>
*dst++ = *src++;
return vdst;
}
1c6: 5b pop %ebx
1c7: 5e pop %esi
1c8: 5d pop %ebp
1c9: c3 ret
1ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
000001d0 <stat>:
return buf;
}
int
stat(char *n, struct stat *st)
{
1d0: 55 push %ebp
1d1: 89 e5 mov %esp,%ebp
1d3: 83 ec 18 sub $0x18,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
1d6: 8b 45 08 mov 0x8(%ebp),%eax
return buf;
}
int
stat(char *n, struct stat *st)
{
1d9: 89 5d f8 mov %ebx,-0x8(%ebp)
1dc: 89 75 fc mov %esi,-0x4(%ebp)
int fd;
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
1df: be ff ff ff ff mov $0xffffffff,%esi
stat(char *n, struct stat *st)
{
int fd;
int r;
fd = open(n, O_RDONLY);
1e4: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1eb: 00
1ec: 89 04 24 mov %eax,(%esp)
1ef: e8 d1 00 00 00 call 2c5 <open>
if(fd < 0)
1f4: 85 c0 test %eax,%eax
stat(char *n, struct stat *st)
{
int fd;
int r;
fd = open(n, O_RDONLY);
1f6: 89 c3 mov %eax,%ebx
if(fd < 0)
1f8: 78 19 js 213 <stat+0x43>
return -1;
r = fstat(fd, st);
1fa: 8b 45 0c mov 0xc(%ebp),%eax
1fd: 89 1c 24 mov %ebx,(%esp)
200: 89 44 24 04 mov %eax,0x4(%esp)
204: e8 d4 00 00 00 call 2dd <fstat>
close(fd);
209: 89 1c 24 mov %ebx,(%esp)
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
r = fstat(fd, st);
20c: 89 c6 mov %eax,%esi
close(fd);
20e: e8 9a 00 00 00 call 2ad <close>
return r;
}
213: 89 f0 mov %esi,%eax
215: 8b 5d f8 mov -0x8(%ebp),%ebx
218: 8b 75 fc mov -0x4(%ebp),%esi
21b: 89 ec mov %ebp,%esp
21d: 5d pop %ebp
21e: c3 ret
21f: 90 nop
00000220 <gets>:
return 0;
}
char*
gets(char *buf, int max)
{
220: 55 push %ebp
221: 89 e5 mov %esp,%ebp
223: 57 push %edi
224: 56 push %esi
225: 31 f6 xor %esi,%esi
227: 53 push %ebx
228: 83 ec 2c sub $0x2c,%esp
22b: 8b 7d 08 mov 0x8(%ebp),%edi
int i, cc;
char c;
for(i=0; i+1 < max; ){
22e: eb 06 jmp 236 <gets+0x16>
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
230: 3c 0a cmp $0xa,%al
232: 74 39 je 26d <gets+0x4d>
234: 89 de mov %ebx,%esi
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
236: 8d 5e 01 lea 0x1(%esi),%ebx
239: 3b 5d 0c cmp 0xc(%ebp),%ebx
23c: 7d 31 jge 26f <gets+0x4f>
cc = read(0, &c, 1);
23e: 8d 45 e7 lea -0x19(%ebp),%eax
241: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
248: 00
249: 89 44 24 04 mov %eax,0x4(%esp)
24d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
254: e8 44 00 00 00 call 29d <read>
if(cc < 1)
259: 85 c0 test %eax,%eax
25b: 7e 12 jle 26f <gets+0x4f>
break;
buf[i++] = c;
25d: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
261: 88 44 1f ff mov %al,-0x1(%edi,%ebx,1)
if(c == '\n' || c == '\r')
265: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
269: 3c 0d cmp $0xd,%al
26b: 75 c3 jne 230 <gets+0x10>
26d: 89 de mov %ebx,%esi
break;
}
buf[i] = '\0';
26f: c6 04 37 00 movb $0x0,(%edi,%esi,1)
return buf;
}
273: 89 f8 mov %edi,%eax
275: 83 c4 2c add $0x2c,%esp
278: 5b pop %ebx
279: 5e pop %esi
27a: 5f pop %edi
27b: 5d pop %ebp
27c: c3 ret
0000027d <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
27d: b8 01 00 00 00 mov $0x1,%eax
282: cd 40 int $0x40
284: c3 ret
00000285 <exit>:
SYSCALL(exit)
285: b8 02 00 00 00 mov $0x2,%eax
28a: cd 40 int $0x40
28c: c3 ret
0000028d <wait>:
SYSCALL(wait)
28d: b8 03 00 00 00 mov $0x3,%eax
292: cd 40 int $0x40
294: c3 ret
00000295 <pipe>:
SYSCALL(pipe)
295: b8 04 00 00 00 mov $0x4,%eax
29a: cd 40 int $0x40
29c: c3 ret
0000029d <read>:
SYSCALL(read)
29d: b8 05 00 00 00 mov $0x5,%eax
2a2: cd 40 int $0x40
2a4: c3 ret
000002a5 <write>:
SYSCALL(write)
2a5: b8 10 00 00 00 mov $0x10,%eax
2aa: cd 40 int $0x40
2ac: c3 ret
000002ad <close>:
SYSCALL(close)
2ad: b8 15 00 00 00 mov $0x15,%eax
2b2: cd 40 int $0x40
2b4: c3 ret
000002b5 <kill>:
SYSCALL(kill)
2b5: b8 06 00 00 00 mov $0x6,%eax
2ba: cd 40 int $0x40
2bc: c3 ret
000002bd <exec>:
SYSCALL(exec)
2bd: b8 07 00 00 00 mov $0x7,%eax
2c2: cd 40 int $0x40
2c4: c3 ret
000002c5 <open>:
SYSCALL(open)
2c5: b8 0f 00 00 00 mov $0xf,%eax
2ca: cd 40 int $0x40
2cc: c3 ret
000002cd <mknod>:
SYSCALL(mknod)
2cd: b8 11 00 00 00 mov $0x11,%eax
2d2: cd 40 int $0x40
2d4: c3 ret
000002d5 <unlink>:
SYSCALL(unlink)
2d5: b8 12 00 00 00 mov $0x12,%eax
2da: cd 40 int $0x40
2dc: c3 ret
000002dd <fstat>:
SYSCALL(fstat)
2dd: b8 08 00 00 00 mov $0x8,%eax
2e2: cd 40 int $0x40
2e4: c3 ret
000002e5 <link>:
SYSCALL(link)
2e5: b8 13 00 00 00 mov $0x13,%eax
2ea: cd 40 int $0x40
2ec: c3 ret
000002ed <mkdir>:
SYSCALL(mkdir)
2ed: b8 14 00 00 00 mov $0x14,%eax
2f2: cd 40 int $0x40
2f4: c3 ret
000002f5 <chdir>:
SYSCALL(chdir)
2f5: b8 09 00 00 00 mov $0x9,%eax
2fa: cd 40 int $0x40
2fc: c3 ret
000002fd <dup>:
SYSCALL(dup)
2fd: b8 0a 00 00 00 mov $0xa,%eax
302: cd 40 int $0x40
304: c3 ret
00000305 <getpid>:
SYSCALL(getpid)
305: b8 0b 00 00 00 mov $0xb,%eax
30a: cd 40 int $0x40
30c: c3 ret
0000030d <sbrk>:
SYSCALL(sbrk)
30d: b8 0c 00 00 00 mov $0xc,%eax
312: cd 40 int $0x40
314: c3 ret
00000315 <sleep>:
SYSCALL(sleep)
315: b8 0d 00 00 00 mov $0xd,%eax
31a: cd 40 int $0x40
31c: c3 ret
0000031d <uptime>:
SYSCALL(uptime)
31d: b8 0e 00 00 00 mov $0xe,%eax
322: cd 40 int $0x40
324: c3 ret
00000325 <date>:
SYSCALL(date)
325: b8 16 00 00 00 mov $0x16,%eax
32a: cd 40 int $0x40
32c: c3 ret
0000032d <alarm>:
SYSCALL(alarm)
32d: b8 17 00 00 00 mov $0x17,%eax
332: cd 40 int $0x40
334: c3 ret
335: 66 90 xchg %ax,%ax
337: 66 90 xchg %ax,%ax
339: 66 90 xchg %ax,%ax
33b: 66 90 xchg %ax,%ax
33d: 66 90 xchg %ax,%ax
33f: 90 nop
00000340 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
340: 55 push %ebp
341: 89 e5 mov %esp,%ebp
343: 57 push %edi
344: 89 cf mov %ecx,%edi
346: 56 push %esi
347: 89 c6 mov %eax,%esi
349: 53 push %ebx
34a: 83 ec 4c sub $0x4c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
34d: 8b 4d 08 mov 0x8(%ebp),%ecx
350: 85 c9 test %ecx,%ecx
352: 74 04 je 358 <printint+0x18>
354: 85 d2 test %edx,%edx
356: 78 70 js 3c8 <printint+0x88>
neg = 1;
x = -xx;
} else {
x = xx;
358: 89 d0 mov %edx,%eax
35a: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
361: 31 c9 xor %ecx,%ecx
363: 8d 5d d7 lea -0x29(%ebp),%ebx
366: 66 90 xchg %ax,%ax
}
i = 0;
do{
buf[i++] = digits[x % base];
368: 31 d2 xor %edx,%edx
36a: f7 f7 div %edi
36c: 0f b6 92 71 07 00 00 movzbl 0x771(%edx),%edx
373: 88 14 0b mov %dl,(%ebx,%ecx,1)
376: 83 c1 01 add $0x1,%ecx
}while((x /= base) != 0);
379: 85 c0 test %eax,%eax
37b: 75 eb jne 368 <printint+0x28>
if(neg)
37d: 8b 45 c4 mov -0x3c(%ebp),%eax
380: 85 c0 test %eax,%eax
382: 74 08 je 38c <printint+0x4c>
buf[i++] = '-';
384: c6 44 0d d7 2d movb $0x2d,-0x29(%ebp,%ecx,1)
389: 83 c1 01 add $0x1,%ecx
while(--i >= 0)
38c: 8d 79 ff lea -0x1(%ecx),%edi
38f: 01 fb add %edi,%ebx
391: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
398: 0f b6 03 movzbl (%ebx),%eax
39b: 83 ef 01 sub $0x1,%edi
39e: 83 eb 01 sub $0x1,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3a1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
3a8: 00
3a9: 89 34 24 mov %esi,(%esp)
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
3ac: 88 45 e7 mov %al,-0x19(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3af: 8d 45 e7 lea -0x19(%ebp),%eax
3b2: 89 44 24 04 mov %eax,0x4(%esp)
3b6: e8 ea fe ff ff call 2a5 <write>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
3bb: 83 ff ff cmp $0xffffffff,%edi
3be: 75 d8 jne 398 <printint+0x58>
putc(fd, buf[i]);
}
3c0: 83 c4 4c add $0x4c,%esp
3c3: 5b pop %ebx
3c4: 5e pop %esi
3c5: 5f pop %edi
3c6: 5d pop %ebp
3c7: c3 ret
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
3c8: 89 d0 mov %edx,%eax
3ca: f7 d8 neg %eax
3cc: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
3d3: eb 8c jmp 361 <printint+0x21>
3d5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000003e0 <printf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
3e0: 55 push %ebp
3e1: 89 e5 mov %esp,%ebp
3e3: 57 push %edi
3e4: 56 push %esi
3e5: 53 push %ebx
3e6: 83 ec 3c sub $0x3c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
3e9: 8b 45 0c mov 0xc(%ebp),%eax
3ec: 0f b6 10 movzbl (%eax),%edx
3ef: 84 d2 test %dl,%dl
3f1: 0f 84 c9 00 00 00 je 4c0 <printf+0xe0>
char *s;
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
3f7: 8d 4d 10 lea 0x10(%ebp),%ecx
3fa: 31 ff xor %edi,%edi
3fc: 89 4d d4 mov %ecx,-0x2c(%ebp)
3ff: 31 db xor %ebx,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
401: 8d 75 e7 lea -0x19(%ebp),%esi
404: eb 1e jmp 424 <printf+0x44>
406: 66 90 xchg %ax,%ax
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
408: 83 fa 25 cmp $0x25,%edx
40b: 0f 85 b7 00 00 00 jne 4c8 <printf+0xe8>
411: 66 bf 25 00 mov $0x25,%di
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
415: 83 c3 01 add $0x1,%ebx
418: 0f b6 14 18 movzbl (%eax,%ebx,1),%edx
41c: 84 d2 test %dl,%dl
41e: 0f 84 9c 00 00 00 je 4c0 <printf+0xe0>
c = fmt[i] & 0xff;
if(state == 0){
424: 85 ff test %edi,%edi
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
426: 0f b6 d2 movzbl %dl,%edx
if(state == 0){
429: 74 dd je 408 <printf+0x28>
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
42b: 83 ff 25 cmp $0x25,%edi
42e: 75 e5 jne 415 <printf+0x35>
if(c == 'd'){
430: 83 fa 64 cmp $0x64,%edx
433: 0f 84 47 01 00 00 je 580 <printf+0x1a0>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
439: 83 fa 70 cmp $0x70,%edx
43c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
440: 0f 84 aa 00 00 00 je 4f0 <printf+0x110>
446: 83 fa 78 cmp $0x78,%edx
449: 0f 84 a1 00 00 00 je 4f0 <printf+0x110>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
44f: 83 fa 73 cmp $0x73,%edx
452: 0f 84 c0 00 00 00 je 518 <printf+0x138>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
458: 83 fa 63 cmp $0x63,%edx
45b: 90 nop
45c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
460: 0f 84 42 01 00 00 je 5a8 <printf+0x1c8>
putc(fd, *ap);
ap++;
} else if(c == '%'){
466: 83 fa 25 cmp $0x25,%edx
469: 0f 84 01 01 00 00 je 570 <printf+0x190>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
46f: 8b 4d 08 mov 0x8(%ebp),%ecx
472: 89 55 cc mov %edx,-0x34(%ebp)
475: c6 45 e7 25 movb $0x25,-0x19(%ebp)
479: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
480: 00
481: 89 74 24 04 mov %esi,0x4(%esp)
485: 89 0c 24 mov %ecx,(%esp)
488: e8 18 fe ff ff call 2a5 <write>
48d: 8b 55 cc mov -0x34(%ebp),%edx
490: 88 55 e7 mov %dl,-0x19(%ebp)
493: 8b 45 08 mov 0x8(%ebp),%eax
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
496: 83 c3 01 add $0x1,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
499: 31 ff xor %edi,%edi
49b: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
4a2: 00
4a3: 89 74 24 04 mov %esi,0x4(%esp)
4a7: 89 04 24 mov %eax,(%esp)
4aa: e8 f6 fd ff ff call 2a5 <write>
4af: 8b 45 0c mov 0xc(%ebp),%eax
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
4b2: 0f b6 14 18 movzbl (%eax,%ebx,1),%edx
4b6: 84 d2 test %dl,%dl
4b8: 0f 85 66 ff ff ff jne 424 <printf+0x44>
4be: 66 90 xchg %ax,%ax
putc(fd, c);
}
state = 0;
}
}
}
4c0: 83 c4 3c add $0x3c,%esp
4c3: 5b pop %ebx
4c4: 5e pop %esi
4c5: 5f pop %edi
4c6: 5d pop %ebp
4c7: c3 ret
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
4c8: 8b 45 08 mov 0x8(%ebp),%eax
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
4cb: 88 55 e7 mov %dl,-0x19(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
4ce: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
4d5: 00
4d6: 89 74 24 04 mov %esi,0x4(%esp)
4da: 89 04 24 mov %eax,(%esp)
4dd: e8 c3 fd ff ff call 2a5 <write>
4e2: 8b 45 0c mov 0xc(%ebp),%eax
4e5: e9 2b ff ff ff jmp 415 <printf+0x35>
4ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
4f0: 8b 45 d4 mov -0x2c(%ebp),%eax
4f3: b9 10 00 00 00 mov $0x10,%ecx
ap++;
4f8: 31 ff xor %edi,%edi
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
4fa: c7 04 24 00 00 00 00 movl $0x0,(%esp)
501: 8b 10 mov (%eax),%edx
503: 8b 45 08 mov 0x8(%ebp),%eax
506: e8 35 fe ff ff call 340 <printint>
50b: 8b 45 0c mov 0xc(%ebp),%eax
ap++;
50e: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
512: e9 fe fe ff ff jmp 415 <printf+0x35>
517: 90 nop
} else if(c == 's'){
s = (char*)*ap;
518: 8b 55 d4 mov -0x2c(%ebp),%edx
ap++;
if(s == 0)
51b: b9 6a 07 00 00 mov $0x76a,%ecx
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
s = (char*)*ap;
520: 8b 3a mov (%edx),%edi
ap++;
522: 83 c2 04 add $0x4,%edx
525: 89 55 d4 mov %edx,-0x2c(%ebp)
if(s == 0)
528: 85 ff test %edi,%edi
52a: 0f 44 f9 cmove %ecx,%edi
s = "(null)";
while(*s != 0){
52d: 0f b6 17 movzbl (%edi),%edx
530: 84 d2 test %dl,%dl
532: 74 33 je 567 <printf+0x187>
534: 89 5d d0 mov %ebx,-0x30(%ebp)
537: 8b 5d 08 mov 0x8(%ebp),%ebx
53a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
putc(fd, *s);
s++;
540: 83 c7 01 add $0x1,%edi
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
543: 88 55 e7 mov %dl,-0x19(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
546: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
54d: 00
54e: 89 74 24 04 mov %esi,0x4(%esp)
552: 89 1c 24 mov %ebx,(%esp)
555: e8 4b fd ff ff call 2a5 <write>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
55a: 0f b6 17 movzbl (%edi),%edx
55d: 84 d2 test %dl,%dl
55f: 75 df jne 540 <printf+0x160>
561: 8b 5d d0 mov -0x30(%ebp),%ebx
564: 8b 45 0c mov 0xc(%ebp),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
567: 31 ff xor %edi,%edi
569: e9 a7 fe ff ff jmp 415 <printf+0x35>
56e: 66 90 xchg %ax,%ax
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
ap++;
} else if(c == '%'){
570: c6 45 e7 25 movb $0x25,-0x19(%ebp)
574: e9 1a ff ff ff jmp 493 <printf+0xb3>
579: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
580: 8b 45 d4 mov -0x2c(%ebp),%eax
583: b9 0a 00 00 00 mov $0xa,%ecx
ap++;
588: 66 31 ff xor %di,%di
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
58b: c7 04 24 01 00 00 00 movl $0x1,(%esp)
592: 8b 10 mov (%eax),%edx
594: 8b 45 08 mov 0x8(%ebp),%eax
597: e8 a4 fd ff ff call 340 <printint>
59c: 8b 45 0c mov 0xc(%ebp),%eax
ap++;
59f: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
5a3: e9 6d fe ff ff jmp 415 <printf+0x35>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
5a8: 8b 55 d4 mov -0x2c(%ebp),%edx
putc(fd, *ap);
ap++;
5ab: 31 ff xor %edi,%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
5ad: 8b 4d 08 mov 0x8(%ebp),%ecx
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
5b0: 8b 02 mov (%edx),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
5b2: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
5b9: 00
5ba: 89 74 24 04 mov %esi,0x4(%esp)
5be: 89 0c 24 mov %ecx,(%esp)
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
5c1: 88 45 e7 mov %al,-0x19(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
5c4: e8 dc fc ff ff call 2a5 <write>
5c9: 8b 45 0c mov 0xc(%ebp),%eax
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
ap++;
5cc: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
5d0: e9 40 fe ff ff jmp 415 <printf+0x35>
5d5: 66 90 xchg %ax,%ax
5d7: 66 90 xchg %ax,%ax
5d9: 66 90 xchg %ax,%ax
5db: 66 90 xchg %ax,%ax
5dd: 66 90 xchg %ax,%ax
5df: 90 nop
000005e0 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
5e0: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5e1: a1 8c 07 00 00 mov 0x78c,%eax
static Header base;
static Header *freep;
void
free(void *ap)
{
5e6: 89 e5 mov %esp,%ebp
5e8: 57 push %edi
5e9: 56 push %esi
5ea: 53 push %ebx
5eb: 8b 5d 08 mov 0x8(%ebp),%ebx
Header *bp, *p;
bp = (Header*)ap - 1;
5ee: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5f1: 39 c8 cmp %ecx,%eax
5f3: 73 1d jae 612 <free+0x32>
5f5: 8d 76 00 lea 0x0(%esi),%esi
5f8: 8b 10 mov (%eax),%edx
5fa: 39 d1 cmp %edx,%ecx
5fc: 72 1a jb 618 <free+0x38>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
5fe: 39 d0 cmp %edx,%eax
600: 72 08 jb 60a <free+0x2a>
602: 39 c8 cmp %ecx,%eax
604: 72 12 jb 618 <free+0x38>
606: 39 d1 cmp %edx,%ecx
608: 72 0e jb 618 <free+0x38>
60a: 89 d0 mov %edx,%eax
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
60c: 39 c8 cmp %ecx,%eax
60e: 66 90 xchg %ax,%ax
610: 72 e6 jb 5f8 <free+0x18>
612: 8b 10 mov (%eax),%edx
614: eb e8 jmp 5fe <free+0x1e>
616: 66 90 xchg %ax,%ax
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
618: 8b 71 04 mov 0x4(%ecx),%esi
61b: 8d 3c f1 lea (%ecx,%esi,8),%edi
61e: 39 d7 cmp %edx,%edi
620: 74 19 je 63b <free+0x5b>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
622: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
625: 8b 50 04 mov 0x4(%eax),%edx
628: 8d 34 d0 lea (%eax,%edx,8),%esi
62b: 39 ce cmp %ecx,%esi
62d: 74 23 je 652 <free+0x72>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
62f: 89 08 mov %ecx,(%eax)
freep = p;
631: a3 8c 07 00 00 mov %eax,0x78c
}
636: 5b pop %ebx
637: 5e pop %esi
638: 5f pop %edi
639: 5d pop %ebp
63a: c3 ret
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
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;
63b: 03 72 04 add 0x4(%edx),%esi
63e: 89 71 04 mov %esi,0x4(%ecx)
bp->s.ptr = p->s.ptr->s.ptr;
641: 8b 10 mov (%eax),%edx
643: 8b 12 mov (%edx),%edx
645: 89 53 f8 mov %edx,-0x8(%ebx)
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
648: 8b 50 04 mov 0x4(%eax),%edx
64b: 8d 34 d0 lea (%eax,%edx,8),%esi
64e: 39 ce cmp %ecx,%esi
650: 75 dd jne 62f <free+0x4f>
p->s.size += bp->s.size;
652: 03 51 04 add 0x4(%ecx),%edx
655: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
658: 8b 53 f8 mov -0x8(%ebx),%edx
65b: 89 10 mov %edx,(%eax)
} else
p->s.ptr = bp;
freep = p;
65d: a3 8c 07 00 00 mov %eax,0x78c
}
662: 5b pop %ebx
663: 5e pop %esi
664: 5f pop %edi
665: 5d pop %ebp
666: c3 ret
667: 89 f6 mov %esi,%esi
669: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000670 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
670: 55 push %ebp
671: 89 e5 mov %esp,%ebp
673: 57 push %edi
674: 56 push %esi
675: 53 push %ebx
676: 83 ec 2c sub $0x2c,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
679: 8b 5d 08 mov 0x8(%ebp),%ebx
if((prevp = freep) == 0){
67c: 8b 0d 8c 07 00 00 mov 0x78c,%ecx
malloc(uint nbytes)
{
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
682: 83 c3 07 add $0x7,%ebx
685: c1 eb 03 shr $0x3,%ebx
688: 83 c3 01 add $0x1,%ebx
if((prevp = freep) == 0){
68b: 85 c9 test %ecx,%ecx
68d: 0f 84 9b 00 00 00 je 72e <malloc+0xbe>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
693: 8b 01 mov (%ecx),%eax
if(p->s.size >= nunits){
695: 8b 50 04 mov 0x4(%eax),%edx
698: 39 d3 cmp %edx,%ebx
69a: 76 27 jbe 6c3 <malloc+0x53>
p->s.size -= nunits;
p += p->s.size;
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
69c: 8d 3c dd 00 00 00 00 lea 0x0(,%ebx,8),%edi
morecore(uint nu)
{
char *p;
Header *hp;
if(nu < 4096)
6a3: be 00 80 00 00 mov $0x8000,%esi
6a8: 89 7d e4 mov %edi,-0x1c(%ebp)
6ab: 90 nop
6ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
6b0: 3b 05 8c 07 00 00 cmp 0x78c,%eax
6b6: 74 30 je 6e8 <malloc+0x78>
6b8: 89 c1 mov %eax,%ecx
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
6ba: 8b 01 mov (%ecx),%eax
if(p->s.size >= nunits){
6bc: 8b 50 04 mov 0x4(%eax),%edx
6bf: 39 d3 cmp %edx,%ebx
6c1: 77 ed ja 6b0 <malloc+0x40>
if(p->s.size == nunits)
6c3: 39 d3 cmp %edx,%ebx
6c5: 74 61 je 728 <malloc+0xb8>
prevp->s.ptr = p->s.ptr;
else {
p->s.size -= nunits;
6c7: 29 da sub %ebx,%edx
6c9: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
6cc: 8d 04 d0 lea (%eax,%edx,8),%eax
p->s.size = nunits;
6cf: 89 58 04 mov %ebx,0x4(%eax)
}
freep = prevp;
6d2: 89 0d 8c 07 00 00 mov %ecx,0x78c
return (void*)(p + 1);
6d8: 83 c0 08 add $0x8,%eax
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
}
6db: 83 c4 2c add $0x2c,%esp
6de: 5b pop %ebx
6df: 5e pop %esi
6e0: 5f pop %edi
6e1: 5d pop %ebp
6e2: c3 ret
6e3: 90 nop
6e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
morecore(uint nu)
{
char *p;
Header *hp;
if(nu < 4096)
6e8: 8b 45 e4 mov -0x1c(%ebp),%eax
6eb: 81 fb 00 10 00 00 cmp $0x1000,%ebx
6f1: bf 00 10 00 00 mov $0x1000,%edi
6f6: 0f 43 fb cmovae %ebx,%edi
6f9: 0f 42 c6 cmovb %esi,%eax
nu = 4096;
p = sbrk(nu * sizeof(Header));
6fc: 89 04 24 mov %eax,(%esp)
6ff: e8 09 fc ff ff call 30d <sbrk>
if(p == (char*)-1)
704: 83 f8 ff cmp $0xffffffff,%eax
707: 74 18 je 721 <malloc+0xb1>
return 0;
hp = (Header*)p;
hp->s.size = nu;
709: 89 78 04 mov %edi,0x4(%eax)
free((void*)(hp + 1));
70c: 83 c0 08 add $0x8,%eax
70f: 89 04 24 mov %eax,(%esp)
712: e8 c9 fe ff ff call 5e0 <free>
return freep;
717: 8b 0d 8c 07 00 00 mov 0x78c,%ecx
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
71d: 85 c9 test %ecx,%ecx
71f: 75 99 jne 6ba <malloc+0x4a>
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
721: 31 c0 xor %eax,%eax
723: eb b6 jmp 6db <malloc+0x6b>
725: 8d 76 00 lea 0x0(%esi),%esi
if(p->s.size == nunits)
prevp->s.ptr = p->s.ptr;
728: 8b 10 mov (%eax),%edx
72a: 89 11 mov %edx,(%ecx)
72c: eb a4 jmp 6d2 <malloc+0x62>
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
72e: c7 05 8c 07 00 00 84 movl $0x784,0x78c
735: 07 00 00
base.s.size = 0;
738: b9 84 07 00 00 mov $0x784,%ecx
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
73d: c7 05 84 07 00 00 84 movl $0x784,0x784
744: 07 00 00
base.s.size = 0;
747: c7 05 88 07 00 00 00 movl $0x0,0x788
74e: 00 00 00
751: e9 3d ff ff ff jmp 693 <malloc+0x23>
| 28.952597 | 60 | 0.416041 |
bf80cf7dcd156656b6951064586cb812cd620ff8 | 31 | asm | Assembly | levels/position_overrides/lvl6_1_7.asm | cppchriscpp/ld38 | fe2e11a2f1a1098c716289b444c867a8113c39ea | [
"MIT"
] | 4 | 2018-08-18T15:31:04.000Z | 2021-03-28T22:21:15.000Z | levels/position_overrides/lvl6_1_7.asm | cppchriscpp/missing-lands | fe2e11a2f1a1098c716289b444c867a8113c39ea | [
"MIT"
] | null | null | null | levels/position_overrides/lvl6_1_7.asm | cppchriscpp/missing-lands | fe2e11a2f1a1098c716289b444c867a8113c39ea | [
"MIT"
] | null | null | null | .repeat 16
.byte 39
.endrepeat | 10.333333 | 10 | 0.741935 |
b3ce932224dd346041f6deb9503ab8003b12f2ef | 1,143 | asm | Assembly | nasm-8086-assembly-course/0x03-compare/compare.asm | ailtonbsj/buffer-overflow-studies | 326a26f26a52f5ac055b85fc6879123c91124d23 | [
"MIT"
] | null | null | null | nasm-8086-assembly-course/0x03-compare/compare.asm | ailtonbsj/buffer-overflow-studies | 326a26f26a52f5ac055b85fc6879123c91124d23 | [
"MIT"
] | null | null | null | nasm-8086-assembly-course/0x03-compare/compare.asm | ailtonbsj/buffer-overflow-studies | 326a26f26a52f5ac055b85fc6879123c91124d23 | [
"MIT"
] | null | null | null | segment .data
LF equ 0x0a ; Line feed
CR equ 0x0d ; Carriage return
NULL equ 0x00 ; NULL \0 character
SYS_CALL equ 0x80 ; OS interrupt vector
; On EAX
SYS_EXIT equ 0x01 ; Finish program code
SYS_READ equ 0x03 ; Read data code
SYS_WRITE equ 0x04 ; Write data code
; On EBX
RET_EXIT equ 0x00 ; Finished without error
STD_IN equ 0x00 ; Standard input code
STD_OUT equ 0x01 ; Standard output code
section .data
x dd 5 ; dd means 'define double (4 bytes)'
y dd 10
msg1 db 'X maior que Y', LF, CR ; db means 'define byte'
tam1 equ $ - msg1
msg2 db 'Y maior que X', LF, CR
tam2 equ $ - msg2
; dw means 'define word (2 bytes)'
section .text
global _start
_start:
mov eax, dword[x]
mov ebx, dword[y]
cmp eax, ebx ; compare two bytes
jge maior ; jump if greater than or equal
mov ecx, msg2
mov edx, tam2
jmp saida
maior:
mov ecx, msg1
mov edx, tam1
saida:
mov eax, SYS_WRITE
mov ebx, STD_OUT
int SYS_CALL
; finish program
mov eax, SYS_EXIT
mov ebx, RET_EXIT
int SYS_CALL | 23.326531 | 60 | 0.619423 |
592203a7376138bf049c88017497e3c835862e83 | 586 | asm | Assembly | oeis/060/A060851.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/060/A060851.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/060/A060851.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A060851: a(n) = (2n-1) * 3^(2n-1).
; 3,81,1215,15309,177147,1948617,20726199,215233605,2195382771,22082967873,219667417263,2165293113021,21182215236075,205891132094649,1990280943581607,19147875284802357,183448998696332259,1751104078464989745,16660504517966902431,158049650967740074413,1495392851464002242523,14115049597965094337961,132944071794787516438935,1249674274871002654525989,11725667132300258949914067,109838392116853446081848097,1027312020387041054530226319,9594706605501609848914377885,89492445247678651863510470091
mul $0,2
add $0,1
mov $1,3
pow $1,$0
mul $1,$0
mov $0,$1
| 58.6 | 490 | 0.863481 |
ce317b41503f48f8dba0e7e69f97f43a6c6a7bcb | 812 | asm | Assembly | oeis/163/A163723.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/163/A163723.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/163/A163723.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A163723: Number of nX2 binary arrays with all 1s connected, a path of 1s from left column to right column, and no 1 having more than two 1s adjacent
; 1,7,21,49,101,193,351,617,1059,1787,2979,4923,8085,13219,21545,35037,56889,92269,149539,242229,392231,634967,1027751,1663319,2691721,4355743,7048221,11404777,18453869,29859577,48314439,78175073,126490635,204666899,331158795,535827027,866987229,1402815739,2269804529,3672621909,5942428161,9615051877,15557481931,25172535789,40730019791,65902557743,106632579791,172535139887,279167722129,451702864567,730870589349,1182573456673,1913444048885,3096017508529,5009461560495,8105479072217,13114940636019
add $0,4
mov $2,$0
seq $0,192760 ; Coefficient of x in the reduction by x^2->x+1 of the polynomial p(n,x) defined below in Comments.
pow $2,2
sub $0,$2
sub $0,1
| 81.2 | 498 | 0.820197 |
8aef11174019528b0b356eb412786ac5618ad2f6 | 3,646 | asm | Assembly | Tests/yasm-regression/simd-2.asm | 13xforever/x86-assembly-textmate-bundle | f1bb62f77b776d87d0fd85b0276d4237ff72c43c | [
"MIT"
] | 69 | 2015-04-16T18:01:22.000Z | 2022-02-15T07:54:26.000Z | Tests/yasm-regression/simd-2.asm | javiercbk/x86-assembly-textmate-bundle | 62d700e0196f62ef4353a9b95c2e64beb0a6afda | [
"MIT"
] | 17 | 2016-09-20T08:49:09.000Z | 2021-02-19T15:01:04.000Z | Tests/yasm-regression/simd-2.asm | javiercbk/x86-assembly-textmate-bundle | 62d700e0196f62ef4353a9b95c2e64beb0a6afda | [
"MIT"
] | 19 | 2016-05-31T07:11:14.000Z | 2021-07-19T10:17:12.000Z | [bits 32]
pextrw ebx, mm5, 0 ; out: 0f c5 dd 00
pextrw ecx, xmm0, 1 ; out: 66 0f c5 c8 01
pinsrw mm3, esi, 5 ; out: 0f c4 de 05
pinsrw mm3, [0], 4 ; out: 0f c4 1d 00 00 00 00 04
pinsrw xmm1, eax, 3 ; out: 66 0f c4 c8 03
pinsrw xmm1, [0], 2 ; out: 66 0f c4 0d 00 00 00 00 02
movmskpd edx, xmm7 ; out: 66 0f 50 d7
movmskps eax, xmm1 ; out: 0f 50 c1
pmovmskb edi, mm0 ; out: 0f d7 f8
pmovmskb esi, xmm1 ; out: 66 0f d7 f1
cvtdq2pd xmm5, xmm4 ; out: f3 0f e6 ec
cvtdq2pd xmm3, [0] ; out: f3 0f e6 1d 00 00 00 00
cvtdq2pd xmm2, qword [0] ; out: f3 0f e6 15 00 00 00 00
cvtdq2ps xmm1, xmm2 ; out: 0f 5b ca
cvtdq2ps xmm4, [0] ; out: 0f 5b 25 00 00 00 00
cvtdq2ps xmm5, dqword [0] ; out: 0f 5b 2d 00 00 00 00
cvtpd2dq xmm0, xmm1 ; out: f2 0f e6 c1
cvtpd2dq xmm2, [0] ; out: f2 0f e6 15 00 00 00 00
cvtpd2dq xmm3, dqword [0] ; out: f2 0f e6 1d 00 00 00 00
cvtpd2pi mm4, xmm5 ; out: 66 0f 2d e5
cvtpd2pi mm6, [0] ; out: 66 0f 2d 35 00 00 00 00
cvtpd2pi mm7, dqword [0] ; out: 66 0f 2d 3d 00 00 00 00
cvtpd2ps xmm1, xmm2 ; out: 66 0f 5a ca
cvtpd2ps xmm3, [0] ; out: 66 0f 5a 1d 00 00 00 00
cvtpd2ps xmm4, dqword [0] ; out: 66 0f 5a 25 00 00 00 00
cvtpi2pd xmm5, mm6 ; out: 66 0f 2a ee
cvtpi2pd xmm7, [0] ; out: 66 0f 2a 3d 00 00 00 00
cvtpi2pd xmm0, qword [0] ; out: 66 0f 2a 05 00 00 00 00
cvtpi2ps xmm2, mm3 ; out: 0f 2a d3
cvtpi2ps xmm4, [0] ; out: 0f 2a 25 00 00 00 00
cvtpi2ps xmm5, qword [0] ; out: 0f 2a 2d 00 00 00 00
cvtps2dq xmm6, xmm7 ; out: 66 0f 5b f7
cvtps2dq xmm0, [0] ; out: 66 0f 5b 05 00 00 00 00
cvtps2dq xmm1, dqword [0] ; out: 66 0f 5b 0d 00 00 00 00
cvtps2pd xmm2, xmm3 ; out: 0f 5a d3
cvtps2pd xmm4, [0] ; out: 0f 5a 25 00 00 00 00
cvtps2pd xmm5, qword [0] ; out: 0f 5a 2d 00 00 00 00
cvtps2pi mm6, xmm7 ; out: 0f 2d f7
cvtps2pi mm0, [0] ; out: 0f 2d 05 00 00 00 00
cvtps2pi mm1, qword [0] ; out: 0f 2d 0d 00 00 00 00
cvtsd2si edx, xmm0 ; out: f2 0f 2d d0
cvtsd2si eax, [0] ; out: f2 0f 2d 05 00 00 00 00
cvtsd2si ebx, qword [0] ; out: f2 0f 2d 1d 00 00 00 00
cvtsd2ss xmm1, xmm2 ; out: f2 0f 5a ca
cvtsd2ss xmm3, [0] ; out: f2 0f 5a 1d 00 00 00 00
cvtsd2ss xmm4, qword [0] ; out: f2 0f 5a 25 00 00 00 00
cvtsi2sd xmm5, eax ; out: f2 0f 2a e8
cvtsi2sd xmm6, [0] ; out: f2 0f 2a 35 00 00 00 00
cvtsi2sd xmm7, dword [0] ; out: f2 0f 2a 3d 00 00 00 00
cvtsi2ss xmm0, edx ; out: f3 0f 2a c2
cvtsi2ss xmm1, [0] ; out: f3 0f 2a 0d 00 00 00 00
cvtsi2ss xmm2, dword [0] ; out: f3 0f 2a 15 00 00 00 00
cvtss2sd xmm3, xmm4 ; out: f3 0f 5a dc
cvtss2sd xmm5, [0] ; out: f3 0f 5a 2d 00 00 00 00
cvtss2sd xmm6, dword [0] ; out: f3 0f 5a 35 00 00 00 00
cvtss2si ebx, xmm7 ; out: f3 0f 2d df
cvtss2si ecx, [0] ; out: f3 0f 2d 0d 00 00 00 00
cvtss2si eax, dword [0] ; out: f3 0f 2d 05 00 00 00 00
cvttpd2pi mm0, xmm1 ; out: 66 0f 2c c1
cvttpd2pi mm2, [0] ; out: 66 0f 2c 15 00 00 00 00
cvttpd2pi mm3, dqword [0] ; out: 66 0f 2c 1d 00 00 00 00
cvttpd2dq xmm4, xmm5 ; out: 66 0f e6 e5
cvttpd2dq xmm6, [0] ; out: 66 0f e6 35 00 00 00 00
cvttpd2dq xmm7, dqword [0] ; out: 66 0f e6 3d 00 00 00 00
cvttps2dq xmm0, xmm1 ; out: f3 0f 5b c1
cvttps2dq xmm2, [0] ; out: f3 0f 5b 15 00 00 00 00
cvttps2dq xmm3, dqword [0] ; out: f3 0f 5b 1d 00 00 00 00
cvttps2pi mm4, xmm5 ; out: 0f 2c e5
cvttps2pi mm6, [0] ; out: 0f 2c 35 00 00 00 00
cvttps2pi mm7, qword [0] ; out: 0f 2c 3d 00 00 00 00
cvttsd2si ecx, xmm0 ; out: f2 0f 2c c8
cvttsd2si ebx, [0] ; out: f2 0f 2c 1d 00 00 00 00
cvttsd2si edi, qword [0] ; out: f2 0f 2c 3d 00 00 00 00
cvttss2si esi, xmm3 ; out: f3 0f 2c f3
cvttss2si ebp, [0] ; out: f3 0f 2c 2d 00 00 00 00
cvttss2si eax, dword [0] ; out: f3 0f 2c 05 00 00 00 00
| 34.72381 | 57 | 0.644542 |
1c036a978a3f7fa74a8728d5d808af969e55516d | 3,861 | asm | Assembly | maps/RuinsOfAlphAerodactylChamber.asm | Dev727/ancientplatinum | 8b212a1728cc32a95743e1538b9eaa0827d013a7 | [
"blessing"
] | 28 | 2019-11-08T07:19:00.000Z | 2021-12-20T10:17:54.000Z | maps/RuinsOfAlphAerodactylChamber.asm | Dev727/ancientplatinum | 8b212a1728cc32a95743e1538b9eaa0827d013a7 | [
"blessing"
] | 13 | 2020-01-11T17:00:40.000Z | 2021-09-14T01:27:38.000Z | maps/RuinsOfAlphAerodactylChamber.asm | Dev727/ancientplatinum | 8b212a1728cc32a95743e1538b9eaa0827d013a7 | [
"blessing"
] | 22 | 2020-05-28T17:31:38.000Z | 2022-03-07T20:49:35.000Z | RuinsOfAlphAerodactylChamber_MapScripts:
db 2 ; scene scripts
scene_script .CheckWall ; SCENE_DEFAULT
scene_script .DummyScene ; SCENE_FINISHED
db 1 ; callbacks
callback MAPCALLBACK_TILES, .HiddenDoors
.CheckWall:
checkevent EVENT_WALL_OPENED_IN_AERODACTYL_CHAMBER
iftrue .OpenWall
end
.OpenWall:
prioritysjump .WallOpenScript
end
.DummyScene:
end
.HiddenDoors:
checkevent EVENT_WALL_OPENED_IN_AERODACTYL_CHAMBER
iftrue .WallOpen
changeblock 4, 0, $2e ; closed wall
.WallOpen:
checkevent EVENT_SOLVED_AERODACTYL_PUZZLE
iffalse .FloorClosed
return
.FloorClosed:
changeblock 2, 2, $01 ; left floor
changeblock 4, 2, $02 ; right floor
return
.WallOpenScript:
pause 30
earthquake 30
showemote EMOTE_SHOCK, PLAYER, 20
pause 30
playsound SFX_STRENGTH
changeblock 4, 0, $30 ; open wall
reloadmappart
earthquake 50
setscene SCENE_FINISHED
closetext
end
RuinsOfAlphAerodactylChamberPuzzle:
refreshscreen
setval UNOWNPUZZLE_AERODACTYL
special UnownPuzzle
closetext
iftrue .PuzzleComplete
end
.PuzzleComplete:
setevent EVENT_RUINS_OF_ALPH_INNER_CHAMBER_TOURISTS
setevent EVENT_SOLVED_AERODACTYL_PUZZLE
setflag ENGINE_UNLOCKED_UNOWNS_S_TO_W
setmapscene RUINS_OF_ALPH_INNER_CHAMBER, SCENE_RUINSOFALPHINNERCHAMBER_STRANGE_PRESENCE
earthquake 30
showemote EMOTE_SHOCK, PLAYER, 15
changeblock 2, 2, $18 ; left hole
changeblock 4, 2, $19 ; right hole
reloadmappart
playsound SFX_STRENGTH
earthquake 80
applymovement PLAYER, RuinsOfAlphAerodactylChamberSkyfallTopMovement
playsound SFX_KINESIS
waitsfx
pause 20
warpcheck
end
RuinsOfAlphAerodactylChamberAncientReplica:
jumptext RuinsOfAlphAerodactylChamberAncientReplicaText
RuinsOfAlphAerodactylChamberDescriptionSign:
jumptext RuinsOfAlphAerodactylChamberDescriptionText
RuinsOfAlphAerodactylChamberWallPatternLeft:
opentext
writetext RuinsOfAlphAerodactylChamberWallPatternLeftText
setval UNOWNWORDS_LIGHT
special DisplayUnownWords
closetext
end
RuinsOfAlphAerodactylChamberWallPatternRight:
checkevent EVENT_WALL_OPENED_IN_AERODACTYL_CHAMBER
iftrue .WallOpen
opentext
writetext RuinsOfAlphAerodactylChamberWallPatternRightText
setval UNOWNWORDS_LIGHT
special DisplayUnownWords
closetext
end
.WallOpen:
opentext
writetext RuinsOfAlphAerodactylChamberWallHoleText
waitbutton
closetext
end
RuinsOfAlphAerodactylChamberSkyfallTopMovement:
skyfall_top
step_end
RuinsOfAlphAerodactylChamberWallPatternLeftText:
text "Patterns appeared"
line "on the walls…"
done
RuinsOfAlphAerodactylChamberUnownText:
; unused
text "It's UNOWN text!"
done
RuinsOfAlphAerodactylChamberWallPatternRightText:
text "Patterns appeared"
line "on the walls…"
done
RuinsOfAlphAerodactylChamberWallHoleText:
text "There's a big hole"
line "in the wall!"
done
RuinsOfAlphAerodactylChamberAncientReplicaText:
text "It's a replica of"
line "an ancient #-"
cont "MON."
done
RuinsOfAlphAerodactylChamberDescriptionText:
text "This flying #-"
line "MON attacked its"
para "prey with saw-like"
line "fangs."
done
RuinsOfAlphAerodactylChamber_MapEvents:
db 0, 0 ; filler
db 5 ; warp events
warp_event 3, 9, RUINS_OF_ALPH_OUTSIDE, 4
warp_event 4, 9, RUINS_OF_ALPH_OUTSIDE, 4
warp_event 3, 3, RUINS_OF_ALPH_INNER_CHAMBER, 8
warp_event 4, 3, RUINS_OF_ALPH_INNER_CHAMBER, 9
warp_event 4, 0, RUINS_OF_ALPH_AERODACTYL_ITEM_ROOM, 1
db 0 ; coord events
db 6 ; bg events
bg_event 2, 3, BGEVENT_READ, RuinsOfAlphAerodactylChamberAncientReplica
bg_event 5, 3, BGEVENT_READ, RuinsOfAlphAerodactylChamberAncientReplica
bg_event 3, 2, BGEVENT_UP, RuinsOfAlphAerodactylChamberPuzzle
bg_event 4, 2, BGEVENT_UP, RuinsOfAlphAerodactylChamberDescriptionSign
bg_event 3, 0, BGEVENT_UP, RuinsOfAlphAerodactylChamberWallPatternLeft
bg_event 4, 0, BGEVENT_UP, RuinsOfAlphAerodactylChamberWallPatternRight
db 0 ; object events
| 23.4 | 88 | 0.830096 |
dea3e6d0991a63b724e8f87b9e143935f6648677 | 16,730 | asm | Assembly | DuetPkg/BootSector/efi32.asm | James992927108/uEFI_Edk2_Practice | 2cac7618dfee10bfa5104a2e167c85425fde0100 | [
"BSD-2-Clause"
] | 8 | 2019-06-03T10:47:48.000Z | 2021-08-21T19:11:38.000Z | DuetPkg/BootSector/efi32.asm | James992927108/uEFI_Edk2_Practice | 2cac7618dfee10bfa5104a2e167c85425fde0100 | [
"BSD-2-Clause"
] | null | null | null | DuetPkg/BootSector/efi32.asm | James992927108/uEFI_Edk2_Practice | 2cac7618dfee10bfa5104a2e167c85425fde0100 | [
"BSD-2-Clause"
] | 1 | 2021-04-21T06:20:00.000Z | 2021-04-21T06:20:00.000Z | ;------------------------------------------------------------------------------
;*
;* Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
;* This program and the accompanying materials
;* are licensed and made available under the terms and conditions of the BSD License
;* which accompanies this distribution. The full text of the license may be found at
;* http://opensource.org/licenses/bsd-license.php
;*
;* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
;* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;*
;* efi32.asm
;*
;* Abstract:
;*
;------------------------------------------------------------------------------
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Now in 32-bit protected mode.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.486
.model flat
.stack
.code
org 21000h
DEFAULT_HANDLER_SIZE EQU INT1 - INT0
JmpCommonIdtEntry macro
; jmp commonIdtEntry - this must be hand coded to keep the assembler from
; using a 8 bit reletive jump when the entries are
; within 255 bytes of the common entry. This must
; be done to maintain the consistency of the size
; of entry points...
db 0e9h ; jmp 16 bit relative
dd commonIdtEntry - $ - 4 ; offset to jump to
endm
Start:
mov ax,bx ; flat data descriptor in BX
mov ds,ax
mov es,ax
mov fs,ax
mov gs,ax
mov ss,ax
mov esp,0001ffff0h
call ClearScreen
; Populate IDT with meaningful offsets for exception handlers...
sidt fword ptr [Idtr] ; get fword address of IDT
mov eax, offset Halt
mov ebx, eax ; use bx to copy 15..0 to descriptors
shr eax, 16 ; use ax to copy 31..16 to descriptors
mov ecx, 78h ; 78h IDT entries to initialize with unique entry points (exceptions)
mov esi, [offset Idtr + 2]
mov edi, [esi]
@@: ; loop through all IDT entries exception handlers and initialize to default handler
mov word ptr [edi], bx ; write bits 15..0 of offset
mov word ptr [edi+2], 20h ; SYS_CODE_SEL from GDT
mov word ptr [edi+4], 0e00h OR 8000h ; type = 386 interrupt gate, present
mov word ptr [edi+6], ax ; write bits 31..16 of offset
add edi, 8 ; move up to next descriptor
add bx, DEFAULT_HANDLER_SIZE ; move to next entry point
loop @b ; loop back through again until all descriptors are initialized
;; at this point edi contains the offset of the descriptor for INT 20
;; and bx contains the low 16 bits of the offset of the default handler
;; so initialize all the rest of the descriptors with these two values...
; mov ecx, 101 ; there are 100 descriptors left (INT 20 (14h) - INT 119 (77h)
;@@: ; loop through all IDT entries exception handlers and initialize to default handler
; mov word ptr [edi], bx ; write bits 15..0 of offset
; mov word ptr [edi+2], 20h ; SYS_CODE_SEL from GDT
; mov word ptr [edi+4], 0e00h OR 8000h ; type = 386 interrupt gate, present
; mov word ptr [edi+6], ax ; write bits 31..16 of offset
; add edi, 8 ; move up to next descriptor
; loop @b ; loop back through again until all descriptors are initialized
;; DUMP location of IDT and several of the descriptors
; mov ecx, 8
; mov eax, [offset Idtr + 2]
; mov eax, [eax]
; mov edi, 0b8000h
; call PrintDword
; mov esi, eax
; mov edi, 0b80a0h
; jmp OuterLoop
;;
;; just for fun, let's do a software interrupt to see if we correctly land in the exception handler...
; mov eax, 011111111h
; mov ebx, 022222222h
; mov ecx, 033333333h
; mov edx, 044444444h
; mov ebp, 055555555h
; mov esi, 066666666h
; mov edi, 077777777h
; push 011111111h
; push 022222222h
; push 033333333h
; int 119
mov esi,022000h ; esi = 22000
mov eax,[esi+014h] ; eax = [22014]
add esi,eax ; esi = 22000 + [22014] = Base of EFILDR.C
mov ebp,[esi+03ch] ; ebp = [22000 + [22014] + 3c] = NT Image Header for EFILDR.C
add ebp,esi
mov edi,[ebp+034h] ; edi = [[22000 + [22014] + 3c] + 30] = ImageBase
mov eax,[ebp+028h] ; eax = [[22000 + [22014] + 3c] + 24] = EntryPoint
add eax,edi ; eax = ImageBase + EntryPoint
mov dword ptr [EfiLdrOffset],eax ; Modify far jump instruction for correct entry point
mov bx,word ptr[ebp+6] ; bx = Number of sections
xor eax,eax
mov ax,word ptr[ebp+014h] ; ax = Optional Header Size
add ebp,eax
add ebp,018h ; ebp = Start of 1st Section
SectionLoop:
push esi ; Save Base of EFILDR.C
push edi ; Save ImageBase
add esi,[ebp+014h] ; esi = Base of EFILDR.C + PointerToRawData
add edi,[ebp+00ch] ; edi = ImageBase + VirtualAddress
mov ecx,[ebp+010h] ; ecs = SizeOfRawData
cld
shr ecx,2
rep movsd
pop edi ; Restore ImageBase
pop esi ; Restore Base of EFILDR.C
add bp,028h ; ebp = ebp + 028h = Pointer to next section record
dec bx
cmp bx,0
jne SectionLoop
movzx eax, word ptr [Idtr] ; get size of IDT
inc eax
add eax, dword ptr [Idtr + 2] ; add to base of IDT to get location of memory map...
push eax ; push memory map location on stack for call to EFILDR...
push eax ; push return address (useless, just for stack balance)
db 0b8h
EfiLdrOffset:
dd 000401000h ; Offset of EFILDR
; mov eax, 401000h
push eax
ret
; db "**** DEFAULT IDT ENTRY ***",0
align 02h
Halt:
INT0:
push 0h ; push error code place holder on the stack
push 0h
JmpCommonIdtEntry
; db 0e9h ; jmp 16 bit reletive
; dd commonIdtEntry - $ - 4 ; offset to jump to
INT1:
push 0h ; push error code place holder on the stack
push 1h
JmpCommonIdtEntry
INT2:
push 0h ; push error code place holder on the stack
push 2h
JmpCommonIdtEntry
INT3:
push 0h ; push error code place holder on the stack
push 3h
JmpCommonIdtEntry
INT4:
push 0h ; push error code place holder on the stack
push 4h
JmpCommonIdtEntry
INT5:
push 0h ; push error code place holder on the stack
push 5h
JmpCommonIdtEntry
INT6:
push 0h ; push error code place holder on the stack
push 6h
JmpCommonIdtEntry
INT7:
push 0h ; push error code place holder on the stack
push 7h
JmpCommonIdtEntry
INT8:
; Double fault causes an error code to be pushed so no phony push necessary
nop
nop
push 8h
JmpCommonIdtEntry
INT9:
push 0h ; push error code place holder on the stack
push 9h
JmpCommonIdtEntry
INT10:
; Invalid TSS causes an error code to be pushed so no phony push necessary
nop
nop
push 10
JmpCommonIdtEntry
INT11:
; Segment Not Present causes an error code to be pushed so no phony push necessary
nop
nop
push 11
JmpCommonIdtEntry
INT12:
; Stack fault causes an error code to be pushed so no phony push necessary
nop
nop
push 12
JmpCommonIdtEntry
INT13:
; GP fault causes an error code to be pushed so no phony push necessary
nop
nop
push 13
JmpCommonIdtEntry
INT14:
; Page fault causes an error code to be pushed so no phony push necessary
nop
nop
push 14
JmpCommonIdtEntry
INT15:
push 0h ; push error code place holder on the stack
push 15
JmpCommonIdtEntry
INT16:
push 0h ; push error code place holder on the stack
push 16
JmpCommonIdtEntry
INT17:
; Alignment check causes an error code to be pushed so no phony push necessary
nop
nop
push 17
JmpCommonIdtEntry
INT18:
push 0h ; push error code place holder on the stack
push 18
JmpCommonIdtEntry
INT19:
push 0h ; push error code place holder on the stack
push 19
JmpCommonIdtEntry
INTUnknown:
REPEAT (78h - 20)
push 0h ; push error code place holder on the stack
; push xxh ; push vector number
db 06ah
db ( $ - INTUnknown - 3 ) / 9 + 20 ; vector number
JmpCommonIdtEntry
ENDM
commonIdtEntry:
pushad
mov ebp, esp
;;
;; At this point the stack looks like this:
;;
;; eflags
;; Calling CS
;; Calling EIP
;; Error code or 0
;; Int num or 0ffh for unknown int num
;; eax
;; ecx
;; edx
;; ebx
;; esp
;; ebp
;; esi
;; edi <------- ESP, EBP
;;
call ClearScreen
mov esi, offset String1
call PrintString
mov eax, [ebp + 32] ;; move Int number into EAX
cmp eax, 19
ja PrintDefaultString
PrintExceptionString:
shl eax, 2 ;; multiply by 4 to get offset from StringTable to actual string address
add eax, offset StringTable
mov esi, [eax]
jmp PrintTheString
PrintDefaultString:
mov esi, offset IntUnknownString
; patch Int number
mov edx, eax
call A2C
mov [esi + 1], al
mov eax, edx
shr eax, 4
call A2C
mov [esi], al
PrintTheString:
call PrintString
mov esi, offset String2
call PrintString
mov eax, [ebp+44] ; CS
call PrintDword
mov al, ':'
mov byte ptr [edi], al
add edi, 2
mov eax, [ebp+40] ; EIP
call PrintDword
mov esi, offset String3
call PrintString
mov edi, 0b8140h
mov esi, offset StringEax ; eax
call PrintString
mov eax, [ebp+28]
call PrintDword
mov esi, offset StringEbx ; ebx
call PrintString
mov eax, [ebp+16]
call PrintDword
mov esi, offset StringEcx ; ecx
call PrintString
mov eax, [ebp+24]
call PrintDword
mov esi, offset StringEdx ; edx
call PrintString
mov eax, [ebp+20]
call PrintDword
mov esi, offset StringEcode ; error code
call PrintString
mov eax, [ebp+36]
call PrintDword
mov edi, 0b81e0h
mov esi, offset StringEsp ; esp
call PrintString
mov eax, [ebp+12]
call PrintDword
mov esi, offset StringEbp ; ebp
call PrintString
mov eax, [ebp+8]
call PrintDword
mov esi, offset StringEsi ; esi
call PrintString
mov eax, [ebp+4]
call PrintDword
mov esi, offset StringEdi ; edi
call PrintString
mov eax, [ebp]
call PrintDword
mov esi, offset StringEflags ; eflags
call PrintString
mov eax, [ebp+48]
call PrintDword
mov edi, 0b8320h
mov esi, ebp
add esi, 52
mov ecx, 8
OuterLoop:
push ecx
mov ecx, 8
mov edx, edi
InnerLoop:
mov eax, [esi]
call PrintDword
add esi, 4
mov al, ' '
mov [edi], al
add edi, 2
loop InnerLoop
pop ecx
add edx, 0a0h
mov edi, edx
loop OuterLoop
mov edi, 0b8960h
mov eax, [ebp+40] ; EIP
sub eax, 32 * 4
mov esi, eax ; esi = eip - 32 DWORD linear (total 64 DWORD)
mov ecx, 8
OuterLoop1:
push ecx
mov ecx, 8
mov edx, edi
InnerLoop1:
mov eax, [esi]
call PrintDword
add esi, 4
mov al, ' '
mov [edi], al
add edi, 2
loop InnerLoop1
pop ecx
add edx, 0a0h
mov edi, edx
loop OuterLoop1
; wbinvd ; Ken: this intruction does not support in early than 486 arch
@@:
jmp @b
;
; return
;
mov esp, ebp
popad
add esp, 8 ; error code and INT number
iretd
PrintString:
push eax
@@:
mov al, byte ptr [esi]
cmp al, 0
je @f
mov byte ptr [edi], al
inc esi
add edi, 2
jmp @b
@@:
pop eax
ret
;; EAX contains dword to print
;; EDI contains memory location (screen location) to print it to
PrintDword:
push ecx
push ebx
push eax
mov ecx, 8
looptop:
rol eax, 4
mov bl, al
and bl, 0fh
add bl, '0'
cmp bl, '9'
jle @f
add bl, 7
@@:
mov byte ptr [edi], bl
add edi, 2
loop looptop
;wbinvd
pop eax
pop ebx
pop ecx
ret
ClearScreen:
push eax
push ecx
mov al, ' '
mov ah, 0ch
mov edi, 0b8000h
mov ecx, 80 * 24
@@:
mov word ptr [edi], ax
add edi, 2
loop @b
mov edi, 0b8000h
pop ecx
pop eax
ret
A2C:
and al, 0fh
add al, '0'
cmp al, '9'
jle @f
add al, 7
@@:
ret
String1 db "*** INT ",0
Int0String db "00h Divide by 0 -",0
Int1String db "01h Debug exception -",0
Int2String db "02h NMI -",0
Int3String db "03h Breakpoint -",0
Int4String db "04h Overflow -",0
Int5String db "05h Bound -",0
Int6String db "06h Invalid opcode -",0
Int7String db "07h Device not available -",0
Int8String db "08h Double fault -",0
Int9String db "09h Coprocessor seg overrun (reserved) -",0
Int10String db "0Ah Invalid TSS -",0
Int11String db "0Bh Segment not present -",0
Int12String db "0Ch Stack fault -",0
Int13String db "0Dh General protection fault -",0
Int14String db "0Eh Page fault -",0
Int15String db "0Fh (Intel reserved) -",0
Int16String db "10h Floating point error -",0
Int17String db "11h Alignment check -",0
Int18String db "12h Machine check -",0
Int19String db "13h SIMD Floating-Point Exception -",0
IntUnknownString db "??h Unknown interrupt -",0
StringTable dd offset Int0String, offset Int1String, offset Int2String, offset Int3String,
offset Int4String, offset Int5String, offset Int6String, offset Int7String,
offset Int8String, offset Int9String, offset Int10String, offset Int11String,
offset Int12String, offset Int13String, offset Int14String, offset Int15String,
offset Int16String, offset Int17String, offset Int18String, offset Int19String
String2 db " HALT!! *** (",0
String3 db ")",0
StringEax db "EAX=",0
StringEbx db " EBX=",0
StringEcx db " ECX=",0
StringEdx db " EDX=",0
StringEcode db " ECODE=",0
StringEsp db "ESP=",0
StringEbp db " EBP=",0
StringEsi db " ESI=",0
StringEdi db " EDI=",0
StringEflags db " EFLAGS=",0
Idtr df 0
org 21ffeh
BlockSignature:
dw 0aa55h
end
| 28.696398 | 132 | 0.520622 |
71d677ee8f9582c78491e6165f367b24778bc371 | 279,342 | asm | Assembly | usertests.asm | thr0m3l/easy-xv6 | d7b16933100635cfd786640ab4d757e555ebdbd0 | [
"MIT-0"
] | null | null | null | usertests.asm | thr0m3l/easy-xv6 | d7b16933100635cfd786640ab4d757e555ebdbd0 | [
"MIT-0"
] | null | null | null | usertests.asm | thr0m3l/easy-xv6 | d7b16933100635cfd786640ab4d757e555ebdbd0 | [
"MIT-0"
] | null | null | null |
_usertests: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
return randstate;
}
int
main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc push -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 51 push %ecx
e: 83 ec 0c sub $0xc,%esp
printf(1, "usertests starting\n");
11: 68 96 4d 00 00 push $0x4d96
16: 6a 01 push $0x1
18: e8 63 3a 00 00 call 3a80 <printf>
if(open("usertests.ran", 0) >= 0){
1d: 59 pop %ecx
1e: 58 pop %eax
1f: 6a 00 push $0x0
21: 68 aa 4d 00 00 push $0x4daa
26: e8 08 39 00 00 call 3933 <open>
2b: 83 c4 10 add $0x10,%esp
2e: 85 c0 test %eax,%eax
30: 78 13 js 45 <main+0x45>
printf(1, "already ran user tests -- rebuild fs.img\n");
32: 52 push %edx
33: 52 push %edx
34: 68 14 55 00 00 push $0x5514
39: 6a 01 push $0x1
3b: e8 40 3a 00 00 call 3a80 <printf>
exit();
40: e8 ae 38 00 00 call 38f3 <exit>
}
close(open("usertests.ran", O_CREATE));
45: 50 push %eax
46: 50 push %eax
47: 68 00 02 00 00 push $0x200
4c: 68 aa 4d 00 00 push $0x4daa
51: e8 dd 38 00 00 call 3933 <open>
56: 89 04 24 mov %eax,(%esp)
59: e8 bd 38 00 00 call 391b <close>
argptest();
5e: e8 8d 35 00 00 call 35f0 <argptest>
createdelete();
63: e8 b8 11 00 00 call 1220 <createdelete>
linkunlink();
68: e8 73 1a 00 00 call 1ae0 <linkunlink>
concreate();
6d: e8 6e 17 00 00 call 17e0 <concreate>
fourfiles();
72: e8 a9 0f 00 00 call 1020 <fourfiles>
sharedfd();
77: e8 e4 0d 00 00 call e60 <sharedfd>
bigargtest();
7c: e8 2f 32 00 00 call 32b0 <bigargtest>
bigwrite();
81: e8 7a 23 00 00 call 2400 <bigwrite>
bigargtest();
86: e8 25 32 00 00 call 32b0 <bigargtest>
bsstest();
8b: e8 b0 31 00 00 call 3240 <bsstest>
sbrktest();
90: e8 ab 2c 00 00 call 2d40 <sbrktest>
validatetest();
95: e8 f6 30 00 00 call 3190 <validatetest>
opentest();
9a: e8 61 03 00 00 call 400 <opentest>
writetest();
9f: e8 ec 03 00 00 call 490 <writetest>
writetest1();
a4: e8 c7 05 00 00 call 670 <writetest1>
createtest();
a9: e8 92 07 00 00 call 840 <createtest>
openiputtest();
ae: e8 4d 02 00 00 call 300 <openiputtest>
exitiputtest();
b3: e8 48 01 00 00 call 200 <exitiputtest>
iputtest();
b8: e8 63 00 00 00 call 120 <iputtest>
mem();
bd: e8 ce 0c 00 00 call d90 <mem>
pipe1();
c2: e8 59 09 00 00 call a20 <pipe1>
preempt();
c7: e8 e4 0a 00 00 call bb0 <preempt>
exitwait();
cc: e8 3f 0c 00 00 call d10 <exitwait>
rmdot();
d1: e8 1a 27 00 00 call 27f0 <rmdot>
fourteen();
d6: e8 d5 25 00 00 call 26b0 <fourteen>
bigfile();
db: e8 00 24 00 00 call 24e0 <bigfile>
subdir();
e0: e8 3b 1c 00 00 call 1d20 <subdir>
linktest();
e5: e8 e6 14 00 00 call 15d0 <linktest>
unlinkread();
ea: e8 51 13 00 00 call 1440 <unlinkread>
dirfile();
ef: e8 7c 28 00 00 call 2970 <dirfile>
iref();
f4: e8 77 2a 00 00 call 2b70 <iref>
forktest();
f9: e8 92 2b 00 00 call 2c90 <forktest>
bigdir(); // slow
fe: e8 ed 1a 00 00 call 1bf0 <bigdir>
uio();
103: e8 78 34 00 00 call 3580 <uio>
exectest();
108: e8 c3 08 00 00 call 9d0 <exectest>
exit();
10d: e8 e1 37 00 00 call 38f3 <exit>
112: 66 90 xchg %ax,%ax
114: 66 90 xchg %ax,%ax
116: 66 90 xchg %ax,%ax
118: 66 90 xchg %ax,%ax
11a: 66 90 xchg %ax,%ax
11c: 66 90 xchg %ax,%ax
11e: 66 90 xchg %ax,%ax
00000120 <iputtest>:
{
120: 55 push %ebp
121: 89 e5 mov %esp,%ebp
123: 83 ec 10 sub $0x10,%esp
printf(stdout, "iput test\n");
126: 68 3c 3e 00 00 push $0x3e3c
12b: ff 35 ac 5e 00 00 push 0x5eac
131: e8 4a 39 00 00 call 3a80 <printf>
if(mkdir("iputdir") < 0){
136: c7 04 24 cf 3d 00 00 movl $0x3dcf,(%esp)
13d: e8 19 38 00 00 call 395b <mkdir>
142: 83 c4 10 add $0x10,%esp
145: 85 c0 test %eax,%eax
147: 78 58 js 1a1 <iputtest+0x81>
if(chdir("iputdir") < 0){
149: 83 ec 0c sub $0xc,%esp
14c: 68 cf 3d 00 00 push $0x3dcf
151: e8 0d 38 00 00 call 3963 <chdir>
156: 83 c4 10 add $0x10,%esp
159: 85 c0 test %eax,%eax
15b: 0f 88 85 00 00 00 js 1e6 <iputtest+0xc6>
if(unlink("../iputdir") < 0){
161: 83 ec 0c sub $0xc,%esp
164: 68 cc 3d 00 00 push $0x3dcc
169: e8 d5 37 00 00 call 3943 <unlink>
16e: 83 c4 10 add $0x10,%esp
171: 85 c0 test %eax,%eax
173: 78 5a js 1cf <iputtest+0xaf>
if(chdir("/") < 0){
175: 83 ec 0c sub $0xc,%esp
178: 68 f1 3d 00 00 push $0x3df1
17d: e8 e1 37 00 00 call 3963 <chdir>
182: 83 c4 10 add $0x10,%esp
185: 85 c0 test %eax,%eax
187: 78 2f js 1b8 <iputtest+0x98>
printf(stdout, "iput test ok\n");
189: 83 ec 08 sub $0x8,%esp
18c: 68 74 3e 00 00 push $0x3e74
191: ff 35 ac 5e 00 00 push 0x5eac
197: e8 e4 38 00 00 call 3a80 <printf>
}
19c: 83 c4 10 add $0x10,%esp
19f: c9 leave
1a0: c3 ret
printf(stdout, "mkdir failed\n");
1a1: 50 push %eax
1a2: 50 push %eax
1a3: 68 a8 3d 00 00 push $0x3da8
1a8: ff 35 ac 5e 00 00 push 0x5eac
1ae: e8 cd 38 00 00 call 3a80 <printf>
exit();
1b3: e8 3b 37 00 00 call 38f3 <exit>
printf(stdout, "chdir / failed\n");
1b8: 50 push %eax
1b9: 50 push %eax
1ba: 68 f3 3d 00 00 push $0x3df3
1bf: ff 35 ac 5e 00 00 push 0x5eac
1c5: e8 b6 38 00 00 call 3a80 <printf>
exit();
1ca: e8 24 37 00 00 call 38f3 <exit>
printf(stdout, "unlink ../iputdir failed\n");
1cf: 52 push %edx
1d0: 52 push %edx
1d1: 68 d7 3d 00 00 push $0x3dd7
1d6: ff 35 ac 5e 00 00 push 0x5eac
1dc: e8 9f 38 00 00 call 3a80 <printf>
exit();
1e1: e8 0d 37 00 00 call 38f3 <exit>
printf(stdout, "chdir iputdir failed\n");
1e6: 51 push %ecx
1e7: 51 push %ecx
1e8: 68 b6 3d 00 00 push $0x3db6
1ed: ff 35 ac 5e 00 00 push 0x5eac
1f3: e8 88 38 00 00 call 3a80 <printf>
exit();
1f8: e8 f6 36 00 00 call 38f3 <exit>
1fd: 8d 76 00 lea 0x0(%esi),%esi
00000200 <exitiputtest>:
{
200: 55 push %ebp
201: 89 e5 mov %esp,%ebp
203: 83 ec 10 sub $0x10,%esp
printf(stdout, "exitiput test\n");
206: 68 03 3e 00 00 push $0x3e03
20b: ff 35 ac 5e 00 00 push 0x5eac
211: e8 6a 38 00 00 call 3a80 <printf>
pid = fork();
216: e8 d0 36 00 00 call 38eb <fork>
if(pid < 0){
21b: 83 c4 10 add $0x10,%esp
21e: 85 c0 test %eax,%eax
220: 0f 88 8a 00 00 00 js 2b0 <exitiputtest+0xb0>
if(pid == 0){
226: 75 50 jne 278 <exitiputtest+0x78>
if(mkdir("iputdir") < 0){
228: 83 ec 0c sub $0xc,%esp
22b: 68 cf 3d 00 00 push $0x3dcf
230: e8 26 37 00 00 call 395b <mkdir>
235: 83 c4 10 add $0x10,%esp
238: 85 c0 test %eax,%eax
23a: 0f 88 87 00 00 00 js 2c7 <exitiputtest+0xc7>
if(chdir("iputdir") < 0){
240: 83 ec 0c sub $0xc,%esp
243: 68 cf 3d 00 00 push $0x3dcf
248: e8 16 37 00 00 call 3963 <chdir>
24d: 83 c4 10 add $0x10,%esp
250: 85 c0 test %eax,%eax
252: 0f 88 86 00 00 00 js 2de <exitiputtest+0xde>
if(unlink("../iputdir") < 0){
258: 83 ec 0c sub $0xc,%esp
25b: 68 cc 3d 00 00 push $0x3dcc
260: e8 de 36 00 00 call 3943 <unlink>
265: 83 c4 10 add $0x10,%esp
268: 85 c0 test %eax,%eax
26a: 78 2c js 298 <exitiputtest+0x98>
exit();
26c: e8 82 36 00 00 call 38f3 <exit>
271: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
wait();
278: e8 7e 36 00 00 call 38fb <wait>
printf(stdout, "exitiput test ok\n");
27d: 83 ec 08 sub $0x8,%esp
280: 68 26 3e 00 00 push $0x3e26
285: ff 35 ac 5e 00 00 push 0x5eac
28b: e8 f0 37 00 00 call 3a80 <printf>
}
290: 83 c4 10 add $0x10,%esp
293: c9 leave
294: c3 ret
295: 8d 76 00 lea 0x0(%esi),%esi
printf(stdout, "unlink ../iputdir failed\n");
298: 83 ec 08 sub $0x8,%esp
29b: 68 d7 3d 00 00 push $0x3dd7
2a0: ff 35 ac 5e 00 00 push 0x5eac
2a6: e8 d5 37 00 00 call 3a80 <printf>
exit();
2ab: e8 43 36 00 00 call 38f3 <exit>
printf(stdout, "fork failed\n");
2b0: 51 push %ecx
2b1: 51 push %ecx
2b2: 68 e9 4c 00 00 push $0x4ce9
2b7: ff 35 ac 5e 00 00 push 0x5eac
2bd: e8 be 37 00 00 call 3a80 <printf>
exit();
2c2: e8 2c 36 00 00 call 38f3 <exit>
printf(stdout, "mkdir failed\n");
2c7: 52 push %edx
2c8: 52 push %edx
2c9: 68 a8 3d 00 00 push $0x3da8
2ce: ff 35 ac 5e 00 00 push 0x5eac
2d4: e8 a7 37 00 00 call 3a80 <printf>
exit();
2d9: e8 15 36 00 00 call 38f3 <exit>
printf(stdout, "child chdir failed\n");
2de: 50 push %eax
2df: 50 push %eax
2e0: 68 12 3e 00 00 push $0x3e12
2e5: ff 35 ac 5e 00 00 push 0x5eac
2eb: e8 90 37 00 00 call 3a80 <printf>
exit();
2f0: e8 fe 35 00 00 call 38f3 <exit>
2f5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
2fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000300 <openiputtest>:
{
300: 55 push %ebp
301: 89 e5 mov %esp,%ebp
303: 83 ec 10 sub $0x10,%esp
printf(stdout, "openiput test\n");
306: 68 38 3e 00 00 push $0x3e38
30b: ff 35 ac 5e 00 00 push 0x5eac
311: e8 6a 37 00 00 call 3a80 <printf>
if(mkdir("oidir") < 0){
316: c7 04 24 47 3e 00 00 movl $0x3e47,(%esp)
31d: e8 39 36 00 00 call 395b <mkdir>
322: 83 c4 10 add $0x10,%esp
325: 85 c0 test %eax,%eax
327: 0f 88 9f 00 00 00 js 3cc <openiputtest+0xcc>
pid = fork();
32d: e8 b9 35 00 00 call 38eb <fork>
if(pid < 0){
332: 85 c0 test %eax,%eax
334: 78 7f js 3b5 <openiputtest+0xb5>
if(pid == 0){
336: 75 38 jne 370 <openiputtest+0x70>
int fd = open("oidir", O_RDWR);
338: 83 ec 08 sub $0x8,%esp
33b: 6a 02 push $0x2
33d: 68 47 3e 00 00 push $0x3e47
342: e8 ec 35 00 00 call 3933 <open>
if(fd >= 0){
347: 83 c4 10 add $0x10,%esp
34a: 85 c0 test %eax,%eax
34c: 78 62 js 3b0 <openiputtest+0xb0>
printf(stdout, "open directory for write succeeded\n");
34e: 83 ec 08 sub $0x8,%esp
351: 68 cc 4d 00 00 push $0x4dcc
356: ff 35 ac 5e 00 00 push 0x5eac
35c: e8 1f 37 00 00 call 3a80 <printf>
exit();
361: e8 8d 35 00 00 call 38f3 <exit>
366: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
36d: 8d 76 00 lea 0x0(%esi),%esi
sleep(1);
370: 83 ec 0c sub $0xc,%esp
373: 6a 01 push $0x1
375: e8 09 36 00 00 call 3983 <sleep>
if(unlink("oidir") != 0){
37a: c7 04 24 47 3e 00 00 movl $0x3e47,(%esp)
381: e8 bd 35 00 00 call 3943 <unlink>
386: 83 c4 10 add $0x10,%esp
389: 85 c0 test %eax,%eax
38b: 75 56 jne 3e3 <openiputtest+0xe3>
wait();
38d: e8 69 35 00 00 call 38fb <wait>
printf(stdout, "openiput test ok\n");
392: 83 ec 08 sub $0x8,%esp
395: 68 70 3e 00 00 push $0x3e70
39a: ff 35 ac 5e 00 00 push 0x5eac
3a0: e8 db 36 00 00 call 3a80 <printf>
}
3a5: 83 c4 10 add $0x10,%esp
3a8: c9 leave
3a9: c3 ret
3aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
exit();
3b0: e8 3e 35 00 00 call 38f3 <exit>
printf(stdout, "fork failed\n");
3b5: 52 push %edx
3b6: 52 push %edx
3b7: 68 e9 4c 00 00 push $0x4ce9
3bc: ff 35 ac 5e 00 00 push 0x5eac
3c2: e8 b9 36 00 00 call 3a80 <printf>
exit();
3c7: e8 27 35 00 00 call 38f3 <exit>
printf(stdout, "mkdir oidir failed\n");
3cc: 51 push %ecx
3cd: 51 push %ecx
3ce: 68 4d 3e 00 00 push $0x3e4d
3d3: ff 35 ac 5e 00 00 push 0x5eac
3d9: e8 a2 36 00 00 call 3a80 <printf>
exit();
3de: e8 10 35 00 00 call 38f3 <exit>
printf(stdout, "unlink failed\n");
3e3: 50 push %eax
3e4: 50 push %eax
3e5: 68 61 3e 00 00 push $0x3e61
3ea: ff 35 ac 5e 00 00 push 0x5eac
3f0: e8 8b 36 00 00 call 3a80 <printf>
exit();
3f5: e8 f9 34 00 00 call 38f3 <exit>
3fa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000400 <opentest>:
{
400: 55 push %ebp
401: 89 e5 mov %esp,%ebp
403: 83 ec 10 sub $0x10,%esp
printf(stdout, "open test\n");
406: 68 82 3e 00 00 push $0x3e82
40b: ff 35 ac 5e 00 00 push 0x5eac
411: e8 6a 36 00 00 call 3a80 <printf>
fd = open("echo", 0);
416: 58 pop %eax
417: 5a pop %edx
418: 6a 00 push $0x0
41a: 68 8d 3e 00 00 push $0x3e8d
41f: e8 0f 35 00 00 call 3933 <open>
if(fd < 0){
424: 83 c4 10 add $0x10,%esp
427: 85 c0 test %eax,%eax
429: 78 36 js 461 <opentest+0x61>
close(fd);
42b: 83 ec 0c sub $0xc,%esp
42e: 50 push %eax
42f: e8 e7 34 00 00 call 391b <close>
fd = open("doesnotexist", 0);
434: 5a pop %edx
435: 59 pop %ecx
436: 6a 00 push $0x0
438: 68 a5 3e 00 00 push $0x3ea5
43d: e8 f1 34 00 00 call 3933 <open>
if(fd >= 0){
442: 83 c4 10 add $0x10,%esp
445: 85 c0 test %eax,%eax
447: 79 2f jns 478 <opentest+0x78>
printf(stdout, "open test ok\n");
449: 83 ec 08 sub $0x8,%esp
44c: 68 d0 3e 00 00 push $0x3ed0
451: ff 35 ac 5e 00 00 push 0x5eac
457: e8 24 36 00 00 call 3a80 <printf>
}
45c: 83 c4 10 add $0x10,%esp
45f: c9 leave
460: c3 ret
printf(stdout, "open echo failed!\n");
461: 50 push %eax
462: 50 push %eax
463: 68 92 3e 00 00 push $0x3e92
468: ff 35 ac 5e 00 00 push 0x5eac
46e: e8 0d 36 00 00 call 3a80 <printf>
exit();
473: e8 7b 34 00 00 call 38f3 <exit>
printf(stdout, "open doesnotexist succeeded!\n");
478: 50 push %eax
479: 50 push %eax
47a: 68 b2 3e 00 00 push $0x3eb2
47f: ff 35 ac 5e 00 00 push 0x5eac
485: e8 f6 35 00 00 call 3a80 <printf>
exit();
48a: e8 64 34 00 00 call 38f3 <exit>
48f: 90 nop
00000490 <writetest>:
{
490: 55 push %ebp
491: 89 e5 mov %esp,%ebp
493: 56 push %esi
494: 53 push %ebx
printf(stdout, "small file test\n");
495: 83 ec 08 sub $0x8,%esp
498: 68 de 3e 00 00 push $0x3ede
49d: ff 35 ac 5e 00 00 push 0x5eac
4a3: e8 d8 35 00 00 call 3a80 <printf>
fd = open("small", O_CREATE|O_RDWR);
4a8: 58 pop %eax
4a9: 5a pop %edx
4aa: 68 02 02 00 00 push $0x202
4af: 68 ef 3e 00 00 push $0x3eef
4b4: e8 7a 34 00 00 call 3933 <open>
if(fd >= 0){
4b9: 83 c4 10 add $0x10,%esp
4bc: 85 c0 test %eax,%eax
4be: 0f 88 88 01 00 00 js 64c <writetest+0x1bc>
printf(stdout, "creat small succeeded; ok\n");
4c4: 83 ec 08 sub $0x8,%esp
4c7: 89 c6 mov %eax,%esi
for(i = 0; i < 100; i++){
4c9: 31 db xor %ebx,%ebx
printf(stdout, "creat small succeeded; ok\n");
4cb: 68 f5 3e 00 00 push $0x3ef5
4d0: ff 35 ac 5e 00 00 push 0x5eac
4d6: e8 a5 35 00 00 call 3a80 <printf>
4db: 83 c4 10 add $0x10,%esp
4de: 66 90 xchg %ax,%ax
if(write(fd, "aaaaaaaaaa", 10) != 10){
4e0: 83 ec 04 sub $0x4,%esp
4e3: 6a 0a push $0xa
4e5: 68 2c 3f 00 00 push $0x3f2c
4ea: 56 push %esi
4eb: e8 23 34 00 00 call 3913 <write>
4f0: 83 c4 10 add $0x10,%esp
4f3: 83 f8 0a cmp $0xa,%eax
4f6: 0f 85 d9 00 00 00 jne 5d5 <writetest+0x145>
if(write(fd, "bbbbbbbbbb", 10) != 10){
4fc: 83 ec 04 sub $0x4,%esp
4ff: 6a 0a push $0xa
501: 68 37 3f 00 00 push $0x3f37
506: 56 push %esi
507: e8 07 34 00 00 call 3913 <write>
50c: 83 c4 10 add $0x10,%esp
50f: 83 f8 0a cmp $0xa,%eax
512: 0f 85 d6 00 00 00 jne 5ee <writetest+0x15e>
for(i = 0; i < 100; i++){
518: 83 c3 01 add $0x1,%ebx
51b: 83 fb 64 cmp $0x64,%ebx
51e: 75 c0 jne 4e0 <writetest+0x50>
printf(stdout, "writes ok\n");
520: 83 ec 08 sub $0x8,%esp
523: 68 42 3f 00 00 push $0x3f42
528: ff 35 ac 5e 00 00 push 0x5eac
52e: e8 4d 35 00 00 call 3a80 <printf>
close(fd);
533: 89 34 24 mov %esi,(%esp)
536: e8 e0 33 00 00 call 391b <close>
fd = open("small", O_RDONLY);
53b: 5b pop %ebx
53c: 5e pop %esi
53d: 6a 00 push $0x0
53f: 68 ef 3e 00 00 push $0x3eef
544: e8 ea 33 00 00 call 3933 <open>
if(fd >= 0){
549: 83 c4 10 add $0x10,%esp
fd = open("small", O_RDONLY);
54c: 89 c3 mov %eax,%ebx
if(fd >= 0){
54e: 85 c0 test %eax,%eax
550: 0f 88 b1 00 00 00 js 607 <writetest+0x177>
printf(stdout, "open small succeeded ok\n");
556: 83 ec 08 sub $0x8,%esp
559: 68 4d 3f 00 00 push $0x3f4d
55e: ff 35 ac 5e 00 00 push 0x5eac
564: e8 17 35 00 00 call 3a80 <printf>
i = read(fd, buf, 2000);
569: 83 c4 0c add $0xc,%esp
56c: 68 d0 07 00 00 push $0x7d0
571: 68 00 86 00 00 push $0x8600
576: 53 push %ebx
577: e8 8f 33 00 00 call 390b <read>
if(i == 2000){
57c: 83 c4 10 add $0x10,%esp
57f: 3d d0 07 00 00 cmp $0x7d0,%eax
584: 0f 85 94 00 00 00 jne 61e <writetest+0x18e>
printf(stdout, "read succeeded ok\n");
58a: 83 ec 08 sub $0x8,%esp
58d: 68 81 3f 00 00 push $0x3f81
592: ff 35 ac 5e 00 00 push 0x5eac
598: e8 e3 34 00 00 call 3a80 <printf>
close(fd);
59d: 89 1c 24 mov %ebx,(%esp)
5a0: e8 76 33 00 00 call 391b <close>
if(unlink("small") < 0){
5a5: c7 04 24 ef 3e 00 00 movl $0x3eef,(%esp)
5ac: e8 92 33 00 00 call 3943 <unlink>
5b1: 83 c4 10 add $0x10,%esp
5b4: 85 c0 test %eax,%eax
5b6: 78 7d js 635 <writetest+0x1a5>
printf(stdout, "small file test ok\n");
5b8: 83 ec 08 sub $0x8,%esp
5bb: 68 a9 3f 00 00 push $0x3fa9
5c0: ff 35 ac 5e 00 00 push 0x5eac
5c6: e8 b5 34 00 00 call 3a80 <printf>
}
5cb: 83 c4 10 add $0x10,%esp
5ce: 8d 65 f8 lea -0x8(%ebp),%esp
5d1: 5b pop %ebx
5d2: 5e pop %esi
5d3: 5d pop %ebp
5d4: c3 ret
printf(stdout, "error: write aa %d new file failed\n", i);
5d5: 83 ec 04 sub $0x4,%esp
5d8: 53 push %ebx
5d9: 68 f0 4d 00 00 push $0x4df0
5de: ff 35 ac 5e 00 00 push 0x5eac
5e4: e8 97 34 00 00 call 3a80 <printf>
exit();
5e9: e8 05 33 00 00 call 38f3 <exit>
printf(stdout, "error: write bb %d new file failed\n", i);
5ee: 83 ec 04 sub $0x4,%esp
5f1: 53 push %ebx
5f2: 68 14 4e 00 00 push $0x4e14
5f7: ff 35 ac 5e 00 00 push 0x5eac
5fd: e8 7e 34 00 00 call 3a80 <printf>
exit();
602: e8 ec 32 00 00 call 38f3 <exit>
printf(stdout, "error: open small failed!\n");
607: 51 push %ecx
608: 51 push %ecx
609: 68 66 3f 00 00 push $0x3f66
60e: ff 35 ac 5e 00 00 push 0x5eac
614: e8 67 34 00 00 call 3a80 <printf>
exit();
619: e8 d5 32 00 00 call 38f3 <exit>
printf(stdout, "read failed\n");
61e: 52 push %edx
61f: 52 push %edx
620: 68 ad 42 00 00 push $0x42ad
625: ff 35 ac 5e 00 00 push 0x5eac
62b: e8 50 34 00 00 call 3a80 <printf>
exit();
630: e8 be 32 00 00 call 38f3 <exit>
printf(stdout, "unlink small failed\n");
635: 50 push %eax
636: 50 push %eax
637: 68 94 3f 00 00 push $0x3f94
63c: ff 35 ac 5e 00 00 push 0x5eac
642: e8 39 34 00 00 call 3a80 <printf>
exit();
647: e8 a7 32 00 00 call 38f3 <exit>
printf(stdout, "error: creat small failed!\n");
64c: 50 push %eax
64d: 50 push %eax
64e: 68 10 3f 00 00 push $0x3f10
653: ff 35 ac 5e 00 00 push 0x5eac
659: e8 22 34 00 00 call 3a80 <printf>
exit();
65e: e8 90 32 00 00 call 38f3 <exit>
663: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
66a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000670 <writetest1>:
{
670: 55 push %ebp
671: 89 e5 mov %esp,%ebp
673: 56 push %esi
674: 53 push %ebx
printf(stdout, "big files test\n");
675: 83 ec 08 sub $0x8,%esp
678: 68 bd 3f 00 00 push $0x3fbd
67d: ff 35 ac 5e 00 00 push 0x5eac
683: e8 f8 33 00 00 call 3a80 <printf>
fd = open("big", O_CREATE|O_RDWR);
688: 58 pop %eax
689: 5a pop %edx
68a: 68 02 02 00 00 push $0x202
68f: 68 37 40 00 00 push $0x4037
694: e8 9a 32 00 00 call 3933 <open>
if(fd < 0){
699: 83 c4 10 add $0x10,%esp
69c: 85 c0 test %eax,%eax
69e: 0f 88 61 01 00 00 js 805 <writetest1+0x195>
6a4: 89 c6 mov %eax,%esi
for(i = 0; i < MAXFILE; i++){
6a6: 31 db xor %ebx,%ebx
6a8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
6af: 90 nop
if(write(fd, buf, 512) != 512){
6b0: 83 ec 04 sub $0x4,%esp
((int*)buf)[0] = i;
6b3: 89 1d 00 86 00 00 mov %ebx,0x8600
if(write(fd, buf, 512) != 512){
6b9: 68 00 02 00 00 push $0x200
6be: 68 00 86 00 00 push $0x8600
6c3: 56 push %esi
6c4: e8 4a 32 00 00 call 3913 <write>
6c9: 83 c4 10 add $0x10,%esp
6cc: 3d 00 02 00 00 cmp $0x200,%eax
6d1: 0f 85 b3 00 00 00 jne 78a <writetest1+0x11a>
for(i = 0; i < MAXFILE; i++){
6d7: 83 c3 01 add $0x1,%ebx
6da: 81 fb 8c 00 00 00 cmp $0x8c,%ebx
6e0: 75 ce jne 6b0 <writetest1+0x40>
close(fd);
6e2: 83 ec 0c sub $0xc,%esp
6e5: 56 push %esi
6e6: e8 30 32 00 00 call 391b <close>
fd = open("big", O_RDONLY);
6eb: 5b pop %ebx
6ec: 5e pop %esi
6ed: 6a 00 push $0x0
6ef: 68 37 40 00 00 push $0x4037
6f4: e8 3a 32 00 00 call 3933 <open>
if(fd < 0){
6f9: 83 c4 10 add $0x10,%esp
fd = open("big", O_RDONLY);
6fc: 89 c3 mov %eax,%ebx
if(fd < 0){
6fe: 85 c0 test %eax,%eax
700: 0f 88 e8 00 00 00 js 7ee <writetest1+0x17e>
n = 0;
706: 31 f6 xor %esi,%esi
708: eb 1d jmp 727 <writetest1+0xb7>
70a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
} else if(i != 512){
710: 3d 00 02 00 00 cmp $0x200,%eax
715: 0f 85 9f 00 00 00 jne 7ba <writetest1+0x14a>
if(((int*)buf)[0] != n){
71b: a1 00 86 00 00 mov 0x8600,%eax
720: 39 f0 cmp %esi,%eax
722: 75 7f jne 7a3 <writetest1+0x133>
n++;
724: 83 c6 01 add $0x1,%esi
i = read(fd, buf, 512);
727: 83 ec 04 sub $0x4,%esp
72a: 68 00 02 00 00 push $0x200
72f: 68 00 86 00 00 push $0x8600
734: 53 push %ebx
735: e8 d1 31 00 00 call 390b <read>
if(i == 0){
73a: 83 c4 10 add $0x10,%esp
73d: 85 c0 test %eax,%eax
73f: 75 cf jne 710 <writetest1+0xa0>
if(n == MAXFILE - 1){
741: 81 fe 8b 00 00 00 cmp $0x8b,%esi
747: 0f 84 86 00 00 00 je 7d3 <writetest1+0x163>
close(fd);
74d: 83 ec 0c sub $0xc,%esp
750: 53 push %ebx
751: e8 c5 31 00 00 call 391b <close>
if(unlink("big") < 0){
756: c7 04 24 37 40 00 00 movl $0x4037,(%esp)
75d: e8 e1 31 00 00 call 3943 <unlink>
762: 83 c4 10 add $0x10,%esp
765: 85 c0 test %eax,%eax
767: 0f 88 af 00 00 00 js 81c <writetest1+0x1ac>
printf(stdout, "big files ok\n");
76d: 83 ec 08 sub $0x8,%esp
770: 68 5e 40 00 00 push $0x405e
775: ff 35 ac 5e 00 00 push 0x5eac
77b: e8 00 33 00 00 call 3a80 <printf>
}
780: 83 c4 10 add $0x10,%esp
783: 8d 65 f8 lea -0x8(%ebp),%esp
786: 5b pop %ebx
787: 5e pop %esi
788: 5d pop %ebp
789: c3 ret
printf(stdout, "error: write big file failed\n", i);
78a: 83 ec 04 sub $0x4,%esp
78d: 53 push %ebx
78e: 68 e7 3f 00 00 push $0x3fe7
793: ff 35 ac 5e 00 00 push 0x5eac
799: e8 e2 32 00 00 call 3a80 <printf>
exit();
79e: e8 50 31 00 00 call 38f3 <exit>
printf(stdout, "read content of block %d is %d\n",
7a3: 50 push %eax
7a4: 56 push %esi
7a5: 68 38 4e 00 00 push $0x4e38
7aa: ff 35 ac 5e 00 00 push 0x5eac
7b0: e8 cb 32 00 00 call 3a80 <printf>
exit();
7b5: e8 39 31 00 00 call 38f3 <exit>
printf(stdout, "read failed %d\n", i);
7ba: 83 ec 04 sub $0x4,%esp
7bd: 50 push %eax
7be: 68 3b 40 00 00 push $0x403b
7c3: ff 35 ac 5e 00 00 push 0x5eac
7c9: e8 b2 32 00 00 call 3a80 <printf>
exit();
7ce: e8 20 31 00 00 call 38f3 <exit>
printf(stdout, "read only %d blocks from big", n);
7d3: 52 push %edx
7d4: 68 8b 00 00 00 push $0x8b
7d9: 68 1e 40 00 00 push $0x401e
7de: ff 35 ac 5e 00 00 push 0x5eac
7e4: e8 97 32 00 00 call 3a80 <printf>
exit();
7e9: e8 05 31 00 00 call 38f3 <exit>
printf(stdout, "error: open big failed!\n");
7ee: 51 push %ecx
7ef: 51 push %ecx
7f0: 68 05 40 00 00 push $0x4005
7f5: ff 35 ac 5e 00 00 push 0x5eac
7fb: e8 80 32 00 00 call 3a80 <printf>
exit();
800: e8 ee 30 00 00 call 38f3 <exit>
printf(stdout, "error: creat big failed!\n");
805: 50 push %eax
806: 50 push %eax
807: 68 cd 3f 00 00 push $0x3fcd
80c: ff 35 ac 5e 00 00 push 0x5eac
812: e8 69 32 00 00 call 3a80 <printf>
exit();
817: e8 d7 30 00 00 call 38f3 <exit>
printf(stdout, "unlink big failed\n");
81c: 50 push %eax
81d: 50 push %eax
81e: 68 4b 40 00 00 push $0x404b
823: ff 35 ac 5e 00 00 push 0x5eac
829: e8 52 32 00 00 call 3a80 <printf>
exit();
82e: e8 c0 30 00 00 call 38f3 <exit>
833: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
83a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000840 <createtest>:
{
840: 55 push %ebp
841: 89 e5 mov %esp,%ebp
843: 53 push %ebx
name[2] = '\0';
844: bb 30 00 00 00 mov $0x30,%ebx
{
849: 83 ec 0c sub $0xc,%esp
printf(stdout, "many creates, followed by unlink test\n");
84c: 68 58 4e 00 00 push $0x4e58
851: ff 35 ac 5e 00 00 push 0x5eac
857: e8 24 32 00 00 call 3a80 <printf>
name[0] = 'a';
85c: c6 05 f0 85 00 00 61 movb $0x61,0x85f0
name[2] = '\0';
863: 83 c4 10 add $0x10,%esp
866: c6 05 f2 85 00 00 00 movb $0x0,0x85f2
for(i = 0; i < 52; i++){
86d: 8d 76 00 lea 0x0(%esi),%esi
fd = open(name, O_CREATE|O_RDWR);
870: 83 ec 08 sub $0x8,%esp
name[1] = '0' + i;
873: 88 1d f1 85 00 00 mov %bl,0x85f1
for(i = 0; i < 52; i++){
879: 83 c3 01 add $0x1,%ebx
fd = open(name, O_CREATE|O_RDWR);
87c: 68 02 02 00 00 push $0x202
881: 68 f0 85 00 00 push $0x85f0
886: e8 a8 30 00 00 call 3933 <open>
close(fd);
88b: 89 04 24 mov %eax,(%esp)
88e: e8 88 30 00 00 call 391b <close>
for(i = 0; i < 52; i++){
893: 83 c4 10 add $0x10,%esp
896: 80 fb 64 cmp $0x64,%bl
899: 75 d5 jne 870 <createtest+0x30>
name[0] = 'a';
89b: c6 05 f0 85 00 00 61 movb $0x61,0x85f0
name[2] = '\0';
8a2: bb 30 00 00 00 mov $0x30,%ebx
8a7: c6 05 f2 85 00 00 00 movb $0x0,0x85f2
for(i = 0; i < 52; i++){
8ae: 66 90 xchg %ax,%ax
unlink(name);
8b0: 83 ec 0c sub $0xc,%esp
name[1] = '0' + i;
8b3: 88 1d f1 85 00 00 mov %bl,0x85f1
for(i = 0; i < 52; i++){
8b9: 83 c3 01 add $0x1,%ebx
unlink(name);
8bc: 68 f0 85 00 00 push $0x85f0
8c1: e8 7d 30 00 00 call 3943 <unlink>
for(i = 0; i < 52; i++){
8c6: 83 c4 10 add $0x10,%esp
8c9: 80 fb 64 cmp $0x64,%bl
8cc: 75 e2 jne 8b0 <createtest+0x70>
printf(stdout, "many creates, followed by unlink; ok\n");
8ce: 83 ec 08 sub $0x8,%esp
8d1: 68 80 4e 00 00 push $0x4e80
8d6: ff 35 ac 5e 00 00 push 0x5eac
8dc: e8 9f 31 00 00 call 3a80 <printf>
}
8e1: 8b 5d fc mov -0x4(%ebp),%ebx
8e4: 83 c4 10 add $0x10,%esp
8e7: c9 leave
8e8: c3 ret
8e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000008f0 <dirtest>:
{
8f0: 55 push %ebp
8f1: 89 e5 mov %esp,%ebp
8f3: 83 ec 10 sub $0x10,%esp
printf(stdout, "mkdir test\n");
8f6: 68 6c 40 00 00 push $0x406c
8fb: ff 35 ac 5e 00 00 push 0x5eac
901: e8 7a 31 00 00 call 3a80 <printf>
if(mkdir("dir0") < 0){
906: c7 04 24 78 40 00 00 movl $0x4078,(%esp)
90d: e8 49 30 00 00 call 395b <mkdir>
912: 83 c4 10 add $0x10,%esp
915: 85 c0 test %eax,%eax
917: 78 58 js 971 <dirtest+0x81>
if(chdir("dir0") < 0){
919: 83 ec 0c sub $0xc,%esp
91c: 68 78 40 00 00 push $0x4078
921: e8 3d 30 00 00 call 3963 <chdir>
926: 83 c4 10 add $0x10,%esp
929: 85 c0 test %eax,%eax
92b: 0f 88 85 00 00 00 js 9b6 <dirtest+0xc6>
if(chdir("..") < 0){
931: 83 ec 0c sub $0xc,%esp
934: 68 1d 46 00 00 push $0x461d
939: e8 25 30 00 00 call 3963 <chdir>
93e: 83 c4 10 add $0x10,%esp
941: 85 c0 test %eax,%eax
943: 78 5a js 99f <dirtest+0xaf>
if(unlink("dir0") < 0){
945: 83 ec 0c sub $0xc,%esp
948: 68 78 40 00 00 push $0x4078
94d: e8 f1 2f 00 00 call 3943 <unlink>
952: 83 c4 10 add $0x10,%esp
955: 85 c0 test %eax,%eax
957: 78 2f js 988 <dirtest+0x98>
printf(stdout, "mkdir test ok\n");
959: 83 ec 08 sub $0x8,%esp
95c: 68 b5 40 00 00 push $0x40b5
961: ff 35 ac 5e 00 00 push 0x5eac
967: e8 14 31 00 00 call 3a80 <printf>
}
96c: 83 c4 10 add $0x10,%esp
96f: c9 leave
970: c3 ret
printf(stdout, "mkdir failed\n");
971: 50 push %eax
972: 50 push %eax
973: 68 a8 3d 00 00 push $0x3da8
978: ff 35 ac 5e 00 00 push 0x5eac
97e: e8 fd 30 00 00 call 3a80 <printf>
exit();
983: e8 6b 2f 00 00 call 38f3 <exit>
printf(stdout, "unlink dir0 failed\n");
988: 50 push %eax
989: 50 push %eax
98a: 68 a1 40 00 00 push $0x40a1
98f: ff 35 ac 5e 00 00 push 0x5eac
995: e8 e6 30 00 00 call 3a80 <printf>
exit();
99a: e8 54 2f 00 00 call 38f3 <exit>
printf(stdout, "chdir .. failed\n");
99f: 52 push %edx
9a0: 52 push %edx
9a1: 68 90 40 00 00 push $0x4090
9a6: ff 35 ac 5e 00 00 push 0x5eac
9ac: e8 cf 30 00 00 call 3a80 <printf>
exit();
9b1: e8 3d 2f 00 00 call 38f3 <exit>
printf(stdout, "chdir dir0 failed\n");
9b6: 51 push %ecx
9b7: 51 push %ecx
9b8: 68 7d 40 00 00 push $0x407d
9bd: ff 35 ac 5e 00 00 push 0x5eac
9c3: e8 b8 30 00 00 call 3a80 <printf>
exit();
9c8: e8 26 2f 00 00 call 38f3 <exit>
9cd: 8d 76 00 lea 0x0(%esi),%esi
000009d0 <exectest>:
{
9d0: 55 push %ebp
9d1: 89 e5 mov %esp,%ebp
9d3: 83 ec 10 sub $0x10,%esp
printf(stdout, "exec test\n");
9d6: 68 c4 40 00 00 push $0x40c4
9db: ff 35 ac 5e 00 00 push 0x5eac
9e1: e8 9a 30 00 00 call 3a80 <printf>
if(exec("echo", echoargv) < 0){
9e6: 5a pop %edx
9e7: 59 pop %ecx
9e8: 68 b0 5e 00 00 push $0x5eb0
9ed: 68 8d 3e 00 00 push $0x3e8d
9f2: e8 34 2f 00 00 call 392b <exec>
9f7: 83 c4 10 add $0x10,%esp
9fa: 85 c0 test %eax,%eax
9fc: 78 02 js a00 <exectest+0x30>
}
9fe: c9 leave
9ff: c3 ret
printf(stdout, "exec echo failed\n");
a00: 50 push %eax
a01: 50 push %eax
a02: 68 cf 40 00 00 push $0x40cf
a07: ff 35 ac 5e 00 00 push 0x5eac
a0d: e8 6e 30 00 00 call 3a80 <printf>
exit();
a12: e8 dc 2e 00 00 call 38f3 <exit>
a17: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
a1e: 66 90 xchg %ax,%ax
00000a20 <pipe1>:
{
a20: 55 push %ebp
a21: 89 e5 mov %esp,%ebp
a23: 57 push %edi
a24: 56 push %esi
if(pipe(fds) != 0){
a25: 8d 45 e0 lea -0x20(%ebp),%eax
{
a28: 53 push %ebx
a29: 83 ec 38 sub $0x38,%esp
if(pipe(fds) != 0){
a2c: 50 push %eax
a2d: e8 d1 2e 00 00 call 3903 <pipe>
a32: 83 c4 10 add $0x10,%esp
a35: 85 c0 test %eax,%eax
a37: 0f 85 34 01 00 00 jne b71 <pipe1+0x151>
pid = fork();
a3d: e8 a9 2e 00 00 call 38eb <fork>
if(pid == 0){
a42: 85 c0 test %eax,%eax
a44: 0f 84 85 00 00 00 je acf <pipe1+0xaf>
} else if(pid > 0){
a4a: 0f 8e 34 01 00 00 jle b84 <pipe1+0x164>
close(fds[1]);
a50: 83 ec 0c sub $0xc,%esp
a53: ff 75 e4 push -0x1c(%ebp)
seq = 0;
a56: 31 db xor %ebx,%ebx
cc = 1;
a58: be 01 00 00 00 mov $0x1,%esi
close(fds[1]);
a5d: e8 b9 2e 00 00 call 391b <close>
total = 0;
a62: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp)
while((n = read(fds[0], buf, cc)) > 0){
a69: 83 c4 10 add $0x10,%esp
a6c: 83 ec 04 sub $0x4,%esp
a6f: 56 push %esi
a70: 68 00 86 00 00 push $0x8600
a75: ff 75 e0 push -0x20(%ebp)
a78: e8 8e 2e 00 00 call 390b <read>
a7d: 83 c4 10 add $0x10,%esp
a80: 89 c7 mov %eax,%edi
a82: 85 c0 test %eax,%eax
a84: 0f 8e a3 00 00 00 jle b2d <pipe1+0x10d>
a8a: 8d 0c 1f lea (%edi,%ebx,1),%ecx
for(i = 0; i < n; i++){
a8d: 31 c0 xor %eax,%eax
a8f: 90 nop
if((buf[i] & 0xff) != (seq++ & 0xff)){
a90: 89 da mov %ebx,%edx
a92: 83 c3 01 add $0x1,%ebx
a95: 38 90 00 86 00 00 cmp %dl,0x8600(%eax)
a9b: 75 18 jne ab5 <pipe1+0x95>
for(i = 0; i < n; i++){
a9d: 83 c0 01 add $0x1,%eax
aa0: 39 d9 cmp %ebx,%ecx
aa2: 75 ec jne a90 <pipe1+0x70>
cc = cc * 2;
aa4: 01 f6 add %esi,%esi
aa6: b8 00 20 00 00 mov $0x2000,%eax
total += n;
aab: 01 7d d4 add %edi,-0x2c(%ebp)
aae: 39 c6 cmp %eax,%esi
ab0: 0f 4f f0 cmovg %eax,%esi
ab3: eb b7 jmp a6c <pipe1+0x4c>
printf(1, "pipe1 oops 2\n");
ab5: 83 ec 08 sub $0x8,%esp
ab8: 68 fe 40 00 00 push $0x40fe
abd: 6a 01 push $0x1
abf: e8 bc 2f 00 00 call 3a80 <printf>
ac4: 83 c4 10 add $0x10,%esp
}
ac7: 8d 65 f4 lea -0xc(%ebp),%esp
aca: 5b pop %ebx
acb: 5e pop %esi
acc: 5f pop %edi
acd: 5d pop %ebp
ace: c3 ret
close(fds[0]);
acf: 83 ec 0c sub $0xc,%esp
ad2: ff 75 e0 push -0x20(%ebp)
seq = 0;
ad5: 31 db xor %ebx,%ebx
close(fds[0]);
ad7: e8 3f 2e 00 00 call 391b <close>
adc: 83 c4 10 add $0x10,%esp
for(i = 0; i < 1033; i++)
adf: 31 c0 xor %eax,%eax
ae1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
buf[i] = seq++;
ae8: 8d 14 18 lea (%eax,%ebx,1),%edx
for(i = 0; i < 1033; i++)
aeb: 83 c0 01 add $0x1,%eax
buf[i] = seq++;
aee: 88 90 ff 85 00 00 mov %dl,0x85ff(%eax)
for(i = 0; i < 1033; i++)
af4: 3d 09 04 00 00 cmp $0x409,%eax
af9: 75 ed jne ae8 <pipe1+0xc8>
if(write(fds[1], buf, 1033) != 1033){
afb: 83 ec 04 sub $0x4,%esp
buf[i] = seq++;
afe: 81 c3 09 04 00 00 add $0x409,%ebx
if(write(fds[1], buf, 1033) != 1033){
b04: 68 09 04 00 00 push $0x409
b09: 68 00 86 00 00 push $0x8600
b0e: ff 75 e4 push -0x1c(%ebp)
b11: e8 fd 2d 00 00 call 3913 <write>
b16: 83 c4 10 add $0x10,%esp
b19: 3d 09 04 00 00 cmp $0x409,%eax
b1e: 75 77 jne b97 <pipe1+0x177>
for(n = 0; n < 5; n++){
b20: 81 fb 2d 14 00 00 cmp $0x142d,%ebx
b26: 75 b7 jne adf <pipe1+0xbf>
exit();
b28: e8 c6 2d 00 00 call 38f3 <exit>
if(total != 5 * 1033){
b2d: 81 7d d4 2d 14 00 00 cmpl $0x142d,-0x2c(%ebp)
b34: 75 26 jne b5c <pipe1+0x13c>
close(fds[0]);
b36: 83 ec 0c sub $0xc,%esp
b39: ff 75 e0 push -0x20(%ebp)
b3c: e8 da 2d 00 00 call 391b <close>
wait();
b41: e8 b5 2d 00 00 call 38fb <wait>
printf(1, "pipe1 ok\n");
b46: 5a pop %edx
b47: 59 pop %ecx
b48: 68 23 41 00 00 push $0x4123
b4d: 6a 01 push $0x1
b4f: e8 2c 2f 00 00 call 3a80 <printf>
b54: 83 c4 10 add $0x10,%esp
b57: e9 6b ff ff ff jmp ac7 <pipe1+0xa7>
printf(1, "pipe1 oops 3 total %d\n", total);
b5c: 53 push %ebx
b5d: ff 75 d4 push -0x2c(%ebp)
b60: 68 0c 41 00 00 push $0x410c
b65: 6a 01 push $0x1
b67: e8 14 2f 00 00 call 3a80 <printf>
exit();
b6c: e8 82 2d 00 00 call 38f3 <exit>
printf(1, "pipe() failed\n");
b71: 57 push %edi
b72: 57 push %edi
b73: 68 e1 40 00 00 push $0x40e1
b78: 6a 01 push $0x1
b7a: e8 01 2f 00 00 call 3a80 <printf>
exit();
b7f: e8 6f 2d 00 00 call 38f3 <exit>
printf(1, "fork() failed\n");
b84: 50 push %eax
b85: 50 push %eax
b86: 68 2d 41 00 00 push $0x412d
b8b: 6a 01 push $0x1
b8d: e8 ee 2e 00 00 call 3a80 <printf>
exit();
b92: e8 5c 2d 00 00 call 38f3 <exit>
printf(1, "pipe1 oops 1\n");
b97: 56 push %esi
b98: 56 push %esi
b99: 68 f0 40 00 00 push $0x40f0
b9e: 6a 01 push $0x1
ba0: e8 db 2e 00 00 call 3a80 <printf>
exit();
ba5: e8 49 2d 00 00 call 38f3 <exit>
baa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000bb0 <preempt>:
{
bb0: 55 push %ebp
bb1: 89 e5 mov %esp,%ebp
bb3: 57 push %edi
bb4: 56 push %esi
bb5: 53 push %ebx
bb6: 83 ec 24 sub $0x24,%esp
printf(1, "preempt: ");
bb9: 68 3c 41 00 00 push $0x413c
bbe: 6a 01 push $0x1
bc0: e8 bb 2e 00 00 call 3a80 <printf>
pid1 = fork();
bc5: e8 21 2d 00 00 call 38eb <fork>
if(pid1 == 0)
bca: 83 c4 10 add $0x10,%esp
bcd: 85 c0 test %eax,%eax
bcf: 75 07 jne bd8 <preempt+0x28>
for(;;)
bd1: eb fe jmp bd1 <preempt+0x21>
bd3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
bd7: 90 nop
bd8: 89 c3 mov %eax,%ebx
pid2 = fork();
bda: e8 0c 2d 00 00 call 38eb <fork>
bdf: 89 c6 mov %eax,%esi
if(pid2 == 0)
be1: 85 c0 test %eax,%eax
be3: 75 0b jne bf0 <preempt+0x40>
for(;;)
be5: eb fe jmp be5 <preempt+0x35>
be7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
bee: 66 90 xchg %ax,%ax
pipe(pfds);
bf0: 83 ec 0c sub $0xc,%esp
bf3: 8d 45 e0 lea -0x20(%ebp),%eax
bf6: 50 push %eax
bf7: e8 07 2d 00 00 call 3903 <pipe>
pid3 = fork();
bfc: e8 ea 2c 00 00 call 38eb <fork>
if(pid3 == 0){
c01: 83 c4 10 add $0x10,%esp
pid3 = fork();
c04: 89 c7 mov %eax,%edi
if(pid3 == 0){
c06: 85 c0 test %eax,%eax
c08: 75 3e jne c48 <preempt+0x98>
close(pfds[0]);
c0a: 83 ec 0c sub $0xc,%esp
c0d: ff 75 e0 push -0x20(%ebp)
c10: e8 06 2d 00 00 call 391b <close>
if(write(pfds[1], "x", 1) != 1)
c15: 83 c4 0c add $0xc,%esp
c18: 6a 01 push $0x1
c1a: 68 01 47 00 00 push $0x4701
c1f: ff 75 e4 push -0x1c(%ebp)
c22: e8 ec 2c 00 00 call 3913 <write>
c27: 83 c4 10 add $0x10,%esp
c2a: 83 f8 01 cmp $0x1,%eax
c2d: 0f 85 b8 00 00 00 jne ceb <preempt+0x13b>
close(pfds[1]);
c33: 83 ec 0c sub $0xc,%esp
c36: ff 75 e4 push -0x1c(%ebp)
c39: e8 dd 2c 00 00 call 391b <close>
c3e: 83 c4 10 add $0x10,%esp
for(;;)
c41: eb fe jmp c41 <preempt+0x91>
c43: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
c47: 90 nop
close(pfds[1]);
c48: 83 ec 0c sub $0xc,%esp
c4b: ff 75 e4 push -0x1c(%ebp)
c4e: e8 c8 2c 00 00 call 391b <close>
if(read(pfds[0], buf, sizeof(buf)) != 1){
c53: 83 c4 0c add $0xc,%esp
c56: 68 00 20 00 00 push $0x2000
c5b: 68 00 86 00 00 push $0x8600
c60: ff 75 e0 push -0x20(%ebp)
c63: e8 a3 2c 00 00 call 390b <read>
c68: 83 c4 10 add $0x10,%esp
c6b: 83 f8 01 cmp $0x1,%eax
c6e: 75 67 jne cd7 <preempt+0x127>
close(pfds[0]);
c70: 83 ec 0c sub $0xc,%esp
c73: ff 75 e0 push -0x20(%ebp)
c76: e8 a0 2c 00 00 call 391b <close>
printf(1, "kill... ");
c7b: 58 pop %eax
c7c: 5a pop %edx
c7d: 68 6d 41 00 00 push $0x416d
c82: 6a 01 push $0x1
c84: e8 f7 2d 00 00 call 3a80 <printf>
kill(pid1);
c89: 89 1c 24 mov %ebx,(%esp)
c8c: e8 92 2c 00 00 call 3923 <kill>
kill(pid2);
c91: 89 34 24 mov %esi,(%esp)
c94: e8 8a 2c 00 00 call 3923 <kill>
kill(pid3);
c99: 89 3c 24 mov %edi,(%esp)
c9c: e8 82 2c 00 00 call 3923 <kill>
printf(1, "wait... ");
ca1: 59 pop %ecx
ca2: 5b pop %ebx
ca3: 68 76 41 00 00 push $0x4176
ca8: 6a 01 push $0x1
caa: e8 d1 2d 00 00 call 3a80 <printf>
wait();
caf: e8 47 2c 00 00 call 38fb <wait>
wait();
cb4: e8 42 2c 00 00 call 38fb <wait>
wait();
cb9: e8 3d 2c 00 00 call 38fb <wait>
printf(1, "preempt ok\n");
cbe: 5e pop %esi
cbf: 5f pop %edi
cc0: 68 7f 41 00 00 push $0x417f
cc5: 6a 01 push $0x1
cc7: e8 b4 2d 00 00 call 3a80 <printf>
ccc: 83 c4 10 add $0x10,%esp
}
ccf: 8d 65 f4 lea -0xc(%ebp),%esp
cd2: 5b pop %ebx
cd3: 5e pop %esi
cd4: 5f pop %edi
cd5: 5d pop %ebp
cd6: c3 ret
printf(1, "preempt read error");
cd7: 83 ec 08 sub $0x8,%esp
cda: 68 5a 41 00 00 push $0x415a
cdf: 6a 01 push $0x1
ce1: e8 9a 2d 00 00 call 3a80 <printf>
ce6: 83 c4 10 add $0x10,%esp
ce9: eb e4 jmp ccf <preempt+0x11f>
printf(1, "preempt write error");
ceb: 83 ec 08 sub $0x8,%esp
cee: 68 46 41 00 00 push $0x4146
cf3: 6a 01 push $0x1
cf5: e8 86 2d 00 00 call 3a80 <printf>
cfa: 83 c4 10 add $0x10,%esp
cfd: e9 31 ff ff ff jmp c33 <preempt+0x83>
d02: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
d09: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000d10 <exitwait>:
{
d10: 55 push %ebp
d11: 89 e5 mov %esp,%ebp
d13: 56 push %esi
d14: be 64 00 00 00 mov $0x64,%esi
d19: 53 push %ebx
d1a: eb 14 jmp d30 <exitwait+0x20>
d1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(pid){
d20: 74 68 je d8a <exitwait+0x7a>
if(wait() != pid){
d22: e8 d4 2b 00 00 call 38fb <wait>
d27: 39 d8 cmp %ebx,%eax
d29: 75 2d jne d58 <exitwait+0x48>
for(i = 0; i < 100; i++){
d2b: 83 ee 01 sub $0x1,%esi
d2e: 74 41 je d71 <exitwait+0x61>
pid = fork();
d30: e8 b6 2b 00 00 call 38eb <fork>
d35: 89 c3 mov %eax,%ebx
if(pid < 0){
d37: 85 c0 test %eax,%eax
d39: 79 e5 jns d20 <exitwait+0x10>
printf(1, "fork failed\n");
d3b: 83 ec 08 sub $0x8,%esp
d3e: 68 e9 4c 00 00 push $0x4ce9
d43: 6a 01 push $0x1
d45: e8 36 2d 00 00 call 3a80 <printf>
return;
d4a: 83 c4 10 add $0x10,%esp
}
d4d: 8d 65 f8 lea -0x8(%ebp),%esp
d50: 5b pop %ebx
d51: 5e pop %esi
d52: 5d pop %ebp
d53: c3 ret
d54: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
printf(1, "wait wrong pid\n");
d58: 83 ec 08 sub $0x8,%esp
d5b: 68 8b 41 00 00 push $0x418b
d60: 6a 01 push $0x1
d62: e8 19 2d 00 00 call 3a80 <printf>
return;
d67: 83 c4 10 add $0x10,%esp
}
d6a: 8d 65 f8 lea -0x8(%ebp),%esp
d6d: 5b pop %ebx
d6e: 5e pop %esi
d6f: 5d pop %ebp
d70: c3 ret
printf(1, "exitwait ok\n");
d71: 83 ec 08 sub $0x8,%esp
d74: 68 9b 41 00 00 push $0x419b
d79: 6a 01 push $0x1
d7b: e8 00 2d 00 00 call 3a80 <printf>
d80: 83 c4 10 add $0x10,%esp
}
d83: 8d 65 f8 lea -0x8(%ebp),%esp
d86: 5b pop %ebx
d87: 5e pop %esi
d88: 5d pop %ebp
d89: c3 ret
exit();
d8a: e8 64 2b 00 00 call 38f3 <exit>
d8f: 90 nop
00000d90 <mem>:
{
d90: 55 push %ebp
d91: 89 e5 mov %esp,%ebp
d93: 56 push %esi
d94: 31 f6 xor %esi,%esi
d96: 53 push %ebx
printf(1, "mem test\n");
d97: 83 ec 08 sub $0x8,%esp
d9a: 68 a8 41 00 00 push $0x41a8
d9f: 6a 01 push $0x1
da1: e8 da 2c 00 00 call 3a80 <printf>
ppid = getpid();
da6: e8 c8 2b 00 00 call 3973 <getpid>
dab: 89 c3 mov %eax,%ebx
if((pid = fork()) == 0){
dad: e8 39 2b 00 00 call 38eb <fork>
db2: 83 c4 10 add $0x10,%esp
db5: 85 c0 test %eax,%eax
db7: 74 0b je dc4 <mem+0x34>
db9: e9 8a 00 00 00 jmp e48 <mem+0xb8>
dbe: 66 90 xchg %ax,%ax
*(char**)m2 = m1;
dc0: 89 30 mov %esi,(%eax)
dc2: 89 c6 mov %eax,%esi
while((m2 = malloc(10001)) != 0){
dc4: 83 ec 0c sub $0xc,%esp
dc7: 68 11 27 00 00 push $0x2711
dcc: e8 df 2e 00 00 call 3cb0 <malloc>
dd1: 83 c4 10 add $0x10,%esp
dd4: 85 c0 test %eax,%eax
dd6: 75 e8 jne dc0 <mem+0x30>
while(m1){
dd8: 85 f6 test %esi,%esi
dda: 74 18 je df4 <mem+0x64>
ddc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
m2 = *(char**)m1;
de0: 89 f0 mov %esi,%eax
free(m1);
de2: 83 ec 0c sub $0xc,%esp
m2 = *(char**)m1;
de5: 8b 36 mov (%esi),%esi
free(m1);
de7: 50 push %eax
de8: e8 33 2e 00 00 call 3c20 <free>
while(m1){
ded: 83 c4 10 add $0x10,%esp
df0: 85 f6 test %esi,%esi
df2: 75 ec jne de0 <mem+0x50>
m1 = malloc(1024*20);
df4: 83 ec 0c sub $0xc,%esp
df7: 68 00 50 00 00 push $0x5000
dfc: e8 af 2e 00 00 call 3cb0 <malloc>
if(m1 == 0){
e01: 83 c4 10 add $0x10,%esp
e04: 85 c0 test %eax,%eax
e06: 74 20 je e28 <mem+0x98>
free(m1);
e08: 83 ec 0c sub $0xc,%esp
e0b: 50 push %eax
e0c: e8 0f 2e 00 00 call 3c20 <free>
printf(1, "mem ok\n");
e11: 58 pop %eax
e12: 5a pop %edx
e13: 68 cc 41 00 00 push $0x41cc
e18: 6a 01 push $0x1
e1a: e8 61 2c 00 00 call 3a80 <printf>
exit();
e1f: e8 cf 2a 00 00 call 38f3 <exit>
e24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
printf(1, "couldn't allocate mem?!!\n");
e28: 83 ec 08 sub $0x8,%esp
e2b: 68 b2 41 00 00 push $0x41b2
e30: 6a 01 push $0x1
e32: e8 49 2c 00 00 call 3a80 <printf>
kill(ppid);
e37: 89 1c 24 mov %ebx,(%esp)
e3a: e8 e4 2a 00 00 call 3923 <kill>
exit();
e3f: e8 af 2a 00 00 call 38f3 <exit>
e44: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
}
e48: 8d 65 f8 lea -0x8(%ebp),%esp
e4b: 5b pop %ebx
e4c: 5e pop %esi
e4d: 5d pop %ebp
wait();
e4e: e9 a8 2a 00 00 jmp 38fb <wait>
e53: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
e5a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000e60 <sharedfd>:
{
e60: 55 push %ebp
e61: 89 e5 mov %esp,%ebp
e63: 57 push %edi
e64: 56 push %esi
e65: 53 push %ebx
e66: 83 ec 34 sub $0x34,%esp
printf(1, "sharedfd test\n");
e69: 68 d4 41 00 00 push $0x41d4
e6e: 6a 01 push $0x1
e70: e8 0b 2c 00 00 call 3a80 <printf>
unlink("sharedfd");
e75: c7 04 24 e3 41 00 00 movl $0x41e3,(%esp)
e7c: e8 c2 2a 00 00 call 3943 <unlink>
fd = open("sharedfd", O_CREATE|O_RDWR);
e81: 5b pop %ebx
e82: 5e pop %esi
e83: 68 02 02 00 00 push $0x202
e88: 68 e3 41 00 00 push $0x41e3
e8d: e8 a1 2a 00 00 call 3933 <open>
if(fd < 0){
e92: 83 c4 10 add $0x10,%esp
e95: 85 c0 test %eax,%eax
e97: 0f 88 2a 01 00 00 js fc7 <sharedfd+0x167>
e9d: 89 c7 mov %eax,%edi
memset(buf, pid==0?'c':'p', sizeof(buf));
e9f: 8d 75 de lea -0x22(%ebp),%esi
ea2: bb e8 03 00 00 mov $0x3e8,%ebx
pid = fork();
ea7: e8 3f 2a 00 00 call 38eb <fork>
memset(buf, pid==0?'c':'p', sizeof(buf));
eac: 83 f8 01 cmp $0x1,%eax
pid = fork();
eaf: 89 45 d4 mov %eax,-0x2c(%ebp)
memset(buf, pid==0?'c':'p', sizeof(buf));
eb2: 19 c0 sbb %eax,%eax
eb4: 83 ec 04 sub $0x4,%esp
eb7: 83 e0 f3 and $0xfffffff3,%eax
eba: 6a 0a push $0xa
ebc: 83 c0 70 add $0x70,%eax
ebf: 50 push %eax
ec0: 56 push %esi
ec1: e8 7a 28 00 00 call 3740 <memset>
ec6: 83 c4 10 add $0x10,%esp
ec9: eb 0a jmp ed5 <sharedfd+0x75>
ecb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
ecf: 90 nop
for(i = 0; i < 1000; i++){
ed0: 83 eb 01 sub $0x1,%ebx
ed3: 74 26 je efb <sharedfd+0x9b>
if(write(fd, buf, sizeof(buf)) != sizeof(buf)){
ed5: 83 ec 04 sub $0x4,%esp
ed8: 6a 0a push $0xa
eda: 56 push %esi
edb: 57 push %edi
edc: e8 32 2a 00 00 call 3913 <write>
ee1: 83 c4 10 add $0x10,%esp
ee4: 83 f8 0a cmp $0xa,%eax
ee7: 74 e7 je ed0 <sharedfd+0x70>
printf(1, "fstests: write sharedfd failed\n");
ee9: 83 ec 08 sub $0x8,%esp
eec: 68 d4 4e 00 00 push $0x4ed4
ef1: 6a 01 push $0x1
ef3: e8 88 2b 00 00 call 3a80 <printf>
break;
ef8: 83 c4 10 add $0x10,%esp
if(pid == 0)
efb: 8b 4d d4 mov -0x2c(%ebp),%ecx
efe: 85 c9 test %ecx,%ecx
f00: 0f 84 f5 00 00 00 je ffb <sharedfd+0x19b>
wait();
f06: e8 f0 29 00 00 call 38fb <wait>
close(fd);
f0b: 83 ec 0c sub $0xc,%esp
nc = np = 0;
f0e: 31 db xor %ebx,%ebx
close(fd);
f10: 57 push %edi
f11: 8d 7d e8 lea -0x18(%ebp),%edi
f14: e8 02 2a 00 00 call 391b <close>
fd = open("sharedfd", 0);
f19: 58 pop %eax
f1a: 5a pop %edx
f1b: 6a 00 push $0x0
f1d: 68 e3 41 00 00 push $0x41e3
f22: e8 0c 2a 00 00 call 3933 <open>
if(fd < 0){
f27: 83 c4 10 add $0x10,%esp
nc = np = 0;
f2a: 31 d2 xor %edx,%edx
fd = open("sharedfd", 0);
f2c: 89 45 d0 mov %eax,-0x30(%ebp)
if(fd < 0){
f2f: 85 c0 test %eax,%eax
f31: 0f 88 aa 00 00 00 js fe1 <sharedfd+0x181>
f37: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
f3e: 66 90 xchg %ax,%ax
while((n = read(fd, buf, sizeof(buf))) > 0){
f40: 83 ec 04 sub $0x4,%esp
f43: 89 55 d4 mov %edx,-0x2c(%ebp)
f46: 6a 0a push $0xa
f48: 56 push %esi
f49: ff 75 d0 push -0x30(%ebp)
f4c: e8 ba 29 00 00 call 390b <read>
f51: 83 c4 10 add $0x10,%esp
f54: 85 c0 test %eax,%eax
f56: 7e 28 jle f80 <sharedfd+0x120>
f58: 8b 55 d4 mov -0x2c(%ebp),%edx
f5b: 89 f0 mov %esi,%eax
f5d: eb 13 jmp f72 <sharedfd+0x112>
f5f: 90 nop
np++;
f60: 80 f9 70 cmp $0x70,%cl
f63: 0f 94 c1 sete %cl
f66: 0f b6 c9 movzbl %cl,%ecx
f69: 01 cb add %ecx,%ebx
for(i = 0; i < sizeof(buf); i++){
f6b: 83 c0 01 add $0x1,%eax
f6e: 39 f8 cmp %edi,%eax
f70: 74 ce je f40 <sharedfd+0xe0>
if(buf[i] == 'c')
f72: 0f b6 08 movzbl (%eax),%ecx
f75: 80 f9 63 cmp $0x63,%cl
f78: 75 e6 jne f60 <sharedfd+0x100>
nc++;
f7a: 83 c2 01 add $0x1,%edx
if(buf[i] == 'p')
f7d: eb ec jmp f6b <sharedfd+0x10b>
f7f: 90 nop
close(fd);
f80: 83 ec 0c sub $0xc,%esp
f83: ff 75 d0 push -0x30(%ebp)
f86: e8 90 29 00 00 call 391b <close>
unlink("sharedfd");
f8b: c7 04 24 e3 41 00 00 movl $0x41e3,(%esp)
f92: e8 ac 29 00 00 call 3943 <unlink>
if(nc == 10000 && np == 10000){
f97: 8b 55 d4 mov -0x2c(%ebp),%edx
f9a: 83 c4 10 add $0x10,%esp
f9d: 81 fa 10 27 00 00 cmp $0x2710,%edx
fa3: 75 5b jne 1000 <sharedfd+0x1a0>
fa5: 81 fb 10 27 00 00 cmp $0x2710,%ebx
fab: 75 53 jne 1000 <sharedfd+0x1a0>
printf(1, "sharedfd ok\n");
fad: 83 ec 08 sub $0x8,%esp
fb0: 68 ec 41 00 00 push $0x41ec
fb5: 6a 01 push $0x1
fb7: e8 c4 2a 00 00 call 3a80 <printf>
fbc: 83 c4 10 add $0x10,%esp
}
fbf: 8d 65 f4 lea -0xc(%ebp),%esp
fc2: 5b pop %ebx
fc3: 5e pop %esi
fc4: 5f pop %edi
fc5: 5d pop %ebp
fc6: c3 ret
printf(1, "fstests: cannot open sharedfd for writing");
fc7: 83 ec 08 sub $0x8,%esp
fca: 68 a8 4e 00 00 push $0x4ea8
fcf: 6a 01 push $0x1
fd1: e8 aa 2a 00 00 call 3a80 <printf>
return;
fd6: 83 c4 10 add $0x10,%esp
}
fd9: 8d 65 f4 lea -0xc(%ebp),%esp
fdc: 5b pop %ebx
fdd: 5e pop %esi
fde: 5f pop %edi
fdf: 5d pop %ebp
fe0: c3 ret
printf(1, "fstests: cannot open sharedfd for reading\n");
fe1: 83 ec 08 sub $0x8,%esp
fe4: 68 f4 4e 00 00 push $0x4ef4
fe9: 6a 01 push $0x1
feb: e8 90 2a 00 00 call 3a80 <printf>
return;
ff0: 83 c4 10 add $0x10,%esp
}
ff3: 8d 65 f4 lea -0xc(%ebp),%esp
ff6: 5b pop %ebx
ff7: 5e pop %esi
ff8: 5f pop %edi
ff9: 5d pop %ebp
ffa: c3 ret
exit();
ffb: e8 f3 28 00 00 call 38f3 <exit>
printf(1, "sharedfd oops %d %d\n", nc, np);
1000: 53 push %ebx
1001: 52 push %edx
1002: 68 f9 41 00 00 push $0x41f9
1007: 6a 01 push $0x1
1009: e8 72 2a 00 00 call 3a80 <printf>
exit();
100e: e8 e0 28 00 00 call 38f3 <exit>
1013: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
101a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00001020 <fourfiles>:
{
1020: 55 push %ebp
1021: 89 e5 mov %esp,%ebp
1023: 57 push %edi
1024: 56 push %esi
printf(1, "fourfiles test\n");
1025: be 0e 42 00 00 mov $0x420e,%esi
{
102a: 53 push %ebx
for(pi = 0; pi < 4; pi++){
102b: 31 db xor %ebx,%ebx
{
102d: 83 ec 34 sub $0x34,%esp
char *names[] = { "f0", "f1", "f2", "f3" };
1030: c7 45 d8 0e 42 00 00 movl $0x420e,-0x28(%ebp)
printf(1, "fourfiles test\n");
1037: 68 14 42 00 00 push $0x4214
103c: 6a 01 push $0x1
char *names[] = { "f0", "f1", "f2", "f3" };
103e: c7 45 dc 57 43 00 00 movl $0x4357,-0x24(%ebp)
1045: c7 45 e0 5b 43 00 00 movl $0x435b,-0x20(%ebp)
104c: c7 45 e4 11 42 00 00 movl $0x4211,-0x1c(%ebp)
printf(1, "fourfiles test\n");
1053: e8 28 2a 00 00 call 3a80 <printf>
1058: 83 c4 10 add $0x10,%esp
unlink(fname);
105b: 83 ec 0c sub $0xc,%esp
105e: 56 push %esi
105f: e8 df 28 00 00 call 3943 <unlink>
pid = fork();
1064: e8 82 28 00 00 call 38eb <fork>
if(pid < 0){
1069: 83 c4 10 add $0x10,%esp
106c: 85 c0 test %eax,%eax
106e: 0f 88 64 01 00 00 js 11d8 <fourfiles+0x1b8>
if(pid == 0){
1074: 0f 84 e9 00 00 00 je 1163 <fourfiles+0x143>
for(pi = 0; pi < 4; pi++){
107a: 83 c3 01 add $0x1,%ebx
107d: 83 fb 04 cmp $0x4,%ebx
1080: 74 06 je 1088 <fourfiles+0x68>
fname = names[pi];
1082: 8b 74 9d d8 mov -0x28(%ebp,%ebx,4),%esi
1086: eb d3 jmp 105b <fourfiles+0x3b>
wait();
1088: e8 6e 28 00 00 call 38fb <wait>
for(i = 0; i < 2; i++){
108d: 31 f6 xor %esi,%esi
wait();
108f: e8 67 28 00 00 call 38fb <wait>
1094: e8 62 28 00 00 call 38fb <wait>
1099: e8 5d 28 00 00 call 38fb <wait>
fname = names[i];
109e: 8b 44 b5 d8 mov -0x28(%ebp,%esi,4),%eax
fd = open(fname, 0);
10a2: 83 ec 08 sub $0x8,%esp
total = 0;
10a5: 31 db xor %ebx,%ebx
fd = open(fname, 0);
10a7: 6a 00 push $0x0
10a9: 50 push %eax
fname = names[i];
10aa: 89 45 d0 mov %eax,-0x30(%ebp)
fd = open(fname, 0);
10ad: e8 81 28 00 00 call 3933 <open>
while((n = read(fd, buf, sizeof(buf))) > 0){
10b2: 83 c4 10 add $0x10,%esp
fd = open(fname, 0);
10b5: 89 45 d4 mov %eax,-0x2c(%ebp)
while((n = read(fd, buf, sizeof(buf))) > 0){
10b8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
10bf: 90 nop
10c0: 83 ec 04 sub $0x4,%esp
10c3: 68 00 20 00 00 push $0x2000
10c8: 68 00 86 00 00 push $0x8600
10cd: ff 75 d4 push -0x2c(%ebp)
10d0: e8 36 28 00 00 call 390b <read>
10d5: 83 c4 10 add $0x10,%esp
10d8: 89 c7 mov %eax,%edi
10da: 85 c0 test %eax,%eax
10dc: 7e 20 jle 10fe <fourfiles+0xde>
for(j = 0; j < n; j++){
10de: 31 c0 xor %eax,%eax
if(buf[j] != '0'+i){
10e0: 83 fe 01 cmp $0x1,%esi
10e3: 0f be 88 00 86 00 00 movsbl 0x8600(%eax),%ecx
10ea: 19 d2 sbb %edx,%edx
10ec: 83 c2 31 add $0x31,%edx
10ef: 39 d1 cmp %edx,%ecx
10f1: 75 5c jne 114f <fourfiles+0x12f>
for(j = 0; j < n; j++){
10f3: 83 c0 01 add $0x1,%eax
10f6: 39 c7 cmp %eax,%edi
10f8: 75 e6 jne 10e0 <fourfiles+0xc0>
total += n;
10fa: 01 fb add %edi,%ebx
10fc: eb c2 jmp 10c0 <fourfiles+0xa0>
close(fd);
10fe: 83 ec 0c sub $0xc,%esp
1101: ff 75 d4 push -0x2c(%ebp)
1104: e8 12 28 00 00 call 391b <close>
if(total != 12*500){
1109: 83 c4 10 add $0x10,%esp
110c: 81 fb 70 17 00 00 cmp $0x1770,%ebx
1112: 0f 85 d4 00 00 00 jne 11ec <fourfiles+0x1cc>
unlink(fname);
1118: 83 ec 0c sub $0xc,%esp
111b: ff 75 d0 push -0x30(%ebp)
111e: e8 20 28 00 00 call 3943 <unlink>
for(i = 0; i < 2; i++){
1123: 83 c4 10 add $0x10,%esp
1126: 83 fe 01 cmp $0x1,%esi
1129: 75 1a jne 1145 <fourfiles+0x125>
printf(1, "fourfiles ok\n");
112b: 83 ec 08 sub $0x8,%esp
112e: 68 52 42 00 00 push $0x4252
1133: 6a 01 push $0x1
1135: e8 46 29 00 00 call 3a80 <printf>
}
113a: 83 c4 10 add $0x10,%esp
113d: 8d 65 f4 lea -0xc(%ebp),%esp
1140: 5b pop %ebx
1141: 5e pop %esi
1142: 5f pop %edi
1143: 5d pop %ebp
1144: c3 ret
1145: be 01 00 00 00 mov $0x1,%esi
114a: e9 4f ff ff ff jmp 109e <fourfiles+0x7e>
printf(1, "wrong char\n");
114f: 83 ec 08 sub $0x8,%esp
1152: 68 35 42 00 00 push $0x4235
1157: 6a 01 push $0x1
1159: e8 22 29 00 00 call 3a80 <printf>
exit();
115e: e8 90 27 00 00 call 38f3 <exit>
fd = open(fname, O_CREATE | O_RDWR);
1163: 83 ec 08 sub $0x8,%esp
1166: 68 02 02 00 00 push $0x202
116b: 56 push %esi
116c: e8 c2 27 00 00 call 3933 <open>
if(fd < 0){
1171: 83 c4 10 add $0x10,%esp
fd = open(fname, O_CREATE | O_RDWR);
1174: 89 c6 mov %eax,%esi
if(fd < 0){
1176: 85 c0 test %eax,%eax
1178: 78 45 js 11bf <fourfiles+0x19f>
memset(buf, '0'+pi, 512);
117a: 83 ec 04 sub $0x4,%esp
117d: 83 c3 30 add $0x30,%ebx
1180: 68 00 02 00 00 push $0x200
1185: 53 push %ebx
1186: bb 0c 00 00 00 mov $0xc,%ebx
118b: 68 00 86 00 00 push $0x8600
1190: e8 ab 25 00 00 call 3740 <memset>
1195: 83 c4 10 add $0x10,%esp
if((n = write(fd, buf, 500)) != 500){
1198: 83 ec 04 sub $0x4,%esp
119b: 68 f4 01 00 00 push $0x1f4
11a0: 68 00 86 00 00 push $0x8600
11a5: 56 push %esi
11a6: e8 68 27 00 00 call 3913 <write>
11ab: 83 c4 10 add $0x10,%esp
11ae: 3d f4 01 00 00 cmp $0x1f4,%eax
11b3: 75 4a jne 11ff <fourfiles+0x1df>
for(i = 0; i < 12; i++){
11b5: 83 eb 01 sub $0x1,%ebx
11b8: 75 de jne 1198 <fourfiles+0x178>
exit();
11ba: e8 34 27 00 00 call 38f3 <exit>
printf(1, "create failed\n");
11bf: 51 push %ecx
11c0: 51 push %ecx
11c1: 68 af 44 00 00 push $0x44af
11c6: 6a 01 push $0x1
11c8: e8 b3 28 00 00 call 3a80 <printf>
exit();
11cd: e8 21 27 00 00 call 38f3 <exit>
11d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printf(1, "fork failed\n");
11d8: 83 ec 08 sub $0x8,%esp
11db: 68 e9 4c 00 00 push $0x4ce9
11e0: 6a 01 push $0x1
11e2: e8 99 28 00 00 call 3a80 <printf>
exit();
11e7: e8 07 27 00 00 call 38f3 <exit>
printf(1, "wrong length %d\n", total);
11ec: 50 push %eax
11ed: 53 push %ebx
11ee: 68 41 42 00 00 push $0x4241
11f3: 6a 01 push $0x1
11f5: e8 86 28 00 00 call 3a80 <printf>
exit();
11fa: e8 f4 26 00 00 call 38f3 <exit>
printf(1, "write failed %d\n", n);
11ff: 52 push %edx
1200: 50 push %eax
1201: 68 24 42 00 00 push $0x4224
1206: 6a 01 push $0x1
1208: e8 73 28 00 00 call 3a80 <printf>
exit();
120d: e8 e1 26 00 00 call 38f3 <exit>
1212: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
1219: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00001220 <createdelete>:
{
1220: 55 push %ebp
1221: 89 e5 mov %esp,%ebp
1223: 57 push %edi
1224: 56 push %esi
1225: 53 push %ebx
for(pi = 0; pi < 4; pi++){
1226: 31 db xor %ebx,%ebx
{
1228: 83 ec 44 sub $0x44,%esp
printf(1, "createdelete test\n");
122b: 68 60 42 00 00 push $0x4260
1230: 6a 01 push $0x1
1232: e8 49 28 00 00 call 3a80 <printf>
1237: 83 c4 10 add $0x10,%esp
pid = fork();
123a: e8 ac 26 00 00 call 38eb <fork>
if(pid < 0){
123f: 85 c0 test %eax,%eax
1241: 0f 88 c3 01 00 00 js 140a <createdelete+0x1ea>
if(pid == 0){
1247: 0f 84 13 01 00 00 je 1360 <createdelete+0x140>
for(pi = 0; pi < 4; pi++){
124d: 83 c3 01 add $0x1,%ebx
1250: 83 fb 04 cmp $0x4,%ebx
1253: 75 e5 jne 123a <createdelete+0x1a>
wait();
1255: e8 a1 26 00 00 call 38fb <wait>
for(i = 0; i < N; i++){
125a: 31 f6 xor %esi,%esi
125c: 8d 7d c8 lea -0x38(%ebp),%edi
wait();
125f: e8 97 26 00 00 call 38fb <wait>
1264: e8 92 26 00 00 call 38fb <wait>
1269: e8 8d 26 00 00 call 38fb <wait>
name[0] = name[1] = name[2] = 0;
126e: c6 45 ca 00 movb $0x0,-0x36(%ebp)
for(i = 0; i < N; i++){
1272: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if((i == 0 || i >= N/2) && fd < 0){
1278: 85 f6 test %esi,%esi
127a: 8d 46 30 lea 0x30(%esi),%eax
127d: 0f 94 c3 sete %bl
1280: 83 fe 09 cmp $0x9,%esi
1283: 88 45 c7 mov %al,-0x39(%ebp)
1286: 0f 9f c0 setg %al
1289: 09 c3 or %eax,%ebx
} else if((i >= 1 && i < N/2) && fd >= 0){
128b: 8d 46 ff lea -0x1(%esi),%eax
128e: 89 45 c0 mov %eax,-0x40(%ebp)
if((i == 0 || i >= N/2) && fd < 0){
1291: 88 5d c6 mov %bl,-0x3a(%ebp)
1294: bb 70 00 00 00 mov $0x70,%ebx
fd = open(name, 0);
1299: 83 ec 08 sub $0x8,%esp
name[1] = '0' + i;
129c: 0f b6 45 c7 movzbl -0x39(%ebp),%eax
name[0] = 'p' + pi;
12a0: 88 5d c8 mov %bl,-0x38(%ebp)
fd = open(name, 0);
12a3: 6a 00 push $0x0
12a5: 57 push %edi
name[1] = '0' + i;
12a6: 88 45 c9 mov %al,-0x37(%ebp)
fd = open(name, 0);
12a9: e8 85 26 00 00 call 3933 <open>
if((i == 0 || i >= N/2) && fd < 0){
12ae: 83 c4 10 add $0x10,%esp
12b1: 80 7d c6 00 cmpb $0x0,-0x3a(%ebp)
12b5: 0f 84 85 00 00 00 je 1340 <createdelete+0x120>
12bb: 85 c0 test %eax,%eax
12bd: 0f 88 32 01 00 00 js 13f5 <createdelete+0x1d5>
} else if((i >= 1 && i < N/2) && fd >= 0){
12c3: 83 7d c0 08 cmpl $0x8,-0x40(%ebp)
12c7: 76 7b jbe 1344 <createdelete+0x124>
close(fd);
12c9: 83 ec 0c sub $0xc,%esp
12cc: 50 push %eax
12cd: e8 49 26 00 00 call 391b <close>
12d2: 83 c4 10 add $0x10,%esp
for(pi = 0; pi < 4; pi++){
12d5: 83 c3 01 add $0x1,%ebx
12d8: 80 fb 74 cmp $0x74,%bl
12db: 75 bc jne 1299 <createdelete+0x79>
for(i = 0; i < N; i++){
12dd: 83 c6 01 add $0x1,%esi
12e0: 83 fe 14 cmp $0x14,%esi
12e3: 75 93 jne 1278 <createdelete+0x58>
12e5: be 70 00 00 00 mov $0x70,%esi
12ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
for(pi = 0; pi < 4; pi++){
12f0: 8d 46 c0 lea -0x40(%esi),%eax
name[0] = 'p' + i;
12f3: bb 04 00 00 00 mov $0x4,%ebx
12f8: 88 45 c7 mov %al,-0x39(%ebp)
unlink(name);
12fb: 83 ec 0c sub $0xc,%esp
name[0] = 'p' + i;
12fe: 89 f0 mov %esi,%eax
unlink(name);
1300: 57 push %edi
name[0] = 'p' + i;
1301: 88 45 c8 mov %al,-0x38(%ebp)
name[1] = '0' + i;
1304: 0f b6 45 c7 movzbl -0x39(%ebp),%eax
1308: 88 45 c9 mov %al,-0x37(%ebp)
unlink(name);
130b: e8 33 26 00 00 call 3943 <unlink>
for(pi = 0; pi < 4; pi++){
1310: 83 c4 10 add $0x10,%esp
1313: 83 eb 01 sub $0x1,%ebx
1316: 75 e3 jne 12fb <createdelete+0xdb>
for(i = 0; i < N; i++){
1318: 83 c6 01 add $0x1,%esi
131b: 89 f0 mov %esi,%eax
131d: 3c 84 cmp $0x84,%al
131f: 75 cf jne 12f0 <createdelete+0xd0>
printf(1, "createdelete ok\n");
1321: 83 ec 08 sub $0x8,%esp
1324: 68 73 42 00 00 push $0x4273
1329: 6a 01 push $0x1
132b: e8 50 27 00 00 call 3a80 <printf>
}
1330: 8d 65 f4 lea -0xc(%ebp),%esp
1333: 5b pop %ebx
1334: 5e pop %esi
1335: 5f pop %edi
1336: 5d pop %ebp
1337: c3 ret
1338: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
133f: 90 nop
} else if((i >= 1 && i < N/2) && fd >= 0){
1340: 85 c0 test %eax,%eax
1342: 78 91 js 12d5 <createdelete+0xb5>
printf(1, "oops createdelete %s did exist\n", name);
1344: 50 push %eax
1345: 57 push %edi
1346: 68 44 4f 00 00 push $0x4f44
134b: 6a 01 push $0x1
134d: e8 2e 27 00 00 call 3a80 <printf>
exit();
1352: e8 9c 25 00 00 call 38f3 <exit>
1357: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
135e: 66 90 xchg %ax,%ax
name[0] = 'p' + pi;
1360: 83 c3 70 add $0x70,%ebx
name[2] = '\0';
1363: c6 45 ca 00 movb $0x0,-0x36(%ebp)
1367: be 01 00 00 00 mov $0x1,%esi
136c: 8d 7d c8 lea -0x38(%ebp),%edi
name[0] = 'p' + pi;
136f: 88 5d c8 mov %bl,-0x38(%ebp)
name[2] = '\0';
1372: 31 db xor %ebx,%ebx
1374: eb 15 jmp 138b <createdelete+0x16b>
1376: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
137d: 8d 76 00 lea 0x0(%esi),%esi
for(i = 0; i < N; i++){
1380: 83 fe 14 cmp $0x14,%esi
1383: 74 6b je 13f0 <createdelete+0x1d0>
1385: 83 c3 01 add $0x1,%ebx
1388: 83 c6 01 add $0x1,%esi
fd = open(name, O_CREATE | O_RDWR);
138b: 83 ec 08 sub $0x8,%esp
name[1] = '0' + i;
138e: 8d 43 30 lea 0x30(%ebx),%eax
fd = open(name, O_CREATE | O_RDWR);
1391: 68 02 02 00 00 push $0x202
1396: 57 push %edi
name[1] = '0' + i;
1397: 88 45 c9 mov %al,-0x37(%ebp)
fd = open(name, O_CREATE | O_RDWR);
139a: e8 94 25 00 00 call 3933 <open>
if(fd < 0){
139f: 83 c4 10 add $0x10,%esp
13a2: 85 c0 test %eax,%eax
13a4: 78 78 js 141e <createdelete+0x1fe>
close(fd);
13a6: 83 ec 0c sub $0xc,%esp
13a9: 50 push %eax
13aa: e8 6c 25 00 00 call 391b <close>
if(i > 0 && (i % 2 ) == 0){
13af: 83 c4 10 add $0x10,%esp
13b2: 85 db test %ebx,%ebx
13b4: 74 cf je 1385 <createdelete+0x165>
13b6: f6 c3 01 test $0x1,%bl
13b9: 75 c5 jne 1380 <createdelete+0x160>
if(unlink(name) < 0){
13bb: 83 ec 0c sub $0xc,%esp
name[1] = '0' + (i / 2);
13be: 89 d8 mov %ebx,%eax
if(unlink(name) < 0){
13c0: 57 push %edi
name[1] = '0' + (i / 2);
13c1: d1 f8 sar %eax
13c3: 83 c0 30 add $0x30,%eax
13c6: 88 45 c9 mov %al,-0x37(%ebp)
if(unlink(name) < 0){
13c9: e8 75 25 00 00 call 3943 <unlink>
13ce: 83 c4 10 add $0x10,%esp
13d1: 85 c0 test %eax,%eax
13d3: 79 ab jns 1380 <createdelete+0x160>
printf(1, "unlink failed\n");
13d5: 52 push %edx
13d6: 52 push %edx
13d7: 68 61 3e 00 00 push $0x3e61
13dc: 6a 01 push $0x1
13de: e8 9d 26 00 00 call 3a80 <printf>
exit();
13e3: e8 0b 25 00 00 call 38f3 <exit>
13e8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
13ef: 90 nop
exit();
13f0: e8 fe 24 00 00 call 38f3 <exit>
printf(1, "oops createdelete %s didn't exist\n", name);
13f5: 83 ec 04 sub $0x4,%esp
13f8: 57 push %edi
13f9: 68 20 4f 00 00 push $0x4f20
13fe: 6a 01 push $0x1
1400: e8 7b 26 00 00 call 3a80 <printf>
exit();
1405: e8 e9 24 00 00 call 38f3 <exit>
printf(1, "fork failed\n");
140a: 83 ec 08 sub $0x8,%esp
140d: 68 e9 4c 00 00 push $0x4ce9
1412: 6a 01 push $0x1
1414: e8 67 26 00 00 call 3a80 <printf>
exit();
1419: e8 d5 24 00 00 call 38f3 <exit>
printf(1, "create failed\n");
141e: 83 ec 08 sub $0x8,%esp
1421: 68 af 44 00 00 push $0x44af
1426: 6a 01 push $0x1
1428: e8 53 26 00 00 call 3a80 <printf>
exit();
142d: e8 c1 24 00 00 call 38f3 <exit>
1432: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
1439: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00001440 <unlinkread>:
{
1440: 55 push %ebp
1441: 89 e5 mov %esp,%ebp
1443: 56 push %esi
1444: 53 push %ebx
printf(1, "unlinkread test\n");
1445: 83 ec 08 sub $0x8,%esp
1448: 68 84 42 00 00 push $0x4284
144d: 6a 01 push $0x1
144f: e8 2c 26 00 00 call 3a80 <printf>
fd = open("unlinkread", O_CREATE | O_RDWR);
1454: 5b pop %ebx
1455: 5e pop %esi
1456: 68 02 02 00 00 push $0x202
145b: 68 95 42 00 00 push $0x4295
1460: e8 ce 24 00 00 call 3933 <open>
if(fd < 0){
1465: 83 c4 10 add $0x10,%esp
1468: 85 c0 test %eax,%eax
146a: 0f 88 e6 00 00 00 js 1556 <unlinkread+0x116>
write(fd, "hello", 5);
1470: 83 ec 04 sub $0x4,%esp
1473: 89 c3 mov %eax,%ebx
1475: 6a 05 push $0x5
1477: 68 ba 42 00 00 push $0x42ba
147c: 50 push %eax
147d: e8 91 24 00 00 call 3913 <write>
close(fd);
1482: 89 1c 24 mov %ebx,(%esp)
1485: e8 91 24 00 00 call 391b <close>
fd = open("unlinkread", O_RDWR);
148a: 58 pop %eax
148b: 5a pop %edx
148c: 6a 02 push $0x2
148e: 68 95 42 00 00 push $0x4295
1493: e8 9b 24 00 00 call 3933 <open>
if(fd < 0){
1498: 83 c4 10 add $0x10,%esp
fd = open("unlinkread", O_RDWR);
149b: 89 c3 mov %eax,%ebx
if(fd < 0){
149d: 85 c0 test %eax,%eax
149f: 0f 88 10 01 00 00 js 15b5 <unlinkread+0x175>
if(unlink("unlinkread") != 0){
14a5: 83 ec 0c sub $0xc,%esp
14a8: 68 95 42 00 00 push $0x4295
14ad: e8 91 24 00 00 call 3943 <unlink>
14b2: 83 c4 10 add $0x10,%esp
14b5: 85 c0 test %eax,%eax
14b7: 0f 85 e5 00 00 00 jne 15a2 <unlinkread+0x162>
fd1 = open("unlinkread", O_CREATE | O_RDWR);
14bd: 83 ec 08 sub $0x8,%esp
14c0: 68 02 02 00 00 push $0x202
14c5: 68 95 42 00 00 push $0x4295
14ca: e8 64 24 00 00 call 3933 <open>
write(fd1, "yyy", 3);
14cf: 83 c4 0c add $0xc,%esp
14d2: 6a 03 push $0x3
fd1 = open("unlinkread", O_CREATE | O_RDWR);
14d4: 89 c6 mov %eax,%esi
write(fd1, "yyy", 3);
14d6: 68 f2 42 00 00 push $0x42f2
14db: 50 push %eax
14dc: e8 32 24 00 00 call 3913 <write>
close(fd1);
14e1: 89 34 24 mov %esi,(%esp)
14e4: e8 32 24 00 00 call 391b <close>
if(read(fd, buf, sizeof(buf)) != 5){
14e9: 83 c4 0c add $0xc,%esp
14ec: 68 00 20 00 00 push $0x2000
14f1: 68 00 86 00 00 push $0x8600
14f6: 53 push %ebx
14f7: e8 0f 24 00 00 call 390b <read>
14fc: 83 c4 10 add $0x10,%esp
14ff: 83 f8 05 cmp $0x5,%eax
1502: 0f 85 87 00 00 00 jne 158f <unlinkread+0x14f>
if(buf[0] != 'h'){
1508: 80 3d 00 86 00 00 68 cmpb $0x68,0x8600
150f: 75 6b jne 157c <unlinkread+0x13c>
if(write(fd, buf, 10) != 10){
1511: 83 ec 04 sub $0x4,%esp
1514: 6a 0a push $0xa
1516: 68 00 86 00 00 push $0x8600
151b: 53 push %ebx
151c: e8 f2 23 00 00 call 3913 <write>
1521: 83 c4 10 add $0x10,%esp
1524: 83 f8 0a cmp $0xa,%eax
1527: 75 40 jne 1569 <unlinkread+0x129>
close(fd);
1529: 83 ec 0c sub $0xc,%esp
152c: 53 push %ebx
152d: e8 e9 23 00 00 call 391b <close>
unlink("unlinkread");
1532: c7 04 24 95 42 00 00 movl $0x4295,(%esp)
1539: e8 05 24 00 00 call 3943 <unlink>
printf(1, "unlinkread ok\n");
153e: 58 pop %eax
153f: 5a pop %edx
1540: 68 3d 43 00 00 push $0x433d
1545: 6a 01 push $0x1
1547: e8 34 25 00 00 call 3a80 <printf>
}
154c: 83 c4 10 add $0x10,%esp
154f: 8d 65 f8 lea -0x8(%ebp),%esp
1552: 5b pop %ebx
1553: 5e pop %esi
1554: 5d pop %ebp
1555: c3 ret
printf(1, "create unlinkread failed\n");
1556: 51 push %ecx
1557: 51 push %ecx
1558: 68 a0 42 00 00 push $0x42a0
155d: 6a 01 push $0x1
155f: e8 1c 25 00 00 call 3a80 <printf>
exit();
1564: e8 8a 23 00 00 call 38f3 <exit>
printf(1, "unlinkread write failed\n");
1569: 51 push %ecx
156a: 51 push %ecx
156b: 68 24 43 00 00 push $0x4324
1570: 6a 01 push $0x1
1572: e8 09 25 00 00 call 3a80 <printf>
exit();
1577: e8 77 23 00 00 call 38f3 <exit>
printf(1, "unlinkread wrong data\n");
157c: 53 push %ebx
157d: 53 push %ebx
157e: 68 0d 43 00 00 push $0x430d
1583: 6a 01 push $0x1
1585: e8 f6 24 00 00 call 3a80 <printf>
exit();
158a: e8 64 23 00 00 call 38f3 <exit>
printf(1, "unlinkread read failed");
158f: 56 push %esi
1590: 56 push %esi
1591: 68 f6 42 00 00 push $0x42f6
1596: 6a 01 push $0x1
1598: e8 e3 24 00 00 call 3a80 <printf>
exit();
159d: e8 51 23 00 00 call 38f3 <exit>
printf(1, "unlink unlinkread failed\n");
15a2: 50 push %eax
15a3: 50 push %eax
15a4: 68 d8 42 00 00 push $0x42d8
15a9: 6a 01 push $0x1
15ab: e8 d0 24 00 00 call 3a80 <printf>
exit();
15b0: e8 3e 23 00 00 call 38f3 <exit>
printf(1, "open unlinkread failed\n");
15b5: 50 push %eax
15b6: 50 push %eax
15b7: 68 c0 42 00 00 push $0x42c0
15bc: 6a 01 push $0x1
15be: e8 bd 24 00 00 call 3a80 <printf>
exit();
15c3: e8 2b 23 00 00 call 38f3 <exit>
15c8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
15cf: 90 nop
000015d0 <linktest>:
{
15d0: 55 push %ebp
15d1: 89 e5 mov %esp,%ebp
15d3: 53 push %ebx
15d4: 83 ec 0c sub $0xc,%esp
printf(1, "linktest\n");
15d7: 68 4c 43 00 00 push $0x434c
15dc: 6a 01 push $0x1
15de: e8 9d 24 00 00 call 3a80 <printf>
unlink("lf1");
15e3: c7 04 24 56 43 00 00 movl $0x4356,(%esp)
15ea: e8 54 23 00 00 call 3943 <unlink>
unlink("lf2");
15ef: c7 04 24 5a 43 00 00 movl $0x435a,(%esp)
15f6: e8 48 23 00 00 call 3943 <unlink>
fd = open("lf1", O_CREATE|O_RDWR);
15fb: 58 pop %eax
15fc: 5a pop %edx
15fd: 68 02 02 00 00 push $0x202
1602: 68 56 43 00 00 push $0x4356
1607: e8 27 23 00 00 call 3933 <open>
if(fd < 0){
160c: 83 c4 10 add $0x10,%esp
160f: 85 c0 test %eax,%eax
1611: 0f 88 1e 01 00 00 js 1735 <linktest+0x165>
if(write(fd, "hello", 5) != 5){
1617: 83 ec 04 sub $0x4,%esp
161a: 89 c3 mov %eax,%ebx
161c: 6a 05 push $0x5
161e: 68 ba 42 00 00 push $0x42ba
1623: 50 push %eax
1624: e8 ea 22 00 00 call 3913 <write>
1629: 83 c4 10 add $0x10,%esp
162c: 83 f8 05 cmp $0x5,%eax
162f: 0f 85 98 01 00 00 jne 17cd <linktest+0x1fd>
close(fd);
1635: 83 ec 0c sub $0xc,%esp
1638: 53 push %ebx
1639: e8 dd 22 00 00 call 391b <close>
if(link("lf1", "lf2") < 0){
163e: 5b pop %ebx
163f: 58 pop %eax
1640: 68 5a 43 00 00 push $0x435a
1645: 68 56 43 00 00 push $0x4356
164a: e8 04 23 00 00 call 3953 <link>
164f: 83 c4 10 add $0x10,%esp
1652: 85 c0 test %eax,%eax
1654: 0f 88 60 01 00 00 js 17ba <linktest+0x1ea>
unlink("lf1");
165a: 83 ec 0c sub $0xc,%esp
165d: 68 56 43 00 00 push $0x4356
1662: e8 dc 22 00 00 call 3943 <unlink>
if(open("lf1", 0) >= 0){
1667: 58 pop %eax
1668: 5a pop %edx
1669: 6a 00 push $0x0
166b: 68 56 43 00 00 push $0x4356
1670: e8 be 22 00 00 call 3933 <open>
1675: 83 c4 10 add $0x10,%esp
1678: 85 c0 test %eax,%eax
167a: 0f 89 27 01 00 00 jns 17a7 <linktest+0x1d7>
fd = open("lf2", 0);
1680: 83 ec 08 sub $0x8,%esp
1683: 6a 00 push $0x0
1685: 68 5a 43 00 00 push $0x435a
168a: e8 a4 22 00 00 call 3933 <open>
if(fd < 0){
168f: 83 c4 10 add $0x10,%esp
fd = open("lf2", 0);
1692: 89 c3 mov %eax,%ebx
if(fd < 0){
1694: 85 c0 test %eax,%eax
1696: 0f 88 f8 00 00 00 js 1794 <linktest+0x1c4>
if(read(fd, buf, sizeof(buf)) != 5){
169c: 83 ec 04 sub $0x4,%esp
169f: 68 00 20 00 00 push $0x2000
16a4: 68 00 86 00 00 push $0x8600
16a9: 50 push %eax
16aa: e8 5c 22 00 00 call 390b <read>
16af: 83 c4 10 add $0x10,%esp
16b2: 83 f8 05 cmp $0x5,%eax
16b5: 0f 85 c6 00 00 00 jne 1781 <linktest+0x1b1>
close(fd);
16bb: 83 ec 0c sub $0xc,%esp
16be: 53 push %ebx
16bf: e8 57 22 00 00 call 391b <close>
if(link("lf2", "lf2") >= 0){
16c4: 58 pop %eax
16c5: 5a pop %edx
16c6: 68 5a 43 00 00 push $0x435a
16cb: 68 5a 43 00 00 push $0x435a
16d0: e8 7e 22 00 00 call 3953 <link>
16d5: 83 c4 10 add $0x10,%esp
16d8: 85 c0 test %eax,%eax
16da: 0f 89 8e 00 00 00 jns 176e <linktest+0x19e>
unlink("lf2");
16e0: 83 ec 0c sub $0xc,%esp
16e3: 68 5a 43 00 00 push $0x435a
16e8: e8 56 22 00 00 call 3943 <unlink>
if(link("lf2", "lf1") >= 0){
16ed: 59 pop %ecx
16ee: 5b pop %ebx
16ef: 68 56 43 00 00 push $0x4356
16f4: 68 5a 43 00 00 push $0x435a
16f9: e8 55 22 00 00 call 3953 <link>
16fe: 83 c4 10 add $0x10,%esp
1701: 85 c0 test %eax,%eax
1703: 79 56 jns 175b <linktest+0x18b>
if(link(".", "lf1") >= 0){
1705: 83 ec 08 sub $0x8,%esp
1708: 68 56 43 00 00 push $0x4356
170d: 68 1e 46 00 00 push $0x461e
1712: e8 3c 22 00 00 call 3953 <link>
1717: 83 c4 10 add $0x10,%esp
171a: 85 c0 test %eax,%eax
171c: 79 2a jns 1748 <linktest+0x178>
printf(1, "linktest ok\n");
171e: 83 ec 08 sub $0x8,%esp
1721: 68 f4 43 00 00 push $0x43f4
1726: 6a 01 push $0x1
1728: e8 53 23 00 00 call 3a80 <printf>
}
172d: 8b 5d fc mov -0x4(%ebp),%ebx
1730: 83 c4 10 add $0x10,%esp
1733: c9 leave
1734: c3 ret
printf(1, "create lf1 failed\n");
1735: 50 push %eax
1736: 50 push %eax
1737: 68 5e 43 00 00 push $0x435e
173c: 6a 01 push $0x1
173e: e8 3d 23 00 00 call 3a80 <printf>
exit();
1743: e8 ab 21 00 00 call 38f3 <exit>
printf(1, "link . lf1 succeeded! oops\n");
1748: 50 push %eax
1749: 50 push %eax
174a: 68 d8 43 00 00 push $0x43d8
174f: 6a 01 push $0x1
1751: e8 2a 23 00 00 call 3a80 <printf>
exit();
1756: e8 98 21 00 00 call 38f3 <exit>
printf(1, "link non-existant succeeded! oops\n");
175b: 52 push %edx
175c: 52 push %edx
175d: 68 8c 4f 00 00 push $0x4f8c
1762: 6a 01 push $0x1
1764: e8 17 23 00 00 call 3a80 <printf>
exit();
1769: e8 85 21 00 00 call 38f3 <exit>
printf(1, "link lf2 lf2 succeeded! oops\n");
176e: 50 push %eax
176f: 50 push %eax
1770: 68 ba 43 00 00 push $0x43ba
1775: 6a 01 push $0x1
1777: e8 04 23 00 00 call 3a80 <printf>
exit();
177c: e8 72 21 00 00 call 38f3 <exit>
printf(1, "read lf2 failed\n");
1781: 51 push %ecx
1782: 51 push %ecx
1783: 68 a9 43 00 00 push $0x43a9
1788: 6a 01 push $0x1
178a: e8 f1 22 00 00 call 3a80 <printf>
exit();
178f: e8 5f 21 00 00 call 38f3 <exit>
printf(1, "open lf2 failed\n");
1794: 53 push %ebx
1795: 53 push %ebx
1796: 68 98 43 00 00 push $0x4398
179b: 6a 01 push $0x1
179d: e8 de 22 00 00 call 3a80 <printf>
exit();
17a2: e8 4c 21 00 00 call 38f3 <exit>
printf(1, "unlinked lf1 but it is still there!\n");
17a7: 50 push %eax
17a8: 50 push %eax
17a9: 68 64 4f 00 00 push $0x4f64
17ae: 6a 01 push $0x1
17b0: e8 cb 22 00 00 call 3a80 <printf>
exit();
17b5: e8 39 21 00 00 call 38f3 <exit>
printf(1, "link lf1 lf2 failed\n");
17ba: 51 push %ecx
17bb: 51 push %ecx
17bc: 68 83 43 00 00 push $0x4383
17c1: 6a 01 push $0x1
17c3: e8 b8 22 00 00 call 3a80 <printf>
exit();
17c8: e8 26 21 00 00 call 38f3 <exit>
printf(1, "write lf1 failed\n");
17cd: 50 push %eax
17ce: 50 push %eax
17cf: 68 71 43 00 00 push $0x4371
17d4: 6a 01 push $0x1
17d6: e8 a5 22 00 00 call 3a80 <printf>
exit();
17db: e8 13 21 00 00 call 38f3 <exit>
000017e0 <concreate>:
{
17e0: 55 push %ebp
17e1: 89 e5 mov %esp,%ebp
17e3: 57 push %edi
17e4: 56 push %esi
for(i = 0; i < 40; i++){
17e5: 31 f6 xor %esi,%esi
{
17e7: 53 push %ebx
17e8: 8d 5d ad lea -0x53(%ebp),%ebx
17eb: 83 ec 64 sub $0x64,%esp
printf(1, "concreate test\n");
17ee: 68 01 44 00 00 push $0x4401
17f3: 6a 01 push $0x1
17f5: e8 86 22 00 00 call 3a80 <printf>
file[0] = 'C';
17fa: c6 45 ad 43 movb $0x43,-0x53(%ebp)
file[2] = '\0';
17fe: 83 c4 10 add $0x10,%esp
1801: c6 45 af 00 movb $0x0,-0x51(%ebp)
for(i = 0; i < 40; i++){
1805: eb 4c jmp 1853 <concreate+0x73>
1807: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
180e: 66 90 xchg %ax,%ax
1810: 69 c6 ab aa aa aa imul $0xaaaaaaab,%esi,%eax
if(pid && (i % 3) == 1){
1816: 3d ab aa aa aa cmp $0xaaaaaaab,%eax
181b: 0f 83 af 00 00 00 jae 18d0 <concreate+0xf0>
fd = open(file, O_CREATE | O_RDWR);
1821: 83 ec 08 sub $0x8,%esp
1824: 68 02 02 00 00 push $0x202
1829: 53 push %ebx
182a: e8 04 21 00 00 call 3933 <open>
if(fd < 0){
182f: 83 c4 10 add $0x10,%esp
1832: 85 c0 test %eax,%eax
1834: 78 5f js 1895 <concreate+0xb5>
close(fd);
1836: 83 ec 0c sub $0xc,%esp
for(i = 0; i < 40; i++){
1839: 83 c6 01 add $0x1,%esi
close(fd);
183c: 50 push %eax
183d: e8 d9 20 00 00 call 391b <close>
1842: 83 c4 10 add $0x10,%esp
wait();
1845: e8 b1 20 00 00 call 38fb <wait>
for(i = 0; i < 40; i++){
184a: 83 fe 28 cmp $0x28,%esi
184d: 0f 84 9f 00 00 00 je 18f2 <concreate+0x112>
unlink(file);
1853: 83 ec 0c sub $0xc,%esp
file[1] = '0' + i;
1856: 8d 46 30 lea 0x30(%esi),%eax
unlink(file);
1859: 53 push %ebx
file[1] = '0' + i;
185a: 88 45 ae mov %al,-0x52(%ebp)
unlink(file);
185d: e8 e1 20 00 00 call 3943 <unlink>
pid = fork();
1862: e8 84 20 00 00 call 38eb <fork>
if(pid && (i % 3) == 1){
1867: 83 c4 10 add $0x10,%esp
186a: 85 c0 test %eax,%eax
186c: 75 a2 jne 1810 <concreate+0x30>
link("C0", file);
186e: 69 f6 cd cc cc cc imul $0xcccccccd,%esi,%esi
} else if(pid == 0 && (i % 5) == 1){
1874: 81 fe cd cc cc cc cmp $0xcccccccd,%esi
187a: 73 34 jae 18b0 <concreate+0xd0>
fd = open(file, O_CREATE | O_RDWR);
187c: 83 ec 08 sub $0x8,%esp
187f: 68 02 02 00 00 push $0x202
1884: 53 push %ebx
1885: e8 a9 20 00 00 call 3933 <open>
if(fd < 0){
188a: 83 c4 10 add $0x10,%esp
188d: 85 c0 test %eax,%eax
188f: 0f 89 39 02 00 00 jns 1ace <concreate+0x2ee>
printf(1, "concreate create %s failed\n", file);
1895: 83 ec 04 sub $0x4,%esp
1898: 53 push %ebx
1899: 68 14 44 00 00 push $0x4414
189e: 6a 01 push $0x1
18a0: e8 db 21 00 00 call 3a80 <printf>
exit();
18a5: e8 49 20 00 00 call 38f3 <exit>
18aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
link("C0", file);
18b0: 83 ec 08 sub $0x8,%esp
18b3: 53 push %ebx
18b4: 68 11 44 00 00 push $0x4411
18b9: e8 95 20 00 00 call 3953 <link>
18be: 83 c4 10 add $0x10,%esp
exit();
18c1: e8 2d 20 00 00 call 38f3 <exit>
18c6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
18cd: 8d 76 00 lea 0x0(%esi),%esi
link("C0", file);
18d0: 83 ec 08 sub $0x8,%esp
for(i = 0; i < 40; i++){
18d3: 83 c6 01 add $0x1,%esi
link("C0", file);
18d6: 53 push %ebx
18d7: 68 11 44 00 00 push $0x4411
18dc: e8 72 20 00 00 call 3953 <link>
18e1: 83 c4 10 add $0x10,%esp
wait();
18e4: e8 12 20 00 00 call 38fb <wait>
for(i = 0; i < 40; i++){
18e9: 83 fe 28 cmp $0x28,%esi
18ec: 0f 85 61 ff ff ff jne 1853 <concreate+0x73>
memset(fa, 0, sizeof(fa));
18f2: 83 ec 04 sub $0x4,%esp
18f5: 8d 45 c0 lea -0x40(%ebp),%eax
18f8: 6a 28 push $0x28
18fa: 6a 00 push $0x0
18fc: 50 push %eax
18fd: e8 3e 1e 00 00 call 3740 <memset>
fd = open(".", 0);
1902: 5e pop %esi
1903: 5f pop %edi
1904: 6a 00 push $0x0
1906: 68 1e 46 00 00 push $0x461e
190b: 8d 7d b0 lea -0x50(%ebp),%edi
190e: e8 20 20 00 00 call 3933 <open>
n = 0;
1913: c7 45 a4 00 00 00 00 movl $0x0,-0x5c(%ebp)
while(read(fd, &de, sizeof(de)) > 0){
191a: 83 c4 10 add $0x10,%esp
fd = open(".", 0);
191d: 89 c6 mov %eax,%esi
while(read(fd, &de, sizeof(de)) > 0){
191f: 90 nop
1920: 83 ec 04 sub $0x4,%esp
1923: 6a 10 push $0x10
1925: 57 push %edi
1926: 56 push %esi
1927: e8 df 1f 00 00 call 390b <read>
192c: 83 c4 10 add $0x10,%esp
192f: 85 c0 test %eax,%eax
1931: 7e 3d jle 1970 <concreate+0x190>
if(de.inum == 0)
1933: 66 83 7d b0 00 cmpw $0x0,-0x50(%ebp)
1938: 74 e6 je 1920 <concreate+0x140>
if(de.name[0] == 'C' && de.name[2] == '\0'){
193a: 80 7d b2 43 cmpb $0x43,-0x4e(%ebp)
193e: 75 e0 jne 1920 <concreate+0x140>
1940: 80 7d b4 00 cmpb $0x0,-0x4c(%ebp)
1944: 75 da jne 1920 <concreate+0x140>
i = de.name[1] - '0';
1946: 0f be 45 b3 movsbl -0x4d(%ebp),%eax
194a: 83 e8 30 sub $0x30,%eax
if(i < 0 || i >= sizeof(fa)){
194d: 83 f8 27 cmp $0x27,%eax
1950: 0f 87 60 01 00 00 ja 1ab6 <concreate+0x2d6>
if(fa[i]){
1956: 80 7c 05 c0 00 cmpb $0x0,-0x40(%ebp,%eax,1)
195b: 0f 85 3d 01 00 00 jne 1a9e <concreate+0x2be>
n++;
1961: 83 45 a4 01 addl $0x1,-0x5c(%ebp)
fa[i] = 1;
1965: c6 44 05 c0 01 movb $0x1,-0x40(%ebp,%eax,1)
n++;
196a: eb b4 jmp 1920 <concreate+0x140>
196c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
close(fd);
1970: 83 ec 0c sub $0xc,%esp
1973: 56 push %esi
1974: e8 a2 1f 00 00 call 391b <close>
if(n != 40){
1979: 83 c4 10 add $0x10,%esp
197c: 83 7d a4 28 cmpl $0x28,-0x5c(%ebp)
1980: 0f 85 05 01 00 00 jne 1a8b <concreate+0x2ab>
for(i = 0; i < 40; i++){
1986: 31 f6 xor %esi,%esi
1988: eb 4c jmp 19d6 <concreate+0x1f6>
198a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
((i % 3) == 1 && pid != 0)){
1990: 85 ff test %edi,%edi
1992: 74 05 je 1999 <concreate+0x1b9>
1994: 83 f8 01 cmp $0x1,%eax
1997: 74 6c je 1a05 <concreate+0x225>
unlink(file);
1999: 83 ec 0c sub $0xc,%esp
199c: 53 push %ebx
199d: e8 a1 1f 00 00 call 3943 <unlink>
unlink(file);
19a2: 89 1c 24 mov %ebx,(%esp)
19a5: e8 99 1f 00 00 call 3943 <unlink>
unlink(file);
19aa: 89 1c 24 mov %ebx,(%esp)
19ad: e8 91 1f 00 00 call 3943 <unlink>
unlink(file);
19b2: 89 1c 24 mov %ebx,(%esp)
19b5: e8 89 1f 00 00 call 3943 <unlink>
19ba: 83 c4 10 add $0x10,%esp
if(pid == 0)
19bd: 85 ff test %edi,%edi
19bf: 0f 84 fc fe ff ff je 18c1 <concreate+0xe1>
wait();
19c5: e8 31 1f 00 00 call 38fb <wait>
for(i = 0; i < 40; i++){
19ca: 83 c6 01 add $0x1,%esi
19cd: 83 fe 28 cmp $0x28,%esi
19d0: 0f 84 8a 00 00 00 je 1a60 <concreate+0x280>
file[1] = '0' + i;
19d6: 8d 46 30 lea 0x30(%esi),%eax
19d9: 88 45 ae mov %al,-0x52(%ebp)
pid = fork();
19dc: e8 0a 1f 00 00 call 38eb <fork>
19e1: 89 c7 mov %eax,%edi
if(pid < 0){
19e3: 85 c0 test %eax,%eax
19e5: 0f 88 8c 00 00 00 js 1a77 <concreate+0x297>
if(((i % 3) == 0 && pid == 0) ||
19eb: b8 ab aa aa aa mov $0xaaaaaaab,%eax
19f0: f7 e6 mul %esi
19f2: 89 d0 mov %edx,%eax
19f4: 83 e2 fe and $0xfffffffe,%edx
19f7: d1 e8 shr %eax
19f9: 01 c2 add %eax,%edx
19fb: 89 f0 mov %esi,%eax
19fd: 29 d0 sub %edx,%eax
19ff: 89 c1 mov %eax,%ecx
1a01: 09 f9 or %edi,%ecx
1a03: 75 8b jne 1990 <concreate+0x1b0>
close(open(file, 0));
1a05: 83 ec 08 sub $0x8,%esp
1a08: 6a 00 push $0x0
1a0a: 53 push %ebx
1a0b: e8 23 1f 00 00 call 3933 <open>
1a10: 89 04 24 mov %eax,(%esp)
1a13: e8 03 1f 00 00 call 391b <close>
close(open(file, 0));
1a18: 58 pop %eax
1a19: 5a pop %edx
1a1a: 6a 00 push $0x0
1a1c: 53 push %ebx
1a1d: e8 11 1f 00 00 call 3933 <open>
1a22: 89 04 24 mov %eax,(%esp)
1a25: e8 f1 1e 00 00 call 391b <close>
close(open(file, 0));
1a2a: 59 pop %ecx
1a2b: 58 pop %eax
1a2c: 6a 00 push $0x0
1a2e: 53 push %ebx
1a2f: e8 ff 1e 00 00 call 3933 <open>
1a34: 89 04 24 mov %eax,(%esp)
1a37: e8 df 1e 00 00 call 391b <close>
close(open(file, 0));
1a3c: 58 pop %eax
1a3d: 5a pop %edx
1a3e: 6a 00 push $0x0
1a40: 53 push %ebx
1a41: e8 ed 1e 00 00 call 3933 <open>
1a46: 89 04 24 mov %eax,(%esp)
1a49: e8 cd 1e 00 00 call 391b <close>
1a4e: 83 c4 10 add $0x10,%esp
1a51: e9 67 ff ff ff jmp 19bd <concreate+0x1dd>
1a56: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
1a5d: 8d 76 00 lea 0x0(%esi),%esi
printf(1, "concreate ok\n");
1a60: 83 ec 08 sub $0x8,%esp
1a63: 68 66 44 00 00 push $0x4466
1a68: 6a 01 push $0x1
1a6a: e8 11 20 00 00 call 3a80 <printf>
}
1a6f: 8d 65 f4 lea -0xc(%ebp),%esp
1a72: 5b pop %ebx
1a73: 5e pop %esi
1a74: 5f pop %edi
1a75: 5d pop %ebp
1a76: c3 ret
printf(1, "fork failed\n");
1a77: 83 ec 08 sub $0x8,%esp
1a7a: 68 e9 4c 00 00 push $0x4ce9
1a7f: 6a 01 push $0x1
1a81: e8 fa 1f 00 00 call 3a80 <printf>
exit();
1a86: e8 68 1e 00 00 call 38f3 <exit>
printf(1, "concreate not enough files in directory listing\n");
1a8b: 51 push %ecx
1a8c: 51 push %ecx
1a8d: 68 b0 4f 00 00 push $0x4fb0
1a92: 6a 01 push $0x1
1a94: e8 e7 1f 00 00 call 3a80 <printf>
exit();
1a99: e8 55 1e 00 00 call 38f3 <exit>
printf(1, "concreate duplicate file %s\n", de.name);
1a9e: 83 ec 04 sub $0x4,%esp
1aa1: 8d 45 b2 lea -0x4e(%ebp),%eax
1aa4: 50 push %eax
1aa5: 68 49 44 00 00 push $0x4449
1aaa: 6a 01 push $0x1
1aac: e8 cf 1f 00 00 call 3a80 <printf>
exit();
1ab1: e8 3d 1e 00 00 call 38f3 <exit>
printf(1, "concreate weird file %s\n", de.name);
1ab6: 83 ec 04 sub $0x4,%esp
1ab9: 8d 45 b2 lea -0x4e(%ebp),%eax
1abc: 50 push %eax
1abd: 68 30 44 00 00 push $0x4430
1ac2: 6a 01 push $0x1
1ac4: e8 b7 1f 00 00 call 3a80 <printf>
exit();
1ac9: e8 25 1e 00 00 call 38f3 <exit>
close(fd);
1ace: 83 ec 0c sub $0xc,%esp
1ad1: 50 push %eax
1ad2: e8 44 1e 00 00 call 391b <close>
1ad7: 83 c4 10 add $0x10,%esp
1ada: e9 e2 fd ff ff jmp 18c1 <concreate+0xe1>
1adf: 90 nop
00001ae0 <linkunlink>:
{
1ae0: 55 push %ebp
1ae1: 89 e5 mov %esp,%ebp
1ae3: 57 push %edi
1ae4: 56 push %esi
1ae5: 53 push %ebx
1ae6: 83 ec 24 sub $0x24,%esp
printf(1, "linkunlink test\n");
1ae9: 68 74 44 00 00 push $0x4474
1aee: 6a 01 push $0x1
1af0: e8 8b 1f 00 00 call 3a80 <printf>
unlink("x");
1af5: c7 04 24 01 47 00 00 movl $0x4701,(%esp)
1afc: e8 42 1e 00 00 call 3943 <unlink>
pid = fork();
1b01: e8 e5 1d 00 00 call 38eb <fork>
if(pid < 0){
1b06: 83 c4 10 add $0x10,%esp
pid = fork();
1b09: 89 45 e4 mov %eax,-0x1c(%ebp)
if(pid < 0){
1b0c: 85 c0 test %eax,%eax
1b0e: 0f 88 b6 00 00 00 js 1bca <linkunlink+0xea>
unsigned int x = (pid ? 1 : 97);
1b14: 83 7d e4 01 cmpl $0x1,-0x1c(%ebp)
1b18: bb 64 00 00 00 mov $0x64,%ebx
if((x % 3) == 0){
1b1d: be ab aa aa aa mov $0xaaaaaaab,%esi
unsigned int x = (pid ? 1 : 97);
1b22: 19 ff sbb %edi,%edi
1b24: 83 e7 60 and $0x60,%edi
1b27: 83 c7 01 add $0x1,%edi
1b2a: eb 1e jmp 1b4a <linkunlink+0x6a>
1b2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
} else if((x % 3) == 1){
1b30: 83 f8 01 cmp $0x1,%eax
1b33: 74 7b je 1bb0 <linkunlink+0xd0>
unlink("x");
1b35: 83 ec 0c sub $0xc,%esp
1b38: 68 01 47 00 00 push $0x4701
1b3d: e8 01 1e 00 00 call 3943 <unlink>
1b42: 83 c4 10 add $0x10,%esp
for(i = 0; i < 100; i++){
1b45: 83 eb 01 sub $0x1,%ebx
1b48: 74 41 je 1b8b <linkunlink+0xab>
x = x * 1103515245 + 12345;
1b4a: 69 cf 6d 4e c6 41 imul $0x41c64e6d,%edi,%ecx
1b50: 8d b9 39 30 00 00 lea 0x3039(%ecx),%edi
if((x % 3) == 0){
1b56: 89 f8 mov %edi,%eax
1b58: f7 e6 mul %esi
1b5a: 89 d0 mov %edx,%eax
1b5c: 83 e2 fe and $0xfffffffe,%edx
1b5f: d1 e8 shr %eax
1b61: 01 c2 add %eax,%edx
1b63: 89 f8 mov %edi,%eax
1b65: 29 d0 sub %edx,%eax
1b67: 75 c7 jne 1b30 <linkunlink+0x50>
close(open("x", O_RDWR | O_CREATE));
1b69: 83 ec 08 sub $0x8,%esp
1b6c: 68 02 02 00 00 push $0x202
1b71: 68 01 47 00 00 push $0x4701
1b76: e8 b8 1d 00 00 call 3933 <open>
1b7b: 89 04 24 mov %eax,(%esp)
1b7e: e8 98 1d 00 00 call 391b <close>
1b83: 83 c4 10 add $0x10,%esp
for(i = 0; i < 100; i++){
1b86: 83 eb 01 sub $0x1,%ebx
1b89: 75 bf jne 1b4a <linkunlink+0x6a>
if(pid)
1b8b: 8b 45 e4 mov -0x1c(%ebp),%eax
1b8e: 85 c0 test %eax,%eax
1b90: 74 4b je 1bdd <linkunlink+0xfd>
wait();
1b92: e8 64 1d 00 00 call 38fb <wait>
printf(1, "linkunlink ok\n");
1b97: 83 ec 08 sub $0x8,%esp
1b9a: 68 89 44 00 00 push $0x4489
1b9f: 6a 01 push $0x1
1ba1: e8 da 1e 00 00 call 3a80 <printf>
}
1ba6: 8d 65 f4 lea -0xc(%ebp),%esp
1ba9: 5b pop %ebx
1baa: 5e pop %esi
1bab: 5f pop %edi
1bac: 5d pop %ebp
1bad: c3 ret
1bae: 66 90 xchg %ax,%ax
link("cat", "x");
1bb0: 83 ec 08 sub $0x8,%esp
1bb3: 68 01 47 00 00 push $0x4701
1bb8: 68 85 44 00 00 push $0x4485
1bbd: e8 91 1d 00 00 call 3953 <link>
1bc2: 83 c4 10 add $0x10,%esp
1bc5: e9 7b ff ff ff jmp 1b45 <linkunlink+0x65>
printf(1, "fork failed\n");
1bca: 52 push %edx
1bcb: 52 push %edx
1bcc: 68 e9 4c 00 00 push $0x4ce9
1bd1: 6a 01 push $0x1
1bd3: e8 a8 1e 00 00 call 3a80 <printf>
exit();
1bd8: e8 16 1d 00 00 call 38f3 <exit>
exit();
1bdd: e8 11 1d 00 00 call 38f3 <exit>
1be2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
1be9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00001bf0 <bigdir>:
{
1bf0: 55 push %ebp
1bf1: 89 e5 mov %esp,%ebp
1bf3: 57 push %edi
1bf4: 56 push %esi
1bf5: 53 push %ebx
1bf6: 83 ec 24 sub $0x24,%esp
printf(1, "bigdir test\n");
1bf9: 68 98 44 00 00 push $0x4498
1bfe: 6a 01 push $0x1
1c00: e8 7b 1e 00 00 call 3a80 <printf>
unlink("bd");
1c05: c7 04 24 a5 44 00 00 movl $0x44a5,(%esp)
1c0c: e8 32 1d 00 00 call 3943 <unlink>
fd = open("bd", O_CREATE);
1c11: 5a pop %edx
1c12: 59 pop %ecx
1c13: 68 00 02 00 00 push $0x200
1c18: 68 a5 44 00 00 push $0x44a5
1c1d: e8 11 1d 00 00 call 3933 <open>
if(fd < 0){
1c22: 83 c4 10 add $0x10,%esp
1c25: 85 c0 test %eax,%eax
1c27: 0f 88 de 00 00 00 js 1d0b <bigdir+0x11b>
close(fd);
1c2d: 83 ec 0c sub $0xc,%esp
for(i = 0; i < 500; i++){
1c30: 31 f6 xor %esi,%esi
1c32: 8d 7d de lea -0x22(%ebp),%edi
close(fd);
1c35: 50 push %eax
1c36: e8 e0 1c 00 00 call 391b <close>
1c3b: 83 c4 10 add $0x10,%esp
1c3e: 66 90 xchg %ax,%ax
name[1] = '0' + (i / 64);
1c40: 89 f0 mov %esi,%eax
if(link("bd", name) != 0){
1c42: 83 ec 08 sub $0x8,%esp
name[0] = 'x';
1c45: c6 45 de 78 movb $0x78,-0x22(%ebp)
name[1] = '0' + (i / 64);
1c49: c1 f8 06 sar $0x6,%eax
if(link("bd", name) != 0){
1c4c: 57 push %edi
name[1] = '0' + (i / 64);
1c4d: 83 c0 30 add $0x30,%eax
if(link("bd", name) != 0){
1c50: 68 a5 44 00 00 push $0x44a5
name[1] = '0' + (i / 64);
1c55: 88 45 df mov %al,-0x21(%ebp)
name[2] = '0' + (i % 64);
1c58: 89 f0 mov %esi,%eax
1c5a: 83 e0 3f and $0x3f,%eax
name[3] = '\0';
1c5d: c6 45 e1 00 movb $0x0,-0x1f(%ebp)
name[2] = '0' + (i % 64);
1c61: 83 c0 30 add $0x30,%eax
1c64: 88 45 e0 mov %al,-0x20(%ebp)
if(link("bd", name) != 0){
1c67: e8 e7 1c 00 00 call 3953 <link>
1c6c: 83 c4 10 add $0x10,%esp
1c6f: 89 c3 mov %eax,%ebx
1c71: 85 c0 test %eax,%eax
1c73: 75 6e jne 1ce3 <bigdir+0xf3>
for(i = 0; i < 500; i++){
1c75: 83 c6 01 add $0x1,%esi
1c78: 81 fe f4 01 00 00 cmp $0x1f4,%esi
1c7e: 75 c0 jne 1c40 <bigdir+0x50>
unlink("bd");
1c80: 83 ec 0c sub $0xc,%esp
1c83: 68 a5 44 00 00 push $0x44a5
1c88: e8 b6 1c 00 00 call 3943 <unlink>
1c8d: 83 c4 10 add $0x10,%esp
name[1] = '0' + (i / 64);
1c90: 89 d8 mov %ebx,%eax
if(unlink(name) != 0){
1c92: 83 ec 0c sub $0xc,%esp
name[0] = 'x';
1c95: c6 45 de 78 movb $0x78,-0x22(%ebp)
name[1] = '0' + (i / 64);
1c99: c1 f8 06 sar $0x6,%eax
if(unlink(name) != 0){
1c9c: 57 push %edi
name[1] = '0' + (i / 64);
1c9d: 83 c0 30 add $0x30,%eax
name[3] = '\0';
1ca0: c6 45 e1 00 movb $0x0,-0x1f(%ebp)
name[1] = '0' + (i / 64);
1ca4: 88 45 df mov %al,-0x21(%ebp)
name[2] = '0' + (i % 64);
1ca7: 89 d8 mov %ebx,%eax
1ca9: 83 e0 3f and $0x3f,%eax
1cac: 83 c0 30 add $0x30,%eax
1caf: 88 45 e0 mov %al,-0x20(%ebp)
if(unlink(name) != 0){
1cb2: e8 8c 1c 00 00 call 3943 <unlink>
1cb7: 83 c4 10 add $0x10,%esp
1cba: 85 c0 test %eax,%eax
1cbc: 75 39 jne 1cf7 <bigdir+0x107>
for(i = 0; i < 500; i++){
1cbe: 83 c3 01 add $0x1,%ebx
1cc1: 81 fb f4 01 00 00 cmp $0x1f4,%ebx
1cc7: 75 c7 jne 1c90 <bigdir+0xa0>
printf(1, "bigdir ok\n");
1cc9: 83 ec 08 sub $0x8,%esp
1ccc: 68 e7 44 00 00 push $0x44e7
1cd1: 6a 01 push $0x1
1cd3: e8 a8 1d 00 00 call 3a80 <printf>
1cd8: 83 c4 10 add $0x10,%esp
}
1cdb: 8d 65 f4 lea -0xc(%ebp),%esp
1cde: 5b pop %ebx
1cdf: 5e pop %esi
1ce0: 5f pop %edi
1ce1: 5d pop %ebp
1ce2: c3 ret
printf(1, "bigdir link failed\n");
1ce3: 83 ec 08 sub $0x8,%esp
1ce6: 68 be 44 00 00 push $0x44be
1ceb: 6a 01 push $0x1
1ced: e8 8e 1d 00 00 call 3a80 <printf>
exit();
1cf2: e8 fc 1b 00 00 call 38f3 <exit>
printf(1, "bigdir unlink failed");
1cf7: 83 ec 08 sub $0x8,%esp
1cfa: 68 d2 44 00 00 push $0x44d2
1cff: 6a 01 push $0x1
1d01: e8 7a 1d 00 00 call 3a80 <printf>
exit();
1d06: e8 e8 1b 00 00 call 38f3 <exit>
printf(1, "bigdir create failed\n");
1d0b: 50 push %eax
1d0c: 50 push %eax
1d0d: 68 a8 44 00 00 push $0x44a8
1d12: 6a 01 push $0x1
1d14: e8 67 1d 00 00 call 3a80 <printf>
exit();
1d19: e8 d5 1b 00 00 call 38f3 <exit>
1d1e: 66 90 xchg %ax,%ax
00001d20 <subdir>:
{
1d20: 55 push %ebp
1d21: 89 e5 mov %esp,%ebp
1d23: 53 push %ebx
1d24: 83 ec 0c sub $0xc,%esp
printf(1, "subdir test\n");
1d27: 68 f2 44 00 00 push $0x44f2
1d2c: 6a 01 push $0x1
1d2e: e8 4d 1d 00 00 call 3a80 <printf>
unlink("ff");
1d33: c7 04 24 7b 45 00 00 movl $0x457b,(%esp)
1d3a: e8 04 1c 00 00 call 3943 <unlink>
if(mkdir("dd") != 0){
1d3f: c7 04 24 18 46 00 00 movl $0x4618,(%esp)
1d46: e8 10 1c 00 00 call 395b <mkdir>
1d4b: 83 c4 10 add $0x10,%esp
1d4e: 85 c0 test %eax,%eax
1d50: 0f 85 b3 05 00 00 jne 2309 <subdir+0x5e9>
fd = open("dd/ff", O_CREATE | O_RDWR);
1d56: 83 ec 08 sub $0x8,%esp
1d59: 68 02 02 00 00 push $0x202
1d5e: 68 51 45 00 00 push $0x4551
1d63: e8 cb 1b 00 00 call 3933 <open>
if(fd < 0){
1d68: 83 c4 10 add $0x10,%esp
fd = open("dd/ff", O_CREATE | O_RDWR);
1d6b: 89 c3 mov %eax,%ebx
if(fd < 0){
1d6d: 85 c0 test %eax,%eax
1d6f: 0f 88 81 05 00 00 js 22f6 <subdir+0x5d6>
write(fd, "ff", 2);
1d75: 83 ec 04 sub $0x4,%esp
1d78: 6a 02 push $0x2
1d7a: 68 7b 45 00 00 push $0x457b
1d7f: 50 push %eax
1d80: e8 8e 1b 00 00 call 3913 <write>
close(fd);
1d85: 89 1c 24 mov %ebx,(%esp)
1d88: e8 8e 1b 00 00 call 391b <close>
if(unlink("dd") >= 0){
1d8d: c7 04 24 18 46 00 00 movl $0x4618,(%esp)
1d94: e8 aa 1b 00 00 call 3943 <unlink>
1d99: 83 c4 10 add $0x10,%esp
1d9c: 85 c0 test %eax,%eax
1d9e: 0f 89 3f 05 00 00 jns 22e3 <subdir+0x5c3>
if(mkdir("/dd/dd") != 0){
1da4: 83 ec 0c sub $0xc,%esp
1da7: 68 2c 45 00 00 push $0x452c
1dac: e8 aa 1b 00 00 call 395b <mkdir>
1db1: 83 c4 10 add $0x10,%esp
1db4: 85 c0 test %eax,%eax
1db6: 0f 85 14 05 00 00 jne 22d0 <subdir+0x5b0>
fd = open("dd/dd/ff", O_CREATE | O_RDWR);
1dbc: 83 ec 08 sub $0x8,%esp
1dbf: 68 02 02 00 00 push $0x202
1dc4: 68 4e 45 00 00 push $0x454e
1dc9: e8 65 1b 00 00 call 3933 <open>
if(fd < 0){
1dce: 83 c4 10 add $0x10,%esp
fd = open("dd/dd/ff", O_CREATE | O_RDWR);
1dd1: 89 c3 mov %eax,%ebx
if(fd < 0){
1dd3: 85 c0 test %eax,%eax
1dd5: 0f 88 24 04 00 00 js 21ff <subdir+0x4df>
write(fd, "FF", 2);
1ddb: 83 ec 04 sub $0x4,%esp
1dde: 6a 02 push $0x2
1de0: 68 6f 45 00 00 push $0x456f
1de5: 50 push %eax
1de6: e8 28 1b 00 00 call 3913 <write>
close(fd);
1deb: 89 1c 24 mov %ebx,(%esp)
1dee: e8 28 1b 00 00 call 391b <close>
fd = open("dd/dd/../ff", 0);
1df3: 58 pop %eax
1df4: 5a pop %edx
1df5: 6a 00 push $0x0
1df7: 68 72 45 00 00 push $0x4572
1dfc: e8 32 1b 00 00 call 3933 <open>
if(fd < 0){
1e01: 83 c4 10 add $0x10,%esp
fd = open("dd/dd/../ff", 0);
1e04: 89 c3 mov %eax,%ebx
if(fd < 0){
1e06: 85 c0 test %eax,%eax
1e08: 0f 88 de 03 00 00 js 21ec <subdir+0x4cc>
cc = read(fd, buf, sizeof(buf));
1e0e: 83 ec 04 sub $0x4,%esp
1e11: 68 00 20 00 00 push $0x2000
1e16: 68 00 86 00 00 push $0x8600
1e1b: 50 push %eax
1e1c: e8 ea 1a 00 00 call 390b <read>
if(cc != 2 || buf[0] != 'f'){
1e21: 83 c4 10 add $0x10,%esp
1e24: 83 f8 02 cmp $0x2,%eax
1e27: 0f 85 3a 03 00 00 jne 2167 <subdir+0x447>
1e2d: 80 3d 00 86 00 00 66 cmpb $0x66,0x8600
1e34: 0f 85 2d 03 00 00 jne 2167 <subdir+0x447>
close(fd);
1e3a: 83 ec 0c sub $0xc,%esp
1e3d: 53 push %ebx
1e3e: e8 d8 1a 00 00 call 391b <close>
if(link("dd/dd/ff", "dd/dd/ffff") != 0){
1e43: 59 pop %ecx
1e44: 5b pop %ebx
1e45: 68 b2 45 00 00 push $0x45b2
1e4a: 68 4e 45 00 00 push $0x454e
1e4f: e8 ff 1a 00 00 call 3953 <link>
1e54: 83 c4 10 add $0x10,%esp
1e57: 85 c0 test %eax,%eax
1e59: 0f 85 c6 03 00 00 jne 2225 <subdir+0x505>
if(unlink("dd/dd/ff") != 0){
1e5f: 83 ec 0c sub $0xc,%esp
1e62: 68 4e 45 00 00 push $0x454e
1e67: e8 d7 1a 00 00 call 3943 <unlink>
1e6c: 83 c4 10 add $0x10,%esp
1e6f: 85 c0 test %eax,%eax
1e71: 0f 85 16 03 00 00 jne 218d <subdir+0x46d>
if(open("dd/dd/ff", O_RDONLY) >= 0){
1e77: 83 ec 08 sub $0x8,%esp
1e7a: 6a 00 push $0x0
1e7c: 68 4e 45 00 00 push $0x454e
1e81: e8 ad 1a 00 00 call 3933 <open>
1e86: 83 c4 10 add $0x10,%esp
1e89: 85 c0 test %eax,%eax
1e8b: 0f 89 2c 04 00 00 jns 22bd <subdir+0x59d>
if(chdir("dd") != 0){
1e91: 83 ec 0c sub $0xc,%esp
1e94: 68 18 46 00 00 push $0x4618
1e99: e8 c5 1a 00 00 call 3963 <chdir>
1e9e: 83 c4 10 add $0x10,%esp
1ea1: 85 c0 test %eax,%eax
1ea3: 0f 85 01 04 00 00 jne 22aa <subdir+0x58a>
if(chdir("dd/../../dd") != 0){
1ea9: 83 ec 0c sub $0xc,%esp
1eac: 68 e6 45 00 00 push $0x45e6
1eb1: e8 ad 1a 00 00 call 3963 <chdir>
1eb6: 83 c4 10 add $0x10,%esp
1eb9: 85 c0 test %eax,%eax
1ebb: 0f 85 b9 02 00 00 jne 217a <subdir+0x45a>
if(chdir("dd/../../../dd") != 0){
1ec1: 83 ec 0c sub $0xc,%esp
1ec4: 68 0c 46 00 00 push $0x460c
1ec9: e8 95 1a 00 00 call 3963 <chdir>
1ece: 83 c4 10 add $0x10,%esp
1ed1: 85 c0 test %eax,%eax
1ed3: 0f 85 a1 02 00 00 jne 217a <subdir+0x45a>
if(chdir("./..") != 0){
1ed9: 83 ec 0c sub $0xc,%esp
1edc: 68 1b 46 00 00 push $0x461b
1ee1: e8 7d 1a 00 00 call 3963 <chdir>
1ee6: 83 c4 10 add $0x10,%esp
1ee9: 85 c0 test %eax,%eax
1eeb: 0f 85 21 03 00 00 jne 2212 <subdir+0x4f2>
fd = open("dd/dd/ffff", 0);
1ef1: 83 ec 08 sub $0x8,%esp
1ef4: 6a 00 push $0x0
1ef6: 68 b2 45 00 00 push $0x45b2
1efb: e8 33 1a 00 00 call 3933 <open>
if(fd < 0){
1f00: 83 c4 10 add $0x10,%esp
fd = open("dd/dd/ffff", 0);
1f03: 89 c3 mov %eax,%ebx
if(fd < 0){
1f05: 85 c0 test %eax,%eax
1f07: 0f 88 e0 04 00 00 js 23ed <subdir+0x6cd>
if(read(fd, buf, sizeof(buf)) != 2){
1f0d: 83 ec 04 sub $0x4,%esp
1f10: 68 00 20 00 00 push $0x2000
1f15: 68 00 86 00 00 push $0x8600
1f1a: 50 push %eax
1f1b: e8 eb 19 00 00 call 390b <read>
1f20: 83 c4 10 add $0x10,%esp
1f23: 83 f8 02 cmp $0x2,%eax
1f26: 0f 85 ae 04 00 00 jne 23da <subdir+0x6ba>
close(fd);
1f2c: 83 ec 0c sub $0xc,%esp
1f2f: 53 push %ebx
1f30: e8 e6 19 00 00 call 391b <close>
if(open("dd/dd/ff", O_RDONLY) >= 0){
1f35: 58 pop %eax
1f36: 5a pop %edx
1f37: 6a 00 push $0x0
1f39: 68 4e 45 00 00 push $0x454e
1f3e: e8 f0 19 00 00 call 3933 <open>
1f43: 83 c4 10 add $0x10,%esp
1f46: 85 c0 test %eax,%eax
1f48: 0f 89 65 02 00 00 jns 21b3 <subdir+0x493>
if(open("dd/ff/ff", O_CREATE|O_RDWR) >= 0){
1f4e: 83 ec 08 sub $0x8,%esp
1f51: 68 02 02 00 00 push $0x202
1f56: 68 66 46 00 00 push $0x4666
1f5b: e8 d3 19 00 00 call 3933 <open>
1f60: 83 c4 10 add $0x10,%esp
1f63: 85 c0 test %eax,%eax
1f65: 0f 89 35 02 00 00 jns 21a0 <subdir+0x480>
if(open("dd/xx/ff", O_CREATE|O_RDWR) >= 0){
1f6b: 83 ec 08 sub $0x8,%esp
1f6e: 68 02 02 00 00 push $0x202
1f73: 68 8b 46 00 00 push $0x468b
1f78: e8 b6 19 00 00 call 3933 <open>
1f7d: 83 c4 10 add $0x10,%esp
1f80: 85 c0 test %eax,%eax
1f82: 0f 89 0f 03 00 00 jns 2297 <subdir+0x577>
if(open("dd", O_CREATE) >= 0){
1f88: 83 ec 08 sub $0x8,%esp
1f8b: 68 00 02 00 00 push $0x200
1f90: 68 18 46 00 00 push $0x4618
1f95: e8 99 19 00 00 call 3933 <open>
1f9a: 83 c4 10 add $0x10,%esp
1f9d: 85 c0 test %eax,%eax
1f9f: 0f 89 df 02 00 00 jns 2284 <subdir+0x564>
if(open("dd", O_RDWR) >= 0){
1fa5: 83 ec 08 sub $0x8,%esp
1fa8: 6a 02 push $0x2
1faa: 68 18 46 00 00 push $0x4618
1faf: e8 7f 19 00 00 call 3933 <open>
1fb4: 83 c4 10 add $0x10,%esp
1fb7: 85 c0 test %eax,%eax
1fb9: 0f 89 b2 02 00 00 jns 2271 <subdir+0x551>
if(open("dd", O_WRONLY) >= 0){
1fbf: 83 ec 08 sub $0x8,%esp
1fc2: 6a 01 push $0x1
1fc4: 68 18 46 00 00 push $0x4618
1fc9: e8 65 19 00 00 call 3933 <open>
1fce: 83 c4 10 add $0x10,%esp
1fd1: 85 c0 test %eax,%eax
1fd3: 0f 89 85 02 00 00 jns 225e <subdir+0x53e>
if(link("dd/ff/ff", "dd/dd/xx") == 0){
1fd9: 83 ec 08 sub $0x8,%esp
1fdc: 68 fa 46 00 00 push $0x46fa
1fe1: 68 66 46 00 00 push $0x4666
1fe6: e8 68 19 00 00 call 3953 <link>
1feb: 83 c4 10 add $0x10,%esp
1fee: 85 c0 test %eax,%eax
1ff0: 0f 84 55 02 00 00 je 224b <subdir+0x52b>
if(link("dd/xx/ff", "dd/dd/xx") == 0){
1ff6: 83 ec 08 sub $0x8,%esp
1ff9: 68 fa 46 00 00 push $0x46fa
1ffe: 68 8b 46 00 00 push $0x468b
2003: e8 4b 19 00 00 call 3953 <link>
2008: 83 c4 10 add $0x10,%esp
200b: 85 c0 test %eax,%eax
200d: 0f 84 25 02 00 00 je 2238 <subdir+0x518>
if(link("dd/ff", "dd/dd/ffff") == 0){
2013: 83 ec 08 sub $0x8,%esp
2016: 68 b2 45 00 00 push $0x45b2
201b: 68 51 45 00 00 push $0x4551
2020: e8 2e 19 00 00 call 3953 <link>
2025: 83 c4 10 add $0x10,%esp
2028: 85 c0 test %eax,%eax
202a: 0f 84 a9 01 00 00 je 21d9 <subdir+0x4b9>
if(mkdir("dd/ff/ff") == 0){
2030: 83 ec 0c sub $0xc,%esp
2033: 68 66 46 00 00 push $0x4666
2038: e8 1e 19 00 00 call 395b <mkdir>
203d: 83 c4 10 add $0x10,%esp
2040: 85 c0 test %eax,%eax
2042: 0f 84 7e 01 00 00 je 21c6 <subdir+0x4a6>
if(mkdir("dd/xx/ff") == 0){
2048: 83 ec 0c sub $0xc,%esp
204b: 68 8b 46 00 00 push $0x468b
2050: e8 06 19 00 00 call 395b <mkdir>
2055: 83 c4 10 add $0x10,%esp
2058: 85 c0 test %eax,%eax
205a: 0f 84 67 03 00 00 je 23c7 <subdir+0x6a7>
if(mkdir("dd/dd/ffff") == 0){
2060: 83 ec 0c sub $0xc,%esp
2063: 68 b2 45 00 00 push $0x45b2
2068: e8 ee 18 00 00 call 395b <mkdir>
206d: 83 c4 10 add $0x10,%esp
2070: 85 c0 test %eax,%eax
2072: 0f 84 3c 03 00 00 je 23b4 <subdir+0x694>
if(unlink("dd/xx/ff") == 0){
2078: 83 ec 0c sub $0xc,%esp
207b: 68 8b 46 00 00 push $0x468b
2080: e8 be 18 00 00 call 3943 <unlink>
2085: 83 c4 10 add $0x10,%esp
2088: 85 c0 test %eax,%eax
208a: 0f 84 11 03 00 00 je 23a1 <subdir+0x681>
if(unlink("dd/ff/ff") == 0){
2090: 83 ec 0c sub $0xc,%esp
2093: 68 66 46 00 00 push $0x4666
2098: e8 a6 18 00 00 call 3943 <unlink>
209d: 83 c4 10 add $0x10,%esp
20a0: 85 c0 test %eax,%eax
20a2: 0f 84 e6 02 00 00 je 238e <subdir+0x66e>
if(chdir("dd/ff") == 0){
20a8: 83 ec 0c sub $0xc,%esp
20ab: 68 51 45 00 00 push $0x4551
20b0: e8 ae 18 00 00 call 3963 <chdir>
20b5: 83 c4 10 add $0x10,%esp
20b8: 85 c0 test %eax,%eax
20ba: 0f 84 bb 02 00 00 je 237b <subdir+0x65b>
if(chdir("dd/xx") == 0){
20c0: 83 ec 0c sub $0xc,%esp
20c3: 68 fd 46 00 00 push $0x46fd
20c8: e8 96 18 00 00 call 3963 <chdir>
20cd: 83 c4 10 add $0x10,%esp
20d0: 85 c0 test %eax,%eax
20d2: 0f 84 90 02 00 00 je 2368 <subdir+0x648>
if(unlink("dd/dd/ffff") != 0){
20d8: 83 ec 0c sub $0xc,%esp
20db: 68 b2 45 00 00 push $0x45b2
20e0: e8 5e 18 00 00 call 3943 <unlink>
20e5: 83 c4 10 add $0x10,%esp
20e8: 85 c0 test %eax,%eax
20ea: 0f 85 9d 00 00 00 jne 218d <subdir+0x46d>
if(unlink("dd/ff") != 0){
20f0: 83 ec 0c sub $0xc,%esp
20f3: 68 51 45 00 00 push $0x4551
20f8: e8 46 18 00 00 call 3943 <unlink>
20fd: 83 c4 10 add $0x10,%esp
2100: 85 c0 test %eax,%eax
2102: 0f 85 4d 02 00 00 jne 2355 <subdir+0x635>
if(unlink("dd") == 0){
2108: 83 ec 0c sub $0xc,%esp
210b: 68 18 46 00 00 push $0x4618
2110: e8 2e 18 00 00 call 3943 <unlink>
2115: 83 c4 10 add $0x10,%esp
2118: 85 c0 test %eax,%eax
211a: 0f 84 22 02 00 00 je 2342 <subdir+0x622>
if(unlink("dd/dd") < 0){
2120: 83 ec 0c sub $0xc,%esp
2123: 68 2d 45 00 00 push $0x452d
2128: e8 16 18 00 00 call 3943 <unlink>
212d: 83 c4 10 add $0x10,%esp
2130: 85 c0 test %eax,%eax
2132: 0f 88 f7 01 00 00 js 232f <subdir+0x60f>
if(unlink("dd") < 0){
2138: 83 ec 0c sub $0xc,%esp
213b: 68 18 46 00 00 push $0x4618
2140: e8 fe 17 00 00 call 3943 <unlink>
2145: 83 c4 10 add $0x10,%esp
2148: 85 c0 test %eax,%eax
214a: 0f 88 cc 01 00 00 js 231c <subdir+0x5fc>
printf(1, "subdir ok\n");
2150: 83 ec 08 sub $0x8,%esp
2153: 68 fa 47 00 00 push $0x47fa
2158: 6a 01 push $0x1
215a: e8 21 19 00 00 call 3a80 <printf>
}
215f: 8b 5d fc mov -0x4(%ebp),%ebx
2162: 83 c4 10 add $0x10,%esp
2165: c9 leave
2166: c3 ret
printf(1, "dd/dd/../ff wrong content\n");
2167: 50 push %eax
2168: 50 push %eax
2169: 68 97 45 00 00 push $0x4597
216e: 6a 01 push $0x1
2170: e8 0b 19 00 00 call 3a80 <printf>
exit();
2175: e8 79 17 00 00 call 38f3 <exit>
printf(1, "chdir dd/../../dd failed\n");
217a: 50 push %eax
217b: 50 push %eax
217c: 68 f2 45 00 00 push $0x45f2
2181: 6a 01 push $0x1
2183: e8 f8 18 00 00 call 3a80 <printf>
exit();
2188: e8 66 17 00 00 call 38f3 <exit>
printf(1, "unlink dd/dd/ff failed\n");
218d: 50 push %eax
218e: 50 push %eax
218f: 68 bd 45 00 00 push $0x45bd
2194: 6a 01 push $0x1
2196: e8 e5 18 00 00 call 3a80 <printf>
exit();
219b: e8 53 17 00 00 call 38f3 <exit>
printf(1, "create dd/ff/ff succeeded!\n");
21a0: 51 push %ecx
21a1: 51 push %ecx
21a2: 68 6f 46 00 00 push $0x466f
21a7: 6a 01 push $0x1
21a9: e8 d2 18 00 00 call 3a80 <printf>
exit();
21ae: e8 40 17 00 00 call 38f3 <exit>
printf(1, "open (unlinked) dd/dd/ff succeeded!\n");
21b3: 53 push %ebx
21b4: 53 push %ebx
21b5: 68 54 50 00 00 push $0x5054
21ba: 6a 01 push $0x1
21bc: e8 bf 18 00 00 call 3a80 <printf>
exit();
21c1: e8 2d 17 00 00 call 38f3 <exit>
printf(1, "mkdir dd/ff/ff succeeded!\n");
21c6: 51 push %ecx
21c7: 51 push %ecx
21c8: 68 03 47 00 00 push $0x4703
21cd: 6a 01 push $0x1
21cf: e8 ac 18 00 00 call 3a80 <printf>
exit();
21d4: e8 1a 17 00 00 call 38f3 <exit>
printf(1, "link dd/ff dd/dd/ffff succeeded!\n");
21d9: 53 push %ebx
21da: 53 push %ebx
21db: 68 c4 50 00 00 push $0x50c4
21e0: 6a 01 push $0x1
21e2: e8 99 18 00 00 call 3a80 <printf>
exit();
21e7: e8 07 17 00 00 call 38f3 <exit>
printf(1, "open dd/dd/../ff failed\n");
21ec: 50 push %eax
21ed: 50 push %eax
21ee: 68 7e 45 00 00 push $0x457e
21f3: 6a 01 push $0x1
21f5: e8 86 18 00 00 call 3a80 <printf>
exit();
21fa: e8 f4 16 00 00 call 38f3 <exit>
printf(1, "create dd/dd/ff failed\n");
21ff: 51 push %ecx
2200: 51 push %ecx
2201: 68 57 45 00 00 push $0x4557
2206: 6a 01 push $0x1
2208: e8 73 18 00 00 call 3a80 <printf>
exit();
220d: e8 e1 16 00 00 call 38f3 <exit>
printf(1, "chdir ./.. failed\n");
2212: 50 push %eax
2213: 50 push %eax
2214: 68 20 46 00 00 push $0x4620
2219: 6a 01 push $0x1
221b: e8 60 18 00 00 call 3a80 <printf>
exit();
2220: e8 ce 16 00 00 call 38f3 <exit>
printf(1, "link dd/dd/ff dd/dd/ffff failed\n");
2225: 52 push %edx
2226: 52 push %edx
2227: 68 0c 50 00 00 push $0x500c
222c: 6a 01 push $0x1
222e: e8 4d 18 00 00 call 3a80 <printf>
exit();
2233: e8 bb 16 00 00 call 38f3 <exit>
printf(1, "link dd/xx/ff dd/dd/xx succeeded!\n");
2238: 50 push %eax
2239: 50 push %eax
223a: 68 a0 50 00 00 push $0x50a0
223f: 6a 01 push $0x1
2241: e8 3a 18 00 00 call 3a80 <printf>
exit();
2246: e8 a8 16 00 00 call 38f3 <exit>
printf(1, "link dd/ff/ff dd/dd/xx succeeded!\n");
224b: 50 push %eax
224c: 50 push %eax
224d: 68 7c 50 00 00 push $0x507c
2252: 6a 01 push $0x1
2254: e8 27 18 00 00 call 3a80 <printf>
exit();
2259: e8 95 16 00 00 call 38f3 <exit>
printf(1, "open dd wronly succeeded!\n");
225e: 50 push %eax
225f: 50 push %eax
2260: 68 df 46 00 00 push $0x46df
2265: 6a 01 push $0x1
2267: e8 14 18 00 00 call 3a80 <printf>
exit();
226c: e8 82 16 00 00 call 38f3 <exit>
printf(1, "open dd rdwr succeeded!\n");
2271: 50 push %eax
2272: 50 push %eax
2273: 68 c6 46 00 00 push $0x46c6
2278: 6a 01 push $0x1
227a: e8 01 18 00 00 call 3a80 <printf>
exit();
227f: e8 6f 16 00 00 call 38f3 <exit>
printf(1, "create dd succeeded!\n");
2284: 50 push %eax
2285: 50 push %eax
2286: 68 b0 46 00 00 push $0x46b0
228b: 6a 01 push $0x1
228d: e8 ee 17 00 00 call 3a80 <printf>
exit();
2292: e8 5c 16 00 00 call 38f3 <exit>
printf(1, "create dd/xx/ff succeeded!\n");
2297: 52 push %edx
2298: 52 push %edx
2299: 68 94 46 00 00 push $0x4694
229e: 6a 01 push $0x1
22a0: e8 db 17 00 00 call 3a80 <printf>
exit();
22a5: e8 49 16 00 00 call 38f3 <exit>
printf(1, "chdir dd failed\n");
22aa: 50 push %eax
22ab: 50 push %eax
22ac: 68 d5 45 00 00 push $0x45d5
22b1: 6a 01 push $0x1
22b3: e8 c8 17 00 00 call 3a80 <printf>
exit();
22b8: e8 36 16 00 00 call 38f3 <exit>
printf(1, "open (unlinked) dd/dd/ff succeeded\n");
22bd: 50 push %eax
22be: 50 push %eax
22bf: 68 30 50 00 00 push $0x5030
22c4: 6a 01 push $0x1
22c6: e8 b5 17 00 00 call 3a80 <printf>
exit();
22cb: e8 23 16 00 00 call 38f3 <exit>
printf(1, "subdir mkdir dd/dd failed\n");
22d0: 53 push %ebx
22d1: 53 push %ebx
22d2: 68 33 45 00 00 push $0x4533
22d7: 6a 01 push $0x1
22d9: e8 a2 17 00 00 call 3a80 <printf>
exit();
22de: e8 10 16 00 00 call 38f3 <exit>
printf(1, "unlink dd (non-empty dir) succeeded!\n");
22e3: 50 push %eax
22e4: 50 push %eax
22e5: 68 e4 4f 00 00 push $0x4fe4
22ea: 6a 01 push $0x1
22ec: e8 8f 17 00 00 call 3a80 <printf>
exit();
22f1: e8 fd 15 00 00 call 38f3 <exit>
printf(1, "create dd/ff failed\n");
22f6: 50 push %eax
22f7: 50 push %eax
22f8: 68 17 45 00 00 push $0x4517
22fd: 6a 01 push $0x1
22ff: e8 7c 17 00 00 call 3a80 <printf>
exit();
2304: e8 ea 15 00 00 call 38f3 <exit>
printf(1, "subdir mkdir dd failed\n");
2309: 50 push %eax
230a: 50 push %eax
230b: 68 ff 44 00 00 push $0x44ff
2310: 6a 01 push $0x1
2312: e8 69 17 00 00 call 3a80 <printf>
exit();
2317: e8 d7 15 00 00 call 38f3 <exit>
printf(1, "unlink dd failed\n");
231c: 50 push %eax
231d: 50 push %eax
231e: 68 e8 47 00 00 push $0x47e8
2323: 6a 01 push $0x1
2325: e8 56 17 00 00 call 3a80 <printf>
exit();
232a: e8 c4 15 00 00 call 38f3 <exit>
printf(1, "unlink dd/dd failed\n");
232f: 52 push %edx
2330: 52 push %edx
2331: 68 d3 47 00 00 push $0x47d3
2336: 6a 01 push $0x1
2338: e8 43 17 00 00 call 3a80 <printf>
exit();
233d: e8 b1 15 00 00 call 38f3 <exit>
printf(1, "unlink non-empty dd succeeded!\n");
2342: 51 push %ecx
2343: 51 push %ecx
2344: 68 e8 50 00 00 push $0x50e8
2349: 6a 01 push $0x1
234b: e8 30 17 00 00 call 3a80 <printf>
exit();
2350: e8 9e 15 00 00 call 38f3 <exit>
printf(1, "unlink dd/ff failed\n");
2355: 53 push %ebx
2356: 53 push %ebx
2357: 68 be 47 00 00 push $0x47be
235c: 6a 01 push $0x1
235e: e8 1d 17 00 00 call 3a80 <printf>
exit();
2363: e8 8b 15 00 00 call 38f3 <exit>
printf(1, "chdir dd/xx succeeded!\n");
2368: 50 push %eax
2369: 50 push %eax
236a: 68 a6 47 00 00 push $0x47a6
236f: 6a 01 push $0x1
2371: e8 0a 17 00 00 call 3a80 <printf>
exit();
2376: e8 78 15 00 00 call 38f3 <exit>
printf(1, "chdir dd/ff succeeded!\n");
237b: 50 push %eax
237c: 50 push %eax
237d: 68 8e 47 00 00 push $0x478e
2382: 6a 01 push $0x1
2384: e8 f7 16 00 00 call 3a80 <printf>
exit();
2389: e8 65 15 00 00 call 38f3 <exit>
printf(1, "unlink dd/ff/ff succeeded!\n");
238e: 50 push %eax
238f: 50 push %eax
2390: 68 72 47 00 00 push $0x4772
2395: 6a 01 push $0x1
2397: e8 e4 16 00 00 call 3a80 <printf>
exit();
239c: e8 52 15 00 00 call 38f3 <exit>
printf(1, "unlink dd/xx/ff succeeded!\n");
23a1: 50 push %eax
23a2: 50 push %eax
23a3: 68 56 47 00 00 push $0x4756
23a8: 6a 01 push $0x1
23aa: e8 d1 16 00 00 call 3a80 <printf>
exit();
23af: e8 3f 15 00 00 call 38f3 <exit>
printf(1, "mkdir dd/dd/ffff succeeded!\n");
23b4: 50 push %eax
23b5: 50 push %eax
23b6: 68 39 47 00 00 push $0x4739
23bb: 6a 01 push $0x1
23bd: e8 be 16 00 00 call 3a80 <printf>
exit();
23c2: e8 2c 15 00 00 call 38f3 <exit>
printf(1, "mkdir dd/xx/ff succeeded!\n");
23c7: 52 push %edx
23c8: 52 push %edx
23c9: 68 1e 47 00 00 push $0x471e
23ce: 6a 01 push $0x1
23d0: e8 ab 16 00 00 call 3a80 <printf>
exit();
23d5: e8 19 15 00 00 call 38f3 <exit>
printf(1, "read dd/dd/ffff wrong len\n");
23da: 51 push %ecx
23db: 51 push %ecx
23dc: 68 4b 46 00 00 push $0x464b
23e1: 6a 01 push $0x1
23e3: e8 98 16 00 00 call 3a80 <printf>
exit();
23e8: e8 06 15 00 00 call 38f3 <exit>
printf(1, "open dd/dd/ffff failed\n");
23ed: 53 push %ebx
23ee: 53 push %ebx
23ef: 68 33 46 00 00 push $0x4633
23f4: 6a 01 push $0x1
23f6: e8 85 16 00 00 call 3a80 <printf>
exit();
23fb: e8 f3 14 00 00 call 38f3 <exit>
00002400 <bigwrite>:
{
2400: 55 push %ebp
2401: 89 e5 mov %esp,%ebp
2403: 56 push %esi
2404: 53 push %ebx
for(sz = 499; sz < 12*512; sz += 471){
2405: bb f3 01 00 00 mov $0x1f3,%ebx
printf(1, "bigwrite test\n");
240a: 83 ec 08 sub $0x8,%esp
240d: 68 05 48 00 00 push $0x4805
2412: 6a 01 push $0x1
2414: e8 67 16 00 00 call 3a80 <printf>
unlink("bigwrite");
2419: c7 04 24 14 48 00 00 movl $0x4814,(%esp)
2420: e8 1e 15 00 00 call 3943 <unlink>
2425: 83 c4 10 add $0x10,%esp
2428: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
242f: 90 nop
fd = open("bigwrite", O_CREATE | O_RDWR);
2430: 83 ec 08 sub $0x8,%esp
2433: 68 02 02 00 00 push $0x202
2438: 68 14 48 00 00 push $0x4814
243d: e8 f1 14 00 00 call 3933 <open>
if(fd < 0){
2442: 83 c4 10 add $0x10,%esp
fd = open("bigwrite", O_CREATE | O_RDWR);
2445: 89 c6 mov %eax,%esi
if(fd < 0){
2447: 85 c0 test %eax,%eax
2449: 78 7e js 24c9 <bigwrite+0xc9>
int cc = write(fd, buf, sz);
244b: 83 ec 04 sub $0x4,%esp
244e: 53 push %ebx
244f: 68 00 86 00 00 push $0x8600
2454: 50 push %eax
2455: e8 b9 14 00 00 call 3913 <write>
if(cc != sz){
245a: 83 c4 10 add $0x10,%esp
245d: 39 d8 cmp %ebx,%eax
245f: 75 55 jne 24b6 <bigwrite+0xb6>
int cc = write(fd, buf, sz);
2461: 83 ec 04 sub $0x4,%esp
2464: 53 push %ebx
2465: 68 00 86 00 00 push $0x8600
246a: 56 push %esi
246b: e8 a3 14 00 00 call 3913 <write>
if(cc != sz){
2470: 83 c4 10 add $0x10,%esp
2473: 39 d8 cmp %ebx,%eax
2475: 75 3f jne 24b6 <bigwrite+0xb6>
close(fd);
2477: 83 ec 0c sub $0xc,%esp
for(sz = 499; sz < 12*512; sz += 471){
247a: 81 c3 d7 01 00 00 add $0x1d7,%ebx
close(fd);
2480: 56 push %esi
2481: e8 95 14 00 00 call 391b <close>
unlink("bigwrite");
2486: c7 04 24 14 48 00 00 movl $0x4814,(%esp)
248d: e8 b1 14 00 00 call 3943 <unlink>
for(sz = 499; sz < 12*512; sz += 471){
2492: 83 c4 10 add $0x10,%esp
2495: 81 fb 07 18 00 00 cmp $0x1807,%ebx
249b: 75 93 jne 2430 <bigwrite+0x30>
printf(1, "bigwrite ok\n");
249d: 83 ec 08 sub $0x8,%esp
24a0: 68 47 48 00 00 push $0x4847
24a5: 6a 01 push $0x1
24a7: e8 d4 15 00 00 call 3a80 <printf>
}
24ac: 83 c4 10 add $0x10,%esp
24af: 8d 65 f8 lea -0x8(%ebp),%esp
24b2: 5b pop %ebx
24b3: 5e pop %esi
24b4: 5d pop %ebp
24b5: c3 ret
printf(1, "write(%d) ret %d\n", sz, cc);
24b6: 50 push %eax
24b7: 53 push %ebx
24b8: 68 35 48 00 00 push $0x4835
24bd: 6a 01 push $0x1
24bf: e8 bc 15 00 00 call 3a80 <printf>
exit();
24c4: e8 2a 14 00 00 call 38f3 <exit>
printf(1, "cannot create bigwrite\n");
24c9: 83 ec 08 sub $0x8,%esp
24cc: 68 1d 48 00 00 push $0x481d
24d1: 6a 01 push $0x1
24d3: e8 a8 15 00 00 call 3a80 <printf>
exit();
24d8: e8 16 14 00 00 call 38f3 <exit>
24dd: 8d 76 00 lea 0x0(%esi),%esi
000024e0 <bigfile>:
{
24e0: 55 push %ebp
24e1: 89 e5 mov %esp,%ebp
24e3: 57 push %edi
24e4: 56 push %esi
24e5: 53 push %ebx
24e6: 83 ec 14 sub $0x14,%esp
printf(1, "bigfile test\n");
24e9: 68 54 48 00 00 push $0x4854
24ee: 6a 01 push $0x1
24f0: e8 8b 15 00 00 call 3a80 <printf>
unlink("bigfile");
24f5: c7 04 24 70 48 00 00 movl $0x4870,(%esp)
24fc: e8 42 14 00 00 call 3943 <unlink>
fd = open("bigfile", O_CREATE | O_RDWR);
2501: 58 pop %eax
2502: 5a pop %edx
2503: 68 02 02 00 00 push $0x202
2508: 68 70 48 00 00 push $0x4870
250d: e8 21 14 00 00 call 3933 <open>
if(fd < 0){
2512: 83 c4 10 add $0x10,%esp
2515: 85 c0 test %eax,%eax
2517: 0f 88 5e 01 00 00 js 267b <bigfile+0x19b>
251d: 89 c6 mov %eax,%esi
for(i = 0; i < 20; i++){
251f: 31 db xor %ebx,%ebx
2521: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
memset(buf, i, 600);
2528: 83 ec 04 sub $0x4,%esp
252b: 68 58 02 00 00 push $0x258
2530: 53 push %ebx
2531: 68 00 86 00 00 push $0x8600
2536: e8 05 12 00 00 call 3740 <memset>
if(write(fd, buf, 600) != 600){
253b: 83 c4 0c add $0xc,%esp
253e: 68 58 02 00 00 push $0x258
2543: 68 00 86 00 00 push $0x8600
2548: 56 push %esi
2549: e8 c5 13 00 00 call 3913 <write>
254e: 83 c4 10 add $0x10,%esp
2551: 3d 58 02 00 00 cmp $0x258,%eax
2556: 0f 85 f8 00 00 00 jne 2654 <bigfile+0x174>
for(i = 0; i < 20; i++){
255c: 83 c3 01 add $0x1,%ebx
255f: 83 fb 14 cmp $0x14,%ebx
2562: 75 c4 jne 2528 <bigfile+0x48>
close(fd);
2564: 83 ec 0c sub $0xc,%esp
2567: 56 push %esi
2568: e8 ae 13 00 00 call 391b <close>
fd = open("bigfile", 0);
256d: 5e pop %esi
256e: 5f pop %edi
256f: 6a 00 push $0x0
2571: 68 70 48 00 00 push $0x4870
2576: e8 b8 13 00 00 call 3933 <open>
if(fd < 0){
257b: 83 c4 10 add $0x10,%esp
fd = open("bigfile", 0);
257e: 89 c6 mov %eax,%esi
if(fd < 0){
2580: 85 c0 test %eax,%eax
2582: 0f 88 e0 00 00 00 js 2668 <bigfile+0x188>
total = 0;
2588: 31 db xor %ebx,%ebx
for(i = 0; ; i++){
258a: 31 ff xor %edi,%edi
258c: eb 30 jmp 25be <bigfile+0xde>
258e: 66 90 xchg %ax,%ax
if(cc != 300){
2590: 3d 2c 01 00 00 cmp $0x12c,%eax
2595: 0f 85 91 00 00 00 jne 262c <bigfile+0x14c>
if(buf[0] != i/2 || buf[299] != i/2){
259b: 89 fa mov %edi,%edx
259d: 0f be 05 00 86 00 00 movsbl 0x8600,%eax
25a4: d1 fa sar %edx
25a6: 39 d0 cmp %edx,%eax
25a8: 75 6e jne 2618 <bigfile+0x138>
25aa: 0f be 15 2b 87 00 00 movsbl 0x872b,%edx
25b1: 39 d0 cmp %edx,%eax
25b3: 75 63 jne 2618 <bigfile+0x138>
total += cc;
25b5: 81 c3 2c 01 00 00 add $0x12c,%ebx
for(i = 0; ; i++){
25bb: 83 c7 01 add $0x1,%edi
cc = read(fd, buf, 300);
25be: 83 ec 04 sub $0x4,%esp
25c1: 68 2c 01 00 00 push $0x12c
25c6: 68 00 86 00 00 push $0x8600
25cb: 56 push %esi
25cc: e8 3a 13 00 00 call 390b <read>
if(cc < 0){
25d1: 83 c4 10 add $0x10,%esp
25d4: 85 c0 test %eax,%eax
25d6: 78 68 js 2640 <bigfile+0x160>
if(cc == 0)
25d8: 75 b6 jne 2590 <bigfile+0xb0>
close(fd);
25da: 83 ec 0c sub $0xc,%esp
25dd: 56 push %esi
25de: e8 38 13 00 00 call 391b <close>
if(total != 20*600){
25e3: 83 c4 10 add $0x10,%esp
25e6: 81 fb e0 2e 00 00 cmp $0x2ee0,%ebx
25ec: 0f 85 9c 00 00 00 jne 268e <bigfile+0x1ae>
unlink("bigfile");
25f2: 83 ec 0c sub $0xc,%esp
25f5: 68 70 48 00 00 push $0x4870
25fa: e8 44 13 00 00 call 3943 <unlink>
printf(1, "bigfile test ok\n");
25ff: 58 pop %eax
2600: 5a pop %edx
2601: 68 ff 48 00 00 push $0x48ff
2606: 6a 01 push $0x1
2608: e8 73 14 00 00 call 3a80 <printf>
}
260d: 83 c4 10 add $0x10,%esp
2610: 8d 65 f4 lea -0xc(%ebp),%esp
2613: 5b pop %ebx
2614: 5e pop %esi
2615: 5f pop %edi
2616: 5d pop %ebp
2617: c3 ret
printf(1, "read bigfile wrong data\n");
2618: 83 ec 08 sub $0x8,%esp
261b: 68 cc 48 00 00 push $0x48cc
2620: 6a 01 push $0x1
2622: e8 59 14 00 00 call 3a80 <printf>
exit();
2627: e8 c7 12 00 00 call 38f3 <exit>
printf(1, "short read bigfile\n");
262c: 83 ec 08 sub $0x8,%esp
262f: 68 b8 48 00 00 push $0x48b8
2634: 6a 01 push $0x1
2636: e8 45 14 00 00 call 3a80 <printf>
exit();
263b: e8 b3 12 00 00 call 38f3 <exit>
printf(1, "read bigfile failed\n");
2640: 83 ec 08 sub $0x8,%esp
2643: 68 a3 48 00 00 push $0x48a3
2648: 6a 01 push $0x1
264a: e8 31 14 00 00 call 3a80 <printf>
exit();
264f: e8 9f 12 00 00 call 38f3 <exit>
printf(1, "write bigfile failed\n");
2654: 83 ec 08 sub $0x8,%esp
2657: 68 78 48 00 00 push $0x4878
265c: 6a 01 push $0x1
265e: e8 1d 14 00 00 call 3a80 <printf>
exit();
2663: e8 8b 12 00 00 call 38f3 <exit>
printf(1, "cannot open bigfile\n");
2668: 53 push %ebx
2669: 53 push %ebx
266a: 68 8e 48 00 00 push $0x488e
266f: 6a 01 push $0x1
2671: e8 0a 14 00 00 call 3a80 <printf>
exit();
2676: e8 78 12 00 00 call 38f3 <exit>
printf(1, "cannot create bigfile");
267b: 50 push %eax
267c: 50 push %eax
267d: 68 62 48 00 00 push $0x4862
2682: 6a 01 push $0x1
2684: e8 f7 13 00 00 call 3a80 <printf>
exit();
2689: e8 65 12 00 00 call 38f3 <exit>
printf(1, "read bigfile wrong total\n");
268e: 51 push %ecx
268f: 51 push %ecx
2690: 68 e5 48 00 00 push $0x48e5
2695: 6a 01 push $0x1
2697: e8 e4 13 00 00 call 3a80 <printf>
exit();
269c: e8 52 12 00 00 call 38f3 <exit>
26a1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
26a8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
26af: 90 nop
000026b0 <fourteen>:
{
26b0: 55 push %ebp
26b1: 89 e5 mov %esp,%ebp
26b3: 83 ec 10 sub $0x10,%esp
printf(1, "fourteen test\n");
26b6: 68 10 49 00 00 push $0x4910
26bb: 6a 01 push $0x1
26bd: e8 be 13 00 00 call 3a80 <printf>
if(mkdir("12345678901234") != 0){
26c2: c7 04 24 4b 49 00 00 movl $0x494b,(%esp)
26c9: e8 8d 12 00 00 call 395b <mkdir>
26ce: 83 c4 10 add $0x10,%esp
26d1: 85 c0 test %eax,%eax
26d3: 0f 85 97 00 00 00 jne 2770 <fourteen+0xc0>
if(mkdir("12345678901234/123456789012345") != 0){
26d9: 83 ec 0c sub $0xc,%esp
26dc: 68 08 51 00 00 push $0x5108
26e1: e8 75 12 00 00 call 395b <mkdir>
26e6: 83 c4 10 add $0x10,%esp
26e9: 85 c0 test %eax,%eax
26eb: 0f 85 de 00 00 00 jne 27cf <fourteen+0x11f>
fd = open("123456789012345/123456789012345/123456789012345", O_CREATE);
26f1: 83 ec 08 sub $0x8,%esp
26f4: 68 00 02 00 00 push $0x200
26f9: 68 58 51 00 00 push $0x5158
26fe: e8 30 12 00 00 call 3933 <open>
if(fd < 0){
2703: 83 c4 10 add $0x10,%esp
2706: 85 c0 test %eax,%eax
2708: 0f 88 ae 00 00 00 js 27bc <fourteen+0x10c>
close(fd);
270e: 83 ec 0c sub $0xc,%esp
2711: 50 push %eax
2712: e8 04 12 00 00 call 391b <close>
fd = open("12345678901234/12345678901234/12345678901234", 0);
2717: 58 pop %eax
2718: 5a pop %edx
2719: 6a 00 push $0x0
271b: 68 c8 51 00 00 push $0x51c8
2720: e8 0e 12 00 00 call 3933 <open>
if(fd < 0){
2725: 83 c4 10 add $0x10,%esp
2728: 85 c0 test %eax,%eax
272a: 78 7d js 27a9 <fourteen+0xf9>
close(fd);
272c: 83 ec 0c sub $0xc,%esp
272f: 50 push %eax
2730: e8 e6 11 00 00 call 391b <close>
if(mkdir("12345678901234/12345678901234") == 0){
2735: c7 04 24 3c 49 00 00 movl $0x493c,(%esp)
273c: e8 1a 12 00 00 call 395b <mkdir>
2741: 83 c4 10 add $0x10,%esp
2744: 85 c0 test %eax,%eax
2746: 74 4e je 2796 <fourteen+0xe6>
if(mkdir("123456789012345/12345678901234") == 0){
2748: 83 ec 0c sub $0xc,%esp
274b: 68 64 52 00 00 push $0x5264
2750: e8 06 12 00 00 call 395b <mkdir>
2755: 83 c4 10 add $0x10,%esp
2758: 85 c0 test %eax,%eax
275a: 74 27 je 2783 <fourteen+0xd3>
printf(1, "fourteen ok\n");
275c: 83 ec 08 sub $0x8,%esp
275f: 68 5a 49 00 00 push $0x495a
2764: 6a 01 push $0x1
2766: e8 15 13 00 00 call 3a80 <printf>
}
276b: 83 c4 10 add $0x10,%esp
276e: c9 leave
276f: c3 ret
printf(1, "mkdir 12345678901234 failed\n");
2770: 50 push %eax
2771: 50 push %eax
2772: 68 1f 49 00 00 push $0x491f
2777: 6a 01 push $0x1
2779: e8 02 13 00 00 call 3a80 <printf>
exit();
277e: e8 70 11 00 00 call 38f3 <exit>
printf(1, "mkdir 12345678901234/123456789012345 succeeded!\n");
2783: 50 push %eax
2784: 50 push %eax
2785: 68 84 52 00 00 push $0x5284
278a: 6a 01 push $0x1
278c: e8 ef 12 00 00 call 3a80 <printf>
exit();
2791: e8 5d 11 00 00 call 38f3 <exit>
printf(1, "mkdir 12345678901234/12345678901234 succeeded!\n");
2796: 52 push %edx
2797: 52 push %edx
2798: 68 34 52 00 00 push $0x5234
279d: 6a 01 push $0x1
279f: e8 dc 12 00 00 call 3a80 <printf>
exit();
27a4: e8 4a 11 00 00 call 38f3 <exit>
printf(1, "open 12345678901234/12345678901234/12345678901234 failed\n");
27a9: 51 push %ecx
27aa: 51 push %ecx
27ab: 68 f8 51 00 00 push $0x51f8
27b0: 6a 01 push $0x1
27b2: e8 c9 12 00 00 call 3a80 <printf>
exit();
27b7: e8 37 11 00 00 call 38f3 <exit>
printf(1, "create 123456789012345/123456789012345/123456789012345 failed\n");
27bc: 51 push %ecx
27bd: 51 push %ecx
27be: 68 88 51 00 00 push $0x5188
27c3: 6a 01 push $0x1
27c5: e8 b6 12 00 00 call 3a80 <printf>
exit();
27ca: e8 24 11 00 00 call 38f3 <exit>
printf(1, "mkdir 12345678901234/123456789012345 failed\n");
27cf: 50 push %eax
27d0: 50 push %eax
27d1: 68 28 51 00 00 push $0x5128
27d6: 6a 01 push $0x1
27d8: e8 a3 12 00 00 call 3a80 <printf>
exit();
27dd: e8 11 11 00 00 call 38f3 <exit>
27e2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
27e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000027f0 <rmdot>:
{
27f0: 55 push %ebp
27f1: 89 e5 mov %esp,%ebp
27f3: 83 ec 10 sub $0x10,%esp
printf(1, "rmdot test\n");
27f6: 68 67 49 00 00 push $0x4967
27fb: 6a 01 push $0x1
27fd: e8 7e 12 00 00 call 3a80 <printf>
if(mkdir("dots") != 0){
2802: c7 04 24 73 49 00 00 movl $0x4973,(%esp)
2809: e8 4d 11 00 00 call 395b <mkdir>
280e: 83 c4 10 add $0x10,%esp
2811: 85 c0 test %eax,%eax
2813: 0f 85 b0 00 00 00 jne 28c9 <rmdot+0xd9>
if(chdir("dots") != 0){
2819: 83 ec 0c sub $0xc,%esp
281c: 68 73 49 00 00 push $0x4973
2821: e8 3d 11 00 00 call 3963 <chdir>
2826: 83 c4 10 add $0x10,%esp
2829: 85 c0 test %eax,%eax
282b: 0f 85 1d 01 00 00 jne 294e <rmdot+0x15e>
if(unlink(".") == 0){
2831: 83 ec 0c sub $0xc,%esp
2834: 68 1e 46 00 00 push $0x461e
2839: e8 05 11 00 00 call 3943 <unlink>
283e: 83 c4 10 add $0x10,%esp
2841: 85 c0 test %eax,%eax
2843: 0f 84 f2 00 00 00 je 293b <rmdot+0x14b>
if(unlink("..") == 0){
2849: 83 ec 0c sub $0xc,%esp
284c: 68 1d 46 00 00 push $0x461d
2851: e8 ed 10 00 00 call 3943 <unlink>
2856: 83 c4 10 add $0x10,%esp
2859: 85 c0 test %eax,%eax
285b: 0f 84 c7 00 00 00 je 2928 <rmdot+0x138>
if(chdir("/") != 0){
2861: 83 ec 0c sub $0xc,%esp
2864: 68 f1 3d 00 00 push $0x3df1
2869: e8 f5 10 00 00 call 3963 <chdir>
286e: 83 c4 10 add $0x10,%esp
2871: 85 c0 test %eax,%eax
2873: 0f 85 9c 00 00 00 jne 2915 <rmdot+0x125>
if(unlink("dots/.") == 0){
2879: 83 ec 0c sub $0xc,%esp
287c: 68 bb 49 00 00 push $0x49bb
2881: e8 bd 10 00 00 call 3943 <unlink>
2886: 83 c4 10 add $0x10,%esp
2889: 85 c0 test %eax,%eax
288b: 74 75 je 2902 <rmdot+0x112>
if(unlink("dots/..") == 0){
288d: 83 ec 0c sub $0xc,%esp
2890: 68 d9 49 00 00 push $0x49d9
2895: e8 a9 10 00 00 call 3943 <unlink>
289a: 83 c4 10 add $0x10,%esp
289d: 85 c0 test %eax,%eax
289f: 74 4e je 28ef <rmdot+0xff>
if(unlink("dots") != 0){
28a1: 83 ec 0c sub $0xc,%esp
28a4: 68 73 49 00 00 push $0x4973
28a9: e8 95 10 00 00 call 3943 <unlink>
28ae: 83 c4 10 add $0x10,%esp
28b1: 85 c0 test %eax,%eax
28b3: 75 27 jne 28dc <rmdot+0xec>
printf(1, "rmdot ok\n");
28b5: 83 ec 08 sub $0x8,%esp
28b8: 68 0e 4a 00 00 push $0x4a0e
28bd: 6a 01 push $0x1
28bf: e8 bc 11 00 00 call 3a80 <printf>
}
28c4: 83 c4 10 add $0x10,%esp
28c7: c9 leave
28c8: c3 ret
printf(1, "mkdir dots failed\n");
28c9: 50 push %eax
28ca: 50 push %eax
28cb: 68 78 49 00 00 push $0x4978
28d0: 6a 01 push $0x1
28d2: e8 a9 11 00 00 call 3a80 <printf>
exit();
28d7: e8 17 10 00 00 call 38f3 <exit>
printf(1, "unlink dots failed!\n");
28dc: 50 push %eax
28dd: 50 push %eax
28de: 68 f9 49 00 00 push $0x49f9
28e3: 6a 01 push $0x1
28e5: e8 96 11 00 00 call 3a80 <printf>
exit();
28ea: e8 04 10 00 00 call 38f3 <exit>
printf(1, "unlink dots/.. worked!\n");
28ef: 52 push %edx
28f0: 52 push %edx
28f1: 68 e1 49 00 00 push $0x49e1
28f6: 6a 01 push $0x1
28f8: e8 83 11 00 00 call 3a80 <printf>
exit();
28fd: e8 f1 0f 00 00 call 38f3 <exit>
printf(1, "unlink dots/. worked!\n");
2902: 51 push %ecx
2903: 51 push %ecx
2904: 68 c2 49 00 00 push $0x49c2
2909: 6a 01 push $0x1
290b: e8 70 11 00 00 call 3a80 <printf>
exit();
2910: e8 de 0f 00 00 call 38f3 <exit>
printf(1, "chdir / failed\n");
2915: 50 push %eax
2916: 50 push %eax
2917: 68 f3 3d 00 00 push $0x3df3
291c: 6a 01 push $0x1
291e: e8 5d 11 00 00 call 3a80 <printf>
exit();
2923: e8 cb 0f 00 00 call 38f3 <exit>
printf(1, "rm .. worked!\n");
2928: 50 push %eax
2929: 50 push %eax
292a: 68 ac 49 00 00 push $0x49ac
292f: 6a 01 push $0x1
2931: e8 4a 11 00 00 call 3a80 <printf>
exit();
2936: e8 b8 0f 00 00 call 38f3 <exit>
printf(1, "rm . worked!\n");
293b: 50 push %eax
293c: 50 push %eax
293d: 68 9e 49 00 00 push $0x499e
2942: 6a 01 push $0x1
2944: e8 37 11 00 00 call 3a80 <printf>
exit();
2949: e8 a5 0f 00 00 call 38f3 <exit>
printf(1, "chdir dots failed\n");
294e: 50 push %eax
294f: 50 push %eax
2950: 68 8b 49 00 00 push $0x498b
2955: 6a 01 push $0x1
2957: e8 24 11 00 00 call 3a80 <printf>
exit();
295c: e8 92 0f 00 00 call 38f3 <exit>
2961: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
2968: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
296f: 90 nop
00002970 <dirfile>:
{
2970: 55 push %ebp
2971: 89 e5 mov %esp,%ebp
2973: 53 push %ebx
2974: 83 ec 0c sub $0xc,%esp
printf(1, "dir vs file\n");
2977: 68 18 4a 00 00 push $0x4a18
297c: 6a 01 push $0x1
297e: e8 fd 10 00 00 call 3a80 <printf>
fd = open("dirfile", O_CREATE);
2983: 5b pop %ebx
2984: 58 pop %eax
2985: 68 00 02 00 00 push $0x200
298a: 68 25 4a 00 00 push $0x4a25
298f: e8 9f 0f 00 00 call 3933 <open>
if(fd < 0){
2994: 83 c4 10 add $0x10,%esp
2997: 85 c0 test %eax,%eax
2999: 0f 88 43 01 00 00 js 2ae2 <dirfile+0x172>
close(fd);
299f: 83 ec 0c sub $0xc,%esp
29a2: 50 push %eax
29a3: e8 73 0f 00 00 call 391b <close>
if(chdir("dirfile") == 0){
29a8: c7 04 24 25 4a 00 00 movl $0x4a25,(%esp)
29af: e8 af 0f 00 00 call 3963 <chdir>
29b4: 83 c4 10 add $0x10,%esp
29b7: 85 c0 test %eax,%eax
29b9: 0f 84 10 01 00 00 je 2acf <dirfile+0x15f>
fd = open("dirfile/xx", 0);
29bf: 83 ec 08 sub $0x8,%esp
29c2: 6a 00 push $0x0
29c4: 68 5e 4a 00 00 push $0x4a5e
29c9: e8 65 0f 00 00 call 3933 <open>
if(fd >= 0){
29ce: 83 c4 10 add $0x10,%esp
29d1: 85 c0 test %eax,%eax
29d3: 0f 89 e3 00 00 00 jns 2abc <dirfile+0x14c>
fd = open("dirfile/xx", O_CREATE);
29d9: 83 ec 08 sub $0x8,%esp
29dc: 68 00 02 00 00 push $0x200
29e1: 68 5e 4a 00 00 push $0x4a5e
29e6: e8 48 0f 00 00 call 3933 <open>
if(fd >= 0){
29eb: 83 c4 10 add $0x10,%esp
29ee: 85 c0 test %eax,%eax
29f0: 0f 89 c6 00 00 00 jns 2abc <dirfile+0x14c>
if(mkdir("dirfile/xx") == 0){
29f6: 83 ec 0c sub $0xc,%esp
29f9: 68 5e 4a 00 00 push $0x4a5e
29fe: e8 58 0f 00 00 call 395b <mkdir>
2a03: 83 c4 10 add $0x10,%esp
2a06: 85 c0 test %eax,%eax
2a08: 0f 84 46 01 00 00 je 2b54 <dirfile+0x1e4>
if(unlink("dirfile/xx") == 0){
2a0e: 83 ec 0c sub $0xc,%esp
2a11: 68 5e 4a 00 00 push $0x4a5e
2a16: e8 28 0f 00 00 call 3943 <unlink>
2a1b: 83 c4 10 add $0x10,%esp
2a1e: 85 c0 test %eax,%eax
2a20: 0f 84 1b 01 00 00 je 2b41 <dirfile+0x1d1>
if(link("README", "dirfile/xx") == 0){
2a26: 83 ec 08 sub $0x8,%esp
2a29: 68 5e 4a 00 00 push $0x4a5e
2a2e: 68 c2 4a 00 00 push $0x4ac2
2a33: e8 1b 0f 00 00 call 3953 <link>
2a38: 83 c4 10 add $0x10,%esp
2a3b: 85 c0 test %eax,%eax
2a3d: 0f 84 eb 00 00 00 je 2b2e <dirfile+0x1be>
if(unlink("dirfile") != 0){
2a43: 83 ec 0c sub $0xc,%esp
2a46: 68 25 4a 00 00 push $0x4a25
2a4b: e8 f3 0e 00 00 call 3943 <unlink>
2a50: 83 c4 10 add $0x10,%esp
2a53: 85 c0 test %eax,%eax
2a55: 0f 85 c0 00 00 00 jne 2b1b <dirfile+0x1ab>
fd = open(".", O_RDWR);
2a5b: 83 ec 08 sub $0x8,%esp
2a5e: 6a 02 push $0x2
2a60: 68 1e 46 00 00 push $0x461e
2a65: e8 c9 0e 00 00 call 3933 <open>
if(fd >= 0){
2a6a: 83 c4 10 add $0x10,%esp
2a6d: 85 c0 test %eax,%eax
2a6f: 0f 89 93 00 00 00 jns 2b08 <dirfile+0x198>
fd = open(".", 0);
2a75: 83 ec 08 sub $0x8,%esp
2a78: 6a 00 push $0x0
2a7a: 68 1e 46 00 00 push $0x461e
2a7f: e8 af 0e 00 00 call 3933 <open>
if(write(fd, "x", 1) > 0){
2a84: 83 c4 0c add $0xc,%esp
2a87: 6a 01 push $0x1
fd = open(".", 0);
2a89: 89 c3 mov %eax,%ebx
if(write(fd, "x", 1) > 0){
2a8b: 68 01 47 00 00 push $0x4701
2a90: 50 push %eax
2a91: e8 7d 0e 00 00 call 3913 <write>
2a96: 83 c4 10 add $0x10,%esp
2a99: 85 c0 test %eax,%eax
2a9b: 7f 58 jg 2af5 <dirfile+0x185>
close(fd);
2a9d: 83 ec 0c sub $0xc,%esp
2aa0: 53 push %ebx
2aa1: e8 75 0e 00 00 call 391b <close>
printf(1, "dir vs file OK\n");
2aa6: 58 pop %eax
2aa7: 5a pop %edx
2aa8: 68 f5 4a 00 00 push $0x4af5
2aad: 6a 01 push $0x1
2aaf: e8 cc 0f 00 00 call 3a80 <printf>
}
2ab4: 8b 5d fc mov -0x4(%ebp),%ebx
2ab7: 83 c4 10 add $0x10,%esp
2aba: c9 leave
2abb: c3 ret
printf(1, "create dirfile/xx succeeded!\n");
2abc: 50 push %eax
2abd: 50 push %eax
2abe: 68 69 4a 00 00 push $0x4a69
2ac3: 6a 01 push $0x1
2ac5: e8 b6 0f 00 00 call 3a80 <printf>
exit();
2aca: e8 24 0e 00 00 call 38f3 <exit>
printf(1, "chdir dirfile succeeded!\n");
2acf: 52 push %edx
2ad0: 52 push %edx
2ad1: 68 44 4a 00 00 push $0x4a44
2ad6: 6a 01 push $0x1
2ad8: e8 a3 0f 00 00 call 3a80 <printf>
exit();
2add: e8 11 0e 00 00 call 38f3 <exit>
printf(1, "create dirfile failed\n");
2ae2: 51 push %ecx
2ae3: 51 push %ecx
2ae4: 68 2d 4a 00 00 push $0x4a2d
2ae9: 6a 01 push $0x1
2aeb: e8 90 0f 00 00 call 3a80 <printf>
exit();
2af0: e8 fe 0d 00 00 call 38f3 <exit>
printf(1, "write . succeeded!\n");
2af5: 51 push %ecx
2af6: 51 push %ecx
2af7: 68 e1 4a 00 00 push $0x4ae1
2afc: 6a 01 push $0x1
2afe: e8 7d 0f 00 00 call 3a80 <printf>
exit();
2b03: e8 eb 0d 00 00 call 38f3 <exit>
printf(1, "open . for writing succeeded!\n");
2b08: 53 push %ebx
2b09: 53 push %ebx
2b0a: 68 d8 52 00 00 push $0x52d8
2b0f: 6a 01 push $0x1
2b11: e8 6a 0f 00 00 call 3a80 <printf>
exit();
2b16: e8 d8 0d 00 00 call 38f3 <exit>
printf(1, "unlink dirfile failed!\n");
2b1b: 50 push %eax
2b1c: 50 push %eax
2b1d: 68 c9 4a 00 00 push $0x4ac9
2b22: 6a 01 push $0x1
2b24: e8 57 0f 00 00 call 3a80 <printf>
exit();
2b29: e8 c5 0d 00 00 call 38f3 <exit>
printf(1, "link to dirfile/xx succeeded!\n");
2b2e: 50 push %eax
2b2f: 50 push %eax
2b30: 68 b8 52 00 00 push $0x52b8
2b35: 6a 01 push $0x1
2b37: e8 44 0f 00 00 call 3a80 <printf>
exit();
2b3c: e8 b2 0d 00 00 call 38f3 <exit>
printf(1, "unlink dirfile/xx succeeded!\n");
2b41: 50 push %eax
2b42: 50 push %eax
2b43: 68 a4 4a 00 00 push $0x4aa4
2b48: 6a 01 push $0x1
2b4a: e8 31 0f 00 00 call 3a80 <printf>
exit();
2b4f: e8 9f 0d 00 00 call 38f3 <exit>
printf(1, "mkdir dirfile/xx succeeded!\n");
2b54: 50 push %eax
2b55: 50 push %eax
2b56: 68 87 4a 00 00 push $0x4a87
2b5b: 6a 01 push $0x1
2b5d: e8 1e 0f 00 00 call 3a80 <printf>
exit();
2b62: e8 8c 0d 00 00 call 38f3 <exit>
2b67: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
2b6e: 66 90 xchg %ax,%ax
00002b70 <iref>:
{
2b70: 55 push %ebp
2b71: 89 e5 mov %esp,%ebp
2b73: 53 push %ebx
printf(1, "empty file name\n");
2b74: bb 33 00 00 00 mov $0x33,%ebx
{
2b79: 83 ec 0c sub $0xc,%esp
printf(1, "empty file name\n");
2b7c: 68 05 4b 00 00 push $0x4b05
2b81: 6a 01 push $0x1
2b83: e8 f8 0e 00 00 call 3a80 <printf>
2b88: 83 c4 10 add $0x10,%esp
2b8b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
2b8f: 90 nop
if(mkdir("irefd") != 0){
2b90: 83 ec 0c sub $0xc,%esp
2b93: 68 16 4b 00 00 push $0x4b16
2b98: e8 be 0d 00 00 call 395b <mkdir>
2b9d: 83 c4 10 add $0x10,%esp
2ba0: 85 c0 test %eax,%eax
2ba2: 0f 85 bb 00 00 00 jne 2c63 <iref+0xf3>
if(chdir("irefd") != 0){
2ba8: 83 ec 0c sub $0xc,%esp
2bab: 68 16 4b 00 00 push $0x4b16
2bb0: e8 ae 0d 00 00 call 3963 <chdir>
2bb5: 83 c4 10 add $0x10,%esp
2bb8: 85 c0 test %eax,%eax
2bba: 0f 85 b7 00 00 00 jne 2c77 <iref+0x107>
mkdir("");
2bc0: 83 ec 0c sub $0xc,%esp
2bc3: 68 cb 41 00 00 push $0x41cb
2bc8: e8 8e 0d 00 00 call 395b <mkdir>
link("README", "");
2bcd: 59 pop %ecx
2bce: 58 pop %eax
2bcf: 68 cb 41 00 00 push $0x41cb
2bd4: 68 c2 4a 00 00 push $0x4ac2
2bd9: e8 75 0d 00 00 call 3953 <link>
fd = open("", O_CREATE);
2bde: 58 pop %eax
2bdf: 5a pop %edx
2be0: 68 00 02 00 00 push $0x200
2be5: 68 cb 41 00 00 push $0x41cb
2bea: e8 44 0d 00 00 call 3933 <open>
if(fd >= 0)
2bef: 83 c4 10 add $0x10,%esp
2bf2: 85 c0 test %eax,%eax
2bf4: 78 0c js 2c02 <iref+0x92>
close(fd);
2bf6: 83 ec 0c sub $0xc,%esp
2bf9: 50 push %eax
2bfa: e8 1c 0d 00 00 call 391b <close>
2bff: 83 c4 10 add $0x10,%esp
fd = open("xx", O_CREATE);
2c02: 83 ec 08 sub $0x8,%esp
2c05: 68 00 02 00 00 push $0x200
2c0a: 68 00 47 00 00 push $0x4700
2c0f: e8 1f 0d 00 00 call 3933 <open>
if(fd >= 0)
2c14: 83 c4 10 add $0x10,%esp
2c17: 85 c0 test %eax,%eax
2c19: 78 0c js 2c27 <iref+0xb7>
close(fd);
2c1b: 83 ec 0c sub $0xc,%esp
2c1e: 50 push %eax
2c1f: e8 f7 0c 00 00 call 391b <close>
2c24: 83 c4 10 add $0x10,%esp
unlink("xx");
2c27: 83 ec 0c sub $0xc,%esp
2c2a: 68 00 47 00 00 push $0x4700
2c2f: e8 0f 0d 00 00 call 3943 <unlink>
for(i = 0; i < 50 + 1; i++){
2c34: 83 c4 10 add $0x10,%esp
2c37: 83 eb 01 sub $0x1,%ebx
2c3a: 0f 85 50 ff ff ff jne 2b90 <iref+0x20>
chdir("/");
2c40: 83 ec 0c sub $0xc,%esp
2c43: 68 f1 3d 00 00 push $0x3df1
2c48: e8 16 0d 00 00 call 3963 <chdir>
printf(1, "empty file name OK\n");
2c4d: 58 pop %eax
2c4e: 5a pop %edx
2c4f: 68 44 4b 00 00 push $0x4b44
2c54: 6a 01 push $0x1
2c56: e8 25 0e 00 00 call 3a80 <printf>
}
2c5b: 8b 5d fc mov -0x4(%ebp),%ebx
2c5e: 83 c4 10 add $0x10,%esp
2c61: c9 leave
2c62: c3 ret
printf(1, "mkdir irefd failed\n");
2c63: 83 ec 08 sub $0x8,%esp
2c66: 68 1c 4b 00 00 push $0x4b1c
2c6b: 6a 01 push $0x1
2c6d: e8 0e 0e 00 00 call 3a80 <printf>
exit();
2c72: e8 7c 0c 00 00 call 38f3 <exit>
printf(1, "chdir irefd failed\n");
2c77: 83 ec 08 sub $0x8,%esp
2c7a: 68 30 4b 00 00 push $0x4b30
2c7f: 6a 01 push $0x1
2c81: e8 fa 0d 00 00 call 3a80 <printf>
exit();
2c86: e8 68 0c 00 00 call 38f3 <exit>
2c8b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
2c8f: 90 nop
00002c90 <forktest>:
{
2c90: 55 push %ebp
2c91: 89 e5 mov %esp,%ebp
2c93: 53 push %ebx
for(n=0; n<1000; n++){
2c94: 31 db xor %ebx,%ebx
{
2c96: 83 ec 0c sub $0xc,%esp
printf(1, "fork test\n");
2c99: 68 58 4b 00 00 push $0x4b58
2c9e: 6a 01 push $0x1
2ca0: e8 db 0d 00 00 call 3a80 <printf>
2ca5: 83 c4 10 add $0x10,%esp
2ca8: eb 13 jmp 2cbd <forktest+0x2d>
2caa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(pid == 0)
2cb0: 74 4a je 2cfc <forktest+0x6c>
for(n=0; n<1000; n++){
2cb2: 83 c3 01 add $0x1,%ebx
2cb5: 81 fb e8 03 00 00 cmp $0x3e8,%ebx
2cbb: 74 6b je 2d28 <forktest+0x98>
pid = fork();
2cbd: e8 29 0c 00 00 call 38eb <fork>
if(pid < 0)
2cc2: 85 c0 test %eax,%eax
2cc4: 79 ea jns 2cb0 <forktest+0x20>
for(; n > 0; n--){
2cc6: 85 db test %ebx,%ebx
2cc8: 74 14 je 2cde <forktest+0x4e>
2cca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(wait() < 0){
2cd0: e8 26 0c 00 00 call 38fb <wait>
2cd5: 85 c0 test %eax,%eax
2cd7: 78 28 js 2d01 <forktest+0x71>
for(; n > 0; n--){
2cd9: 83 eb 01 sub $0x1,%ebx
2cdc: 75 f2 jne 2cd0 <forktest+0x40>
if(wait() != -1){
2cde: e8 18 0c 00 00 call 38fb <wait>
2ce3: 83 f8 ff cmp $0xffffffff,%eax
2ce6: 75 2d jne 2d15 <forktest+0x85>
printf(1, "fork test OK\n");
2ce8: 83 ec 08 sub $0x8,%esp
2ceb: 68 8a 4b 00 00 push $0x4b8a
2cf0: 6a 01 push $0x1
2cf2: e8 89 0d 00 00 call 3a80 <printf>
}
2cf7: 8b 5d fc mov -0x4(%ebp),%ebx
2cfa: c9 leave
2cfb: c3 ret
exit();
2cfc: e8 f2 0b 00 00 call 38f3 <exit>
printf(1, "wait stopped early\n");
2d01: 83 ec 08 sub $0x8,%esp
2d04: 68 63 4b 00 00 push $0x4b63
2d09: 6a 01 push $0x1
2d0b: e8 70 0d 00 00 call 3a80 <printf>
exit();
2d10: e8 de 0b 00 00 call 38f3 <exit>
printf(1, "wait got too many\n");
2d15: 52 push %edx
2d16: 52 push %edx
2d17: 68 77 4b 00 00 push $0x4b77
2d1c: 6a 01 push $0x1
2d1e: e8 5d 0d 00 00 call 3a80 <printf>
exit();
2d23: e8 cb 0b 00 00 call 38f3 <exit>
printf(1, "fork claimed to work 1000 times!\n");
2d28: 50 push %eax
2d29: 50 push %eax
2d2a: 68 f8 52 00 00 push $0x52f8
2d2f: 6a 01 push $0x1
2d31: e8 4a 0d 00 00 call 3a80 <printf>
exit();
2d36: e8 b8 0b 00 00 call 38f3 <exit>
2d3b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
2d3f: 90 nop
00002d40 <sbrktest>:
{
2d40: 55 push %ebp
2d41: 89 e5 mov %esp,%ebp
2d43: 57 push %edi
2d44: 56 push %esi
for(i = 0; i < 5000; i++){
2d45: 31 f6 xor %esi,%esi
{
2d47: 53 push %ebx
2d48: 83 ec 64 sub $0x64,%esp
printf(stdout, "sbrk test\n");
2d4b: 68 98 4b 00 00 push $0x4b98
2d50: ff 35 ac 5e 00 00 push 0x5eac
2d56: e8 25 0d 00 00 call 3a80 <printf>
oldbrk = sbrk(0);
2d5b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2d62: e8 14 0c 00 00 call 397b <sbrk>
a = sbrk(0);
2d67: c7 04 24 00 00 00 00 movl $0x0,(%esp)
oldbrk = sbrk(0);
2d6e: 89 45 a4 mov %eax,-0x5c(%ebp)
a = sbrk(0);
2d71: e8 05 0c 00 00 call 397b <sbrk>
2d76: 83 c4 10 add $0x10,%esp
2d79: 89 c3 mov %eax,%ebx
for(i = 0; i < 5000; i++){
2d7b: eb 05 jmp 2d82 <sbrktest+0x42>
2d7d: 8d 76 00 lea 0x0(%esi),%esi
a = b + 1;
2d80: 89 c3 mov %eax,%ebx
b = sbrk(1);
2d82: 83 ec 0c sub $0xc,%esp
2d85: 6a 01 push $0x1
2d87: e8 ef 0b 00 00 call 397b <sbrk>
if(b != a){
2d8c: 83 c4 10 add $0x10,%esp
2d8f: 39 d8 cmp %ebx,%eax
2d91: 0f 85 9c 02 00 00 jne 3033 <sbrktest+0x2f3>
for(i = 0; i < 5000; i++){
2d97: 83 c6 01 add $0x1,%esi
*b = 1;
2d9a: c6 03 01 movb $0x1,(%ebx)
a = b + 1;
2d9d: 8d 43 01 lea 0x1(%ebx),%eax
for(i = 0; i < 5000; i++){
2da0: 81 fe 88 13 00 00 cmp $0x1388,%esi
2da6: 75 d8 jne 2d80 <sbrktest+0x40>
pid = fork();
2da8: e8 3e 0b 00 00 call 38eb <fork>
2dad: 89 c6 mov %eax,%esi
if(pid < 0){
2daf: 85 c0 test %eax,%eax
2db1: 0f 88 02 03 00 00 js 30b9 <sbrktest+0x379>
c = sbrk(1);
2db7: 83 ec 0c sub $0xc,%esp
if(c != a + 1){
2dba: 83 c3 02 add $0x2,%ebx
c = sbrk(1);
2dbd: 6a 01 push $0x1
2dbf: e8 b7 0b 00 00 call 397b <sbrk>
c = sbrk(1);
2dc4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2dcb: e8 ab 0b 00 00 call 397b <sbrk>
if(c != a + 1){
2dd0: 83 c4 10 add $0x10,%esp
2dd3: 39 c3 cmp %eax,%ebx
2dd5: 0f 85 3b 03 00 00 jne 3116 <sbrktest+0x3d6>
if(pid == 0)
2ddb: 85 f6 test %esi,%esi
2ddd: 0f 84 2e 03 00 00 je 3111 <sbrktest+0x3d1>
wait();
2de3: e8 13 0b 00 00 call 38fb <wait>
a = sbrk(0);
2de8: 83 ec 0c sub $0xc,%esp
2deb: 6a 00 push $0x0
2ded: e8 89 0b 00 00 call 397b <sbrk>
2df2: 89 c3 mov %eax,%ebx
amt = (BIG) - (uint)a;
2df4: b8 00 00 40 06 mov $0x6400000,%eax
2df9: 29 d8 sub %ebx,%eax
p = sbrk(amt);
2dfb: 89 04 24 mov %eax,(%esp)
2dfe: e8 78 0b 00 00 call 397b <sbrk>
if (p != a) {
2e03: 83 c4 10 add $0x10,%esp
2e06: 39 c3 cmp %eax,%ebx
2e08: 0f 85 94 02 00 00 jne 30a2 <sbrktest+0x362>
a = sbrk(0);
2e0e: 83 ec 0c sub $0xc,%esp
*lastaddr = 99;
2e11: c6 05 ff ff 3f 06 63 movb $0x63,0x63fffff
a = sbrk(0);
2e18: 6a 00 push $0x0
2e1a: e8 5c 0b 00 00 call 397b <sbrk>
c = sbrk(-4096);
2e1f: c7 04 24 00 f0 ff ff movl $0xfffff000,(%esp)
a = sbrk(0);
2e26: 89 c3 mov %eax,%ebx
c = sbrk(-4096);
2e28: e8 4e 0b 00 00 call 397b <sbrk>
if(c == (char*)0xffffffff){
2e2d: 83 c4 10 add $0x10,%esp
2e30: 83 f8 ff cmp $0xffffffff,%eax
2e33: 0f 84 22 03 00 00 je 315b <sbrktest+0x41b>
c = sbrk(0);
2e39: 83 ec 0c sub $0xc,%esp
2e3c: 6a 00 push $0x0
2e3e: e8 38 0b 00 00 call 397b <sbrk>
if(c != a - 4096){
2e43: 8d 93 00 f0 ff ff lea -0x1000(%ebx),%edx
2e49: 83 c4 10 add $0x10,%esp
2e4c: 39 d0 cmp %edx,%eax
2e4e: 0f 85 f0 02 00 00 jne 3144 <sbrktest+0x404>
a = sbrk(0);
2e54: 83 ec 0c sub $0xc,%esp
2e57: 6a 00 push $0x0
2e59: e8 1d 0b 00 00 call 397b <sbrk>
c = sbrk(4096);
2e5e: c7 04 24 00 10 00 00 movl $0x1000,(%esp)
a = sbrk(0);
2e65: 89 c3 mov %eax,%ebx
c = sbrk(4096);
2e67: e8 0f 0b 00 00 call 397b <sbrk>
if(c != a || sbrk(0) != a + 4096){
2e6c: 83 c4 10 add $0x10,%esp
c = sbrk(4096);
2e6f: 89 c6 mov %eax,%esi
if(c != a || sbrk(0) != a + 4096){
2e71: 39 c3 cmp %eax,%ebx
2e73: 0f 85 b4 02 00 00 jne 312d <sbrktest+0x3ed>
2e79: 83 ec 0c sub $0xc,%esp
2e7c: 6a 00 push $0x0
2e7e: e8 f8 0a 00 00 call 397b <sbrk>
2e83: 8d 93 00 10 00 00 lea 0x1000(%ebx),%edx
2e89: 83 c4 10 add $0x10,%esp
2e8c: 39 c2 cmp %eax,%edx
2e8e: 0f 85 99 02 00 00 jne 312d <sbrktest+0x3ed>
if(*lastaddr == 99){
2e94: 80 3d ff ff 3f 06 63 cmpb $0x63,0x63fffff
2e9b: 0f 84 2f 02 00 00 je 30d0 <sbrktest+0x390>
a = sbrk(0);
2ea1: 83 ec 0c sub $0xc,%esp
2ea4: 6a 00 push $0x0
2ea6: e8 d0 0a 00 00 call 397b <sbrk>
c = sbrk(-(sbrk(0) - oldbrk));
2eab: c7 04 24 00 00 00 00 movl $0x0,(%esp)
a = sbrk(0);
2eb2: 89 c3 mov %eax,%ebx
c = sbrk(-(sbrk(0) - oldbrk));
2eb4: e8 c2 0a 00 00 call 397b <sbrk>
2eb9: 89 c2 mov %eax,%edx
2ebb: 8b 45 a4 mov -0x5c(%ebp),%eax
2ebe: 29 d0 sub %edx,%eax
2ec0: 89 04 24 mov %eax,(%esp)
2ec3: e8 b3 0a 00 00 call 397b <sbrk>
if(c != a){
2ec8: 83 c4 10 add $0x10,%esp
2ecb: 39 c3 cmp %eax,%ebx
2ecd: 0f 85 b8 01 00 00 jne 308b <sbrktest+0x34b>
for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){
2ed3: bb 00 00 00 80 mov $0x80000000,%ebx
2ed8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
2edf: 90 nop
ppid = getpid();
2ee0: e8 8e 0a 00 00 call 3973 <getpid>
2ee5: 89 c6 mov %eax,%esi
pid = fork();
2ee7: e8 ff 09 00 00 call 38eb <fork>
if(pid < 0){
2eec: 85 c0 test %eax,%eax
2eee: 0f 88 5d 01 00 00 js 3051 <sbrktest+0x311>
if(pid == 0){
2ef4: 0f 84 6f 01 00 00 je 3069 <sbrktest+0x329>
wait();
2efa: e8 fc 09 00 00 call 38fb <wait>
for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){
2eff: 81 c3 50 c3 00 00 add $0xc350,%ebx
2f05: 81 fb 80 84 1e 80 cmp $0x801e8480,%ebx
2f0b: 75 d3 jne 2ee0 <sbrktest+0x1a0>
if(pipe(fds) != 0){
2f0d: 83 ec 0c sub $0xc,%esp
2f10: 8d 45 b8 lea -0x48(%ebp),%eax
2f13: 50 push %eax
2f14: e8 ea 09 00 00 call 3903 <pipe>
2f19: 83 c4 10 add $0x10,%esp
2f1c: 85 c0 test %eax,%eax
2f1e: 0f 85 da 01 00 00 jne 30fe <sbrktest+0x3be>
2f24: 8d 5d c0 lea -0x40(%ebp),%ebx
2f27: 8d 75 e8 lea -0x18(%ebp),%esi
2f2a: 89 df mov %ebx,%edi
2f2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if((pids[i] = fork()) == 0){
2f30: e8 b6 09 00 00 call 38eb <fork>
2f35: 89 07 mov %eax,(%edi)
2f37: 85 c0 test %eax,%eax
2f39: 0f 84 91 00 00 00 je 2fd0 <sbrktest+0x290>
if(pids[i] != -1)
2f3f: 83 f8 ff cmp $0xffffffff,%eax
2f42: 74 14 je 2f58 <sbrktest+0x218>
read(fds[0], &scratch, 1);
2f44: 83 ec 04 sub $0x4,%esp
2f47: 8d 45 b7 lea -0x49(%ebp),%eax
2f4a: 6a 01 push $0x1
2f4c: 50 push %eax
2f4d: ff 75 b8 push -0x48(%ebp)
2f50: e8 b6 09 00 00 call 390b <read>
2f55: 83 c4 10 add $0x10,%esp
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
2f58: 83 c7 04 add $0x4,%edi
2f5b: 39 f7 cmp %esi,%edi
2f5d: 75 d1 jne 2f30 <sbrktest+0x1f0>
c = sbrk(4096);
2f5f: 83 ec 0c sub $0xc,%esp
2f62: 68 00 10 00 00 push $0x1000
2f67: e8 0f 0a 00 00 call 397b <sbrk>
2f6c: 83 c4 10 add $0x10,%esp
2f6f: 89 c7 mov %eax,%edi
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
2f71: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(pids[i] == -1)
2f78: 8b 03 mov (%ebx),%eax
2f7a: 83 f8 ff cmp $0xffffffff,%eax
2f7d: 74 11 je 2f90 <sbrktest+0x250>
kill(pids[i]);
2f7f: 83 ec 0c sub $0xc,%esp
2f82: 50 push %eax
2f83: e8 9b 09 00 00 call 3923 <kill>
wait();
2f88: e8 6e 09 00 00 call 38fb <wait>
2f8d: 83 c4 10 add $0x10,%esp
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
2f90: 83 c3 04 add $0x4,%ebx
2f93: 39 de cmp %ebx,%esi
2f95: 75 e1 jne 2f78 <sbrktest+0x238>
if(c == (char*)0xffffffff){
2f97: 83 ff ff cmp $0xffffffff,%edi
2f9a: 0f 84 47 01 00 00 je 30e7 <sbrktest+0x3a7>
if(sbrk(0) > oldbrk)
2fa0: 83 ec 0c sub $0xc,%esp
2fa3: 6a 00 push $0x0
2fa5: e8 d1 09 00 00 call 397b <sbrk>
2faa: 83 c4 10 add $0x10,%esp
2fad: 39 45 a4 cmp %eax,-0x5c(%ebp)
2fb0: 72 60 jb 3012 <sbrktest+0x2d2>
printf(stdout, "sbrk test OK\n");
2fb2: 83 ec 08 sub $0x8,%esp
2fb5: 68 40 4c 00 00 push $0x4c40
2fba: ff 35 ac 5e 00 00 push 0x5eac
2fc0: e8 bb 0a 00 00 call 3a80 <printf>
}
2fc5: 83 c4 10 add $0x10,%esp
2fc8: 8d 65 f4 lea -0xc(%ebp),%esp
2fcb: 5b pop %ebx
2fcc: 5e pop %esi
2fcd: 5f pop %edi
2fce: 5d pop %ebp
2fcf: c3 ret
sbrk(BIG - (uint)sbrk(0));
2fd0: 83 ec 0c sub $0xc,%esp
2fd3: 6a 00 push $0x0
2fd5: e8 a1 09 00 00 call 397b <sbrk>
2fda: 89 c2 mov %eax,%edx
2fdc: b8 00 00 40 06 mov $0x6400000,%eax
2fe1: 29 d0 sub %edx,%eax
2fe3: 89 04 24 mov %eax,(%esp)
2fe6: e8 90 09 00 00 call 397b <sbrk>
write(fds[1], "x", 1);
2feb: 83 c4 0c add $0xc,%esp
2fee: 6a 01 push $0x1
2ff0: 68 01 47 00 00 push $0x4701
2ff5: ff 75 bc push -0x44(%ebp)
2ff8: e8 16 09 00 00 call 3913 <write>
2ffd: 83 c4 10 add $0x10,%esp
for(;;) sleep(1000);
3000: 83 ec 0c sub $0xc,%esp
3003: 68 e8 03 00 00 push $0x3e8
3008: e8 76 09 00 00 call 3983 <sleep>
300d: 83 c4 10 add $0x10,%esp
3010: eb ee jmp 3000 <sbrktest+0x2c0>
sbrk(-(sbrk(0) - oldbrk));
3012: 83 ec 0c sub $0xc,%esp
3015: 6a 00 push $0x0
3017: e8 5f 09 00 00 call 397b <sbrk>
301c: 89 c2 mov %eax,%edx
301e: 8b 45 a4 mov -0x5c(%ebp),%eax
3021: 29 d0 sub %edx,%eax
3023: 89 04 24 mov %eax,(%esp)
3026: e8 50 09 00 00 call 397b <sbrk>
302b: 83 c4 10 add $0x10,%esp
302e: e9 7f ff ff ff jmp 2fb2 <sbrktest+0x272>
printf(stdout, "sbrk test failed %d %x %x\n", i, a, b);
3033: 83 ec 0c sub $0xc,%esp
3036: 50 push %eax
3037: 53 push %ebx
3038: 56 push %esi
3039: 68 a3 4b 00 00 push $0x4ba3
303e: ff 35 ac 5e 00 00 push 0x5eac
3044: e8 37 0a 00 00 call 3a80 <printf>
exit();
3049: 83 c4 20 add $0x20,%esp
304c: e8 a2 08 00 00 call 38f3 <exit>
printf(stdout, "fork failed\n");
3051: 83 ec 08 sub $0x8,%esp
3054: 68 e9 4c 00 00 push $0x4ce9
3059: ff 35 ac 5e 00 00 push 0x5eac
305f: e8 1c 0a 00 00 call 3a80 <printf>
exit();
3064: e8 8a 08 00 00 call 38f3 <exit>
printf(stdout, "oops could read %x = %x\n", a, *a);
3069: 0f be 03 movsbl (%ebx),%eax
306c: 50 push %eax
306d: 53 push %ebx
306e: 68 0c 4c 00 00 push $0x4c0c
3073: ff 35 ac 5e 00 00 push 0x5eac
3079: e8 02 0a 00 00 call 3a80 <printf>
kill(ppid);
307e: 89 34 24 mov %esi,(%esp)
3081: e8 9d 08 00 00 call 3923 <kill>
exit();
3086: e8 68 08 00 00 call 38f3 <exit>
printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c);
308b: 50 push %eax
308c: 53 push %ebx
308d: 68 ec 53 00 00 push $0x53ec
3092: ff 35 ac 5e 00 00 push 0x5eac
3098: e8 e3 09 00 00 call 3a80 <printf>
exit();
309d: e8 51 08 00 00 call 38f3 <exit>
printf(stdout, "sbrk test failed to grow big address space; enough phys mem?\n");
30a2: 56 push %esi
30a3: 56 push %esi
30a4: 68 1c 53 00 00 push $0x531c
30a9: ff 35 ac 5e 00 00 push 0x5eac
30af: e8 cc 09 00 00 call 3a80 <printf>
exit();
30b4: e8 3a 08 00 00 call 38f3 <exit>
printf(stdout, "sbrk test fork failed\n");
30b9: 50 push %eax
30ba: 50 push %eax
30bb: 68 be 4b 00 00 push $0x4bbe
30c0: ff 35 ac 5e 00 00 push 0x5eac
30c6: e8 b5 09 00 00 call 3a80 <printf>
exit();
30cb: e8 23 08 00 00 call 38f3 <exit>
printf(stdout, "sbrk de-allocation didn't really deallocate\n");
30d0: 51 push %ecx
30d1: 51 push %ecx
30d2: 68 bc 53 00 00 push $0x53bc
30d7: ff 35 ac 5e 00 00 push 0x5eac
30dd: e8 9e 09 00 00 call 3a80 <printf>
exit();
30e2: e8 0c 08 00 00 call 38f3 <exit>
printf(stdout, "failed sbrk leaked memory\n");
30e7: 50 push %eax
30e8: 50 push %eax
30e9: 68 25 4c 00 00 push $0x4c25
30ee: ff 35 ac 5e 00 00 push 0x5eac
30f4: e8 87 09 00 00 call 3a80 <printf>
exit();
30f9: e8 f5 07 00 00 call 38f3 <exit>
printf(1, "pipe() failed\n");
30fe: 52 push %edx
30ff: 52 push %edx
3100: 68 e1 40 00 00 push $0x40e1
3105: 6a 01 push $0x1
3107: e8 74 09 00 00 call 3a80 <printf>
exit();
310c: e8 e2 07 00 00 call 38f3 <exit>
exit();
3111: e8 dd 07 00 00 call 38f3 <exit>
printf(stdout, "sbrk test failed post-fork\n");
3116: 57 push %edi
3117: 57 push %edi
3118: 68 d5 4b 00 00 push $0x4bd5
311d: ff 35 ac 5e 00 00 push 0x5eac
3123: e8 58 09 00 00 call 3a80 <printf>
exit();
3128: e8 c6 07 00 00 call 38f3 <exit>
printf(stdout, "sbrk re-allocation failed, a %x c %x\n", a, c);
312d: 56 push %esi
312e: 53 push %ebx
312f: 68 94 53 00 00 push $0x5394
3134: ff 35 ac 5e 00 00 push 0x5eac
313a: e8 41 09 00 00 call 3a80 <printf>
exit();
313f: e8 af 07 00 00 call 38f3 <exit>
printf(stdout, "sbrk deallocation produced wrong address, a %x c %x\n", a, c);
3144: 50 push %eax
3145: 53 push %ebx
3146: 68 5c 53 00 00 push $0x535c
314b: ff 35 ac 5e 00 00 push 0x5eac
3151: e8 2a 09 00 00 call 3a80 <printf>
exit();
3156: e8 98 07 00 00 call 38f3 <exit>
printf(stdout, "sbrk could not deallocate\n");
315b: 53 push %ebx
315c: 53 push %ebx
315d: 68 f1 4b 00 00 push $0x4bf1
3162: ff 35 ac 5e 00 00 push 0x5eac
3168: e8 13 09 00 00 call 3a80 <printf>
exit();
316d: e8 81 07 00 00 call 38f3 <exit>
3172: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3179: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00003180 <validateint>:
}
3180: c3 ret
3181: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3188: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
318f: 90 nop
00003190 <validatetest>:
{
3190: 55 push %ebp
3191: 89 e5 mov %esp,%ebp
3193: 56 push %esi
for(p = 0; p <= (uint)hi; p += 4096){
3194: 31 f6 xor %esi,%esi
{
3196: 53 push %ebx
printf(stdout, "validate test\n");
3197: 83 ec 08 sub $0x8,%esp
319a: 68 4e 4c 00 00 push $0x4c4e
319f: ff 35 ac 5e 00 00 push 0x5eac
31a5: e8 d6 08 00 00 call 3a80 <printf>
31aa: 83 c4 10 add $0x10,%esp
31ad: 8d 76 00 lea 0x0(%esi),%esi
if((pid = fork()) == 0){
31b0: e8 36 07 00 00 call 38eb <fork>
31b5: 89 c3 mov %eax,%ebx
31b7: 85 c0 test %eax,%eax
31b9: 74 63 je 321e <validatetest+0x8e>
sleep(0);
31bb: 83 ec 0c sub $0xc,%esp
31be: 6a 00 push $0x0
31c0: e8 be 07 00 00 call 3983 <sleep>
sleep(0);
31c5: c7 04 24 00 00 00 00 movl $0x0,(%esp)
31cc: e8 b2 07 00 00 call 3983 <sleep>
kill(pid);
31d1: 89 1c 24 mov %ebx,(%esp)
31d4: e8 4a 07 00 00 call 3923 <kill>
wait();
31d9: e8 1d 07 00 00 call 38fb <wait>
if(link("nosuchfile", (char*)p) != -1){
31de: 58 pop %eax
31df: 5a pop %edx
31e0: 56 push %esi
31e1: 68 5d 4c 00 00 push $0x4c5d
31e6: e8 68 07 00 00 call 3953 <link>
31eb: 83 c4 10 add $0x10,%esp
31ee: 83 f8 ff cmp $0xffffffff,%eax
31f1: 75 30 jne 3223 <validatetest+0x93>
for(p = 0; p <= (uint)hi; p += 4096){
31f3: 81 c6 00 10 00 00 add $0x1000,%esi
31f9: 81 fe 00 40 11 00 cmp $0x114000,%esi
31ff: 75 af jne 31b0 <validatetest+0x20>
printf(stdout, "validate ok\n");
3201: 83 ec 08 sub $0x8,%esp
3204: 68 81 4c 00 00 push $0x4c81
3209: ff 35 ac 5e 00 00 push 0x5eac
320f: e8 6c 08 00 00 call 3a80 <printf>
}
3214: 83 c4 10 add $0x10,%esp
3217: 8d 65 f8 lea -0x8(%ebp),%esp
321a: 5b pop %ebx
321b: 5e pop %esi
321c: 5d pop %ebp
321d: c3 ret
exit();
321e: e8 d0 06 00 00 call 38f3 <exit>
printf(stdout, "link should not succeed\n");
3223: 83 ec 08 sub $0x8,%esp
3226: 68 68 4c 00 00 push $0x4c68
322b: ff 35 ac 5e 00 00 push 0x5eac
3231: e8 4a 08 00 00 call 3a80 <printf>
exit();
3236: e8 b8 06 00 00 call 38f3 <exit>
323b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
323f: 90 nop
00003240 <bsstest>:
{
3240: 55 push %ebp
3241: 89 e5 mov %esp,%ebp
3243: 83 ec 10 sub $0x10,%esp
printf(stdout, "bss test\n");
3246: 68 8e 4c 00 00 push $0x4c8e
324b: ff 35 ac 5e 00 00 push 0x5eac
3251: e8 2a 08 00 00 call 3a80 <printf>
3256: 83 c4 10 add $0x10,%esp
for(i = 0; i < sizeof(uninit); i++){
3259: 31 c0 xor %eax,%eax
325b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
325f: 90 nop
if(uninit[i] != '\0'){
3260: 80 b8 e0 5e 00 00 00 cmpb $0x0,0x5ee0(%eax)
3267: 75 22 jne 328b <bsstest+0x4b>
for(i = 0; i < sizeof(uninit); i++){
3269: 83 c0 01 add $0x1,%eax
326c: 3d 10 27 00 00 cmp $0x2710,%eax
3271: 75 ed jne 3260 <bsstest+0x20>
printf(stdout, "bss test ok\n");
3273: 83 ec 08 sub $0x8,%esp
3276: 68 a9 4c 00 00 push $0x4ca9
327b: ff 35 ac 5e 00 00 push 0x5eac
3281: e8 fa 07 00 00 call 3a80 <printf>
}
3286: 83 c4 10 add $0x10,%esp
3289: c9 leave
328a: c3 ret
printf(stdout, "bss test failed\n");
328b: 83 ec 08 sub $0x8,%esp
328e: 68 98 4c 00 00 push $0x4c98
3293: ff 35 ac 5e 00 00 push 0x5eac
3299: e8 e2 07 00 00 call 3a80 <printf>
exit();
329e: e8 50 06 00 00 call 38f3 <exit>
32a3: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
32aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
000032b0 <bigargtest>:
{
32b0: 55 push %ebp
32b1: 89 e5 mov %esp,%ebp
32b3: 83 ec 14 sub $0x14,%esp
unlink("bigarg-ok");
32b6: 68 b6 4c 00 00 push $0x4cb6
32bb: e8 83 06 00 00 call 3943 <unlink>
pid = fork();
32c0: e8 26 06 00 00 call 38eb <fork>
if(pid == 0){
32c5: 83 c4 10 add $0x10,%esp
32c8: 85 c0 test %eax,%eax
32ca: 74 44 je 3310 <bigargtest+0x60>
} else if(pid < 0){
32cc: 0f 88 c5 00 00 00 js 3397 <bigargtest+0xe7>
wait();
32d2: e8 24 06 00 00 call 38fb <wait>
fd = open("bigarg-ok", 0);
32d7: 83 ec 08 sub $0x8,%esp
32da: 6a 00 push $0x0
32dc: 68 b6 4c 00 00 push $0x4cb6
32e1: e8 4d 06 00 00 call 3933 <open>
if(fd < 0){
32e6: 83 c4 10 add $0x10,%esp
32e9: 85 c0 test %eax,%eax
32eb: 0f 88 8f 00 00 00 js 3380 <bigargtest+0xd0>
close(fd);
32f1: 83 ec 0c sub $0xc,%esp
32f4: 50 push %eax
32f5: e8 21 06 00 00 call 391b <close>
unlink("bigarg-ok");
32fa: c7 04 24 b6 4c 00 00 movl $0x4cb6,(%esp)
3301: e8 3d 06 00 00 call 3943 <unlink>
}
3306: 83 c4 10 add $0x10,%esp
3309: c9 leave
330a: c3 ret
330b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
330f: 90 nop
args[i] = "bigargs test: failed\n ";
3310: c7 04 85 00 a6 00 00 movl $0x5410,0xa600(,%eax,4)
3317: 10 54 00 00
for(i = 0; i < MAXARG-1; i++)
331b: 83 c0 01 add $0x1,%eax
331e: 83 f8 1f cmp $0x1f,%eax
3321: 75 ed jne 3310 <bigargtest+0x60>
printf(stdout, "bigarg test\n");
3323: 51 push %ecx
3324: 51 push %ecx
3325: 68 c0 4c 00 00 push $0x4cc0
332a: ff 35 ac 5e 00 00 push 0x5eac
args[MAXARG-1] = 0;
3330: c7 05 7c a6 00 00 00 movl $0x0,0xa67c
3337: 00 00 00
printf(stdout, "bigarg test\n");
333a: e8 41 07 00 00 call 3a80 <printf>
exec("echo", args);
333f: 58 pop %eax
3340: 5a pop %edx
3341: 68 00 a6 00 00 push $0xa600
3346: 68 8d 3e 00 00 push $0x3e8d
334b: e8 db 05 00 00 call 392b <exec>
printf(stdout, "bigarg test ok\n");
3350: 59 pop %ecx
3351: 58 pop %eax
3352: 68 cd 4c 00 00 push $0x4ccd
3357: ff 35 ac 5e 00 00 push 0x5eac
335d: e8 1e 07 00 00 call 3a80 <printf>
fd = open("bigarg-ok", O_CREATE);
3362: 58 pop %eax
3363: 5a pop %edx
3364: 68 00 02 00 00 push $0x200
3369: 68 b6 4c 00 00 push $0x4cb6
336e: e8 c0 05 00 00 call 3933 <open>
close(fd);
3373: 89 04 24 mov %eax,(%esp)
3376: e8 a0 05 00 00 call 391b <close>
exit();
337b: e8 73 05 00 00 call 38f3 <exit>
printf(stdout, "bigarg test failed!\n");
3380: 50 push %eax
3381: 50 push %eax
3382: 68 f6 4c 00 00 push $0x4cf6
3387: ff 35 ac 5e 00 00 push 0x5eac
338d: e8 ee 06 00 00 call 3a80 <printf>
exit();
3392: e8 5c 05 00 00 call 38f3 <exit>
printf(stdout, "bigargtest: fork failed\n");
3397: 52 push %edx
3398: 52 push %edx
3399: 68 dd 4c 00 00 push $0x4cdd
339e: ff 35 ac 5e 00 00 push 0x5eac
33a4: e8 d7 06 00 00 call 3a80 <printf>
exit();
33a9: e8 45 05 00 00 call 38f3 <exit>
33ae: 66 90 xchg %ax,%ax
000033b0 <fsfull>:
{
33b0: 55 push %ebp
33b1: 89 e5 mov %esp,%ebp
33b3: 57 push %edi
33b4: 56 push %esi
for(nfiles = 0; ; nfiles++){
33b5: 31 f6 xor %esi,%esi
{
33b7: 53 push %ebx
33b8: 83 ec 54 sub $0x54,%esp
printf(1, "fsfull test\n");
33bb: 68 0b 4d 00 00 push $0x4d0b
33c0: 6a 01 push $0x1
33c2: e8 b9 06 00 00 call 3a80 <printf>
33c7: 83 c4 10 add $0x10,%esp
33ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
name[1] = '0' + nfiles / 1000;
33d0: b8 d3 4d 62 10 mov $0x10624dd3,%eax
name[3] = '0' + (nfiles % 100) / 10;
33d5: b9 cd cc cc cc mov $0xcccccccd,%ecx
printf(1, "writing %s\n", name);
33da: 83 ec 04 sub $0x4,%esp
name[0] = 'f';
33dd: c6 45 a8 66 movb $0x66,-0x58(%ebp)
name[1] = '0' + nfiles / 1000;
33e1: f7 e6 mul %esi
name[5] = '\0';
33e3: c6 45 ad 00 movb $0x0,-0x53(%ebp)
name[1] = '0' + nfiles / 1000;
33e7: c1 ea 06 shr $0x6,%edx
33ea: 8d 42 30 lea 0x30(%edx),%eax
33ed: 88 45 a9 mov %al,-0x57(%ebp)
name[2] = '0' + (nfiles % 1000) / 100;
33f0: 69 c2 e8 03 00 00 imul $0x3e8,%edx,%eax
33f6: 89 f2 mov %esi,%edx
33f8: 29 c2 sub %eax,%edx
33fa: b8 1f 85 eb 51 mov $0x51eb851f,%eax
33ff: f7 e2 mul %edx
name[3] = '0' + (nfiles % 100) / 10;
3401: b8 1f 85 eb 51 mov $0x51eb851f,%eax
name[2] = '0' + (nfiles % 1000) / 100;
3406: c1 ea 05 shr $0x5,%edx
3409: 83 c2 30 add $0x30,%edx
340c: 88 55 aa mov %dl,-0x56(%ebp)
name[3] = '0' + (nfiles % 100) / 10;
340f: f7 e6 mul %esi
3411: c1 ea 05 shr $0x5,%edx
3414: 6b c2 64 imul $0x64,%edx,%eax
3417: 89 f2 mov %esi,%edx
3419: 29 c2 sub %eax,%edx
341b: 89 d0 mov %edx,%eax
341d: f7 e1 mul %ecx
name[4] = '0' + (nfiles % 10);
341f: 89 f0 mov %esi,%eax
name[3] = '0' + (nfiles % 100) / 10;
3421: c1 ea 03 shr $0x3,%edx
3424: 83 c2 30 add $0x30,%edx
3427: 88 55 ab mov %dl,-0x55(%ebp)
name[4] = '0' + (nfiles % 10);
342a: f7 e1 mul %ecx
342c: 89 f0 mov %esi,%eax
342e: c1 ea 03 shr $0x3,%edx
3431: 8d 14 92 lea (%edx,%edx,4),%edx
3434: 01 d2 add %edx,%edx
3436: 29 d0 sub %edx,%eax
3438: 83 c0 30 add $0x30,%eax
343b: 88 45 ac mov %al,-0x54(%ebp)
printf(1, "writing %s\n", name);
343e: 8d 45 a8 lea -0x58(%ebp),%eax
3441: 50 push %eax
3442: 68 18 4d 00 00 push $0x4d18
3447: 6a 01 push $0x1
3449: e8 32 06 00 00 call 3a80 <printf>
int fd = open(name, O_CREATE|O_RDWR);
344e: 58 pop %eax
344f: 8d 45 a8 lea -0x58(%ebp),%eax
3452: 5a pop %edx
3453: 68 02 02 00 00 push $0x202
3458: 50 push %eax
3459: e8 d5 04 00 00 call 3933 <open>
if(fd < 0){
345e: 83 c4 10 add $0x10,%esp
int fd = open(name, O_CREATE|O_RDWR);
3461: 89 c7 mov %eax,%edi
if(fd < 0){
3463: 85 c0 test %eax,%eax
3465: 78 4f js 34b6 <fsfull+0x106>
int total = 0;
3467: 31 db xor %ebx,%ebx
3469: eb 07 jmp 3472 <fsfull+0xc2>
346b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
346f: 90 nop
total += cc;
3470: 01 c3 add %eax,%ebx
int cc = write(fd, buf, 512);
3472: 83 ec 04 sub $0x4,%esp
3475: 68 00 02 00 00 push $0x200
347a: 68 00 86 00 00 push $0x8600
347f: 57 push %edi
3480: e8 8e 04 00 00 call 3913 <write>
if(cc < 512)
3485: 83 c4 10 add $0x10,%esp
3488: 3d ff 01 00 00 cmp $0x1ff,%eax
348d: 7f e1 jg 3470 <fsfull+0xc0>
printf(1, "wrote %d bytes\n", total);
348f: 83 ec 04 sub $0x4,%esp
3492: 53 push %ebx
3493: 68 34 4d 00 00 push $0x4d34
3498: 6a 01 push $0x1
349a: e8 e1 05 00 00 call 3a80 <printf>
close(fd);
349f: 89 3c 24 mov %edi,(%esp)
34a2: e8 74 04 00 00 call 391b <close>
if(total == 0)
34a7: 83 c4 10 add $0x10,%esp
34aa: 85 db test %ebx,%ebx
34ac: 74 1e je 34cc <fsfull+0x11c>
for(nfiles = 0; ; nfiles++){
34ae: 83 c6 01 add $0x1,%esi
34b1: e9 1a ff ff ff jmp 33d0 <fsfull+0x20>
printf(1, "open %s failed\n", name);
34b6: 83 ec 04 sub $0x4,%esp
34b9: 8d 45 a8 lea -0x58(%ebp),%eax
34bc: 50 push %eax
34bd: 68 24 4d 00 00 push $0x4d24
34c2: 6a 01 push $0x1
34c4: e8 b7 05 00 00 call 3a80 <printf>
break;
34c9: 83 c4 10 add $0x10,%esp
name[1] = '0' + nfiles / 1000;
34cc: bf d3 4d 62 10 mov $0x10624dd3,%edi
name[2] = '0' + (nfiles % 1000) / 100;
34d1: bb 1f 85 eb 51 mov $0x51eb851f,%ebx
34d6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
34dd: 8d 76 00 lea 0x0(%esi),%esi
name[1] = '0' + nfiles / 1000;
34e0: 89 f0 mov %esi,%eax
unlink(name);
34e2: 83 ec 0c sub $0xc,%esp
name[0] = 'f';
34e5: c6 45 a8 66 movb $0x66,-0x58(%ebp)
name[1] = '0' + nfiles / 1000;
34e9: f7 e7 mul %edi
name[5] = '\0';
34eb: c6 45 ad 00 movb $0x0,-0x53(%ebp)
name[1] = '0' + nfiles / 1000;
34ef: c1 ea 06 shr $0x6,%edx
34f2: 8d 42 30 lea 0x30(%edx),%eax
34f5: 88 45 a9 mov %al,-0x57(%ebp)
name[2] = '0' + (nfiles % 1000) / 100;
34f8: 69 c2 e8 03 00 00 imul $0x3e8,%edx,%eax
34fe: 89 f2 mov %esi,%edx
3500: 29 c2 sub %eax,%edx
3502: 89 d0 mov %edx,%eax
3504: f7 e3 mul %ebx
name[3] = '0' + (nfiles % 100) / 10;
3506: 89 f0 mov %esi,%eax
name[2] = '0' + (nfiles % 1000) / 100;
3508: c1 ea 05 shr $0x5,%edx
350b: 83 c2 30 add $0x30,%edx
350e: 88 55 aa mov %dl,-0x56(%ebp)
name[3] = '0' + (nfiles % 100) / 10;
3511: f7 e3 mul %ebx
3513: c1 ea 05 shr $0x5,%edx
3516: 6b ca 64 imul $0x64,%edx,%ecx
3519: 89 f2 mov %esi,%edx
351b: 29 ca sub %ecx,%edx
351d: b9 cd cc cc cc mov $0xcccccccd,%ecx
3522: 89 d0 mov %edx,%eax
3524: f7 e1 mul %ecx
name[4] = '0' + (nfiles % 10);
3526: 89 f0 mov %esi,%eax
name[3] = '0' + (nfiles % 100) / 10;
3528: c1 ea 03 shr $0x3,%edx
352b: 83 c2 30 add $0x30,%edx
352e: 88 55 ab mov %dl,-0x55(%ebp)
name[4] = '0' + (nfiles % 10);
3531: f7 e1 mul %ecx
3533: 89 f0 mov %esi,%eax
nfiles--;
3535: 83 ee 01 sub $0x1,%esi
name[4] = '0' + (nfiles % 10);
3538: c1 ea 03 shr $0x3,%edx
353b: 8d 14 92 lea (%edx,%edx,4),%edx
353e: 01 d2 add %edx,%edx
3540: 29 d0 sub %edx,%eax
3542: 83 c0 30 add $0x30,%eax
3545: 88 45 ac mov %al,-0x54(%ebp)
unlink(name);
3548: 8d 45 a8 lea -0x58(%ebp),%eax
354b: 50 push %eax
354c: e8 f2 03 00 00 call 3943 <unlink>
while(nfiles >= 0){
3551: 83 c4 10 add $0x10,%esp
3554: 83 fe ff cmp $0xffffffff,%esi
3557: 75 87 jne 34e0 <fsfull+0x130>
printf(1, "fsfull test finished\n");
3559: 83 ec 08 sub $0x8,%esp
355c: 68 44 4d 00 00 push $0x4d44
3561: 6a 01 push $0x1
3563: e8 18 05 00 00 call 3a80 <printf>
}
3568: 83 c4 10 add $0x10,%esp
356b: 8d 65 f4 lea -0xc(%ebp),%esp
356e: 5b pop %ebx
356f: 5e pop %esi
3570: 5f pop %edi
3571: 5d pop %ebp
3572: c3 ret
3573: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
357a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00003580 <uio>:
{
3580: 55 push %ebp
3581: 89 e5 mov %esp,%ebp
3583: 83 ec 10 sub $0x10,%esp
printf(1, "uio test\n");
3586: 68 5a 4d 00 00 push $0x4d5a
358b: 6a 01 push $0x1
358d: e8 ee 04 00 00 call 3a80 <printf>
pid = fork();
3592: e8 54 03 00 00 call 38eb <fork>
if(pid == 0){
3597: 83 c4 10 add $0x10,%esp
359a: 85 c0 test %eax,%eax
359c: 74 1b je 35b9 <uio+0x39>
} else if(pid < 0){
359e: 78 3d js 35dd <uio+0x5d>
wait();
35a0: e8 56 03 00 00 call 38fb <wait>
printf(1, "uio test done\n");
35a5: 83 ec 08 sub $0x8,%esp
35a8: 68 64 4d 00 00 push $0x4d64
35ad: 6a 01 push $0x1
35af: e8 cc 04 00 00 call 3a80 <printf>
}
35b4: 83 c4 10 add $0x10,%esp
35b7: c9 leave
35b8: c3 ret
asm volatile("outb %0,%1"::"a"(val), "d" (port));
35b9: b8 09 00 00 00 mov $0x9,%eax
35be: ba 70 00 00 00 mov $0x70,%edx
35c3: ee out %al,(%dx)
asm volatile("inb %1,%0" : "=a" (val) : "d" (port));
35c4: ba 71 00 00 00 mov $0x71,%edx
35c9: ec in (%dx),%al
printf(1, "uio: uio succeeded; test FAILED\n");
35ca: 52 push %edx
35cb: 52 push %edx
35cc: 68 f0 54 00 00 push $0x54f0
35d1: 6a 01 push $0x1
35d3: e8 a8 04 00 00 call 3a80 <printf>
exit();
35d8: e8 16 03 00 00 call 38f3 <exit>
printf (1, "fork failed\n");
35dd: 50 push %eax
35de: 50 push %eax
35df: 68 e9 4c 00 00 push $0x4ce9
35e4: 6a 01 push $0x1
35e6: e8 95 04 00 00 call 3a80 <printf>
exit();
35eb: e8 03 03 00 00 call 38f3 <exit>
000035f0 <argptest>:
{
35f0: 55 push %ebp
35f1: 89 e5 mov %esp,%ebp
35f3: 53 push %ebx
35f4: 83 ec 0c sub $0xc,%esp
fd = open("init", O_RDONLY);
35f7: 6a 00 push $0x0
35f9: 68 73 4d 00 00 push $0x4d73
35fe: e8 30 03 00 00 call 3933 <open>
if (fd < 0) {
3603: 83 c4 10 add $0x10,%esp
3606: 85 c0 test %eax,%eax
3608: 78 39 js 3643 <argptest+0x53>
read(fd, sbrk(0) - 1, -1);
360a: 83 ec 0c sub $0xc,%esp
360d: 89 c3 mov %eax,%ebx
360f: 6a 00 push $0x0
3611: e8 65 03 00 00 call 397b <sbrk>
3616: 83 c4 0c add $0xc,%esp
3619: 83 e8 01 sub $0x1,%eax
361c: 6a ff push $0xffffffff
361e: 50 push %eax
361f: 53 push %ebx
3620: e8 e6 02 00 00 call 390b <read>
close(fd);
3625: 89 1c 24 mov %ebx,(%esp)
3628: e8 ee 02 00 00 call 391b <close>
printf(1, "arg test passed\n");
362d: 58 pop %eax
362e: 5a pop %edx
362f: 68 85 4d 00 00 push $0x4d85
3634: 6a 01 push $0x1
3636: e8 45 04 00 00 call 3a80 <printf>
}
363b: 8b 5d fc mov -0x4(%ebp),%ebx
363e: 83 c4 10 add $0x10,%esp
3641: c9 leave
3642: c3 ret
printf(2, "open failed\n");
3643: 51 push %ecx
3644: 51 push %ecx
3645: 68 78 4d 00 00 push $0x4d78
364a: 6a 02 push $0x2
364c: e8 2f 04 00 00 call 3a80 <printf>
exit();
3651: e8 9d 02 00 00 call 38f3 <exit>
3656: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
365d: 8d 76 00 lea 0x0(%esi),%esi
00003660 <rand>:
randstate = randstate * 1664525 + 1013904223;
3660: 69 05 a8 5e 00 00 0d imul $0x19660d,0x5ea8,%eax
3667: 66 19 00
366a: 05 5f f3 6e 3c add $0x3c6ef35f,%eax
366f: a3 a8 5e 00 00 mov %eax,0x5ea8
}
3674: c3 ret
3675: 66 90 xchg %ax,%ax
3677: 66 90 xchg %ax,%ax
3679: 66 90 xchg %ax,%ax
367b: 66 90 xchg %ax,%ax
367d: 66 90 xchg %ax,%ax
367f: 90 nop
00003680 <strcpy>:
#include "stat.h"
#include "types.h"
#include "user.h"
#include "x86.h"
char *strcpy(char *s, const char *t) {
3680: 55 push %ebp
char *os;
os = s;
while ((*s++ = *t++) != 0)
3681: 31 c0 xor %eax,%eax
char *strcpy(char *s, const char *t) {
3683: 89 e5 mov %esp,%ebp
3685: 53 push %ebx
3686: 8b 4d 08 mov 0x8(%ebp),%ecx
3689: 8b 5d 0c mov 0xc(%ebp),%ebx
368c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
while ((*s++ = *t++) != 0)
3690: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx
3694: 88 14 01 mov %dl,(%ecx,%eax,1)
3697: 83 c0 01 add $0x1,%eax
369a: 84 d2 test %dl,%dl
369c: 75 f2 jne 3690 <strcpy+0x10>
;
return os;
}
369e: 8b 5d fc mov -0x4(%ebp),%ebx
36a1: 89 c8 mov %ecx,%eax
36a3: c9 leave
36a4: c3 ret
36a5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
36ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
000036b0 <strcmp>:
int strcmp(const char *p, const char *q) {
36b0: 55 push %ebp
36b1: 89 e5 mov %esp,%ebp
36b3: 53 push %ebx
36b4: 8b 55 08 mov 0x8(%ebp),%edx
36b7: 8b 4d 0c mov 0xc(%ebp),%ecx
while (*p && *p == *q)
36ba: 0f b6 02 movzbl (%edx),%eax
36bd: 84 c0 test %al,%al
36bf: 75 17 jne 36d8 <strcmp+0x28>
36c1: eb 3a jmp 36fd <strcmp+0x4d>
36c3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
36c7: 90 nop
36c8: 0f b6 42 01 movzbl 0x1(%edx),%eax
p++, q++;
36cc: 83 c2 01 add $0x1,%edx
36cf: 8d 59 01 lea 0x1(%ecx),%ebx
while (*p && *p == *q)
36d2: 84 c0 test %al,%al
36d4: 74 1a je 36f0 <strcmp+0x40>
p++, q++;
36d6: 89 d9 mov %ebx,%ecx
while (*p && *p == *q)
36d8: 0f b6 19 movzbl (%ecx),%ebx
36db: 38 c3 cmp %al,%bl
36dd: 74 e9 je 36c8 <strcmp+0x18>
return (uchar)*p - (uchar)*q;
36df: 29 d8 sub %ebx,%eax
}
36e1: 8b 5d fc mov -0x4(%ebp),%ebx
36e4: c9 leave
36e5: c3 ret
36e6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
36ed: 8d 76 00 lea 0x0(%esi),%esi
return (uchar)*p - (uchar)*q;
36f0: 0f b6 59 01 movzbl 0x1(%ecx),%ebx
36f4: 31 c0 xor %eax,%eax
36f6: 29 d8 sub %ebx,%eax
}
36f8: 8b 5d fc mov -0x4(%ebp),%ebx
36fb: c9 leave
36fc: c3 ret
return (uchar)*p - (uchar)*q;
36fd: 0f b6 19 movzbl (%ecx),%ebx
3700: 31 c0 xor %eax,%eax
3702: eb db jmp 36df <strcmp+0x2f>
3704: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
370b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
370f: 90 nop
00003710 <strlen>:
uint strlen(const char *s) {
3710: 55 push %ebp
3711: 89 e5 mov %esp,%ebp
3713: 8b 55 08 mov 0x8(%ebp),%edx
int n;
for (n = 0; s[n]; n++)
3716: 80 3a 00 cmpb $0x0,(%edx)
3719: 74 15 je 3730 <strlen+0x20>
371b: 31 c0 xor %eax,%eax
371d: 8d 76 00 lea 0x0(%esi),%esi
3720: 83 c0 01 add $0x1,%eax
3723: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1)
3727: 89 c1 mov %eax,%ecx
3729: 75 f5 jne 3720 <strlen+0x10>
;
return n;
}
372b: 89 c8 mov %ecx,%eax
372d: 5d pop %ebp
372e: c3 ret
372f: 90 nop
for (n = 0; s[n]; n++)
3730: 31 c9 xor %ecx,%ecx
}
3732: 5d pop %ebp
3733: 89 c8 mov %ecx,%eax
3735: c3 ret
3736: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
373d: 8d 76 00 lea 0x0(%esi),%esi
00003740 <memset>:
void *memset(void *dst, int c, uint n) {
3740: 55 push %ebp
3741: 89 e5 mov %esp,%ebp
3743: 57 push %edi
3744: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
3747: 8b 4d 10 mov 0x10(%ebp),%ecx
374a: 8b 45 0c mov 0xc(%ebp),%eax
374d: 89 d7 mov %edx,%edi
374f: fc cld
3750: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
3752: 8b 7d fc mov -0x4(%ebp),%edi
3755: 89 d0 mov %edx,%eax
3757: c9 leave
3758: c3 ret
3759: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00003760 <strchr>:
char *strchr(const char *s, char c) {
3760: 55 push %ebp
3761: 89 e5 mov %esp,%ebp
3763: 8b 45 08 mov 0x8(%ebp),%eax
3766: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx
for (; *s; s++)
376a: 0f b6 10 movzbl (%eax),%edx
376d: 84 d2 test %dl,%dl
376f: 75 12 jne 3783 <strchr+0x23>
3771: eb 1d jmp 3790 <strchr+0x30>
3773: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3777: 90 nop
3778: 0f b6 50 01 movzbl 0x1(%eax),%edx
377c: 83 c0 01 add $0x1,%eax
377f: 84 d2 test %dl,%dl
3781: 74 0d je 3790 <strchr+0x30>
if (*s == c)
3783: 38 d1 cmp %dl,%cl
3785: 75 f1 jne 3778 <strchr+0x18>
return (char *)s;
return 0;
}
3787: 5d pop %ebp
3788: c3 ret
3789: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
return 0;
3790: 31 c0 xor %eax,%eax
}
3792: 5d pop %ebp
3793: c3 ret
3794: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
379b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
379f: 90 nop
000037a0 <gets>:
char *gets(char *buf, int max) {
37a0: 55 push %ebp
37a1: 89 e5 mov %esp,%ebp
37a3: 57 push %edi
37a4: 56 push %esi
int i, cc;
char c;
for (i = 0; i + 1 < max;) {
cc = read(0, &c, 1);
37a5: 8d 7d e7 lea -0x19(%ebp),%edi
char *gets(char *buf, int max) {
37a8: 53 push %ebx
for (i = 0; i + 1 < max;) {
37a9: 31 db xor %ebx,%ebx
char *gets(char *buf, int max) {
37ab: 83 ec 1c sub $0x1c,%esp
for (i = 0; i + 1 < max;) {
37ae: eb 27 jmp 37d7 <gets+0x37>
cc = read(0, &c, 1);
37b0: 83 ec 04 sub $0x4,%esp
37b3: 6a 01 push $0x1
37b5: 57 push %edi
37b6: 6a 00 push $0x0
37b8: e8 4e 01 00 00 call 390b <read>
if (cc < 1)
37bd: 83 c4 10 add $0x10,%esp
37c0: 85 c0 test %eax,%eax
37c2: 7e 1d jle 37e1 <gets+0x41>
break;
buf[i++] = c;
37c4: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
37c8: 8b 55 08 mov 0x8(%ebp),%edx
37cb: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1)
if (c == '\n' || c == '\r')
37cf: 3c 0a cmp $0xa,%al
37d1: 74 1d je 37f0 <gets+0x50>
37d3: 3c 0d cmp $0xd,%al
37d5: 74 19 je 37f0 <gets+0x50>
for (i = 0; i + 1 < max;) {
37d7: 89 de mov %ebx,%esi
37d9: 83 c3 01 add $0x1,%ebx
37dc: 3b 5d 0c cmp 0xc(%ebp),%ebx
37df: 7c cf jl 37b0 <gets+0x10>
break;
}
buf[i] = '\0';
37e1: 8b 45 08 mov 0x8(%ebp),%eax
37e4: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
37e8: 8d 65 f4 lea -0xc(%ebp),%esp
37eb: 5b pop %ebx
37ec: 5e pop %esi
37ed: 5f pop %edi
37ee: 5d pop %ebp
37ef: c3 ret
buf[i] = '\0';
37f0: 8b 45 08 mov 0x8(%ebp),%eax
37f3: 89 de mov %ebx,%esi
37f5: c6 04 30 00 movb $0x0,(%eax,%esi,1)
}
37f9: 8d 65 f4 lea -0xc(%ebp),%esp
37fc: 5b pop %ebx
37fd: 5e pop %esi
37fe: 5f pop %edi
37ff: 5d pop %ebp
3800: c3 ret
3801: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3808: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
380f: 90 nop
00003810 <stat>:
int stat(const char *n, struct stat *st) {
3810: 55 push %ebp
3811: 89 e5 mov %esp,%ebp
3813: 56 push %esi
3814: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
3815: 83 ec 08 sub $0x8,%esp
3818: 6a 00 push $0x0
381a: ff 75 08 push 0x8(%ebp)
381d: e8 11 01 00 00 call 3933 <open>
if (fd < 0)
3822: 83 c4 10 add $0x10,%esp
3825: 85 c0 test %eax,%eax
3827: 78 27 js 3850 <stat+0x40>
return -1;
r = fstat(fd, st);
3829: 83 ec 08 sub $0x8,%esp
382c: ff 75 0c push 0xc(%ebp)
382f: 89 c3 mov %eax,%ebx
3831: 50 push %eax
3832: e8 14 01 00 00 call 394b <fstat>
close(fd);
3837: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
383a: 89 c6 mov %eax,%esi
close(fd);
383c: e8 da 00 00 00 call 391b <close>
return r;
3841: 83 c4 10 add $0x10,%esp
}
3844: 8d 65 f8 lea -0x8(%ebp),%esp
3847: 89 f0 mov %esi,%eax
3849: 5b pop %ebx
384a: 5e pop %esi
384b: 5d pop %ebp
384c: c3 ret
384d: 8d 76 00 lea 0x0(%esi),%esi
return -1;
3850: be ff ff ff ff mov $0xffffffff,%esi
3855: eb ed jmp 3844 <stat+0x34>
3857: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
385e: 66 90 xchg %ax,%ax
00003860 <atoi>:
int atoi(const char *s) {
3860: 55 push %ebp
3861: 89 e5 mov %esp,%ebp
3863: 56 push %esi
3864: be 01 00 00 00 mov $0x1,%esi
3869: 8b 4d 08 mov 0x8(%ebp),%ecx
386c: 53 push %ebx
i = 0;
sign = 1;
val = 0;
nbr = 0;
if (s[0] == '-') {
386d: 0f b6 11 movzbl (%ecx),%edx
3870: 80 fa 2d cmp $0x2d,%dl
3873: 75 0c jne 3881 <atoi+0x21>
sign = -1;
s++;
}
i = 0;
while (s[i] >= '0' && s[i] <= '9' && s[i] != '\0') {
3875: 0f b6 51 01 movzbl 0x1(%ecx),%edx
sign = -1;
3879: be ff ff ff ff mov $0xffffffff,%esi
s++;
387e: 83 c1 01 add $0x1,%ecx
while (s[i] >= '0' && s[i] <= '9' && s[i] != '\0') {
3881: 8d 5a d0 lea -0x30(%edx),%ebx
3884: 80 fb 09 cmp $0x9,%bl
3887: 77 2f ja 38b8 <atoi+0x58>
3889: 83 c1 01 add $0x1,%ecx
val = 0;
388c: 31 db xor %ebx,%ebx
388e: 66 90 xchg %ax,%ax
nbr = (int)(s[i] - '0');
3890: 83 ea 30 sub $0x30,%edx
val = (val * 10) + nbr;
3893: 8d 1c 9b lea (%ebx,%ebx,4),%ebx
while (s[i] >= '0' && s[i] <= '9' && s[i] != '\0') {
3896: 83 c1 01 add $0x1,%ecx
nbr = (int)(s[i] - '0');
3899: 0f be d2 movsbl %dl,%edx
val = (val * 10) + nbr;
389c: 8d 1c 5a lea (%edx,%ebx,2),%ebx
while (s[i] >= '0' && s[i] <= '9' && s[i] != '\0') {
389f: 0f b6 51 ff movzbl -0x1(%ecx),%edx
38a3: 8d 42 d0 lea -0x30(%edx),%eax
38a6: 3c 09 cmp $0x9,%al
38a8: 76 e6 jbe 3890 <atoi+0x30>
i++;
}
i++;
return (val * sign);
38aa: 89 f0 mov %esi,%eax
38ac: 0f af c3 imul %ebx,%eax
}
38af: 5b pop %ebx
38b0: 5e pop %esi
38b1: 5d pop %ebp
38b2: c3 ret
38b3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
38b7: 90 nop
38b8: 5b pop %ebx
while (s[i] >= '0' && s[i] <= '9' && s[i] != '\0') {
38b9: 31 c0 xor %eax,%eax
}
38bb: 5e pop %esi
38bc: 5d pop %ebp
38bd: c3 ret
38be: 66 90 xchg %ax,%ax
000038c0 <memmove>:
void *memmove(void *vdst, const void *vsrc, int n) {
38c0: 55 push %ebp
38c1: 89 e5 mov %esp,%ebp
38c3: 57 push %edi
38c4: 8b 45 10 mov 0x10(%ebp),%eax
38c7: 8b 55 08 mov 0x8(%ebp),%edx
38ca: 56 push %esi
38cb: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while (n-- > 0)
38ce: 85 c0 test %eax,%eax
38d0: 7e 13 jle 38e5 <memmove+0x25>
38d2: 01 d0 add %edx,%eax
dst = vdst;
38d4: 89 d7 mov %edx,%edi
38d6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
38dd: 8d 76 00 lea 0x0(%esi),%esi
*dst++ = *src++;
38e0: a4 movsb %ds:(%esi),%es:(%edi)
while (n-- > 0)
38e1: 39 f8 cmp %edi,%eax
38e3: 75 fb jne 38e0 <memmove+0x20>
return vdst;
}
38e5: 5e pop %esi
38e6: 89 d0 mov %edx,%eax
38e8: 5f pop %edi
38e9: 5d pop %ebp
38ea: c3 ret
000038eb <fork>:
SYSCALL(fork)
38eb: b8 01 00 00 00 mov $0x1,%eax
38f0: cd 40 int $0x40
38f2: c3 ret
000038f3 <exit>:
SYSCALL(exit)
38f3: b8 02 00 00 00 mov $0x2,%eax
38f8: cd 40 int $0x40
38fa: c3 ret
000038fb <wait>:
SYSCALL(wait)
38fb: b8 03 00 00 00 mov $0x3,%eax
3900: cd 40 int $0x40
3902: c3 ret
00003903 <pipe>:
SYSCALL(pipe)
3903: b8 04 00 00 00 mov $0x4,%eax
3908: cd 40 int $0x40
390a: c3 ret
0000390b <read>:
SYSCALL(read)
390b: b8 05 00 00 00 mov $0x5,%eax
3910: cd 40 int $0x40
3912: c3 ret
00003913 <write>:
SYSCALL(write)
3913: b8 10 00 00 00 mov $0x10,%eax
3918: cd 40 int $0x40
391a: c3 ret
0000391b <close>:
SYSCALL(close)
391b: b8 15 00 00 00 mov $0x15,%eax
3920: cd 40 int $0x40
3922: c3 ret
00003923 <kill>:
SYSCALL(kill)
3923: b8 06 00 00 00 mov $0x6,%eax
3928: cd 40 int $0x40
392a: c3 ret
0000392b <exec>:
SYSCALL(exec)
392b: b8 07 00 00 00 mov $0x7,%eax
3930: cd 40 int $0x40
3932: c3 ret
00003933 <open>:
SYSCALL(open)
3933: b8 0f 00 00 00 mov $0xf,%eax
3938: cd 40 int $0x40
393a: c3 ret
0000393b <mknod>:
SYSCALL(mknod)
393b: b8 11 00 00 00 mov $0x11,%eax
3940: cd 40 int $0x40
3942: c3 ret
00003943 <unlink>:
SYSCALL(unlink)
3943: b8 12 00 00 00 mov $0x12,%eax
3948: cd 40 int $0x40
394a: c3 ret
0000394b <fstat>:
SYSCALL(fstat)
394b: b8 08 00 00 00 mov $0x8,%eax
3950: cd 40 int $0x40
3952: c3 ret
00003953 <link>:
SYSCALL(link)
3953: b8 13 00 00 00 mov $0x13,%eax
3958: cd 40 int $0x40
395a: c3 ret
0000395b <mkdir>:
SYSCALL(mkdir)
395b: b8 14 00 00 00 mov $0x14,%eax
3960: cd 40 int $0x40
3962: c3 ret
00003963 <chdir>:
SYSCALL(chdir)
3963: b8 09 00 00 00 mov $0x9,%eax
3968: cd 40 int $0x40
396a: c3 ret
0000396b <dup>:
SYSCALL(dup)
396b: b8 0a 00 00 00 mov $0xa,%eax
3970: cd 40 int $0x40
3972: c3 ret
00003973 <getpid>:
SYSCALL(getpid)
3973: b8 0b 00 00 00 mov $0xb,%eax
3978: cd 40 int $0x40
397a: c3 ret
0000397b <sbrk>:
SYSCALL(sbrk)
397b: b8 0c 00 00 00 mov $0xc,%eax
3980: cd 40 int $0x40
3982: c3 ret
00003983 <sleep>:
SYSCALL(sleep)
3983: b8 0d 00 00 00 mov $0xd,%eax
3988: cd 40 int $0x40
398a: c3 ret
0000398b <uptime>:
SYSCALL(uptime)
398b: b8 0e 00 00 00 mov $0xe,%eax
3990: cd 40 int $0x40
3992: c3 ret
00003993 <shutdown>:
#SYSCALL(dup)
#SYSCALL(getpid)
#SYSCALL(sbrk)
#SYSCALL(sleep)
#SYSCALL(uptime)
SYSCALL(shutdown)
3993: b8 16 00 00 00 mov $0x16,%eax
3998: cd 40 int $0x40
399a: c3 ret
0000399b <incr>:
SYSCALL(incr)
399b: b8 17 00 00 00 mov $0x17,%eax
39a0: cd 40 int $0x40
39a2: c3 ret
000039a3 <add>:
SYSCALL(add)
39a3: b8 18 00 00 00 mov $0x18,%eax
39a8: cd 40 int $0x40
39aa: c3 ret
000039ab <mult>:
SYSCALL(mult)
39ab: b8 19 00 00 00 mov $0x19,%eax
39b0: cd 40 int $0x40
39b2: c3 ret
000039b3 <div>:
SYSCALL(div)
39b3: b8 1a 00 00 00 mov $0x1a,%eax
39b8: cd 40 int $0x40
39ba: c3 ret
000039bb <mod>:
SYSCALL(mod)
39bb: b8 1b 00 00 00 mov $0x1b,%eax
39c0: cd 40 int $0x40
39c2: c3 ret
39c3: 66 90 xchg %ax,%ax
39c5: 66 90 xchg %ax,%ax
39c7: 66 90 xchg %ax,%ax
39c9: 66 90 xchg %ax,%ax
39cb: 66 90 xchg %ax,%ax
39cd: 66 90 xchg %ax,%ax
39cf: 90 nop
000039d0 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
39d0: 55 push %ebp
39d1: 89 e5 mov %esp,%ebp
39d3: 57 push %edi
39d4: 56 push %esi
39d5: 53 push %ebx
39d6: 83 ec 3c sub $0x3c,%esp
39d9: 89 4d c4 mov %ecx,-0x3c(%ebp)
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
39dc: 89 d1 mov %edx,%ecx
{
39de: 89 45 b8 mov %eax,-0x48(%ebp)
if(sgn && xx < 0){
39e1: 85 d2 test %edx,%edx
39e3: 0f 89 7f 00 00 00 jns 3a68 <printint+0x98>
39e9: f6 45 08 01 testb $0x1,0x8(%ebp)
39ed: 74 79 je 3a68 <printint+0x98>
neg = 1;
39ef: c7 45 bc 01 00 00 00 movl $0x1,-0x44(%ebp)
x = -xx;
39f6: f7 d9 neg %ecx
} else {
x = xx;
}
i = 0;
39f8: 31 db xor %ebx,%ebx
39fa: 8d 75 d7 lea -0x29(%ebp),%esi
39fd: 8d 76 00 lea 0x0(%esi),%esi
do{
buf[i++] = digits[x % base];
3a00: 89 c8 mov %ecx,%eax
3a02: 31 d2 xor %edx,%edx
3a04: 89 cf mov %ecx,%edi
3a06: f7 75 c4 divl -0x3c(%ebp)
3a09: 0f b6 92 a0 55 00 00 movzbl 0x55a0(%edx),%edx
3a10: 89 45 c0 mov %eax,-0x40(%ebp)
3a13: 89 d8 mov %ebx,%eax
3a15: 8d 5b 01 lea 0x1(%ebx),%ebx
}while((x /= base) != 0);
3a18: 8b 4d c0 mov -0x40(%ebp),%ecx
buf[i++] = digits[x % base];
3a1b: 88 14 1e mov %dl,(%esi,%ebx,1)
}while((x /= base) != 0);
3a1e: 39 7d c4 cmp %edi,-0x3c(%ebp)
3a21: 76 dd jbe 3a00 <printint+0x30>
if(neg)
3a23: 8b 4d bc mov -0x44(%ebp),%ecx
3a26: 85 c9 test %ecx,%ecx
3a28: 74 0c je 3a36 <printint+0x66>
buf[i++] = '-';
3a2a: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1)
buf[i++] = digits[x % base];
3a2f: 89 d8 mov %ebx,%eax
buf[i++] = '-';
3a31: ba 2d 00 00 00 mov $0x2d,%edx
while(--i >= 0)
3a36: 8b 7d b8 mov -0x48(%ebp),%edi
3a39: 8d 5c 05 d7 lea -0x29(%ebp,%eax,1),%ebx
3a3d: eb 07 jmp 3a46 <printint+0x76>
3a3f: 90 nop
putc(fd, buf[i]);
3a40: 0f b6 13 movzbl (%ebx),%edx
3a43: 83 eb 01 sub $0x1,%ebx
write(fd, &c, 1);
3a46: 83 ec 04 sub $0x4,%esp
3a49: 88 55 d7 mov %dl,-0x29(%ebp)
3a4c: 6a 01 push $0x1
3a4e: 56 push %esi
3a4f: 57 push %edi
3a50: e8 be fe ff ff call 3913 <write>
while(--i >= 0)
3a55: 83 c4 10 add $0x10,%esp
3a58: 39 de cmp %ebx,%esi
3a5a: 75 e4 jne 3a40 <printint+0x70>
}
3a5c: 8d 65 f4 lea -0xc(%ebp),%esp
3a5f: 5b pop %ebx
3a60: 5e pop %esi
3a61: 5f pop %edi
3a62: 5d pop %ebp
3a63: c3 ret
3a64: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
3a68: c7 45 bc 00 00 00 00 movl $0x0,-0x44(%ebp)
3a6f: eb 87 jmp 39f8 <printint+0x28>
3a71: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3a78: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3a7f: 90 nop
00003a80 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
3a80: 55 push %ebp
3a81: 89 e5 mov %esp,%ebp
3a83: 57 push %edi
3a84: 56 push %esi
3a85: 53 push %ebx
3a86: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
3a89: 8b 5d 0c mov 0xc(%ebp),%ebx
{
3a8c: 8b 75 08 mov 0x8(%ebp),%esi
for(i = 0; fmt[i]; i++){
3a8f: 0f b6 13 movzbl (%ebx),%edx
3a92: 84 d2 test %dl,%dl
3a94: 74 6a je 3b00 <printf+0x80>
ap = (uint*)(void*)&fmt + 1;
3a96: 8d 45 10 lea 0x10(%ebp),%eax
3a99: 83 c3 01 add $0x1,%ebx
write(fd, &c, 1);
3a9c: 8d 7d e7 lea -0x19(%ebp),%edi
state = 0;
3a9f: 31 c9 xor %ecx,%ecx
ap = (uint*)(void*)&fmt + 1;
3aa1: 89 45 d0 mov %eax,-0x30(%ebp)
3aa4: eb 36 jmp 3adc <printf+0x5c>
3aa6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3aad: 8d 76 00 lea 0x0(%esi),%esi
3ab0: 89 4d d4 mov %ecx,-0x2c(%ebp)
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
state = '%';
3ab3: b9 25 00 00 00 mov $0x25,%ecx
if(c == '%'){
3ab8: 83 f8 25 cmp $0x25,%eax
3abb: 74 15 je 3ad2 <printf+0x52>
write(fd, &c, 1);
3abd: 83 ec 04 sub $0x4,%esp
3ac0: 88 55 e7 mov %dl,-0x19(%ebp)
3ac3: 6a 01 push $0x1
3ac5: 57 push %edi
3ac6: 56 push %esi
3ac7: e8 47 fe ff ff call 3913 <write>
3acc: 8b 4d d4 mov -0x2c(%ebp),%ecx
} else {
putc(fd, c);
3acf: 83 c4 10 add $0x10,%esp
for(i = 0; fmt[i]; i++){
3ad2: 0f b6 13 movzbl (%ebx),%edx
3ad5: 83 c3 01 add $0x1,%ebx
3ad8: 84 d2 test %dl,%dl
3ada: 74 24 je 3b00 <printf+0x80>
c = fmt[i] & 0xff;
3adc: 0f b6 c2 movzbl %dl,%eax
if(state == 0){
3adf: 85 c9 test %ecx,%ecx
3ae1: 74 cd je 3ab0 <printf+0x30>
}
} else if(state == '%'){
3ae3: 83 f9 25 cmp $0x25,%ecx
3ae6: 75 ea jne 3ad2 <printf+0x52>
if(c == 'd'){
3ae8: 83 f8 25 cmp $0x25,%eax
3aeb: 0f 84 07 01 00 00 je 3bf8 <printf+0x178>
3af1: 83 e8 63 sub $0x63,%eax
3af4: 83 f8 15 cmp $0x15,%eax
3af7: 77 17 ja 3b10 <printf+0x90>
3af9: ff 24 85 48 55 00 00 jmp *0x5548(,%eax,4)
putc(fd, c);
}
state = 0;
}
}
}
3b00: 8d 65 f4 lea -0xc(%ebp),%esp
3b03: 5b pop %ebx
3b04: 5e pop %esi
3b05: 5f pop %edi
3b06: 5d pop %ebp
3b07: c3 ret
3b08: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3b0f: 90 nop
write(fd, &c, 1);
3b10: 83 ec 04 sub $0x4,%esp
3b13: 88 55 d4 mov %dl,-0x2c(%ebp)
3b16: 6a 01 push $0x1
3b18: 57 push %edi
3b19: 56 push %esi
3b1a: c6 45 e7 25 movb $0x25,-0x19(%ebp)
3b1e: e8 f0 fd ff ff call 3913 <write>
putc(fd, c);
3b23: 0f b6 55 d4 movzbl -0x2c(%ebp),%edx
write(fd, &c, 1);
3b27: 83 c4 0c add $0xc,%esp
3b2a: 88 55 e7 mov %dl,-0x19(%ebp)
3b2d: 6a 01 push $0x1
3b2f: 57 push %edi
3b30: 56 push %esi
3b31: e8 dd fd ff ff call 3913 <write>
putc(fd, c);
3b36: 83 c4 10 add $0x10,%esp
state = 0;
3b39: 31 c9 xor %ecx,%ecx
3b3b: eb 95 jmp 3ad2 <printf+0x52>
3b3d: 8d 76 00 lea 0x0(%esi),%esi
printint(fd, *ap, 16, 0);
3b40: 83 ec 0c sub $0xc,%esp
3b43: b9 10 00 00 00 mov $0x10,%ecx
3b48: 6a 00 push $0x0
3b4a: 8b 45 d0 mov -0x30(%ebp),%eax
3b4d: 8b 10 mov (%eax),%edx
3b4f: 89 f0 mov %esi,%eax
3b51: e8 7a fe ff ff call 39d0 <printint>
ap++;
3b56: 83 45 d0 04 addl $0x4,-0x30(%ebp)
3b5a: 83 c4 10 add $0x10,%esp
state = 0;
3b5d: 31 c9 xor %ecx,%ecx
3b5f: e9 6e ff ff ff jmp 3ad2 <printf+0x52>
3b64: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
s = (char*)*ap;
3b68: 8b 45 d0 mov -0x30(%ebp),%eax
3b6b: 8b 10 mov (%eax),%edx
ap++;
3b6d: 83 c0 04 add $0x4,%eax
3b70: 89 45 d0 mov %eax,-0x30(%ebp)
if(s == 0)
3b73: 85 d2 test %edx,%edx
3b75: 0f 84 8d 00 00 00 je 3c08 <printf+0x188>
while(*s != 0){
3b7b: 0f b6 02 movzbl (%edx),%eax
state = 0;
3b7e: 31 c9 xor %ecx,%ecx
while(*s != 0){
3b80: 84 c0 test %al,%al
3b82: 0f 84 4a ff ff ff je 3ad2 <printf+0x52>
3b88: 89 5d d4 mov %ebx,-0x2c(%ebp)
3b8b: 89 d3 mov %edx,%ebx
3b8d: 8d 76 00 lea 0x0(%esi),%esi
write(fd, &c, 1);
3b90: 83 ec 04 sub $0x4,%esp
s++;
3b93: 83 c3 01 add $0x1,%ebx
3b96: 88 45 e7 mov %al,-0x19(%ebp)
write(fd, &c, 1);
3b99: 6a 01 push $0x1
3b9b: 57 push %edi
3b9c: 56 push %esi
3b9d: e8 71 fd ff ff call 3913 <write>
while(*s != 0){
3ba2: 0f b6 03 movzbl (%ebx),%eax
3ba5: 83 c4 10 add $0x10,%esp
3ba8: 84 c0 test %al,%al
3baa: 75 e4 jne 3b90 <printf+0x110>
state = 0;
3bac: 8b 5d d4 mov -0x2c(%ebp),%ebx
3baf: 31 c9 xor %ecx,%ecx
3bb1: e9 1c ff ff ff jmp 3ad2 <printf+0x52>
3bb6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3bbd: 8d 76 00 lea 0x0(%esi),%esi
printint(fd, *ap, 10, 1);
3bc0: 83 ec 0c sub $0xc,%esp
3bc3: b9 0a 00 00 00 mov $0xa,%ecx
3bc8: 6a 01 push $0x1
3bca: e9 7b ff ff ff jmp 3b4a <printf+0xca>
3bcf: 90 nop
putc(fd, *ap);
3bd0: 8b 45 d0 mov -0x30(%ebp),%eax
write(fd, &c, 1);
3bd3: 83 ec 04 sub $0x4,%esp
putc(fd, *ap);
3bd6: 8b 00 mov (%eax),%eax
write(fd, &c, 1);
3bd8: 6a 01 push $0x1
3bda: 57 push %edi
3bdb: 56 push %esi
putc(fd, *ap);
3bdc: 88 45 e7 mov %al,-0x19(%ebp)
write(fd, &c, 1);
3bdf: e8 2f fd ff ff call 3913 <write>
ap++;
3be4: 83 45 d0 04 addl $0x4,-0x30(%ebp)
3be8: 83 c4 10 add $0x10,%esp
state = 0;
3beb: 31 c9 xor %ecx,%ecx
3bed: e9 e0 fe ff ff jmp 3ad2 <printf+0x52>
3bf2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
putc(fd, c);
3bf8: 88 55 e7 mov %dl,-0x19(%ebp)
write(fd, &c, 1);
3bfb: 83 ec 04 sub $0x4,%esp
3bfe: e9 2a ff ff ff jmp 3b2d <printf+0xad>
3c03: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3c07: 90 nop
s = "(null)";
3c08: ba 3e 55 00 00 mov $0x553e,%edx
while(*s != 0){
3c0d: 89 5d d4 mov %ebx,-0x2c(%ebp)
3c10: b8 28 00 00 00 mov $0x28,%eax
3c15: 89 d3 mov %edx,%ebx
3c17: e9 74 ff ff ff jmp 3b90 <printf+0x110>
3c1c: 66 90 xchg %ax,%ax
3c1e: 66 90 xchg %ax,%ax
00003c20 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
3c20: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
3c21: a1 80 a6 00 00 mov 0xa680,%eax
{
3c26: 89 e5 mov %esp,%ebp
3c28: 57 push %edi
3c29: 56 push %esi
3c2a: 53 push %ebx
3c2b: 8b 5d 08 mov 0x8(%ebp),%ebx
bp = (Header*)ap - 1;
3c2e: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
3c31: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3c38: 89 c2 mov %eax,%edx
3c3a: 8b 00 mov (%eax),%eax
3c3c: 39 ca cmp %ecx,%edx
3c3e: 73 30 jae 3c70 <free+0x50>
3c40: 39 c1 cmp %eax,%ecx
3c42: 72 04 jb 3c48 <free+0x28>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
3c44: 39 c2 cmp %eax,%edx
3c46: 72 f0 jb 3c38 <free+0x18>
break;
if(bp + bp->s.size == p->s.ptr){
3c48: 8b 73 fc mov -0x4(%ebx),%esi
3c4b: 8d 3c f1 lea (%ecx,%esi,8),%edi
3c4e: 39 f8 cmp %edi,%eax
3c50: 74 30 je 3c82 <free+0x62>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
3c52: 89 43 f8 mov %eax,-0x8(%ebx)
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
3c55: 8b 42 04 mov 0x4(%edx),%eax
3c58: 8d 34 c2 lea (%edx,%eax,8),%esi
3c5b: 39 f1 cmp %esi,%ecx
3c5d: 74 3a je 3c99 <free+0x79>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
3c5f: 89 0a mov %ecx,(%edx)
} else
p->s.ptr = bp;
freep = p;
}
3c61: 5b pop %ebx
freep = p;
3c62: 89 15 80 a6 00 00 mov %edx,0xa680
}
3c68: 5e pop %esi
3c69: 5f pop %edi
3c6a: 5d pop %ebp
3c6b: c3 ret
3c6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
3c70: 39 c2 cmp %eax,%edx
3c72: 72 c4 jb 3c38 <free+0x18>
3c74: 39 c1 cmp %eax,%ecx
3c76: 73 c0 jae 3c38 <free+0x18>
if(bp + bp->s.size == p->s.ptr){
3c78: 8b 73 fc mov -0x4(%ebx),%esi
3c7b: 8d 3c f1 lea (%ecx,%esi,8),%edi
3c7e: 39 f8 cmp %edi,%eax
3c80: 75 d0 jne 3c52 <free+0x32>
bp->s.size += p->s.ptr->s.size;
3c82: 03 70 04 add 0x4(%eax),%esi
3c85: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
3c88: 8b 02 mov (%edx),%eax
3c8a: 8b 00 mov (%eax),%eax
3c8c: 89 43 f8 mov %eax,-0x8(%ebx)
if(p + p->s.size == bp){
3c8f: 8b 42 04 mov 0x4(%edx),%eax
3c92: 8d 34 c2 lea (%edx,%eax,8),%esi
3c95: 39 f1 cmp %esi,%ecx
3c97: 75 c6 jne 3c5f <free+0x3f>
p->s.size += bp->s.size;
3c99: 03 43 fc add -0x4(%ebx),%eax
freep = p;
3c9c: 89 15 80 a6 00 00 mov %edx,0xa680
p->s.size += bp->s.size;
3ca2: 89 42 04 mov %eax,0x4(%edx)
p->s.ptr = bp->s.ptr;
3ca5: 8b 4b f8 mov -0x8(%ebx),%ecx
3ca8: 89 0a mov %ecx,(%edx)
}
3caa: 5b pop %ebx
3cab: 5e pop %esi
3cac: 5f pop %edi
3cad: 5d pop %ebp
3cae: c3 ret
3caf: 90 nop
00003cb0 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
3cb0: 55 push %ebp
3cb1: 89 e5 mov %esp,%ebp
3cb3: 57 push %edi
3cb4: 56 push %esi
3cb5: 53 push %ebx
3cb6: 83 ec 1c sub $0x1c,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
3cb9: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
3cbc: 8b 3d 80 a6 00 00 mov 0xa680,%edi
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
3cc2: 8d 70 07 lea 0x7(%eax),%esi
3cc5: c1 ee 03 shr $0x3,%esi
3cc8: 83 c6 01 add $0x1,%esi
if((prevp = freep) == 0){
3ccb: 85 ff test %edi,%edi
3ccd: 0f 84 9d 00 00 00 je 3d70 <malloc+0xc0>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
3cd3: 8b 17 mov (%edi),%edx
if(p->s.size >= nunits){
3cd5: 8b 4a 04 mov 0x4(%edx),%ecx
3cd8: 39 f1 cmp %esi,%ecx
3cda: 73 6a jae 3d46 <malloc+0x96>
3cdc: bb 00 10 00 00 mov $0x1000,%ebx
3ce1: 39 de cmp %ebx,%esi
3ce3: 0f 43 de cmovae %esi,%ebx
p = sbrk(nu * sizeof(Header));
3ce6: 8d 04 dd 00 00 00 00 lea 0x0(,%ebx,8),%eax
3ced: 89 45 e4 mov %eax,-0x1c(%ebp)
3cf0: eb 17 jmp 3d09 <malloc+0x59>
3cf2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
3cf8: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
3cfa: 8b 48 04 mov 0x4(%eax),%ecx
3cfd: 39 f1 cmp %esi,%ecx
3cff: 73 4f jae 3d50 <malloc+0xa0>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
3d01: 8b 3d 80 a6 00 00 mov 0xa680,%edi
3d07: 89 c2 mov %eax,%edx
3d09: 39 d7 cmp %edx,%edi
3d0b: 75 eb jne 3cf8 <malloc+0x48>
p = sbrk(nu * sizeof(Header));
3d0d: 83 ec 0c sub $0xc,%esp
3d10: ff 75 e4 push -0x1c(%ebp)
3d13: e8 63 fc ff ff call 397b <sbrk>
if(p == (char*)-1)
3d18: 83 c4 10 add $0x10,%esp
3d1b: 83 f8 ff cmp $0xffffffff,%eax
3d1e: 74 1c je 3d3c <malloc+0x8c>
hp->s.size = nu;
3d20: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
3d23: 83 ec 0c sub $0xc,%esp
3d26: 83 c0 08 add $0x8,%eax
3d29: 50 push %eax
3d2a: e8 f1 fe ff ff call 3c20 <free>
return freep;
3d2f: 8b 15 80 a6 00 00 mov 0xa680,%edx
if((p = morecore(nunits)) == 0)
3d35: 83 c4 10 add $0x10,%esp
3d38: 85 d2 test %edx,%edx
3d3a: 75 bc jne 3cf8 <malloc+0x48>
return 0;
}
}
3d3c: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
3d3f: 31 c0 xor %eax,%eax
}
3d41: 5b pop %ebx
3d42: 5e pop %esi
3d43: 5f pop %edi
3d44: 5d pop %ebp
3d45: c3 ret
if(p->s.size >= nunits){
3d46: 89 d0 mov %edx,%eax
3d48: 89 fa mov %edi,%edx
3d4a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(p->s.size == nunits)
3d50: 39 ce cmp %ecx,%esi
3d52: 74 4c je 3da0 <malloc+0xf0>
p->s.size -= nunits;
3d54: 29 f1 sub %esi,%ecx
3d56: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
3d59: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
3d5c: 89 70 04 mov %esi,0x4(%eax)
freep = prevp;
3d5f: 89 15 80 a6 00 00 mov %edx,0xa680
}
3d65: 8d 65 f4 lea -0xc(%ebp),%esp
return (void*)(p + 1);
3d68: 83 c0 08 add $0x8,%eax
}
3d6b: 5b pop %ebx
3d6c: 5e pop %esi
3d6d: 5f pop %edi
3d6e: 5d pop %ebp
3d6f: c3 ret
base.s.ptr = freep = prevp = &base;
3d70: c7 05 80 a6 00 00 84 movl $0xa684,0xa680
3d77: a6 00 00
base.s.size = 0;
3d7a: bf 84 a6 00 00 mov $0xa684,%edi
base.s.ptr = freep = prevp = &base;
3d7f: c7 05 84 a6 00 00 84 movl $0xa684,0xa684
3d86: a6 00 00
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
3d89: 89 fa mov %edi,%edx
base.s.size = 0;
3d8b: c7 05 88 a6 00 00 00 movl $0x0,0xa688
3d92: 00 00 00
if(p->s.size >= nunits){
3d95: e9 42 ff ff ff jmp 3cdc <malloc+0x2c>
3d9a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
prevp->s.ptr = p->s.ptr;
3da0: 8b 08 mov (%eax),%ecx
3da2: 89 0a mov %ecx,(%edx)
3da4: eb b9 jmp 3d5f <malloc+0xaf>
| 41.974756 | 240 | 0.430447 |
174e39137fc8b68ce6b11441af6ddfec1f96dca6 | 367 | asm | Assembly | programs/oeis/087/A087058.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/087/A087058.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/087/A087058.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A087058: Smallest square number greater than 2*n^2.
; 4,9,25,36,64,81,100,144,169,225,256,289,361,400,484,529,625,676,729,841,900,1024,1089,1156,1296,1369,1521,1600,1764,1849,1936,2116,2209,2401,2500,2601,2809,2916,3136,3249,3364,3600,3721,3969,4096,4356,4489
add $0,1
mov $1,2
mov $2,$0
mul $2,$0
mov $0,1
lpb $1,13
sub $2,$0
add $0,1
lpe
pow $0,$1
mov $1,$0
| 24.466667 | 207 | 0.692098 |
de207f0bc7f675bba7f965fe7ae31e5e97f8d9da | 663 | asm | Assembly | oeis/227/A227128.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/227/A227128.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/227/A227128.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A227128: The twisted Euler phi-function for the non-principal Dirichlet character mod 3.
; Submitted by Christian Krause
; 1,3,3,6,6,9,6,12,9,18,12,18,12,18,18,24,18,27,18,36,18,36,24,36,30,36,27,36,30,54,30,48,36,54,36,54,36,54,36,72,42,54,42,72,54,72,48,72,42,90,54,72,54,81,72,72,54,90,60,108,60,90,54,96
add $0,1
mov $1,1
lpb $0
mov $3,$0
lpb $3
mov $4,$0
mov $6,$2
cmp $6,0
add $2,$6
mod $4,$2
cmp $4,0
cmp $4,0
mov $5,$2
add $2,1
cmp $5,1
max $4,$5
sub $3,$4
lpe
mul $1,3
mov $5,1
lpb $0
dif $0,$2
mul $5,$2
lpe
dif $5,$2
mul $1,$5
add $2,1
div $2,3
mul $1,$2
lpe
mov $0,$1
| 18.416667 | 186 | 0.552036 |
46f6d8361920682a1d4cb36a610481f9309a1c3f | 478 | asm | Assembly | libsrc/_DEVELOPMENT/math/float/math48/z80/am48_dload.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/math/float/math48/z80/am48_dload.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/math/float/math48/z80/am48_dload.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
SECTION code_clib
SECTION code_fp_math48
PUBLIC am48_dload, am48_dloadb
am48_dload:
; load double from memory into AC'
;
; enter : hl = double *
;
; exit : AC'= double x (*hl)
; exx set becomes main set
;
; uses : af, bc, de, hl, bc', de', hl'
ld bc,5
add hl,bc
am48_dloadb:
ld b,(hl)
dec hl
ld c,(hl)
dec hl
ld d,(hl)
dec hl
ld e,(hl)
dec hl
ld a,(hl)
dec hl
ld l,(hl)
ld h,a
exx
ret
| 12.578947 | 42 | 0.531381 |
17ffc4a894d273125995e15ba1f2743d0ee5387c | 3,053 | asm | Assembly | vbox/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-first-pe16.asm | Nurzamal/rest_api_docker | a9cc01dfc235467d490d9663755b33ef6990bdd8 | [
"MIT"
] | null | null | null | vbox/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-first-pe16.asm | Nurzamal/rest_api_docker | a9cc01dfc235467d490d9663755b33ef6990bdd8 | [
"MIT"
] | null | null | null | vbox/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-first-pe16.asm | Nurzamal/rest_api_docker | a9cc01dfc235467d490d9663755b33ef6990bdd8 | [
"MIT"
] | null | null | null | ; $Id: bs3-first-pe16.asm 69111 2017-10-17 14:26:02Z vboxsync $
;; @file
; BS3Kit - First Object, calling 16-bit protected-mode main().
;
;
; Copyright (C) 2007-2017 Oracle Corporation
;
; This file is part of VirtualBox Open Source Edition (OSE), as
; available from http://www.virtualbox.org. This file is free software;
; you can redistribute it and/or modify it under the terms of the GNU
; General Public License (GPL) as published by the Free Software
; Foundation, in version 2 as it comes in the "COPYING" file of the
; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
;
; The contents of this file may alternatively be used under the terms
; of the Common Development and Distribution License Version 1.0
; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
; VirtualBox OSE distribution, in which case the provisions of the
; CDDL are applicable instead of those of the GPL.
;
; You may elect to license modified versions of this file under the
; terms and conditions of either the GPL or the CDDL or both.
;
;*********************************************************************************************************************************
;* Header Files *
;*********************************************************************************************************************************
;
; Segment defs, grouping and related variables.
; Defines the entry point 'start' as well, leaving us in BS3TEXT16.
;
%include "bs3-first-common.mac"
;*********************************************************************************************************************************
;* External Symbols *
;*********************************************************************************************************************************
BS3_BEGIN_DATA16
BS3_BEGIN_RMTEXT16
extern _Bs3CpuDetect_rm_far
extern _Bs3InitMemory_rm_far
BS3_BEGIN_TEXT16
BS3_EXTERN_CMN Bs3PicMaskAll
BS3_EXTERN_CMN Bs3Trap16Init
extern _Bs3SwitchToPE16_rm
extern _Main_pe16
BS3_EXTERN_CMN Bs3Shutdown
BS3_BEGIN_TEXT16
;
; Zero return address and zero caller BP.
;
xor ax, ax
push ax
push ax
mov bp, sp
;
; Load DS and ES with data selectors.
;
mov ax, BS3KIT_GRPNM_DATA16
mov ds, ax
mov es, ax
;
; Make sure interrupts are disabled as we cannot (don't want to) service
; BIOS interrupts once we switch mode.
;
cli
call Bs3PicMaskAll
;
; Initialize 16-bit protected mode.
;
call far _Bs3CpuDetect_rm_far
call far _Bs3InitMemory_rm_far
call Bs3Trap16Init
;
; Switch to PE16 and call main.
;
call _Bs3SwitchToPE16_rm
call _Main_pe16
; Try shutdown if it returns.
call Bs3Shutdown
| 31.802083 | 130 | 0.539142 |
aab08d6d9555c29da45598c5332ddf030bc0aa8a | 385 | asm | Assembly | programs/oeis/093/A093609.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/093/A093609.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/093/A093609.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A093609: Upper Beatty sequence for e^G, G = Euler's gamma constant.
; 2,5,8,11,13,16,19,22,25,27,30,33,36,38,41,44,47,50,52,55,58,61,63,66,69,72,75,77,80,83,86,88,91,94,97,100,102,105,108,111,114,116,119,122,125,127,130,133,136,139,141,144,147,150,152,155,158,161,164,166,169
mov $1,$0
mov $3,$0
mov $4,$0
div $0,8
sub $3,$0
div $3,4
sub $1,$3
add $1,2
mov $2,$4
mul $2,2
add $1,$2
| 25.666667 | 207 | 0.651948 |
67edf41b6483b5051e06f968f02e84a1a8caa280 | 13,342 | asm | Assembly | Appl/FileMgrs/CommonDesktop/CDeskDisplay/cdeskdisplayTool.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 504 | 2018-11-18T03:35:53.000Z | 2022-03-29T01:02:51.000Z | Appl/FileMgrs/CommonDesktop/CDeskDisplay/cdeskdisplayTool.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 96 | 2018-11-19T21:06:50.000Z | 2022-03-06T10:26:48.000Z | Appl/FileMgrs/CommonDesktop/CDeskDisplay/cdeskdisplayTool.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: deskdisplayTool.asm
AUTHOR: Adam de Boor, Jan 30, 1992
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
Adam 1/30/92 Initial revision
DESCRIPTION:
Implementation of DeskToolClass
$Id: cdeskdisplayTool.asm,v 1.2 98/06/03 13:23:54 joon Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PseudoResident segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeskToolPtr
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: provide feedback during direct-manipulation
CALLED BY: MSG_META_PTR
PASS: usual object stuff
ds:di = DeskTool instance data
es - segment of DeskToolClass
bp - UIFA flags
UIFA_IN - set mouse pointer if in bounds of this object
RETURN: ax = MouseReturnFlags
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 3/11/91 Initial version for 2.0 quick-transfer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeskToolPtr method DeskToolClass, MSG_META_PTR
add di, offset DT_flags ; ds:di = flags
mov bx, offset Callback_DeskToolPtr ; callback routine
mov ax, offset DeskToolClass
call ToolPtrCommon
ret
DeskToolPtr endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Callback_DeskToolPtr
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: callback for DeskToolPtr that determines the quick
transfer default for move/copy.
CALLED BY: ToopPtrCommon
PASS: *ds:si = DeskTool object
RETURN: ax = CQTF_MOVE, CQTF_COPY, CQTF_CLEAR
DESTROYED: ???
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
Desktools aren't used right now.
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 01/17/93 Added this header
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
Callback_DeskToolPtr proc near
class DeskToolClass
.enter
call CheckQuickTransferType ; is CIF_FILES supported?
mov ax, CQTF_CLEAR ; assume not
jc done ; no, just clear cursor
mov ax, CQTF_MOVE ; default to move
;
; Only the FileCabinet Wastebasket uses this class right now,
; if this class is used by anyone else they should put in the
; appropriate behavior.
;
done:
.leave
ret
Callback_DeskToolPtr endp
DeskToolLostGadgetExcl method DeskToolClass, MSG_VIS_LOST_GADGET_EXCL
add di, offset DT_flags
call ToolLostGadgetExclCommon
ret
DeskToolLostGadgetExcl endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ToolPtrCommon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: a common routine for handlers of MSG_META_PTR
CALLED BY: DriveToolPtr, DirToolPtr, DeskToolPtr
PASS: ds:*si = tool object
cx, dx, bp = data from MSG_META_PTR
ds:di = flags
bx = callback routine
es:ax = segment:offset of tool class
RETURN: ax = MouseReturnFlags
DESTROYED: ???
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 01/17/93 Added this header
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ToolPtrCommon proc near
push ax, cx, dx, bp ; save MSG_META_PTR data
test bp, mask UIFA_MOVE_COPY shl 8 ; quick-transfer in progress?
;don't need this anymore as we fake UIFA_MOVE_COPY at the app-obj
;- brianc 6/28/93
;if _ZMGR
; jnz qtInProgress
; test es:[fileDragging], mask FDF_MOVECOPY
;qtInProgress:
;endif
jz done ; nope
call ClipboardGetQuickTransferStatus ; quick-transfer in progress?
jz done ; nope
test bp, mask UIFA_IN shl 8 ; in bounds?
jnz inBounds ; yes, start feedback
call ToolLostGadgetExclCommon ; else, stop feedback
jmp short done
inBounds:
;
; grab mouse, if not already grabbed
;
test {DesktopToolFlags} ds:[di], mask DTF_FEEDBACK_ON
jnz setCursor ; already doing feedback
; (just ensure cursor)
call VisTakeGadgetExclAndGrab ; grab mouse
ornf {DesktopToolFlags} ds:[di], mask DTF_FEEDBACK_ON
setCursor:
call bx ; returns ax = cursor type
call ClipboardSetQuickTransferFeedback
done:
;
; call superclass to handle lower-level ptr operations
;
pop di, cx, dx, bp ; retrieve MSG_META_PTR data
; and class (es:di)
mov ax, MSG_META_PTR
call ObjCallSuperNoLock
; assume in bounds
mov ax, mask MRF_PROCESSED or mask MRF_CLEAR_POINTER_IMAGE
test bp, mask UIFA_IN shl 8 ; in bounds?
jnz exit ; yes
mov ax, mask MRF_REPLAY ; else, replay pointer event
exit:
ret
ToolPtrCommon endp
ToolLostGadgetExclCommon proc near
push ax
test {DesktopToolFlags} ds:[di], mask DTF_FEEDBACK_ON
jz done
andnf {DesktopToolFlags} ds:[di], not mask DTF_FEEDBACK_ON
call VisReleaseMouse
mov ax, CQTF_CLEAR
call ClipboardSetQuickTransferFeedback
done:
pop ax
ret
ToolLostGadgetExclCommon endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeskToolEndMoveCopy
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: handle direct-manipulation
CALLED BY: MSG_META_END_MOVE_COPY
PASS: usual object stuff
es - segment of DeskToolClass
bp - UIFA flags
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 12/18/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeskToolEndMoveCopy method DeskToolClass, MSG_META_END_MOVE_COPY
call DeskToolLostGadgetExcl ; release mouse, if needed
mov di, MSG_DESKTOOL_QT_INTERNAL
call ToolQuickTransfer
ret
DeskToolEndMoveCopy endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeskToolEndSelect
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: handle direct-manipulation for ZMGR
CALLED BY: MSG_META_END_SELECT
PASS: usual object stuff
es - segment of DeskToolClass
bp - UIFA flags
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 2/19/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _PEN_BASED
DeskToolEndSelect method DeskToolClass, MSG_META_END_SELECT
push es
NOFXIP< segmov es, dgroup, bx ; es = dgroup >
FXIP < GetResourceSegmentNS dgroup, es, TRASH_BX >
test es:[fileDragging], mask FDF_MOVECOPY
pop es
jz callSuper
call DeskToolLostGadgetExcl ; release mouse, if needed
mov di, MSG_DESKTOOL_QT_INTERNAL
call ToolQuickTransfer
ret
callSuper:
mov di, offset DeskToolClass
GOTO ObjCallSuperNoLock
DeskToolEndSelect endm
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ToolQuickTransfer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
CALLED BY: DeskToolEndMoveCopy,
DirToolEndMoveCopy,
DriveToolEndMoveCopy
PASS: di = internal QT method to send to Desktop thread
bp = UIFA flags from MSG_META_END_MOVE_COPY
es = segment of class
RETURN: none
DESTROYED: ???
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 1/26/93 Added this header
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ToolQuickTransfer proc near
.enter
;
; clear quick transfer flags
;
push es
NOFXIP< segmov es, dgroup, bx ; es = dgroup >
FXIP < GetResourceSegmentNS dgroup, es, TRASH_BX >
andnf es:[fileDragging], not (mask FDF_MOVECOPY or \
mask FDF_SELECT_MOVECOPY)
pop es
if _ZMGR
;
; if ZMGR, VisContent didn't do a ClipboardHandleEndMoveCopy
; because we faked it with a END_SELECT, so we need to do it
; ourselves
;
mov bx, -1 ; have active grab (us)
clc ; don't check quick-transfer status
call ClipboardHandleEndMoveCopy
endif
push bp ; save flags
mov bp, mask CIF_QUICK
call ClipboardQueryItem ; returns:
; cx:dx - owner of drag files
tst bp ; bp = count of formats
; (use results later)
pop bp ; retrieve flags
push bx, ax ; bx:ax - transfer item header
jz done ; no transfer item, done
;
; We don't have to worry about MANUFACTURER_ID_WIZARD, as the
; NewDesk doesn't use the "tools" i.e. tool buttons in the tool area.
;
mov cx, MANUFACTURER_ID_GEOWORKS
mov dx, CIF_FILES
push bp
call ClipboardRequestItemFormat ; get file list block (bx:ax)
pop bp ; and flags in cx:dx
tst ax ; does format exist?
jz done ; no, done
;
; copy file list
; bp = UIFA flags
;
mov dx, bp ; dx = UIFA flags
push di, es, ds, si ; save our instance
call VMLock ; ax = segment, bp = mem handle
mov bx, bp
mov ds, ax
mov ax, MGIT_SIZE
call MemGetInfo
push ax ; size
mov cx, ALLOC_DYNAMIC_LOCK or mask HF_SHARABLE
call MemAlloc
pop cx ; size
jc memError
mov es, ax
clr si, di
;
; Hack! Rely on the fact that MemGetInfo(MGIT_SIZE) always
; returns an even number
;
EC < test cx, 1 >
EC < ERROR_NZ DESKTOP_FATAL_ERROR >
shr cx
rep movsw ; copy file list
mov es:[FQTH_UIFA], dx ; save UIFA flags in file list
mov di, bx ; di = handle of copied block
call MemUnlock ; unlock it
clc ; indicate no error
errorExit:
call VMUnlock ; unlock original file list
pop ax, es, ds, dx ; retrieve instance (dx = si)
jc done ; if error, done
if GPC_DRAG_SOUND
call UtilDragSound
endif
;
; send file list to desktop thread so application has burden of
; expensive file operations
; send: cx:dx - this object
; di - handle of filelist block
; ax - internal method
;
mov cx, ds:[LMBH_handle] ; ^lcx:dx = our instance
mov bp, di ; bp = file list block handle
mov bx, handle 0 ; bx = desktop process
mov di, mask MF_FIXUP_DS
call ObjMessage
done:
pop bx, ax ; bx:ax = transfer item header
call ClipboardDoneWithItem ; tell UI we're done
;
; whatever the case, stop the UI part of the quick-transfer
;
; as we don't know whether a move or copy will be preformed, let's
; just say that the item was not accepted -- the ramification of this
; is just that no notification will be sent out to the owner;
; currently, only GeoManager generates CIF_FILES, and we don't need
; notification, so we let this slip
;
mov bp, mask CQNF_NO_OPERATION ; bp = ClipboardQuickNotifyFlags
call ClipboardEndQuickTransfer
mov ax, mask MRF_PROCESSED
.leave
ret
memError:
;
; send method to process to put up error box for us
;
mov cx, ERROR_INSUFFICIENT_MEMORY ; report error
mov ax, MSG_REMOTE_ERROR_BOX
mov bx, handle 0
call ObjMessageForce
stc ; indicate error reported
jmp errorExit
ToolQuickTransfer endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeskToolGetType
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: get tool type for this tool
CALLED BY: MSG_DESK_TOOL_GET_TYPE
PASS: usual object stuff
RETURN: dl - tool type
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 1/11/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeskToolGetType method dynamic DeskToolClass, MSG_DESK_TOOL_GET_TYPE
mov dl, ds:[di].DT_toolType ; get drive number
ret
DeskToolGetType endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeskToolActivate
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: handle activation via keyboard navigation
CALLED BY: MSG_GEN_ACTIVATE
PASS: usual object stuff
es - segment of DeskToolClass
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 1/30/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeskToolActivate method DeskToolClass, MSG_GEN_ACTIVATE
cmp ds:[di].DT_toolType, DESKTOOL_WASTEBASKET
jne done
;
; trash can activated, start delete (handily uses menu-delete code
; which asks before deleting when confirmation is off)
;
mov ax, MSG_FM_START_DELETE
mov bx, handle 0
mov di, mask MF_FIXUP_DS
call ObjMessage
done:
ret
DeskToolActivate endm
PseudoResident ends
| 25.078947 | 79 | 0.591216 |
a4859a62a2508dac57de7a1b88fbbe9ee5d02e80 | 270 | nasm | Assembly | OvmfPkg/XenBusDxe/X64/TestAndClearBit.nasm | christopherco/RPi-UEFI | 48fd8bb20dd4d45a4cf0a8970a65837e45bbaa99 | [
"BSD-2-Clause"
] | 93 | 2016-10-27T12:03:57.000Z | 2022-03-29T15:22:10.000Z | OvmfPkg/XenBusDxe/X64/TestAndClearBit.nasm | khezami/RPi-UEFI | 5bfd48d674e6c7efea6e31f9eb97b9da90c20263 | [
"BSD-2-Clause"
] | 16 | 2016-11-02T02:08:40.000Z | 2021-06-03T21:18:06.000Z | OvmfPkg/XenBusDxe/X64/TestAndClearBit.nasm | khezami/RPi-UEFI | 5bfd48d674e6c7efea6e31f9eb97b9da90c20263 | [
"BSD-2-Clause"
] | 41 | 2016-11-02T00:05:02.000Z | 2022-03-29T14:33:09.000Z | DEFAULT REL
SECTION .text
; INT32
; EFIAPI
; TestAndClearBit (
; IN INT32 Bit, // rcx
; IN volatile VOID* Address // rdx
; );
global ASM_PFX(TestAndClearBit)
ASM_PFX(TestAndClearBit):
lock btr [rdx], ecx
sbb eax, eax
ret
| 16.875 | 41 | 0.588889 |
b3c0a7576711f153234f18437aeb71c04f3bfae5 | 134 | asm | Assembly | libsrc/math/math48/ftoe.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/math/math48/ftoe.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/math/math48/ftoe.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
SECTION code_fp_math48
PUBLIC ftoe
EXTERN _ftoe_impl
; sccz80 points to the implementation
defc ftoe = _ftoe_impl
| 12.181818 | 37 | 0.716418 |
41afa3bc72a40158d1ca706d5cac0a5b990e1add | 92,736 | asm | Assembly | Library/SpecUI/CommonUI/CUtils/copenAppCommon.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 504 | 2018-11-18T03:35:53.000Z | 2022-03-29T01:02:51.000Z | Library/SpecUI/CommonUI/CUtils/copenAppCommon.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 96 | 2018-11-19T21:06:50.000Z | 2022-03-06T10:26:48.000Z | Library/SpecUI/CommonUI/CUtils/copenAppCommon.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 73 | 2018-11-19T20:46:53.000Z | 2022-03-29T00:59:26.000Z | COMMENT @----------------------------------------------------------------------
Copyright (c) GeoWorks 1994 -- All Rights Reserved
GEOWORKS CONFIDENTIAL
PROJECT: GEOS
MODULE: OpenLook/Open
FILE: copenAppCommon.asm
ROUTINES:
Name Description
---- -----------
GLB OLApplicationClass Open look Application class
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 10/10/94 Broken out of copenApplication.asm
DESCRIPTION:
$Id: copenAppCommon.asm,v 1.2 98/03/13 16:12:12 joon Exp $
------------------------------------------------------------------------------@
AppCommon segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLApplicationExpressMenuChange
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Take note of the creation of an express menu to add a trigger
for ourselves in GEOS tasks list.
CALLED BY: MSG_NOTIFY_EXPRESS_MENU_CHANGE
PASS: bp = GCNExpressMenuNotificationType
^lcx:dx = optr of affected Express Menu Control
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 11/11/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLApplicationExpressMenuChange method dynamic OLApplicationClass,
MSG_NOTIFY_EXPRESS_MENU_CHANGE
uses ax, cx, dx, bp, si
.enter
cmp bp, GCNEMNT_CREATED
jne destroy
;
; New express menu created, so create a GEOS tasks list item
; ^lcx:dx = new ExpressMenuControl
;
mov ax, si ; *ds:ax = OLApplication
call GenFindParent ; ^lbx:si = parent field
xchgdw bxsi, cxdx ; ^lcx:dx = parent field
; ^lbx:si = new ExpressMenuControl
sub sp, size CreateExpressMenuControlItemParams
mov bp, sp
mov ss:[bp].CEMCIP_feature, CEMCIF_GEOS_TASKS_LIST
mov ss:[bp].CEMCIP_class.segment, segment OLAppTaskItemClass
mov ss:[bp].CEMCIP_class.offset, offset OLAppTaskItemClass
mov ss:[bp].CEMCIP_itemPriority, CEMCIP_STANDARD_PRIORITY
mov ss:[bp].CEMCIP_responseMessage, MSG_OL_APPLICATION_GEOS_TASKS_LIST_ITEM_CREATED
; send response back here
mov ss:[bp].CEMCIP_responseDestination.chunk, ax
mov ax, ds:[LMBH_handle]
mov ss:[bp].CEMCIP_responseDestination.handle, ax
mov ss:[bp].CEMCIP_field.handle, cx
mov ss:[bp].CEMCIP_field.chunk, dx
mov ax, MSG_EXPRESS_MENU_CONTROL_CREATE_ITEM
mov dx, size CreateExpressMenuControlItemParams
mov di, mask MF_STACK or mask MF_FIXUP_DS
call ObjMessage
add sp, size CreateExpressMenuControlItemParams
callSuper:
.leave
mov di, offset OLApplicationClass
GOTO ObjCallSuperNoLock
destroy:
mov si, ds:[di].OLAI_appMenuItems
tst si
jz noDestroy
mov bx, cs
mov di, offset OLAEMC_callback
call ChunkArrayEnum
noDestroy:
jmp callSuper
OLApplicationExpressMenuChange endm
;
; pass: *ds:si = chunk array
; ds:di = CreateExpressMenuControlItemResponseParams
; ^lcx:dx = destroyed Express Menu Control
; return: carry clear to continue enumeration if no match
; carry set to stop enumeration if match
;
OLAEMC_callback proc far
cmp cx, ds:[di].CEMCIRP_expressMenuControl.handle
jne notFound
cmp dx, ds:[di].CEMCIRP_expressMenuControl.chunk
jne notFound
pushdw cxdx
movdw bxax, ds:[di].CEMCIRP_expressMenuControl
movdw cxdx, ds:[di].CEMCIRP_newItem
call ChunkArrayDelete
mov si, ax ; ^lbx:si = EMC
mov ax, MSG_EXPRESS_MENU_CONTROL_DESTROY_CREATED_ITEM
mov bp, VUM_NOW
mov di, mask MF_FIXUP_DS
call ObjMessage
popdw cxdx
stc ; stop enumeration
jmp short done
notFound:
clc ; continue enumeration
done:
ret
OLAEMC_callback endp
COMMENT @----------------------------------------------------------------------
METHOD: OLAppSendToFlow
DESCRIPTION: Can't use default VisContent behavior just yet, so relay
this onto the flow object (a transition step)
PASS: *ds:si - instance data
es - segment of VisContentClass
ax - METHOD to pass on
cx, dx, bp - data to pass on
RETURN: nothing
DESTROYED: ax, bx, cx, dx, bp, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 5/91 Initial version
------------------------------------------------------------------------------@
OLAppSendToFlow method dynamic OLApplicationClass,
MSG_VIS_VUP_TERMINATE_ACTIVE_MOUSE_FUNCTION, \
MSG_VIS_VUP_GET_MOUSE_STATUS, \
MSG_VIS_VUP_BUMP_MOUSE
mov di, mask MF_CALL
GOTO UserCallFlow
OLAppSendToFlow endm
COMMENT @----------------------------------------------------------------------
FUNCTION: OLApplicationUpdateTaskEntry
DESCRIPTION: Update this application's GenItem which is in the
ApplicationMenu.
PASS: ds:*si - instance data
cx = TRUE if application has focus
RETURN: nothing
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 1/90 initial version
------------------------------------------------------------------------------@
OLApplicationUpdateTaskEntry method dynamic OLApplicationClass, \
MSG_OL_APP_UPDATE_TASK_ENTRY
;
; Find the TaskItem we created earlier, that's on the Express menu
;
mov dx, si ; *ds:dx = OLApplication
mov di, ds:[si]
add di, ds:[di].Vis_offset
mov si, ds:[di].OLAI_appMenuItems
tst si
jz done ;skip if none...
; Get parent window in bp
; (needed for MSG_OL_APP_ITEM_SET_OPERATING_PARAMS)
;
mov bp, ds:[di].OLAI_fieldWin
mov_tr ax, cx ; ax = TRUE if application has focus
mov cx, ds:[LMBH_handle] ; app obj in ^lcx:dx,
; Setup each OLAppTaskItem object to have the info it will need to
; function correctly.
; ax = TRUE if application has focus
; ^lcx:dx = OLApplication object
; bp = field win
; *ds:si = chunk array of
; CreateExpressMenuControlItemResponseParams
;
mov bx, cs ; bx:si = callback routine
mov di, offset OLAUTE_callback
call ChunkArrayEnum
done:
ret
OLApplicationUpdateTaskEntry endm
;
; pass: *ds:si = chunk array
; ds:di = CreateExpressMenuControlItemResponseParams
; ax = TRUE if application has focus
; ^lcx:dx = OLApplication object
; bp = field window
; return:
; carry clear to continue enumeration
;
OLAUTE_callback proc far
uses ax, cx, dx, bp
.enter
; ^lbx:si = new item (may be run by
; different thread!)
movdw bxsi, ds:[di].CEMCIRP_newItem
push ax ; save flag
mov ax, MSG_OL_APP_TASK_ITEM_SET_OPERATING_PARAMS
mov di, mask MF_FIXUP_DS ;no MF_CALL
call ObjMessage
pop cx
;
; if we are setting a selection, make sure the set selection message
; gets process after any clear selection messages
; cx = TRUE if app has focus
;
mov di, mask MF_FORCE_QUEUE or \
mask MF_INSERT_AT_FRONT or \
mask MF_FIXUP_DS
jcxz haveMF
mov di, mask MF_FORCE_QUEUE or mask MF_FIXUP_DS
haveMF:
mov ax, MSG_OL_APP_TASK_ITEM_SET_EXCLUSIVE
call ObjMessage
done:
clc
.leave
ret
OLAUTE_callback endp
COMMENT @----------------------------------------------------------------------
METHOD: OLApplicationGetMeasurementType --
MSG_GEN_APPLICATION_GET_MEASUREMENT_TYPE for OLApplicationClass
DESCRIPTION: Return the application's measurement type
PASS:
*ds:si - instance data
es - segment of OLApplicationClass
ax - The method
RETURN:
al - MeasurementType (either metric or US)
ah - AppMeasurementType (in application)
cx, dx, bp - same
DESTROYED:
bx, si, di, ds, es (method handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 5/90 Initial version
------------------------------------------------------------------------------@
OLApplicationGetMeasurementType method dynamic OLApplicationClass,
MSG_GEN_APPLICATION_GET_MEASUREMENT_TYPE
uses cx, dx, bp
.enter
mov al, ds:[di].OLAI_units
mov ah, al
cmp al, AMT_DEFAULT
jnz noMapping
; Get default units from localization driver
push ax ;save application measurement
call LocalGetMeasurementType ;returns measurement type in al
pop cx ;restore app measurement in ch
mov ah, ch ;put in ah
noMapping:
.leave
ret
OLApplicationGetMeasurementType endm
AppCommon ends
AppCommon segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLAppVisUpwardQuery
DESCRIPTION: Respond to a query traveling up the generic composite tree
PASS:
*ds:si - instance data
es - segment of OLApplicationClass
ax - MSG_VIS_VUP_QUERY
cx - Query type (VisQueryType or SpecVisQueryType)
dx -?
bp -?
RETURN:
carry - set if query acknowledged, clear if not
ax, cx, dx, bp - data if query acknowledged
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 5/91 Initial version
------------------------------------------------------------------------------@
OLAppVisUpwardQuery method dynamic OLApplicationClass, MSG_VIS_VUP_QUERY
; Send ALL visual upward queries to parent, the field, to avoid
; default vis behavior of return info based on this object instead
; of field/screen
;
GOTO VisCallParent
OLAppVisUpwardQuery endp
COMMENT @----------------------------------------------------------------------
METHOD: OLApplicationQupQueryVisParent -- MSG_SPEC_GUP_QUERY_VIS_PARENT
for OLApplicationClass
DESCRIPTION: Respond to a query traveling up the generic composite tree.
PASS:
*ds:si - instance data
es - segment of OLApplicationClass
ax - MSG_SPEC_GUP_QUERY_VIS_PARENT
cx - GenQueryType (Defined in genClass.asm)
SQT_VIS_PARENT_FOR_FIELD
SQT_VIS_PARENT_FOR_APPLICATION
SQT_VIS_PARENT_FOR_PRIMARY
SQT_VIS_PARENT_FOR_DISPLAY
SQT_VIS_PARENT_FOR_POPUP
SQT_VIS_PARENT_FOR_URGENT
SQT_VIS_PARENT_FOR_SYS_MODAL
RETURN:
carry - set if query acknowledged, clear if not
cx:dx - obj descriptor of visual parent to use, null if not acknowledged
bp - window handle to use
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
VIS_PARENT_FOR_PRIMARY -> This object, field window
VIS_PARENT_FOR_DISPLAY -> This object, field window
VIS_PARENT_FOR_POPUP -> This object, field window
VIS_PARENT_FOR_URGENT -> This object, field window
VIS_PARENT_FOR_SYS_MODAL -> This object, screen window
All others: pass on to superclass
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 2/89 Initial version
Doug 5/91 Changed to return THIS object, now IsoContent
------------------------------------------------------------------------------@
OLApplicationGupQueryVisParent method dynamic OLApplicationClass, \
MSG_SPEC_GUP_QUERY_VIS_PARENT
;
; See if we can handle query
;
cmp cx, SQT_VIS_PARENT_FOR_PRIMARY
je thisObject
cmp cx, SQT_VIS_PARENT_FOR_DISPLAY
je thisObject
cmp cx, SQT_VIS_PARENT_FOR_POPUP
je thisObject
cmp cx, SQT_VIS_PARENT_FOR_URGENT
je thisObject
cmp cx, SQT_VIS_PARENT_FOR_SYS_MODAL
jne askParent
sysModalExcl:
; For sys modal case, return this object's OD to be the visible parent,
; but the screen window for a parent window.
;
mov cx, ds:[LMBH_handle]
mov dx, si
mov bp, ds:[di].OLAI_screenWin
stc ; return query acknowledged
ret
askParent:
; If we don't know the answer, pass on...
;
mov di, offset OLApplicationClass
CallSuper MSG_SPEC_GUP_QUERY_VIS_PARENT
jc exit ; something ultimately found, exit
clr cx, dx ; else return cx:dx = null
jmp short exit
thisObject:
; Return THIS object for visible parent
mov cx, ds:[LMBH_handle]
mov dx, si
call VisQueryWindow ; If a window handle exists for this
; application, return it in bp
mov bp, di
stc ; return query acknowledged
exit:
ret
OLApplicationGupQueryVisParent endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLApplicationGupQuery
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Answer a generic query or two, specifically the
SGQT_BUILD_INFO query so that dialog boxes under the app
object don't try & put buttons on the field.
CALLED BY: MSG_SPEC_GUP_QUERY
PASS: *ds:si = instance data
cx = query type (GenQueryType or SpecGenQueryType)
bp = OLBuildFlags
RETURN: carry = set if acknowledged, clear if not
bp = OLBuildFlags
cx:dx = vis parent
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
doug 1/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLApplicationGupQuery method dynamic OLApplicationClass, MSG_SPEC_GUP_QUERY
cmp cx, SGQT_BUILD_INFO ;fieldable?
je answer
mov di, offset OLApplicationClass ;Pass the buck to our superclass
GOTO ObjCallSuperNoLock
answer:
clr cx, dx ; Respond with NO visible parent.
; Dlg boxes, etc. under the application
; object should NOT have buttons
; appearing anywhere.
EC < test bp, mask OLBF_REPLY >
EC < ERROR_NZ OL_BUILD_FLAGS_MULTIPLE_REPLIES >
ORNF bp, OLBR_TOP_MENU shl offset OLBF_REPLY
stc
ret
OLApplicationGupQuery endm
COMMENT @----------------------------------------------------------------------
FUNCTION: OLApplicationGenGupEnsureUpdateWindow
DESCRIPTION: Handle window update.
PASS:
*ds:si - instance data (offset through Vis_offset)
cx - UpdateWindowFlags
dl - VisUpdateMode
RETURN:
carry set to stop gup (stops at GenApplication object)
cx, dl - unchanged
ax, dh, bp - destroyed
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 6/11/92 Initial version
------------------------------------------------------------------------------@
OLApplicationGenGupEnsureUpdateWindow method OLApplicationClass,
MSG_GEN_GUP_ENSURE_UPDATE_WINDOW
stc ; stop gup
Destroy ax, dh, bp
ret
OLApplicationGenGupEnsureUpdateWindow endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLApplicationEnterLeave
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Handle reciept of the various enter/leave messages generated
by the window system, & relayed to us. Send them on to the
object owning the window.
PASS: *ds:si - instance data
ds:di - ptr to start of master instance data
es - segment of class
ax - MSG_META_RAW_UNIV_ENTER, MSG_META_RAW_UNIV_LEAVE
cx:dx - InputOD of window
bp - handle of window
RETURN: nothing
ALLOWED TO DESTROY:
bx, si, di, ds, es
PSEUDO CODE/STRATEGY/KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
doug 3/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLApplicationEnterLeave method dynamic OLApplicationClass,
MSG_META_RAW_UNIV_ENTER,
MSG_META_RAW_UNIV_LEAVE
movdw bxsi, cxdx
clr di
call ObjMessage ; send message on...
ret
OLApplicationEnterLeave endm
COMMENT @----------------------------------------------------------------------
METHOD: OLApplicationImpliedWinChange
DESCRIPTION: Handles notification that the implied window, or window that
the mouse is in, when interacting with this application,
has changed.
PASS:
*ds:si - instance data
es - segment of FlowClass
ax - MSG_META_IMPLIED_WIN_CHANGE
cx:dx - Input OD of implied window, or 0 if no window has the
implied grab.
bp - window that ptr is in
RETURN:
carry - ?
ax - ?
cx - ?
dx - ?
bp - ?
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 9/89 Initial version
------------------------------------------------------------------------------@
OLApplicationImpliedWinChange method dynamic OLApplicationClass,
MSG_META_IMPLIED_WIN_CHANGE
; Save away full Implied Win info
;
mov ds:[di].OLAI_impliedWin.MG_OD.handle, cx
mov ds:[di].OLAI_impliedWin.MG_OD.chunk, dx
mov ds:[di].OLAI_impliedWin.MG_gWin, bp
call OLAppUpdateImpliedWin ; update VCNI_impliedMouseGrab
call OLAppUpdatePtrImage ; & update the ptr image
ret
OLApplicationImpliedWinChange endm
COMMENT @----------------------------------------------------------------------
METHOD: OLAppNotifyActiveMouseGrabWinChanged
DESCRIPTION: Intercept change of active grab window here.
Inform window system, so that it will present the correct ptr
image for us.
PASS: *ds:si - instance data
es - segment of VisContentClass
ax - MSG_VIS_CONTENT_NOTIFY_ACTIVE_MOUSE_GRAB_WIN_CHANGED
RETURN: nothing
ax, cx, dx, bp - destroyed
DESTROYED: bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 4/92 Initial version
------------------------------------------------------------------------------@
OLAppNotifyActiveMouseGrabWinChanged method OLApplicationClass,
MSG_VIS_CONTENT_NOTIFY_ACTIVE_MOUSE_GRAB_WIN_CHANGED
; Update geode w/new active window
;
mov di, ds:[di].VCNI_activeMouseGrab.VMG_gWin
mov bx, ds:[LMBH_handle]
call MemOwner
call WinGeodeSetActiveWin
; If mouse grab suddenly released, update PIL_LAYER ptr image
;
tst di
jnz done
call OLAppUpdatePtrImage
done:
ret
OLAppNotifyActiveMouseGrabWinChanged endm
COMMENT @----------------------------------------------------------------------
METHOD: OLApplicationEnsureActiveFT
DESCRIPTION: Checks to make sure that something within the app has the
Focus & Target exclusives. Called from within the UI,
usually on the closure of a window, to give the Focus and/or
Target to the next best location. Click-to-type model
is implemented using the following rules:
For Target, the priority order is:
1) Anything already having the exclusive
2) Top targetable PRIO_STD priority level window
3) Top targetable PRIO_COMMAND priority level window
For Focus, priority goes to:
1) Anything already having the exclusive
2) Top system modal window
3) Top application modal window
4) Last non-modal window to have or request the
exclusive
5) Window having Target exclusive
6) Top focusable PRIO_STD priority level window
7) Top focusable PRIO_COMMAND priority level window
Note that this message just tires to make sure that something
DOES have the focus & target. It does not go out of its
way to forcibly change these exclusives to any particular
location. Thus, it is still the responsibility of windows
to request the exclusives when they are due them, generally
when being initiated to the front of the screen.
CALLED BY AS OF 2/22/92:
OLApplicationGainedFocusExcl, method OLApplicationClass, \
MSG_META_GAINED_FOCUS_EXCL
OLBaseWinDismiss, method OLBaseWinClass, MSG_GEN_DISMISS_INTERACTION
OpenWinLowerToBottom, method OLWinClass, MSG_GEN_LOWER_TO_BOTTOM
OLDialogWinGenApply, method OLDialogClass, MSG_GEN_APPLY
OLMenuedWinGenSetNotMinimized, method OLMenuedWinClass, \
MSG_GEN_SET_NOT_MINIMIZED
OLPopupDismiss
OLDialogWinInteractionCommand, method OLDialogWinClass, \
MSG_GEN_GUP_INTERACTION_COMMAND
OLPopupInteractionCommand, method OLPopupWinClass, \
MSG_GEN_GUP_INTERACTION_COMMAND
PASS:
*ds:si - instance data
es - segment of OLApplicationClass
ax - MSG_META_ENSURE_ACTIVE_FT
RETURN:
Nothing
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
Does NOT yet check to make sure that windows are focusable or
targetable -- if they aren't it will just go ahead & ask them
to do it anyway (which they won't), but then won't move on to find
the next window that will...
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 3/90 Initial version
------------------------------------------------------------------------------@
OLApplicationEnsureActiveFT method dynamic OLApplicationClass, \
MSG_META_ENSURE_ACTIVE_FT
;
; TARGET
;
; Make sure we've got a target window. If not, give target
; win exclusive to top-most primary window
;
; 1) Anything already having the exclusive
cmp ds:[di].VCNI_targetExcl.FTVMC_OD.handle, 0
jnz targetDone
; 2) Top targetable PRIO_STD priority level window
mov cl, WIN_PRIO_STD
call AppFindTopWinOfPriority
tst cx
jnz giveTarget
; 3) Top targetable PRIO_COMMAND priority level window
mov cl, WIN_PRIO_COMMAND
call AppFindTopWinOfPriority
jcxz targetDone
giveTarget:
mov ax, MSG_META_GRAB_TARGET_EXCL
call ObjMessageCallPreserveCXDXWithSelf
targetDone:
; FOCUS
;
; If not the active application, then don't bother looking for a
; focus window; no one will get the focus anyone, & no one will
; even be curious about it. Skip to choose a target however, which
; won't scan windows if there is already a target -- some apps
; may query to find the target within the app, so this might prove
; useful. This optimization is somewhat of a hack, as we're really
; just trying to avoid loading in all of Welcome's resources when
; the Express menu goes away (damn, non-conforming window has Welcome
; as it's parent, & this method gets sent there) This is a relatively
; easy fix for a problem that appears to have no nasty side effects
; other than loading in resources.
;
mov di, ds:[si]
add di, ds:[di].Vis_offset
test ds:[di].OLAI_flowFlags, mask AFF_FOCUS_APP
jz focusDone
; 1) Anything already having the exclusive
tst ds:[di].VCNI_focusExcl.FTVMC_OD.handle
jnz focusDone
; 2) Top system modal window
; 3) Top application modal window
mov cx, ds:[di].OLAI_modalWin.handle
mov dx, ds:[di].OLAI_modalWin.chunk
tst cx
jnz giveFocus
; 4) Last non-modal window to have or request the
; exclusive
mov cx, ds:[di].OLAI_nonModalFocus.handle
mov dx, ds:[di].OLAI_nonModalFocus.chunk
tst cx
jnz giveFocus
; 5) Window having Target exclusive
mov cx, ds:[di].VCNI_targetExcl.FTVMC_OD.handle
mov dx, ds:[di].VCNI_targetExcl.FTVMC_OD.chunk
tst cx
jnz giveFocus
; 6) Top focusable PRIO_STD priority level window
mov cl, WIN_PRIO_STD
call AppFindTopWinOfPriority
tst cx
jnz giveFocus
; 7) Top focusable PRIO_COMMAND priority level window
mov cl, WIN_PRIO_COMMAND
call AppFindTopWinOfPriority
jcxz focusDone
giveFocus:
; Ask window to grab the focus exclusive for itself.
;
mov ax, MSG_META_GRAB_FOCUS_EXCL
call ObjMessageCallPreserveCXDXWithSelf
focusDone:
call OLAppUpdateFocusActivity ; Update focusExcl data
; (If ignore input mode,
; keep kbd data from flowing)
call OLAppUpdateImpliedWin ; update VCNI_impliedMouseGrab
call OLAppUpdatePtrImage ; & update the ptr image
call OLAppUpdateFlowHoldUpState ; Update hold-up state
;
; not needed yet - brianc 1/26/93
; turned on for Express Menu focus problems - brianc 2/23/93
;
if 1
;
; check to see if something has the focus
;
mov di, ds:[si]
add di, ds:[di].Vis_offset
tst ds:[di].VCNI_focusExcl.FTVMC_OD.handle
jnz afterFocusCheck
;
; if not, send notification to ourselves (note that we force queue
; this, so handlers should check if a focus hasn't been established
; in the meanwhile)
;
mov ax, MSG_META_NOTIFY_NO_FOCUS_WITHIN_NODE
mov bx, ds:[LMBH_handle]
mov di, mask MF_FORCE_QUEUE
call ObjMessage
afterFocusCheck:
endif
ret
OLApplicationEnsureActiveFT endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLApplicationNotifyModalChange
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Notification that the modal status of the application has
changed in some way, either becoming modal, or becoming
non-modal, or simply a change in which window is modal.
PASS: *ds:si - instance data
ds:di - ptr to start of master instance data
es - segment of class
ax - MSG_GEN_APPLICATION_NOTIFY_MODAL_CHANGE
RETURN: nothing
ALLOWED TO DESTROY:
bx, si, di, ds, es
PSEUDO CODE/STRATEGY/KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
doug 3/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLApplicationNotifyModalChange method dynamic OLApplicationClass, \
MSG_GEN_APPLICATION_NOTIFY_MODAL_WIN_CHANGE
; Test to see which window, if any, is the new top system modal or
; modal window
;
call AppFindTopSysModalWin ; First check for a system modal window
tst cx
jnz haveAnswer
mov cl, WIN_PRIO_MODAL ; Look for MODAL priority windows
call AppFindTopWinOfPriority ; Then check for an app-modal window
haveAnswer:
; Store result of test
;
mov di, ds:[si]
add di, ds:[di].Vis_offset
mov ds:[di].OLAI_modalWin.handle, cx
mov ds:[di].OLAI_modalWin.chunk, dx
; If no modal window, clear AFF_OVERRIDE_INPUT_RESTRICTIONS flag.
; Otherwise, ask the window itself whether it wants to override
; input restrictions.
;
andnf ds:[di].OLAI_flowFlags, \
not mask AFF_OVERRIDE_INPUT_RESTRICTIONS
jcxz afterInputRestrictionsFlagSet
push si
movdw bxsi, cxdx
mov ax, MSG_GEN_INTERACTION_TEST_INPUT_RESTRICTABILITY
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; returns carry set to override
pop si ; input restrictions
jnc afterInputRestrictionsFlagSet
mov di, ds:[si]
add di, ds:[di].Vis_offset
ornf ds:[di].OLAI_flowFlags, \
mask AFF_OVERRIDE_INPUT_RESTRICTIONS
afterInputRestrictionsFlagSet:
call OLAppUpdateFocusActivity ; Update focusExcl data
; (If ignore input mode,
; keep kbd data from flowing)
call OLAppUpdateFlowHoldUpState ; Update hold-up state
call OLAppUpdateImpliedWin ; update VCNI_impliedMouseGrab
call OLAppUpdatePtrImage
call SendOutModalChangeNotification ; In case there are interested
; parties....
ret
OLApplicationNotifyModalChange endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SendOutModalChangeNotification
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Sends MSG_META_NOTIFY(GWNT_MODAL_WIN_CHANGE) to the
GAGCNLT_MODAL_WIN_CHANGE list of the app object.
CALLED BY: OLApplicationNotifyModalChange
PASS: *ds:si - GenApplication object
RETURN:
DESTROYED: ax, bx, cx ,dx, bp, di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 12/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SendOutModalChangeNotification proc near
;
; *ds:si - GenApplication object
;
mov ax, MSG_META_NOTIFY
mov cx, MANUFACTURER_ID_GEOWORKS
mov dx, GWNT_MODAL_WIN_CHANGE
mov di, mask MF_RECORD
call ObjMessage
clr ax
push ax ; GCNLMP_flags
push di ; GCNLMP_event
push ax ; GCNLMP_block
mov ax, GAGCNLT_MODAL_WIN_CHANGE
push ax ; GCNLT_type
mov ax, MANUFACTURER_ID_GEOWORKS
push ax ; GCNLT_manuf
mov dx, size GCNListMessageParams
mov bp, sp
mov ax, MSG_META_GCN_LIST_SEND
call ObjCallInstanceNoLock
add sp, size GCNListMessageParams
;
; Force all windows to redraw.
;
mov ax, MSG_META_NOTIFY
mov cx, MANUFACTURER_ID_GEOWORKS
mov dx, GWNT_MODAL_WIN_CHANGE
mov di, mask MF_RECORD
call ObjMessage
clr ax
push ax ; GCNLMP_flags
push di ; GCNLMP_event
push ax ; GCNLMP_block
mov ax, GAGCNLT_WINDOWS
push ax ; GCNLT_type
mov ax, MANUFACTURER_ID_GEOWORKS
push ax ; GCNLT_manuf
mov dx, size GCNListMessageParams
mov bp, sp
mov ax, MSG_META_GCN_LIST_SEND
call ObjCallInstanceNoLock
add sp, size GCNListMessageParams
ret
SendOutModalChangeNotification endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLApplicationGetModalWin
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Returns current modal window, if any. Used for printing,
where one of the criteria of whether we're done or not
is whether there's still a modal window up that the user
hasn't responded to yet.
PASS: *ds:si - instance data
ds:di - ptr to start of master instance data
es - segment of class
ax - MSG_GEN_APPLICATION_GET_MODAL_WIN
nothing
RETURN: ^lcx:dx - top modal window, if any
ALLOWED TO DESTROY:
bx, si, di, ds, es
PSEUDO CODE/STRATEGY/KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
doug 12/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLApplicationGetModalWin method dynamic OLApplicationClass, \
MSG_GEN_APPLICATION_GET_MODAL_WIN
mov cx, ds:[di].OLAI_modalWin.handle
mov dx, ds:[di].OLAI_modalWin.chunk
ret
OLApplicationGetModalWin endm
COMMENT @----------------------------------------------------------------------
FUNCTION: AppFindTopSysModalWin
DESCRIPTION: Looks through all windows on screen for sys modal window
of this application
CALLED BY: INTERNAL
PASS: *ds:si - app object
RETURN: cx:dx - set to InputOD of first sys modal window which is
up on screen, which could take modal exclusive,
else 0:0
bp - handle of window, else 0
DESTROYED: nothing
WARNING: This routine MAY resize the LMem block, moving it on the
heap and invalidating stored segment pointers and current
register or stored offsets to it.
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 3/90 Initial version
------------------------------------------------------------------------------@
AppFindTopSysModalWin proc far
uses ax, bx, di
.enter
;
; Look on screen window
;
mov di, ds:[si]
add di, ds:[di].Vis_offset
mov di, ds:[di].OLAI_screenWin
;
; Check only windows owned by same geode as app object
;
mov bx, ds:[LMBH_handle]
call MemOwner
mov_tr ax, bx
clr bx ; any LayerID OK
; restrict to sys modal windows
mov cx, (LAYER_PRIO_MODAL shl offset WPD_LAYER) or WIN_PRIO_MODAL
; no focusable/targetable restrictions
if FIND_HIGHER_LAYER_PRIORITY
call FindHigherLayerPriorityWinOnWin
else
call FindWinOnWin
endif
.leave
ret
AppFindTopSysModalWin endp
COMMENT @----------------------------------------------------------------------
FUNCTION: AppFindTopWinOfPriority
DESCRIPTION: Looks through all windows within the field having this
application's layerID for a modal window
CALLED BY: INTERNAL
PASS: *ds:si - app object
cl - Window Priority level to look for
RETURN: cx:dx - set to InputOD of first app modal window which is
up on screen, which could take modal exclusive,
else 0:0
bp - handle of window, else 0
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 3/90 Initial version
------------------------------------------------------------------------------@
AppFindTopWinOfPriority proc far
uses ax, bx, si, di
.enter
;
; Fetch di = window handle of field
;
mov di, ds:[si]
add di, ds:[di].Vis_offset
mov di, ds:[di].VCI_window
if not _DUI
clr ax ; All of this LayerID will be owned
; by owner of this app obj, so no need
; to check owner.
endif
mov bx, ds:[LMBH_handle] ; Get LayerID = geode handle
call MemOwner
if _DUI
;
; for _DUI, floating keyboard shares LayerID of app, so we must check
; owner
;
mov ax, bx
endif
clr ch ; no focusable/targetable restrictions
if FIND_HIGHER_LAYER_PRIORITY
call FindHigherLayerPriorityWinOnWin
else
call FindWinOnWin
endif
.leave
ret
AppFindTopWinOfPriority endp
COMMENT @----------------------------------------------------------------------
METHOD: OLAppTaskItemSetOperatingParams
DESCRIPTION: Init OLAppTaskItem
PASS:
*ds:si - instance data
es - segment of class
ax - MSG_OL_APP_TASK_ITEM_SET_OPERATING_PARAMS
cx:dx - app object
bp - field window
RETURN:
carry - ?
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 6/92 Initial version
------------------------------------------------------------------------------@
; NOTE! This is *not* a handler for OLApplicationClass, but rather
; OLAppTaskItem.
;
OLAppTaskItemSetOperatingParams method dynamic OLAppTaskItemClass, \
MSG_OL_APP_TASK_ITEM_SET_OPERATING_PARAMS
mov ds:[di].OLATI_appObj.handle, cx
mov ds:[di].OLATI_appObj.chunk, dx
mov ds:[di].OLATI_parentWin, bp
ret
OLAppTaskItemSetOperatingParams endm
COMMENT @----------------------------------------------------------------------
METHOD: OLAppTaskItemSetMoniker
DESCRIPTION: Set moniker for OLAppTaskItem
PASS:
*ds:si - instance data
es - segment of class
ax - MSG_OL_APP_TASK_ITEM_SET_MONIKER
^hcx - block containing text vis moniker
(freed afterwards)
RETURN:
carry - ?
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 11/12/92 Initial version
------------------------------------------------------------------------------@
; NOTE! This is *not* a handler for OLApplicationClass, but rather
; OLAppTaskItem.
;
OLAppTaskItemSetMoniker method dynamic OLAppTaskItemClass, \
MSG_OL_APP_TASK_ITEM_SET_MONIKER
mov bx, cx ; bx = block handle
push bx
call MemLock
mov cx, ax ; cx:dx = text moniker
mov dx, offset VM_data + offset VMT_text
mov ax, MSG_GEN_REPLACE_VIS_MONIKER_TEXT
mov bp, VUM_NOW
call ObjCallInstanceNoLock
pop bx
call MemFree
ret
OLAppTaskItemSetMoniker endm
COMMENT @----------------------------------------------------------------------
METHOD: OLAppTaskItemSetExclusive
DESCRIPTION: Set exclusive in parent of OLAppTaskItem
PASS:
*ds:si - instance data
es - segment of class
ax - MSG_OL_APP_TASK_ITEM_SET_EXCLUSIVE
cx - TRUE to set exclusive
RETURN:
carry - ?
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 11/12/92 Initial version
------------------------------------------------------------------------------@
; NOTE! This is *not* a handler for OLApplicationClass, but rather
; OLAppTaskItem.
;
OLAppTaskItemSetExclusive method dynamic OLAppTaskItemClass, \
MSG_OL_APP_TASK_ITEM_SET_EXCLUSIVE
;gained or lost?
; jcxz updateGenList ;skip if lost target...
;let's try doing nothing if lost-target, as something else should gain-target
;- brianc 1/26/93
jcxz done
mov ax, MSG_GEN_ITEM_GET_IDENTIFIER
call ObjCallInstanceNoLock ;identifier in ax
mov cx, ax
updateGenList:
clr dx
push bx, si
mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION
mov bx, segment GenItemGroupClass
mov si, offset GenItemGroupClass
mov di, mask MF_RECORD
call ObjMessage
mov cx, di ;ClassedEvent to cx
pop bx, si ;^lbx:si is ListEntry
; Send MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION to parent of
; GenListEntry.
;
mov dx, TO_GEN_PARENT
mov ax, MSG_META_SEND_CLASSED_EVENT
call ObjCallInstanceNoLock
done:
ret
OLAppTaskItemSetExclusive endm
COMMENT @----------------------------------------------------------------------
METHOD: OLAppTaskItemNotifyTaskSelected
DESCRIPTION: Default handling for user "Switch to Task" request on this
application, generally a result of user selecting this app
from the Express menu
PASS:
*ds:si - instance data
es - segment of class
ax - MSG_META_NOTIFY_TASK_SELECTED
cx, dx, bp - ?
RETURN:
carry - ?
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 10/91 Initial version
------------------------------------------------------------------------------@
; NOTE! This is *not* a handler for OLApplicationClass, but rather
; OLAppTaskItem.
;
OLAppTaskItemNotifyTaskSelected method dynamic OLAppTaskItemClass, \
MSG_META_NOTIFY_TASK_SELECTED
push ds:[di].OLATI_appObj.handle
push ds:[di].OLATI_appObj.chunk
; Raise app to top within field
;
mov bx, ds:[di].OLATI_appObj.handle
call MemOwner ; Get owning geode
mov cx, bx
mov dx, bx ; which is also LayerID to raise
mov bp, ds:[di].OLATI_parentWin
mov ax, MSG_GEN_SYSTEM_BRING_GEODE_TO_TOP
call UserCallSystem
; Then pass on notification to the app object
;
pop si
pop bx
mov ax, MSG_META_NOTIFY_TASK_SELECTED
mov di, mask MF_FORCE_QUEUE
GOTO ObjMessage
done:
ret
OLAppTaskItemNotifyTaskSelected endm
COMMENT @----------------------------------------------------------------------
METHOD: OLApplicationNotifyTaskSelected
DESCRIPTION: Default handling for user "Switch to Task" request on this
application, generally a result of user selecting this app
from the Express menu
PASS:
*ds:si - instance data
es - segment of class
ax - MSG_META_NOTIFY_TASK_SELECTED
cx, dx, bp - ?
RETURN:
carry - ?
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 10/91 Initial version
------------------------------------------------------------------------------@
OLApplicationNotifyTaskSelected method dynamic OLApplicationClass, \
MSG_META_NOTIFY_TASK_SELECTED
; If detaching, not a good idea.
;
mov di, ds:[si]
add di, ds:[di].Gen_offset
test ds:[di].GAI_states, mask AS_DETACHING or \
mask AS_NOT_USER_INTERACTABLE
jnz done
push si
mov bx, segment GenPrimaryClass
mov si, offset GenPrimaryClass
mov ax, MSG_GEN_DISPLAY_SET_NOT_MINIMIZED
mov dl, VUM_NOW
mov di, mask MF_RECORD
call ObjMessage ; di = event
mov cx, di ; cx = event
pop si
mov ax, MSG_GEN_SEND_TO_CHILDREN
call ObjCallInstanceNoLock
; If this is a transparent-detach mode Desk Accessory, bring back
; to the top layer.
;
call OLAppRaiseLayerPrioIfDeskAccessory
; This is done for us by the OLAppTaskItem, for synchronization purposes (the
; raising happens on the same thread as the notification of the selection of
; the task item, so if we're slow in responding to the selection, and the user
; chooses some other app from the express menu, we don't suddenly appear on top
; from out of nowhere)
; mov ax, MSG_GEN_BRING_TO_TOP
; call ObjCallInstanceNoLock
; Make sure field is on top as well, as if app is in a different
; field than currently active, it will still not be able to
; be interacted with without this step.
;
; (This screws up things in RedMotif. I don't know how removing it
; will affect things, though. 10/25/93 cbh)
;
mov ax, MSG_GEN_BRING_TO_TOP
GOTO GenCallParent
done:
ret
OLApplicationNotifyTaskSelected endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLAppRaiseLayerPrioIfDeskAccessory
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: If this is a desk accessory, raise its layer priority to
ON_TOP. Does not affect focus/target, which must be dealt
with seperately
CALLED BY: INTERNAL
PASS: *ds:si - GenApplication
RETURN: nothing
DESTROYED: ax, cx, dx, di, bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 4/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLAppRaiseLayerPrioIfDeskAccessory proc far
uses bx
.enter
;
; If running as a desk accessory, raise layer priority to ON_TOP,
; & bring windows up if present. This is necessary both on startup
; & if coming back to top after having being "Closed" by a user in
; transparent launch mode, where we're really just pushed to the
; back in a standard layer until called up again or transparently
; detached.
;
mov di, ds:[si]
add di, ds:[di].Gen_offset
test ds:[di].GAI_launchFlags, mask ALF_DESK_ACCESSORY
jz done
; Set custom layer priority attribute so that future windows
; will come up in the right layer. Save to state so that we come
; back in correct layer if shutdown, restored.
;
mov ax, ATTR_GEN_WINDOW_CUSTOM_LAYER_PRIORITY or \
mask VDF_SAVE_TO_STATE
mov cx, size LayerPriority
call ObjVarAddData
mov {byte} ds:[bx], LAYER_PRIO_ON_TOP
; Bring any opened windows back up to the top, w/new layer priority.
call VisQueryWindow ; Get window stored in app object,
; which is really the field.
tst di
jz done
mov ax, mask WPF_LAYER or (LAYER_PRIO_ON_TOP shl offset WPD_LAYER)
mov bx, ds:[LMBH_handle] ; LayerID is owning geode handle
call MemOwner
mov dx, bx
call WinChangePriority ; Pop-her back to top.
done:
.leave
ret
OLAppRaiseLayerPrioIfDeskAccessory endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLAppLowerLayerPrioIfDeskAccessory
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: If this is a desk accessory, lower its layer priority to STD.
Does not deal with focus/target changes, which must be dealt
with seperately.
CALLED BY: INTERNAL
PASS: *ds:si - GenApplication
RETURN: nothing
DESTROYED: ax, cx, dx, di, bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 4/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLAppLowerLayerPrioIfDeskAccessory proc far
uses bx
.enter
;
; If a desk accessory, drop layer priority to STD. This is useful
; in transparent launch mode to get the app to go back to being
; behind normal apps instead of actually "closing" it. This has
; the effect of adding it to the the app cache, where it can be
; transparently detached or brought quickly back up.
;
mov di, ds:[si]
add di, ds:[di].Gen_offset
test ds:[di].GAI_launchFlags, mask ALF_DESK_ACCESSORY
jz done
; Change layer priority attribute to LAYER_PRIO_STD, so that future
; windows come up in the standard layer. We don't nuke the attribute,
; which would do the same thing, because we want a record if we actually
; saved to state (as opposed to being transparently detached, where
; this attribute is nuked) that we were being "app-cached", so we
; can come back that way.
;
mov ax, ATTR_GEN_WINDOW_CUSTOM_LAYER_PRIORITY or \
mask VDF_SAVE_TO_STATE
mov cx, size LayerPriority
call ObjVarAddData
mov {byte} ds:[bx], LAYER_PRIO_STD
; Push any opened windows to the bottom
call VisQueryWindow ; Get window stored in app object,
; which is really the field.
tst di
jz done
mov ax, mask WPF_LAYER or (LAYER_PRIO_STD shl offset WPD_LAYER)
mov bx, ds:[LMBH_handle] ; LayerID is owning geode handle
call MemOwner
mov dx, bx
call WinChangePriority ; Pop-her back to top.
done:
.leave
ret
OLAppLowerLayerPrioIfDeskAccessory endp
COMMENT @----------------------------------------------------------------------
METHOD: OLApplicationBringToTop
DESCRIPTION: Brings whole application to the top.
PASS:
*ds:si - instance data
es - segment of MetaClass
ax - MSG_GEN_BRING_TO_TOP
cx, dx, bp - ?
RETURN:
carry - ?
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 1/90 Initial version
kho 1/24/96 Add indicator check for rudy
------------------------------------------------------------------------------@
OLApplicationBringToTop method dynamic OLApplicationClass, \
MSG_GEN_BRING_TO_TOP
mov ax, MSG_GEN_SYSTEM_BRING_GEODE_TO_TOP
FALL_THRU OLAppRaiseLowerCommon
OLApplicationBringToTop endp
OLAppRaiseLowerCommon proc far
push ax ; save method to call on sys obj
mov bp, ds:[di].OLAI_fieldWin
mov bx, ds:[LMBH_handle]
call MemOwner
mov cx, bx ; geode
mov dx, bx ; & LayerID (geode handle)
pop ax
call UserCallSystem
ret
OLAppRaiseLowerCommon endp
COMMENT @----------------------------------------------------------------------
METHOD: OLApplicationLowerToBottom
DESCRIPTION: Brings whole application to the bottom, relinquishing focus,
& passing it on to next app on top
PASS:
*ds:si - instance data
es - segment of MetaClass
ax - MSG_GEN_LOWER_TO_BOTTOM
cx, dx, bp - ?
RETURN:
carry - ?
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 4/90 Initial version
------------------------------------------------------------------------------@
OLApplicationLowerToBottom method dynamic OLApplicationClass,
MSG_GEN_LOWER_TO_BOTTOM
;
; specify that we wish to stay in same layer (DA or normal app),
; if possible
;
mov bx, ds:[LMBH_handle]
call MemOwner ; bx = geode
call WinGeodeGetParentObj ; ^lcx:dx = parent obj
mov ax, LAYER_PRIO_STD shl offset WPD_LAYER ; assume not DA
mov di, ds:[si]
add di, ds:[di].Gen_offset
test ds:[di].GAI_launchFlags, mask ALF_DESK_ACCESSORY
jz havePref
mov ax, LAYER_PRIO_ON_TOP shl offset WPD_LAYER ; else, DA
havePref:
push si ; save OLApp chunk
sub sp, size EnsureActiveFTPriorityPreferenceData
mov bp, sp ; ss:bp = EAFTPPD
mov ss:[bp].EAFTPPD_priority, ax
mov ax, ds:[LMBH_handle] ; ^lax:si = OLApp handle
mov ss:[bp].EAFTPPD_avoidOptr.handle, ax
mov ss:[bp].EAFTPPD_avoidOptr.chunk, si
movdw bxsi, cxdx ; ^lbx:si = parent obj
mov ax, bp ; ss:ax = EAFTPPD
mov dx, size AddVarDataParams
sub sp, dx
mov bp, sp
mov ss:[bp].AVDP_data.segment, ss
mov ss:[bp].AVDP_data.offset, ax
mov ss:[bp].AVDP_dataSize, size EnsureActiveFTPriorityPreferenceData
mov ss:[bp].AVDP_dataType, \
TEMP_META_ENSURE_ACTIVE_FT_LAYER_PRIORITY_PREFERENCE
mov ax, MSG_META_ADD_VAR_DATA
mov di, mask MF_CALL or mask MF_FIXUP_DS or mask MF_STACK
call ObjMessage
; free params and LayerPrio
add sp, size AddVarDataParams + size EnsureActiveFTPriorityPreferenceData
pop si ; *ds:si = OLApp
mov di, ds:[si]
add di, ds:[di].Vis_offset ; set ds:di = vis instance
; for OLAppRaiseLowerCommon
mov ax, MSG_GEN_SYSTEM_LOWER_GEODE_TO_BOTTOM
call OLAppRaiseLowerCommon
;
; move ourselves to the end of our parent GenField's
; GFI_genApplication list
;
push si
mov cx, ds:[LMBH_handle]
mov dx, si
mov bx, segment GenFieldClass
mov si, offset GenFieldClass
mov bp, CCO_LAST ; move to end
mov ax, MSG_GEN_FIELD_MOVE_GEN_APPLICATION
mov di, mask MF_RECORD
call ObjMessage ; ^hdi = event
pop si
mov cx, di ; ^hcx = event
mov ax, MSG_GEN_GUP_CALL_OBJECT_OF_CLASS
call ObjCallInstanceNoLock
ret
OLApplicationLowerToBottom endm
COMMENT @----------------------------------------------------------------------
METHOD: OLApplicationCheckBeforeGrabbing
DESCRIPTION: Check to make sure application has a right to be grabbing
exclusives from the field before going ahead & doing so.
PASS:
*ds:si - instance data
es - segment of OLApplicationClass
ax - MSG_META_GRAB_FOCUS_EXCL,
MSG_META_GRAB_TARGET_EXCL,
MSG_META_GRAB_MODEL_EXCL
cx, dx, bp - data to pass onto superclass if function can continue
RETURN:
DESTROYED:
ax, bx, cx, dx, bp, di
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 9/91 Initial version
------------------------------------------------------------------------------@
OLApplicationCheckBeforeGrabbing method OLApplicationClass, \
MSG_META_GRAB_FOCUS_EXCL,
MSG_META_GRAB_TARGET_EXCL,
MSG_META_GRAB_MODEL_EXCL
; If detaching, not a good idea
;
mov di, ds:[si]
add di, ds:[di].Gen_offset
test ds:[di].GAI_states, mask AS_DETACHING or \
mask AS_NOT_USER_INTERACTABLE
jnz done
mov di, offset OLApplicationClass
GOTO ObjCallSuperNoLock
done:
ret
OLApplicationCheckBeforeGrabbing endm
COMMENT @----------------------------------------------------------------------
METHOD: OLApplicationGainedFocusExcl
DESCRIPTION: Notification that we have gained the focus
exclusive. We should let the object within this
level that last had the exclusive have it again.
PASS: *ds:si - instance data
es - segment of OLApplicationClass
ax - MSG_META_GAINED_FOCUS_EXCL
RETURN: nothing
ax, cx, dx, bp - destroyed
DESTROYED: bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 11/89 Initial version
------------------------------------------------------------------------------@
OLApplicationGainedFocusExcl method OLApplicationClass, \
MSG_META_GAINED_FOCUS_EXCL
ornf ds:[di].OLAI_flowFlags, mask AFF_FOCUS_APP
call OLAppUpdateFocusActivity ; Update focusExcl data
;
; If no window has been recognized as being on top yet, give it
; to the top primary window.
;
mov ax, MSG_META_ENSURE_ACTIVE_FT
call ObjCallInstanceNoLock
;
; move ourselves to the front of our parent GenField's
; GFI_genApplication list
;
push si
mov cx, ds:[LMBH_handle]
mov dx, si
mov bx, segment GenFieldClass
mov si, offset GenFieldClass
mov bp, CCO_FIRST ; move to front
mov ax, MSG_GEN_FIELD_MOVE_GEN_APPLICATION
mov di, mask MF_RECORD
call ObjMessage ; ^hdi = event
pop si
mov cx, di ; ^hcx = event
mov ax, MSG_GEN_GUP_CALL_OBJECT_OF_CLASS
call ObjCallInstanceNoLock
ret
OLApplicationGainedFocusExcl endm
COMMENT @----------------------------------------------------------------------
METHOD: OLApplicationLostFocusExcl -- MSG_META_LOST_FOCUS_EXCL
DESCRIPTION: Take away focus exclusive from any object which has it.
(But remember which one it was, so that we can give it
back again later)
PASS:
*ds:si - instance data
es - segment of MetaClass
ax - MSG_META_LOST_FOCUS_EXCL
RETURN:
ax, cx, dx, bp - destroyed
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 6/89 Initial version
------------------------------------------------------------------------------@
OLApplicationLostFocusExcl method OLApplicationClass, \
MSG_META_LOST_FOCUS_EXCL
; Clear flag - no longer active app
andnf ds:[di].OLAI_flowFlags, not mask AFF_FOCUS_APP
FALL_THRU OLAppUpdateFocusActivity ; Update focusExcl data
OLApplicationLostFocusExcl endm
COMMENT @----------------------------------------------------------------------
FUNCTION: OLAppUpdateFocusActivity
DESCRIPTION: Let focusExcl be active or force to be not active, based
on such criteria as whiether app is active application, whether
there is a focus window up, and whether or not the app
is in an ignore input mode.
CALLED BY: INTERNAL
PASS: *ds:si - OLApplicationInstance
RETURN:
Nothing
DESTROYED:
ax, bx, cx, dx, di, bp
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 7/90 Initial version
------------------------------------------------------------------------------@
OLAppUpdateFocusActivity proc far
mov di, ds:[si]
add di, ds:[di].Vis_offset
; If app isn't active, then can't
; have focus just yet
test ds:[di].OLAI_flowFlags, mask AFF_FOCUS_APP
jz disallowFocusWin
; If overriding input restrictions, allow focus. Otherwise check
; ignore input flag
;
test ds:[di].OLAI_flowFlags, \
mask AFF_OVERRIDE_INPUT_RESTRICTIONS
jnz allowFocusWin
; If ignoring input, then disallow kbd data
;
tst ds:[di].OLAI_ignoreInputCount
jnz disallowFocusWin
allowFocusWin:
; If already has exclusive, then done.
test ds:[di].VCNI_focusExcl.FTVMC_flags, mask HGF_SYS_EXCL
jnz done
mov ax, MSG_META_GAINED_SYS_FOCUS_EXCL
jmp short flowUpdateExclCommon
disallowFocusWin:
; If already doesn't have exclusive,
; then done.
test ds:[di].VCNI_focusExcl.FTVMC_flags, mask HGF_SYS_EXCL
jz done
mov ax, MSG_META_LOST_SYS_FOCUS_EXCL
flowUpdateExclCommon:
mov bp, MSG_META_GAINED_FOCUS_EXCL ; pass base message
mov bx, offset Vis_offset
mov di, offset VCNI_focusExcl
GOTO FlowUpdateHierarchicalGrab
done:
ret
OLAppUpdateFocusActivity endp
COMMENT @----------------------------------------------------------------------
METHOD: OLAppConsumeMessage
DESCRIPTION: Consume the event so that the superclass will NOT provide
default handling for it.
PASS: *ds:si - instance data
es - segment of OLAppClass
ax - message to eat
RETURN: nothing
ax, cx, dx, bp - destroyed
DESTROYED: bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 10/91 Initial version
------------------------------------------------------------------------------@
OLAppConsumeMessage method OLApplicationClass,
MSG_META_FORCE_GRAB_KBD,
MSG_VIS_FORCE_GRAB_LARGE_MOUSE,
MSG_VIS_FORCE_GRAB_MOUSE,
MSG_META_GRAB_KBD,
MSG_VIS_GRAB_LARGE_MOUSE,
MSG_VIS_GRAB_MOUSE,
MSG_META_RELEASE_KBD,
MSG_VIS_RELEASE_MOUSE
ret
OLAppConsumeMessage endm
COMMENT @----------------------------------------------------------------------
METHOD: OLApplicationUpdateTargetExcl
DESCRIPTION: Convert gained/lost target to gained/lost system messages, but
otherwise provide default target node behavior.
PASS: *ds:si - instance data
es - segment of OLApplicationClass
ax - MSG_META_GAINED_TARGET_EXCL
RETURN: nothing
ax, cx, dx, bp - destroyed
DESTROYED: bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 11/89 Initial version
------------------------------------------------------------------------------@
OLApplicationUpdateTargetExcl method OLApplicationClass, \
MSG_META_GAINED_TARGET_EXCL,
MSG_META_LOST_TARGET_EXCL
add ax, MSG_META_GAINED_SYS_TARGET_EXCL-MSG_META_GAINED_TARGET_EXCL
mov bp, MSG_META_GAINED_TARGET_EXCL ; pass base message
mov bx, offset Vis_offset
mov di, offset VCNI_targetExcl
GOTO FlowUpdateHierarchicalGrab
OLApplicationUpdateTargetExcl endm
COMMENT @----------------------------------------------------------------------
METHOD: OLApplicationUpdateModelExcl
DESCRIPTION: Convert gained/lost model to gained/lost system messages, but
otherwise provide default model node behavior.
PASS: *ds:si - instance data
es - segment of OLApplicationClass
ax - MSG_[GAINED/LOST]_MODEL_EXCL
RETURN: nothing
ax, cx, dx, bp - destroyed
DESTROYED: bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 9/91 Initial version
------------------------------------------------------------------------------@
OLApplicationUpdateModelExcl method OLApplicationClass, \
MSG_META_GAINED_MODEL_EXCL,
MSG_META_LOST_MODEL_EXCL
add ax, MSG_META_GAINED_SYS_MODEL_EXCL-MSG_META_GAINED_MODEL_EXCL
mov bp, MSG_META_GAINED_MODEL_EXCL ; pass base message
mov bx, offset Vis_offset
mov di, offset OLAI_modelExcl
GOTO FlowUpdateHierarchicalGrab
OLApplicationUpdateModelExcl endm
COMMENT @----------------------------------------------------------------------
METHOD: OLApplicationAlterFTVMCExcl
DESCRIPTION: Allows object to grab/release any of the FTVMC exlusives.
PASS: *ds:si - instance data
ds:di - SpecInstance
es - segment of class
ax - MSG_META_MUP_ALTER_FTVMC_EXCL
^lcx:dx - object requesting grab/release
bp - MetaAlterFTVMCExclFlags
RETURN: nothing
DESTROYED: bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 9/25/91 Initial version
------------------------------------------------------------------------------@
OLApplicationAlterFTVMCExcl method OLApplicationClass, \
MSG_META_MUP_ALTER_FTVMC_EXCL
; If app itself is wishing to alter exclusive, call super to send
; request on up.
;
test bp, mask MAEF_NOT_HERE
jnz toField
EC < test bp, mask MAEF_FULL_SCREEN >
EC < ERROR_NZ OL_ERROR_FULL_SCREEN_EXCL_NOT_LEGAL_BELOW_APP_OBJ >
EC < call ECCheckODCXDX >
next:
; If no requests for operations left, exit
;
test bp, MAEF_MASK_OF_ALL_HIERARCHIES
jz done
; Check FIRST for focus, while ds:di still points to instance data
;
test bp, mask MAEF_FOCUS
jz afterFocus
mov ax, di
add ax, offset OLAI_nonModalFocus ; ds:ax is nonModalFocus
tst ds:[di].OLAI_modalWin.handle ; set non-zero if in modal state
mov bx, offset Vis_offset ; bx is master offset,
mov di, offset VCNI_focusExcl ; di is offset, to focusExcl
call AlterFExclWithNonModalCacheCommon
jmp short next
afterFocus:
; Check for other requests we can handle
;
mov ax, MSG_META_GAINED_TARGET_EXCL
mov bx, mask MAEF_TARGET
mov di, offset VCNI_targetExcl
test bp, bx
jnz doHierarchy
mov ax, MSG_META_GAINED_MODEL_EXCL
mov bx, mask MAEF_MODEL
mov di, offset OLAI_modelExcl
test bp, bx
jnz doHierarchy
toField:
and bp, not mask MAEF_NOT_HERE
mov ax, MSG_META_MUP_ALTER_FTVMC_EXCL
GOTO GenCallParent
doHierarchy:
push bx, bp
and bp, mask MAEF_GRAB
or bp, bx ; or back in hierarchy flag
mov bx, offset Vis_offset
call FlowAlterHierarchicalGrab
pop bx, bp
not bx ; get not mask for hierarchy
and bp, bx ; clear request on this hierarchy
jmp short next
done:
Destroy ax, cx, dx, bp
ret
OLApplicationAlterFTVMCExcl endm
AppCommon ends
AppCommon segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLApplicationSendClassedEvent
DESCRIPTION: Sends message to target object at level requested
Focus, Target, View, Model & Controller requests are all
passed on to the current field.
PASS:
*ds:si - instance data
es - segment of OLApplicationClass
ax - MSG_META_SEND_CLASSED_EVENT
cx - handle of classed event
dx - TargetObject
RETURN:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 9/91 Initial version
------------------------------------------------------------------------------@
OLApplicationSendClassedEvent method OLApplicationClass, \
MSG_META_SEND_CLASSED_EVENT
mov bp, di ; save offset to master part
mov di, offset VCNI_focusExcl
cmp dx, TO_FOCUS
je sendHere
mov di, offset VCNI_targetExcl
cmp dx, TO_TARGET
je sendHere
mov di, offset OLAI_modelExcl
cmp dx, TO_MODEL
je sendHere
mov di, offset OLApplicationClass
CallSuper MSG_META_SEND_CLASSED_EVENT
ret
sendHere:
add di, bp ; Get ptrs to instance data
add bx, bp
mov bx, ds:[di].BG_OD.handle
mov bp, ds:[di].BG_OD.chunk
clr di
GOTO FlowDispatchSendOnOrDestroyClassedEvent
OLApplicationSendClassedEvent endm
AppCommon ends
AppCommon segment resource
COMMENT @----------------------------------------------------------------------
METHOD:
MSG_GEN_APPLICATION_MARK_BUSY - OLAppMarkBusy
MSG_GEN_APPLICATION_MARK_NOT_BUSY - OLAppMarkNotBusy
MSG_GEN_APPLICATION_HOLD_UP_INPUT - OLAppHoldUpBusy
MSG_GEN_APPLICATION_RESUME_INPUT - OLAppResumeBusy
MSG_GEN_APPLICATION_IGNORE_INPUT - OLAppIgnoreBusy
MSG_GEN_APPLICATION_ACCEPT_INPUT - OLAppAcceptBusy
DESCRIPTION: These routines handle the inc'ing & dec'ing of variables
for determining whether the application should be marked as busy,
should hold up UI processing, or should discard UI processing.
PASS:
*ds:si - instance data
es - segment of OlApplicationClass
ax - MSG_?
cx, dx, bp - ?
RETURN:
carry - ?
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 8/89 Initial version
------------------------------------------------------------------------------@
OLAppMarkBusy method dynamic OLApplicationClass, MSG_GEN_APPLICATION_MARK_BUSY
inc ds:[di].OLAI_busyCount ; Inc busy count
EC < ERROR_Z OL_BUSY_COUNT_OVERFLOW >
if DISABLE_APO_ON_BUSY
call SysDisableAPO
endif
if ANIMATED_BUSY_CURSOR
cmp ds:[di].OLAI_busyCount, 1
jne noTimer
push di
mov al, TIMER_EVENT_CONTINUAL
mov bx, ds:[LMBH_handle]
mov cx, 0
mov dx, MSG_OL_APP_UPDATE_PTR_IMAGE
mov di, 60/NUM_BUSY_CURSOR_FRAMES ; every 1/x second
call TimerStart
pop di
xchg bx, ds:[di].OLAI_busyTimer
xchg ax, ds:[di].OLAI_busyTimerID
tst bx
jz noTimer
call TimerStop
noTimer:
endif
GOTO OLAppUpdatePtrImage
OLAppMarkBusy endp
OLAppMarkNotBusy method dynamic OLApplicationClass, \
MSG_GEN_APPLICATION_MARK_NOT_BUSY
dec ds:[di].OLAI_busyCount ; Dec busy count
EC < ERROR_S OL_BUSY_COUNT_UNDERFLOW >
if DISABLE_APO_ON_BUSY
call SysEnableAPO
endif
if ANIMATED_BUSY_CURSOR
tst ds:[di].OLAI_busyCount
jnz noTimer
clr bx
xchg bx, ds:[di].OLAI_busyTimer
mov ax, ds:[di].OLAI_busyTimerID
call TimerStop
noTimer:
endif
GOTO OLAppUpdatePtrImage
OLAppMarkNotBusy endp
OLAppHoldUpInput method dynamic OLApplicationClass, \
MSG_GEN_APPLICATION_HOLD_UP_INPUT
inc ds:[di].OLAI_holdUpInputCount
EC < ERROR_Z OL_HOLD_UP_INPUT_COUNT_OVERFLOW >
call OLAppUpdateFlowHoldUpState ; Update hold-up state
GOTO OLAppUpdatePtrImage
OLAppHoldUpInput endp
OLAppResumeInput method dynamic OLApplicationClass, \
MSG_GEN_APPLICATION_RESUME_INPUT
dec ds:[di].OLAI_holdUpInputCount
EC < ERROR_S OL_HOLD_UP_INPUT_COUNT_UNDERFLOW >
call OLAppUpdateFlowHoldUpState ; Update hold-up state
GOTO OLAppUpdatePtrImage
OLAppResumeInput endp
OLAppIgnoreInput method dynamic OLApplicationClass, \
MSG_GEN_APPLICATION_IGNORE_INPUT
inc ds:[di].OLAI_ignoreInputCount
EC < ERROR_Z OL_IGNORE_INPUT_COUNT_OVERFLOW >
call OLAppUpdateFocusActivity ; Make sure app is allowing/
; disallowing focus as is
; appropriate.
call OLAppUpdateImpliedWin ; update VCNI_impliedMouseGrab
GOTO OLAppUpdatePtrImage
OLAppIgnoreInput endp
OLAppAcceptInput method dynamic OLApplicationClass, \
MSG_GEN_APPLICATION_ACCEPT_INPUT
dec ds:[di].OLAI_ignoreInputCount
EC < ERROR_S OL_IGNORE_INPUT_COUNT_UNDERFLOW >
jnz done ; if hasn't reached zero yet, no
; action needs to be taken
call OLAppUpdateFocusActivity ; Make sure app is allowing/
; disallowing focus as is
; appropriate.
call OLAppUpdateImpliedWin ; update VCNI_impliedMouseGrab
GOTO OLAppUpdatePtrImage ; fix up ptr image.
done:
ret
OLAppAcceptInput endp
COMMENT @----------------------------------------------------------------------
METHOD: OLAppMarkCompletelyBusy
METHOD: OLAppMarkAppNotCompletely
DESCRIPTION: These routines handle the inc'ing & dec'ing of variables
for determining whether the application should be marked as busy,
should hold up UI processing, or should discard UI processing.
PASS:
*ds:si - instance data
es - segment of OlApplicationClass
ax - MSG_GEN_APPLICATION_MARK_APP_COMPLETELY_BUSY/
MSG_GEN_APPLICATION_MARK_APP_NOT_COMPLETELY_BUSY
cx, dx, bp - ?
RETURN:
carry - ?
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 8/89 Initial version
------------------------------------------------------------------------------@
OLAppMarkCompletelyBusy method dynamic OLApplicationClass, \
MSG_GEN_APPLICATION_MARK_APP_COMPLETELY_BUSY
inc ds:[di].OLAI_completelyBusyCount ; Inc busy count
EC < ERROR_Z OL_BUSY_COUNT_OVERFLOW >
if DISABLE_APO_ON_COMPLETELY_BUSY
call SysDisableAPO
endif
GOTO OLAppUpdatePtrImage
OLAppMarkCompletelyBusy endp
OLAppMarkAppNotCompletely method dynamic OLApplicationClass, \
MSG_GEN_APPLICATION_MARK_APP_NOT_COMPLETELY_BUSY
dec ds:[di].OLAI_completelyBusyCount ; Dec busy count
EC < ERROR_S OL_BUSY_COUNT_OVERFLOW >
if DISABLE_APO_ON_COMPLETELY_BUSY
call SysEnableAPO
endif
GOTO OLAppUpdatePtrImage
OLAppMarkAppNotCompletely endp
COMMENT @----------------------------------------------------------------------
FUNCTION: OLAppUpdateFlowHoldUpState
DESCRIPTION: Check to make sure that our current state of input-holding,
with regards to the flow object (managed via calls to
FlowHoldUpInput & FlowResumeInput) are in the state which they
should be in.
CALLED BY: INTERNAL
OLAppHoldUpInput
OLAppResumeInput
OLAppGrabModalExcl
OLAppReleaseModalExcl
PASS:
*ds:si - OLApplication object
RETURN:
Nothing
DESTROYED:
di
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 6/90 Initial version
------------------------------------------------------------------------------@
OLAppUpdateFlowHoldUpState proc near
uses ax
.enter
mov di, ds:[si]
add di, ds:[di].Vis_offset
; First, decide if flow object should be holding up input for us
; or not...
; If overriding input restrictions, allow input to flow.
; Otherwise check hold up input flag
;
test ds:[di].OLAI_flowFlags, \
mask AFF_OVERRIDE_INPUT_RESTRICTIONS
jnz letErRip
; Otherwise, see if we have a non-zero hold
; up count, indicating hold up desired
tst ds:[di].OLAI_holdUpInputCount
jnz holdUpInput ; if so, hold up input
; Otherwise, let fly
letErRip:
; If already allowing flow, nothing more to
; worry about, we're done.
test ds:[di].OLAI_flowFlags, mask AFF_FLOW_HOLDING_INPUT_FOR_APP
jz done
; Otherwise, reset flag & release input
andnf ds:[di].OLAI_flowFlags, not mask AFF_FLOW_HOLDING_INPUT_FOR_APP
mov ax, MSG_VIS_CONTENT_RESUME_INPUT_FLOW
jmp short callThenDone
holdUpInput:
; If already holding up, nothing more to worry
; about, we're done.
test ds:[di].OLAI_flowFlags, mask AFF_FLOW_HOLDING_INPUT_FOR_APP
jnz done
; Otherwise, set flag & hold up input
ornf ds:[di].OLAI_flowFlags, mask AFF_FLOW_HOLDING_INPUT_FOR_APP
mov ax, MSG_VIS_CONTENT_HOLD_UP_INPUT_FLOW
callThenDone:
push cx, dx, bp
call ObjCallInstanceNoLock
pop cx, dx, bp
done:
.leave
ret
OLAppUpdateFlowHoldUpState endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CheckIfInteractableObject
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Checks to see if the object is interactable.
CALLED BY: GLOBAL
PASS: CX:DX <- object
RETURN: nada
DESTROYED: nada
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 1/22/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CheckIfInteractableObject proc far
.enter
movdw bxsi, ds:[di]
cmpdw cxdx, bxsi
stc ;If this object is on the list,
je exit ; then it must be interactable
; If the object on the list was not the one we were testing, send a
; message to the object on the list in case the passed object is a
; child object of the one on the list (GenControl subclasses this
; this to allow messages to its child blocks)
push cx, dx
mov ax, MSG_META_CHECK_IF_INTERACTABLE_OBJECT
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ;Returns carry set if interactable
; object
pop cx, dx
exit:
.leave
ret
CheckIfInteractableObject endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLAppCheckIfAlwaysInteractableObject
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Checks if the object should always be interactable.
CALLED BY: GLOBAL
PASS: nada
RETURN: carry set if allowed
DESTROYED: nada
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 1/22/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLAppCheckIfAlwaysInteractableObject method OLApplicationClass,
MSG_GEN_APPLICATION_CHECK_IF_ALWAYS_INTERACTABLE_OBJECT
.enter
mov di, offset CheckIfInteractableObject
mov ax, GAGCNLT_CONTROLLERS_WITHIN_USER_DO_DIALOGS
call CallOnAllItemsInGCNList
jc exit
; If nobody on the app wants this, try the modal win itself...
mov di, ds:[si]
add di, ds:[di].OLApplication_offset
movdw bxsi, ds:[di].OLAI_modalWin
tst_clc bx
jz exit
mov ax, MSG_META_CHECK_IF_INTERACTABLE_OBJECT
mov di, mask MF_CALL
call ObjMessage
exit:
.leave
ret
OLAppCheckIfAlwaysInteractableObject endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CheckIfWindowIsInteractable
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: If the window is interactable, then return carry set.
CALLED BY: GLOBAL
PASS: cx:dx - InputOD as passed w/ MSG_META_TEST_WIN_INTERACTIBILITY
bp - window
ds:di - object in GCN list
RETURN: carry set if window is interactable
DESTROYED: nada
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 12/ 2/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CheckIfWindowIsInteractable proc far
.enter
push cx, dx, bp
mov ax, MSG_META_TEST_WIN_INTERACTIBILITY
movdw bxsi, ds:[di]
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ;Returns carry set if mouse allowed
; in window
pop cx, dx, bp
.leave
ret
CheckIfWindowIsInteractable endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CallOnAllItemsInGCNList
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Calls the passed callback routine on all items in the
passed gcnlist.
CALLED BY: GLOBAL
PASS: *ds:si - OLApplicationClass object
ax - GCN list
CS:DI - callback routine
CX,DX,BP - data to pass to callback
RETURN: carry set if callback routine set it
carry clear if no items in list, or callback routine did
not set it.
DESTROYED: nada
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 1/22/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CallOnAllItemsInGCNList proc near
uses si
.enter
; Call callback on all items in GCN list
push ax
mov ax, TEMP_META_GCN ;
call ObjVarFindData ;
pop ax
jnc exit ;If no GCN lists, exit
push di
mov di, ds:[bx].TMGCND_listOfLists
mov bx, MANUFACTURER_ID_GEOWORKS
clc ;Don't create list
call GCNListFindListInBlock
pop di
jnc exit ;If no GCNList, exit
clr ax
mov bx, cs ;BX:DI <- callback routine
call ChunkArrayEnum ;Returns carry set if window was
; interactable
exit:
.leave
ret
CallOnAllItemsInGCNList endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLAppTestWinInteractibility
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: General purpose message used to determine whether the mouse
should be allowed into a particular window on an implied
basis at any given point in time. The default handler here
returns "yes" unless there is a modal window up, & the mouse
is outside of it, or if the app is currently IGNORING input.
This message may be subclassed to do enable interesting effects
like allowing clicking on spreadsheet cells while a modal
dialog is up.
PASS: *ds:si - instance data
ds:di - ptr to start of master instance data
es - segment of class
ax - MSG_META_TEST_WIN_INTERACTIBILITY
^lcx:dx - InputOD of window to check
^hbp - Window to check
RETURN: carry - set if mouse allowed in window, clear if not.
ALLOWED TO DESTROY:
bx, si, di, ds, es
PSEUDO CODE/STRATEGY/KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
doug 2/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLAppTestWinInteractibility method dynamic OLApplicationClass, \
MSG_META_TEST_WIN_INTERACTIBILITY
clc
jcxz exit ; if no InputOD, mouse can't interact
mov bx, ds:[di].OLAI_modalWin.handle
tst bx
jz afterModal
; We want to accept input to this modal dialog, so query the dialog
; to see if the window the mouse is over is a child window of this
; dialog, and if so, allow input in...
push cx, dx, bp, si
mov si, ds:[di].OLAI_modalWin.chunk
mov ax, MSG_META_TEST_WIN_INTERACTIBILITY
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
pop cx, dx, bp, si
jc overModalWin
; The mouse is not over the modal window, so check to see if the window
; belongs to an object on the GCN list that says it should always
; be interactable - if so, branch to allow input in
mov di, offset CheckIfWindowIsInteractable
mov ax, GAGCNLT_ALWAYS_INTERACTABLE_WINDOWS
call CallOnAllItemsInGCNList
;Returns carry set if window belongs to ALWAYS_INTERACTABLE object
jmp exit
overModalWin:
; The mouse is over the current modal window (or one of its subwindows).
; Ask the currently active modal window if it wants to abide by input
; restrictions. If so, treat it like a non-modal window, and if ignoring
; input, don't let the mouse in (2/25/94 - atw)
push cx, dx, bp, si
mov di, ds:[si]
add di, ds:[di].OLApplication_offset
mov si, ds:[di].OLAI_modalWin.chunk
mov ax, MSG_GEN_INTERACTION_TEST_INPUT_RESTRICTABILITY
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
pop cx, dx, bp, si
jc exit ;Branch if it wants to override input restrictions
; (which is the default for modal windows, for some
; stupid reason).
mov di, ds:[si]
add di, ds:[di].OLApplication_offset
afterModal:
; If ignoring input, mouse isn't allowed in.
;
tst_clc ds:[di].OLAI_ignoreInputCount
jnz exit
stc
exit:
ret
OLAppTestWinInteractibility endm
COMMENT @----------------------------------------------------------------------
FUNCTION: OLAppUpdateImpliedWin
DESCRIPTION: Sets VCNI_impliedMouseGrab based on current implied win info, &
whether or not we have an app-modal or system modal dialog
up on screen. Normally, we just let mouse data go to
whatever window it is over (unless, of course, there is
an active grab). If there is a modal window, up, however,
only allow implied mouse data to be sent to that window.
CALLED BY: INTERNAL
PASS: *ds:si - OLApplication object
RETURN: nothing
DESTROYED: ax, cx, dx, bp, di
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 2/92 Initial version
------------------------------------------------------------------------------@
OLAppUpdateImpliedWin proc near
uses es
.enter
mov di, ds:[si]
add di, ds:[di].Vis_offset
;
; Get window mouse is over
;
mov cx, ds:[di].OLAI_impliedWin.MG_OD.handle
mov dx, ds:[di].OLAI_impliedWin.MG_OD.chunk
mov bp, ds:[di].OLAI_impliedWin.MG_gWin
; Ask ourselves (while allowing developers to subclass & give us a
; different answer), whether the mouse should be allowed in this
; window or not.
;
push cx, dx, bp
mov ax, MSG_META_TEST_WIN_INTERACTIBILITY
call ObjCallInstanceNoLock
pop cx, dx, bp
jc haveDecision
clr cx, dx ; if not allowed in, clear out implied
; win optr.
haveDecision:
mov ax, MSG_META_IMPLIED_WIN_CHANGE
mov di, segment OLApplicationClass
mov es, di
mov di, offset OLApplicationClass
call ObjCallSuperNoLock
.leave
ret
OLAppUpdateImpliedWin endp
OLAppGetImpliedWin method dynamic OLApplicationClass, MSG_OL_APP_GET_IMPLIED_WIN
mov cx, ds:[di].OLAI_impliedWin.MG_OD.handle
mov dx, ds:[di].OLAI_impliedWin.MG_OD.chunk
mov bp, ds:[di].OLAI_impliedWin.MG_gWin
ret
OLAppGetImpliedWin endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLAppUpdatePtrImage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Determines appropriate PtrImages for PIL_LAYER,
& sets them for the App's Layer
CALLED BY: GLOBAL
PASS: *ds:si - object
RETURN: nada
DESTROYED: ax, cx, dx, bp, di
PSEUDO CODE/STRATEGY:
if (OLAI_completelyBusyCount) OLPI_BUSY
else {
if (sys/app modal window active) {
if (active or implied mouse grab) OLPI_NONE
else OLPI_MODAL
} else {
if (ignore input OR busy) OLPI_BUSY
else OLPI_NONE
}
}
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
doug 2/21/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if ANIMATED_BUSY_CURSOR
OLAppUpdatePtrImage method OLApplicationClass, MSG_OL_APP_UPDATE_PTR_IMAGE
else
OLAppUpdatePtrImage proc far
endif
mov di, ds:[si]
add di, ds:[di].Vis_offset
; FIRST, figure out whether we want to show a completely
; BUSY cursor or not.
mov cl, OLPI_NONE ; assume we don't
; If completely busy, modal state doesn't matter -- show busy.
;
tst ds:[di].OLAI_completelyBusyCount
jnz showBusy
; Check to see if "outside modal" area cursor should be displayed
; (Is overriden by busy states)
;
tst ds:[di].OLAI_modalWin.handle
jz afterModalWin
;
; If active grab, no special cursor
;
tst ds:[di].VCNI_activeMouseGrab.VMG_object.handle
jnz afterModalWin
;
; If mouse allowed in current implied window, no special cursor
;
tst ds:[di].VCNI_impliedMouseGrab.VMG_object.handle
jnz afterModalWin
;
mov cl, OLPI_MODAL ; Otherwise, use modal cursor
afterModalWin:
;
; Can't do this as it allows busy cursor on modal dialogs with text entry,
; etc. Oh well, no busy cursor for you. - brianc 6/8/93
;
if 0
;
; If running in PF_HIDE_PTR_IF_NOT_OF_ALWAYS_SHOW_TYPE mode, then
; allow busy cursor to override AFF_OVERRIDE_INPUT_RESTRICTIONS
; - brianc 6/3/93
;
push ax
call ImGetPtrFlags
test al, mask PF_HIDE_PTR_IF_NOT_OF_ALWAYS_SHOW_TYPE
pop ax
jnz checkBusy
endif
; If overriding input restrictions, then use current mouse image.
; Otherwise, check to see if we should show "busy."
;
test ds:[di].OLAI_flowFlags, \
mask AFF_OVERRIDE_INPUT_RESTRICTIONS
jnz setLayerStatus
;
; Show busy if ignoring input or app marked "Busy".
;
;checkBusy:
tst ds:[di].OLAI_ignoreInputCount
jnz showBusy
tst ds:[di].OLAI_busyCount
jnz showBusy
jmp short setLayerStatus
;
showBusy:
mov cl, OLPI_BUSY ; if any outstanding, set busy
setLayerStatus:
call OpenGetPtrImage ; Fetch OL ptr image to use
mov bx, ds:[LMBH_handle] ; get handle of app's geode
call MemOwner
call WinGeodeSetPtrImage ; Set it.
done:
ret
OLAppUpdatePtrImage endp
COMMENT @----------------------------------------------------------------------
METHOD: OLAppGetDisplayScheme -- MSG_GEN_APPLICATION_GET_DISPLAY_SCHEME for
OLApplicationClass
DESCRIPTION: Fetch display scheme store in app object
PASS:
*ds:si - instance data
es - segment of ApplicationClass
ax - MSG_GEN_APPLICATION_GET_DISPLAY_SCHEME
cx - ?
dx - ?
bp - ?
RETURN: Display scheme structure in ax,cx,dx,bp.
al - DS_colorScheme
ah - DS_displayType
cl - DS_lightColor
ch - DS_darkColor
dx - DS_fontID
bp - DS_pointSize
carry - set
DESTROYED:
Nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 11/89 Initial version
------------------------------------------------------------------------------@
; NOTE! This routine is called directly from various places, so be careful
; with what you trash.
;
OLAppGetDisplayScheme method OLApplicationClass, \
MSG_GEN_APPLICATION_GET_DISPLAY_SCHEME
push bx
call SpecGetDisplayScheme ; Use FAST routine for this
mov bp, dx ; specific UI, which works with
mov dx, cx ; only one DisplayScheme at
mov cx, bx ; a time.
pop bx
stc
ret
OLAppGetDisplayScheme endp
COMMENT @----------------------------------------------------------------------
FUNCTION: OLApplicationSetTaskEntryMoniker -
MSG_GEN_APPLICATION_SET_TASK_ENTRY_MONIKER handler.
DESCRIPTION: This procedure sets a new moniker for the GenItem
which represents this application in the Application Menu.
PASS: ds:*si - instance data
^lcx:dx = VisMoniker or VisMonikerList to use
(will copy to this block)
RETURNS: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 1/90 initial version
------------------------------------------------------------------------------@
OLApplicationSetTaskEntryMoniker method dynamic OLApplicationClass, \
MSG_GEN_APPLICATION_SET_TASK_ENTRY_MONIKER
mov di, ds:[si]
add di, ds:[di].Vis_offset
mov si, ds:[di].OLAI_appMenuItems
tst si
jz done
mov bx, cs
mov di, offset OLASTEM_callback
call ChunkArrayEnum
done:
ret
OLApplicationSetTaskEntryMoniker endm
;
; pass: *ds:si = chunk array
; ds:di = CreateExpressMenuControlItemResponseParams
; ^lcx:dx = vis moniker to copy
; return: carry clear to continue enumeration
;
OLASTEM_callback proc far
uses cx, dx
.enter
movdw bxsi, ds:[di].CEMCIRP_newItem
call CopyTextMonikerToListEntry
clc
.leave
ret
OLASTEM_callback endp
AppCommon ends
AppCommon segment resource
COMMENT @----------------------------------------------------------------------
FUNCTION: CopyTextMonikerToListEntry
DESCRIPTION: Copy text moniker over current moniker of list entry passed
CALLED BY: INTERNAL
OLApplicationSetTaskEntryMoniker
PASS: ds - object block segment to keep fixed up
^lbx:si - GenItem
^lcx:dx - source moniker
RETURN:
DESTROYED:
ax, cx, dx
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 4/90 Initial version
------------------------------------------------------------------------------@
CopyTextMonikerToListEntry proc near
uses bx, di, bp
.enter
push bx ; ^lbx:si is GenItem
; ^lcx:dx is VisMoniker to copy from
jcxz haveMoniker ; if NULL source, pass it on
;
; lock down VisMoniker and if moniker list, find a text moniker
;
mov bx, cx ; bx = moniker block handle
call ObjSwapLock ; ds = moniker segment
; bx = passed ds block
push bx, si ; save ds block, GenItem chunk
mov di, dx ; *ds:di = VisMoniker to copy from
call UserGetDisplayType ; ah = DisplayType
mov bh, ah ; bh = DisplayType
; bp = search flags
mov bp, (VMS_TEXT shl offset VMSF_STYLE)
;return non-abbreviated text string,
;otherwise abbreviated text string,
;otherwise textual GString, otherwise
;non-textual GString.
call VisFindMoniker ; ^lcx:dx = moniker found
pop bx, si ; restore ds block, GenItem chunk
call ObjSwapUnlock
;
; XXX: make sure returned moniker is text
;
haveMoniker:
pop bx ; ^lbx:si = GenItem
jcxz exit ; just exit if no moniker found
;
; set found moniker in OLAppTaskItem
; ^lbx:si = OLAppTaskItem
; cx:dx = optr of text vis moniker
;
; NOTE: We have to bend backwards to be very careful here. We
; cannot use MSG_GEN_REPLACE_VIS_MONIKER_OPTR because the GenItem
; being set can be run by a different thread. We could use
; MSG_GEN_REPLACE_VIS_MONIKER_TEXT, but then we'd have to a MF_CALL
; which is bad because if there are several threads running Express
; Menu Controls (and their GenItems), we could get deadlock as one
; thread waits for another. So we copy the moniker into a sharable
; block and do a send.
;
pushdw bxsi ; save OLAppTaskItem
mov bx, cx
call ObjSwapLock ; *ds:dx is text moniker
push bx ; save for ObjSwapUnlock
mov di, dx
mov si, ds:[di] ; *ds:si = text moniker
ChunkSizePtr ds, si, ax ; ax = size of text moniker
push ax ; save size
mov cx, ALLOC_DYNAMIC_LOCK or mask HF_SHARABLE
call MemAlloc ; bx = handle, ax = segment
pop cx ; cx = size
jc memError1 ; couldn't allocate block, skip
mov es, ax ; es:di = block
clr di
rep movsb ; copy over
call MemUnlock ; unlock new text moniker block
mov ax, bx ; ax = new text moniker block
memError1:
pop bx
call ObjSwapUnlock ; (preserves flags)
popdw bxsi ; ^lbx:si = OLAppTaskItem
jc exit ; memory error above, skip setting
; moniker
mov cx, ax ; cx = new text moniker block
mov ax, MSG_OL_APP_TASK_ITEM_SET_MONIKER
mov di, mask MF_FIXUP_DS
call ObjMessage
exit:
.leave
ret
CopyTextMonikerToListEntry endp
if _PRINT_SCREEN ;------------------------------------------------------
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLAppPrintScreen
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Print the screen.
CALLED BY: MSG_OL_APP_PRINT_SCREEN
PASS: *ds:si = OLApplicationClass object
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ACJ 1/ 4/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLAppPrintScreen method dynamic OLApplicationClass,
MSG_OL_APP_PRINT_SCREEN
uses bp
screenDumpToken local GeodeToken
.enter
;
; Initialize the local(s).
;
mov {word}ss:[screenDumpToken].GT_chars, 'SC'
mov {word}ss:[screenDumpToken].GT_chars+2, 'DP'
mov {word}ss:[screenDumpToken].GT_manufID, \
MANUFACTURER_ID_GEOWORKS
;
; Create a launch block for IACP.
;
mov dx, MSG_GEN_PROCESS_OPEN_APPLICATION
call IACPCreateDefaultLaunchBlock
mov bx, dx ; ^hbx = launch block
jc error
;
; Launch app using IACP.
;
push bp ; locals
segmov es, ss
lea di, ss:screenDumpToken
mov ax, mask IACPCF_FIRST_ONLY or \
mask IACPCF_OBEY_LAUNCH_MODEL or \
(IACPSM_USER_INTERACTIBLE shl offset IACPCF_SERVER_MODE)
call IACPConnect ; bp = IACPConnection
mov_tr ax, bp ; ax = IACPConnection
pop bp ; locals
jc error
;
; Close the connection (but leave Screen Dumper active --
; it will close itself eventually).
;
push bp ; locals
mov_tr bp, ax ; bp = IACPConnection
clr cx ; server shutting down
call IACPShutdown
pop bp ; locals
done::
error:
.leave
ret
OLAppPrintScreen endm
endif ; _PRINT_SCREEN -------------------------------------------------------
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLAppEnsureIndicatorCorrect
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Make sure that indicator floats to top or sink to
bottom correctly. Specifically, if the currect active
window does not occupy the whole screen, Indicator
should appear (unless the active window is a bubble
window).
CALLED BY: MSG_OL_APP_ENSURE_INDICATOR_CORRECT
PASS: *ds:si = OLApplicationClass object
ds:di = OLApplicationClass instance data
es = segment of OLApplicationClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
/* if the app is detaching, don't do any check. --
commented because geometry should update if an
app transparently detach. */
if the app is indicator (AS_NOT_USER_INTERACTABLE)
don't do any check -- to prevent deadlock.
if we haven't found indicator primary window {
find it by callback
}
find the correct window that is not a popup nor indicator
window.
if (no such window) {
quit
}
if (VisGetBounds(window).Left >= INDICATOR_WIDTH) {
Bring up indicator window (*)
} else {
Bring up the top window (*)
}
(*) done by WinChangePriority, so we don't have to force
queue, call message, and have delays or worries about
synchronization.
Need exclusive access to indicatorPrimaryWindow because
OpenWinVisClose will change it when indicator window is
closed.
REVISION HISTORY:
Name Date Description
---- ---- -----------
kho 6/19/95 Initial version
kho 3/18/96 Bring up window by WinChangePriority, thanks
to Drew's suggestion.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AppCommon ends
| 25.724272 | 85 | 0.645068 |
aa32bb7d2524dfaf3d669c4684e75e0e9becb78d | 7,422 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0xca_notsx.log_21829_63.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_63.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_63.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r8
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x1463, %r10
nop
nop
cmp %r9, %r9
mov (%r10), %r11w
add $62247, %rax
lea addresses_UC_ht+0x122c3, %rbp
nop
dec %r13
movb (%rbp), %r8b
nop
nop
nop
dec %rbp
lea addresses_D_ht+0xdbf7, %r10
add $9301, %r11
vmovups (%r10), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $0, %xmm6, %rbp
nop
nop
cmp $60687, %rax
lea addresses_D_ht+0x10ac3, %rbp
nop
nop
dec %rax
movups (%rbp), %xmm3
vpextrq $1, %xmm3, %r11
nop
nop
lfence
lea addresses_UC_ht+0xfa43, %rsi
lea addresses_D_ht+0xa840, %rdi
nop
nop
nop
xor $10249, %r11
mov $68, %rcx
rep movsl
nop
nop
nop
nop
nop
xor $60194, %r8
lea addresses_normal_ht+0x1cac3, %r8
nop
nop
cmp $36182, %rsi
mov (%r8), %r13
nop
nop
nop
nop
nop
cmp $22901, %r11
lea addresses_normal_ht+0x5ec3, %rsi
lea addresses_D_ht+0xec63, %rdi
clflush (%rdi)
nop
nop
nop
inc %r9
mov $4, %rcx
rep movsq
nop
nop
nop
nop
cmp %r13, %r13
lea addresses_WC_ht+0x15a07, %rcx
add $7994, %rdi
movb (%rcx), %r10b
inc %r8
lea addresses_WC_ht+0x176bf, %rbp
nop
nop
nop
nop
cmp $63451, %rdi
movw $0x6162, (%rbp)
nop
nop
xor %rax, %rax
lea addresses_WC_ht+0x9919, %r11
cmp %rdi, %rdi
vmovups (%r11), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $1, %xmm3, %r9
nop
nop
nop
nop
add $15703, %rax
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r8
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r14
push %r8
push %rbp
push %rbx
push %rcx
// Store
lea addresses_D+0x112c3, %r8
nop
nop
nop
inc %rbx
movw $0x5152, (%r8)
add %r11, %r11
// Store
lea addresses_A+0x3223, %r11
nop
nop
nop
nop
add $34361, %r13
movb $0x51, (%r11)
nop
nop
nop
nop
nop
xor %rcx, %rcx
// Store
lea addresses_PSE+0x19143, %rbx
nop
nop
nop
add %r11, %r11
mov $0x5152535455565758, %r8
movq %r8, %xmm6
movups %xmm6, (%rbx)
cmp $40876, %rbp
// Store
lea addresses_WC+0xb37f, %rbp
nop
nop
nop
and %r14, %r14
mov $0x5152535455565758, %r11
movq %r11, (%rbp)
nop
nop
nop
nop
nop
xor $57470, %rcx
// Faulty Load
lea addresses_D+0x112c3, %r11
nop
nop
nop
nop
nop
xor %rcx, %rcx
movb (%r11), %r8b
lea oracles, %r14
and $0xff, %r8
shlq $12, %r8
mov (%r14,%r8,1), %r8
pop %rcx
pop %rbx
pop %rbp
pop %r8
pop %r14
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 2, 'AVXalign': True}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': True, 'type': 'addresses_A', 'size': 1, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_PSE', 'size': 16, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_WC', 'size': 8, 'AVXalign': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}}
{'src': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}}
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': True, 'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'52': 21829}
52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52
*/
| 32.986667 | 2,999 | 0.652789 |
4da87c80f7dd88805e554a926eb64143a0e4d70e | 18,122 | asm | Assembly | CSC 323/Assignments/Assignment 3/G6P3.asm | Anthony91501/uwp-2022-spring | 2ca2b95d3a502551870fe3203ba4e97969d2835f | [
"MIT"
] | 4 | 2022-01-15T21:17:08.000Z | 2022-02-22T05:53:56.000Z | CSC 323/Assignments/Assignment 3/G6P3.asm | Anthony91501/uwp-2022-spring | 2ca2b95d3a502551870fe3203ba4e97969d2835f | [
"MIT"
] | 1 | 2022-01-29T01:30:06.000Z | 2022-01-31T17:51:39.000Z | CSC 323/Assignments/Assignment 3/G6P3.asm | Anthony91501/uwp-2022-spring | 2ca2b95d3a502551870fe3203ba4e97969d2835f | [
"MIT"
] | 4 | 2022-01-28T19:39:27.000Z | 2022-02-23T21:09:09.000Z | TITLE Operating System Simulator (G6P3.asm) ; OF DOOM(ED GRADES)
; CSC 323 - Group 6 - Assignment 3: Operating System Simulator
; Author: Robert Krency, kre1188@calu.edu
; Author: Anthony Stepich, ste4864@calu.edu
; Author: Camden Kovach, kov2428@calu.edu
; This program simulates an Operating System that handles up to ten jobs and
; the stepping of those jobs.
; NOTES:
; ASCII Capital letters: 65-90
; QUESTIONS:
; Store job name as is, or can force to lower/upper case
; Overwrite existing jobs?
INCLUDE Irvine32.inc
.data
; Output Strings
msg_Details BYTE "Welcome to the Operating System Simulator.", 0
msg_GetInput BYTE ">> ", 0
msg_Quit BYTE "Exiting...", 0
msg_InvalidCommand BYTE "Invalid command entered.", 0
msg_MissingJobName BYTE "Invalid job name. Input Job Name (max 8 chars).", 0
msg_MissingJobPriority BYTE "Missing job priority. Input Job Priority: ", 0
msg_InvalidJobPriority BYTE "Invalid job priority. No command executed.", 0
msg_MissingJobRunTime BYTE "Missing job runtime. Input Job RunTime: ", 0
msg_InvalidRunTime BYTE "Invalid run time. No command executed.", 0
msg_JobFinished BYTE "Job finished.", 0
msg_StatusRun BYTE "Status: Run", 0
msg_StatusHold BYTE "Status: Hold", 0
;Help Menu Messages
msg_Help BYTE "[HELP MENU]",0
msg_HQuit BYTE "quit -> Quits Program", 0
msg_HHelp BYTE "help -> Displays this menu", 0
msg_HShow BYTE "show -> displays the current job queue", 0
msg_HRun BYTE "run [job] -> runs the job you select, brackets not included", 0
msg_HHold BYTE "hold [job] -> puts the job you select on hold, brackets not included", 0
msg_HKill BYTE "kill [job] -> removes selected job from queue, must be in HOLD mode", 0
msg_HStep BYTE "step [num] -> processes the system for num cycles", 0
msg_HChange BYTE "change [job] [priority] -> changes job priority. priority must bt 0-7", 0
msg_HLoad BYTE "load [job] [priority] [runtime] -> loads the job, sets the priority, runtime is cycle steps, 1-50", 0
; Input Buffer
bufferSize equ 100
buffer BYTE bufferSize DUP(0)
byteCount DWORD ?
wordMaxSize equ bufferSize
currentWord BYTE wordMaxSize DUP(0)
currentWordSize BYTE 0
outputWord BYTE 9 DUP(0)
stepCounter DWORD 0
; ASCII Equivalents
ascii_Z_Upper equ 90
ascii_A_Upper equ 65
ascii_Z_Lower equ 122
ascii_A_Lower equ 97
ascii_Tab equ 9
ascii_Space equ 32
ascii_Null equ 0
ascii_EndOfLine equ 3
ascii_Zero equ 48
ascii_Nine equ 57
ascii_MinusSign equ 45
; Job Record Offsets
JName equ 0
JPriority equ 8
JStatus equ 9
JRunTime equ 10
JLoadTime equ 12
; Job Constants
JobAvailable equ 0
JobRun equ 1
JobHold equ 2
LowestPriority equ 7
SizeOfJob equ 14
NumberOfJobs equ 10
; Job Records
; Byte 0-7: Job Name
; Byte 8: Priority
; Byte 9: Status
; Byte 10-11: Run Time
; Byte 12-13: Load Time
jobsArray BYTE NumberOfJobs*SizeOfJob dup(JobAvailable)
endOfJobsArray DWORD endOfJobsArray
jobIndex DWORD 0
; Job Variables
curJobPointer DWORD 0
curJobName BYTE 8 DUP(0)
curJobPriority BYTE 0
curJobStatus BYTE 0
curJobRunTime WORD 0
curJobLoadtime WORD 0
; Command Names
cmd_QUIT BYTE "quit", 0
cmd_HELP BYTE "help", 0
cmd_LOAD BYTE "load", 0
cmd_RUN BYTE "run", 0
cmd_HOLD BYTE "hold", 0
cmd_KILL BYTE "kill", 0
cmd_SHOW BYTE "show", 0
cmd_STEP BYTE "step", 0
cmd_CHANGE BYTE "change", 0
; System Variables
system_time word 0
; Flags
flag_AvailableRecord BYTE 0
flag_JobExists BYTE 0
flag_NegativeNumber BYTE 0
flag_JobStepAvailable BYTE 0
.code
main PROC
mov edx, OFFSET msg_Details ; Display welcome message
call WriteString
call Crlf
mov system_time, 0
mov curJobPointer, offset endOfJobsarray-SizeOfJob
while1:
call ProcessCommand
jc endwhile1
jmp while1
endwhile1:
call Quit
; The command handler: it calls GetInput to get the input from the user and extracts
; the word from the input by calling GetWord, then process the case statement calling
; the command routines
ProcessCommand:
; Get input from the user
call GetInput
; Check if we're at the end of the input line
mov al, [esi]
cmp al, ascii_Null
je EndProcessCommand
; Get the word from the input
mov esi, OFFSET buffer
call GetWord
; Check which command this is
case_cmd_QUIT:
push esi
mov edi, OFFSET cmd_QUIT
mov esi, OFFSET currentWord
cld
mov ecx, LENGTHOF cmd_QUIT
REPE CMPSB
pop esi
jne case_cmd_HELP
call Quit
case_cmd_HELP:
push esi
mov edi, OFFSET cmd_HELP
mov esi, OFFSET currentWord
cld
mov ecx, LENGTHOF cmd_HELP
REPE CMPSB
pop esi
jne case_cmd_LOAD
call Help
jmp EndProcessCommand
case_cmd_LOAD:
push esi
mov edi, OFFSET cmd_LOAD
mov esi, OFFSET currentWord
cld
mov ecx, LENGTHOF cmd_LOAD
REPE CMPSB
pop esi
jne case_cmd_RUN
call LoadJob
jmp EndProcessCommand
case_cmd_RUN:
push esi
mov edi, OFFSET cmd_RUN
mov esi, OFFSET currentWord
cld
mov ecx, LENGTHOF cmd_RUN
REPE CMPSB
pop esi
jne case_cmd_HOLD
call RunJob
jmp EndProcessCommand
case_cmd_HOLD:
push esi
mov edi, OFFSET cmd_HOLD
mov esi, OFFSET currentWord
cld
mov ecx, LENGTHOF cmd_HOLD
REPE CMPSB
pop esi
jne case_cmd_KILL
call HoldJob
jmp EndProcessCommand
case_cmd_KILL:
push esi
mov edi, OFFSET cmd_KILL
mov esi, OFFSET currentWord
cld
mov ecx, LENGTHOF cmd_KILL
REPE CMPSB
pop esi
jne case_cmd_SHOW
call KillJob
jmp EndProcessCommand
case_cmd_SHOW:
push esi
mov edi, OFFSET cmd_SHOW
mov esi, OFFSET currentWord
cld
mov ecx, LENGTHOF cmd_SHOW
REPE CMPSB
pop esi
jne case_cmd_STEP
call Show
jmp EndProcessCommand
case_cmd_STEP:
push esi
mov edi, OFFSET cmd_STEP
mov esi, OFFSET currentWord
cld
mov ecx, LENGTHOF cmd_STEP
REPE CMPSB
pop esi
jne case_cmd_CHANGE
call Step
jmp EndProcessCommand
case_cmd_CHANGE:
push edi
mov edi, OFFSET cmd_CHANGE
mov esi, OFFSET currentWord
cld
mov ecx, LENGTHOF cmd_CHANGE
REPE CMPSB
pop edi
jne case_default
call Change
jmp EndProcessCommand
case_default:
mov edx, OFFSET msg_InvalidCommand
call WriteString
call Crlf
EndProcessCommand:
; Return to the main loop
ret
; Clears the input buffer, resets the index, prompts the user, reads the input,
; then calls SkipWhiteSpace
GetInput:
mov edx, OFFSET msg_GetInput
call WriteString
mov edx, OFFSET buffer
mov ecx, SIZEOF buffer
call ReadString
mov byteCount, eax
; Skip the white space in the input
mov esi, OFFSET buffer
call SkipWhiteSpace
ret
; Skips white space in the input from the current index
SkipWhiteSpace:
mov al, [esi]
cmp al, ascii_Tab
je SkipChar
mov al, [esi]
cmp al, ascii_Space
je SkipChar
ret
SkipChar:
inc esi
jmp SkipWhiteSpace
; Copies the characters from the input buffer starting with the current
; input index to a word buffer until a non-alpha character, null, or end of line
; is reached.
GetWord:
mov edi, OFFSET currentWord
mov currentWordSize, 0
mov ebx, 0
mov eax, 0
GetWordLoop:
; Move the current character into the al register, then force it to upper case
mov al, [esi]
and al, 223
; Check that it is a valid character
cmp al, ascii_A_Upper
jl InvalidChar
cmp al, ascii_Z_Upper
jg InvalidChar
mov dl, byte ptr [esi]
mov byte ptr [edi], dl
inc esi
inc edi
inc currentWordSize
jmp GetWordLoop
InvalidChar:
mov dl, 0
mov byte ptr[edi], dl
ret
; Calls SkipWhiteSpace then if there is not a parameter left in the input buffer the
; user will be prompted for a job name and the GetInput procedure will be called.
; Once there is input, the GetWord procedure will be called and the job name is kept.
GetJobName:
call SkipWhiteSpace
mov al, byte ptr [esi]
cmp al, ascii_Null
jne GetJobWord
GetJobInput:
mov edx, OFFSET msg_MissingJobName
call WriteString
call Crlf
call GetInput
GetJobWord:
call GetWord
push esi
; Move the Word to the current Job Name
mov ecx, 0
mov esi, OFFSET currentWord
mov edi, OFFSET curJobName
mov cl, 8
REP MOVSB
mov ecx, 0
mov byte ptr [esi], cl
pop esi
ret
; Converst the digit characters in the input buffer starting with the current index to
; a positive or negative number.
GetNumber:
mov eax, 0
mov ebx, 10
; Check if negative number
mov flag_NegativeNumber, 0
mov dl, byte ptr [esi]
cmp dl, ascii_MinusSign
jne GetNumberLoop
mov flag_NegativeNumber, 1
inc esi
GetNumberLoop:
mov edx, 0
mov dl, byte ptr [esi]
cmp dl, ascii_Zero
jl CheckNegative
cmp dl, ascii_Nine
jg CheckNegative
mul ebx
mov dl, byte ptr [esi]
add dl, -48
add eax, edx
inc esi
jmp GetNumberLoop
CheckNegative:
cmp flag_NegativeNumber, 1
jne GetNumberEnd
neg eax
GetNumberEnd:
ret
; Calls SkipWhiteSpace then if there is not a parameter left in the input buffer the user
; will be prompted for a priority and the GetInput procedure will be called. Once there
; is input, the GetNumber procedure will be called.
; The priority will be validated and the priority will be kept.
; There is no re-prompting for an invalid priority, a message will be displayed and the
; operation will not be performed.
GetPriority:
call SkipWhiteSpace
mov dl, [esi]
cmp dl, ascii_Null
jne ProcessPriority
mov edx, OFFSET msg_MissingJobPriority
call WriteString
call Crlf
call GetInput
ProcessPriority:
call GetNumber
cmp al, 0
jl InvalidPriority
cmp al, 7
jg InvalidPriority
mov curJobPriority, al
ret
InvalidPriority:
mov edx, OFFSET msg_InvalidJobPriority
call WriteString
call Crlf
ret
; Calls SkipWhiteSpace then if there is not a parameter left in the input buffer the user
; will be prompted for a run time and the GetInput procedure will be called. Once there
; is input the GetNumber procedure will be called.
; The run time will be validated and the run time will be kept.
; There is no re-prompting for and invalid run time, a message will be displayed and the
; operation will not be performed.
GetRunTime:
call SkipWhiteSpace
mov dl, [esi]
cmp dl, ascii_Null
jne ProcessRunTime
mov edx, OFFSET msg_MissingJobRunTime
call WriteString
call Crlf
call GetInput
ProcessRunTime:
call GetNumber
cmp eax, 0
jl InvalidRunTime
cmp eax, 50
jg InvalidRunTime
mov curJobRunTime, ax
ret
InvalidRunTime:
mov edx, OFFSET msg_InvalidRunTime
call WriteString
call Crlf
ret
; Finds the next available record by testing if the status field is set to available (0).
; When the first available record is reached, this returns with the address of that record.
; When the procedure reaches the end of the job records without finding an available space,
; the procedure returns indicating no space is available.
FindNextAvailableRecord:
mov esi, OFFSET jobsArray
AvailJobLoop:
cmp byte ptr [esi+JStatus], JobAvailable
je AvailableRecord
cmp esi, endOfJobsArray
je NoAvailableRecord
add esi, SizeOfJob
jmp AvailJobLoop
AvailableRecord:
mov curJobPointer, esi
mov flag_AvailableRecord, 1
ret
NoAvailableRecord:
mov flag_AvailableRecord, 0
ret
; Search through the jobs records to find a job that matches the specified job name that is
; not available space, ie the job is not in a run or hold status. Status != 0.
; When the job name is found, the procedure returns with the address of the record.
; When the procedure reaches the end of the jobs record without finding the job name,
; the procedure returns indicating the job was not found.
FindJob:
push esi
mov edi, OFFSET jobsArray
mov curJobPointer, edi
FindJobLoop:
mov esi, OFFSET curJobName
mov edi, curJobPointer
mov ecx, LENGTHOF curJobName
cld
REPE CMPSB
je JobFound
call GetNextRecord
cmp edi, endOfJobsArray
je NoJobFound
jmp FindJobLoop
JobFound:
mov flag_JobExists, 1
pop esi
ret
NoJobFound:
pop esi
mov flag_JobExists, 0
ret
; Moves the curJobPointer to the next record
GetNextRecord:
mov edi, curJobPointer
cmp edi, endofJobsArray
je GNREndOfArray
jmp GNRNext
GNREndOfArray:
mov edi, OFFSET jobsArray
jmp GNREnd
GNRNext:
add edi, SizeOfJob
GNREnd:
mov curJobPointer, edi
ret
; This calls the GetJobName procedure followed by calling the GetPriority procedure then
; finally the GetRunTime procedure. If all of the data for a job is gathered, the FindJob
; procedure is called to see if the JobName already is loaded. When the job is unique,
; the FindNext procedure is called to find an available location for the job. When a
; location is found for the unique job, the information is placed into the record and the
; status is changed from available to hold.
LoadJob:
; Get Input Vars
call GetJobName
call GetPriority
call GetRunTime
; Check if Job exists already
call FindJob
cmp flag_JobExists, 1
je EndLoadJob
; Find an available Record
call FindNextAvailableRecord
cmp flag_AvailableRecord, 1
jne EndLoadJob
push esi
; Move the name into the Record
mov esi, OFFSET curJobName
mov edi, curJobPointer
mov ecx, 8
cld
REP MOVSB
pop esi
mov esi, curJobPointer
; Store numerical values in the Record
mov al, curJobPriority
mov byte ptr [esi+JPriority], al
mov al, JobHold
mov byte ptr [esi+JStatus], al
mov ax, curJobRunTime
mov word ptr [esi+JRunTime], ax
mov ax, system_time
mov word ptr [esi+JLoadTime], ax
EndLoadJob:
ret
; Gets the job name and if it exists, sets the status to hold.
HoldJob:
call GetJobName
; Check for valid input
call FindJob
cmp flag_JobExists, 1
jne EndHold
push esi
mov esi, curJobPointer
mov byte ptr JStatus[esi], JobHold
pop esi
EndHold:
ret
; Gets the job name and sets its status to Run
RunJob:
call GetJobName
; Check for valid input
call FindJob
cmp flag_JobExists, 1
jne EndRun
push esi
mov esi, curJobPointer
mov byte ptr JStatus[esi], JobRun
pop esi
EndRun:
ret
; Gets the job and if it is in a hold status, sets its status to available.
; For any other circumstance, an appropriate error message is displayed.
KillJob:
call GetJobName
; Check for valid input
call FindJob
cmp flag_JobExists, 1
jne EndKill
push esi
mov esi, curJobPointer
mov byte ptr JStatus[esi], JobAvailable
pop esi
EndKill:
ret
; This will process the next job with the highest priority that is in run mode. It will
; not always start at the beginning and it will not continue to process the same job.
; The processing will only process the same job if it is the next job of the highest priority
; in the run mode. Every time a step is processed the system time will increment even if there
; are no jobs to process.
Step:
call SkipWhiteSpace
call GetNumber
; Check for valid input
mov flag_JobStepAvailable, 0
mov esi, OFFSET jobsArray
mov curJobPriority, 8
mov stepCounter, eax
StepLoop:
cmp stepCounter, 0
jle EndStep
dec stepCounter
mov flag_JobStepAvailable, 0
call FindHighestPriorityJob
inc system_time
cmp flag_JobStepAvailable, 1
jne StepLoop
mov esi, curJobPointer
cmp byte ptr JStatus[esi], JobRun
jne StepLoop
call ShowCurrentJob
dec byte ptr JRunTime[esi]
cmp byte ptr JRunTime[esi], 0
jg StepLoopPartDeux
mov byte ptr JStatus[esi], JobAvailable
mov edx, OFFSET msg_JobFinished
call WriteString
call Crlf
StepLoopPartDeux:
mov curJobPointer, esi
jmp StepLoop
EndStep:
ret
FindHighestPriorityJob:
mov al, 8
mov curJobPointer, esi
FHPJLoop:
; Get the Next Record
push esi
call GetNextRecord
pop esi
; If at the end of the array, loop again
mov edi, curJobPointer
cmp edi, endOfJobsArray
je FHPJLoop
; If looped back to current candidate, stop
cmp edi, esi
je FHPJEnd
; If the job is not in a run state, continue loop
cmp byte ptr JStatus[edi], JobRun
jne FHPJLoop
; If the new cadidate is lower prio, set as current candidate
mov al, byte ptr JPriority[edi]
cmp byte ptr JPriority[esi], al
jge FHPJLoop
mov curJobPointer, edi
mov esi, edi
jmp FHPJLoop
FHPJEnd:
mov curJobPointer, esi
mov flag_JobStepAvailable, 1
ret
; The show procedure begins at the beginning of the jobs record and proceeds to the end.
; Each record is checked if it is a run or hold state. When a record is not in the available
; state, the information is retrieved from the record: job name, priority, status, run time,
; and load time. The information is then neatly displayed to the user. The status is printed
; as words not numbers: run or hold.
Show:
mov esi, OFFSET jobsArray
mov curJobPointer, esi
ShowLoop:
call ShowCurrentJob
call GetNextRecord
mov esi, curJobPointer
cmp esi, endOfJobsArray
je EndShow
jmp ShowLoop
EndShow:
ret
ShowCurrentJob:
mov esi, curJobPointer
mov eax, 0
mov al, byte ptr [esi+JStatus]
cmp al, JobAvailable
je EndShowCurrentJob
mov edi, OFFSET outputWord
mov ecx, 8
cld
REP MOVSB
mov edx, OFFSET outputWord
call WriteString
call Crlf
mov esi, curJobPointer
mov al, byte ptr JPriority[esi]
call WriteInt
call Crlf
call PrintStatus
mov ax, word ptr JRunTime[esi]
call WriteInt
call Crlf
mov ax, word ptr JLoadTime[esi]
call WriteInt
call Crlf
call Crlf
EndShowCurrentJob:
ret
; Changes the job priority
Change:
call FindJob
cmp flag_JobExists, 1
jne EndChange
call GetNumber
cmp eax, 0
jl EndChange
cmp eax, 7
jg EndChange
mov esi, curJobPointer
mov byte ptr JPriority[esi], al
EndChange:
ret
; Prints out the help messages
Help:
mov edx, OFFSET msg_Help
call WriteString
call Crlf
mov edx, OFFSET msg_HQuit
call WriteString
call Crlf
mov edx, OFFSET msg_HHelp
call WriteString
call Crlf
mov edx, OFFSET msg_HShow
call WriteString
call Crlf
mov edx, OFFSET msg_HRun
call WriteString
Call Crlf
mov edx, OFFSET msg_HHold
call WriteString
Call Crlf
mov edx, OFFSET msg_HKill
call WriteString
Call Crlf
mov edx, OFFSET msg_HStep
call WriteString
Call Crlf
mov edx, OFFSET msg_HChange
call WriteString
Call Crlf
mov edx, OFFSET msg_HLoad
call WriteString
Call Crlf
ret
PrintStatus:
mov dl, byte ptr JStatus[esi]
cmp dl, JobRun
jne PrintHold
mov edx, OFFSET msg_StatusRun
jmp EndPrintStatus
PrintHold:
mov edx, OFFSET msg_StatusHold
EndPrintStatus:
call WriteString
call Crlf
ret
; Quit the program
; Command: 'Q'
Quit:
call Crlf
mov edx, OFFSET msg_Quit ; Print the quit message
call WriteString
call Crlf
exit
main ENDP
END main | 19.549083 | 120 | 0.757863 |
e21aa1508ab9807e9389fabafe9faaa81808dce3 | 186 | asm | Assembly | libsrc/graphics/gal/respixl.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/graphics/gal/respixl.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/graphics/gal/respixl.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
SECTION code_clib
PUBLIC respixel
EXTERN res_MODE0
EXTERN res_MODE1
EXTERN __gal_mode
respixel:
ld a,(__gal_mode)
cp 1
jp z,res_MODE1
and a
ret nz
jp res_MODE0
| 10.941176 | 19 | 0.709677 |
95691dbffda4b928c59ad948034ac0f1467e8524 | 20,168 | asm | Assembly | sources/ippcp/asm_ia32_gas_converted/linux/nonpic/h9/merged/pcpp192r1arith_mont_slm.asm | idesai/ipp-crypto | 67220e3042f23d423c7977cdfd8b4f54f3cba2e0 | [
"Apache-2.0"
] | 1 | 2020-11-03T21:30:58.000Z | 2020-11-03T21:30:58.000Z | sources/ippcp/asm_ia32_gas_converted/linux/nonpic/h9/merged/pcpp192r1arith_mont_slm.asm | idesai/ipp-crypto | 67220e3042f23d423c7977cdfd8b4f54f3cba2e0 | [
"Apache-2.0"
] | null | null | null | sources/ippcp/asm_ia32_gas_converted/linux/nonpic/h9/merged/pcpp192r1arith_mont_slm.asm | idesai/ipp-crypto | 67220e3042f23d423c7977cdfd8b4f54f3cba2e0 | [
"Apache-2.0"
] | null | null | null | ###############################################################################
# Copyright 2018 Intel Corporation
# All Rights Reserved.
#
# If this software was obtained under the Intel Simplified Software License,
# the following terms apply:
#
# The source code, information and material ("Material") contained herein is
# owned by Intel Corporation or its suppliers or licensors, and title to such
# Material remains with Intel Corporation or its suppliers or licensors. The
# Material contains proprietary information of Intel or its suppliers and
# licensors. The Material is protected by worldwide copyright laws and treaty
# provisions. No part of the Material may be used, copied, reproduced,
# modified, published, uploaded, posted, transmitted, distributed or disclosed
# in any way without Intel's prior express written permission. No license under
# any patent, copyright or other intellectual property rights in the Material
# is granted to or conferred upon you, either expressly, by implication,
# inducement, estoppel or otherwise. Any license under such intellectual
# property rights must be express and approved by Intel in writing.
#
# Unless otherwise agreed by Intel in writing, you may not remove or alter this
# notice or any other notice embedded in Materials by Intel or Intel's
# suppliers or licensors in any way.
#
#
# If this software was obtained under the Apache License, Version 2.0 (the
# "License"), the following terms apply:
#
# You may not use this file except in compliance with the License. You may
# obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################
.section .note.GNU-stack,"",%progbits
.text
p192r1_data:
_prime192r1:
.long 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF
.p2align 5, 0x90
.globl h9_add_192
.type h9_add_192, @function
h9_add_192:
movl (%esi), %eax
addl (%ebx), %eax
movl %eax, (%edi)
movl (4)(%esi), %eax
adcl (4)(%ebx), %eax
movl %eax, (4)(%edi)
movl (8)(%esi), %eax
adcl (8)(%ebx), %eax
movl %eax, (8)(%edi)
movl (12)(%esi), %eax
adcl (12)(%ebx), %eax
movl %eax, (12)(%edi)
movl (16)(%esi), %eax
adcl (16)(%ebx), %eax
movl %eax, (16)(%edi)
movl (20)(%esi), %eax
adcl (20)(%ebx), %eax
movl %eax, (20)(%edi)
mov $(0), %eax
adc $(0), %eax
ret
.Lfe1:
.size h9_add_192, .Lfe1-(h9_add_192)
.p2align 5, 0x90
.globl h9_sub_192
.type h9_sub_192, @function
h9_sub_192:
movl (%esi), %eax
subl (%ebx), %eax
movl %eax, (%edi)
movl (4)(%esi), %eax
sbbl (4)(%ebx), %eax
movl %eax, (4)(%edi)
movl (8)(%esi), %eax
sbbl (8)(%ebx), %eax
movl %eax, (8)(%edi)
movl (12)(%esi), %eax
sbbl (12)(%ebx), %eax
movl %eax, (12)(%edi)
movl (16)(%esi), %eax
sbbl (16)(%ebx), %eax
movl %eax, (16)(%edi)
movl (20)(%esi), %eax
sbbl (20)(%ebx), %eax
movl %eax, (20)(%edi)
mov $(0), %eax
adc $(0), %eax
ret
.Lfe2:
.size h9_sub_192, .Lfe2-(h9_sub_192)
.p2align 5, 0x90
.globl h9_shl_192
.type h9_shl_192, @function
h9_shl_192:
movl (20)(%esi), %eax
movq (16)(%esi), %xmm2
movdqu (%esi), %xmm1
movdqa %xmm2, %xmm3
palignr $(8), %xmm1, %xmm3
psllq $(1), %xmm2
psrlq $(63), %xmm3
por %xmm3, %xmm2
movq %xmm2, (16)(%edi)
movdqa %xmm1, %xmm3
pslldq $(8), %xmm3
psllq $(1), %xmm1
psrlq $(63), %xmm3
por %xmm3, %xmm1
movdqu %xmm1, (%edi)
shr $(31), %eax
ret
.Lfe3:
.size h9_shl_192, .Lfe3-(h9_shl_192)
.p2align 5, 0x90
.globl h9_shr_192
.type h9_shr_192, @function
h9_shr_192:
movdqu (%esi), %xmm2
movq (16)(%esi), %xmm1
movdqa %xmm1, %xmm3
palignr $(8), %xmm2, %xmm3
psrlq $(1), %xmm2
psllq $(63), %xmm3
por %xmm3, %xmm2
movdqu %xmm2, (%edi)
movdqa %xmm0, %xmm3
psrlq $(1), %xmm1
psllq $(63), %xmm3
por %xmm3, %xmm1
movq %xmm1, (16)(%edi)
ret
.Lfe4:
.size h9_shr_192, .Lfe4-(h9_shr_192)
.p2align 5, 0x90
.globl h9_p192r1_add
.type h9_p192r1_add, @function
h9_p192r1_add:
push %ebp
mov %esp, %ebp
push %ebx
push %esi
push %edi
mov %esp, %eax
sub $(28), %esp
and $(-16), %esp
movl %eax, (24)(%esp)
movl (8)(%ebp), %edi
movl (12)(%ebp), %esi
movl (16)(%ebp), %ebx
call h9_add_192
mov %eax, %edx
lea (%esp), %edi
movl (8)(%ebp), %esi
lea p192r1_data, %ebx
lea ((_prime192r1-p192r1_data))(%ebx), %ebx
call h9_sub_192
lea (%esp), %esi
movl (8)(%ebp), %edi
sub %eax, %edx
cmovne %edi, %esi
movdqu (%esi), %xmm0
movq (16)(%esi), %xmm1
movdqu %xmm0, (%edi)
movq %xmm1, (16)(%edi)
mov (24)(%esp), %esp
pop %edi
pop %esi
pop %ebx
pop %ebp
ret
.Lfe5:
.size h9_p192r1_add, .Lfe5-(h9_p192r1_add)
.p2align 5, 0x90
.globl h9_p192r1_sub
.type h9_p192r1_sub, @function
h9_p192r1_sub:
push %ebp
mov %esp, %ebp
push %ebx
push %esi
push %edi
mov %esp, %eax
sub $(28), %esp
and $(-16), %esp
movl %eax, (24)(%esp)
movl (8)(%ebp), %edi
movl (12)(%ebp), %esi
movl (16)(%ebp), %ebx
call h9_sub_192
mov %eax, %edx
lea (%esp), %edi
movl (8)(%ebp), %esi
lea p192r1_data, %ebx
lea ((_prime192r1-p192r1_data))(%ebx), %ebx
call h9_add_192
lea (%esp), %esi
movl (8)(%ebp), %edi
test %edx, %edx
cmove %edi, %esi
movdqu (%esi), %xmm0
movq (16)(%esi), %xmm1
movdqu %xmm0, (%edi)
movq %xmm1, (16)(%edi)
mov (24)(%esp), %esp
pop %edi
pop %esi
pop %ebx
pop %ebp
ret
.Lfe6:
.size h9_p192r1_sub, .Lfe6-(h9_p192r1_sub)
.p2align 5, 0x90
.globl h9_p192r1_neg
.type h9_p192r1_neg, @function
h9_p192r1_neg:
push %ebp
mov %esp, %ebp
push %ebx
push %esi
push %edi
mov %esp, %eax
sub $(28), %esp
and $(-16), %esp
movl %eax, (24)(%esp)
movl (8)(%ebp), %edi
movl (12)(%ebp), %esi
mov $(0), %eax
subl (%esi), %eax
movl %eax, (%edi)
mov $(0), %eax
sbbl (4)(%esi), %eax
movl %eax, (4)(%edi)
mov $(0), %eax
sbbl (8)(%esi), %eax
movl %eax, (8)(%edi)
mov $(0), %eax
sbbl (12)(%esi), %eax
movl %eax, (12)(%edi)
mov $(0), %eax
sbbl (16)(%esi), %eax
movl %eax, (16)(%edi)
mov $(0), %eax
sbbl (20)(%esi), %eax
movl %eax, (20)(%edi)
sbb %edx, %edx
lea (%esp), %edi
movl (8)(%ebp), %esi
lea p192r1_data, %ebx
lea ((_prime192r1-p192r1_data))(%ebx), %ebx
call h9_add_192
lea (%esp), %esi
movl (8)(%ebp), %edi
test %edx, %edx
cmove %edi, %esi
movdqu (%esi), %xmm0
movq (16)(%esi), %xmm1
movdqu %xmm0, (%edi)
movq %xmm1, (16)(%edi)
mov (24)(%esp), %esp
pop %edi
pop %esi
pop %ebx
pop %ebp
ret
.Lfe7:
.size h9_p192r1_neg, .Lfe7-(h9_p192r1_neg)
.p2align 5, 0x90
.globl h9_p192r1_mul_by_2
.type h9_p192r1_mul_by_2, @function
h9_p192r1_mul_by_2:
push %ebp
mov %esp, %ebp
push %ebx
push %esi
push %edi
mov %esp, %eax
sub $(28), %esp
and $(-16), %esp
movl %eax, (24)(%esp)
lea (%esp), %edi
movl (12)(%ebp), %esi
call h9_shl_192
mov %eax, %edx
mov %edi, %esi
movl (8)(%ebp), %edi
lea p192r1_data, %ebx
lea ((_prime192r1-p192r1_data))(%ebx), %ebx
call h9_sub_192
sub %eax, %edx
cmove %edi, %esi
movdqu (%esi), %xmm0
movq (16)(%esi), %xmm1
movdqu %xmm0, (%edi)
movq %xmm1, (16)(%edi)
mov (24)(%esp), %esp
pop %edi
pop %esi
pop %ebx
pop %ebp
ret
.Lfe8:
.size h9_p192r1_mul_by_2, .Lfe8-(h9_p192r1_mul_by_2)
.p2align 5, 0x90
.globl h9_p192r1_mul_by_3
.type h9_p192r1_mul_by_3, @function
h9_p192r1_mul_by_3:
push %ebp
mov %esp, %ebp
push %ebx
push %esi
push %edi
mov %esp, %eax
sub $(56), %esp
and $(-16), %esp
movl %eax, (52)(%esp)
lea p192r1_data, %eax
lea ((_prime192r1-p192r1_data))(%eax), %eax
movl %eax, (48)(%esp)
lea (%esp), %edi
movl (12)(%ebp), %esi
call h9_shl_192
mov %eax, %edx
mov %edi, %esi
lea (24)(%esp), %edi
mov (48)(%esp), %ebx
call h9_sub_192
sub %eax, %edx
cmove %edi, %esi
movdqu (%esi), %xmm0
movq (16)(%esi), %xmm1
movdqu %xmm0, (%edi)
movq %xmm1, (16)(%edi)
mov %edi, %esi
movl (12)(%ebp), %ebx
call h9_add_192
mov %eax, %edx
movl (8)(%ebp), %edi
mov (48)(%esp), %ebx
call h9_sub_192
sub %eax, %edx
cmove %edi, %esi
movdqu (%esi), %xmm0
movq (16)(%esi), %xmm1
movdqu %xmm0, (%edi)
movq %xmm1, (16)(%edi)
mov (52)(%esp), %esp
pop %edi
pop %esi
pop %ebx
pop %ebp
ret
.Lfe9:
.size h9_p192r1_mul_by_3, .Lfe9-(h9_p192r1_mul_by_3)
.p2align 5, 0x90
.globl h9_p192r1_div_by_2
.type h9_p192r1_div_by_2, @function
h9_p192r1_div_by_2:
push %ebp
mov %esp, %ebp
push %ebx
push %esi
push %edi
mov %esp, %eax
sub $(28), %esp
and $(-16), %esp
movl %eax, (24)(%esp)
lea (%esp), %edi
movl (12)(%ebp), %esi
lea p192r1_data, %ebx
lea ((_prime192r1-p192r1_data))(%ebx), %ebx
call h9_add_192
mov $(0), %edx
movl (%esi), %ecx
and $(1), %ecx
cmovne %edi, %esi
cmove %edx, %eax
movd %eax, %xmm0
movl (8)(%ebp), %edi
call h9_shr_192
mov (24)(%esp), %esp
pop %edi
pop %esi
pop %ebx
pop %ebp
ret
.Lfe10:
.size h9_p192r1_div_by_2, .Lfe10-(h9_p192r1_div_by_2)
.p2align 5, 0x90
.globl h9_p192r1_mul_mont_slm
.type h9_p192r1_mul_mont_slm, @function
h9_p192r1_mul_mont_slm:
push %ebp
mov %esp, %ebp
push %ebx
push %esi
push %edi
push %ebp
mov %esp, %eax
sub $(44), %esp
and $(-16), %esp
movl %eax, (40)(%esp)
pxor %mm0, %mm0
movq %mm0, (%esp)
movq %mm0, (8)(%esp)
movq %mm0, (16)(%esp)
movq %mm0, (24)(%esp)
movl (8)(%ebp), %edi
movl (12)(%ebp), %esi
movl (16)(%ebp), %ebp
movl %edi, (28)(%esp)
movl %esi, (32)(%esp)
movl %ebp, (36)(%esp)
mov $(6), %edi
movd (4)(%esi), %mm1
movd (8)(%esi), %mm2
.p2align 5, 0x90
.Lmmul_loopgas_11:
movd %edi, %mm7
movl (%ebp), %edx
movl (%esi), %eax
movd %edx, %mm0
add $(4), %ebp
movl %ebp, (36)(%esp)
pmuludq %mm0, %mm1
mul %edx
addl (%esp), %eax
adc $(0), %edx
pmuludq %mm0, %mm2
movd %mm1, %ecx
psrlq $(32), %mm1
add %edx, %ecx
movd %mm1, %edx
adc $(0), %edx
addl (4)(%esp), %ecx
movd (12)(%esi), %mm1
adc $(0), %edx
movd %mm2, %ebx
psrlq $(32), %mm2
add %edx, %ebx
movd %mm2, %edx
adc $(0), %edx
addl (8)(%esp), %ebx
movd (16)(%esi), %mm2
movd (20)(%esi), %mm3
adc $(0), %edx
pmuludq %mm0, %mm1
pmuludq %mm0, %mm2
pmuludq %mm0, %mm3
movl %ecx, (%esp)
sub %eax, %ebx
mov $(0), %edi
movl %ebx, (4)(%esp)
adc $(0), %edi
movd %mm1, %ecx
psrlq $(32), %mm1
add %edx, %ecx
movd %mm1, %edx
adc $(0), %edx
addl (12)(%esp), %ecx
adc $(0), %edx
movd %mm2, %ebx
psrlq $(32), %mm2
add %edx, %ebx
movd %mm2, %edx
adc $(0), %edx
addl (16)(%esp), %ebx
adc $(0), %edx
movd %mm3, %ebp
psrlq $(32), %mm3
add %edx, %ebp
movd %mm3, %edx
adc $(0), %edx
addl (20)(%esp), %ebp
adc $(0), %edx
sub %edi, %ecx
movl %ecx, (8)(%esp)
sbb $(0), %ebx
movl %ebx, (12)(%esp)
sbb $(0), %ebp
movl %ebp, (16)(%esp)
movd %mm7, %edi
sbb $(0), %eax
mov $(0), %ebx
addl (24)(%esp), %edx
adc $(0), %ebx
add %eax, %edx
adc $(0), %ebx
movl %edx, (20)(%esp)
movl %ebx, (24)(%esp)
sub $(1), %edi
movd (4)(%esi), %mm1
movd (8)(%esi), %mm2
jz .Lexit_mmul_loopgas_11
movl (36)(%esp), %ebp
jmp .Lmmul_loopgas_11
.Lexit_mmul_loopgas_11:
emms
mov (28)(%esp), %edi
lea (%esp), %esi
lea p192r1_data, %ebx
lea ((_prime192r1-p192r1_data))(%ebx), %ebx
call h9_sub_192
movl (24)(%esp), %edx
sub %eax, %edx
cmove %edi, %esi
movdqu (%esi), %xmm0
movq (16)(%esi), %xmm1
movdqu %xmm0, (%edi)
movq %xmm1, (16)(%edi)
mov (40)(%esp), %esp
pop %ebp
pop %edi
pop %esi
pop %ebx
pop %ebp
ret
.Lfe11:
.size h9_p192r1_mul_mont_slm, .Lfe11-(h9_p192r1_mul_mont_slm)
.p2align 5, 0x90
.globl h9_p192r1_sqr_mont_slm
.type h9_p192r1_sqr_mont_slm, @function
h9_p192r1_sqr_mont_slm:
push %ebp
mov %esp, %ebp
push %esi
push %edi
movl (12)(%ebp), %esi
movl (8)(%ebp), %edi
push %esi
push %esi
push %edi
call h9_p192r1_mul_mont_slm
add $(12), %esp
pop %edi
pop %esi
pop %ebp
ret
.Lfe12:
.size h9_p192r1_sqr_mont_slm, .Lfe12-(h9_p192r1_sqr_mont_slm)
.p2align 5, 0x90
.globl h9_p192r1_mred
.type h9_p192r1_mred, @function
h9_p192r1_mred:
push %ebp
mov %esp, %ebp
push %ebx
push %esi
push %edi
movl (12)(%ebp), %esi
mov $(6), %ecx
xor %edx, %edx
.p2align 5, 0x90
.Lmred_loopgas_13:
movl (%esi), %eax
mov $(0), %ebx
movl %ebx, (%esi)
movl (4)(%esi), %ebx
movl %ebx, (4)(%esi)
movl (8)(%esi), %ebx
sub %eax, %ebx
movl %ebx, (8)(%esi)
movl (12)(%esi), %ebx
sbb $(0), %ebx
movl %ebx, (12)(%esi)
movl (16)(%esi), %ebx
sbb $(0), %ebx
movl %ebx, (16)(%esi)
movl (20)(%esi), %ebx
sbb $(0), %ebx
movl %ebx, (20)(%esi)
movl (24)(%esi), %ebx
sbb $(0), %eax
add %edx, %eax
mov $(0), %edx
adc $(0), %edx
add %eax, %ebx
movl %ebx, (24)(%esi)
adc $(0), %edx
lea (4)(%esi), %esi
sub $(1), %ecx
jnz .Lmred_loopgas_13
movl (8)(%ebp), %edi
lea p192r1_data, %ebx
lea ((_prime192r1-p192r1_data))(%ebx), %ebx
call h9_sub_192
sub %eax, %edx
cmove %edi, %esi
movdqu (%esi), %xmm0
movq (16)(%esi), %xmm1
movdqu %xmm0, (%edi)
movq %xmm1, (16)(%edi)
pop %edi
pop %esi
pop %ebx
pop %ebp
ret
.Lfe13:
.size h9_p192r1_mred, .Lfe13-(h9_p192r1_mred)
.p2align 5, 0x90
.globl h9_p192r1_select_pp_w5
.type h9_p192r1_select_pp_w5, @function
h9_p192r1_select_pp_w5:
push %ebp
mov %esp, %ebp
push %esi
push %edi
pxor %xmm0, %xmm0
movl (8)(%ebp), %edi
movl (12)(%ebp), %esi
movl (16)(%ebp), %eax
movd %eax, %xmm7
pshufd $(0), %xmm7, %xmm7
mov $(1), %edx
movd %edx, %xmm6
pshufd $(0), %xmm6, %xmm6
movdqa %xmm0, (%edi)
movdqa %xmm0, (16)(%edi)
movdqa %xmm0, (32)(%edi)
movdqa %xmm0, (48)(%edi)
movq %xmm0, (64)(%edi)
movdqa %xmm6, %xmm5
mov $(16), %ecx
.p2align 5, 0x90
.Lselect_loopgas_14:
movdqa %xmm5, %xmm4
pcmpeqd %xmm7, %xmm4
movdqu (%esi), %xmm0
pand %xmm4, %xmm0
por (%edi), %xmm0
movdqa %xmm0, (%edi)
movdqu (16)(%esi), %xmm1
pand %xmm4, %xmm1
por (16)(%edi), %xmm1
movdqa %xmm1, (16)(%edi)
movdqu (32)(%esi), %xmm2
pand %xmm4, %xmm2
por (32)(%edi), %xmm2
movdqa %xmm2, (32)(%edi)
movdqu (48)(%esi), %xmm3
pand %xmm4, %xmm3
por (48)(%edi), %xmm3
movdqa %xmm3, (48)(%edi)
movq (64)(%esi), %xmm0
movq (64)(%edi), %xmm1
pand %xmm4, %xmm0
por %xmm1, %xmm0
movq %xmm0, (64)(%edi)
paddd %xmm6, %xmm5
add $(72), %esi
sub $(1), %ecx
jnz .Lselect_loopgas_14
pop %edi
pop %esi
pop %ebp
ret
.Lfe14:
.size h9_p192r1_select_pp_w5, .Lfe14-(h9_p192r1_select_pp_w5)
| 28.405634 | 80 | 0.439409 |
73c1f1a55b3e28aca02b924f08905c3f62fb3ce0 | 1,940 | asm | Assembly | game-projects/day-of-the-tentacle/game-mode/infinite-loop/main.asm | wide-dot/thomson-to8-game-engine | f305368ff28fba6e6bd03d0138a36ff5ea67e925 | [
"Apache-2.0"
] | 11 | 2021-09-07T18:45:06.000Z | 2022-02-15T06:36:19.000Z | game-projects/day-of-the-tentacle/game-mode/infinite-loop/main.asm | dougmasten/thomson-to8-game-engine | b1f29e3b650e2296a5058570173e1c9068bccbe4 | [
"Apache-2.0"
] | null | null | null | game-projects/day-of-the-tentacle/game-mode/infinite-loop/main.asm | dougmasten/thomson-to8-game-engine | b1f29e3b650e2296a5058570173e1c9068bccbe4 | [
"Apache-2.0"
] | 1 | 2021-11-22T08:43:52.000Z | 2021-11-22T08:43:52.000Z | INCLUDE "./Engine/Constants.asm"
INCLUDE "./Engine/Macros.asm"
org $6100
jsr LoadAct
jsr ResetMidi
jsr IrqSet50Hz
ldx #Smid_intro
jsr PlayMusic
* ==============================================================================
* Main Loop
* ==============================================================================
LevelMainLoop
jsr WaitVBL
jsr UpdatePalette
jsr RunObjects
jsr CheckSpritesRefresh
jsr EraseSprites
jsr UnsetDisplayPriority
jsr DrawSprites
bra LevelMainLoop
Object_RAM
fcb ObjID_background1
fill 0,object_size-1
fcb ObjID_background2
fill 0,object_size-1
Object_RAM_End
nb_graphical_objects equ 2
* ==============================================================================
* Routines
* ==============================================================================
INCLUDE "./Engine/Ram/BankSwitch.asm"
INCLUDE "./Engine/Graphics/WaitVBL.asm"
INCLUDE "./Engine/Graphics/AnimateSprite.asm"
INCLUDE "./Engine/Graphics/DisplaySprite.asm"
INCLUDE "./Engine/Graphics/CheckSpritesRefresh.asm"
INCLUDE "./Engine/Graphics/EraseSprites.asm"
INCLUDE "./Engine/Graphics/UnsetDisplayPriority.asm"
INCLUDE "./Engine/Graphics/DrawSpritesExtEnc.asm"
INCLUDE "./Engine/Graphics/BgBufferAlloc.asm"
INCLUDE "./Engine/Palette/UpdatePalette.asm"
INCLUDE "./Engine/Ram/ClearDataMemory.asm"
INCLUDE "./Engine/ObjectManagement/RunObjects.asm"
INCLUDE "./Engine/ObjectManagement/ClearObj.asm"
INCLUDE "./Engine/Irq/IrqSmidi.asm"
INCLUDE "./Engine/Sound/Smidi.asm"
INCLUDE "./Engine/Graphics/Codec/zx0_mega.asm"
INCLUDE "./Engine/Graphics/Codec/DecRLE00.asm"
| 35.925926 | 80 | 0.519588 |
6ce7b7c36268689f3ac057cb82c0be0c6b796636 | 218 | asm | Assembly | audio/sfx/safari_zone_pa.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | 1 | 2022-02-15T00:19:44.000Z | 2022-02-15T00:19:44.000Z | audio/sfx/safari_zone_pa.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | null | null | null | audio/sfx/safari_zone_pa.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | null | null | null | SFX_Safari_Zone_PA_Ch5:
duty_cycle 2
square_note 15, 15, 3, 1840
square_note 8, 6, 5, 1840
square_note 15, 15, 4, 1792
square_note 15, 7, 4, 1792
square_note 15, 4, 4, 1792
square_note 15, 2, 4, 1792
sound_ret
| 21.8 | 28 | 0.720183 |
4703b06d84d4c21acb6add047b652d951a15aa81 | 53 | asm | Assembly | Tests/Core/OpenNotFound/OpenNotFound.asm | georgjz/armips | a8c277ca2e4bd90350f56e4adbcf9a99e8df9644 | [
"MIT"
] | 1 | 2017-03-24T12:19:07.000Z | 2017-03-24T12:19:07.000Z | Tests/Core/OpenNotFound/OpenNotFound.asm | georgjz/armips | a8c277ca2e4bd90350f56e4adbcf9a99e8df9644 | [
"MIT"
] | null | null | null | Tests/Core/OpenNotFound/OpenNotFound.asm | georgjz/armips | a8c277ca2e4bd90350f56e4adbcf9a99e8df9644 | [
"MIT"
] | null | null | null | .psx
.open "input.bin", 0
.org 10h
.word 0
.close | 6.625 | 20 | 0.603774 |
300df8b507a16e336eb4d561897ea13cb184045b | 97 | asm | Assembly | tests/testdata/tbuilder-in-13-bad.asm | roycrippen/sicxe | fdca37f56c95f2a76a78455f86a90e4b89329a54 | [
"MIT"
] | null | null | null | tests/testdata/tbuilder-in-13-bad.asm | roycrippen/sicxe | fdca37f56c95f2a76a78455f86a90e4b89329a54 | [
"MIT"
] | null | null | null | tests/testdata/tbuilder-in-13-bad.asm | roycrippen/sicxe | fdca37f56c95f2a76a78455f86a90e4b89329a54 | [
"MIT"
] | null | null | null | test START 0
a EQU -100 . error: negative value
END test
| 24.25 | 51 | 0.43299 |
c66f09b49f3a68931c836d314522dca833c31dab | 423 | asm | Assembly | programs/oeis/016/A016209.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/016/A016209.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/016/A016209.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A016209: Expansion of 1/((1-x)(1-3x)(1-5x)).
; 1,9,58,330,1771,9219,47188,239220,1205941,6059229,30384718,152189310,761743711,3811110039,19062724648,95335146600,476740303081,2383895225649,11920057258978,59602029687090,298015378612051,1490092583590059,7450509989539708
add $0,2
mov $1,1
mov $3,3
pow $3,$0
mov $4,5
pow $4,$0
lpb $0
mov $0,1
add $1,$4
mov $2,$3
mul $2,2
sub $1,$2
lpe
sub $1,8
div $1,8
add $1,1
| 21.15 | 222 | 0.713948 |
4709497d16ddaadc5619a24c9a38cffac887ff02 | 87 | asm | Assembly | reset_stub.asm | neilbaldwin/Pulsar | 8cc11ab4cb4117dc44022b7645b02f777a672bf2 | [
"BSD-2-Clause-FreeBSD"
] | 11 | 2021-04-08T14:24:52.000Z | 2022-03-25T00:45:27.000Z | reset_stub.asm | neilbaldwin/Pulsar | 8cc11ab4cb4117dc44022b7645b02f777a672bf2 | [
"BSD-2-Clause-FreeBSD"
] | 3 | 2021-09-17T03:10:36.000Z | 2021-09-17T03:16:45.000Z | reset_stub.asm | neilbaldwin/Pulsar | 8cc11ab4cb4117dc44022b7645b02f777a672bf2 | [
"BSD-2-Clause-FreeBSD"
] | 1 | 2021-04-08T14:24:54.000Z | 2021-04-08T14:24:54.000Z | ;.word 0,0,0, NMI, RESET, IRQ
lda #$80
sta $8000
jmp RESET
.word NMI,$FFF2,IRQ
| 12.428571 | 30 | 0.597701 |
bbc5229fe174a9f909d080ea35c4f33598184853 | 983 | asm | Assembly | Assignment/a2q1.asm | chintamanand/Embedded-Systems-Project | 8e5651ad699dce8b4c962edb492c910200e00f36 | [
"MIT"
] | null | null | null | Assignment/a2q1.asm | chintamanand/Embedded-Systems-Project | 8e5651ad699dce8b4c962edb492c910200e00f36 | [
"MIT"
] | null | null | null | Assignment/a2q1.asm | chintamanand/Embedded-Systems-Project | 8e5651ad699dce8b4c962edb492c910200e00f36 | [
"MIT"
] | null | null | null | ;ASSIGNMENT 2 QUESTION 1
;WALP TO CHECK WHETHER A STRING STORED IN CODE MEMORY IS PALINDROME OR NOT
;STORE 0XFF IN THE RAM IF PALINDROME, ELSE STORE 0X00
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, =SRC
LDR R1, =LENGTH ;WE ASSUME THE STRING'S LENGTH TO BE STORED IN THE CODE MEMORY
LDR R1, [R1] ;R1 STORES THE STRING'S LENGTH
ADD R2, R0, R1
SUB R2, #01
LSR R1, #01 ;DIVIDES THE LENGTH OF THE STRING BY 2
MOV R9, #0XFF
LOOP
LDRB R3, [R0]
LDRB R4, [R2]
ADD R0, #01
SUB R2, #01
CMP R3, R4
BEQ NEXT
MOV R9, #0X00
B EXIT
NEXT
SUB R1, #01
TEQ R1, #00
BNE LOOP
EXIT
LDR R8, =RES
STR R9, [R8]
STOP B STOP
SRC DCB "345643" ;STRING OPERANDS CAN ONLY BE SPECIFIED FOR DCB
LENGTH DCD 6 ;STORES LENGTH OF STRING
AREA myarea, DATA, READWRITE
RES DCD 0
END
| 17.872727 | 81 | 0.660224 |
519ecc8f5a741f1417c1be2713990f13e5ae5675 | 8,994 | nasm | Assembly | napoca/boot/ap_initialization.nasm | fengjixuchui/napoca | ed26609ab9a3ea12d12882b311dcb332dc759d32 | [
"Apache-2.0"
] | 170 | 2020-07-30T15:04:59.000Z | 2022-03-24T10:59:29.000Z | napoca/boot/ap_initialization.nasm | a-cristi/napoca | ed6691125bf703366581e47a1fe789167009c24a | [
"Apache-2.0"
] | 3 | 2020-08-10T09:16:56.000Z | 2022-02-18T21:40:43.000Z | napoca/boot/ap_initialization.nasm | a-cristi/napoca | ed6691125bf703366581e47a1fe789167009c24a | [
"Apache-2.0"
] | 44 | 2020-07-30T15:06:55.000Z | 2022-02-25T08:55:55.000Z | ;
; Copyright (c) 2020 Bitdefender
; SPDX-License-Identifier: Apache-2.0
;
section .text
;
; AP INITIALIZATION CODE, RUNS FROM A 'VV00:0000h' - LIKE ADDRESS (Intel MP Spec.)
;
%include "system.nasm"
%include "loader_interface.nasm"
;
; Imported symbols / external dependencies
;
extern InitCpuEntry
extern IniInit64
extern PwrResumeHostAp
;
; Exported symbols
;
global gApTrampoline16 ; the base and entry point of AP initialization code/data
global gApTrampoline16End ; address of where it ends
global gApStartupData ; structure sent by the HV to APs
;
; Configuration
;
AP_MAX_CPU_COUNT equ 64
;
; Types and macros
;
%define RVA(X) ((X) - gApTrampoline16) ; offset relative to trampoline start
%define SEL(X) apGdtTable. %+ X - apGdtTable.start ; offset inside the GDT for a given descriptor label
%macro WAKEUP_HALT 0
push di
xor di, di
;;;cmp [gIsWakeup], di
jz %%skip
cli
hlt
%%skip:
pop di
%endmacro
; AP parameters structure, initialized by HV
_struc AP_POINTERS
DWORD (LapicId) ; an AP checks this value to find out if the current entry belongs to itself
QWORD (StackTop) ; what RSP value should I use ?
QWORD (CpuMapEntry) ; what's my CPU entry ?
QWORD (GsBase) ; where should my KERNEL_GS_BASE point at ?
_endstruc
_struc AP_STARTUP_DATA
DWORD (BaseAddress) ; must be set by napoca, NOT USED, it is dynamically determined by each AP
QWORD (BaseAddressVa) ; the VA of the trampoline start, as seen by the C code (BSP)
QWORD (StartupCr3) ; intermediate cr3 below 4GB for long mode initialization
QWORD (BspCr3) ; bsp's final cr3
DWORD (UefiEvent) ; used by UEFI
QWORD (UefiEntry) ; UEFI APs will run this code
QWORD (BootContext) ; pointer to the boot context which will be used as param for init64
QWORD (IsWakeUp)
RAW (ApPointers, AP_MAX_CPU_COUNT*sizeof(AP_POINTERS)) ; storage for per cpu pointers to structures
_endstruc
;
; Actual implementation
;
[bits 16]
gApTrampoline16:
cli
xor ebp, ebp
mov bp, cs
mov ds, bp
mov es, bp
mov fs, bp
mov gs, bp
mov ss, bp
shl ebp, 4 ; ebp is the PA of gApTrampoline16
;;; enable A20 address line (??)
; fix the gdt base value based on actual runtime address
lea eax, [ebp + RVA(apGdtTable)]
mov [RVA(apGdtStructure.base)], eax
; fix the next far jump
lea eax, [ebp + RVA(.bits32)]
mov [RVA(.farjmp)+2], eax
; switch to 32 bits
lgdt [RVA(apGdtStructure)]
mov eax, cr0
or eax, 1
mov cr0, eax
.farjmp:
jmp DWORD SEL(code32): 0x12345678 ; the offset is patched in the above code
;
; AP DATA
;
_istruc gApStartupData, AP_STARTUP_DATA
_iend
apStacks: times 64 dq 0 ; 64 cpu stacks of one quad each, used for 64bit switching
apGdtStructure:
.size dw apGdtTable.end - apGdtTable.start
.base dq 0 ; auto-patched before use
apGdtTable:
.start:
.null dq 0
.code64 dq FLAT_DESCRIPTOR_CODE64
.data64 dq FLAT_DESCRIPTOR_DATA64
.code16 dq FLAT_DESCRIPTOR_CODE16
.data16 dq FLAT_DESCRIPTOR_DATA16
.code32 dq FLAT_DESCRIPTOR_CODE32
.data32 dq FLAT_DESCRIPTOR_DATA32
.end:
fpuTestWord:
dw 0xBDBD
gApTrampoline16.bits32:
[bits 32]
mov ax, SEL(data32)
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
;
; Activate long-mode
;
; deactivate XD_DISABLE and LIMIT_CPUID in IA32_MISC
CONFIGURE_IA32_MISC 0, IA32_MISC_ENABLE.XD_DISABLE | IA32_MISC_ENABLE.LIMIT_CPUID
ENABLE_PAE
ENABLE_LME
ENABLE_XD
; set PG using the intermediate cr3
mov eax, [ebp + RVA(gApStartupData.StartupCr3)]
mov cr3, eax
ENABLE_PAGING
; Prepare new 64bit-ready selectors
mov ax, SEL(data64) ; Setup data segment selectors
mov fs, ax
mov gs, ax
mov ds, ax
mov ss, ax
mov es, ax
; setup the 8 bytes stack: ToS = apStacks + id*8 + 8
xor ebx, ebx
mov eax, 1
cpuid
mov edx, ebx
shr edx, 24
and edx, 63 ; edx is the lapic id
lea esp, [ebp + edx * 8 + RVA(apStacks) + 8]
;
; switch to 64 bits
;
push DWORD SEL(code64)
call .pushEip ; place return EIP onto the stack (4 bytes)
.pushEip:
add DWORD [esp], .entry64 - .pushEip
retf ; pops cs:rip (8 bytes) and continues execution in true long mode
[bits 64]
.entry64:
; ESP -> RSP
xor rax, rax
mov eax, esp
mov rsp, rax
; EBP -> RBP (PA base)
xor rax, rax
mov eax, ebp
mov rbp, rax
; EDX -> RDX (apicId)
xor rax, rax
mov eax, edx
mov rdx, rax
; final CR3
mov rax, [rbp + RVA(gApStartupData.BspCr3)]
mov cr3, rax
; final HV VA
mov rbx, [rbp + RVA(gApStartupData.BaseAddressVa)]
lea rax, [rbx + RVA(.finalVA)]
push rax ; rax is relative to rbx = gApStartupData.BaseAddressVa
ret
.finalVA:
; rbp points to gApTrampoline16 PA base, rbx will point to gApTrampoline16 VA base; edx is still the lapic id
; find the stack and CpuMap entry
lea rsi, [rbp + RVA(gApStartupData.ApPointers)]
mov rcx, AP_MAX_CPU_COUNT
.nextEntry:
cmp [rsi + AP_POINTERS.LapicId], edx
jz .foundPointers
add rsi, sizeof(AP_POINTERS)
loop .nextEntry
jmp .error
.foundPointers:
; setup stack
mov rax, [rsi + AP_POINTERS.StackTop]
mov rsp, rax
;
; enable fpu support
;
call activateFpuSupport
; Setup GS Base for the current AP
push rdx
mov eax, [rsi + AP_POINTERS.GsBase] ; low part
mov edx, [rsi + AP_POINTERS.GsBase + 4] ; high part
mov rcx, 0xC0000101 ; IA32_GS_BASE
wrmsr
mov rcx, 0xC0000102 ; IA32_KERNEL_GS_BASE
wrmsr
pop rdx
; init the gBootInfo->CpuMap entry
X64CALL InitCpuEntry, [rsi + AP_POINTERS.CpuMapEntry]
test al, al
jz .error
.enterHv:
mov rcx, [rbp + RVA(gApStartupData.BootContext)]
xor rdi, rdi
cmp [rbp + RVA(gApStartupData.IsWakeUp)], rdi
jz .makecall
mov rcx, 0 ;; when calling PwrResumeHostAp with a NULL parameter we know we are during Sleep - Wakeup and not doing a normal boot
X64CALL PwrResumeHostAp
.makecall:
X64CALL IniInit64, rcx
.error:
cli
hlt
[bits 64]
activateFpuSupport:
%define CR0_MP (1 << 1)
%define CR0_EM (1 << 2)
%define CR0_TS (1 << 3)
%define CR0_NE (1 << 5)
%define CR4_OSFXSR (1 << 9)
%define CR4_OSXMMEXCPT (1 << 10)
%define CR4_OSXSAVE (1 << 18)
%define CPUID_FPU (1 << 0)
%define CPUID_XSAVE (1 << 26)
push rax
push rbx
push rcx
push rdx
xor rax, rax
inc rax
cpuid
test rdx, CPUID_FPU ; bit 0 in edx specifies fpu support
jz .notSupported
; test the presence of the fpu
mov rax, cr0
and eax, 0xFFFFFFFF - (CR0_TS + CR0_EM)
mov cr0, rax
fninit
fnstsw [ebp + RVA(fpuTestWord)]
cmp word [ebp + RVA(fpuTestWord)], 0
jnz .notSupported
mov rax, cr0
and eax, 0xFFFFFFFF - CR0_NE ; disable interrupt generation on exceptions
or eax, CR0_MP ; should be inverse of EM, and EM is 0
mov cr0, rax
mov rax, cr4
or rax, CR4_OSFXSR
and eax, 0xFFFFFFFF - CR4_OSXMMEXCPT
;or eax, CR4_OSXMMEXCPT
mov cr4, rax
; enable xsave
xor rax, rax
inc rax
test ecx, CPUID_XSAVE
jz .noXsaveSupport
mov rax, cr4
or eax, CR4_OSXSAVE
mov cr4, rax
.noXsaveSupport:
.notSupported:
pop rdx
pop rcx
pop rbx
pop rax
ret
gApTrampoline16End:
| 25.844828 | 159 | 0.546698 |
85ddd0910c1e442d32c9f7921c7576e25954e248 | 8,137 | asm | Assembly | main.asm | acdzh/TC_Assembly_Project-BrainFuckVM | 3f70a462d32550a833ac31995b10a8eff0dc24e6 | [
"WTFPL"
] | null | null | null | main.asm | acdzh/TC_Assembly_Project-BrainFuckVM | 3f70a462d32550a833ac31995b10a8eff0dc24e6 | [
"WTFPL"
] | null | null | null | main.asm | acdzh/TC_Assembly_Project-BrainFuckVM | 3f70a462d32550a833ac31995b10a8eff0dc24e6 | [
"WTFPL"
] | null | null | null | MEMORY_SIZE equ 1000
STACK_SIZE equ 1000
CODE_SIZE equ 1000
section .data
var_str_title db 'BrainF**k VM Writern by Nasm x64', 0
var_str_0 db 'Hello! Welecome to bf_asm vm.', 10, 0
var_str_1 db 'Your bf code is: ', 0
var_str_2 db 10, '--------------start--------------', 0
var_str_3 db '--------------stop---------------', 0
var_str_4 db 'Finished!', 0
var_str_5 db 'Please input corret argvs.', 0
var_test db 'test.bf', 0
code db '++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.', 0
;code db '++++++[>+++++[>+++<-]<-]>>.', 0
;code resb CODE_SIZE
memory resb MEMORY_SIZE ;The vm memory
stack resd STACK_SIZE ;
code_index dd 0
mery_index dd 0
stck_index dd 0
file_point dd 0, 0
f_read_sign db 'r' , 0
printf_format_d db '%d'
printf_format_c db '%c'
printf_format_s db '%s'
printf_format_s_CR db '%s', 10
section .text
extern printf
extern puts
extern getchar
extern putchar
extern MessageBoxA
extern fopen
extern fgets
global main
main:
push rbp
mov rbp, rsp
sub rsp, 48 ; x64 shadow stack
cmp ecx, 1
je buqdsh
mov rcx, var_str_5
call puts
jmp main_sub_end
buqdsh:
; call init_code
call init_hello ; print_hello
call init_memory ; initilize memory
call init_stack ; initilize stack
call prase ; start prase
mov rcx, var_str_3 ; print_stop_divider
call puts
mov ecx, 0 ; show_messagebox
mov rdx, var_str_4
mov r8, var_str_title
mov r9d, 0
call MessageBoxA
main_sub_end:
add rsp, 48
pop rbp
mov rax, 10 ; return 10
ret
main_end:
init_hello:
push rbp
mov rbp, rsp
sub rsp, 48
push rcx
mov rcx, var_str_0 ; print_hello
call puts
mov rcx, var_str_1
call puts
mov rcx, code
call puts
mov rcx, var_str_2
call puts
pop rcx
add rsp, 48
pop rbp
ret
init_memory: ; initilize memory - fill memory with 0
push rax
mov DWORD eax, MEMORY_SIZE
dec eax
nbl5ze:
cmp eax, 0
je nbl5ze_end
mov BYTE [-1 + rax + memory], 0
dec eax
jmp nbl5ze
nbl5ze_end:
pop rax
ret
init_stack: ; initilize stack - fill stack with 0
push rax
mov DWORD eax, STACK_SIZE
dec eax
bot40v:
cmp eax, 0
je bot40v_end
mov BYTE [-1 + rax + stack], 40
dec eax
jmp bot40v
bot40v_end:
pop rax
ret
init_code:
;TODO
push rbp
mov rbp, rsp
sub rsp, 1056
push rax
push rcx
push rdx
mov rax, rdx
add rax, 8
mov QWORD rax, [rax] ; rax <- argv[1]
mov rax, var_test
mov rdi, rax
mov rsi, f_read_sign
call fopen
; mov rdx, f_read_sign
; mov rcx, rax
; call fopen ; rax <- fopen(rax, "r");
; mov rdx, rax
; mov r8, rdx
; mov rax, code
; mov edx, CODE_SIZE
; mov rcx, code
; call fgets
; mov rcx, code
; call puts
pop rdx
pop rcx
pop rax
add rsp, 1056
pop rbp
ret
prase:
push rbp
mov rbp, rsp
sub rsp, 48
push rax
push rbx
start_prase_loop:
mov DWORD eax, [code_index]
mov BYTE bl, [eax + code]
cmp bl, '+'
je uv5u1q
jmp uv5u1q_end
uv5u1q:
call incr
uv5u1q_end:
cmp bl, '-'
je fidnke
jmp fidnke_end
fidnke:
call decr
fidnke_end:
cmp bl, '<'
je s2oxau
jmp s2oxau_end
s2oxau:
call prev
s2oxau_end:
cmp bl, '>'
je yvsvfr
jmp yvsvfr_end
yvsvfr:
call next
yvsvfr_end:
cmp bl, ','
je ruekup
jmp ruekup_end
ruekup:
call read
ruekup_end:
cmp bl, 46
je mestpk
jmp mestpk_end
mestpk:
call print
mestpk_end:
cmp bl, '['
je notvpc
jmp notvpc_end
notvpc:
call sloop
notvpc_end:
cmp bl, ']'
je trxtyo
jmp trxtyo_end
trxtyo:
call eloop
trxtyo_end:
cmp bl, 0
je end_parse_loop
jmp start_prase_loop
end_parse_loop:
pop rbx
pop rax
add rsp, 48
pop rbp
ret
next: ; >
push rax
mov DWORD eax, [mery_index]
inc eax
mov DWORD [mery_index], eax
inc DWORD [code_index]
pop rax
ret
prev: ; <
push rax
mov DWORD eax, [mery_index]
dec eax
mov DWORD [mery_index], eax
inc DWORD [code_index]
pop rax
ret
incr: ; +
push rax
mov DWORD eax, [mery_index]
inc BYTE [eax + memory]
inc DWORD [code_index]
pop rax
ret
decr: ; -
push rax
mov DWORD eax, [mery_index]
dec BYTE [eax + memory]
inc DWORD [code_index]
pop rax
ret
read: ; ,
push rbp
mov rbp, rsp
sub rsp, 48
push rax
push rbx
mov DWORD ebx, [mery_index]
call getchar
mov BYTE [ebx + memory], al
inc DWORD [code_index]
pop rbx
pop rax
add rsp, 48
pop rbp
ret
print: ; .
push rbp
mov rbp, rsp
sub rsp, 48
push rax
push rcx
mov DWORD eax, [mery_index]
mov BYTE ecx, [eax + memory]
call putchar
inc DWORD [code_index]
pop rcx
pop rax
add rsp, 48
pop rbp
ret
sloop: ; [
push rax
push rbx
inc DWORD [code_index]
inc DWORD [stck_index]
inc DWORD [stck_index]
inc DWORD [stck_index]
inc DWORD [stck_index]
mov DWORD eax, [stck_index]
mov DWORD ebx, [code_index]
mov DWORD [eax + stack], ebx
pop rbx
pop rax
ret
eloop: ; ]
push rax
push rbx
mov DWORD eax, [mery_index]
mov BYTE bl, [eax + memory]
cmp bl, 0
je loop_stop
jmp loop_continue
loop_continue:
mov DWORD eax, [stck_index]
mov DWORD eax, [eax + stack]
mov DWORD [code_index], eax
jmp pjczyt
loop_stop:
inc DWORD [code_index]
dec DWORD [stck_index]
dec DWORD [stck_index]
dec DWORD [stck_index]
dec DWORD [stck_index]
jmp pjczyt
pjczyt:
pop rbx
pop rax
ret
section .drectve info
db '/defaultlib:user32.lib /defaultlib:msvcrt.lib /defaultlib:legacy_stdio_definitions.lib ' | 22.792717 | 139 | 0.434558 |
c0c6b93c9a80befefb42f6c5084b377f1083a9f1 | 552 | asm | Assembly | oeis/017/A017811.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/017/A017811.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/017/A017811.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A017811: Binomial coefficients C(95,n).
; 1,95,4465,138415,3183545,57940519,869107785,11050084695,121550931645,1174992339235,10104934117421,78083581816435,546585072715045,3489735464257595,20439879147794485,110375347398090219,551876736990451095,2564603660132096265,11113282527239083815,45038039715653129145,171144550919481890751,611230538998149609825,2055957267539230505775,6525429588276688127025,19576288764830064381075,55596660092117382842253,149683315632623723036835,382524028838927292205245,928986927180251995355595
mov $1,95
bin $1,$0
mov $0,$1
| 78.857143 | 478 | 0.896739 |
6867421d0d2a5a671cd4e7a044adf29c42a25480 | 772 | asm | Assembly | 3-1-Assembly/hardware/4-2-sin.asm | Awdrtgg/Coursework-Projects | d48124b71e477f71b6370f5c3317c6800f8fdb06 | [
"MIT"
] | 3 | 2018-12-02T13:52:55.000Z | 2019-02-26T13:19:50.000Z | 3-1-Assembly/hardware/4-2-sin.asm | Awdrtgg/Coursework-Projects | d48124b71e477f71b6370f5c3317c6800f8fdb06 | [
"MIT"
] | null | null | null | 3-1-Assembly/hardware/4-2-sin.asm | Awdrtgg/Coursework-Projects | d48124b71e477f71b6370f5c3317c6800f8fdb06 | [
"MIT"
] | null | null | null | data segment
port dw 290h
mes0 db 'Start.',0dh,0ah,'$'
mes db 'Exit!$'
;正弦波数据表
sin db 80h,96h,0aeh,0c5h,0d8h,0e9h,0f5h,0fdh
db 0ffh,0fdh,0f5h,0e9h,0d8h,0c5h,0aeh,96h
db 80h,66h,4eh,38h,25h,15h,09h,04h
db 00h,04h,09h,15h,25h,38h,4eh,66h
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
lea dx,mes0
mov ah,09h
int 21h
lp:
lea si,sin
mov bh,32h
llp:
mov al,[si]
mov dx,port
out dx,al
;按键退出
mov ah,06h
mov dl,0ffh
int 21h
jne exit
mov cx,1
delay:loop delay;延时
inc si
dec bh
jne llp
jmp lp
exit:
lea dx,mes
mov ah,09h
int 21h
mov ah,4ch
int 21h
code ends
end start | 15.137255 | 54 | 0.55829 |
3bea58b2a9151911da983e0c5cf885185c1aef3e | 71 | asm | Assembly | tests/bonus/errors.asm | UPB-FILS-ALF/devoir-1-tests | 75ad3698f506329c609cdfe66e9fbeffe2ae03ad | [
"Apache-2.0"
] | null | null | null | tests/bonus/errors.asm | UPB-FILS-ALF/devoir-1-tests | 75ad3698f506329c609cdfe66e9fbeffe2ae03ad | [
"Apache-2.0"
] | null | null | null | tests/bonus/errors.asm | UPB-FILS-ALF/devoir-1-tests | 75ad3698f506329c609cdfe66e9fbeffe2ae03ad | [
"Apache-2.0"
] | 1 | 2021-03-25T10:58:49.000Z | 2021-03-25T10:58:49.000Z | read
push 1
write
push 1500
read
write
pop
push -1000
read
write
stack
| 5.916667 | 10 | 0.788732 |
7abc11e30f2e5a02e7c285d071971239f574caad | 2,522 | asm | Assembly | projects/test/test.asm | yupferris/msx-playground | 58661e2c092702812e58a86a1cd1ecbe3df6c667 | [
"MIT"
] | 3 | 2017-08-02T11:28:49.000Z | 2017-08-24T17:52:57.000Z | projects/test/test.asm | yupferris/msx-playground | 58661e2c092702812e58a86a1cd1ecbe3df6c667 | [
"MIT"
] | null | null | null | projects/test/test.asm | yupferris/msx-playground | 58661e2c092702812e58a86a1cd1ecbe3df6c667 | [
"MIT"
] | null | null | null | ; Empty ASCII mapping will give us default 1:1 mapping and suppress warnings
.asciitable
.enda
; Just treat mem as one big contiguous area starting at $100
; Basically max TOTAL_SIZE is going to be ~64kb minus $100 (eg. $fe00), but wla is going to output
; the entire bank even if we don't fill it, so it's best to keep TOTAL_SIZE small and increase it
; as needed to reduce load time for bytes we don't use.
.define TOTAL_SIZE $0200
.memorymap
defaultslot 0
slotsize TOTAL_SIZE
slot 0 $0100
.endme
.rombankmap
bankstotal 1
banksize TOTAL_SIZE
banks 1
.endro
; BDOS
.define BDOS $f37d
.define CONOUT $02
.define STROUT $09
.define FOPEN $0f
.define FCLOSE $10
.define SETDTA $1a
.define RDBLK $27
.define FCB $005c
entry:
; Load message from file
; Prepare unopened FCB
ld hl, FCB
; Drive number (0 = default)
ld a, 0
ld (hl), a
inc hl
; File name
ld de, message_file_name
ld b, 11
load_message_file_name_loop:
ld a, (de)
ld (hl), a
inc de
inc hl
djnz load_message_file_name_loop
; Open file
ld de, FCB
ld c, FOPEN
call BDOS
; Set DTA addr
; We'll use a random block read to read the whole file as one block, so we can just set this to our target addr
ld de, message
ld c, SETDTA
call BDOS
; Set record size to file size
; Since we can safely assume the file is less than 64kb bytes in size, we can just copy out the low two bytes of the file size
ld hl, (FCB + 16)
ld (FCB + 14), hl
; Clear random record
ld hl, 0
ld (FCB + 33), hl
ld (FCB + 35), hl
; Read record
; Here we read the entire message as one record
ld de, FCB
ld hl, 1
ld c, RDBLK
call BDOS
; Close file
ld de, FCB
ld c, FCLOSE
call BDOS
; Write out message
ld de, message
ld c, STROUT
call BDOS
; Disable interrupts (otherwise our VDP I/O could get screwed due to internal index flip flops)
di
; Set bg/fg colors to color 0
ld a, 0
out ($99), a
ld a, $07 | $80
out ($99), a
main_loop:
; Set color number to zero (we'll overwrite this color)
ld a, 0
out ($99), a
ld a, $10 | $80
out ($99), a
; Output next color and increment color value
ld hl, color_value
ld a, (hl)
out ($9a), a
out ($9a), a
inc (hl)
jr main_loop
message_file_name:
; ***********
.asc "MESSAGE "
color_value:
.db $00
message: ; Will be read from file
| 20.176 | 132 | 0.622522 |
f477508bbd29711efc7b5b63aba362832602881e | 1,807 | asm | Assembly | programs/oeis/084/A084173.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/084/A084173.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/084/A084173.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A084173: a(n) = 3*a(n-1) - a(n-2) - 3*a(n-3) + 2*a(n-4).
; 1,3,5,13,27,59,121,249,503,1015,2037,4085,8179,16371,32753,65521,131055,262127,524269,1048557,2097131,4194283,8388585,16777193,33554407,67108839,134217701,268435429,536870883,1073741795,2147483617,4294967265,8589934559,17179869151,34359738333,68719476701,137438953435,274877906907,549755813849,1099511627737,2199023255511,4398046511063,8796093022165,17592186044373,35184372088787,70368744177619,140737488355281,281474976710609,562949953421263,1125899906842575,2251799813685197,4503599627370445,9007199254740939,18014398509481931,36028797018963913,72057594037927881,144115188075855815,288230376151711687,576460752303423429,1152921504606846917,2305843009213693891,4611686018427387843,9223372036854775745,18446744073709551553,36893488147419103167,73786976294838206399,147573952589676412861,295147905179352825789,590295810358705651643,1180591620717411303355,2361183241434822606777,4722366482869645213625,9444732965739290427319,18889465931478580854711,37778931862957161709493,75557863725914323419061,151115727451828646838195,302231454903657293676467,604462909807314587353009,1208925819614629174706097,2417851639229258349412271,4835703278458516698824623,9671406556917033397649325,19342813113834066795298733,38685626227668133590597547,77371252455336267181195179,154742504910672534362390441,309485009821345068724780969,618970019642690137449562023,1237940039285380274899124135,2475880078570760549798248357,4951760157141521099596496805,9903520314283042199192993699,19807040628566084398385987491,39614081257132168796771975073,79228162514264337593543950241,158456325028528675187087900575,316912650057057350374175801247,633825300114114700748351602589,1267650600228229401496703205277
mov $1,2
pow $1,$0
div $0,2
sub $1,$0
sub $1,1
mul $1,2
add $1,1
mov $0,$1
| 150.583333 | 1,671 | 0.904261 |
f1b84a26c5bcee3ced83cb00c87ed2b6758943bc | 3,019 | asm | Assembly | scripts/payload/payload/payload.asm | fengjixuchui/blazefox | d5c732ac7305a79fe20704c2d134c130f14eca83 | [
"MIT"
] | 149 | 2018-12-23T09:08:00.000Z | 2022-02-02T09:18:38.000Z | scripts/payload/payload/payload.asm | fengjixuchui/blazefox | d5c732ac7305a79fe20704c2d134c130f14eca83 | [
"MIT"
] | null | null | null | scripts/payload/payload/payload.asm | fengjixuchui/blazefox | d5c732ac7305a79fe20704c2d134c130f14eca83 | [
"MIT"
] | 56 | 2018-12-23T18:11:40.000Z | 2021-11-30T13:18:17.000Z | .code
public payload
payload:
int 3
push rax
push rbx
push rcx
push rdx
push rbp
push rsi
push rdi
push r8
push r9
push r10
push r11
push r12
push r13
push r14
push r15
mov r11,rsp
sub rsp,010h
sub rsp,070h
sub rsp,070h
and sp,0fff0h
mov eax,0636c6163h
mov dword ptr [rsp], eax
mov byte ptr [rsp+4], 00h
xor eax,eax
mov qword ptr [r11+8],rbx
lea rdi,[r11-78h]
mov qword ptr [r11+10h],rsi
mov ecx,68h
xor ebp,ebp
rep stos byte ptr [rdi]
mov byte ptr [rsp+70h],68h
mov eax,060h
mov rax,qword ptr gs:[eax]
mov rcx,qword ptr [rax+18h]
mov r8,qword ptr [rcx+10h]
mov rdi,qword ptr [r8+60h]
mov r9,rdi
_00007ff6559b1047: test rdi,rdi
je _00007ff6559b107c
movzx ecx,word ptr [rdi]
mov eax,1505h
mov edx,ebp
test cx,cx
je _00007ff6559b107c
nop dword ptr [rax+rax]
_00007ff6559b1060: movzx ecx,cx
inc edx
imul eax,eax,21h
add eax,ecx
mov ecx,edx
movzx ecx,word ptr [rdi+rdx*2]
test cx,cx
jne _00007ff6559b1060
cmp eax,6DDB9555h
je _00007ff6559b10ae
_00007ff6559b107c: mov r8,qword ptr [r8]
mov rdi,qword ptr [r8+60h]
cmp rdi,r9
jne _00007ff6559b1047
_00007ff6559b1088: mov eax,1
_00007ff6559b108d: lea rsp,[rsp+070h]
add rsp,070h
add rsp,018h
pop r15
pop r14
pop r13
pop r12
pop r11
pop r9
pop r8
pop rdi
pop rsi
pop rbp
pop rdx
pop rcx
pop rbx
pop rax
ret
_00007ff6559b10ae: mov r10,qword ptr [r8+30h]
test r10,r10
je _00007ff6559b1088
movsxd rax,dword ptr [r10+3Ch]
lea rcx,[rax+r10]
add rcx,070h
add rcx,018h
mov ecx,dword ptr [rcx]
test ecx,ecx
je _00007ff6559b1088
mov r9d,dword ptr [r10+rcx+20h]
lea rax,[r10+rcx]
mov ebx,dword ptr [rax+24h]
add r9,r10
mov esi,dword ptr [rax+1Ch]
add rbx,r10
mov r11d,dword ptr [rax+18h]
add rsi,r10
mov r8d,ebp
test r11d,r11d
je _00007ff6559b1088
nop dword ptr [rax+rax]
_00007ff6559b10f0: mov edi,dword ptr [r9]
mov ecx,1505h
add rdi,r10
mov edx,ebp
movzx eax,byte ptr [rdi]
test al,al
je _00007ff6559b1120
_00007ff6559b1104: movsx eax,al
inc edx
imul ecx,ecx,21h
add ecx,eax
mov eax,edx
movzx eax,byte ptr [rdx+rdi]
test al,al
jne _00007ff6559b1104
push rax
mov rax, rcx
cmp eax, 0AEB52E19h
pop rax
;cmp ecx,0AEB52E19h
je _00007ff6559b1131
_00007ff6559b1120: inc r8d
add r9,4
cmp r8d,r11d
jb _00007ff6559b10f0
jmp _00007ff6559b1088
_00007ff6559b1131: mov eax,r8d
movzx ecx,word ptr [rbx+rax*2]
mov eax,dword ptr [rsi+rcx*4]
add rax,r10
je _00007ff6559b1088
lea rcx,[rsp+010h]
xor r9d,r9d
mov qword ptr [rsp+48h],rcx
lea rdx,[rsp]
lea rcx,[rsp+70h]
add rcx,10h
xor r8d,r8d
mov qword ptr [rsp+40h],rcx
xor ecx,ecx
mov qword ptr [rsp+38h],rbp
mov qword ptr [rsp+30h],rbp
mov dword ptr [rsp+28h],ebp
mov dword ptr [rsp+20h],ebp
call rax
xor eax,eax
jmp _00007ff6559b108d
end | 19.603896 | 49 | 0.660815 |
958a81c78307abc5e43c565b2749690ea1fc2890 | 61,352 | asm | Assembly | test_sleep.asm | tphan022/AssignmentTestCases | 3a8894d70a95f061ef629cb53bbdc0aaadc50b99 | [
"MIT-0"
] | null | null | null | test_sleep.asm | tphan022/AssignmentTestCases | 3a8894d70a95f061ef629cb53bbdc0aaadc50b99 | [
"MIT-0"
] | null | null | null | test_sleep.asm | tphan022/AssignmentTestCases | 3a8894d70a95f061ef629cb53bbdc0aaadc50b99 | [
"MIT-0"
] | null | null | null |
_test_sleep: file format elf32-i386
Disassembly of section .text:
00001000 <main>:
int total;
}ttable;
void func(void *arg_ptr);
int main(int argc, char *argv[]){
1000: 55 push %ebp
1001: 89 e5 mov %esp,%ebp
1003: 83 e4 f0 and $0xfffffff0,%esp
1006: 83 ec 20 sub $0x20,%esp
struct thread * t;
int i;
printf(1,"init ttable\n");
1009: c7 44 24 04 f4 1b 00 movl $0x1bf4,0x4(%esp)
1010: 00
1011: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1018: e8 c8 05 00 00 call 15e5 <printf>
lock_init(&ttable.lock);
101d: c7 04 24 00 1d 00 00 movl $0x1d00,(%esp)
1024: e8 9d 09 00 00 call 19c6 <lock_init>
ttable.total = 0;
1029: c7 05 04 1e 00 00 00 movl $0x0,0x1e04
1030: 00 00 00
lock_acquire(&ttable.lock);
1033: c7 04 24 00 1d 00 00 movl $0x1d00,(%esp)
103a: e8 95 09 00 00 call 19d4 <lock_acquire>
for(t=ttable.threads;t < &ttable.threads[64];t++){
103f: c7 44 24 14 04 1d 00 movl $0x1d04,0x14(%esp)
1046: 00
1047: eb 0f jmp 1058 <main+0x58>
t->tid = 0;
1049: 8b 44 24 14 mov 0x14(%esp),%eax
104d: c7 00 00 00 00 00 movl $0x0,(%eax)
printf(1,"init ttable\n");
lock_init(&ttable.lock);
ttable.total = 0;
lock_acquire(&ttable.lock);
for(t=ttable.threads;t < &ttable.threads[64];t++){
1053: 83 44 24 14 04 addl $0x4,0x14(%esp)
1058: b8 04 1e 00 00 mov $0x1e04,%eax
105d: 39 44 24 14 cmp %eax,0x14(%esp)
1061: 72 e6 jb 1049 <main+0x49>
t->tid = 0;
}
lock_release(&ttable.lock);
1063: c7 04 24 00 1d 00 00 movl $0x1d00,(%esp)
106a: e8 84 09 00 00 call 19f3 <lock_release>
printf(1,"testing thread sleep and wakeup \n\n\n");
106f: c7 44 24 04 04 1c 00 movl $0x1c04,0x4(%esp)
1076: 00
1077: c7 04 24 01 00 00 00 movl $0x1,(%esp)
107e: e8 62 05 00 00 call 15e5 <printf>
void *stack = thread_create(func,0);
1083: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
108a: 00
108b: c7 04 24 6c 11 00 00 movl $0x116c,(%esp)
1092: e8 77 09 00 00 call 1a0e <thread_create>
1097: 89 44 24 1c mov %eax,0x1c(%esp)
thread_create(func,0);
109b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
10a2: 00
10a3: c7 04 24 6c 11 00 00 movl $0x116c,(%esp)
10aa: e8 5f 09 00 00 call 1a0e <thread_create>
thread_create(func,0);
10af: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
10b6: 00
10b7: c7 04 24 6c 11 00 00 movl $0x116c,(%esp)
10be: e8 4b 09 00 00 call 1a0e <thread_create>
i=0;
10c3: c7 44 24 18 00 00 00 movl $0x0,0x18(%esp)
10ca: 00
while(i++ < 1000000);
10cb: 81 7c 24 18 3f 42 0f cmpl $0xf423f,0x18(%esp)
10d2: 00
10d3: 0f 9e c0 setle %al
10d6: 83 44 24 18 01 addl $0x1,0x18(%esp)
10db: 84 c0 test %al,%al
10dd: 75 ec jne 10cb <main+0xcb>
//find that thread
lock_acquire(&ttable.lock);
10df: c7 04 24 00 1d 00 00 movl $0x1d00,(%esp)
10e6: e8 e9 08 00 00 call 19d4 <lock_acquire>
for(t=ttable.threads;t < &ttable.threads[64];t++){
10eb: c7 44 24 14 04 1d 00 movl $0x1d04,0x14(%esp)
10f2: 00
10f3: eb 40 jmp 1135 <main+0x135>
if(t->tid != 0){
10f5: 8b 44 24 14 mov 0x14(%esp),%eax
10f9: 8b 00 mov (%eax),%eax
10fb: 85 c0 test %eax,%eax
10fd: 74 31 je 1130 <main+0x130>
printf(1,"found one... %d, wake up lazy boy !!!\n",t->tid);
10ff: 8b 44 24 14 mov 0x14(%esp),%eax
1103: 8b 00 mov (%eax),%eax
1105: 89 44 24 08 mov %eax,0x8(%esp)
1109: c7 44 24 04 28 1c 00 movl $0x1c28,0x4(%esp)
1110: 00
1111: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1118: e8 c8 04 00 00 call 15e5 <printf>
twakeup(t->tid);
111d: 8b 44 24 14 mov 0x14(%esp),%eax
1121: 8b 00 mov (%eax),%eax
1123: 89 04 24 mov %eax,(%esp)
1126: e8 d9 03 00 00 call 1504 <twakeup>
i++;
112b: 83 44 24 18 01 addl $0x1,0x18(%esp)
i=0;
while(i++ < 1000000);
//find that thread
lock_acquire(&ttable.lock);
for(t=ttable.threads;t < &ttable.threads[64];t++){
1130: 83 44 24 14 04 addl $0x4,0x14(%esp)
1135: b8 04 1e 00 00 mov $0x1e04,%eax
113a: 39 44 24 14 cmp %eax,0x14(%esp)
113e: 72 b5 jb 10f5 <main+0xf5>
printf(1,"found one... %d, wake up lazy boy !!!\n",t->tid);
twakeup(t->tid);
i++;
}
}
lock_release(&ttable.lock);
1140: c7 04 24 00 1d 00 00 movl $0x1d00,(%esp)
1147: e8 a7 08 00 00 call 19f3 <lock_release>
wait();
114c: e8 03 03 00 00 call 1454 <wait>
wait();
1151: e8 fe 02 00 00 call 1454 <wait>
wait();
1156: e8 f9 02 00 00 call 1454 <wait>
free(stack);
115b: 8b 44 24 1c mov 0x1c(%esp),%eax
115f: 89 04 24 mov %eax,(%esp)
1162: e8 35 06 00 00 call 179c <free>
exit();
1167: e8 e0 02 00 00 call 144c <exit>
0000116c <func>:
}
void func(void *arg_ptr){
116c: 55 push %ebp
116d: 89 e5 mov %esp,%ebp
116f: 83 ec 28 sub $0x28,%esp
int tid;
tid = getpid();
1172: e8 55 03 00 00 call 14cc <getpid>
1177: 89 45 f4 mov %eax,-0xc(%ebp)
lock_acquire(&ttable.lock);
117a: c7 04 24 00 1d 00 00 movl $0x1d00,(%esp)
1181: e8 4e 08 00 00 call 19d4 <lock_acquire>
(ttable.threads[ttable.total]).tid = tid;
1186: a1 04 1e 00 00 mov 0x1e04,%eax
118b: 8b 55 f4 mov -0xc(%ebp),%edx
118e: 89 14 85 04 1d 00 00 mov %edx,0x1d04(,%eax,4)
ttable.total++;
1195: a1 04 1e 00 00 mov 0x1e04,%eax
119a: 83 c0 01 add $0x1,%eax
119d: a3 04 1e 00 00 mov %eax,0x1e04
lock_release(&ttable.lock);
11a2: c7 04 24 00 1d 00 00 movl $0x1d00,(%esp)
11a9: e8 45 08 00 00 call 19f3 <lock_release>
printf(1,"I am thread %d, is about to sleep\n",tid);
11ae: 8b 45 f4 mov -0xc(%ebp),%eax
11b1: 89 44 24 08 mov %eax,0x8(%esp)
11b5: c7 44 24 04 54 1c 00 movl $0x1c54,0x4(%esp)
11bc: 00
11bd: c7 04 24 01 00 00 00 movl $0x1,(%esp)
11c4: e8 1c 04 00 00 call 15e5 <printf>
tsleep();
11c9: e8 2e 03 00 00 call 14fc <tsleep>
printf(1,"I am wake up!\n");
11ce: c7 44 24 04 77 1c 00 movl $0x1c77,0x4(%esp)
11d5: 00
11d6: c7 04 24 01 00 00 00 movl $0x1,(%esp)
11dd: e8 03 04 00 00 call 15e5 <printf>
texit();
11e2: e8 0d 03 00 00 call 14f4 <texit>
11e7: 90 nop
000011e8 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
11e8: 55 push %ebp
11e9: 89 e5 mov %esp,%ebp
11eb: 57 push %edi
11ec: 53 push %ebx
asm volatile("cld; rep stosb" :
11ed: 8b 4d 08 mov 0x8(%ebp),%ecx
11f0: 8b 55 10 mov 0x10(%ebp),%edx
11f3: 8b 45 0c mov 0xc(%ebp),%eax
11f6: 89 cb mov %ecx,%ebx
11f8: 89 df mov %ebx,%edi
11fa: 89 d1 mov %edx,%ecx
11fc: fc cld
11fd: f3 aa rep stos %al,%es:(%edi)
11ff: 89 ca mov %ecx,%edx
1201: 89 fb mov %edi,%ebx
1203: 89 5d 08 mov %ebx,0x8(%ebp)
1206: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
1209: 5b pop %ebx
120a: 5f pop %edi
120b: 5d pop %ebp
120c: c3 ret
0000120d <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
120d: 55 push %ebp
120e: 89 e5 mov %esp,%ebp
1210: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
1213: 8b 45 08 mov 0x8(%ebp),%eax
1216: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
1219: 8b 45 0c mov 0xc(%ebp),%eax
121c: 0f b6 10 movzbl (%eax),%edx
121f: 8b 45 08 mov 0x8(%ebp),%eax
1222: 88 10 mov %dl,(%eax)
1224: 8b 45 08 mov 0x8(%ebp),%eax
1227: 0f b6 00 movzbl (%eax),%eax
122a: 84 c0 test %al,%al
122c: 0f 95 c0 setne %al
122f: 83 45 08 01 addl $0x1,0x8(%ebp)
1233: 83 45 0c 01 addl $0x1,0xc(%ebp)
1237: 84 c0 test %al,%al
1239: 75 de jne 1219 <strcpy+0xc>
;
return os;
123b: 8b 45 fc mov -0x4(%ebp),%eax
}
123e: c9 leave
123f: c3 ret
00001240 <strcmp>:
int
strcmp(const char *p, const char *q)
{
1240: 55 push %ebp
1241: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
1243: eb 08 jmp 124d <strcmp+0xd>
p++, q++;
1245: 83 45 08 01 addl $0x1,0x8(%ebp)
1249: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
124d: 8b 45 08 mov 0x8(%ebp),%eax
1250: 0f b6 00 movzbl (%eax),%eax
1253: 84 c0 test %al,%al
1255: 74 10 je 1267 <strcmp+0x27>
1257: 8b 45 08 mov 0x8(%ebp),%eax
125a: 0f b6 10 movzbl (%eax),%edx
125d: 8b 45 0c mov 0xc(%ebp),%eax
1260: 0f b6 00 movzbl (%eax),%eax
1263: 38 c2 cmp %al,%dl
1265: 74 de je 1245 <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
1267: 8b 45 08 mov 0x8(%ebp),%eax
126a: 0f b6 00 movzbl (%eax),%eax
126d: 0f b6 d0 movzbl %al,%edx
1270: 8b 45 0c mov 0xc(%ebp),%eax
1273: 0f b6 00 movzbl (%eax),%eax
1276: 0f b6 c0 movzbl %al,%eax
1279: 89 d1 mov %edx,%ecx
127b: 29 c1 sub %eax,%ecx
127d: 89 c8 mov %ecx,%eax
}
127f: 5d pop %ebp
1280: c3 ret
00001281 <strlen>:
uint
strlen(char *s)
{
1281: 55 push %ebp
1282: 89 e5 mov %esp,%ebp
1284: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
1287: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
128e: eb 04 jmp 1294 <strlen+0x13>
1290: 83 45 fc 01 addl $0x1,-0x4(%ebp)
1294: 8b 45 fc mov -0x4(%ebp),%eax
1297: 03 45 08 add 0x8(%ebp),%eax
129a: 0f b6 00 movzbl (%eax),%eax
129d: 84 c0 test %al,%al
129f: 75 ef jne 1290 <strlen+0xf>
;
return n;
12a1: 8b 45 fc mov -0x4(%ebp),%eax
}
12a4: c9 leave
12a5: c3 ret
000012a6 <memset>:
void*
memset(void *dst, int c, uint n)
{
12a6: 55 push %ebp
12a7: 89 e5 mov %esp,%ebp
12a9: 83 ec 0c sub $0xc,%esp
stosb(dst, c, n);
12ac: 8b 45 10 mov 0x10(%ebp),%eax
12af: 89 44 24 08 mov %eax,0x8(%esp)
12b3: 8b 45 0c mov 0xc(%ebp),%eax
12b6: 89 44 24 04 mov %eax,0x4(%esp)
12ba: 8b 45 08 mov 0x8(%ebp),%eax
12bd: 89 04 24 mov %eax,(%esp)
12c0: e8 23 ff ff ff call 11e8 <stosb>
return dst;
12c5: 8b 45 08 mov 0x8(%ebp),%eax
}
12c8: c9 leave
12c9: c3 ret
000012ca <strchr>:
char*
strchr(const char *s, char c)
{
12ca: 55 push %ebp
12cb: 89 e5 mov %esp,%ebp
12cd: 83 ec 04 sub $0x4,%esp
12d0: 8b 45 0c mov 0xc(%ebp),%eax
12d3: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
12d6: eb 14 jmp 12ec <strchr+0x22>
if(*s == c)
12d8: 8b 45 08 mov 0x8(%ebp),%eax
12db: 0f b6 00 movzbl (%eax),%eax
12de: 3a 45 fc cmp -0x4(%ebp),%al
12e1: 75 05 jne 12e8 <strchr+0x1e>
return (char*)s;
12e3: 8b 45 08 mov 0x8(%ebp),%eax
12e6: eb 13 jmp 12fb <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
12e8: 83 45 08 01 addl $0x1,0x8(%ebp)
12ec: 8b 45 08 mov 0x8(%ebp),%eax
12ef: 0f b6 00 movzbl (%eax),%eax
12f2: 84 c0 test %al,%al
12f4: 75 e2 jne 12d8 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
12f6: b8 00 00 00 00 mov $0x0,%eax
}
12fb: c9 leave
12fc: c3 ret
000012fd <gets>:
char*
gets(char *buf, int max)
{
12fd: 55 push %ebp
12fe: 89 e5 mov %esp,%ebp
1300: 83 ec 28 sub $0x28,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
1303: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
130a: eb 44 jmp 1350 <gets+0x53>
cc = read(0, &c, 1);
130c: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
1313: 00
1314: 8d 45 ef lea -0x11(%ebp),%eax
1317: 89 44 24 04 mov %eax,0x4(%esp)
131b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1322: e8 3d 01 00 00 call 1464 <read>
1327: 89 45 f4 mov %eax,-0xc(%ebp)
if(cc < 1)
132a: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
132e: 7e 2d jle 135d <gets+0x60>
break;
buf[i++] = c;
1330: 8b 45 f0 mov -0x10(%ebp),%eax
1333: 03 45 08 add 0x8(%ebp),%eax
1336: 0f b6 55 ef movzbl -0x11(%ebp),%edx
133a: 88 10 mov %dl,(%eax)
133c: 83 45 f0 01 addl $0x1,-0x10(%ebp)
if(c == '\n' || c == '\r')
1340: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1344: 3c 0a cmp $0xa,%al
1346: 74 16 je 135e <gets+0x61>
1348: 0f b6 45 ef movzbl -0x11(%ebp),%eax
134c: 3c 0d cmp $0xd,%al
134e: 74 0e je 135e <gets+0x61>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
1350: 8b 45 f0 mov -0x10(%ebp),%eax
1353: 83 c0 01 add $0x1,%eax
1356: 3b 45 0c cmp 0xc(%ebp),%eax
1359: 7c b1 jl 130c <gets+0xf>
135b: eb 01 jmp 135e <gets+0x61>
cc = read(0, &c, 1);
if(cc < 1)
break;
135d: 90 nop
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
135e: 8b 45 f0 mov -0x10(%ebp),%eax
1361: 03 45 08 add 0x8(%ebp),%eax
1364: c6 00 00 movb $0x0,(%eax)
return buf;
1367: 8b 45 08 mov 0x8(%ebp),%eax
}
136a: c9 leave
136b: c3 ret
0000136c <stat>:
int
stat(char *n, struct stat *st)
{
136c: 55 push %ebp
136d: 89 e5 mov %esp,%ebp
136f: 83 ec 28 sub $0x28,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
1372: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1379: 00
137a: 8b 45 08 mov 0x8(%ebp),%eax
137d: 89 04 24 mov %eax,(%esp)
1380: e8 07 01 00 00 call 148c <open>
1385: 89 45 f0 mov %eax,-0x10(%ebp)
if(fd < 0)
1388: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
138c: 79 07 jns 1395 <stat+0x29>
return -1;
138e: b8 ff ff ff ff mov $0xffffffff,%eax
1393: eb 23 jmp 13b8 <stat+0x4c>
r = fstat(fd, st);
1395: 8b 45 0c mov 0xc(%ebp),%eax
1398: 89 44 24 04 mov %eax,0x4(%esp)
139c: 8b 45 f0 mov -0x10(%ebp),%eax
139f: 89 04 24 mov %eax,(%esp)
13a2: e8 fd 00 00 00 call 14a4 <fstat>
13a7: 89 45 f4 mov %eax,-0xc(%ebp)
close(fd);
13aa: 8b 45 f0 mov -0x10(%ebp),%eax
13ad: 89 04 24 mov %eax,(%esp)
13b0: e8 bf 00 00 00 call 1474 <close>
return r;
13b5: 8b 45 f4 mov -0xc(%ebp),%eax
}
13b8: c9 leave
13b9: c3 ret
000013ba <atoi>:
int
atoi(const char *s)
{
13ba: 55 push %ebp
13bb: 89 e5 mov %esp,%ebp
13bd: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
13c0: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
13c7: eb 24 jmp 13ed <atoi+0x33>
n = n*10 + *s++ - '0';
13c9: 8b 55 fc mov -0x4(%ebp),%edx
13cc: 89 d0 mov %edx,%eax
13ce: c1 e0 02 shl $0x2,%eax
13d1: 01 d0 add %edx,%eax
13d3: 01 c0 add %eax,%eax
13d5: 89 c2 mov %eax,%edx
13d7: 8b 45 08 mov 0x8(%ebp),%eax
13da: 0f b6 00 movzbl (%eax),%eax
13dd: 0f be c0 movsbl %al,%eax
13e0: 8d 04 02 lea (%edx,%eax,1),%eax
13e3: 83 e8 30 sub $0x30,%eax
13e6: 89 45 fc mov %eax,-0x4(%ebp)
13e9: 83 45 08 01 addl $0x1,0x8(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
13ed: 8b 45 08 mov 0x8(%ebp),%eax
13f0: 0f b6 00 movzbl (%eax),%eax
13f3: 3c 2f cmp $0x2f,%al
13f5: 7e 0a jle 1401 <atoi+0x47>
13f7: 8b 45 08 mov 0x8(%ebp),%eax
13fa: 0f b6 00 movzbl (%eax),%eax
13fd: 3c 39 cmp $0x39,%al
13ff: 7e c8 jle 13c9 <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
1401: 8b 45 fc mov -0x4(%ebp),%eax
}
1404: c9 leave
1405: c3 ret
00001406 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
1406: 55 push %ebp
1407: 89 e5 mov %esp,%ebp
1409: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
140c: 8b 45 08 mov 0x8(%ebp),%eax
140f: 89 45 f8 mov %eax,-0x8(%ebp)
src = vsrc;
1412: 8b 45 0c mov 0xc(%ebp),%eax
1415: 89 45 fc mov %eax,-0x4(%ebp)
while(n-- > 0)
1418: eb 13 jmp 142d <memmove+0x27>
*dst++ = *src++;
141a: 8b 45 fc mov -0x4(%ebp),%eax
141d: 0f b6 10 movzbl (%eax),%edx
1420: 8b 45 f8 mov -0x8(%ebp),%eax
1423: 88 10 mov %dl,(%eax)
1425: 83 45 f8 01 addl $0x1,-0x8(%ebp)
1429: 83 45 fc 01 addl $0x1,-0x4(%ebp)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
142d: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
1431: 0f 9f c0 setg %al
1434: 83 6d 10 01 subl $0x1,0x10(%ebp)
1438: 84 c0 test %al,%al
143a: 75 de jne 141a <memmove+0x14>
*dst++ = *src++;
return vdst;
143c: 8b 45 08 mov 0x8(%ebp),%eax
}
143f: c9 leave
1440: c3 ret
1441: 90 nop
1442: 90 nop
1443: 90 nop
00001444 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
1444: b8 01 00 00 00 mov $0x1,%eax
1449: cd 40 int $0x40
144b: c3 ret
0000144c <exit>:
SYSCALL(exit)
144c: b8 02 00 00 00 mov $0x2,%eax
1451: cd 40 int $0x40
1453: c3 ret
00001454 <wait>:
SYSCALL(wait)
1454: b8 03 00 00 00 mov $0x3,%eax
1459: cd 40 int $0x40
145b: c3 ret
0000145c <pipe>:
SYSCALL(pipe)
145c: b8 04 00 00 00 mov $0x4,%eax
1461: cd 40 int $0x40
1463: c3 ret
00001464 <read>:
SYSCALL(read)
1464: b8 05 00 00 00 mov $0x5,%eax
1469: cd 40 int $0x40
146b: c3 ret
0000146c <write>:
SYSCALL(write)
146c: b8 10 00 00 00 mov $0x10,%eax
1471: cd 40 int $0x40
1473: c3 ret
00001474 <close>:
SYSCALL(close)
1474: b8 15 00 00 00 mov $0x15,%eax
1479: cd 40 int $0x40
147b: c3 ret
0000147c <kill>:
SYSCALL(kill)
147c: b8 06 00 00 00 mov $0x6,%eax
1481: cd 40 int $0x40
1483: c3 ret
00001484 <exec>:
SYSCALL(exec)
1484: b8 07 00 00 00 mov $0x7,%eax
1489: cd 40 int $0x40
148b: c3 ret
0000148c <open>:
SYSCALL(open)
148c: b8 0f 00 00 00 mov $0xf,%eax
1491: cd 40 int $0x40
1493: c3 ret
00001494 <mknod>:
SYSCALL(mknod)
1494: b8 11 00 00 00 mov $0x11,%eax
1499: cd 40 int $0x40
149b: c3 ret
0000149c <unlink>:
SYSCALL(unlink)
149c: b8 12 00 00 00 mov $0x12,%eax
14a1: cd 40 int $0x40
14a3: c3 ret
000014a4 <fstat>:
SYSCALL(fstat)
14a4: b8 08 00 00 00 mov $0x8,%eax
14a9: cd 40 int $0x40
14ab: c3 ret
000014ac <link>:
SYSCALL(link)
14ac: b8 13 00 00 00 mov $0x13,%eax
14b1: cd 40 int $0x40
14b3: c3 ret
000014b4 <mkdir>:
SYSCALL(mkdir)
14b4: b8 14 00 00 00 mov $0x14,%eax
14b9: cd 40 int $0x40
14bb: c3 ret
000014bc <chdir>:
SYSCALL(chdir)
14bc: b8 09 00 00 00 mov $0x9,%eax
14c1: cd 40 int $0x40
14c3: c3 ret
000014c4 <dup>:
SYSCALL(dup)
14c4: b8 0a 00 00 00 mov $0xa,%eax
14c9: cd 40 int $0x40
14cb: c3 ret
000014cc <getpid>:
SYSCALL(getpid)
14cc: b8 0b 00 00 00 mov $0xb,%eax
14d1: cd 40 int $0x40
14d3: c3 ret
000014d4 <sbrk>:
SYSCALL(sbrk)
14d4: b8 0c 00 00 00 mov $0xc,%eax
14d9: cd 40 int $0x40
14db: c3 ret
000014dc <sleep>:
SYSCALL(sleep)
14dc: b8 0d 00 00 00 mov $0xd,%eax
14e1: cd 40 int $0x40
14e3: c3 ret
000014e4 <uptime>:
SYSCALL(uptime)
14e4: b8 0e 00 00 00 mov $0xe,%eax
14e9: cd 40 int $0x40
14eb: c3 ret
000014ec <clone>:
SYSCALL(clone)
14ec: b8 16 00 00 00 mov $0x16,%eax
14f1: cd 40 int $0x40
14f3: c3 ret
000014f4 <texit>:
SYSCALL(texit)
14f4: b8 17 00 00 00 mov $0x17,%eax
14f9: cd 40 int $0x40
14fb: c3 ret
000014fc <tsleep>:
SYSCALL(tsleep)
14fc: b8 18 00 00 00 mov $0x18,%eax
1501: cd 40 int $0x40
1503: c3 ret
00001504 <twakeup>:
SYSCALL(twakeup)
1504: b8 19 00 00 00 mov $0x19,%eax
1509: cd 40 int $0x40
150b: c3 ret
0000150c <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
150c: 55 push %ebp
150d: 89 e5 mov %esp,%ebp
150f: 83 ec 28 sub $0x28,%esp
1512: 8b 45 0c mov 0xc(%ebp),%eax
1515: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
1518: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
151f: 00
1520: 8d 45 f4 lea -0xc(%ebp),%eax
1523: 89 44 24 04 mov %eax,0x4(%esp)
1527: 8b 45 08 mov 0x8(%ebp),%eax
152a: 89 04 24 mov %eax,(%esp)
152d: e8 3a ff ff ff call 146c <write>
}
1532: c9 leave
1533: c3 ret
00001534 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
1534: 55 push %ebp
1535: 89 e5 mov %esp,%ebp
1537: 53 push %ebx
1538: 83 ec 44 sub $0x44,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
153b: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
1542: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
1546: 74 17 je 155f <printint+0x2b>
1548: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
154c: 79 11 jns 155f <printint+0x2b>
neg = 1;
154e: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
1555: 8b 45 0c mov 0xc(%ebp),%eax
1558: f7 d8 neg %eax
155a: 89 45 f4 mov %eax,-0xc(%ebp)
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
155d: eb 06 jmp 1565 <printint+0x31>
neg = 1;
x = -xx;
} else {
x = xx;
155f: 8b 45 0c mov 0xc(%ebp),%eax
1562: 89 45 f4 mov %eax,-0xc(%ebp)
}
i = 0;
1565: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
do{
buf[i++] = digits[x % base];
156c: 8b 4d ec mov -0x14(%ebp),%ecx
156f: 8b 5d 10 mov 0x10(%ebp),%ebx
1572: 8b 45 f4 mov -0xc(%ebp),%eax
1575: ba 00 00 00 00 mov $0x0,%edx
157a: f7 f3 div %ebx
157c: 89 d0 mov %edx,%eax
157e: 0f b6 80 bc 1c 00 00 movzbl 0x1cbc(%eax),%eax
1585: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
1589: 83 45 ec 01 addl $0x1,-0x14(%ebp)
}while((x /= base) != 0);
158d: 8b 45 10 mov 0x10(%ebp),%eax
1590: 89 45 d4 mov %eax,-0x2c(%ebp)
1593: 8b 45 f4 mov -0xc(%ebp),%eax
1596: ba 00 00 00 00 mov $0x0,%edx
159b: f7 75 d4 divl -0x2c(%ebp)
159e: 89 45 f4 mov %eax,-0xc(%ebp)
15a1: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
15a5: 75 c5 jne 156c <printint+0x38>
if(neg)
15a7: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
15ab: 74 28 je 15d5 <printint+0xa1>
buf[i++] = '-';
15ad: 8b 45 ec mov -0x14(%ebp),%eax
15b0: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
15b5: 83 45 ec 01 addl $0x1,-0x14(%ebp)
while(--i >= 0)
15b9: eb 1a jmp 15d5 <printint+0xa1>
putc(fd, buf[i]);
15bb: 8b 45 ec mov -0x14(%ebp),%eax
15be: 0f b6 44 05 dc movzbl -0x24(%ebp,%eax,1),%eax
15c3: 0f be c0 movsbl %al,%eax
15c6: 89 44 24 04 mov %eax,0x4(%esp)
15ca: 8b 45 08 mov 0x8(%ebp),%eax
15cd: 89 04 24 mov %eax,(%esp)
15d0: e8 37 ff ff ff call 150c <putc>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
15d5: 83 6d ec 01 subl $0x1,-0x14(%ebp)
15d9: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
15dd: 79 dc jns 15bb <printint+0x87>
putc(fd, buf[i]);
}
15df: 83 c4 44 add $0x44,%esp
15e2: 5b pop %ebx
15e3: 5d pop %ebp
15e4: c3 ret
000015e5 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
15e5: 55 push %ebp
15e6: 89 e5 mov %esp,%ebp
15e8: 83 ec 38 sub $0x38,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
15eb: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
ap = (uint*)(void*)&fmt + 1;
15f2: 8d 45 0c lea 0xc(%ebp),%eax
15f5: 83 c0 04 add $0x4,%eax
15f8: 89 45 f4 mov %eax,-0xc(%ebp)
for(i = 0; fmt[i]; i++){
15fb: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
1602: e9 7e 01 00 00 jmp 1785 <printf+0x1a0>
c = fmt[i] & 0xff;
1607: 8b 55 0c mov 0xc(%ebp),%edx
160a: 8b 45 ec mov -0x14(%ebp),%eax
160d: 8d 04 02 lea (%edx,%eax,1),%eax
1610: 0f b6 00 movzbl (%eax),%eax
1613: 0f be c0 movsbl %al,%eax
1616: 25 ff 00 00 00 and $0xff,%eax
161b: 89 45 e8 mov %eax,-0x18(%ebp)
if(state == 0){
161e: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
1622: 75 2c jne 1650 <printf+0x6b>
if(c == '%'){
1624: 83 7d e8 25 cmpl $0x25,-0x18(%ebp)
1628: 75 0c jne 1636 <printf+0x51>
state = '%';
162a: c7 45 f0 25 00 00 00 movl $0x25,-0x10(%ebp)
1631: e9 4b 01 00 00 jmp 1781 <printf+0x19c>
} else {
putc(fd, c);
1636: 8b 45 e8 mov -0x18(%ebp),%eax
1639: 0f be c0 movsbl %al,%eax
163c: 89 44 24 04 mov %eax,0x4(%esp)
1640: 8b 45 08 mov 0x8(%ebp),%eax
1643: 89 04 24 mov %eax,(%esp)
1646: e8 c1 fe ff ff call 150c <putc>
164b: e9 31 01 00 00 jmp 1781 <printf+0x19c>
}
} else if(state == '%'){
1650: 83 7d f0 25 cmpl $0x25,-0x10(%ebp)
1654: 0f 85 27 01 00 00 jne 1781 <printf+0x19c>
if(c == 'd'){
165a: 83 7d e8 64 cmpl $0x64,-0x18(%ebp)
165e: 75 2d jne 168d <printf+0xa8>
printint(fd, *ap, 10, 1);
1660: 8b 45 f4 mov -0xc(%ebp),%eax
1663: 8b 00 mov (%eax),%eax
1665: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp)
166c: 00
166d: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
1674: 00
1675: 89 44 24 04 mov %eax,0x4(%esp)
1679: 8b 45 08 mov 0x8(%ebp),%eax
167c: 89 04 24 mov %eax,(%esp)
167f: e8 b0 fe ff ff call 1534 <printint>
ap++;
1684: 83 45 f4 04 addl $0x4,-0xc(%ebp)
1688: e9 ed 00 00 00 jmp 177a <printf+0x195>
} else if(c == 'x' || c == 'p'){
168d: 83 7d e8 78 cmpl $0x78,-0x18(%ebp)
1691: 74 06 je 1699 <printf+0xb4>
1693: 83 7d e8 70 cmpl $0x70,-0x18(%ebp)
1697: 75 2d jne 16c6 <printf+0xe1>
printint(fd, *ap, 16, 0);
1699: 8b 45 f4 mov -0xc(%ebp),%eax
169c: 8b 00 mov (%eax),%eax
169e: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
16a5: 00
16a6: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
16ad: 00
16ae: 89 44 24 04 mov %eax,0x4(%esp)
16b2: 8b 45 08 mov 0x8(%ebp),%eax
16b5: 89 04 24 mov %eax,(%esp)
16b8: e8 77 fe ff ff call 1534 <printint>
ap++;
16bd: 83 45 f4 04 addl $0x4,-0xc(%ebp)
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
16c1: e9 b4 00 00 00 jmp 177a <printf+0x195>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
16c6: 83 7d e8 73 cmpl $0x73,-0x18(%ebp)
16ca: 75 46 jne 1712 <printf+0x12d>
s = (char*)*ap;
16cc: 8b 45 f4 mov -0xc(%ebp),%eax
16cf: 8b 00 mov (%eax),%eax
16d1: 89 45 e4 mov %eax,-0x1c(%ebp)
ap++;
16d4: 83 45 f4 04 addl $0x4,-0xc(%ebp)
if(s == 0)
16d8: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
16dc: 75 27 jne 1705 <printf+0x120>
s = "(null)";
16de: c7 45 e4 86 1c 00 00 movl $0x1c86,-0x1c(%ebp)
while(*s != 0){
16e5: eb 1f jmp 1706 <printf+0x121>
putc(fd, *s);
16e7: 8b 45 e4 mov -0x1c(%ebp),%eax
16ea: 0f b6 00 movzbl (%eax),%eax
16ed: 0f be c0 movsbl %al,%eax
16f0: 89 44 24 04 mov %eax,0x4(%esp)
16f4: 8b 45 08 mov 0x8(%ebp),%eax
16f7: 89 04 24 mov %eax,(%esp)
16fa: e8 0d fe ff ff call 150c <putc>
s++;
16ff: 83 45 e4 01 addl $0x1,-0x1c(%ebp)
1703: eb 01 jmp 1706 <printf+0x121>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
1705: 90 nop
1706: 8b 45 e4 mov -0x1c(%ebp),%eax
1709: 0f b6 00 movzbl (%eax),%eax
170c: 84 c0 test %al,%al
170e: 75 d7 jne 16e7 <printf+0x102>
1710: eb 68 jmp 177a <printf+0x195>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
1712: 83 7d e8 63 cmpl $0x63,-0x18(%ebp)
1716: 75 1d jne 1735 <printf+0x150>
putc(fd, *ap);
1718: 8b 45 f4 mov -0xc(%ebp),%eax
171b: 8b 00 mov (%eax),%eax
171d: 0f be c0 movsbl %al,%eax
1720: 89 44 24 04 mov %eax,0x4(%esp)
1724: 8b 45 08 mov 0x8(%ebp),%eax
1727: 89 04 24 mov %eax,(%esp)
172a: e8 dd fd ff ff call 150c <putc>
ap++;
172f: 83 45 f4 04 addl $0x4,-0xc(%ebp)
1733: eb 45 jmp 177a <printf+0x195>
} else if(c == '%'){
1735: 83 7d e8 25 cmpl $0x25,-0x18(%ebp)
1739: 75 17 jne 1752 <printf+0x16d>
putc(fd, c);
173b: 8b 45 e8 mov -0x18(%ebp),%eax
173e: 0f be c0 movsbl %al,%eax
1741: 89 44 24 04 mov %eax,0x4(%esp)
1745: 8b 45 08 mov 0x8(%ebp),%eax
1748: 89 04 24 mov %eax,(%esp)
174b: e8 bc fd ff ff call 150c <putc>
1750: eb 28 jmp 177a <printf+0x195>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
1752: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp)
1759: 00
175a: 8b 45 08 mov 0x8(%ebp),%eax
175d: 89 04 24 mov %eax,(%esp)
1760: e8 a7 fd ff ff call 150c <putc>
putc(fd, c);
1765: 8b 45 e8 mov -0x18(%ebp),%eax
1768: 0f be c0 movsbl %al,%eax
176b: 89 44 24 04 mov %eax,0x4(%esp)
176f: 8b 45 08 mov 0x8(%ebp),%eax
1772: 89 04 24 mov %eax,(%esp)
1775: e8 92 fd ff ff call 150c <putc>
}
state = 0;
177a: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
1781: 83 45 ec 01 addl $0x1,-0x14(%ebp)
1785: 8b 55 0c mov 0xc(%ebp),%edx
1788: 8b 45 ec mov -0x14(%ebp),%eax
178b: 8d 04 02 lea (%edx,%eax,1),%eax
178e: 0f b6 00 movzbl (%eax),%eax
1791: 84 c0 test %al,%al
1793: 0f 85 6e fe ff ff jne 1607 <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
1799: c9 leave
179a: c3 ret
179b: 90 nop
0000179c <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
179c: 55 push %ebp
179d: 89 e5 mov %esp,%ebp
179f: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
17a2: 8b 45 08 mov 0x8(%ebp),%eax
17a5: 83 e8 08 sub $0x8,%eax
17a8: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
17ab: a1 e8 1c 00 00 mov 0x1ce8,%eax
17b0: 89 45 fc mov %eax,-0x4(%ebp)
17b3: eb 24 jmp 17d9 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
17b5: 8b 45 fc mov -0x4(%ebp),%eax
17b8: 8b 00 mov (%eax),%eax
17ba: 3b 45 fc cmp -0x4(%ebp),%eax
17bd: 77 12 ja 17d1 <free+0x35>
17bf: 8b 45 f8 mov -0x8(%ebp),%eax
17c2: 3b 45 fc cmp -0x4(%ebp),%eax
17c5: 77 24 ja 17eb <free+0x4f>
17c7: 8b 45 fc mov -0x4(%ebp),%eax
17ca: 8b 00 mov (%eax),%eax
17cc: 3b 45 f8 cmp -0x8(%ebp),%eax
17cf: 77 1a ja 17eb <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
17d1: 8b 45 fc mov -0x4(%ebp),%eax
17d4: 8b 00 mov (%eax),%eax
17d6: 89 45 fc mov %eax,-0x4(%ebp)
17d9: 8b 45 f8 mov -0x8(%ebp),%eax
17dc: 3b 45 fc cmp -0x4(%ebp),%eax
17df: 76 d4 jbe 17b5 <free+0x19>
17e1: 8b 45 fc mov -0x4(%ebp),%eax
17e4: 8b 00 mov (%eax),%eax
17e6: 3b 45 f8 cmp -0x8(%ebp),%eax
17e9: 76 ca jbe 17b5 <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
17eb: 8b 45 f8 mov -0x8(%ebp),%eax
17ee: 8b 40 04 mov 0x4(%eax),%eax
17f1: c1 e0 03 shl $0x3,%eax
17f4: 89 c2 mov %eax,%edx
17f6: 03 55 f8 add -0x8(%ebp),%edx
17f9: 8b 45 fc mov -0x4(%ebp),%eax
17fc: 8b 00 mov (%eax),%eax
17fe: 39 c2 cmp %eax,%edx
1800: 75 24 jne 1826 <free+0x8a>
bp->s.size += p->s.ptr->s.size;
1802: 8b 45 f8 mov -0x8(%ebp),%eax
1805: 8b 50 04 mov 0x4(%eax),%edx
1808: 8b 45 fc mov -0x4(%ebp),%eax
180b: 8b 00 mov (%eax),%eax
180d: 8b 40 04 mov 0x4(%eax),%eax
1810: 01 c2 add %eax,%edx
1812: 8b 45 f8 mov -0x8(%ebp),%eax
1815: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
1818: 8b 45 fc mov -0x4(%ebp),%eax
181b: 8b 00 mov (%eax),%eax
181d: 8b 10 mov (%eax),%edx
181f: 8b 45 f8 mov -0x8(%ebp),%eax
1822: 89 10 mov %edx,(%eax)
1824: eb 0a jmp 1830 <free+0x94>
} else
bp->s.ptr = p->s.ptr;
1826: 8b 45 fc mov -0x4(%ebp),%eax
1829: 8b 10 mov (%eax),%edx
182b: 8b 45 f8 mov -0x8(%ebp),%eax
182e: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
1830: 8b 45 fc mov -0x4(%ebp),%eax
1833: 8b 40 04 mov 0x4(%eax),%eax
1836: c1 e0 03 shl $0x3,%eax
1839: 03 45 fc add -0x4(%ebp),%eax
183c: 3b 45 f8 cmp -0x8(%ebp),%eax
183f: 75 20 jne 1861 <free+0xc5>
p->s.size += bp->s.size;
1841: 8b 45 fc mov -0x4(%ebp),%eax
1844: 8b 50 04 mov 0x4(%eax),%edx
1847: 8b 45 f8 mov -0x8(%ebp),%eax
184a: 8b 40 04 mov 0x4(%eax),%eax
184d: 01 c2 add %eax,%edx
184f: 8b 45 fc mov -0x4(%ebp),%eax
1852: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
1855: 8b 45 f8 mov -0x8(%ebp),%eax
1858: 8b 10 mov (%eax),%edx
185a: 8b 45 fc mov -0x4(%ebp),%eax
185d: 89 10 mov %edx,(%eax)
185f: eb 08 jmp 1869 <free+0xcd>
} else
p->s.ptr = bp;
1861: 8b 45 fc mov -0x4(%ebp),%eax
1864: 8b 55 f8 mov -0x8(%ebp),%edx
1867: 89 10 mov %edx,(%eax)
freep = p;
1869: 8b 45 fc mov -0x4(%ebp),%eax
186c: a3 e8 1c 00 00 mov %eax,0x1ce8
}
1871: c9 leave
1872: c3 ret
00001873 <morecore>:
static Header*
morecore(uint nu)
{
1873: 55 push %ebp
1874: 89 e5 mov %esp,%ebp
1876: 83 ec 28 sub $0x28,%esp
char *p;
Header *hp;
if(nu < 4096)
1879: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
1880: 77 07 ja 1889 <morecore+0x16>
nu = 4096;
1882: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
1889: 8b 45 08 mov 0x8(%ebp),%eax
188c: c1 e0 03 shl $0x3,%eax
188f: 89 04 24 mov %eax,(%esp)
1892: e8 3d fc ff ff call 14d4 <sbrk>
1897: 89 45 f0 mov %eax,-0x10(%ebp)
if(p == (char*)-1)
189a: 83 7d f0 ff cmpl $0xffffffff,-0x10(%ebp)
189e: 75 07 jne 18a7 <morecore+0x34>
return 0;
18a0: b8 00 00 00 00 mov $0x0,%eax
18a5: eb 22 jmp 18c9 <morecore+0x56>
hp = (Header*)p;
18a7: 8b 45 f0 mov -0x10(%ebp),%eax
18aa: 89 45 f4 mov %eax,-0xc(%ebp)
hp->s.size = nu;
18ad: 8b 45 f4 mov -0xc(%ebp),%eax
18b0: 8b 55 08 mov 0x8(%ebp),%edx
18b3: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
18b6: 8b 45 f4 mov -0xc(%ebp),%eax
18b9: 83 c0 08 add $0x8,%eax
18bc: 89 04 24 mov %eax,(%esp)
18bf: e8 d8 fe ff ff call 179c <free>
return freep;
18c4: a1 e8 1c 00 00 mov 0x1ce8,%eax
}
18c9: c9 leave
18ca: c3 ret
000018cb <malloc>:
void*
malloc(uint nbytes)
{
18cb: 55 push %ebp
18cc: 89 e5 mov %esp,%ebp
18ce: 83 ec 28 sub $0x28,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
18d1: 8b 45 08 mov 0x8(%ebp),%eax
18d4: 83 c0 07 add $0x7,%eax
18d7: c1 e8 03 shr $0x3,%eax
18da: 83 c0 01 add $0x1,%eax
18dd: 89 45 f4 mov %eax,-0xc(%ebp)
if((prevp = freep) == 0){
18e0: a1 e8 1c 00 00 mov 0x1ce8,%eax
18e5: 89 45 f0 mov %eax,-0x10(%ebp)
18e8: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
18ec: 75 23 jne 1911 <malloc+0x46>
base.s.ptr = freep = prevp = &base;
18ee: c7 45 f0 e0 1c 00 00 movl $0x1ce0,-0x10(%ebp)
18f5: 8b 45 f0 mov -0x10(%ebp),%eax
18f8: a3 e8 1c 00 00 mov %eax,0x1ce8
18fd: a1 e8 1c 00 00 mov 0x1ce8,%eax
1902: a3 e0 1c 00 00 mov %eax,0x1ce0
base.s.size = 0;
1907: c7 05 e4 1c 00 00 00 movl $0x0,0x1ce4
190e: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
1911: 8b 45 f0 mov -0x10(%ebp),%eax
1914: 8b 00 mov (%eax),%eax
1916: 89 45 ec mov %eax,-0x14(%ebp)
if(p->s.size >= nunits){
1919: 8b 45 ec mov -0x14(%ebp),%eax
191c: 8b 40 04 mov 0x4(%eax),%eax
191f: 3b 45 f4 cmp -0xc(%ebp),%eax
1922: 72 4d jb 1971 <malloc+0xa6>
if(p->s.size == nunits)
1924: 8b 45 ec mov -0x14(%ebp),%eax
1927: 8b 40 04 mov 0x4(%eax),%eax
192a: 3b 45 f4 cmp -0xc(%ebp),%eax
192d: 75 0c jne 193b <malloc+0x70>
prevp->s.ptr = p->s.ptr;
192f: 8b 45 ec mov -0x14(%ebp),%eax
1932: 8b 10 mov (%eax),%edx
1934: 8b 45 f0 mov -0x10(%ebp),%eax
1937: 89 10 mov %edx,(%eax)
1939: eb 26 jmp 1961 <malloc+0x96>
else {
p->s.size -= nunits;
193b: 8b 45 ec mov -0x14(%ebp),%eax
193e: 8b 40 04 mov 0x4(%eax),%eax
1941: 89 c2 mov %eax,%edx
1943: 2b 55 f4 sub -0xc(%ebp),%edx
1946: 8b 45 ec mov -0x14(%ebp),%eax
1949: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
194c: 8b 45 ec mov -0x14(%ebp),%eax
194f: 8b 40 04 mov 0x4(%eax),%eax
1952: c1 e0 03 shl $0x3,%eax
1955: 01 45 ec add %eax,-0x14(%ebp)
p->s.size = nunits;
1958: 8b 45 ec mov -0x14(%ebp),%eax
195b: 8b 55 f4 mov -0xc(%ebp),%edx
195e: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
1961: 8b 45 f0 mov -0x10(%ebp),%eax
1964: a3 e8 1c 00 00 mov %eax,0x1ce8
return (void*)(p + 1);
1969: 8b 45 ec mov -0x14(%ebp),%eax
196c: 83 c0 08 add $0x8,%eax
196f: eb 38 jmp 19a9 <malloc+0xde>
}
if(p == freep)
1971: a1 e8 1c 00 00 mov 0x1ce8,%eax
1976: 39 45 ec cmp %eax,-0x14(%ebp)
1979: 75 1b jne 1996 <malloc+0xcb>
if((p = morecore(nunits)) == 0)
197b: 8b 45 f4 mov -0xc(%ebp),%eax
197e: 89 04 24 mov %eax,(%esp)
1981: e8 ed fe ff ff call 1873 <morecore>
1986: 89 45 ec mov %eax,-0x14(%ebp)
1989: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
198d: 75 07 jne 1996 <malloc+0xcb>
return 0;
198f: b8 00 00 00 00 mov $0x0,%eax
1994: eb 13 jmp 19a9 <malloc+0xde>
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
1996: 8b 45 ec mov -0x14(%ebp),%eax
1999: 89 45 f0 mov %eax,-0x10(%ebp)
199c: 8b 45 ec mov -0x14(%ebp),%eax
199f: 8b 00 mov (%eax),%eax
19a1: 89 45 ec mov %eax,-0x14(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
19a4: e9 70 ff ff ff jmp 1919 <malloc+0x4e>
}
19a9: c9 leave
19aa: c3 ret
19ab: 90 nop
000019ac <xchg>:
asm volatile("sti");
}
static inline uint
xchg(volatile uint *addr, uint newval)
{
19ac: 55 push %ebp
19ad: 89 e5 mov %esp,%ebp
19af: 83 ec 10 sub $0x10,%esp
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
19b2: 8b 55 08 mov 0x8(%ebp),%edx
19b5: 8b 45 0c mov 0xc(%ebp),%eax
19b8: 8b 4d 08 mov 0x8(%ebp),%ecx
19bb: f0 87 02 lock xchg %eax,(%edx)
19be: 89 45 fc mov %eax,-0x4(%ebp)
"+m" (*addr), "=a" (result) :
"1" (newval) :
"cc");
return result;
19c1: 8b 45 fc mov -0x4(%ebp),%eax
}
19c4: c9 leave
19c5: c3 ret
000019c6 <lock_init>:
#include "mmu.h"
#include "spinlock.h"
#include "x86.h"
#include "proc.h"
void lock_init(lock_t *lock){
19c6: 55 push %ebp
19c7: 89 e5 mov %esp,%ebp
lock->locked = 0;
19c9: 8b 45 08 mov 0x8(%ebp),%eax
19cc: c7 00 00 00 00 00 movl $0x0,(%eax)
}
19d2: 5d pop %ebp
19d3: c3 ret
000019d4 <lock_acquire>:
void lock_acquire(lock_t *lock){
19d4: 55 push %ebp
19d5: 89 e5 mov %esp,%ebp
19d7: 83 ec 08 sub $0x8,%esp
while(xchg(&lock->locked,1) != 0);
19da: 8b 45 08 mov 0x8(%ebp),%eax
19dd: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
19e4: 00
19e5: 89 04 24 mov %eax,(%esp)
19e8: e8 bf ff ff ff call 19ac <xchg>
19ed: 85 c0 test %eax,%eax
19ef: 75 e9 jne 19da <lock_acquire+0x6>
}
19f1: c9 leave
19f2: c3 ret
000019f3 <lock_release>:
void lock_release(lock_t *lock){
19f3: 55 push %ebp
19f4: 89 e5 mov %esp,%ebp
19f6: 83 ec 08 sub $0x8,%esp
xchg(&lock->locked,0);
19f9: 8b 45 08 mov 0x8(%ebp),%eax
19fc: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1a03: 00
1a04: 89 04 24 mov %eax,(%esp)
1a07: e8 a0 ff ff ff call 19ac <xchg>
}
1a0c: c9 leave
1a0d: c3 ret
00001a0e <thread_create>:
void *thread_create(void(*start_routine)(void*), void *arg){
1a0e: 55 push %ebp
1a0f: 89 e5 mov %esp,%ebp
1a11: 83 ec 28 sub $0x28,%esp
int tid;
void * stack = malloc(2 * 4096);
1a14: c7 04 24 00 20 00 00 movl $0x2000,(%esp)
1a1b: e8 ab fe ff ff call 18cb <malloc>
1a20: 89 45 f0 mov %eax,-0x10(%ebp)
void *garbage_stack = stack;
1a23: 8b 45 f0 mov -0x10(%ebp),%eax
1a26: 89 45 f4 mov %eax,-0xc(%ebp)
// printf(1,"start routine addr : %d\n",(uint)start_routine);
if((uint)stack % 4096){
1a29: 8b 45 f0 mov -0x10(%ebp),%eax
1a2c: 25 ff 0f 00 00 and $0xfff,%eax
1a31: 85 c0 test %eax,%eax
1a33: 74 15 je 1a4a <thread_create+0x3c>
stack = stack + (4096 - (uint)stack % 4096);
1a35: 8b 45 f0 mov -0x10(%ebp),%eax
1a38: 89 c2 mov %eax,%edx
1a3a: 81 e2 ff 0f 00 00 and $0xfff,%edx
1a40: b8 00 10 00 00 mov $0x1000,%eax
1a45: 29 d0 sub %edx,%eax
1a47: 01 45 f0 add %eax,-0x10(%ebp)
}
if (stack == 0){
1a4a: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
1a4e: 75 1b jne 1a6b <thread_create+0x5d>
printf(1,"malloc fail \n");
1a50: c7 44 24 04 8d 1c 00 movl $0x1c8d,0x4(%esp)
1a57: 00
1a58: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1a5f: e8 81 fb ff ff call 15e5 <printf>
return 0;
1a64: b8 00 00 00 00 mov $0x0,%eax
1a69: eb 6f jmp 1ada <thread_create+0xcc>
}
tid = clone((uint)stack,PSIZE,(uint)start_routine,(int)arg);
1a6b: 8b 4d 0c mov 0xc(%ebp),%ecx
1a6e: 8b 55 08 mov 0x8(%ebp),%edx
1a71: 8b 45 f0 mov -0x10(%ebp),%eax
1a74: 89 4c 24 0c mov %ecx,0xc(%esp)
1a78: 89 54 24 08 mov %edx,0x8(%esp)
1a7c: c7 44 24 04 00 10 00 movl $0x1000,0x4(%esp)
1a83: 00
1a84: 89 04 24 mov %eax,(%esp)
1a87: e8 60 fa ff ff call 14ec <clone>
1a8c: 89 45 ec mov %eax,-0x14(%ebp)
if(tid < 0){
1a8f: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
1a93: 79 1b jns 1ab0 <thread_create+0xa2>
printf(1,"clone fails\n");
1a95: c7 44 24 04 9b 1c 00 movl $0x1c9b,0x4(%esp)
1a9c: 00
1a9d: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1aa4: e8 3c fb ff ff call 15e5 <printf>
return 0;
1aa9: b8 00 00 00 00 mov $0x0,%eax
1aae: eb 2a jmp 1ada <thread_create+0xcc>
}
if(tid > 0){
1ab0: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
1ab4: 7e 05 jle 1abb <thread_create+0xad>
//store threads on thread table
return garbage_stack;
1ab6: 8b 45 f4 mov -0xc(%ebp),%eax
1ab9: eb 1f jmp 1ada <thread_create+0xcc>
}
if(tid == 0){
1abb: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
1abf: 75 14 jne 1ad5 <thread_create+0xc7>
printf(1,"tid = 0 return \n");
1ac1: c7 44 24 04 a8 1c 00 movl $0x1ca8,0x4(%esp)
1ac8: 00
1ac9: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1ad0: e8 10 fb ff ff call 15e5 <printf>
}
// wait();
// free(garbage_stack);
return 0;
1ad5: b8 00 00 00 00 mov $0x0,%eax
}
1ada: c9 leave
1adb: c3 ret
00001adc <init_q>:
#include "queue.h"
#include "types.h"
#include "user.h"
void init_q(struct queue *q){
1adc: 55 push %ebp
1add: 89 e5 mov %esp,%ebp
q->size = 0;
1adf: 8b 45 08 mov 0x8(%ebp),%eax
1ae2: c7 00 00 00 00 00 movl $0x0,(%eax)
q->head = 0;
1ae8: 8b 45 08 mov 0x8(%ebp),%eax
1aeb: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
q->tail = 0;
1af2: 8b 45 08 mov 0x8(%ebp),%eax
1af5: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
}
1afc: 5d pop %ebp
1afd: c3 ret
00001afe <add_q>:
void add_q(struct queue *q, int v){
1afe: 55 push %ebp
1aff: 89 e5 mov %esp,%ebp
1b01: 83 ec 28 sub $0x28,%esp
struct node * n = malloc(sizeof(struct node));
1b04: c7 04 24 08 00 00 00 movl $0x8,(%esp)
1b0b: e8 bb fd ff ff call 18cb <malloc>
1b10: 89 45 f4 mov %eax,-0xc(%ebp)
n->next = 0;
1b13: 8b 45 f4 mov -0xc(%ebp),%eax
1b16: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
n->value = v;
1b1d: 8b 45 f4 mov -0xc(%ebp),%eax
1b20: 8b 55 0c mov 0xc(%ebp),%edx
1b23: 89 10 mov %edx,(%eax)
if(q->head == 0){
1b25: 8b 45 08 mov 0x8(%ebp),%eax
1b28: 8b 40 04 mov 0x4(%eax),%eax
1b2b: 85 c0 test %eax,%eax
1b2d: 75 0b jne 1b3a <add_q+0x3c>
q->head = n;
1b2f: 8b 45 08 mov 0x8(%ebp),%eax
1b32: 8b 55 f4 mov -0xc(%ebp),%edx
1b35: 89 50 04 mov %edx,0x4(%eax)
1b38: eb 0c jmp 1b46 <add_q+0x48>
}else{
q->tail->next = n;
1b3a: 8b 45 08 mov 0x8(%ebp),%eax
1b3d: 8b 40 08 mov 0x8(%eax),%eax
1b40: 8b 55 f4 mov -0xc(%ebp),%edx
1b43: 89 50 04 mov %edx,0x4(%eax)
}
q->tail = n;
1b46: 8b 45 08 mov 0x8(%ebp),%eax
1b49: 8b 55 f4 mov -0xc(%ebp),%edx
1b4c: 89 50 08 mov %edx,0x8(%eax)
q->size++;
1b4f: 8b 45 08 mov 0x8(%ebp),%eax
1b52: 8b 00 mov (%eax),%eax
1b54: 8d 50 01 lea 0x1(%eax),%edx
1b57: 8b 45 08 mov 0x8(%ebp),%eax
1b5a: 89 10 mov %edx,(%eax)
}
1b5c: c9 leave
1b5d: c3 ret
00001b5e <empty_q>:
int empty_q(struct queue *q){
1b5e: 55 push %ebp
1b5f: 89 e5 mov %esp,%ebp
if(q->size == 0)
1b61: 8b 45 08 mov 0x8(%ebp),%eax
1b64: 8b 00 mov (%eax),%eax
1b66: 85 c0 test %eax,%eax
1b68: 75 07 jne 1b71 <empty_q+0x13>
return 1;
1b6a: b8 01 00 00 00 mov $0x1,%eax
1b6f: eb 05 jmp 1b76 <empty_q+0x18>
else
return 0;
1b71: b8 00 00 00 00 mov $0x0,%eax
}
1b76: 5d pop %ebp
1b77: c3 ret
00001b78 <pop_q>:
int pop_q(struct queue *q){
1b78: 55 push %ebp
1b79: 89 e5 mov %esp,%ebp
1b7b: 83 ec 28 sub $0x28,%esp
int val;
struct node *destroy;
if(!empty_q(q)){
1b7e: 8b 45 08 mov 0x8(%ebp),%eax
1b81: 89 04 24 mov %eax,(%esp)
1b84: e8 d5 ff ff ff call 1b5e <empty_q>
1b89: 85 c0 test %eax,%eax
1b8b: 75 5d jne 1bea <pop_q+0x72>
val = q->head->value;
1b8d: 8b 45 08 mov 0x8(%ebp),%eax
1b90: 8b 40 04 mov 0x4(%eax),%eax
1b93: 8b 00 mov (%eax),%eax
1b95: 89 45 f0 mov %eax,-0x10(%ebp)
destroy = q->head;
1b98: 8b 45 08 mov 0x8(%ebp),%eax
1b9b: 8b 40 04 mov 0x4(%eax),%eax
1b9e: 89 45 f4 mov %eax,-0xc(%ebp)
q->head = q->head->next;
1ba1: 8b 45 08 mov 0x8(%ebp),%eax
1ba4: 8b 40 04 mov 0x4(%eax),%eax
1ba7: 8b 50 04 mov 0x4(%eax),%edx
1baa: 8b 45 08 mov 0x8(%ebp),%eax
1bad: 89 50 04 mov %edx,0x4(%eax)
free(destroy);
1bb0: 8b 45 f4 mov -0xc(%ebp),%eax
1bb3: 89 04 24 mov %eax,(%esp)
1bb6: e8 e1 fb ff ff call 179c <free>
q->size--;
1bbb: 8b 45 08 mov 0x8(%ebp),%eax
1bbe: 8b 00 mov (%eax),%eax
1bc0: 8d 50 ff lea -0x1(%eax),%edx
1bc3: 8b 45 08 mov 0x8(%ebp),%eax
1bc6: 89 10 mov %edx,(%eax)
if(q->size == 0){
1bc8: 8b 45 08 mov 0x8(%ebp),%eax
1bcb: 8b 00 mov (%eax),%eax
1bcd: 85 c0 test %eax,%eax
1bcf: 75 14 jne 1be5 <pop_q+0x6d>
q->head = 0;
1bd1: 8b 45 08 mov 0x8(%ebp),%eax
1bd4: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
q->tail = 0;
1bdb: 8b 45 08 mov 0x8(%ebp),%eax
1bde: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
}
return val;
1be5: 8b 45 f0 mov -0x10(%ebp),%eax
1be8: eb 05 jmp 1bef <pop_q+0x77>
}
return -1;
1bea: b8 ff ff ff ff mov $0xffffffff,%eax
}
1bef: c9 leave
1bf0: c3 ret
| 36.781775 | 73 | 0.432325 |
14c824b588ab75769f898df62bf4b8d037fba2e8 | 577 | asm | Assembly | oeis/099/A099393.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/099/A099393.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/099/A099393.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A099393: a(n) = 4^n + 2^n - 1.
; 1,5,19,71,271,1055,4159,16511,65791,262655,1049599,4196351,16781311,67117055,268451839,1073774591,4295032831,17180000255,68719738879,274878431231,1099512676351,4398048608255,17592190238719,70368752566271,281474993487871,1125899940397055,4503599694479359,18014398643699711,72057594306363391,288230376688582655,1152921505680588799,4611686020574871551,18446744078004518911,73786976303428141055,295147905196532695039,1180591620751771041791,4722366482938364690431,18889465931616019808255
mov $2,2
pow $2,$0
mov $0,$2
mul $0,$2
add $0,$2
sub $0,1
| 57.7 | 484 | 0.847487 |
918f4ceda2827457bdccab0c1809007433d712bc | 1,847 | asm | Assembly | programs/oeis/212/A212343.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/212/A212343.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/212/A212343.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A212343: a(n) = (n+1)*(n-2)*(n-3)/2.
; 0,0,5,18,42,80,135,210,308,432,585,770,990,1248,1547,1890,2280,2720,3213,3762,4370,5040,5775,6578,7452,8400,9425,10530,11718,12992,14355,15810,17360,19008,20757,22610,24570,26640,28823,31122,33540,36080,38745,41538,44462,47520,50715,54050,57528,61152,64925,68850,72930,77168,81567,86130,90860,95760,100833,106082,111510,117120,122915,128898,135072,141440,148005,154770,161738,168912,176295,183890,191700,199728,207977,216450,225150,234080,243243,252642,262280,272160,282285,292658,303282,314160,325295,336690,348348,360272,372465,384930,397670,410688,423987,437570,451440,465600,480053,494802,509850,525200,540855,556818,573092,589680,606585,623810,641358,659232,677435,695970,714840,734048,753597,773490,793730,814320,835263,856562,878220,900240,922625,945378,968502,992000,1015875,1040130,1064768,1089792,1115205,1141010,1167210,1193808,1220807,1248210,1276020,1304240,1332873,1361922,1391390,1421280,1451595,1482338,1513512,1545120,1577165,1609650,1642578,1675952,1709775,1744050,1778780,1813968,1849617,1885730,1922310,1959360,1996883,2034882,2073360,2112320,2151765,2191698,2232122,2273040,2314455,2356370,2398788,2441712,2485145,2529090,2573550,2618528,2664027,2710050,2756600,2803680,2851293,2899442,2948130,2997360,3047135,3097458,3148332,3199760,3251745,3304290,3357398,3411072,3465315,3520130,3575520,3631488,3688037,3745170,3802890,3861200,3920103,3979602,4039700,4100400,4161705,4223618,4286142,4349280,4413035,4477410,4542408,4608032,4674285,4741170,4808690,4876848,4945647,5015090,5085180,5155920,5227313,5299362,5372070,5445440,5519475,5594178,5669552,5745600,5822325,5899730,5977818,6056592,6136055,6216210,6297060,6378608,6460857,6543810,6627470,6711840,6796923,6882722,6969240,7056480,7144445,7233138,7322562,7412720,7503615,7595250,7687628,7780752
mov $1,$0
add $0,3
bin $1,2
mul $1,$0
| 230.875 | 1,768 | 0.840823 |
8aededff8b664612885d59b2733f01d21071af19 | 778 | asm | Assembly | oeis/127/A127895.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/127/A127895.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/127/A127895.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A127895: Riordan array (1/(1+x)^3, x/(1+x)^3).
; Submitted by Jon Maiga
; 1,-3,1,6,-6,1,-10,21,-9,1,15,-56,45,-12,1,-21,126,-165,78,-15,1,28,-252,495,-364,120,-18,1,-36,462,-1287,1365,-680,171,-21,1,45,-792,3003,-4368,3060,-1140,231,-24,1,-55,1287,-6435,12376,-11628,5985,-1771,300,-27,1,66,-2002,12870,-31824,38760,-26334,10626,-2600,378,-30,1,-78,3003,-24310,75582,-116280,100947,-53130,17550,-3654,465,-33,1,91,-4368,43758,-167960,319770,-346104,230230,-98280,27405,-4960,561,-36,1,-105,6188,-75582,352716,-817190,1081575,-888030,475020,-169911
mov $1,$0
seq $0,2262 ; Triangle read by rows: T(n,k), 0 <= k <= n, in which row n lists the first n+1 nonnegative integers.
add $0,1
seq $1,2024 ; n appears n times; a(n) = floor(sqrt(2n) + 1/2).
sub $1,$0
mul $0,-3
bin $0,$1
| 64.833333 | 475 | 0.658098 |
ef86a4c0ac23ec125a8de733784bd369ca654fe2 | 694 | asm | Assembly | stage4/boot2.asm | amrwc/8086-graphics | 396ebd087f7747f13fee9b24bb41b54c53f43b9d | [
"MIT"
] | 5 | 2019-11-23T10:07:23.000Z | 2021-05-22T08:13:45.000Z | stage4/boot2.asm | amrwc/8086-graphics | 396ebd087f7747f13fee9b24bb41b54c53f43b9d | [
"MIT"
] | null | null | null | stage4/boot2.asm | amrwc/8086-graphics | 396ebd087f7747f13fee9b24bb41b54c53f43b9d | [
"MIT"
] | 2 | 2020-11-03T14:48:04.000Z | 2021-05-23T03:50:13.000Z | ORG 9000h
jmp Stage_4_Start
%include "print_functions_16_SF.asm"
%include "graphics_main.asm"
; Assignment Stage 4 -- draw a rectangle and a circle
; by writing directly to the video memory.
Stage_4_Start:
push word horizontal_line
call Console_WriteLine_16
call New_Line_16
call Graphics_Main
;____________________
Halt:
mov ax, 0003h ; Clear screen
int 10h
push word goodbye_message
call Console_Write_16
hlt
;____________________
; Data
horizontal_line: db '____________________', 0
goodbye_message: db 'Goodbye!', 0
;____________________
times 3584 - ($ - $$) db 0 | 23.133333 | 55 | 0.661383 |
fcf2ba15e6ddb0715ec759ad7bb933eca4b39b76 | 509 | asm | Assembly | libsrc/_DEVELOPMENT/adt/p_stack/z80/asm_p_stack_clear.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/adt/p_stack/z80/asm_p_stack_clear.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/adt/p_stack/z80/asm_p_stack_clear.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null |
; ===============================================================
; Feb 2014
; ===============================================================
;
; void p_stack_clear(p_stack_t *s)
;
; Clear the stack to empty.
;
; ===============================================================
SECTION code_adt_p_stack
PUBLIC asm_p_stack_clear
EXTERN asm_p_forward_list_init
defc asm_p_stack_clear = asm_p_forward_list_init
; enter : hl = p_stack_t *
;
; exit : de = p_stack_t *
;
; uses : af, de, hl
| 20.36 | 65 | 0.420432 |
d30836b92439cf8cabef82af69ce6e472728c8e7 | 2,033 | asm | Assembly | programs/oeis/002/A002110.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/002/A002110.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 69 | 2021-08-28T10:34:30.000Z | 2022-03-20T19:16:19.000Z | programs/oeis/002/A002110.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A002110 o=0: Primorial numbers (first definition): product of first n primes. Sometimes written prime(n)#.
; Coded manually 2021-02-24 by Antti Karttunen, https://github.com/karttu
; With 64-bit implementation this is even in theory good only up to n=15, as A002110(15) = 614889782588491410 is the greatest primorial < 2^64.
; With 64-bit ints this version allows only computing up to A002110(14) = 13082761331670030 because the overflow kludge is now commented out.
mov $1,1 ; Initialize the result-register, the primorials are constructed to this
mov $2,1 ; Last prime found so far, this one from the beginning of the 20th century (A008578)
lpb $0 ; Loop from n to 1, to find the n-th primorial, we start from the "zeroth" one, A002110(0)=1.
mov $3,$2 ; Set search-limit for "find-next-prime loop" below, this should be enough by Bertrand's postulate.
lpb $3 ; (Bertrand is a great friend of all LODA-coders!). Start the inner loop.
add $2,1 ; First increment the prime past previous
mov $4,$1 ; And make temp. copy of it
gcd $4,$2 ; Take the greatest common divisor with the primorial constructed so far
cmp $4,1 ; $4 is now 1 if $2 was coprime to all previous primes, thus a new prime
cmp $4,0 ; ... and now $4 is zero if a new prime was found, otherwise 1
sub $3,$4 ; Thus we will fall out from loop if a new prime was found.
lpe
add $2,1 ; Has to increment again, because the results of the last iteration of the inner loop were lost (is there a better way to do this?)
; The following four instructions are just a kludge so that we could obtain that term A002110(15) without throwing an overflow:
; Now commented out for program cleanliness, and for the eventual migration to bignum-implementation of LODA.
; mov $3,$0
; cmp $3,0
; cmp $3,0
; mul $2,$3 ;; namely, if the $0 had come to zero, then this would force to multiply by zero instead, to avoid an overflow
mul $1,$2 ; Update the primorial
sub $0,1 ; and decrement the main loop counter.
lpe
mov $0,$1
| 70.103448 | 143 | 0.718151 |
5e9cc85827ea221cdaef845a564d240b4b430ead | 362 | asm | Assembly | programs/oeis/039/A039914.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/039/A039914.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/039/A039914.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A039914: Smallest k>1 such that k(p-1)-1 is divisible by p^2, p=n-th prime.
; 5,5,19,41,109,155,271,341,505,811,929,1331,1639,1805,2161,2755,3421,3659,4421,4969,5255,6161,6805,7831,9311,10099,10505,11341,11771,12655,16001,17029,18631,19181,22051,22649,24491,26405,27721,29755,31861
trn $0,1
seq $0,6308 ; Coefficients of period polynomials.
mul $0,2
sub $0,1
| 45.25 | 205 | 0.745856 |
035372454f9fa6fc32aee9b9025317943d9c1ffe | 372 | asm | Assembly | mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/xor8.asm | gb-archive/really-old-stuff | ffb39a518cad47e23353b3420b88e2f3521fd3d7 | [
"Apache-2.0"
] | 10 | 2016-10-27T20:46:02.000Z | 2021-11-01T15:49:13.000Z | mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/xor8.asm | gb-archive/really-old-stuff | ffb39a518cad47e23353b3420b88e2f3521fd3d7 | [
"Apache-2.0"
] | null | null | null | mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/xor8.asm | gb-archive/really-old-stuff | ffb39a518cad47e23353b3420b88e2f3521fd3d7 | [
"Apache-2.0"
] | 2 | 2015-03-11T14:28:08.000Z | 2017-11-02T10:57:57.000Z | ; vim:ts=4:et:
; FASTCALL boolean xor 8 version.
; result in Accumulator (0 False, not 0 True)
; __FASTCALL__ version (operands: A, H)
; Performs 8bit xor 8bit and returns the boolean
__XOR16:
ld a, h
or l
ld h, a
ld a, d
or e
__XOR8:
sub 1
sbc a, a
ld l, a ; l = 00h or FFh
ld a, h
sub 1
sbc a, a ; a = 00h or FFh
xor l
ret
| 14.307692 | 48 | 0.583333 |
382baf596f377ac962c9acab31f4ce4acca4ad93 | 1,676 | asm | Assembly | Kernel/loader.asm | nicodonof/SoundblasterOS | ba0ffe42e62991c1193f272abd79ed460647092a | [
"BSD-3-Clause"
] | null | null | null | Kernel/loader.asm | nicodonof/SoundblasterOS | ba0ffe42e62991c1193f272abd79ed460647092a | [
"BSD-3-Clause"
] | null | null | null | Kernel/loader.asm | nicodonof/SoundblasterOS | ba0ffe42e62991c1193f272abd79ed460647092a | [
"BSD-3-Clause"
] | null | null | null | global loader
global forceScheduler
extern main
extern initializeKernelBinary
extern schedulerToKernel
extern schedulerToUser
extern processNext
extern sPrintf
%macro pusha 0
push rax
push rbx
push rcx
push rdx
push rbp
push rdi
push rsi
push r8
push r9
push r10
push r11
push r12
push r13
push r14
push r15
push fs
push gs
%endmacro
%macro popa 0
pop gs
pop fs
pop r15
pop r14
pop r13
pop r12
pop r11
pop r10
pop r9
pop r8
pop rsi
pop rdi
pop rbp
pop rdx
pop rcx
pop rbx
pop rax
%endmacro
loader:
call initializeKernelBinary ; Set up the kernel binary, and get thet stack address
mov rsp, rax ; Set up the stack with the returned address
call main
cli
hang:
hlt ; halt machine should kernel return
jmp hang
forceScheduler:
;Push de los registros que dps va a levantar el iretq
pop QWORD[ret_addr] ;Direccion de retorno
mov QWORD[ss_addr], ss ;Stack Segment
push QWORD[ss_addr]
push rsp
pushf ;Se pushean los flags
mov QWORD[cs_addr], cs ;Code Segment
push QWORD[cs_addr]
push QWORD[ret_addr] ;Direccion de retorno
;En este momento el stack contiene:
;
; > ret_addr
; cs
; rflags
; rsp
; ss
pusha
mov rdi, rsp
call schedulerToKernel
mov rsp, rax
call processNext
call schedulerToUser
mov rsp, rax
popa
iretq
section .bss
ret_addr:
resq 1
cs_addr:
resq 1
ss_addr:
resq 1
section .data
string db "rsp: %x",10,0
ripppp db "rip: %x",10,0
halt db "halt"
start db "Start fs:",10,0
end db "End fs.",10,0
| 14.448276 | 83 | 0.645585 |
bfffa0011d661516c75df63fd42cb93b0c7d1764 | 137 | asm | Assembly | Read/read_char.asm | berkcetinsaya/MIPSLanguageExamples | e1ec7ae15a38621e09fcf211f033497c495ee06b | [
"Apache-2.0"
] | null | null | null | Read/read_char.asm | berkcetinsaya/MIPSLanguageExamples | e1ec7ae15a38621e09fcf211f033497c495ee06b | [
"Apache-2.0"
] | null | null | null | Read/read_char.asm | berkcetinsaya/MIPSLanguageExamples | e1ec7ae15a38621e09fcf211f033497c495ee06b | [
"Apache-2.0"
] | null | null | null | .text
li $v0, 12 # service code 12 to read .char
# ascii value of the input will be stored in $v0
syscall # to execute the service
| 27.4 | 51 | 0.693431 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.