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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b2d7e192252ad3ccee8287cba0f4acd7f91e1359 | 6,629 | asm | Assembly | engine/menu/options.asm | longlostsoul/EvoYellow | fe5d0d372c4e90d384c4005a93f19d7968f2ff13 | [
"Unlicense"
] | 16 | 2018-08-28T21:47:01.000Z | 2022-02-20T20:29:59.000Z | engine/menu/options.asm | longlostsoul/EvoYellow | fe5d0d372c4e90d384c4005a93f19d7968f2ff13 | [
"Unlicense"
] | 5 | 2019-04-03T19:53:11.000Z | 2022-03-11T22:49:34.000Z | engine/menu/options.asm | longlostsoul/EvoYellow | fe5d0d372c4e90d384c4005a93f19d7968f2ff13 | [
"Unlicense"
] | 2 | 2019-12-09T19:46:02.000Z | 2020-12-05T21:36:30.000Z | DisplayOptionMenu_:
call Func_41f06
.optionMenuLoop
call JoypadLowSensitivity
ld a, [hJoy5]
and START | B_BUTTON
jr nz, .exitOptionMenu
call Func_41eb7
jr c, .asm_41c86
call Func_41c95
jr c, .exitOptionMenu
.asm_41c86
call Func_41ee9
call DelayFrame
call DelayFrame
call DelayFrame
jr .optionMenuLoop
.exitOptionMenu
ret
Func_41c95:
ld a, [wOptionsCursorLocation]
ld e, a
ld d, $0
ld hl, OptionMenuJumpTable
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp hl
OptionMenuJumpTable:
dw OptionsMenu_TextSpeed
dw OptionsMenu_BattleAnimations
dw OptionsMenu_BattleStyle
dw OptionsMenu_SpeakerSettings
dw OptionsMenu_Mode
dw OptionsMenu_GBPrinterBrightness
dw OptionsMenu_Dummy
dw OptionsMenu_Cancel
OptionsMenu_TextSpeed:
call Func_41d07
ld a, [hJoy5]
bit 4, a ; right
jr nz, .pressedRight
bit 5, a
jr nz, .pressedLeft
jr .asm_41ce0
.pressedRight
ld a, c
cp $2
jr c, .asm_41cca
ld c, $ff
.asm_41cca
inc c
ld a, e
jr .asm_41cd6
.pressedLeft
ld a, c
and a
jr nz, .asm_41cd4
ld c, $3
.asm_41cd4
dec c
ld a, d
.asm_41cd6
ld b, a
ld a, [wOptions]
and $f0
or b
ld [wOptions], a
.asm_41ce0
ld b, $0
ld hl, TextSpeedStringsPointerTable
add hl, bc
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
coord hl, 14, 2
call PlaceString
and a
ret
TextSpeedStringsPointerTable:
dw FastText
dw MidText
dw SlowText
FastText:
db "FAST@"
MidText:
db "MID @"
SlowText:
db "SLOW@"
Func_41d07:
ld a, [wOptions]
and $f
cp $5
jr z, .slowTextOption
cp $1
jr z, .fastTextOption
; mid text option
ld c, $1
lb de, 1, 5
ret
.slowTextOption
ld c, $2
lb de, 3, 1
ret
.fastTextOption
ld c, $0
lb de, 5, 3
ret
OptionsMenu_Mode:
ld a, [hJoy5]
bit 4, a ; right
jr nz, .Toggle
bit 5, a
jr nz, .Toggle
;maybe use other bits in future?
ld a, [wMode]
cp 1
jr z, .SetYes
jr .SetNo
.Toggle
ld a,[wMode]
cp 0
jr z, .SetYes
.SetNo:
ld a,0
ld [wMode],a
ld de, AnimationOffText
jr .Display
.SetYes:
ld a,1
ld [wMode],a
ld de, AnimationOnText
.Display:
coord hl, 14, 10
call PlaceString
and a
ret
OptionsMenu_BattleAnimations:
ld a, [hJoy5]
and D_RIGHT | D_LEFT
jr nz, .asm_41d33
ld a, [wOptions]
and $80 ; mask other bits
jr .asm_41d3b
.asm_41d33
ld a, [wOptions]
xor $80
ld [wOptions], a
.asm_41d3b
ld bc, $0
sla a
rl c
ld hl, AnimationOptionStringsPointerTable
add hl, bc
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
coord hl, 14, 4
call PlaceString
and a
ret
AnimationOptionStringsPointerTable:
dw AnimationOnText
dw AnimationOffText
AnimationOnText:
db "ON @"
AnimationOffText:
db "OFF@"
OptionsMenu_BattleStyle:
ld a, [hJoy5]
and D_LEFT | D_RIGHT
jr nz, .asm_41d6b
ld a, [wOptions]
and $40 ; mask other bits
jr .asm_41d73
.asm_41d6b
ld a, [wOptions]
xor $40
ld [wOptions], a
.asm_41d73
ld bc, $0
sla a
sla a
rl c
ld hl, BattleStyleOptionStringsPointerTable
add hl, bc
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
coord hl, 14, 6
call PlaceString
and a
ret
BattleStyleOptionStringsPointerTable:
dw BattleStyleShiftText
dw BattleStyleSetText
BattleStyleShiftText:
db "SHIFT@"
BattleStyleSetText:
db "SET @"
OptionsMenu_SpeakerSettings:
ld a, [wOptions]
and $30
swap a
ld c, a
ld a, [hJoy5]
bit 4, a
jr nz, .pressedRight
bit 5, a
jr nz, .pressedLeft
jr .asm_41dca
.pressedRight
ld a, c
inc a
and $3
jr .asm_41dba
.pressedLeft
ld a, c
dec a
and $3
.asm_41dba
ld c, a
swap a
ld b, a
xor a
ld [rNR51], a
ld a, [wOptions]
and $cf
or b
ld [wOptions], a
.asm_41dca
ld b, $0
ld hl, SpeakerOptionStringsPointerTable
add hl, bc
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
coord hl, 8, 8
call PlaceString
and a
ret
SpeakerOptionStringsPointerTable:
dw MonoSoundText
dw Earphone1SoundText
dw Earphone2SoundText
dw Earphone3SoundText
MonoSoundText:
db "MONO @"
Earphone1SoundText:
db "EARPHONE1@"
Earphone2SoundText:
db "EARPHONE2@"
Earphone3SoundText:
db "EARPHONE3@"
OptionsMenu_GBPrinterBrightness:
call Func_41e7b
ld a, [hJoy5]
bit 4, a
jr nz, .pressedRight
bit 5, a
jr nz, .pressedLeft
jr .asm_41e32
.pressedRight
ld a, c
cp $4
jr c, .asm_41e22
ld c, $ff
.asm_41e22
inc c
ld a, e
jr .asm_41e2e
.pressedLeft
ld a, c
and a
jr nz, .asm_41e2c
ld c, $5
.asm_41e2c
dec c
ld a, d
.asm_41e2e
ld b, a
ld [wPrinterSettings], a
.asm_41e32
ld b, $0
ld hl, GBPrinterOptionStringsPointerTable
add hl, bc
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
coord hl, 8, 10
call PlaceString
and a
ret
GBPrinterOptionStringsPointerTable:
dw LightestPrintText
dw LighterPrintText
dw NormalPrintText
dw DarkerPrintText
dw DarkestPrintText
LightestPrintText:
db "LIGHTEST@"
LighterPrintText:
db "LIGHTER @"
NormalPrintText:
db "NORMAL @"
DarkerPrintText:
db "DARKER @"
DarkestPrintText:
db "DARKEST @"
Func_41e7b:
ld a, [wPrinterSettings]
and a
jr z, .asm_41e93
cp $20
jr z, .asm_41e99
cp $60
jr z, .asm_41e9f
cp $7f
jr z, .asm_41ea5
ld c, $2
lb de, $20, $60
ret
.asm_41e93
ld c, $0
lb de, $7f, $20
ret
.asm_41e99
ld c, $1
lb de, $0, $40
ret
.asm_41e9f
ld c, $3
lb de, $40, $7f
ret
.asm_41ea5
ld c, $4
lb de, $60, $0
ret
OptionsMenu_Dummy:
and a
ret
OptionsMenu_Cancel:
ld a, [hJoy5]
and A_BUTTON
jr nz, .pressedCancel
and a
ret
.pressedCancel
scf
ret
Func_41eb7:
ld hl, wOptionsCursorLocation
ld a, [hJoy5]
cp D_DOWN
jr z, .pressedDown
cp D_UP
jr z, .pressedUp
and a
ret
.pressedDown
ld a, [hl]
cp $7
jr nz, .doNotWrapAround
ld [hl], $0
scf
ret
.doNotWrapAround
cp $4
jr c, .regularIncrement
ld [hl], $6
.regularIncrement
inc [hl]
scf
ret
.pressedUp
ld a, [hl]
cp $7
jr nz, .doNotMoveCursorToPrintOption
ld [hl], $4
scf
ret
.doNotMoveCursorToPrintOption
and a
jr nz, .regularDecrement
ld [hl], $8
.regularDecrement
dec [hl]
scf
ret
Func_41ee9:
coord hl, 1, 1
ld de, SCREEN_WIDTH
ld c, 16
.loop
ld [hl], " "
add hl, de
dec c
jr nz, .loop
coord hl, 1, 2
ld bc, SCREEN_WIDTH * 2
ld a, [wOptionsCursorLocation]
call AddNTimes
ld [hl], "▶"
ret
Func_41f06:
coord hl, 0, 0
lb bc, SCREEN_HEIGHT - 2, SCREEN_WIDTH - 2
call TextBoxBorder
coord hl, 2, 2
ld de, AllOptionsText
call PlaceString
coord hl, 2, 16
ld de, OptionMenuCancelText
call PlaceString
xor a
ld [wOptionsCursorLocation], a
ld c, 5
.loop
push bc
call Func_41c95
pop bc
ld hl, wOptionsCursorLocation
inc [hl]
dec c
jr nz, .loop
xor a
ld [wOptionsCursorLocation], a
inc a
ld [H_AUTOBGTRANSFERENABLED], a
call Delay3
ret
AllOptionsText:
db "TEXT SPEED :"
next "ANIMATION :"
next "BATTLESTYLE:"
next "SOUND:";next "PRINT:@"
next "LEVELS:@"
OptionMenuCancelText:
db "CANCEL@"
| 13.868201 | 44 | 0.696787 |
5add391dcee3853b34d8e93a1968ca8f533e16b0 | 724 | asm | Assembly | oeis/069/A069203.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/069/A069203.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/069/A069203.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A069203: a(1)=0 a(2)=3 a(n+2)=(a(n+1)+a(n))/3 if (a(n+1)+a(n)==0 (mod 3)); a(n+2)=a(n+1)+a(n) otherwise.
; Submitted by Simon Strandgaard
; 0,3,1,4,5,3,8,11,19,10,29,13,14,9,23,32,55,29,28,19,47,22,23,15,38,53,91,48,139,187,326,171,497,668,1165,611,592,401,331,244,575,273,848,1121,1969,1030,2999,1343,4342,1895,2079,3974,6053,10027,5360,5129,10489,5206,15695,6967,7554,14521,22075,36596,19557,56153,75710,131863,69191,67018,45403,112421,52608,165029,217637,382666,200101,582767,260956,281241,542197,823438,1365635,729691,698442,1428133,2126575,3554708,1893761,5448469,2447410,7895879,3447763,3781214,2409659,6190873,2866844,3019239
mov $2,3
lpb $0
sub $0,1
mov $3,$4
mov $4,$2
add $2,$3
dif $2,3
lpe
add $0,$4
| 51.714286 | 494 | 0.711326 |
9ae8c2b1d230942acaeeb70a79f92993d338d9e9 | 337 | asm | Assembly | programs/oeis/080/A080458.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/080/A080458.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/080/A080458.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A080458: a(1)=4; for n>1, a(n)=a(n-1) if n is already in the sequence, a(n)=a(n-1)+4 otherwise.
; 4,8,12,12,16,20,24,24,28,32,36,36,40,44,48,48,52,56,60,60,64,68,72,72,76,80,84,84,88,92,96,96,100,104,108,108,112,116,120,120,124,128,132,132,136,140,144,144,148,152,156,156,160,164,168,168,172,176
add $0,2
mul $0,12
div $0,16
mul $0,4
| 42.125 | 199 | 0.658754 |
05c46d902ac737a6a8f342013ddf4d829b949cf5 | 676 | asm | Assembly | oeis/348/A348015.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/348/A348015.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/348/A348015.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A348015: Number of recurrent n X n matrices over GF(2).
; Submitted by Jamie Morken(s1.)
; 1,2,13,365,43801,21725297,43798198753,355991759464385,11619571028917526401,1520025803718875133673217,796153035368657542014822907393,1668838669721233396228446711227874305,13995815633937307151473642050515241531340801,469564317112649657867143585938515326497638404059137,63020009121845570312908090314184266498136555304557293330433,33832577251664098139227085133002766095883313277574001959867156250625,72653797791754049013489566488701707095038785475241974773838449373502156800001
mov $2,1
mov $4,1
lpb $0
sub $0,1
add $3,$2
mul $4,$3
mul $4,$2
mul $2,2
add $4,1
lpe
mov $0,$4
| 42.25 | 475 | 0.850592 |
b912d7e74eae0caa0bd35c51e41415d5054db0a9 | 1,441 | asm | Assembly | samples/nes/player_cntrl_NROM-128/player_anm.asm | 0x8BitDev/MAPeD-SPReD | da1a8a582980ea5963777a46fd3dfddc0d69aa82 | [
"MIT"
] | 23 | 2019-05-16T20:23:49.000Z | 2022-03-13T21:53:10.000Z | samples/nes/player_cntrl_NROM-128/player_anm.asm | 0x8BitDev/MAPeD-SPReD | da1a8a582980ea5963777a46fd3dfddc0d69aa82 | [
"MIT"
] | 6 | 2021-03-30T05:51:46.000Z | 2022-01-07T13:18:44.000Z | samples/nes/player_cntrl_NROM-128/player_anm.asm | 0x8BitDev/MAPeD-SPReD | da1a8a582980ea5963777a46fd3dfddc0d69aa82 | [
"MIT"
] | null | null | null | ;###############################################
;
; Copyright 2018-2019 0x8BitDev ( MIT license )
;
;###############################################
; *** ANIMATIONS DATA ***
player_run_right:
.byte 8 ; number of ticks to change a frame
.byte $02 ; number of frames
.byte $00 ; loop frame
.word frames_player_run_right ; frame data pointer
player_run_left:
.byte 8
.byte $02
.byte $00
.word frames_player_run_left
player_idle_right:
player_duck_right:
player_shoot_right:
.byte 10
.byte $02
.byte $00
.word frames_player_idle_right
player_idle_left:
player_duck_left:
player_shoot_left:
.byte 10
.byte $02
.byte $00
.word frames_player_idle_left
player_jump_right:
.byte 1
.byte $01
.byte $00
.word frames_player_jump_right
player_jump_left:
.byte 1
.byte $01
.byte $00
.word frames_player_jump_left
.include "data/dog_gfx.asm"
frames_player_idle_right = dog01_IDLE01_RIGHT_frame
frames_player_duck_right = dog01_IDLE01_RIGHT_frame
frames_player_shoot_right = dog01_IDLE01_RIGHT_frame
frames_player_run_right = dog01_RUN01_RIGHT_frame
frames_player_jump_right = dog01_JUMP_RIGHT_frame
frames_player_idle_left = dog01_IDLE01_LEFT_frame
frames_player_duck_left = dog01_IDLE01_LEFT_frame
frames_player_shoot_left = dog01_IDLE01_LEFT_frame
frames_player_run_left = dog01_RUN01_LEFT_frame
frames_player_jump_left = dog01_JUMP_LEFT_frame
| 23.241935 | 53 | 0.716863 |
056589c12ae0da99d481f62d13dd1e004cb38550 | 188 | asm | Assembly | libsrc/_DEVELOPMENT/arch/ts2068/display/c/sdcc/tshr_saddr2cy_fastcall.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/arch/ts2068/display/c/sdcc/tshr_saddr2cy_fastcall.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/arch/ts2068/display/c/sdcc/tshr_saddr2cy_fastcall.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z | ; uchar tshr_saddr2cy(void *saddr)
SECTION code_clib
SECTION code_arch
PUBLIC _tshr_saddr2cy_fastcall
EXTERN _zx_saddr2cy_fastcall
defc _tshr_saddr2cy_fastcall = _zx_saddr2cy_fastcall
| 17.090909 | 52 | 0.867021 |
e6782df302ded6db5d9e82b40d703c9ea1759ce3 | 5,183 | asm | Assembly | audio/music/routes2.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | 1 | 2022-02-15T00:19:44.000Z | 2022-02-15T00:19:44.000Z | audio/music/routes2.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | null | null | null | audio/music/routes2.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | null | null | null | Music_Routes2_Ch1::
tempo 152
volume 7, 7
vibrato 9, 2, 5
duty_cycle 1
Music_Routes2_branch_9dc3::
note_type 12, 11, 2
octave 2
note B_, 4
octave 3
note G#, 6
note F#, 2
note E_, 2
note D#, 1
note F#, 1
note E_, 2
octave 2
note B_, 2
octave 3
note E_, 2
note A_, 2
note G#, 4
note F#, 4
octave 2
note B_, 4
octave 3
note G#, 6
note F#, 2
note E_, 2
note D#, 1
note F#, 1
note B_, 2
octave 2
note B_, 2
octave 3
note E_, 2
note A_, 2
note G#, 4
note B_, 4
note_type 8, 11, 2
octave 4
note E_, 2
octave 3
note A_, 2
octave 4
note E_, 2
note E_, 2
octave 3
note A_, 2
octave 4
note E_, 2
note D#, 2
octave 3
note G#, 2
octave 4
note D#, 2
note D#, 2
octave 3
note G#, 2
octave 4
note D#, 2
note C#, 2
octave 3
note F#, 2
octave 4
note C#, 2
note C#, 2
octave 3
note F#, 2
octave 4
note C#, 2
octave 3
note B_, 2
note E_, 2
note B_, 2
note B_, 2
note E_, 2
note G#, 2
note F#, 2
note G#, 2
note A_, 2
note A_, 2
note F#, 2
note A_, 2
note F#, 2
note G#, 2
note A_, 2
note A_, 2
note F#, 2
note A_, 2
note G#, 2
note E_, 2
note B_, 2
note B_, 2
note E_, 2
note B_, 2
note B_, 2
note E_, 2
note B_, 2
note B_, 2
note E_, 2
note B_, 2
note A_, 2
note B_, 2
note A_, 2
octave 4
note C#, 2
octave 3
note B_, 2
octave 4
note C#, 2
note D_, 2
octave 3
note B_, 2
octave 4
note D_, 2
note F#, 2
note E_, 2
note D#, 2
note E_, 2
octave 3
note B_, 2
octave 4
note E_, 2
note E_, 2
octave 3
note B_, 2
octave 4
note E_, 2
note E_, 2
octave 3
note B_, 2
octave 4
note E_, 2
note E_, 2
octave 3
note B_, 2
octave 4
note E_, 2
sound_loop 0, Music_Routes2_branch_9dc3
sound_ret
Music_Routes2_Ch2::
vibrato 8, 2, 6
duty_cycle 3
Music_Routes2_branch_9e54::
note_type 12, 13, 4
octave 4
note E_, 6
octave 3
note B_, 1
octave 4
note E_, 1
note F#, 6
note A_, 2
note G#, 3
note E_, 1
note F#, 8
octave 3
note D#, 4
octave 4
note E_, 6
octave 3
note B_, 1
octave 4
note E_, 1
note F#, 6
note A_, 2
note G#, 3
note E_, 1
note B_, 8
octave 3
note G#, 4
octave 5
note C#, 6
octave 4
note B_, 1
note A_, 1
note B_, 6
note A_, 1
note G#, 1
note A_, 6
note G#, 1
note F#, 1
note G#, 4
note F#, 2
note E_, 2
note D_, 2
note D_, 1
note E_, 1
note F#, 8
note A_, 4
note G#, 3
note F#, 1
note E_, 8
note F#, 2
note E_, 2
note D_, 2
note D_, 1
note E_, 1
note F#, 2
note F#, 1
note G#, 1
note A_, 4
octave 5
note C#, 4
octave 4
note B_, 3
note A_, 1
note G#, 8
rest 4
sound_loop 0, Music_Routes2_branch_9e54
sound_ret
Music_Routes2_Ch3::
vibrato 9, 2, 8
Music_Routes2_branch_9e9e::
note_type 12, 1, 1
octave 3
note E_, 2
rest 2
octave 2
note B_, 6
octave 3
note D_, 1
note C#, 1
note D_, 2
note D#, 2
note E_, 2
rest 2
octave 2
note B_, 6
octave 3
note D_, 1
note C#, 1
octave 2
note A_, 2
octave 3
note C#, 2
note E_, 2
rest 2
octave 2
note B_, 6
octave 3
note D_, 1
note C#, 1
note D_, 2
note D#, 2
note E_, 2
rest 2
octave 2
note B_, 4
octave 3
note C#, 2
octave 2
note B_, 2
octave 3
note D_, 2
note F#, 2
note E_, 2
rest 2
octave 2
note A_, 2
rest 2
octave 3
note D#, 2
rest 2
octave 2
note G#, 2
rest 2
octave 3
note C#, 2
rest 2
octave 2
note F#, 2
rest 2
note B_, 2
rest 2
note E_, 2
note G#, 2
note F#, 2
rest 2
note A_, 2
rest 2
note F#, 2
rest 2
note A_, 2
rest 2
note G#, 2
rest 2
note B_, 2
rest 2
note G#, 2
rest 2
note B_, 2
rest 2
note F#, 2
rest 2
note A_, 2
rest 2
octave 3
note C#, 2
rest 2
octave 2
note A_, 2
octave 3
note C#, 2
octave 2
note B_, 2
rest 2
octave 3
note E_, 2
rest 2
note G#, 2
rest 2
note E_, 2
rest 2
sound_loop 0, Music_Routes2_branch_9e9e
sound_ret
Music_Routes2_Ch4::
drum_speed 12
drum_note 3, 2
rest 2
drum_note 3, 1
rest 5
drum_note 3, 1
drum_note 3, 1
drum_note 3, 2
drum_note 3, 2
drum_note 3, 2
rest 2
drum_speed 8
drum_note 3, 2
drum_note 3, 2
drum_note 3, 2
drum_note 3, 3
drum_note 3, 3
drum_speed 12
drum_note 3, 1
rest 3
drum_note 3, 2
rest 2
drum_note 3, 2
rest 4
drum_note 3, 1
drum_note 3, 1
drum_note 3, 2
rest 2
drum_note 3, 2
rest 2
drum_speed 8
drum_note 3, 2
drum_note 3, 2
drum_note 3, 2
drum_note 3, 3
drum_note 3, 3
drum_note 3, 2
drum_note 3, 2
drum_note 3, 2
drum_note 3, 3
rest 3
drum_speed 12
drum_note 3, 1
rest 5
drum_note 3, 1
drum_note 3, 1
drum_note 3, 2
drum_note 3, 2
drum_note 3, 2
rest 2
drum_speed 8
drum_note 3, 2
drum_note 3, 2
drum_note 3, 2
drum_note 3, 3
rest 3
drum_speed 12
drum_note 3, 1
rest 3
drum_note 3, 2
rest 2
drum_note 3, 2
rest 4
drum_note 3, 1
drum_note 3, 1
drum_note 3, 2
drum_note 3, 2
drum_note 3, 2
rest 2
drum_speed 8
drum_note 3, 2
drum_note 3, 2
drum_note 3, 2
drum_note 3, 3
rest 3
drum_note 3, 3
drum_note 3, 3
drum_note 3, 3
rest 3
drum_speed 12
drum_note 3, 1
rest 5
drum_note 3, 1
drum_note 3, 1
drum_note 3, 2
drum_note 3, 2
drum_note 3, 2
rest 2
drum_speed 8
drum_note 3, 2
drum_note 3, 2
drum_note 3, 2
drum_note 3, 3
rest 3
drum_note 3, 3
rest 3
sound_loop 0, Music_Routes2_Ch4
sound_ret
| 12.166667 | 40 | 0.635153 |
e82f587643822c9885f7231160adb179e6c20d6c | 870 | asm | Assembly | round_down.asm | alfiejsmith/LMC | 46aa24b2bd93e66527a91bd03b2bd43fcf3934ca | [
"Unlicense"
] | 1 | 2022-03-05T21:00:49.000Z | 2022-03-05T21:00:49.000Z | round_down.asm | alfiejfs/lmc | 46aa24b2bd93e66527a91bd03b2bd43fcf3934ca | [
"Unlicense"
] | null | null | null | round_down.asm | alfiejfs/lmc | 46aa24b2bd93e66527a91bd03b2bd43fcf3934ca | [
"Unlicense"
] | 1 | 2020-11-06T22:25:39.000Z | 2020-11-06T22:25:39.000Z | // Round a given x down to the nearest multiple of y > 0
INP
STA x
STA initialCheck
INP
STA y
LDA initialCheck
BRP checkFactorPos
BRA checkFactorNeg
//
// Positive check
//
positiveRound LDA initialCheck
SUB one
STA initialCheck
BRA checkFactorPos
checkFactorPos BRZ output
SUB y
BRZ output
BRP checkFactorPos
BRA positiveRound
//
// Negative check
//
negativeRound LDA initialCheck
SUB one
STA initialCheck
BRA checkFactorNeg
checkFactorNeg BRZ output
ADD y
BRZ output
BRP negativeRound
BRA checkFactorNeg
//
// Output procedure
//
output LDA initialCheck
OUT
HLT
// Variables
x DAT
y DAT
initialCheck DAT
one DAT 1
| 16.415094 | 56 | 0.568966 |
053826abd575f5d3da2ee6fe06f7e781bd5a044c | 372 | asm | Assembly | programs/oeis/052/A052657.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/052/A052657.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/052/A052657.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A052657: E.g.f. x^2/((1-x)^2*(1+x)).
; 0,0,2,6,48,240,2160,15120,161280,1451520,18144000,199584000,2874009600,37362124800,610248038400,9153720576000,167382319104000,2845499424768000,57621363351552000,1094805903679488000
mov $1,$0
seq $0,142 ; Factorial numbers: n! = 1*2*3*4*...*n (order of symmetric group S_n, number of permutations of n letters).
div $1,2
mul $0,$1
| 46.5 | 182 | 0.741935 |
01b6789da95380603c043a860a34822707f1fc8d | 6,041 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_756.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_756.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_756.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r14
push %r15
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x5e86, %r9
nop
nop
nop
and %r15, %r15
movups (%r9), %xmm6
vpextrq $0, %xmm6, %rdi
nop
nop
dec %r10
lea addresses_WT_ht+0x18de6, %rcx
nop
nop
cmp $56888, %r13
mov (%rcx), %r9
nop
nop
nop
nop
nop
mfence
lea addresses_A_ht+0x5546, %rsi
lea addresses_WC_ht+0x58c6, %rdi
nop
nop
nop
nop
and %r14, %r14
mov $108, %rcx
rep movsl
nop
sub $32252, %rcx
lea addresses_UC_ht+0x81fe, %rsi
lea addresses_A_ht+0x5ea6, %rdi
clflush (%rsi)
nop
nop
nop
nop
nop
add %r15, %r15
mov $3, %rcx
rep movsb
nop
nop
nop
add $30773, %rdi
lea addresses_normal_ht+0xae10, %r10
nop
nop
cmp $36571, %rsi
mov $0x6162636465666768, %rcx
movq %rcx, (%r10)
nop
nop
nop
nop
nop
xor %rcx, %rcx
lea addresses_UC_ht+0xd46, %rsi
lea addresses_WT_ht+0x18186, %rdi
nop
nop
dec %r10
mov $118, %rcx
rep movsl
nop
dec %rdi
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r15
pop %r14
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r15
push %r8
push %r9
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_PSE+0x2546, %rcx
nop
nop
add $28077, %r8
movw $0x5152, (%rcx)
nop
nop
nop
dec %r15
// REPMOV
lea addresses_D+0xf01e, %rsi
lea addresses_normal+0x15d46, %rdi
nop
nop
nop
nop
nop
inc %rax
mov $104, %rcx
rep movsw
nop
nop
nop
nop
sub $18106, %r15
// Faulty Load
lea addresses_A+0x19546, %r15
clflush (%r15)
nop
sub %r8, %r8
mov (%r15), %dx
lea oracles, %rdi
and $0xff, %rdx
shlq $12, %rdx
mov (%rdi,%rdx,1), %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r15
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 11}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_D'}, 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_normal'}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 6}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 4}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_A_ht'}, 'dst': {'same': True, 'congruent': 7, 'type': 'addresses_WC_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_UC_ht'}, 'dst': {'same': True, 'congruent': 5, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 1}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}}
{'35': 21829}
35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35
*/
| 36.391566 | 2,999 | 0.660156 |
200f06634ef275d689f0a8fa5ed209677b6013bd | 3,881 | asm | Assembly | projects/08/FunctionCalls/StaticsTest/StaticsTest.asm | azaslavsky/nand2tetris | f9440564f86c33213730a1e021da894ac0c9be25 | [
"MIT"
] | null | null | null | projects/08/FunctionCalls/StaticsTest/StaticsTest.asm | azaslavsky/nand2tetris | f9440564f86c33213730a1e021da894ac0c9be25 | [
"MIT"
] | null | null | null | projects/08/FunctionCalls/StaticsTest/StaticsTest.asm | azaslavsky/nand2tetris | f9440564f86c33213730a1e021da894ac0c9be25 | [
"MIT"
] | null | null | null |
// boot:
@256
D=A
@SP
M=D
@RET0
D=A
@SP
A=M
M=D
@SP
M=M+1
@R1
D=M
@SP
A=M
M=D
@SP
M=M+1
@R2
D=M
@SP
A=M
M=D
@SP
M=M+1
@R3
D=M
@SP
A=M
M=D
@SP
M=M+1
@R4
D=M
@SP
A=M
M=D
@SP
M=M+1
@5
D=A
@SP
D=M-D
@ARG
M=D
@SP
D=M
@LCL
M=D
@Sys.init
0;JMP
(RET0)
// function Class1.set 0:
(Class1.set)
@0
D=A
@SP
D=M-D
@LCL
M=D
// push argument 0:
@0
D=A
@ARG
A=M+D
D=M
@SP
A=M
M=D
@SP
M=M+1
// pop static 0:
@SP
M=M-1
A=M
D=M
@16
M=D
// push argument 1:
@1
D=A
@ARG
A=M+D
D=M
@SP
A=M
M=D
@SP
M=M+1
// pop static 1:
@SP
M=M-1
A=M
D=M
@17
M=D
// push constant 0:
@0
D=A
@SP
A=M
M=D
@SP
M=M+1
// return:
@LCL
D=M
@R14
M=D
@5
A=D-A
D=M
@R15
M=D
@0
D=A
@ARG
D=M+D
@R13
M=D
@SP
M=M-1
A=M
D=M
@R13
A=M
M=D
@ARG
D=M+1
@SP
M=D
@1
D=A
@R14
A=M-D
D=M
@4
M=D
@2
D=A
@R14
A=M-D
D=M
@3
M=D
@3
D=A
@R14
A=M-D
D=M
@2
M=D
@4
D=A
@R14
A=M-D
D=M
@1
M=D
@R15
A=M
0;JMP
// function Class1.get 0:
(Class1.get)
@0
D=A
@SP
D=M-D
@LCL
M=D
// push static 0:
@16
D=M
@SP
A=M
M=D
@SP
M=M+1
// push static 1:
@17
D=M
@SP
A=M
M=D
@SP
M=M+1
// sub:
@SP
M=M-1
@SP
A=M
D=M
@SP
M=M-1
@SP
A=M
D=M-D
@SP
A=M
M=D
@SP
M=M+1
// return:
@LCL
D=M
@R14
M=D
@5
A=D-A
D=M
@R15
M=D
@0
D=A
@ARG
D=M+D
@R13
M=D
@SP
M=M-1
A=M
D=M
@R13
A=M
M=D
@ARG
D=M+1
@SP
M=D
@1
D=A
@R14
A=M-D
D=M
@4
M=D
@2
D=A
@R14
A=M-D
D=M
@3
M=D
@3
D=A
@R14
A=M-D
D=M
@2
M=D
@4
D=A
@R14
A=M-D
D=M
@1
M=D
@R15
A=M
0;JMP
// function Sys.init 0:
(Sys.init)
@0
D=A
@SP
D=M-D
@LCL
M=D
// push constant 6:
@6
D=A
@SP
A=M
M=D
@SP
M=M+1
// push constant 8:
@8
D=A
@SP
A=M
M=D
@SP
M=M+1
// call Class1.set 2:
@RET1
D=A
@SP
A=M
M=D
@SP
M=M+1
@R1
D=M
@SP
A=M
M=D
@SP
M=M+1
@R2
D=M
@SP
A=M
M=D
@SP
M=M+1
@R3
D=M
@SP
A=M
M=D
@SP
M=M+1
@R4
D=M
@SP
A=M
M=D
@SP
M=M+1
@7
D=A
@SP
D=M-D
@ARG
M=D
@SP
D=M
@LCL
M=D
@Class1.set
0;JMP
(RET1)
// pop temp 0 // Dumps the return value:
@SP
M=M-1
A=M
D=M
@R5
M=D
// push constant 23:
@23
D=A
@SP
A=M
M=D
@SP
M=M+1
// push constant 15:
@15
D=A
@SP
A=M
M=D
@SP
M=M+1
// call Class2.set 2:
@RET2
D=A
@SP
A=M
M=D
@SP
M=M+1
@R1
D=M
@SP
A=M
M=D
@SP
M=M+1
@R2
D=M
@SP
A=M
M=D
@SP
M=M+1
@R3
D=M
@SP
A=M
M=D
@SP
M=M+1
@R4
D=M
@SP
A=M
M=D
@SP
M=M+1
@7
D=A
@SP
D=M-D
@ARG
M=D
@SP
D=M
@LCL
M=D
@Class2.set
0;JMP
(RET2)
// pop temp 0 // Dumps the return value:
@SP
M=M-1
A=M
D=M
@R5
M=D
// call Class1.get 0:
@RET3
D=A
@SP
A=M
M=D
@SP
M=M+1
@R1
D=M
@SP
A=M
M=D
@SP
M=M+1
@R2
D=M
@SP
A=M
M=D
@SP
M=M+1
@R3
D=M
@SP
A=M
M=D
@SP
M=M+1
@R4
D=M
@SP
A=M
M=D
@SP
M=M+1
@5
D=A
@SP
D=M-D
@ARG
M=D
@SP
D=M
@LCL
M=D
@Class1.get
0;JMP
(RET3)
// call Class2.get 0:
@RET4
D=A
@SP
A=M
M=D
@SP
M=M+1
@R1
D=M
@SP
A=M
M=D
@SP
M=M+1
@R2
D=M
@SP
A=M
M=D
@SP
M=M+1
@R3
D=M
@SP
A=M
M=D
@SP
M=M+1
@R4
D=M
@SP
A=M
M=D
@SP
M=M+1
@5
D=A
@SP
D=M-D
@ARG
M=D
@SP
D=M
@LCL
M=D
@Class2.get
0;JMP
(RET4)
// label WHILE:
(Sys.init$WHILE)
// goto WHILE:
@Sys.init$WHILE
0;JMP
// function Class2.set 0:
(Class2.set)
@0
D=A
@SP
D=M-D
@LCL
M=D
// push argument 0:
@0
D=A
@ARG
A=M+D
D=M
@SP
A=M
M=D
@SP
M=M+1
// pop static 0:
@SP
M=M-1
A=M
D=M
@18
M=D
// push argument 1:
@1
D=A
@ARG
A=M+D
D=M
@SP
A=M
M=D
@SP
M=M+1
// pop static 1:
@SP
M=M-1
A=M
D=M
@19
M=D
// push constant 0:
@0
D=A
@SP
A=M
M=D
@SP
M=M+1
// return:
@LCL
D=M
@R14
M=D
@5
A=D-A
D=M
@R15
M=D
@0
D=A
@ARG
D=M+D
@R13
M=D
@SP
M=M-1
A=M
D=M
@R13
A=M
M=D
@ARG
D=M+1
@SP
M=D
@1
D=A
@R14
A=M-D
D=M
@4
M=D
@2
D=A
@R14
A=M-D
D=M
@3
M=D
@3
D=A
@R14
A=M-D
D=M
@2
M=D
@4
D=A
@R14
A=M-D
D=M
@1
M=D
@R15
A=M
0;JMP
// function Class2.get 0:
(Class2.get)
@0
D=A
@SP
D=M-D
@LCL
M=D
// push static 0:
@18
D=M
@SP
A=M
M=D
@SP
M=M+1
// push static 1:
@19
D=M
@SP
A=M
M=D
@SP
M=M+1
// sub:
@SP
M=M-1
@SP
A=M
D=M
@SP
M=M-1
@SP
A=M
D=M-D
@SP
A=M
M=D
@SP
M=M+1
// return:
@LCL
D=M
@R14
M=D
@5
A=D-A
D=M
@R15
M=D
@0
D=A
@ARG
D=M+D
@R13
M=D
@SP
M=M-1
A=M
D=M
@R13
A=M
M=D
@ARG
D=M+1
@SP
M=D
@1
D=A
@R14
A=M-D
D=M
@4
M=D
@2
D=A
@R14
A=M-D
D=M
@3
M=D
@3
D=A
@R14
A=M-D
D=M
@2
M=D
@4
D=A
@R14
A=M-D
D=M
@1
M=D
@R15
A=M
0;JMP
| 5.086501 | 40 | 0.534398 |
fb5777cae5c5daf8ff03f435053f1128d51d398b | 4,821 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_407.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_407.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_407.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r8
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0xedb1, %r12
nop
cmp %rsi, %rsi
movb $0x61, (%r12)
nop
cmp $53057, %r12
lea addresses_normal_ht+0x12351, %rsi
lea addresses_WC_ht+0x85c5, %rdi
clflush (%rsi)
nop
nop
nop
add %rbx, %rbx
mov $112, %rcx
rep movsl
nop
nop
nop
nop
inc %rsi
lea addresses_normal_ht+0x49ed, %r8
nop
nop
cmp $31220, %rdx
mov $0x6162636465666768, %rdi
movq %rdi, (%r8)
nop
nop
xor %rsi, %rsi
lea addresses_D_ht+0x4c6c, %rdi
nop
and $61444, %rdx
movb (%rdi), %bl
nop
nop
xor %r8, %r8
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %rbx
push %rdx
push %rsi
// Faulty Load
lea addresses_D+0x15b51, %rsi
nop
nop
nop
add %r12, %r12
mov (%rsi), %r14d
lea oracles, %r12
and $0xff, %r14
shlq $12, %r14
mov (%r12,%r14,1), %r14
pop %rsi
pop %rdx
pop %rbx
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': True}}
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
| 50.747368 | 2,999 | 0.661274 |
1db57f26b92ef76ac435936da453861f39f013c3 | 845 | asm | Assembly | Lab slides/Lab 7 - array sum.asm | mbadry1/FCIFayoum-Computer-architecture-2018 | c09ec1610f7f502bebdc5dd0d342950c0882b00e | [
"Unlicense"
] | 9 | 2018-11-21T16:30:52.000Z | 2021-02-22T12:33:20.000Z | Lab slides/Lab 7 - array sum.asm | mahmoud-1998/FCIFayoum-Computer-architecture-2018 | ed6793cd6587d430939bd1888e0f33142039b89a | [
"Unlicense"
] | null | null | null | Lab slides/Lab 7 - array sum.asm | mahmoud-1998/FCIFayoum-Computer-architecture-2018 | ed6793cd6587d430939bd1888e0f33142039b89a | [
"Unlicense"
] | 5 | 2018-12-01T15:17:39.000Z | 2019-10-09T20:50:45.000Z |
; This program Sums content of a 16 bit array
;Author: MBadry
org 100h
include 'emu8086.inc'
.data
array DW 0001h,0002h,0003h
arrayCount = ($-array)/2
.code
main PROC
lea si,array
mov cx, arrayCount
call ArraySum
call PRINT_NUM_UNS
JMP Exit
main ENDP
;-----------------------------------------------------
;ArraySum PROC
;Calculates the sum of an array of 16-bit integers.
;Receives: SI the array offset
; CX = number of elements in the array
;Returns: AX = sum of the array elements
;-----------------------------------------------------
ArraySum PROC
push si
push cx
mov ax,0
L1: add ax,[si]
add si,2
loop L1
pop si
pop cx
ret
ArraySum ENDP
Exit: ret
DEFINE_PRINT_NUM_UNS
END main
| 17.244898 | 56 | 0.518343 |
f1473e0fdb3ab1b53313bc981a310770fe76ce5d | 34,280 | asm | Assembly | tinyweb/httpc/Tbrowser.asm | j-pel/tinyedit | 87037f19cbaed118c4f04fb278640c5f6053b45a | [
"MIT"
] | 1 | 2022-01-12T00:37:44.000Z | 2022-01-12T00:37:44.000Z | tinyweb/httpc/Tbrowser.asm | j-pel/tinyedit | 87037f19cbaed118c4f04fb278640c5f6053b45a | [
"MIT"
] | null | null | null | tinyweb/httpc/Tbrowser.asm | j-pel/tinyedit | 87037f19cbaed118c4f04fb278640c5f6053b45a | [
"MIT"
] | null | null | null | ; MenuetOS Tiny Browser
; File: HTTP client
;--- REVISIONS ---
; Version 0.5 4th March 2004 pelaillo:
; Code reorganization by macros
; Version 0.4 2nd December 2003 Mike Hibbett
; Enabled lowercase/uppcase characters in URL
; Version 0.3 30th November 2003 Mike Hibbett
; Fixed bug with tcp socket opne - uses unique port
; Version 0.2 27th November 2003 Mike Hibbett
; Added user entry of url
; implements url -> IP address resolution through DNS
; Version 0.1 Ville Mikael Turjanmaa
; Original version
;.
;--- INSTRUCTIONS ---
; This program implements a very simple web browser
; Please address comments and improvements
; on board.flatassembler.net
;
; Memory usage
; webpage source file at 0x10000
; decoded text page at 0x20000
; text attribute 0x30000 (1 = normal, 2 = bold, 128+ = link)
;.
; Enabling debugging puts stuff to the debug board
DEBUGGING_ENABLED equ 1
DEBUGGING_DISABLED equ 0
DEBUGGING_STATE equ DEBUGGING_DISABLED
URLMAXLEN equ 50 ; maximum length of url string
include 'menuet.inc'
meos_app_start
code
mov eax,40 ; Report events
mov ebx,10000111b ; Stack 8 + defaults
int 0x40
call draw_window
still:
mov eax,23 ; wait here for event
mov ebx,1
int 0x40
cmp eax,1 ; redraw request ?
je red
cmp eax,2 ; key in buffer ?
je key
cmp eax,3 ; button in buffer ?
je button
; Get the web page data from the remote server
call read_incoming_data
mov eax,[status]
mov [prev_status],eax
mov eax,53
mov ebx,6
mov ecx,[socket]
int 0x40
mov [status],eax
cmp [prev_status],4
jge no_send
cmp [status],4
jne no_send
mov [onoff],1
call send_request
no_send:
call print_status
cmp [prev_status],4
jne no_close
cmp [status],4 ; connection closed by server
jbe no_close ; respond to connection close command
; draw page
call read_incoming_data
mov eax,53
mov ebx,8
mov ecx,[socket]
int 0x40
call draw_page
mov [onoff],0
no_close:
jmp still
red: ; redraw
call draw_window
jmp still
key: ; key
mov eax,2 ; just read it and ignore
int 0x40
shr eax,8
cmp eax,184
jne no_down
cmp [display_from],25
jb no_down
sub [display_from],25
call display_page
no_down:
cmp eax,183
jne no_up
add [display_from],25
call display_page
no_up:
jmp still
button: ; button
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne noclose
mov eax,-1 ; close this program
int 0x40
noclose:
cmp ah,31
jne noup
sub [display_from],20
call display_page
jmp still
noup:
cmp ah,32
jne nodown
add [display_from],20
call display_page
jmp still
nodown:
cmp ah, 10 ; Enter url
jne nourl
mov [addr],dword document_user
mov [ya],dword 38
mov [len],dword URLMAXLEN
mov ecx,[len]
mov edi,[addr]
mov al,' '
rep stosb
call print_text
mov edi,[addr]
f11:
mov eax,10
int 0x40
cmp eax,2 ; key?
jz fbu
jmp still
fbu:
mov eax,2
int 0x40 ; get key
shr eax,8
cmp eax,8
jnz nobs
cmp edi,[addr]
jz f11
sub edi,1
mov [edi],byte ' '
call print_text
jmp f11
nobs:
cmp eax, dword 10
je retkey
cmp eax, dword 13
je retkey
cmp eax,dword 31
jbe f11
; Removed in v0.4
; cmp eax,dword 95
; jb keyok
; sub eax,32
keyok:
mov [edi],al
call print_text
add edi,1
mov esi,[addr]
add esi,URLMAXLEN
cmp esi,edi
jnz f11
jmp still
retkey:
mov ah, 22 ; start load
nourl:
call socket_commands ; opens or closes the connection
jmp still
;****************************************************************************
; Function
; send_request
;
; Description
; Transmits the GET request to the server.
; This is done as GET then URL then HTTP/1.0',13,10,13,10 in 3 packets
;
;****************************************************************************
send_request:
pusha
mov eax,53 ; 'GET '
mov ebx,7
mov ecx,[socket]
mov edx,4
mov esi,string0
int 0x40
mov edx,0
next_edx:
; Determine the length of the url to send in the GET request
inc edx
cmp [edx+document],byte ' '
jne next_edx
mov eax,53 ; document_user
mov ebx,7
mov ecx,[socket]
mov esi,document
int 0x40
mov eax,53 ; ' HTTP/1.0 .. '
mov ebx,7
mov ecx,[socket]
mov edx,stringh_end-stringh
mov esi,stringh
int 0x40
popa
ret
;****************************************************************************
; Function
; print_status
;
; Description
; displays the socket/data received status information
;
;****************************************************************************
print_status:
pusha
mov eax,26
mov ebx,9
int 0x40
cmp eax,[nextupdate]
jb status_return
add eax,25
mov [nextupdate],eax
mov eax,13
mov ebx,5*65536+100
mov ecx,[winys]
shl ecx,16
add ecx,-18*65536+10
mov edx,0xffffff
int 0x40
mov eax,47
mov ebx,3*65536
mov ecx,[status]
mov edx,12*65536-18
add edx,[winys]
mov esi,0x000000
int 0x40
mov eax,47
mov ebx,6*65536
mov ecx,[pos]
mov edx,40*65536-18
add edx,[winys]
mov esi,0x000000
int 0x40
status_return:
popa
ret
;****************************************************************************
; Function
; read_incoming_data
;
; Description
; receive the web page from the server, storing it without processing
;
;****************************************************************************
read_incoming_data:
cmp [onoff],1
je rid
ret
rid:
mov ecx,-1
newbyteread:
mov eax, 53
mov ebx, 2
mov ecx, [socket]
int 0x40
cmp eax,0
je no_more_data
read_more:
mov eax, 53
mov ebx, 3
mov ecx, [socket]
int 0x40
yesm:
inc [pos]
mov ecx,[pos]
mov [0x10000+ecx],bl
call print_status
cmp eax,0
jne read_more
mov eax,5
mov ebx,50
int 0x40
jmp newbyteread
no_more_data:
ret
;****************************************************************************
; Function
; draw_page
;
; Description
; parses the web page data, storing displayable data at 0x20000
; and attributes at 0x30000. It then calls display_page to render
; the data
;
;****************************************************************************
draw_page:
pusha
mov esi,0
mov [command_on_off],0
newlettercheck:
movzx eax,byte [esi+0x10000]
cmp al,'<'
jne no_c_on
mov [command_on_off],1
no_c_on:
cmp al,'>'
jne no_c_off
mov [command_on_off],0
no_c_off:
cmp [command_on_off],0
je no_lower_case
cmp eax,96
jg no_lower_case
cmp eax,65
jb no_lower_case
add eax,32
no_lower_case:
mov [esi+0x10000],al
inc esi
cmp esi,[pos]
jbe newlettercheck
mov edi,0x30000
mov ecx,0x10000
mov al,0
cld
rep stosb
mov [text_type],1
mov [command_on_off],0
mov esi,0
mov ecx,[pos]
; search for double lf
find_dlf:
cmp [0x10000+esi-4],dword 0x0d0a0d0a
je found_dlf
cmp [0x10000+esi-4],dword 0x0a0d0a0d
je found_dlf
cmp [0x10000+esi-2],word 0x0d0d
je found_dlf
cmp [0x10000+esi-2],word 0x0a0a
je found_dlf
cmp esi,5500
je found_dlf
inc esi
jmp find_dlf
found_dlf:
newbyte:
mov al,[esi+0x10000]
cmp al,'<'
jne no_command_on
mov [command_on_off],1
no_command_on:
cmp al,'>'
jne no_command_off
mov [command_on_off],0
jmp byte_done
no_command_off:
mov eax,[esi+0x10000] ; <!--
cmp eax,'<!--'
jne no_com2_start
mov [com2],1
no_com2_start:
mov ax,[esi+0x10000] ; -->
cmp ax,'->'
jne no_com2_end
mov [com2],0
inc esi
jmp byte_done
no_com2_end:
mov eax,[esi+0x10000] ; <script
cmp eax,'<scr'
jne no_script_start
mov [script],1
no_script_start:
mov eax,[esi+0x10000] ; /script>
cmp eax,'</sc'
jne no_script_end
mov [script],0
inc esi
jmp byte_done
no_script_end:
cmp [command_on_off],0
jne no_print
cmp [com2],0
jne no_print
cmp [script],0
jne no_print
mov al,[esi+0x10000] ; &
cmp al,'&'
jne no_nbsp
newsps:
inc esi
mov al,[esi+0x10000] ;
cmp al,';'
jne newsps
jmp byte_done
no_nbsp:
cmp al,13
jne no_lb
jmp byte_done
no_lb:
cmp al,10
jne no_lf
jmp byte_done
no_lf:
mov ebx,[pagey]
imul ebx,[pagexs]
add ebx,[pagex]
add ebx,0x20000
and eax,0xff
cmp eax,31
jbe byte_done
cmp [lastletter],al
jne letter_ok
cmp al,' '
je byte_done
letter_ok:
mov [ebx],al
mov dl,[text_type]
mov [ebx+0x10000],dl
mov [pageyinc],0
mov [lastletter],al
inc [pagex]
mov ebx,[pagex]
cmp ebx,[pagexs]
jb byte_done
mov [pagex],0
inc [pagey]
jmp byte_done
no_print:
; HTML -COMMAND
mov ax,[esi+0x10000] ; b> bold
cmp ax,'b>'
jne no_bold_start
mov [text_type],2
no_bold_start:
mov eax,[esi+0x10000] ; /b bold end
cmp eax,'</b>'
jne no_bold_end
mov [text_type],1
add esi,2
no_bold_end:
mov ax,[esi+0x10000] ; <a
cmp ax,'a '
jne no_link_start
mov [text_type],128
add esi,2
no_link_start:
mov ax,[esi+0x10000] ; /a
cmp ax,'/a'
jne no_link_end2
mov [text_type],1
add esi,0
no_link_end2:
mov ax,[esi+0x10000]
cmp ax,'br'
jne no_br
call linefeed
inc esi
no_br:
mov ax,[esi+0x10000]
cmp ax,'td'
jne no_td
call linefeed
inc esi
no_td:
mov eax,[esi+0x10000]
cmp eax,'tabl'
jne no_table
call linefeed
add esi,3
no_table:
byte_done:
inc esi
cmp esi,[pos]
jbe newbyte
mov [display_from],0
call display_page
popa
ret
;****************************************************************************
; Function
; linefeed
;
; Description
;
;
;****************************************************************************
linefeed:
cmp [pageyinc],2
jge nolf
mov [pagex],0
inc [pagey]
inc [pageyinc]
nolf:
ret
;****************************************************************************
; Function
; display_page
;
; Description
; Renders the text decoded by draw_page
;
;****************************************************************************
display_page:
pusha
mov eax,0
mov ebx,0
newpxy:
push eax
push ebx
mov eax,13 ; background for letter
mov ebx,[esp+4]
imul ebx,6
add ebx,[dpx]
shl ebx,16
add ebx,6
mov ecx,[esp+0]
imul ecx,10
add ecx,[dpy]
shl ecx,16
add ecx,10
mov edx,0xffffff
int 0x40
mov eax,4
mov ebx,[esp+4]
imul ebx,6
add ebx,[dpx]
shl ebx,16
mov bx,[esp+0]
imul bx,10
add bx,word [dpy]
mov esi,[esp]
imul esi,[pagexs]
add esi,[esp+4]
mov edx,[display_from]
imul edx,[pagexs]
add edx,0x20000
add edx,esi
movzx ecx,byte [edx+0x10000]
cmp ecx,1
jne noecx1
mov ecx,0x000000
noecx1:
movzx ecx,byte [edx+0x10000]
cmp ecx,2
jne noecx2
mov ecx,0xff0000
noecx2:
cmp ecx,128
jne noecx128
mov ecx,0x0000ff
noecx128:
mov esi,1
int 0x40
pop ebx
pop eax
inc eax
cmp eax,[pagexs]
jb newpxy
mov eax,0
inc ebx
cmp ebx,30
jb newpxy
popa
ret
;****************************************************************************
; Function
; socket_commands
;
; Description
; opens or closes the socket
;
;****************************************************************************
socket_commands:
cmp ah,22 ; open socket
jnz tst3
; Clear all page memory
mov edi,0x10000
mov ecx,0x30000
mov al,0
cld
rep stosb
; Parse the entered url
call parse_url
; Get a free port number
mov ecx, 1000 ; local port starting at 1000
getlp1:
inc ecx
push ecx
mov eax, 53
mov ebx, 9
int 0x40
pop ecx
cmp eax, 0 ; is this local port in use?
jz getlp1 ; yes - so try next
mov eax,53
mov ebx,5
mov edx,80
mov esi,dword [server_ip]
mov edi,1
int 0x40
mov [socket], eax
mov [pos],0
mov [pagex],0
mov [pagey],0
mov [pagexs],80
mov [command_on_off],0
ret
tst3:
cmp ah,24 ; close socket
jnz no_24
mov eax,53
mov ebx,8
mov ecx,[socket]
int 0x40
call draw_page
ret
no_24:
ret
;****************************************************************************
; Function
; parse_url
;
; Description
; parses the full url typed in by the user into a web address ( that
; can be turned into an IP address by DNS ) and the page to display
; DNS will be used to translate the web address into an IP address, if
; needed.
; url is at document_user and will be space terminated.
; web address goes to webAddr and is space terminated.
; ip address goes to server_ip
; page goes to document and is space terminated.
;
; Supported formats:
; <protocol://>address<page>
; <protocol> is optional, removed and ignored - only http supported
; <address> is required. It can be an ip address or web address
; <page> is optional and must start with a leading / character
;
;****************************************************************************
parse_url:
; First, reset destination variables
cld
mov al, ' '
mov edi, document
mov ecx,URLMAXLEN
rep stosb
mov edi, webAddr
mov ecx,URLMAXLEN
rep stosb
mov al, '/'
mov [document], al
mov esi, document_user
; remove any leading protocol text
mov ecx, URLMAXLEN
mov ax, '//'
pu_000:
cmp [esi], byte ' ' ; end of text?
je pu_002 ; yep, so not found
cmp word [esi], ax
je pu_001 ; Found it, so esi+2 is start
inc esi
loop pu_000
pu_002:
; not found, so reset esi to start
mov esi, document_user -2
pu_001:
add esi, 2
mov ebx, esi ; save address of start of web address
mov edi, document_user + URLMAXLEN ; end of string
; look for page delimiter - it's a '/' character
pu_003:
cmp [esi], byte ' ' ; end of text?
je pu_004 ; yep, so none found
cmp esi, edi ; end of string?
je pu_004 ; yep, so none found
cmp [esi], byte '/' ; delimiter?
je pu_005 ; yep - process it
inc esi
jmp pu_003
pu_005:
; copy page to document address
; esi = delimiter
push esi
inc esi
mov ecx, edi ; end of document_user
mov edi, document
cld
pu_006:
movsb
cmp esi, ecx
je pu_007 ; end of string?
cmp [esi], byte ' ' ; end of text
je pu_007
jmp pu_006
pu_007:
pop esi ; point esi to '/' delimiter
pu_004:
; copy web address to webAddr
; start in ebx, end in esi-1
mov ecx, esi
mov esi, ebx
mov edi, webAddr
cld
pu_008:
movsb
cmp esi, ecx
je pu_009
jmp pu_008
pu_009:
; For debugging, display resulting strings
if DEBUGGING_STATE = DEBUGGING_ENABLED
mov esi, document_user
call debug_print_string
mov esi, webAddr
call debug_print_string
mov esi, document
call debug_print_string
end if
; Look up the ip address, or was it specified?
mov al, [webAddr]
cmp al, '0'
jb pu_010 ; Resolve address
cmp al, '9'
ja pu_010 ; Resolve address
if DEBUGGING_STATE = DEBUGGING_ENABLED
mov esi, str2 ; print gotip
call debug_print_string
end if
; Convert address
mov esi,webAddr-1
mov edi,server_ip
xor eax,eax
ip1:
inc esi
cmp [esi],byte '0'
jb ip2
cmp [esi],byte '9'
jg ip2
imul eax,10
movzx ebx,byte [esi]
sub ebx,48
add eax,ebx
jmp ip1
ip2:
mov [edi],al
xor eax,eax
inc edi
cmp edi,server_ip+3
jbe ip1
jmp pu_011
pu_010:
if DEBUGGING_STATE = DEBUGGING_ENABLED
mov esi, str1 ; print resolving
call debug_print_string
end if
; Resolve Address
call translateData ; Convert domain & DNS IP address
call resolveDomain ; get ip address
if DEBUGGING_STATE = DEBUGGING_ENABLED
mov esi, str3
call debug_print_string
end if
pu_011:
; Done
ret
;***************************************************************************
; Function
; translateData
;
; Description
; Coverts the domain name and DNS IP address typed in by the user into
; a format suitable for the IP layer.
;
; The ename, in query, is converted and stored in dnsMsg
;
;***************************************************************************
translateData:
; first, get the IP address of the DNS server
; Then, build up the request string.
; Build the request string
mov eax, 0x00010100
mov [dnsMsg], eax
mov eax, 0x00000100
mov [dnsMsg+4], eax
mov eax, 0x00000000
mov [dnsMsg+8], eax
; domain name goes in at dnsMsg+12
mov esi, dnsMsg + 12 ; location of label length
mov edi, dnsMsg + 13 ; label start
mov edx, webAddr
mov ecx, 12 ; total string length so far
td002:
mov [esi], byte 0
inc ecx
td0021:
mov al, [edx]
cmp al, ' '
je td001 ; we have finished the string translation
cmp al, '.' ; we have finished the label
je td004
inc byte [esi]
inc ecx
mov [edi], al
inc edi
inc edx
jmp td0021
td004:
mov esi, edi
inc edi
inc edx
jmp td002
; write label len + label text
td001:
mov [edi], byte 0
inc ecx
inc edi
mov [edi], dword 0x01000100
add ecx, 4
mov [dnsMsgLen], ecx
ret
;***************************************************************************
; Function
; resolveDomain
;
; Description
; Sends a question to the dns server
; works out the IP address from the response from the DNS server
;
;***************************************************************************
resolveDomain:
; Get a free port number
mov ecx, 1000 ; local port starting at 1000
getlp:
inc ecx
push ecx
mov eax, 53
mov ebx, 9
int 0x40
pop ecx
cmp eax, 0 ; is this local port in use?
jz getlp ; yes - so try next
; First, open socket
mov eax, 53
mov ebx, 0
mov edx, 53 ; remote port - dns
mov esi, dword [dns_ip]
int 0x40
mov [socketNum], eax
; write to socket ( request DNS lookup )
mov eax, 53
mov ebx, 4
mov ecx, [socketNum]
mov edx, [dnsMsgLen]
mov esi, dnsMsg
int 0x40
; Setup the DNS response buffer
mov eax, dnsMsg
mov [dnsMsgLen], eax
; now, we wait for
; UI redraw
; UI close
; or data from remote
ctr001:
mov eax,10 ; wait here for event
int 0x40
cmp eax,1 ; redraw request ?
je ctr003
cmp eax,2 ; key in buffer ?
je ctr004
cmp eax,3 ; button in buffer ?
je ctr005
; Any data in the UDP receive buffer?
mov eax, 53
mov ebx, 2
mov ecx, [socketNum]
int 0x40
cmp eax, 0
je ctr001
; we have data - this will be the response
ctr002:
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte - block (high byte)
; Store the data in the response buffer
mov eax, [dnsMsgLen]
mov [eax], bl
inc dword [dnsMsgLen]
mov eax, 53
mov ebx, 2
mov ecx, [socketNum]
int 0x40 ; any more data?
cmp eax, 0
jne ctr002 ; yes, so get it
; close socket
mov eax, 53
mov ebx, 1
mov ecx, [socketNum]
int 0x40
mov [socketNum], dword 0xFFFF
; Now parse the message to get the host IP
; Man, this is complicated. It's described in
; RFC 1035
if DEBUGGING_STATE = DEBUGGING_ENABLED
mov esi, str4
call debug_print_string
end if
; 1) Validate that we have an answer with > 0 responses
; 2) Find the answer record with TYPE 0001 ( host IP )
; 3) Finally, copy the IP address to the display
; Note: The response is in dnsMsg
; The end of the buffer is pointed to by [dnsMsgLen]
; Clear the IP address text
mov [server_ip], dword 0
mov esi, dnsMsg
; Is this a response to my question?
mov al, [esi+2]
and al, 0x80
cmp al, 0x80
jne ctr002a
; Were there any errors?
mov al, [esi+3]
and al, 0x0F
cmp al, 0x00
jne ctr002a
; Is there ( at least 1 ) answer?
mov ax, [esi+6]
cmp ax, 0x00
je ctr002a
; Header validated. Scan through and get my answer
if DEBUGGING_STATE = DEBUGGING_ENABLED
pusha
mov esi, str4
call debug_print_string
popa
end if
add esi, 12 ; Skip to the question field
; Skip through the question field
call skipName
add esi, 4 ; skip past the questions qtype, qclass
ctr002z:
; Now at the answer. There may be several answers,
; find the right one ( TYPE = 0x0001 )
call skipName
mov ax, [esi]
cmp ax, 0x0100 ; Is this the IP address answer?
jne ctr002c
; Yes! Point esi to the first byte of the IP address
add esi, 10
mov eax, [esi]
mov [server_ip], eax
ret
ctr002c: ; Skip through the answer, move to the next
add esi, 8
movzx eax, byte [esi+1]
mov ah, [esi]
add esi, eax
add esi, 2
; Have we reached the end of the msg?
; This is an error condition, should not happen
cmp esi, [dnsMsgLen]
jl ctr002z ; Check next answer
jmp ctr002a ; abort
ctr002a:
jmp ctr001
ctr003: ; redraw
jmp ctr001
ctr004: ; key
mov eax,2 ; just read it and ignore
int 0x40
jmp ctr001
ctr005: ; button
mov eax,17 ; get id
int 0x40
; close socket
mov eax, 53
mov ebx, 1
mov ecx, [socketNum]
int 0x40
mov [socketNum], dword 0xFFFF
mov [server_ip], dword 0
ret
;***************************************************************************
; Function
; skipName
;
; Description
; Increment esi to the first byte past the name field
; Names may use compressed labels. Normally do.
; RFC 1035 page 30 gives details
;
;***************************************************************************
skipName:
mov al, [esi]
cmp al, 0
je sn_exit
and al, 0xc0
cmp al, 0xc0
je sn001
movzx eax, byte [esi]
inc eax
add esi, eax
jmp skipName
sn001:
add esi, 2 ; A pointer is always at the end
ret
sn_exit:
inc esi
ret
if DEBUGGING_STATE = DEBUGGING_ENABLED
;****************************************************************************
; Function
; debug_print_string
;
; Description
; prints a string to the debug board, in quotes
;
; esi holds ptr to msg to display, which is space or 0 terminated
;
; Nothing preserved; I'm assuming a pusha/popa is done before calling
;
;****************************************************************************
debug_print_string:
push esi
mov cl, '"'
mov eax,63
mov ebx, 1
int 0x40
pop esi
dps_000:
mov cl, [esi]
cmp cl, 0
je dps_exit
cmp cl, ' '
je dps_exit
jmp dps_001
dps_exit:
mov cl, '"'
mov eax,63
mov ebx, 1
int 0x40
mov cl, 13
mov eax,63
mov ebx, 1
int 0x40
mov cl, 10
mov eax,63
mov ebx, 1
int 0x40
ret
dps_001:
mov eax,63
mov ebx, 1
push esi
int 0x40
pop esi
inc esi
jmp dps_000
end if
;****************************************************************************
; Function
; print_text
;
; Description
; display the url (full path) text
;
;****************************************************************************
print_text:
; Draw a bar to blank out previous text
mov eax,13
mov ebx,30*65536+URLMAXLEN*6 ; 50 should really be [len], and 103 [xa]
mov ecx,[ya]
shl ecx,16
mov cx,9
mov edx,0xFFFFFF
int 0x40
; write text
mov eax,4
mov ebx,30*65536
add ebx,[ya]
mov ecx,0x000000
mov edx,[addr]
mov esi,URLMAXLEN
int 0x40
ret
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
draw_window:
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
int 0x40
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,50*65536+550 ; [x start] *65536 + [x size]
mov ecx,50*65536+400 ; [y start] *65536 + [y size]
mov edx,0x03ffffff ; color of work area RRGGBB,8->color gl
mov esi,0x805080d0 ; color of grab bar RRGGBB,8->color gl
mov edi,0x005080d0 ; color of frames RRGGBB
int 0x40
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
mov ecx,0x00ddeeff ; color of text RRGGBB
mov edx,labelt ; pointer to text beginning
mov esi,labellen-labelt ; text length
int 0x40
mov esi, URLMAXLEN ; URL
mov eax,4 ; function 4 : write text to window
mov ebx,30*65536+38 ; [x start] *65536 + [y start]
mov ecx,0x000000 ; color of text RRGGBB
mov edx,document_user ; pointer to text beginning
int 0x40
mov eax,38
mov ebx,5*65536+545
mov ecx,60*65536+60
mov edx,0x000000
int 0x40
mov eax,38
mov ebx,5*65536+545
mov ecx,[winys]
shl ecx,16
add ecx,[winys]
sub ecx,26*65536+26
mov edx,0x000000
int 0x40
; RELOAD
mov eax,8 ; function 8 : define and draw button
mov ebx,388*65536+50 ; [x start] *65536 + [x size]
mov ecx,34*65536+14 ; [y start] *65536 + [y size]
mov edx,22 ; button id
mov esi,0x5588dd ; button color RRGGBB
int 0x40
; URL
mov eax,8 ; function 8 : define and draw button
mov ebx,10*65536+12 ; [x start] *65536 + [x size]
mov ecx,34*65536+12 ; [y start] *65536 + [y size]
mov edx,10 ; button id
mov esi,0x5588dd ; button color RRGGBB
int 0x40
; STOP
mov eax,8 ; function 8 : define and draw button
mov ebx,443*65536+50 ; [x start] *65536 + [x size]
mov ecx,34*65536+14 ; [y start] *65536 + [y size]
mov edx,24 ; button id
mov esi,0x5588dd ; button color RRGGBB
int 0x40
; BUTTON TEXT
mov eax,4 ; function 4 : write text to window
mov ebx,390*65536+38 ; [x start] *65536 + [y start]
mov ecx,0xffffff ; color of text RRGGBB
mov edx,button_text ; pointer to text beginning
mov esi,20 ; text length
int 0x40
call display_page
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
ret
data
if DEBUGGING_STATE = DEBUGGING_ENABLED
str1: db "Resolving...",0
str3: db "Resolved",0
str2: db "GotIP",0
str4: db "GotResponse",0
end if
button_text db ' RELOAD STOP '
dpx dd 25 ; x - start of html page in pixels in window
dpy dd 65 ; for y
lastletter db 0
pageyinc dd 0
display_from dd 20
pos dd 0x0
pagex dd 0x0
pagey dd 0x0
pagexs dd 80
command_on_off dd 0x0
text_type db 1
com2 dd 0x0
script dd 0x0
socket dd 0x0
addr dd 0x0
ya dd 0x0
len dd 0x00
labelt: db 'HTTPC - PgUp/PgDown'
labellen:
server_ip: db 207,44,212,20
dns_ip: db 194,145,128,1
webAddr: times 128 db ' '
document_user: db 'Click on the button to the left to enter a URL',0
times 100 db 0x0
document: db '/'
times 100 db ' '
string0: db 'GET '
stringh: db ' HTTP/1.0',13,10,13,10
stringh_end:
status dd 0x0
prev_status dd 0x0
onoff dd 0x0
nextupdate: dd 0
winys: dd 400
dnsMsgLen: dd 0
socketNum: dd 0xFFFF
dnsMsg:
udata
meos_app_end | 22.838108 | 79 | 0.463856 |
71ef596023a1ebe2b7e19710bd36169fffaacde9 | 245 | asm | Assembly | data/mapHeaders/FuchsiaGym.asm | AmateurPanda92/pokemon-rby-dx | f7ba1cc50b22d93ed176571e074a52d73360da93 | [
"MIT"
] | 9 | 2020-07-12T19:44:21.000Z | 2022-03-03T23:32:40.000Z | data/mapHeaders/FuchsiaGym.asm | JStar-debug2020/pokemon-rby-dx | c2fdd8145d96683addbd8d9075f946a68d1527a1 | [
"MIT"
] | 7 | 2020-07-16T10:48:52.000Z | 2021-01-28T18:32:02.000Z | data/mapHeaders/FuchsiaGym.asm | JStar-debug2020/pokemon-rby-dx | c2fdd8145d96683addbd8d9075f946a68d1527a1 | [
"MIT"
] | 2 | 2021-03-28T18:33:43.000Z | 2021-05-06T13:12:09.000Z | FuchsiaGym_h:
db GYM ; tileset
db FUCHSIA_GYM_HEIGHT, FUCHSIA_GYM_WIDTH ; dimensions (y, x)
dw FuchsiaGym_Blocks ; blocks
dw FuchsiaGym_TextPointers ; texts
dw FuchsiaGym_Script ; scripts
db 0 ; connections
dw FuchsiaGym_Object ; objects
| 27.222222 | 61 | 0.791837 |
ed6d0ea2fa3f47c9ae79b8984bce3e1d5ee7f0e7 | 4,392 | asm | Assembly | Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xa0_notsx.log_3_1704.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xa0_notsx.log_3_1704.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xa0_notsx.log_3_1704.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 %r8
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0xcb8b, %rdi
nop
nop
nop
sub %r12, %r12
mov (%rdi), %r8w
nop
nop
sub $58807, %r10
lea addresses_WT_ht+0xa98b, %r9
clflush (%r9)
nop
nop
nop
nop
nop
and $24020, %rax
mov $0x6162636465666768, %r11
movq %r11, %xmm2
movups %xmm2, (%r9)
xor $25223, %r9
lea addresses_WC_ht+0x174eb, %rsi
lea addresses_WT_ht+0x109cb, %rdi
clflush (%rsi)
nop
nop
nop
add $31432, %r8
mov $99, %rcx
rep movsq
nop
nop
nop
and %rcx, %rcx
lea addresses_A_ht+0x625b, %rsi
clflush (%rsi)
nop
nop
nop
nop
nop
cmp %rcx, %rcx
mov $0x6162636465666768, %rdi
movq %rdi, %xmm7
and $0xffffffffffffffc0, %rsi
vmovaps %ymm7, (%rsi)
xor %r9, %r9
lea addresses_UC_ht+0x10c8b, %rdi
nop
nop
nop
nop
add %rsi, %rsi
movl $0x61626364, (%rdi)
nop
nop
nop
nop
xor %r10, %r10
lea addresses_UC_ht+0x258b, %rsi
lea addresses_WC_ht+0xe70b, %rdi
nop
nop
nop
nop
nop
and $36258, %r12
mov $74, %rcx
rep movsl
nop
nop
nop
dec %r9
lea addresses_UC_ht+0x1778b, %r10
nop
nop
nop
mfence
movups (%r10), %xmm5
vpextrq $0, %xmm5, %rax
nop
cmp $31882, %rcx
lea addresses_UC_ht+0x863b, %rsi
lea addresses_D_ht+0x18a8b, %rdi
nop
nop
dec %r10
mov $89, %rcx
rep movsw
nop
nop
nop
nop
nop
xor $19099, %r9
lea addresses_normal_ht+0x1b2af, %rsi
lea addresses_WT_ht+0x7647, %rdi
nop
nop
nop
nop
dec %r8
mov $61, %rcx
rep movsw
nop
nop
nop
and %r12, %r12
lea addresses_WT_ht+0x1328b, %r9
nop
nop
inc %rcx
movl $0x61626364, (%r9)
nop
nop
sub $25380, %r8
lea addresses_UC_ht+0x1444c, %r11
nop
nop
nop
nop
nop
and %r9, %r9
movw $0x6162, (%r11)
nop
nop
nop
nop
inc %r12
lea addresses_WT_ht+0x1f8b, %rsi
lea addresses_WT_ht+0x1933f, %rdi
nop
cmp %r9, %r9
mov $5, %rcx
rep movsw
nop
sub $6882, %rsi
lea addresses_normal_ht+0x4b6b, %r9
nop
nop
nop
nop
xor $40585, %r11
vmovups (%r9), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $1, %xmm5, %rax
and $7757, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r14
push %r8
push %rdx
// Faulty Load
lea addresses_US+0x3f8b, %rdx
nop
sub %r11, %r11
movb (%rdx), %r13b
lea oracles, %rdx
and $0xff, %r13
shlq $12, %r13
mov (%rdx,%r13,1), %r13
pop %rdx
pop %r8
pop %r14
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_US', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_US', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 7}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 8}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': True, 'size': 32, 'NT': False, 'same': False, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 8}}
{'src': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}}
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}}
{'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'}
{'00': 3}
00 00 00
*/
| 20.239631 | 151 | 0.655055 |
d0faaf70e8d4fdd3069333e378db4b79e6310b67 | 76,276 | asm | Assembly | Library/Kernel/Heap/heapCore.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 504 | 2018-11-18T03:35:53.000Z | 2022-03-29T01:02:51.000Z | Library/Kernel/Heap/heapCore.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 96 | 2018-11-19T21:06:50.000Z | 2022-03-06T10:26:48.000Z | Library/Kernel/Heap/heapCore.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 73 | 2018-11-19T20:46:53.000Z | 2022-03-29T00:59:26.000Z | COMMENT @-----------------------------------------------------------------------
Copyright (c) GeoWorks 1988 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Kernel
FILE: heapCore.asm (core heap routines)
AUTHOR: Tony Requist
ROUTINES:
Name Description
---- -----------
INT FindFree Create a free block on the heap of the given size
INT RelocateBlock Move a block from one position to another
INT FixLinks Fix the links to a block from prev and next blocks
INT CombineBlocks Combine two adjacent blocks if both are free
INT SplitBlock Split a block into a free block and a non-free block
INT SplitBlockFreeRemainder Split a used block in two, freeing one of the
two pieces
INT SwapHandles Swap the block associated with two handles
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 4/88 Initial version
Chris 10/88 Made ParaToByte external. Needs new name.
Tony 10/88 Comments from Jim's code review added
Cheng 5/89 Code for VM blocks added
DESCRIPTION:
This file conatins the core heap routines. See manager.asm for details.
$Id: heapCore.asm,v 1.1 97/04/05 01:14:05 newdeal Exp $
-------------------------------------------------------------------------------@
COMMENT @-----------------------------------------------------------------------
FUNCTION: FindFree
DESCRIPTION: Find a block of memory of the given size and type.
CALLED BY: INTERNAL
DoAlloc, SysInfo
PASS:
exclusive access to heap variables
ax - size (in paragraphs) requested -- if 0xffff then treat this as
a request to find the largest block
cl - flags for block type
HF_FIXED => search from bottom of memory (fixed heap)
HF_DEBUG => search from top of memory, but not beyond original
heap confines b/c block is pseudo-fixed and may be
needed at interrupt time, and we can't guarantee
its availability if the thing is allocated in the
EMS page frame, e.g.
0 => search from top of memory
HF_FIXED+HF_DEBUG => search from top of memory (movable heap),
and continue into fixed heap.
ds - kernel data segment
RETURN:
carry - set if not successful
bx - handle of block found
ax, cx, ds - unchanged
DESTROYED:
si, di
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
/* See if there is space on the heap. If so, done */
SearchHeap(paraRequested);
if (SearchHeap found space) begin
return(successful);
end
/* Next, get rid of cached memory */
FlushGStateCache();
curSwapDriver = first swap driver
/* Next, try compacting the heap. If this does not work, */
/* throw out blocks until there is enough space */
do begin
if (no compaction was specified) begin
return(unsuccessful);
end
CompactHeap();
SearchHeap(paraRequested);
if (SearchHeap found space) begin
return(successful);
end
if (no removing blocks was specified) begin
return(unsuccessful);
end
ThrowOutBlocks(paraRequested - largest block);
while (ThrowOutBlocks did not return error);
return(unsuccessful);
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 4/88 Initial version
Tony 10/88 Comments from Jim's code review added
-------------------------------------------------------------------------------@
FindFree proc far uses cx, ax, dx
parasNeeded local word ; # paragraphs caller needs
blockType local HeapFlags
.enter
EC < call AssertHeapMine >
;
; Save parameters in local variables to avoid constant, nagging
; pushes and pops.
;
mov parasNeeded, ax
mov blockType, cl
;
; First just look for space on the heap. If it's there, we're happy.
;
call SearchHeap ;see if room exists
jnc gotIt ;if so then done
;
; If we're trying to allocate a fixed block and there is a locked
; block too close to the top of fixed heap, there is no point
; compacting the heap and/or throwing out blocks repeatedly, because
; doing so won't make us enough room anyway. Hence we detect such a
; situation and return an error to our caller now, instead of
; returning an error after we throw out *all* unlocked blocks, which
; causes unnecessary threshing both now and later.
;
mov cl, blockType
andnf cl, mask HF_FIXED or mask HF_DEBUG ;discard other bits
cmp cl, mask HF_FIXED
jne checkDone ;=> not normal fixed blk
call CalcNonLockedSpaceAboveFixedHeap ;ax = # paras
cmp ax, parasNeeded
jb jcDone ;=> impossible to make room (CF set)
checkDone:
mov di,offset swapTable
;
; Try compacting the heap (again)
;
cmp parasNeeded, 0xffff
jz forceCompact
if INI_SETTABLE_HEAP_THRESHOLDS
push ax, es
mov ax, segment minSpaceForInitialCompaction
mov es, ax
mov ax, es:minSpaceForInitialCompaction
cmp ds:loaderVars.KLV_heapFreeSize, ax
pop ax, es
else
cmp ds:loaderVars.KLV_heapFreeSize, MIN_SPACE_FOR_INITIAL_COMPACTION
endif
jbe noCompact
forceCompact:
mov cl,TRUE ;compact entire heap
call CompactHeap ;compact to try to make room
mov cl, blockType
mov ax, parasNeeded
;
; if (finding largest block) then return (registers loaded properly)
;
cmp ax,0ffffh
LONG jz findLargest
;
; Search through the heap again to see if we've made enough room yet.
;
call SearchHeap ;see if room exists
jnc gotIt ;if so then done
noCompact:
;
; Nope. Throw out enough blocks, over and above the size of the largest
; block on the heap, for the request to be filled.
;
mov ax, parasNeeded
sub ax,dx ;calculate # of para to throw out
; always throw out a fair amount (or else it is not worth our while)
if INI_SETTABLE_HEAP_THRESHOLDS
push dx, ds
mov dx, segment minSpaceToThrowOut
mov ds, dx
cmp ax, ds:minSpaceToThrowOut
pop dx, ds
else
cmp ax, MIN_SPACE_TO_THROW_OUT
endif
jae 10$
if INI_SETTABLE_HEAP_THRESHOLDS
push dx, ds
mov dx, segment minSpaceToThrowOut
mov ds, dx
mov ax, ds:minSpaceToThrowOut
pop dx, ds
else
mov ax, MIN_SPACE_TO_THROW_OUT
endif
10$:
push bp
call ThrowOutBlocks
pop bp
jcDone:
jc done ;if error then branch
;
; See if the room was generated in the right place...
;
mov ax, parasNeeded
mov cl, blockType
call SearchHeap ;see if room exists now.
jnc gotIt
call FlushGstateCache ;free cached GStates
jmp forceCompact ;nope -- go back to compact the heap
gotIt:
;
; If allocating movable, try to avoid allocating too close to fixed
; if there's enough free space in the movable. "Too close" here means
; in the final free block before the fixed heap. If the movable heap,
; minus the block we got back, contains more than 1/4 free space,
; but the request still couldn't be satisfied from any free
; block but the boundary block, compact the heap and do one more search.
;
test blockType, mask HF_FIXED; Allocating fixed? (clears CF)
jnz done ; Yes -- don't care about this
mov si, ds:[bx].HM_next
cmp si, ds:[loaderVars].KLV_handleBottomBlock
; Are we at the top of the heap?
je done ; Yes -- don't care about this
mov al, ds:[si].HM_flags ; Are we stuck in the middle?
mov si, ds:[bx].HM_prev
xor al, ds:[si].HM_flags
test al, mask HF_FIXED ; (clears CF)
jz done ; if blocks are of the same type,
; we're not at the block-between-the-
; heaps, so we don't care.
mov ax, ds:[bx].HM_size
sub cx, ax ; our block was added in...
sub ax, parasNeeded ; Reduce size of inter-block by amount
; we require
cmp ax, (64 * 1024) shr 4 ; Within 64K of fixed heap?
jae done ; Nope -- don't worry about it.
; flag danger to heap if w/in 32K of fixed heap
cmp ax, DANGER_LEVEL shr 4 ; Within danger level?
jae checkFragmentation ; nope
call VScrub ; yup -- activate scrub thread
checkFragmentation:
; see if anything to be gained from compacting the heap now
add ax, ds:[bx].HM_addr ; figure total space above and
; including our block
sub ax, ds:loaderVars.KLV_heapEnd
neg ax
shr ax ; divide total by 4
shr ax
cmp ax, cx ; free space >= 1/4 total?
jb compactAndSearch ; yes -- must be fragmented. compact and
; try again.
done:
EC < jc 99$ >
EC < mov ax, parasNeeded >
EC < cmp ds:[bx].HM_size, ax >
EC < ERROR_B GASP_CHOKE_WHEEZE >
EC <99$: >
.leave
ret
findLargest:
;
; Just finding largest block -- search heap once more and return what
; we got.
;
call SearchHeap
jmp done
compactAndSearch:
;
; The movable heap is too fragmented and we're allocating too close to
; fixed space for our own comfort, so compact the heap and make one
; more search.
;
mov cl, TRUE
call CompactHeap
mov ax, parasNeeded
mov cl, blockType
call SearchHeap
jmp done
FindFree endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: SearchHeap
DESCRIPTION: Search the heap for a free block of the given size, or search
for the largest free block.
CALLED BY: INTERNAL
FindFree
PASS:
exclusive access to heap variables
ax - size (in paragraphs) requested ($ffff to find largest)
cl - HeapFlags for block being allocated
HF_FIXED => search from bottom of memory (fixed heap)
HF_DEBUG => search from top of memory, but not beyond original
heap confines b/c block is pseudo-fixed and may be
needed at interrupt time, and we can't guarantee
its availability if the thing is allocated in the
EMS page frame, e.g.
0 => search from top of memory
HF_FIXED+HF_DEBUG => search from top of memory (movable heap),
and continue into fixed heap.
ds - handles segment
RETURN:
carry - set if not successful
bx - handle of block found, or handle to largest block if none found
dx - size of block bx
cx - amount of free space above/below bx
ds - unchanged
DESTROYED:
si
REGISTER/STACK USAGE:
ax - number of paragraphs needed
bx - tempPtr
dx - size of largest block so far
bp - handle of largest block so far
si - offset to HM_prev or HM_next
di - blockToStopAt
PSEUDO CODE/STRATEGY:
tempPtr = handleBottomBlock;
if (request is at allocate from top)
tempPtr = tempPtr->HM_prev;
endif
blockToStopAt = tempPtr
do begin
if (tempPtr is free)
if (block is big enough)
return (tempPtr)
endif
endif
while (tempPtr != blockToStopAt && tempPtr type == request type)
return (not found)
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 4/88 Initial version
Tony 10/88 Comments from Jim's code review added
-------------------------------------------------------------------------------@
SearchHeap proc near uses di
largest local hptr ; Largest free block so far
sizeFree local word ; Amount free so far in blocks too small
upperLimit local sptr ; Highest address allowed for allocation
.enter
EC < call AssertHeapMine >
;
; Figure starting conditions: initial block (bx) and which pointer in
; the handle should be used to get to the next one (si)
;
mov dx, ds:[loaderVars].KLV_heapEnd
mov si, HM_next ;assume from bottom
mov bx, ds:[loaderVars].KLV_handleBottomBlock
AXIP < mov di, bx ;save block at which to stop >
andnf cl, mask HF_FIXED or mask HF_DEBUG ;discard other bits
cmp cl, mask HF_FIXED
je startSearch ;=> HF_FIXED only, search from bottom
mov si, HM_prev ;from top -- go backwards
if TRACK_FINAL_FREE
mov bx, ds:[lastFreeBlock] ; and start with final free block
else
NOAXIP< mov bx, ds:[bx][si] ;and start at top >
AXIP < mov di, ds:[bx][si] ;save block at which to stop >
AXIP < mov bx, ds:[xipHandleTopBlock] >
AXIP < mov bx, ds:[bx][si] ;previous handle is start point >
endif
cmp cl, mask HF_DEBUG ;allocating pseudo-fixed?
jne startSearch ;=> 0 or HF_FIXED+HF_DEBUG. Not p-fixed
mov dx, ds:[loaderVars].KLV_origHeapEnd
;yes -- don't allocate beyond original
; heap confines.
startSearch:
mov ss:[upperLimit], dx
clr dx ;init largest so far
mov ss:[largest], dx ; and largest handle
mov ss:[sizeFree], dx ; and accumulated free-space
NOAXIP< mov di,bx ;save block at which to stop >
; the loop starts here -- loop until block found or done
blockLoop:
EC < call ECCheckHandleForWeirdness >
cmp ds:[bx][HM_owner],0 ;test for block free (owner = 0)
jz free
; Don't check for heap boundary if allocating movable with desperate
; method.
cmp cl, mask HF_FIXED or mask HF_DEBUG
je tryNext ;=> don't check
mov ch, cl
xor ch,ds:[bx][HM_flags] ;check for types different
CheckHack <mask HF_FIXED eq 0x80>
js notFound ;differ => crossed into other heap so
; there's nothing big enough in the
; heap we want.
tryNext:
; move to next block on list
mov bx,ds:[bx][si] ;follow pointer
cmp bx,di
jnz blockLoop ;if looped around then done
notFound:
mov bx, ss:[largest] ; return handle of largest block found
stc
jmp done
free:
;
; We've found a free block. See if it's larger than the
; largest one we've seen so far.
;
; ax - size required
; bx - handle of free block
; dx - size of largest block seen so far
;
push cx
mov cx, ds:[bx].HM_size ;adjust accumulated free-space size
add ss:[sizeFree], cx
cmp dx, cx ;block biggest yet?
pop cx
jae tryNext ;not as big as biggest and biggest
; wasn't enough, so advance to next
;
; This block is the biggest. See if it's in the valid range.
; If it's not, we don't want to save its size, because that
; will cause us to ignore smaller blocks inside the valid
; range that are actually big enough to satisfy the required
; size.
;
push bx
mov bx, ds:[bx].HM_addr ;block beyond allowed range?
cmp ss:[upperLimit], bx ;upper limit below this block?
; (carry cleared by comparison on fall
; through)
pop bx
jbe tryNext ;yes -- keep looking
mov dx, ds:[bx].HM_size ;record size
mov ss:[largest], bx ;save handle
cmp dx, ax ;block big enough?
jb tryNext
done:
mov cx, ss:[sizeFree] ;return size free above chosen block
; (or in entire movable/fixed part of
; heap)
.leave
ret
SearchHeap endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CalcNonLockedSpaceAboveFixedHeap
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Calculate the amount of contiguous non-locked space above
the topmost fixed block and the bottommost locked movable
block (if any). This includes space from all free blocks
and all unlocked movable blocks. Space above KLV_origHeapEnd
is not counted, however.
CALLED BY: INTERNAL
FindFree
PASS: ds = kernel data segment
RETURN: ax = # paragraphs
DESTROYED: bx, cx, di
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
Fake blocks in fixed heap are treated as fixed (HF_FIXED set).
Fake blocks in movable heap are treated as locked (HM_lockCount = 1).
Pseudo-fixed blocks are treated as locked (HM_lockCount =
LOCK_COUNT_MOVABLE_PERMANENTLY_FIXED).
This routine hasn't been tested in XIP yet. -- ayuen 4/30/00
REVISION HISTORY:
Name Date Description
---- ---- -----------
ayuen 4/28/00 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AXIP < PrintMessage <This routine hasn't been tested in XIP yet.> >
CalcNonLockedSpaceAboveFixedHeap proc near
mov ax, ds:[loaderVars].KLV_origHeapEnd ; ax = upper limit
mov bx, ds:[loaderVars].KLV_handleBottomBlock
jmp checkAddr ; enter the loop
blkLoop:
mov bx, ds:[bx].HM_next
cmp bx, ds:[loaderVars].KLV_handleBottomBlock
je endFound ; => prev blk was top blk
checkAddr:
mov di, ds:[bx].HM_addr
cmp di, ax ; KLV_origHeapEnd reached?
jae endFound ; => yes
test ds:[bx].HM_flags, mask HF_FIXED
jz notFixed ; => free or unlocked or locked
mov cx, di ; cx = start addr of this fixed blk
add cx, ds:[bx].HM_size ; cx = end addr of this fixed blk
if ERROR_CHECK
; SearchHeap claims it doesn't allocate fixed blocks in the region
; above KLV_origHeapEnd, but I think as a bug it may do that. So
; let's try to catch that case.
Assert b, cx, ax ; assert end of blk below origHeapEnd
endif ; ERROR_CHECK
jmp blkLoop
notFixed:
tst ds:[bx].HM_lockCount
jz blkLoop ; => free or unlocked
; locked block found
mov ax, di ; ax = start addr of this locked blk
endFound:
;
; We know for sure the above loop has found an end address of some
; fixed block, since we know there exist at least two fixed blocks:
; kdata and kcode.
;
sub ax, cx ; ax = non-locked space
ret
CalcNonLockedSpaceAboveFixedHeap endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: CompactHeap
DESCRIPTION: Compact the heap to bring the free space togather
CALLED BY: INTERNAL
FindFree
PASS:
exclusive access to heap variables
cl - flag - TRUE for compact whole heap, FALSE for incremental mode
ds - kernel data segment
RETURN:
carry - set if entire heap compacted
ds - same
DESTROYED:
ax, bx, cx, dx, bp, si
REGISTER/STACK USAGE:
bx - firstBlock
cx - incremental flag
dx - mlSize
si - secondBlock
bp - mlBlock (block to which unlocked blocks are shifted, if they'll
fit)
PSEUDO CODE/STRATEGY:
Move from the end of the stack forward, moving all unlocked moveable
blocks towards the end of memory.
mlSize = 0 /* this is the free block */
/* used to move stuff around */
/* locked blocks */
firstBlock = handleBottomBlock->HM_prev /* last block on heap */
while (1) do begin
secondBlock = firstBlock
firstBlock = firstBlock->HM_prev
if (firstBlock > secondBlock)
exit()
endif
Combine(firstBlock, secondBlock)
if (firstBlock not free)
if (firstBlock fixed)
exit()
endif
INT_OFF
if (firstBlock locked)
INT_ON
if (secondBlock free
and secondBlock.size > mlSize)
mlBlock = secondBlock
mlSize = secondBlock.size
endif
else
temp = firstBlock.address
firstBlock.address = 0
INT_ON
if (firstBlock->HM_size <= mlSize)
Move(firstBlock to mlBlock)
firstBlock.address = moved to address
if (incremental flag)
exit
endif
firstBlock = mlBlock
else if (secondBlock free)
Swap(firstBlock, secondBlock)
firstBlock.address = moved to address
if (incremental flag)
exit
endif
endif
endif
endif
end
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
Stop compacting if you get a block of the needed size?
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 4/88 Initial version
Tony 10/88 Comments from Jim's code review added
-------------------------------------------------------------------------------@
CompactHeap proc near uses bp, di
.enter
EC < call AssertHeapMine >
EC < call ECMemVerifyHeapLow >
; mlSize = 0
; firstBlock = handleBottomBlock.HM_prev
;
; Initialize state, pointing to highest block on the heap and setting
; mlSize (size of the block to which unlocked movable blocks can be
; copied) to 0 so we don't try to move anything. mlSize (dx) will be set
; throughout this loop to be the size of the largest free block seen
; so far. mlBlock (bp) holds the handle of this modern wonder.
;
clr dx
if TRACK_FINAL_FREE
; no point in starting with any block past the last free one, as that
; part of the heap is clearly already compacted.
;
mov bx, ds:[lastFreeBlock]
else
call GetLastBlock
jc done ;CF set => nothing to compact (!?)
endif
blockLoop:
;
; Shift our focus down to the next block. If the address of our new
; block-of-the-minute is greater than our previous block's, it means
; we've wrapped and should quit while we're ahead.
;
INT_ON
mov si,bx ;secondBlock = firstBlock
mov bx,ds:[bx][HM_prev] ;firstBlock = firstBlock.HM_prev
mov di,ds:[bx][HM_addr] ;di = address (used if block moved)
cmp di,ds:[si][HM_addr] ;make sure first block < second block
EC < ERROR_E CORRUPTED_HEAP >
ja allCompact
;
; Combine the two blocks in case previous motion yielded two
; free blocks next to each other (CombineBlocks handles being
; given an in-use block or two).
;
call CombineBlocks
;
; If block is free, we don't do anything with it for now. When we're
; sure it can't be combined with any earlier blocks (i.e. when it's our
; secondBlock and our firstBlock is in-use), we'll deal with possibly
; making it the mlBlock to which lower blocks will be moved.
;
cmp ds:[bx][HM_owner],0 ;check for free
jz blockLoop
;
; Exit if we've gotten back to the fixed portion of the heap
;
test ds:[bx][HM_flags],mask HF_FIXED
jnz allCompact ;heap totally compacted if so
;
; See if our current secondBlock should be promoted to be our preferred
; mlBlock destination. We do this if secondBlock is both free and
; larger than our current mlBlock.
;
INT_OFF
cmp ds:[bx][HM_lockCount],0 ;check for locked
jz unLocked ;if unlocked then branch
cmp ds:[si][HM_owner],0 ;test for secondBlock free
jnz blockLoop ;if not then loop
cmp ds:[si][HM_size],dx ;compare size to mlSize
jbe blockLoop
mov bp,si ;save free block to move stuff to
mov dx,ds:[si][HM_size] ;and save size
jmp blockLoop
unLocked:
;
; See if we can shift this block to the current destination.
;
cmp ds:[bx][HM_size],dx ;check for able to move this block
jbe moveAround ;around a fixed block
;
; Well, if we can't move it to the current destination, see if
; secondBlock is free and shift firstBlock up to there if it
; is, getting the contents that much higher in memory.
;
cmp ds:[si][HM_owner],0 ;test for secondBlock free
jnz blockLoop ;if not then loop -- nothing we can do.
mov ds:[bx][HM_addr],0 ;data address is saved in di
INT_ON
push cx
push dx
mov dx, di
call callContract
mov di, dx
mov si, ds:[bx].HM_next ;reload SI in case block was contracted
; and former SI was combined with new
; free block holding BX's former free
; space.
mov ax, ds:[si].HM_size ;compensate for DoFree that SwapHandles
sub ds:[loaderVars].KLV_heapFreeSize, ax
; will be doing in a bit...
call SwapUsedFree ;swap the blocks at bx and si. This
; will cause us to re-examine si with
; it having been combined with bx.prev
; if that was free too.
pop dx
afterMove:
pop cx
;XXX: IS THIS EVER USED?
tst cl ;test for compacting entire heap
jnz blockLoop ;if so then keep going
clc ;return that entire heap is (probably)
;not compacted
done:
EC < pushf >
EC < call ECMemVerifyHeapLow >
EC < popf >
.leave
ret
allCompact:
stc
jmp done
moveAround:
;We're here to move a block around a (or many) locked block(s).
; bx is block to move, bp is destination, dx is destination size
;
; zero bx's address so no-one tries to use it while it's in-transit
;
mov ds:[bx][HM_addr],0 ;data address is saved in di
INT_ON ;can now allow switches
xchg dx, di ;dx <- data address, di <- mlSize
call callContract ;contract block before moving
xchg dx, di
push cx ;save "incremental flag" -- it will
; be restored at afterMove
;
; Split mlBlock into two, if necessary, pointing mlBlock at the higher
; portion, sized to fit the block we're shifting.
;
mov ax,ds:[bx][HM_size] ;size to create
sub ds:[loaderVars].KLV_heapFreeSize, ax
;compensate for DoFree that SwapHandles
; will be doing later...
xchg bx,bp ;pass block to split and save block
; being moved
clr cl ;allocate at top (movable)
call SplitBlockWithAddr
mov si,bx ;restore proper relationship between
; source and dest.
mov bx, bp
;
; Move the data and reposition bx in the handle chain. This will cause
; us to re-traverse the blocks between the block we just moved and the
; destination block to which we moved it, which is good.
;
call RelocateBlock
clr dx ;reset free block size -- it will be
; handled by re-traversing the handle
; list from bx's new position.
jmp afterMove
;---
callContract:
mov ax, ds:systemCounter.low
sub ax, ds:[bx].HM_usageValue
mov cx, LCT_ALWAYS_COMPACT
cmp ax, AGE_TO_ALWAYS_LMEM_COMPACT
jae gotCompactParam
mov cx, LCT_COMPACT_IF_12_FREE
cmp ax, AGE_TO_LMEM_COMPACT_IF_12_FREE
jae gotCompactParam
mov cx, LCT_COMPACT_IF_25_FREE
cmp ax, AGE_TO_LMEM_COMPACT_IF_25_FREE
jae gotCompactParam
mov cx, LCT_COMPACT_IF_50_FREE
gotCompactParam:
call ContractIfLMem ;contract the block before moving it
retn
CompactHeap endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SplitBlockWithAddr
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Split a block that still has its address in HM_addr
CALLED BY: CompactHeap, DoReAlloc
PASS: ax = size of block to allocate (paragraphs)
bx = block to split
cl = mask HF_FIXED to leave bottom allocated,
0 to leave top allocated
RETURN: bx = block that was split (ax paragraphs)
si = handle to free memory, if any
dx = segment address of used block
carry set if block was actually split
DESTROYED: ax
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
lastFreeBlock may be updated
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 6/23/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SplitBlockWithAddrFar proc far
call SplitBlockWithAddr
ret
SplitBlockWithAddrFar endp
SplitBlockWithAddr proc near
.enter
clr dx
xchg ds:[bx].HM_addr, dx ;fetch block addr & zero it
call SplitBlock ;split block into two
mov ds:[bx].HM_addr, dx ;restore new address
if TRACK_FINAL_FREE
pushf
push si
jc checkLastFree ; => si is handle to free memory
clr si ; no free memory
checkLastFree:
cmp ds:[lastFreeBlock], bx ; did we just split the last beast?
jne giveOverNewMem ; no, so couldn't have changed
; anything.
tst si ; any free stuff left here?
jnz haveLastFree ; yes -- that must still be the last
; free block, regardless of whether
; used space was allocated from top
; or bottom
mov si, bx ; no -- find next free block below
; what was the last.
findLastFree:
mov si, ds:[si].HM_prev
cmp ds:[si].HM_owner, 0 ; free?
jne findLastFree
haveLastFree:
mov ds:[lastFreeBlock], si
giveOverNewMem:
pop si
popf
endif
.leave
ret
SplitBlockWithAddr endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SplitBlockFreeRemainderWithAddr
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Split a block that still has its address in HM_addr and free
the remainder.
CALLED BY: MemExtendHeap
PASS: ax = size of block to allocate (paragraphs)
bx = block to split
cl = mask HF_FIXED to leave bottom allocated,
0 to leave top allocated
RETURN: bx = block that was split (ax paragraphs)
dx = segment address of used block
carry set if block was actually split
DESTROYED: ax, si
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 6/23/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SplitBlockFreeRemainderWithAddr proc far
.enter
clr dx
xchg ds:[bx].HM_addr, dx ;fetch block addr & zero it
call SplitBlockFreeRemainder ;split block into two
mov ds:[bx].HM_addr, dx ;restore new address
.leave
ret
SplitBlockFreeRemainderWithAddr endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: SplitBlock
DESCRIPTION: Split a block into two blocks
CALLED BY: INTERNAL
DoAlloc, CompactHeap, DoReAlloc
PASS:
exclusive access to heap variables
ax - block size to create (paragraphs)
bx - handle of block to split
cl - flag: HF_FIXED to allocate used block at bottom
ds - kernel data segment
dx - segment address of block to split
RETURN:
carry - set if block was actually split
si - handle to new (free) block
bx - handle of block that was split
dx - segment address of split (used) block
DESTROYED:
ax
REGISTER/STACK USAGE:
ax - size of new block
si - handle of higher block
bx - handle of lower block
PSEUDO CODE/STRATEGY:
The idea here is to split input block into two pieces, one holding
ax paragraphs of memory and one holding the rest.
Before addresses are assigned, si is the handle with ax paragraphs,
bx the handle with the rest.
The addresses (i.e. the actual piece of the initial block) of these
two handles are determined by the passed flag: if cl is
HF_FIXED, si retains its original address and bx is
adjusted upward, else the opposite happens.
Once the addresses are set, the two are linked together in the
proper order and the surrounding blocks adjusted accordingly
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 6/15/87 Initial version written and tested
Tony 10/88 Comments from Jim's code review added
-------------------------------------------------------------------------------@
SplitBlock proc near
.enter
EC < call AssertHeapMine >
;
; Figure new free-block's size
;
cmp ax, ds:[bx].HM_size
je finish
;
; Duplicate the handle and divide the block into its two areas
;
call DupHandle
mov ds:[si][HM_size],ax ;store used size in original handle
sub ds:[bx][HM_size],ax ;figure free size in new handle
EC < ERROR_B SPLIT_BLOCK_FREE_SIZE_TOO_BIG >
mov ds:[bx][HM_owner],0 ;mark new as free
mov {word}ds:[bx][HM_flags],0 ;not discardable or swappable or
; locked
push bx, si
mov ds:[bx].HM_addr, dx ; Assume free at bottom
add dx, ds:[bx].HM_size ; Compute new address for used block
; after the free block
test cl,mask HF_FIXED
jz fixlinks ;if allocating at top, branch -- free addr
; and registers already set
mov dx, ds:[bx].HM_addr ; fetch original address
add ax, dx ; add to used size
mov ds:[bx].HM_addr, ax ; and store in free handle
xchg bx,si ;swap handles to allocate at top
fixlinks:
; fix up links.
;
; bx = handle of block lower in memory
; si = handle of block higher in memory
mov ds:[si][HM_prev],bx ;point high block at low block
mov ds:[bx][HM_next],si ;point low block at high block
call FixLinks ;update surrounding blocks
pop si, bx ; si <- free, bx <- split
stc ;indicate split happened
finish:
.leave
ret
SplitBlock endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SplitBlockFreeRemainder
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Split an in-use block into two and free the remainder
CALLED BY: ContractBlock, DoReAlloc
PASS: exclusive access to heap variables
ax - block size to create (paragraphs)
bx - handle of block to split
cl - flag: HF_FIXED to allocate used block at bottom
ds - kernel data segment
dx - segment address of block to split
RETURN: carry - set if block was actually split
bx - handle of block that was split
DESTROYED: ax, si
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 2/26/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SplitBlockFreeRemainder proc near
.enter
;
; Perform initial split
;
call SplitBlock
jnc done ;branch if no split happened
;
; Free the other block we got back.
;
xchg bx, si
call DoFreeNoDeleteSwap
mov bx, si
stc ;block was split
done:
EC < call AssertFreeBlocksCC >
.leave
ret
SplitBlockFreeRemainder endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: SwapUsedFree
DESCRIPTION: Swap in the heap a used block (in lower memory) and a free
block (in higher memory)
CALLED BY: INTERNAL
CompactHeap
PASS:
exclusive access to heap variables
bx - handle to first block (unlocked)
si - handle to second block (free)
di - data address of first block
ds - kernel data segment
RETURN:
ax - new address for second block
DESTROYED:
cx, dx, di
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
secondHandle.HM_addr = firstHandle.HM_addr
newDataAddress = firstHandle.HM_addr + secondHandle.size
firstHandle.HM_addr = newDataAddress
call MoveBlock to move the block's data
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 4/88 Initial version
Tony 10/88 Comments from Jim's code review added
-------------------------------------------------------------------------------@
SwapUsedFree proc near
EC < call CheckBX_SIAdjacent >
EC < call AssertHeapMine >
mov ax,ds:[bx][HM_size] ;swap sizes (they will be
mov cx,ax
xchg ax,ds:[si][HM_size] ;swapped back later)
mov ds:[bx][HM_size],ax
mov dx,di
add ax,dx ;dx = source for move
;ax = destination for move
;cx = # paras to move
mov ds:[si][HM_addr],ax
GOTO SUF_RB_common
SwapUsedFree endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: RelocateBlock
DESCRIPTION: Move a block from one handle to another
CALLED BY: INTERNAL
DoReAlloc, CompactHeap
PASS:
exclusive access to heap variables
bx - handle of block to relocate
si - handle of destination to relocate to
ds - kernel data segment
di - address of block to relocate
RETURN:
si - same but memory freed
DESTROYED:
ax, cx, dx, di
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
Copy block's data
Exchange HM_addr, size, HM_next and HM_prev from dest to source
Fix pointers to both blocks
Call DoFree to free dest
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 4/88 Initial version
Tony 10/88 Comments from Jim's code review added
-------------------------------------------------------------------------------@
RelocateBlock proc near
mov ax,ds:[si][HM_addr] ;dest address
mov dx,di ;source address
mov cx,ds:[bx][HM_size] ;# of paragraphs
FALL_THRU SUF_RB_common
RelocateBlock endp
SUF_RB_common proc near
call MoveBlock ;copy block data
INT_OFF ;no context switching until handles
;are swapped
mov ds:[bx][HM_addr],dx
FALL_THRU SwapHandles
SUF_RB_common endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: SwapHandles
DESCRIPTION: Exchange address, size, next and prev pointers between two
handles, "freeing" the second handle's memory (i.e. combining
it with any neighboring blocks)
CALLED BY: INTERNAL
RelocateBlock, DoAlloc
PASS:
exclusive access to heap variables
bx - handle of block to relocate
si - handle of destination to relocate to
ds - kernel data segment
RETURN:
si - same but memory freed
DESTROYED:
ax, cx, dx, di
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
Copy block's data
Exchange HM_addr, size, HM_next and HM_prev from dest to source
Fix pointers to both blocks
Call DoFree to free dest
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 4/88 Initial version
Tony 10/88 Comments from Jim's code review added
-------------------------------------------------------------------------------@
SwapHandles proc near
call SwapHandlesLow
push bx
mov bx,si
call DoFree
pop bx
ret
SwapHandles endp
if ERROR_CHECK
SwapHandlesFar proc far
call SwapHandles
ret
SwapHandlesFar endp
endif ;ERROR_CHECK
COMMENT @-----------------------------------------------------------------------
FUNCTION: SwapHandlesLow
DESCRIPTION: Swap data between two handles
CALLED BY: INTERNAL
SwapHandles, MemSwap
PASS:
exclusive access to heap variables
bx, si - handles for which to swap memory
RETURN:
memory swapped
DESTROYED:
ax, cx, dx, di
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
Copy block's data
Exchange HM_addr, size, HM_next and HM_prev from dest to source
Fix pointers to both blocks
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 4/88 Initial version
Tony 10/88 Comments from Jim's code review added
-------------------------------------------------------------------------------@
SwapHandlesLow proc near
EC < call AssertHeapMine >
push bx
push si
mov cx,5 ;exchange 4 words (+1 for HM_owner,
; which is not swapped)
INT_OFF
copy:
lodsw ;fetch initial word
cmp cx, 5 - ((offset HM_owner)/2)
jz skipThisWord
xchg ds:[bx],ax
mov ds:[si-2],ax
skipThisWord:
inc bx ;bump pointer
inc bx
loop copy
CheckHack <offset HM_flags eq 10>
;
; Exchange the HF_DISCARDED & HF_SWAPPED flags between the blocks, as
; well. Do this with interrupts off. This closes a nasty window where
; a core block was being moved, via MemForceMove, and had a non-zero
; address, but still had HF_DISCARDED set, when MemOwner was called
; during a timer routine, yielding death -- ardeb 11/10/94
;
mov al, ds:[bx]
mov ah, ds:[si]
mov cx, ax
andnf cx, not (mask HF_DISCARDED or mask HF_SWAPPED or \
((mask HF_DISCARDED or mask HF_SWAPPED) shl 8))
andnf ax, (mask HF_DISCARDED or mask HF_SWAPPED or \
((mask HF_DISCARDED or mask HF_SWAPPED) shl 8))
xchg al, ah ; exchange swapped/discarded bits
or ax, cx ; merge exchanged into actual
mov ds:[bx], al
mov ds:[si], ah
INT_ON
pop si
pop bx
;
; Special case swapping of swapped handle with memory handle. Swapped
; handle isn't in the memory list and we don't want to get mysterious
; death because opaque HSM_swapID happens to match the handle ID of
; the memory handle...
;
tst ds:[si].HM_addr
jz 20$
;
; Adjust linkage to each other, if necessary. Since HM_next and HM_prev
; were swapped above, along with HM_addr and HM_size, we need to see
; if the handles are self-referential in either direction.
;
cmp ds:[bx][HM_next],bx ;si below bx?
jnz 10$ ; no
mov ds:[bx][HM_next],si ;Yes -- bx now below si
mov ds:[si][HM_prev],bx
jmp 20$
10$:
cmp ds:[bx][HM_prev],bx ;bx below si?
jnz 20$
mov ds:[bx][HM_prev],si ;Yes -- si now below bx
mov ds:[si][HM_next],bx
20$:
;
; Now fix links to other blocks around si
;
GOTO FixLinks ;fix links in new block
SwapHandlesLow endp
if LOG_BLOCK_MOVEMENT
; ax = BlockMovementOperation (trashed on return)
; bx = Handle being moved
; ds = kernel data segment
LogBlockMovement proc far
push cx, si
mov si, ds:blockMovementHead
add si, offset blockMovementLog
;
; record vital data
;
mov ds:[si].BME_op, ax
mov ds:[si].BME_handle, bx
mov ax, ds:[bx].HM_addr
mov ds:[si].BME_address, ax
mov ax, ds:[bx].HM_size
mov cl, 4
shl ax, cl
mov ds:[si].BME_size, ax
;
; Increment head pointer
;
add si, size BlockMovementEntry
sub si, offset blockMovementLog
cmp si, size blockMovementLog
jb done
clr si
done:
mov ds:blockMovementHead, si
pop cx, si
ret
LogBlockMovement endp
endif ; LOG_BLOCK_MOVEMENT
COMMENT @-----------------------------------------------------------------------
FUNCTION: MoveBlock
DESCRIPTION: Move memory from one block to another
CALLED BY: INTERNAL
RelocateBlock, SwapUsedFree
PASS:
ax - destination segment address
bx - handle of block being moved
cx - number of paragraphs to move
dx - source segment for move
ds - kernel data segment
RETURN:
DESTROYED:
di
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
convert paragraphs to words and use rep movsw to do the move
We move from the top down to accomodate SwapUsedFree, which is
moving things up that could easily overlap.
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 4/88 Initial version
Tony 10/88 Comments from Jim's code review added
-------------------------------------------------------------------------------@
MoveBlock proc near
push ax, es
push si, ds, cx
; non-ec: make sure we're not moving to/from 0:0
NEC < tst ax >
NEC < jz necError >
NEC < tst dx >
NEC < jz necError >
EC < cmp ax, ds:[loaderVars].KLV_heapStart >
EC < ERROR_B BAD_MOVE_BLOCK >
EC < cmp ax, ds:[loaderVars].KLV_heapEnd >
EC < ERROR_AE BAD_MOVE_BLOCK >
EC < cmp dx, ds:[loaderVars].KLV_heapStart >
EC < ERROR_B BAD_MOVE_BLOCK >
EC < cmp dx, ds:[loaderVars].KLV_heapEnd >
EC < ERROR_AE BAD_MOVE_BLOCK >
if LOG_BLOCK_MOVEMENT
push ax
mov ax, BMO_MOVE
call LogBlockMovement
pop ax
endif
mov ds, dx ;source segment
mov es, ax ;dest segment
xchg ax, cx ;(1-byte inst)
call ParaToByteAX ;convert paragraphs to bytes
mov si, cx ;set si and di last word to move
if USE_32BIT_STRING_INSTR
sub si, size dword
else
dec si
dec si
endif ; USE_32BIT_STRING_INSTR
mov di, si
if USE_32BIT_STRING_INSTR
shr cx, 2 ;convert back to dwords
else
shr cx ;convert back to words
endif ; USE_32BIT_STRING_INSTR
std ;set direction flag
if USE_32BIT_STRING_INSTR
rep movsd
else
rep movsw
endif ; USE_32BIT_STRING_INSTR
cld ;reset default state
pop si, ds, cx
mov al,DEBUG_MOVE ;notify debugger of block movement
; passing destination address in es.
call FarDebugMemory
pop ax, es
ret
NEC <necError: >
NEC < ERROR BAD_MOVE_BLOCK >
MoveBlock endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: FixLinks, FixLinks2
DESCRIPTION: FixLinks - Fix the links to both bx and si
FixLinks2 - Fix the links to the block bx
CALLED BY: INTERNAL
FixLinks - FreeBlockData, SplitBlock, SwapHandles
FixLinks2 - CombineBlocks, FixLinks
PASS:
exclusive access to heap variables
bx, si - blocks to fix
ds - kernel data segment
RETURN:
bx, si, ds - same
DESTROYED:
none
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 4/88 Initial version
Tony 10/88 Comments from Jim's code review added
-------------------------------------------------------------------------------@
FixLinks proc near
xchg bx,si ; Fix si first
call FixLinks2
xchg bx,si
REAL_FALL_THRU FixLinks2 ; Now fix BX
FixLinks endp
FixLinks2 proc near
EC < call AssertHeapMine >
cmp ds:[bx][HM_addr],0 ;check for no memory associated
jz 20$
push si
mov si, ds:[loaderVars].KLV_heapStart
cmp si, ds:[bx].HM_addr
EC < ERROR_A CORRUPTED_HEAP >
jnz 10$
mov ds:[loaderVars].KLV_handleBottomBlock, bx
10$:
mov si, ds:[bx].HM_prev ;fix link from prev block
mov ds:[si].HM_next, bx
mov si, ds:[bx].HM_next ;fix link from next block
mov ds:[si].HM_prev, bx
pop si
20$:
ret
FixLinks2 endp
if ERROR_CHECK
FixLinks2Far proc far
call FixLinks2
ret
FixLinks2Far endp
endif ;ERROR_CHECK
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CombineBX
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Try and combine the block BX with its adjacent compatriots
CALLED BY: DoFreeNoDeleteSwap, SplitBlockFreeRemainder
PASS: ds = idata
bx = block to combine
RETURN: nothing
DESTROYED: bx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 6/21/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CombineBX proc near uses si
.enter
mov si,ds:[bx][HM_next] ;try to combine with next block
call CombineBlocks
mov si, bx
mov bx,ds:[bx][HM_prev] ;try to combine with previous
call CombineBlocks
if TRACK_FINAL_FREE
;
; see if original block combined with previous, so we can return
; a useful handle.
;
cmp ds:[si].HG_type, SIG_FREE
je haveBX
mov bx, si ; not combined, so return
; original handle in BX
haveBX:
;
; Now see if result of combination is a block that comes after the
; lastFreeBlock.
;
mov si, ds:[lastFreeBlock]
mov si, ds:[si].HM_addr
cmp si, ds:[bx].HM_addr
jae done
setLastFree::
mov ds:[lastFreeBlock], bx
done:
EC < call CheckLastFreeBlock >
endif
.leave
ret
CombineBX endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: CombineBlocks
DESCRIPTION: CombineBlocks - Combine two adjacent blocks if both are free
CALLED BY: INTERNAL
CombineBlocks - DoFree, CompactHeap, DoReAlloc
PASS:
exclusive access to heap variables
bx - pointer to first block (lower block in memory)
si - pointer to second block
ds - kernel segment
RETURN:
ds - same
si - same but possibly meaningless (if second handle was freed)
DESTROYED:
ax
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
assuming bx and si are adjacent (bx below si):
If (block blocks are free) and (first block < second block)
fix size
fix first block's HM_next
fix block after second block's HM_prev
free second handle
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 4/88 Initial version
Tony 10/88 Comments from Jim's code review added
-------------------------------------------------------------------------------@
CombineBlocks proc near
EC < call CheckBX_SIAdjacent >
EC < call AssertHeapMine >
; don't combine last the block with the first
cmp si, ds:[loaderVars].KLV_handleBottomBlock
jz done
mov ax, ds:[bx].HM_owner ;test for both free
or ax, ds:[si].HM_owner
jnz done ;if not then done
mov ax, ds:[bx].HM_addr
cmp ax, ds:[si].HM_addr ;make sure first block < second block
EC < ERROR_AE CORRUPTED_HEAP >
NEC < jae done >
mov ax, ds:[si].HM_size ;fix size
add ds:[bx].HM_size, ax
mov ax, ds:[si].HM_next ;make si point at block after second
mov ds:[bx].HM_next, ax ;fix links
call FixLinks2
xchg bx, si ;free second handle
if TRACK_FINAL_FREE
cmp bx, ds:[lastFreeBlock]
jne freeBX
; if we're freeing the handle for the last free block because we merged
; it with si, then si must be the new lastFreeBlock
mov ds:[lastFreeBlock], si
freeBX:
endif
call FreeHandle
xchg bx, si
done:
ret
CombineBlocks endp
COMMENT @----------------------------------------------------------------------
FUNCTION: ThrowOutBlocks
DESCRIPTION: Throw out blocks from memory.
CALLED BY: INTERNAL
FindFree
PASS:
exclusive access to heap variables unless called by the scrub thread
ax - number of paragraphs to throw out
ds - kernel segment
di - first swap driver to use (offset swapTable)
RETURN:
carry - set if error
ax - destroyed
ds - unchanged
DESTROYED:
bx, cx, dx, si, di, bp
REGISTER/STACK USAGE:
ax - paraToThrowOut
bx - tempPtr
cx - HM_flags (inner loop), counter (outer loop)
si - index into TOB array
PSEUDO CODE/STRATEGY:
Throw out memory starting at the least recently used block. If it
is discardable, discard it. If it is moveable, swap it.
do {
numberFound = FindNOldest(methodToUse)
if (numberFound == 0) {
swap driver = next(swap driver)
if (swap drivers exhausted)
return(error)
}
}
for (count = 0; count < numberFound and paraToThrowOut > 0;
count++) {
tempPtr = hArray[count];
if (tempPtr is unlocked) {
err = ThrowOutBlock(tempPtr);
if (err) {
break
} else {
paraToThrowOut -= tempPtr.HM_size;
}
} /* if unlocked */
} /* for count */
} while (paraToThrowOut > 0);
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 4/88 Initial version
Tony 10/88 Comments from Jim's code review added
Adam 6/90 Changed to work on scrub thread
mevissen 3/99 Added shme to ensure a 'slow' swap driver is
called to discard discardable blocks
------------------------------------------------------------------------------@
ThrowOutBlocks proc far
; do {
scanLoop:
;
; Locate as many biffable blocks as we can using the current
; disposal method.
;
call PHeap
getMoreBlocks:
push ax ; (smaller to do this here than in FindNOldest,
; which has two exit points)
call FindNOldest ;returns count in cx
pop ax
mov bp, ds:[tobId]
call VHeap ; Give other threads a chance if we're scrubbing
;
; If none found that can be nuked with our current method, advance to
; the next.
;
jcxz methodExhausted
;
; Loop through the array of biffable blocks, throwing out each in turn
; (they are ordered from most to least desirable) until we've made
; enough room on the heap.
;
mov si,offset tobTable ;start at first block
throwLoop:
call PHeap
cmp ds:[tobId], bp ;tobTable still unchanged?
jne getMoreBlocks ;nope -- go fill it again
;
; Fetch the next block to be nuked.
;
mov bx,ds:[si].TOB_handle
;
; If the block has become locked in the interim, skip it. Else change
; its address to 0 so no one can lock it.
;
INT_OFF ;change handle so it cannot be locked
;
; If the block has become freed, discarded or swapped in the interim,
; skip it. This could happen if ThrowOutOne/MemSwapOut fails and
; starts discarding discarable blocks swapped to that device. If such
; a block is a VM block, we could go through this whole ThrowOutBlocks
; shme again as we try to make room to bring in the VM header during
; the VM block discard.
;
CheckHack <HM_lockCount eq HM_flags+1>
test {word}ds:[bx].HM_flags, \
(mask HF_DISCARDED or mask HF_SWAPPED) or (0xff shl 8)
jnz innerLocked
cmp ds:[bx].HM_owner, 0
je innerLocked
clr dx
xchg dx,ds:[bx][HM_addr]
INT_ON ;dx = block address
; err = ThrowOutBlock(tempPtr);
; if (err) {
; break
; } else {
; paraToThrowOut -= tempPtr.HM_size;
; }
; } /* if unlocked */
push cx
push ax, ds:[bx].HM_size, bp ; record block size in case mangled by
; throw-out
call ThrowOutOne
pop ax, cx, bp
mov ds:[tobId], bp ; compensate for possible increment in
; DoFreeNoDeleteSwap, since the tobTable
; isn't outdated unless tobId is upped
; when we've not got the heapSem
jc error ; couldn't nuke
sub ax, cx ; record size nuked
pop cx ; recover loop count
; } /* for count */
; } while (paraToThrowOut > 0);
jbe found ; ax <= size means we've got enough
tryNext:
call VHeap
add si,size ThrowOutBlock ;move to next
loop throwLoop
cmp si, offset tobTable + size tobTable
jne methodExhausted ;table wasn't full => hit the end of
; what this disposal method can do
jmp scanLoop ;else try for another set of blocks.
innerLocked:
INT_ON
jmp tryNext
found:
call VHeap
clc
ret
error:
pop cx ; recover loop count
mov ds:[bx].HM_addr,dx
jmp tryNext ; just because one block
; couldn't make it doesn't
; mean we should give up.
; FindNOldest will decide if
; it's impossible to throw
; out anything else...
methodExhausted:
add di, size SwapDriver ; point to next swap driver
cmp di, ds:[swapNext] ; hit the end?
jb scanLoop ; => more drivers to check...
jne noMoreMethods ; => past dummy driver, even
; invoke a dummy driver if no slow methods have yet been called;
; this allows discardable blocks to be discarded in FindNOldest.
; mevissen, 3/99
cmp ds:[di-(size SwapDriver)].SD_speed, SS_PRETTY_FAST
jbe scanLoop ; try again with dummy driver
noMoreMethods:
stc ; return error
ret
ThrowOutBlocks endp
COMMENT @----------------------------------------------------------------------
FUNCTION: ThrowOutOne
DESCRIPTION: Throw out a block for ThrowOutBlocks
CALLED BY: INTERNAL
ThrowOutBlocks
PASS:
bx - handle (with data address = 0)
dx - data address
ds - kernel data
di - SwapDriver to use if swapping
RETURN:
carry - set if error (dx must be preserved)
bx, ds - same
DESTROYED:
ax, cx, bp
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
if (speed(curSwapDriver) >= PRETTY_FAST) {
/* Always swap since device is so fast */
error = MemSwapOut(tempPtr, addr, driver)
} else if (tempPtr is VM block) {
/* Give VM a crack at it first */
error = VMUpdateAndRidBlk(tempPtr, addr)
if (error) {
/* VM couldn't nuke it, so try and swap it instead */
error = MemSwapOut(tempPtr, addr, driver)
}
} else if (tempPtr is discardable) {
error = DoDiscard(tempPtr)
} else if (tempPtr is swapable) {
error = MemSwapOut(tempPtr, addr, driver)
}
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 3/89 Initial version
------------------------------------------------------------------------------@
ThrowOutOne proc near
EC < call AssertHeapMine >
mov cx, LCT_ALWAYS_COMPACT
call ContractIfLMem ; Contract any LMem block that's
; being nuked
mov cl,ds:[bx].HM_flags
;
; If we're swapping to a pretty fast or really fast driver, always
; swap w/o regard to the type of block being biffed (unless the
; block is only discardable).
;
test cl, mask HF_SWAPABLE
jz discard
cmp ds:[di].SD_speed, SS_PRETTY_FAST
jbe trySwap
;
; If the block is a VM data block, give it to the VM code to dispose
; of. If it can't go away, try and swap it.
;
mov bp, ds:[bx][HM_owner] ;get owner
cmp ds:[bp][HG_type], SIG_VM ;is owner a VM file handle?
jne notVM ;branch if not
call VMUpdateAndRidBlk
jnc done
jmp trySwap
notVM:
;
; If the block is discardable, we want to discard it. Call DoDiscard
; to handle it.
;
test cl,mask HF_DISCARDABLE
jz trySwap
discard:
;
; If DoDiscard is called on a VM block, the VMHeader does not
; get properly updated and you can get a death due to VM_BAD_HDR.
;
; This can happen if a non-swapable heap block is attached
; to a VM file, as when an extra state block created by an app
; with the wrong heap flags is attached to the state file.
;
; DoFullDiscard will handle VM blocks correctly, so call it in
; the EC version, but call DoDiscard in the non-ec, as it is
; faster. -cassie, 6/30/95
;
; Just call DoFullDiscard, so that the non-ec system won't crash
; if a VM block is incorrectly discarded. -cassie, 7/05/95
;
EC < mov bp, ds:[bx][HM_owner] ;get owner >
EC < cmp ds:[bp][HG_type], SIG_VM >
EC < WARNING_E DISCARDING_VM_BLOCK_INCORRECTLY >
call DoFullDiscard
done:
ret
trySwap:
EC< test cl, mask HF_SWAPABLE >
EC< ERROR_Z GASP_CHOKE_WHEEZE >
call MemSwapOut
jmp done
ThrowOutOne endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: FindNOldest
DESCRIPTION: Search the heap for the N oldest blocks that can be disposed
of with the current swap driver.
CALLED BY: INTERNAL
ThrowOutBlocks
PASS:
exclusive access to heap variables
di - swap driver being used for this pass
SS_REALLY_FAST, SS_PRETTY_FAST - prefer swapping over discarding
anything else - prefer discarding over swapping.
ds - idata segment
RETURN:
cx - number of blocks found
ds - same
DESTROYED:
ax, bx, dx, si, bp
REGISTER/STACK USAGE:
ax - tempPtr's flags and lock count
bx - tempPtr
cl - curSDSpeed
ch - swapFlags
dx - temp
si - count*4
di - lastBlock
bp - temporary
PSEUDO CODE/STRATEGY:
"Oldest" for a block x is figured by (high scores indicate old blocks):
score = systemCounter.low-x.HM_usageValue
hArray[0] = 0
if (speed(curSwapDriver) >= PRETTY_FAST && curSwapDriver is full) {
return(error)
}
tempPtr = last block on heap
do begin
if ((tempPtr.HM_owner != 0) && (tempPtr->lockCount == 0) {
temp = systemCounter.low - tempPtr.HM_usageValue
;
; Prefer swapping to memory above all else -- we'll
; do it until memory is full
;
if (swapSpeed >= pretty fast) {
if (tempPtr is not swapable) {
break
}
} else if (tempPtr is a VM block) {
if (VM can biff it) {
if (tempPtr is DISCARDABLE) {
; weight high by leaving score alone
} else {
; make same weight as swapping
temp /= 2
}
} else {
; this is an unfortunate choice as updating
; the file would involve reading the thing
; from swap then writing it to disk
temp /= 2
try swapping
}
} else if (tempPtr is DISCARDABLE) {
; discarding is fastish -- weight it higher
; by leaving the score alone
} else if (tempPtr is SWAPABLE and can swap to disk) {
temp /= 2
} else if (tempPtr is lmem and detachable) {
; this is really slow so make it worse than swapping
temp /= 4
} else {
break /* block is hopeless */
}
; put into hArray in proper order
count = 0
do begin
if (hArray[count] = 0 or temp > sArray[count])
shift array down
hArray[count] = tempPtr
sArray[count] = temp
else
count = TOB_ARRAY_SIZE
endif
end while (count < TOB_ARRAY_SIZE)
}
tempPtr = tempPtr.HM_prev
end while (tempPtr != last block on heap)
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
Would like to add the size into the score here....
When deciding if we should write a VM block to its file or swap it or
discard it, we should take into account if the file is on a floppy.
Use DiskIsFloppy to find out...
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 4/88 Initial version
-------------------------------------------------------------------------------@
FindNOldest proc near
EC < call AssertHeapMine >
; hArray[0] = 0
startAgain:
clr dx ;use dx as 0 throughout
mov ds:[tobTable].TOB_handle,dx ;zero first count
inc ds:[tobId] ;another time through the mill..
;
; If the current swap device is full and fast, return no blocks
; nukable...(if device is slow, we might still find blocks to discard
; or write to a VM file)
;
mov cx, {word}ds:[di].SD_speed ; ch = SwapDriverFlags,
; cl = SwapSpeed
test ch, mask SDF_ENDANGERED
jnz notPossible ; if endangered, then never possible
test ch, mask SDF_FULL
jz possible
cmp cl, SS_PRETTY_FAST
ja possible
notPossible:
clr cx
ret
possible:
;
; set tempPtr (bx) to be the last block on the heap. this value is
; saved in di so we know when to stop (can you imagine a heap of
; 10 64K blocks? Yeah. right :)
;
; cl = SwapSpeed
;
call GetLastBlock
jc notPossible
push es
push di
mov di,bx
scanLoop:
;do begin
EC < call ECCheckHandleForWeirdness >
;
; if block now free or locked, skip it
;
cmp ds:[bx][HM_owner],dx ;check for free
jz next
mov ax, {word}ds:[bx][HM_flags] ; ah = lockCount, al = flags
tst ah ;check for locked
jnz next
;
; If hit a fixed block, there's nothing more that can be thrown out.
;
test al, mask HF_FIXED
jnz atEnd
;
; Calculate the initial score by subtracting the usage value from the
; low word of the system counter, giving a higher score for older
; blocks.
;
; Scores work like this: the score starts at (time since last use)
;
; If the block can be discarded (and therefore will be by ThrowOutOne)
; then we want to make is more likely to be thrown out by ADDING a
; small ammount to its score since discarding is faster than swapping.
; The constant is proportional to the expected extra time required
; for swapping.
mov dx,ds:[systemCounter.low]
sub dx,ds:[bx][HM_usageValue]
;
; If swapping to fast driver and the block isn't swappable or
; discardable, skip it,
; else proclaim the block valid.
;
cmp cl, SS_PRETTY_FAST
ja other
; REALLY_FAST or PRETTY_FAST (EMS and XMS)
test al, mask HF_SWAPABLE or mask HF_DISCARDABLE
jz next
jmp valid
other:
; Swapping to KINDA_SLOW or REALLY_SLOW (disk)
;
; See if the thing's a VM block that the VM code can write out.
;
mov bp, ds:[bx][HM_owner] ;retrieve owner
cmp ds:[bp][HG_type], SIG_VM ;is owner a VM file handle?
jne notVM ;branch if not
; its a VM block -- if it is DIRTY (and biffable) then add
; NORMAL_SWAP_PENALTY to make it less like to get biffed
push ds:[tobId]
call VMBlockBiffable
pop bp
pushf
cmp bp, ds:[tobId]
jnz toStartAgain
popf
jc notDiscardable ; no -- DO NOT DO USUAL DISCARD CHECK
test ds:[bx].HM_flags, mask HF_DISCARDABLE
jz valid ;if dirty then the block cannot be
;discarded so the score remains as-is
addPenalty:
add dx, NORMAL_SWAP_PENALTY ; CLEAN and biffable
jnc valid
mov dx, 0xffff ; catch wrap around
jmp valid
toStartAgain:
popf
pop di
pop es
jmp startAgain
notVM:
;
; If block is discardable then add in the penalty as described above
;
test al, mask HF_DISCARDABLE
jnz addPenalty
notDiscardable:
;
; if block is swappable and we can swap to disk, do so
;
test al,mask HF_SWAPABLE
jz next
test ch, mask SDF_FULL
jnz next
jmp valid
;-----------------
; little piece of table-traversal code here to avoid out-of-range jumps
; and allow fall-through to "next", given we need to jump someplace
; at the end of the loop, but next can't be too far down or we
; won't reach.
innerNext:
add si,4
cmp si, offset tobTable + size tobTable
jnz innerLoop
next:
;
; Advance tempPtr to next-oldest block (tempPtr.HM_prev)
;
clr dx ;set dx=0 for scanLoop
mov bx,ds:[bx][HM_prev]
cmp bx,di
jnz scanLoop
atEnd:
; find out how many handles
mov cx, TOB_ARRAY_SIZE
mov si, offset tobTable - size ThrowOutBlock
countLoop:
add si,size ThrowOutBlock
tst ds:[si].TOB_handle
loopnz countLoop
jnz done
inc cx
done:
sub cx, TOB_ARRAY_SIZE
neg cx
pop di
pop es
ret
valid:
;
; We think we can biff this here block. It's relative biff-rating
; is in dx. Find the proper place for it in the array.
;
mov si,offset tobTable ;init count
innerLoop:
tst ds:[si].TOB_handle ;hit first empty slot in table?
jz replace
cmp dx,ds:[si].TOB_score ;compare score
jbe innerNext ; advance to next slot and fall into
; "next" (skipping this block) if all
; current blocks are more biffable.
replace:
mov bp,si ;save current position for loop end
;
; Shift all following blocks up in the array. This propagates the
; initial 0 handle up to the end if there aren't enough blocks
; to be nuked...Of course, we have to start with the last and work
; down.
;
mov si, offset tobTable + size tobTable - size ThrowOutBlock
replaceLoop:
mov ax,ds:[si-size ThrowOutBlock].TOB_handle
mov ds:[si].TOB_handle,ax
mov ax,ds:[si-size ThrowOutBlock].TOB_score
mov ds:[si].TOB_score,ax
sub si,size ThrowOutBlock
cmp si,bp
ja replaceLoop
;
; Store new block and advance to next oldest.
;
mov ds:[si].TOB_handle,bx
mov ds:[si].TOB_score,dx
jmp short next
FindNOldest endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: GetLastBlock
DESCRIPTION: Load the handle of the highest block on the heap
CALLED BY: INTERNAL
FindNOldest, CompactHeap
PASS:
ds - kernel data segment
RETURN:
bx - handle to last block on heap
carry - set if heap is empty
DESTROYED:
ax
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 4/88 Initial version
Tony 10/88 Comments from Jim's code review added
-------------------------------------------------------------------------------@
GetLastBlock proc near
NOAXIP< mov bx, ds:[loaderVars].KLV_handleBottomBlock >
AXIP< mov bx, ds:[xipHandleTopBlock] >
mov ax, ds:[bx].HM_prev
cmp ax, bx ;check for heap empty
stc
jz 10$
clc
10$:
mov bx, ax
ret
GetLastBlock endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: FlushGstateCache
DESCRIPTION: Flush the GState cache to generate free memory
CALLED BY: INTERNAL
FindFree
PASS:
exclusive access to heap
ds - kernel variables
RETURN:
none
DESTROYED:
ax, bx
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
See GrCreate
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 12/88 Initial version
-------------------------------------------------------------------------------@
FlushGstateCache proc near
FGC_loop:
; remove GState from cache
INT_OFF
mov bx, ds:[GStateCachePtr] ;get first cached GState
tst bx
jz done ;if null then done
mov ax,ds:[bx].HM_otherInfo ;get next GState, set it as
mov ds:[GStateCachePtr],ax ;first in list
INT_ON
call DoFree ;free the GState
jmp short FGC_loop
done:
INT_ON
ret
FlushGstateCache endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: ContractIfLMem
DESCRIPTION: Contract a block if it's an LMem block. This is done just
before moving it in CompactHeap, discarding it, or
swapping it out.
CALLED BY: INTERNAL
CompactHeap
ThrowOutOne
PASS:
exclusive access to heap
ds - kernel variables
bx - block to contract, if lmem
dx - data address of block
cl - compaction threshhold LMemCompactionThreshhold
RETURN:
none
DESTROYED:
ax
REGISTER/STACK USAGE:
INT_OFF
if ((tempPtr is unlocked) and (tempPtr is an lmem block) {
ContractBlock(tempPtr);
INT_ON
PSEUDO CODE/STRATEGY:
See LMem documentation.
We dont want to compact discardable lmem blocks, because
if they are discarded and then reloaded, then HM_size might not
match the internal state of the LMem block.
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 12/88 Initial version
-------------------------------------------------------------------------------@
ContractIfLMem proc near uses cx, si, di
.enter
; INT_OFF
; if ((tempPtr is unlocked) and (tempPtr is an lmem block) and
; (tempPtr is not discardable)) {
; save HM_addr for tempPtr, set HM_addr to 0
INT_OFF
mov ax,{word}ds:[bx][HM_flags] ;al - flags, ah = lock
test al, mask HF_LMEM
jz done
test ax, (0xff shl 8) or mask HF_DISCARDABLE
jnz done
; ContractBlock(tempPtr);
;
; The code used to turn interrupts on at done:, causing ContractNoNotify
; to be called with interrupts off. This is an exceedingly bad thing
; since ContractNoNotify calls LMemCompcatHeap which can take eons to
; complete.
;
INT_ON
call ContractNoNotify
done:
INT_ON
.leave
ret
ContractIfLMem endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: ContractBlock
DESCRIPTION: Contract an lmem block
CALLED BY: INTERNAL
ContractLMem, DoLMemDiscard, DetachObjBlock
PASS:
exclusive access to heap
bx - handle of block to contract (HM_addr = 0)
dx - data address
ds - kernel data
RETURN:
interrupts on
[bx].HM_addr set to dx
DESTROYED:
ax, cx, si, di
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
compact the block's heap
biff all free space at the end, giving it to a free block.
restore data address
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 1/89 Initial version
-------------------------------------------------------------------------------@
ContractBlock proc far
mov cx, LCT_ALWAYS_COMPACT
call ContractNoNotify
mov ds:[bx][HM_addr],dx
jnc noNotify
mov al, DEBUG_REALLOC ;notify debugger of block
call FarDebugMemory ; shrinkage
noNotify:
ret ;
ContractBlock endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ContractNoNotify
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Contract an lmem block, nuking any free space in the block,
without notifying the debugger of the change.
CALLED BY: ContractBlock, MoveBlock
PASS: exclusive access to heap
bx = handle of block to contract (HM_addr = 0)
cl = compaction threshhold LMemCompactionThreshhold
dx = data address
ds = idata
RETURN: interrupts on
carry set if the block actually changed size.
DESTROYED: ax, cx, si, di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 6/17/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ContractNoNotify proc near
.enter
mov di, ds ; preserve kdata
mov ax, ds:[bx][HM_size] ;
mov ds, dx
test ds:[LMBH_flags], mask LMF_NO_ENLARGE
jnz done
;
; If EC_FORCE_MOVE is set, then there is the possibility that when
; an LMem block is being force-moved, the original copy of the block
; is compacted. This results in the size as stored in the handle of
; the block to not match LMBH_blockSize.
;
; So, if we are asked to compact the block currently being force moved,
; just exit
;
EC < push es, ax >
EC < mov es, di >
EC < mov ax, ds:[LMBH_handle] >
EC < cmp ax, es:[handleBeingForceMoved] >
EC < pop es, ax >
EC < jz done >
call LMemCompactHeap ;shrink the heap.
jc done
;
mov cx, ds:LMBH_blockSize ;figure size used
EC < test cx, 1 >
EC < ERROR_NZ ODD_LMEM_BLOCK_SIZE >
sub cx, ds:LMBH_totalFree
EC < ERROR_B GASP_CHOKE_WHEEZE >
EC < test cx, 1 >
EC < ERROR_NZ ODD_LMEM_TOTAL_FREE_SIZE >
mov ds:LMBH_blockSize, cx ;set new size to size used.
mov ds:LMBH_totalFree, 0 ;no more free space.
mov ds:LMBH_freeList, 0 ;and no free list.
;
;
; compare new and old sizes and see if we can shrink the block at all.
;
mov si, cx ;si <- new total size.
mov ds, di ; restore kdata
add si, 15 ;si = min para size
mov cl, 4 ;
shr si, cl ;
cmp ax, si ;can it be made smaller ?
EC < ERROR_B CORRUPTED_HEAP ;new block can't be bigger>
jz done ;
xchg ax, si ;ax = new size (1-byte inst)
;si = old size
mov cl, mask HF_FIXED ;leave the low part in-use
push si ;preserve old size
CNN_LMemBlockContract label near ; needed for "showcalls -l"
ForceRef CNN_LMemBlockContract
call SplitBlockFreeRemainder
;
; do some VM File stuff.. for monitoring the dirty size
;
; first, check if we are dealing with a block in a vm file
;
pop cx ; restore old size
mov si, ds:[bx].HM_owner
cmp ds:[si].HVM_signature, SIG_VM
jne setDone
;
; has it been marked dirty before? if not yet, this will be
; taken care of later
;
test ds:[bx].HM_flags, mask HF_DISCARDABLE
jnz setDone
;
; ok, now find the amount of new dirty size.. since the block
; is shrinking, this will positive
;
sub cx, ds:[bx].HM_size ; old size - new size
;
; Just do it (TM)
;
INT_OFF
tst ds:[si].HVM_relocRoutine.segment
jnz setDone
;
; very quickly check if the dirtly size has gone negative..
; time is important with interrupts off
test {byte}ds:[si].HVM_relocRoutine.offset.high, 0x80
jnz setDone
add ds:[si].HVM_relocRoutine.offset, cx
setDone:
stc
done:
INT_ON
mov ds, di ; restore kdata
.leave
Destroy ax, cx, si, di
ret
ContractNoNotify endp
ifdef PRODUCT_GEOS32
include gpmi.def
; Pass
; bx:cx = size of block to allocate in bytes
; Return
; bx = selector (if carry clear)
GPMIAllocateBlock proc near
push es
push si
les si, ds:[loaderVars].KLV_GPMIVectorTable
call {fptr}es:[si+GPMI_CALL_ALLOCATE_BLOCK]
pop si
pop es
ret
GPMIAllocateBlock endp
GPMIAlias proc near
push es
push si
les si, ds:[loaderVars].KLV_GPMIVectorTable
call {fptr}es:[si+GPMI_CALL_ALIAS]
pop si
pop es
ret
GPMIAlias endp
GPMIFreeAlias proc near
push es
push si
les si, ds:[loaderVars].KLV_GPMIVectorTable
call {fptr}es:[si+GPMI_CALL_FREE_ALIAS]
pop si
pop es
ret
GPMIFreeAlias endp
GPMIAccessRealSegment proc near
push es
push si
les si, ds:[loaderVars].KLV_GPMIVectorTable
call {fptr}es:[si+GPMI_CALL_ACCESS_REAL_SEGMENT]
pop si
pop es
ret
GPMIAccessRealSegment endp
if 0
GPMIResizeBlock proc near
push es
push si
les si, ds:[loaderVars].KLV_GPMIVectorTable
call {fptr}es:[si+GPMI_CALL_RESIZE_BLOCK]
pop si
pop es
ret
GPMIResizeBlock endp
endif
GPMIGetInterruptHandler proc near
push es
push si
les si, ds:[loaderVars].KLV_GPMIVectorTable
call {fptr}es:[si+GPMI_CALL_GET_INTERRUPT_HANDLER]
pop si
pop es
ret
GPMIGetInterruptHandler endp
GPMISetInterruptHandler proc near
push es
push si
les si, ds:[loaderVars].KLV_GPMIVectorTable
call {fptr}es:[si+GPMI_CALL_SET_INTERRUPT_HANDLER]
pop si
pop es
ret
GPMISetInterruptHandler endp
GPMIReleaseSegmentAccess proc near
push es
push si
les si, ds:[loaderVars].KLV_GPMIVectorTable
call {fptr}es:[si+GPMI_CALL_RELEASE_SEGMENT_ACCESS]
pop si
pop es
ret
GPMIReleaseSegmentAccess endp
GPMIIsSelector16Bit proc near
push es
push si
les si, ds:[loaderVars].KLV_GPMIVectorTable
call {fptr}es:[si+GPMI_CALL_IS_SELECTOR_16_BIT]
pop si
pop es
ret
GPMIIsSelector16Bit endp
GPMISelectorCheckLimits proc near
push es
push si
les si, ds:[loaderVars].KLV_GPMIVectorTable
call {fptr}es:[si+GPMI_CALL_SELECTOR_CHECK_LIMITS]
pop si
pop es
ret
GPMISelectorCheckLimits endp
endif
| 25.847509 | 81 | 0.635613 |
26d296e08a5440709306c8773618ce6aabafd49f | 486 | asm | Assembly | programs/oeis/135/A135684.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/135/A135684.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/135/A135684.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A135684: a(n)=11 if n is a prime number. Otherwise, a(n)=n.
; 1,11,11,4,11,6,11,8,9,10,11,12,11,14,15,16,11,18,11,20,21,22,11,24,25,26,27,28,11,30,11,32,33,34,35,36,11,38,39,40,11,42,11,44,45,46,11,48,49,50,51,52,11,54,55,56,57,58,11,60,11,62,63,64,65,66,11,68,69,70,11,72,11,74,75,76,77,78,11,80,81,82,11,84,85,86,87,88,11,90,91,92,93,94,95,96,11,98,99,100
mov $1,$0
sub $0,10
seq $1,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
mul $1,$0
sub $0,$1
add $0,11
| 48.6 | 297 | 0.654321 |
6511ffd49bcd7b36853f81f3dc111c73d44bbc4a | 823 | asm | Assembly | oeis/264/A264129.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/264/A264129.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/264/A264129.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A264129: Number of (n+1) X (4+1) arrays of permutations of 0..n*5+4 with each element having index change +-(.,.) 0,0 0,2 or 1,2.
; Submitted by Jon Maiga
; 80,1040,13600,178000,2330000,30500000,399250000,5226250000,68412500000,895531250000,11722656250000,153451562500000,2008707031250000,26294316406250000,344197070312500000,4505598144531250000,58979045410156250000,772045727539062500000,10106209777832031250000,132292003479003906250000,1731724807739257812500000,22668572029113769531250000,296735460243225097656250000,3884317602920532226562500000,50846377537727355957031250000,665587722992897033691406250000,8712656406450271606445312500000
add $0,1
mul $0,2
seq $0,153365 ; Number of zig-zag paths from top to bottom of a rectangle of width 9 with 2n rows whose color is that of the top right corner.
div $0,5
mul $0,4
| 82.3 | 485 | 0.839611 |
226811bb15b0ed8684882034c0fbe8725767204a | 421 | asm | Assembly | libsrc/stdio/__printf_print_to_buf.asm | Toysoft/z88dk | f930bef9ac4feeec91a07303b79ddd9071131a24 | [
"ClArtistic"
] | 8 | 2017-01-18T12:02:17.000Z | 2021-06-12T09:40:28.000Z | libsrc/stdio/__printf_print_to_buf.asm | Toysoft/z88dk | f930bef9ac4feeec91a07303b79ddd9071131a24 | [
"ClArtistic"
] | 1 | 2017-03-06T07:41:56.000Z | 2017-03-06T07:41:56.000Z | libsrc/stdio/__printf_print_to_buf.asm | Toysoft/z88dk | f930bef9ac4feeec91a07303b79ddd9071131a24 | [
"ClArtistic"
] | 3 | 2017-03-07T03:19:40.000Z | 2021-09-15T17:59:19.000Z |
MODULE __printf_print_to_buf
SECTION code_clib
PUBLIC __printf_print_to_buf
EXTERN __printf_get_buffer_address
; Entry: a = character to print
__printf_print_to_buf:
push hl
push bc
call __printf_get_buffer_address
ld c,(ix-10)
ld b,0
add hl,bc
inc (ix-10)
ld (hl),a
pop bc
pop hl
ret
| 20.047619 | 43 | 0.551069 |
79a864eda869369c8c17eb30518054d950097fe0 | 383 | asm | Assembly | oeis/152/A152239.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/152/A152239.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/152/A152239.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A152239: a(n) = -5*a(n-1) + 7*a(n-2) for n > 1 with a(0) = 1 and a(1) = -7.
; Submitted by Jon Maiga
; 1,-7,42,-259,1589,-9758,59913,-367871,2258746,-13868827,85155357,-522858574,3210380369,-19711911863,121032221898,-743144492531,4562948015941,-28016751527422,172024393748697,-1056239229435439
mul $0,2
mov $2,1
lpb $0
sub $0,2
sub $2,$1
sub $1,$2
mul $2,-7
lpe
mov $0,$2
| 27.357143 | 192 | 0.671018 |
b7890add8d360ef0736811457c39bed0faaf231e | 1,732 | asm | Assembly | programs/oeis/164/A164015.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/164/A164015.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/164/A164015.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A164015: 5 times centered pentagonal numbers: 5*(5*n^2 + 5*n + 2)/2.
; 5,30,80,155,255,380,530,705,905,1130,1380,1655,1955,2280,2630,3005,3405,3830,4280,4755,5255,5780,6330,6905,7505,8130,8780,9455,10155,10880,11630,12405,13205,14030,14880,15755,16655,17580,18530,19505,20505,21530,22580,23655,24755,25880,27030,28205,29405,30630,31880,33155,34455,35780,37130,38505,39905,41330,42780,44255,45755,47280,48830,50405,52005,53630,55280,56955,58655,60380,62130,63905,65705,67530,69380,71255,73155,75080,77030,79005,81005,83030,85080,87155,89255,91380,93530,95705,97905,100130,102380,104655,106955,109280,111630,114005,116405,118830,121280,123755,126255,128780,131330,133905,136505,139130,141780,144455,147155,149880,152630,155405,158205,161030,163880,166755,169655,172580,175530,178505,181505,184530,187580,190655,193755,196880,200030,203205,206405,209630,212880,216155,219455,222780,226130,229505,232905,236330,239780,243255,246755,250280,253830,257405,261005,264630,268280,271955,275655,279380,283130,286905,290705,294530,298380,302255,306155,310080,314030,318005,322005,326030,330080,334155,338255,342380,346530,350705,354905,359130,363380,367655,371955,376280,380630,385005,389405,393830,398280,402755,407255,411780,416330,420905,425505,430130,434780,439455,444155,448880,453630,458405,463205,468030,472880,477755,482655,487580,492530,497505,502505,507530,512580,517655,522755,527880,533030,538205,543405,548630,553880,559155,564455,569780,575130,580505,585905,591330,596780,602255,607755,613280,618830,624405,630005,635630,641280,646955,652655,658380,664130,669905,675705,681530,687380,693255,699155,705080,711030,717005,723005,729030,735080,741155,747255,753380,759530,765705,771905,778130
sub $1,$0
bin $1,2
mul $1,25
add $1,5
| 216.5 | 1,621 | 0.829677 |
260ed6c9c0ac3d799ee0bc224a2d568204b79765 | 5,717 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_326_990.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_326_990.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_326_990.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r14
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0xc0ab, %rsi
lea addresses_WT_ht+0x40ab, %rdi
nop
nop
nop
inc %r13
mov $82, %rcx
rep movsq
nop
nop
nop
add %rsi, %rsi
lea addresses_WT_ht+0x17e6b, %r14
nop
nop
nop
nop
xor %r10, %r10
mov (%r14), %rbp
nop
nop
add %rcx, %rcx
lea addresses_UC_ht+0x78ab, %rbp
add $43417, %rcx
mov (%rbp), %rdi
cmp $39137, %r10
lea addresses_WC_ht+0xd64b, %rsi
lea addresses_normal_ht+0x1d8ab, %rdi
nop
xor %r11, %r11
mov $5, %rcx
rep movsq
nop
nop
nop
dec %r14
lea addresses_UC_ht+0xa1ab, %rsi
lea addresses_A_ht+0x1c92b, %rdi
clflush (%rsi)
add $44296, %r14
mov $31, %rcx
rep movsb
nop
nop
nop
nop
nop
and $41304, %r14
lea addresses_D_ht+0x168fb, %rsi
lea addresses_WT_ht+0x4e2b, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
cmp %rbp, %rbp
mov $96, %rcx
rep movsl
sub $44691, %r13
lea addresses_WT_ht+0x1dfab, %rsi
lea addresses_normal_ht+0x1c20c, %rdi
nop
nop
nop
cmp $55024, %r14
mov $103, %rcx
rep movsw
add $54812, %rbp
lea addresses_WC_ht+0x14cab, %rsi
lea addresses_D_ht+0xf1db, %rdi
nop
nop
nop
cmp %r10, %r10
mov $11, %rcx
rep movsl
nop
nop
nop
nop
xor %rdi, %rdi
lea addresses_WT_ht+0x166ab, %r14
nop
nop
nop
xor $5032, %rbp
movb $0x61, (%r14)
nop
nop
nop
nop
nop
and $21062, %rbp
lea addresses_A_ht+0x2aeb, %rsi
lea addresses_WT_ht+0x39c3, %rdi
nop
nop
nop
nop
nop
xor $41498, %rbp
mov $33, %rcx
rep movsl
xor %r10, %r10
lea addresses_WC_ht+0x1bcab, %rsi
lea addresses_normal_ht+0x41ab, %rdi
clflush (%rdi)
nop
add %r14, %r14
mov $95, %rcx
rep movsb
nop
nop
xor %r10, %r10
lea addresses_normal_ht+0x14b4b, %rsi
lea addresses_UC_ht+0x7e2b, %rdi
clflush (%rdi)
nop
nop
and $36610, %r14
mov $35, %rcx
rep movsb
nop
nop
xor $42481, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r14
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r15
push %r8
push %rbp
push %rsi
// Store
lea addresses_WC+0x5a57, %r12
inc %r11
movl $0x51525354, (%r12)
nop
nop
xor $54237, %rsi
// Store
mov $0xcb3, %r8
nop
nop
nop
nop
nop
xor $42596, %rbp
mov $0x5152535455565758, %rsi
movq %rsi, (%r8)
nop
nop
nop
nop
xor %r15, %r15
// Faulty Load
lea addresses_D+0x178ab, %r8
cmp $23355, %r15
vmovups (%r8), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $1, %xmm4, %rbp
lea oracles, %r11
and $0xff, %rbp
shlq $12, %rbp
mov (%r11,%rbp,1), %rbp
pop %rsi
pop %rbp
pop %r8
pop %r15
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': True}}
{'36': 326}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
| 25.752252 | 977 | 0.657513 |
8f8d82bf7f2f0e3aeb23da57083e701b832e338d | 3,531 | asm | Assembly | lib/vz_crt0.asm | dex4er/deb-z88dk | 9ee4f23444fa6f6043462332a1bff7ae20a8504b | [
"ClArtistic"
] | 1 | 2018-09-04T23:07:24.000Z | 2018-09-04T23:07:24.000Z | lib/vz_crt0.asm | dex4er/deb-z88dk | 9ee4f23444fa6f6043462332a1bff7ae20a8504b | [
"ClArtistic"
] | null | null | null | lib/vz_crt0.asm | dex4er/deb-z88dk | 9ee4f23444fa6f6043462332a1bff7ae20a8504b | [
"ClArtistic"
] | null | null | null | ; Startup for VZ200/300
;
; Stefano Bodrato - Apr. 2000
;
; If an error occurs eg break we just drop back to BASIC
;
; $Id: vz_crt0.asm,v 1.8 2007/06/27 20:49:28 dom Exp $
;
MODULE vz_crt0
;
; Initially include the zcc_opt.def file to find out lots of lovely
; information about what we should do..
;
INCLUDE "zcc_opt.def"
; No matter what set up we have, main is always, always external to
; this file
XREF _main
;
; Some variables which are needed for both app and basic startup
;
XDEF cleanup
XDEF l_dcal
; Integer rnd seed
XDEF _std_seed
; vprintf is internal to this file so we only ever include one of the set
; of routines
XDEF _vfprintf
;Exit variables
XDEF exitsp
XDEF exitcount
;For stdin, stdout, stder
XDEF __sgoioblk
;Graphic function XDEFS..
XDEF coords
XDEF base_graphics
XDEF gfx_bank
; Now, getting to the real stuff now!
IF (startup=2)
org 32768
ELSE
org $7ae9-24
defb $20,$20,0,0
defm "z80.mc"
defb 0,0,0,0,0,0,0,0,0,0,0
defb $f0
defw $7ae9 ; 24 bytes so far
defw $7b04
defw 1
defb $B1 ;POKE
defm " 30862,18:"
defb $B1 ;POKE
defm " 30863,123"
defb 0 ; this block is 27 bytes long
defw $7b0f
defw 2
defb $b2 ; PRINT
defb ' '
defb $c1 ; USR
defm "(0)"
defb 0 ; this block is 11 bytes long
defw 0
defb 4
; Header ends here: 65 bytes
ENDIF
.start
call _main
.cleanup
;
; Deallocate memory which has been allocated here!
;
push hl
IF !DEFINED_nostreams
IF DEFINED_ANSIstdio
LIB closeall
call closeall
ENDIF
ENDIF
exx
ld hl,10072
exx
pop bc
.start1
ld sp,0
jp 1A19h
.l_dcal
jp (hl)
; Now, define some values for stdin, stdout, stderr
.__sgoioblk
IF DEFINED_ANSIstdio
INCLUDE "#stdio_fp.asm"
ELSE
defw -11,-12,-10
ENDIF
; Now, which of the vfprintf routines do we need?
._vfprintf
IF DEFINED_floatstdio
LIB vfprintf_fp
jp vfprintf_fp
ELSE
IF DEFINED_complexstdio
LIB vfprintf_comp
jp vfprintf_comp
ELSE
IF DEFINED_ministdio
LIB vfprintf_mini
jp vfprintf_mini
ENDIF
ENDIF
ENDIF
;Seed for integer rand() routines
._std_seed defw 0
;Atexit routine
.exitsp
defw 0
.exitcount
defb 0
; Heap stuff
.heaplast defw 0
.heapblocks defw 0
.coords defw 0
.base_graphics defw 28672
.gfx_bank defb 0
defm "Small C+ VZ"
defb 0
;All the float stuff is kept in a different file...for ease of altering!
;It will eventually be integrated into the library
;
;Here we have a minor (minor!) problem, we've no idea if we need the
;float package if this is separated from main (we had this problem before
;but it wasn't critical..so, now we will have to read in a file from
;the directory (this will be produced by zcc) which tells us if we need
;the floatpackage, and if so what it is..kludgey, but it might just work!
;
;Brainwave time! The zcc_opt file could actually be written by the
;compiler as it goes through the modules, appending as necessary - this
;way we only include the package if we *really* need it!
IF NEED_floatpack
INCLUDE "#float.asm"
;seed for random number generator - not used yet..
.fp_seed defb $80,$80,0,0,0,0
;Floating point registers...
.extra defs 6
.fa defs 6
.fasign defb 0
ENDIF
| 17.655 | 73 | 0.640895 |
15636a1ad69da4301c03d91a5ff6416b8a8ef047 | 8,191 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_547.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_0x48.log_21829_547.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_0x48.log_21829_547.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r15
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x129c, %rsi
lea addresses_UC_ht+0x4a72, %rdi
nop
nop
nop
and %rbx, %rbx
mov $89, %rcx
rep movsw
nop
nop
nop
nop
nop
inc %r13
lea addresses_UC_ht+0xe242, %rsi
lea addresses_WT_ht+0x1ab72, %rdi
nop
nop
nop
nop
nop
and $25118, %rdx
mov $75, %rcx
rep movsb
nop
add %rdx, %rdx
lea addresses_A_ht+0x11772, %rsi
lea addresses_WC_ht+0x16e72, %rdi
nop
nop
dec %r11
mov $74, %rcx
rep movsl
nop
nop
nop
inc %rdi
lea addresses_normal_ht+0xccda, %rcx
nop
nop
nop
nop
xor %r13, %r13
mov $0x6162636465666768, %r11
movq %r11, %xmm4
movups %xmm4, (%rcx)
nop
nop
and %r13, %r13
lea addresses_normal_ht+0x3682, %r13
nop
nop
nop
sub %r11, %r11
movups (%r13), %xmm3
vpextrq $1, %xmm3, %rdi
nop
nop
nop
nop
nop
xor %r11, %r11
lea addresses_D_ht+0xdf72, %rsi
nop
nop
sub $29564, %rdx
mov $0x6162636465666768, %rdi
movq %rdi, (%rsi)
nop
nop
nop
nop
and $52909, %r11
lea addresses_D_ht+0x1a7bb, %rdi
nop
nop
nop
nop
nop
and %r13, %r13
movups (%rdi), %xmm5
vpextrq $0, %xmm5, %rsi
nop
nop
nop
nop
dec %rsi
lea addresses_D_ht+0xcf72, %r13
dec %rsi
mov (%r13), %rdx
cmp %rdx, %rdx
lea addresses_WC_ht+0x19a48, %rsi
nop
nop
nop
dec %r13
vmovups (%rsi), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $0, %xmm4, %rdx
nop
nop
nop
nop
add %rcx, %rcx
lea addresses_UC_ht+0x2630, %rdx
nop
nop
nop
sub %rcx, %rcx
movb $0x61, (%rdx)
nop
nop
nop
nop
add $34525, %r13
lea addresses_normal_ht+0x2272, %rsi
lea addresses_D_ht+0x18372, %rdi
nop
nop
nop
and $3626, %r15
mov $77, %rcx
rep movsw
nop
and %r11, %r11
lea addresses_normal_ht+0x12972, %rsi
lea addresses_normal_ht+0xc392, %rdi
clflush (%rsi)
clflush (%rdi)
nop
nop
nop
nop
add $9361, %rdx
mov $74, %rcx
rep movsb
cmp $22593, %r15
lea addresses_A_ht+0xa512, %r15
nop
nop
nop
dec %rdx
mov (%r15), %rsi
nop
inc %rbx
lea addresses_UC_ht+0x1d772, %rsi
nop
nop
nop
nop
cmp %rcx, %rcx
movb $0x61, (%rsi)
nop
nop
nop
nop
and %r15, %r15
lea addresses_A_ht+0xa4e9, %rsi
lea addresses_WT_ht+0x15772, %rdi
clflush (%rsi)
clflush (%rdi)
nop
inc %rbx
mov $127, %rcx
rep movsw
nop
nop
nop
nop
nop
add $58633, %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r15
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r9
push %rbx
push %rcx
push %rsi
// Store
lea addresses_WC+0x17272, %r14
xor $61756, %rcx
mov $0x5152535455565758, %rsi
movq %rsi, %xmm1
vmovups %ymm1, (%r14)
nop
nop
nop
add %rbx, %rbx
// Faulty Load
lea addresses_RW+0x1df72, %rcx
nop
nop
cmp %r9, %r9
mov (%rcx), %r14w
lea oracles, %rcx
and $0xff, %r14
shlq $12, %r14
mov (%rcx,%r14,1), %r14
pop %rsi
pop %rcx
pop %rbx
pop %r9
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 8, 'size': 32, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 2, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 4, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 11, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 9, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 1, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 1, 'size': 1, 'same': True, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': True, 'congruent': 2, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}}
{'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
*/
| 31.996094 | 2,999 | 0.659016 |
c177d0da1e9fd30cf520bf5d7a0d92aa0d71971e | 960 | asm | Assembly | assembler/tests/t_1802/t_1802.asm | paulscottrobson/RCA-Cosmac-VIP-III | 5d3fcea325aacb7c99269f266bc14e30439cdc2b | [
"MIT"
] | 1 | 2022-01-17T16:06:15.000Z | 2022-01-17T16:06:15.000Z | assembler/tests/t_1802/t_1802.asm | paulscottrobson/RCA-Cosmac-VIP-III | 5d3fcea325aacb7c99269f266bc14e30439cdc2b | [
"MIT"
] | null | null | null | assembler/tests/t_1802/t_1802.asm | paulscottrobson/RCA-Cosmac-VIP-III | 5d3fcea325aacb7c99269f266bc14e30439cdc2b | [
"MIT"
] | null | null | null | cpu 1802
page 0
allregs_nozero macro instr
irp reg,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
instr reg
endm
endm
allregs macro instr
instr 0
allregs_nozero instr
endm
allio macro instr
irp addr,1,2,3,4,5,6,7
instr addr
endm
endm
allregs_nozero ldn
allregs lda
ldx
ldxa
ldi 55h
allregs str
stxd
allregs inc
allregs dec
irx
allregs glo
allregs plo
allregs ghi
allregs phi
or
ori 55h
xor
xri 55h
and
ani 55h
shr
shrc
rshr
shl
shlc
rshl
add
adi 55h
adc
adci 55h
sd
sdi 55h
sdb
sdbi 55h
sm
smi 55h
smb
smbi 55h
br $+2
nbr $+2
bz $+2
bnz $+2
bdf $+2
bpz $+2
bge $+2
bnf $+2
bm $+2
bl $+2
bq $+2
bnq $+2
b1 $+2
bn1 $+2
b2 $+2
bn2 $+2
b3 $+2
bn3 $+2
b4 $+2
bn4 $+2
lbr $+3
nlbr $+3
lbz $+3
lbnz $+3
lbdf $+3
lbnf $+3
lbq $+3
lbnq $+3
skp
lskp
lsz
lsnz
lsdf
lsnf
lsq
lsnq
lsie
idl
nop
allregs sep
allregs sex
seq
req
sav
mark
ret
dis
allio out
allio inp
| 8.205128 | 44 | 0.617708 |
bb22e93e86515b5248e9a910900570ea1503f6f1 | 351 | asm | Assembly | data/mapHeaders/undergroundpathentranceroute6.asm | adhi-thirumala/EvoYellow | 6fb1b1d6a1fa84b02e2d982f270887f6c63cdf4c | [
"Unlicense"
] | 16 | 2018-08-28T21:47:01.000Z | 2022-02-20T20:29:59.000Z | data/mapHeaders/undergroundpathentranceroute6.asm | adhi-thirumala/EvoYellow | 6fb1b1d6a1fa84b02e2d982f270887f6c63cdf4c | [
"Unlicense"
] | 5 | 2019-04-03T19:53:11.000Z | 2022-03-11T22:49:34.000Z | data/mapHeaders/undergroundpathentranceroute6.asm | adhi-thirumala/EvoYellow | 6fb1b1d6a1fa84b02e2d982f270887f6c63cdf4c | [
"Unlicense"
] | 2 | 2019-12-09T19:46:02.000Z | 2020-12-05T21:36:30.000Z | UndergroundPathEntranceRoute6_h:
db GATE ; tileset
db PATH_ENTRANCE_ROUTE_6_HEIGHT, PATH_ENTRANCE_ROUTE_6_WIDTH ; dimensions (y, x)
dw UndergroundPathEntranceRoute6Blocks, UndergroundPathEntranceRoute6TextPointers, UndergroundPathEntranceRoute6Script ; blocks, texts, scripts
db $00 ; connections
dw UndergroundPathEntranceRoute6Object ; objects
| 50.142857 | 144 | 0.863248 |
478e26a6bdef0c0105dc6e6a1c670449ce8bf78e | 68 | asm | Assembly | 8085_programming/8085 Programs/test1.asm | SayanGhoshBDA/code-backup | 8b6135facc0e598e9686b2e8eb2d69dd68198b80 | [
"MIT"
] | 16 | 2018-11-26T08:39:42.000Z | 2019-05-08T10:09:52.000Z | 8085_programming/8085 Programs/test1.asm | SayanGhoshBDA/code-backup | 8b6135facc0e598e9686b2e8eb2d69dd68198b80 | [
"MIT"
] | 8 | 2020-05-04T06:29:26.000Z | 2022-02-12T05:33:16.000Z | 8085_programming/8085 Programs/test1.asm | SayanGhoshBDA/code-backup | 8b6135facc0e598e9686b2e8eb2d69dd68198b80 | [
"MIT"
] | 5 | 2020-02-11T16:02:21.000Z | 2021-02-05T07:48:30.000Z | ;.ORG 0000H
LDA 4000H
LXI H,4002H
MOV B,M
ADD B
STA 4003H
HLT | 9.714286 | 12 | 0.661765 |
4aac9afecb1ef523a90cdd301489cda020624bd1 | 527 | asm | Assembly | programs/oeis/164/A164675.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/164/A164675.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/164/A164675.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A164675: a(n) = 8*a(n-2) for n > 2; a(1) = 1, a(2) = 12.
; 1,12,8,96,64,768,512,6144,4096,49152,32768,393216,262144,3145728,2097152,25165824,16777216,201326592,134217728,1610612736,1073741824,12884901888,8589934592,103079215104,68719476736,824633720832,549755813888,6597069766656,4398046511104,52776558133248,35184372088832,422212465065984,281474976710656,3377699720527872,2251799813685248
mov $1,$0
mod $1,2
add $1,2
lpb $0
sub $0,1
trn $0,1
mov $2,4
mul $2,$1
mul $2,2
mov $1,$2
lpe
sub $1,2
div $1,2
add $1,1
| 29.277778 | 332 | 0.736243 |
7bd13fdb41e8ac5558afca3a58e06eacde2a5e81 | 290 | nasm | Assembly | custom_tools/compile_assembly/template.nasm | danf42/vulnserver | 1b01aaa0f0b5706b5bc24c5f64d99dddcdcfe913 | [
"MIT"
] | null | null | null | custom_tools/compile_assembly/template.nasm | danf42/vulnserver | 1b01aaa0f0b5706b5bc24c5f64d99dddcdcfe913 | [
"MIT"
] | null | null | null | custom_tools/compile_assembly/template.nasm | danf42/vulnserver | 1b01aaa0f0b5706b5bc24c5f64d99dddcdcfe913 | [
"MIT"
] | null | null | null | [BITS 32]
global _start
section .text
_start:
; Print hello world using write syscall
mov eax, 0x4
mov ebx, 1
mov ecx, message
mov edx, mlen
int 0x80
mov eax, 1
mov ebx, 10 ; sys_exit syscall
int 0x80
section .data
message: db "Hello World!"
mlen equ $-message
| 10.740741 | 40 | 0.668966 |
fea366c0b0847eae79e72e7f692c44e957a67cde | 637 | asm | Assembly | oeis/122/A122117.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/122/A122117.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/122/A122117.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A122117: a(n) = 3*a(n-1) + 4*a(n-2), with a(0)=1, a(1)=2.
; 1,2,10,38,154,614,2458,9830,39322,157286,629146,2516582,10066330,40265318,161061274,644245094,2576980378,10307921510,41231686042,164926744166,659706976666,2638827906662,10555311626650,42221246506598,168884986026394,675539944105574,2702159776422298,10808639105689190,43234556422756762,172938225691027046,691752902764108186,2767011611056432742,11068046444225730970,44272185776902923878,177088743107611695514,708354972430446782054,2833419889721787128218,11333679558887148512870,45334718235548594051482
mov $1,4
pow $1,$0
mul $1,6
div $1,15
mul $1,6
div $1,4
add $1,1
mov $0,$1
| 53.083333 | 500 | 0.828885 |
a0f7164d53da4f3180f3924cf602c5edb0376c5f | 433 | asm | Assembly | programs/oeis/254/A254758.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/254/A254758.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/254/A254758.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A254758: Part of the positive proper solutions x of the Pell equation x^2 - 2*y^2 = - 7^2 based on the fundamental solution (x0, y0)= (1, 5).
; 1,23,137,799,4657,27143,158201,922063,5374177,31322999,182563817,1064059903,6201795601,36146713703,210678486617,1227924205999,7156866749377,41713276290263,243122790992201,1417023469662943
mov $1,1
mov $2,5
lpb $0
sub $0,1
add $1,$2
add $2,$1
add $2,$1
add $1,$2
lpe
mov $0,$1
| 30.928571 | 189 | 0.725173 |
b69acc5943370ed77a2c99bd352be59c6816416d | 729 | asm | Assembly | oeis/277/A277466.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/277/A277466.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/277/A277466.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A277466: E.g.f.: -log(1-x)/(1+LambertW(-x)).
; Submitted by Jon Maiga
; 0,1,3,17,146,1684,24294,419383,8412760,192078864,4914973770,139265564723,4327699948956,146323675764044,5347193667136398,210005149832116455,8820722263274822992,394546588041904397184,18723398414958791004690,939550079246853331267203,49706725507826031460129220,2765108804107856319091550796,161348438322604129167668238614,9854228672909541918599871544999,628664856362206107904669976001144,41817750312042379300290517088366800,2895458806845765719131466077153708570,208360908977531555553191698809250635507
mov $4,$0
add $0,1
lpb $0
sub $0,1
max $0,1
mov $2,$1
pow $2,$1
mov $3,$4
bin $3,$1
add $1,1
mul $3,$2
mul $5,$0
add $5,$3
lpe
mov $0,$5
| 36.45 | 498 | 0.802469 |
dbfed070867112f391546e719cfbed5bb22ba997 | 1,085 | asm | Assembly | oeis/289/A289097.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/289/A289097.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/289/A289097.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A289097: Binary representation of the diagonal from the origin to the corner of the n-th stage of growth of the two-dimensional cellular automaton defined by "Rule 545", based on the 5-celled von Neumann neighborhood.
; Submitted by Christian Krause
; 1,1,111,111,10111,11111,1011111,1111111,101111111,111111111,10111111111,11111111111,1011111111111,1111111111111,101111111111111,111111111111111,10111111111111111,11111111111111111,1011111111111111111,1111111111111111111,101111111111111111111,111111111111111111111,10111111111111111111111,11111111111111111111111,1011111111111111111111111,1111111111111111111111111,101111111111111111111111111,111111111111111111111111111,10111111111111111111111111111,11111111111111111111111111111
seq $0,289099 ; Decimal representation of the diagonal from the origin to the corner of the n-th stage of growth of the two-dimensional cellular automaton defined by "Rule 545", based on the 5-celled von Neumann neighborhood.
seq $0,7088 ; The binary numbers (or binary words, or binary vectors, or binary expansion of n): numbers written in base 2.
| 155 | 481 | 0.852535 |
21536de996fbed5d5293dbe21b4d15d850773a8d | 683 | asm | Assembly | programs/oeis/287/A287549.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/287/A287549.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/287/A287549.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A287549: Total number of unordered factorizations of all positive integers <= n into distinct factors greater than 1.
; 1,2,3,4,5,7,8,10,11,13,14,17,18,20,22,24,25,28,29,32,34,36,37,42,43,45,47,50,51,56,57,60,62,64,66,71,72,74,76,81,82,87,88,91,94,96,97,104,105,108,110,113,114,119,121,126,128,130,131,140,141,143,146,150,152,157,158,161,163,168,169,178,179,181,184
mov $2,$0
add $2,1
mov $3,$0
lpb $2
mov $0,$3
sub $2,1
sub $0,$2
seq $0,5 ; d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n.
sub $0,1
seq $0,248517 ; Number of odd divisors > 1 in the numbers 1 through n, counted with multiplicity.
mov $4,$0
add $4,1
add $1,$4
lpe
mov $0,$1
| 35.947368 | 247 | 0.667643 |
7b9b33a02fcba206cb79af882662cabaf0134d53 | 9,216 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_st_sm_/i7-7700_9_0x48_notsx.log_21829_1893.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/AVXALIGN/_st_sm_/i7-7700_9_0x48_notsx.log_21829_1893.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/AVXALIGN/_st_sm_/i7-7700_9_0x48_notsx.log_21829_1893.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x1ae37, %rsi
lea addresses_normal_ht+0x11eaf, %rdi
nop
nop
nop
add $41615, %rbp
mov $63, %rcx
rep movsw
nop
nop
sub $17822, %rcx
lea addresses_UC_ht+0x10237, %rsi
lea addresses_D_ht+0xa7af, %rdi
nop
nop
nop
nop
nop
and %r11, %r11
mov $113, %rcx
rep movsb
nop
nop
nop
nop
lfence
lea addresses_A_ht+0x1139b, %rsi
lea addresses_normal_ht+0x178a7, %rdi
nop
nop
nop
nop
nop
sub $47584, %rdx
mov $0, %rcx
rep movsb
nop
nop
xor $43563, %rbp
lea addresses_UC_ht+0x6ccf, %r11
nop
nop
nop
nop
inc %rbx
mov $0x6162636465666768, %rdx
movq %rdx, %xmm3
vmovups %ymm3, (%r11)
nop
nop
nop
cmp %rbx, %rbx
lea addresses_D_ht+0xfaaf, %rsi
lea addresses_UC_ht+0x1ea2f, %rdi
nop
nop
nop
nop
nop
inc %r12
mov $89, %rcx
rep movsw
nop
nop
cmp $8886, %r11
lea addresses_normal_ht+0x11727, %rcx
add $57259, %r12
mov $0x6162636465666768, %rdi
movq %rdi, %xmm5
and $0xffffffffffffffc0, %rcx
vmovntdq %ymm5, (%rcx)
nop
nop
nop
nop
nop
cmp $63362, %rbp
lea addresses_normal_ht+0x1442f, %rsi
lea addresses_UC_ht+0x402f, %rdi
nop
nop
nop
nop
nop
inc %r12
mov $76, %rcx
rep movsl
nop
nop
nop
cmp $18853, %rcx
lea addresses_A_ht+0x14e2b, %rsi
lea addresses_UC_ht+0xc2f, %rdi
nop
nop
nop
nop
cmp %rdx, %rdx
mov $6, %rcx
rep movsb
cmp $58027, %rdx
lea addresses_WC_ht+0x1a6ef, %rsi
lea addresses_WC_ht+0x8f4b, %rdi
nop
sub $32300, %rdx
mov $66, %rcx
rep movsb
nop
nop
nop
nop
add $12523, %rdi
lea addresses_A_ht+0x17b0f, %rdx
nop
nop
inc %rsi
mov $0x6162636465666768, %r11
movq %r11, %xmm7
and $0xffffffffffffffc0, %rdx
vmovaps %ymm7, (%rdx)
nop
nop
nop
nop
inc %rsi
lea addresses_normal_ht+0x1e7, %rbp
nop
add $37484, %r12
movb $0x61, (%rbp)
nop
nop
nop
nop
nop
cmp %rsi, %rsi
lea addresses_WT_ht+0x17817, %rbp
add %r11, %r11
movb $0x61, (%rbp)
nop
nop
cmp $2911, %rdx
lea addresses_WT_ht+0xb22f, %rsi
lea addresses_D_ht+0x1acaf, %rdi
nop
add $8835, %r11
mov $9, %rcx
rep movsl
nop
xor %rcx, %rcx
lea addresses_UC_ht+0x1a017, %rdx
nop
nop
nop
sub $5293, %r12
mov $0x6162636465666768, %rbx
movq %rbx, (%rdx)
nop
nop
nop
add $6676, %rbx
lea addresses_D_ht+0x1c9af, %r11
nop
nop
add $29518, %rsi
vmovups (%r11), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $1, %xmm7, %rbp
nop
nop
add %rcx, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r8
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_WT+0x4af, %rsi
lea addresses_normal+0x43f7, %rdi
nop
nop
inc %r8
mov $123, %rcx
rep movsw
nop
nop
sub $24673, %rbp
// REPMOV
lea addresses_WC+0x61af, %rsi
lea addresses_UC+0x9cff, %rdi
nop
nop
nop
nop
nop
add $56084, %rax
mov $97, %rcx
rep movsw
nop
nop
and %rbx, %rbx
// Store
lea addresses_A+0x1a6af, %r8
nop
xor %rdi, %rdi
movl $0x51525354, (%r8)
nop
nop
nop
nop
nop
cmp $16063, %rbp
// Store
lea addresses_A+0x1a6af, %r8
nop
nop
nop
nop
nop
cmp $2537, %rax
mov $0x5152535455565758, %rbx
movq %rbx, (%r8)
nop
nop
nop
add %rax, %rax
// Faulty Load
lea addresses_A+0x1a6af, %rdi
nop
nop
nop
xor $9438, %rax
mov (%rdi), %rcx
lea oracles, %rbp
and $0xff, %rcx
shlq $12, %rcx
mov (%rbp,%rcx,1), %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r8
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_A', 'congruent': 0}}
{'dst': {'same': False, 'congruent': 3, 'type': 'addresses_normal'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_WT'}}
{'dst': {'same': False, 'congruent': 4, 'type': 'addresses_UC'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_WC'}}
{'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_A', 'congruent': 0}, 'OP': 'STOR'}
{'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_A', 'congruent': 0}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': True, 'AVXalign': False, 'size': 8, 'type': 'addresses_A', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'congruent': 11, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_D_ht'}}
{'dst': {'same': False, 'congruent': 8, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_UC_ht'}}
{'dst': {'same': False, 'congruent': 2, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_A_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_UC_ht', 'congruent': 5}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 7, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_D_ht'}}
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 32, 'type': 'addresses_normal_ht', 'congruent': 3}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 6, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_normal_ht'}}
{'dst': {'same': False, 'congruent': 7, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_A_ht'}}
{'dst': {'same': False, 'congruent': 2, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_WC_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 32, 'type': 'addresses_A_ht', 'congruent': 5}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_normal_ht', 'congruent': 2}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_WT_ht', 'congruent': 3}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 7, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_WT_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_UC_ht', 'congruent': 2}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_D_ht', 'congruent': 5}}
{'58': 21829}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
| 30.315789 | 2,999 | 0.66135 |
0a78f616e37de9abd79daab9e8688be933a981c0 | 73 | asm | Assembly | src/main/fragment/mos6502-common/vwsm1_lt_pwsc1_derefidx_vbuyy_then_la1.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | 2 | 2022-03-01T02:21:14.000Z | 2022-03-01T04:33:35.000Z | src/main/fragment/mos6502-common/vwsm1_lt_pwsc1_derefidx_vbuyy_then_la1.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | null | null | null | src/main/fragment/mos6502-common/vwsm1_lt_pwsc1_derefidx_vbuyy_then_la1.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | null | null | null | lda {m1}
cmp {c1},y
lda {m1}+1
sbc {c1}+1,y
bvc !+
eor #$80
!:
bmi {la1}
| 8.111111 | 12 | 0.520548 |
d0e336f6d6660d6f17a7457acd22906ca927c075 | 5,440 | asm | Assembly | src/filters/ASM_merge2.asm | ignaciolebrero/Orga2-TP2 | 404e39e76dafd05af81e29be2d1210d8fb50a96e | [
"MIT"
] | null | null | null | src/filters/ASM_merge2.asm | ignaciolebrero/Orga2-TP2 | 404e39e76dafd05af81e29be2d1210d8fb50a96e | [
"MIT"
] | null | null | null | src/filters/ASM_merge2.asm | ignaciolebrero/Orga2-TP2 | 404e39e76dafd05af81e29be2d1210d8fb50a96e | [
"MIT"
] | null | null | null | ; ************************************************************************* ;
; Organizacion del Computador II ;
; ;
; Implementacion de la funcion Merge 2 ;
; ;
; ************************************************************************* ;
; void ASM_merge2(uint32_t w, uint32_t h, uint8_t* data1, uint8_t* data2, float value)
global ASM_merge2
;value--> xmm0
section .data
mask_ordenar: db 0x00, 0x04,0x08, 0x0c, 0x01, 0x05, 0x09, 0x0d, 0x02,0x06, 0x0a, 0x0e, 0x03, 0x07, 0x0b, 0x0f
mask_shuf: db 0x00, 0x01,0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01
v256: dd 256.0, 0.0, 0.0, 0.0
section .text
ASM_merge2:
push rbp
mov rbp, rsp
push rbx
push r12
push r13
push r14
push r15
sub rsp, 8
mov r13, rdx ; r13 = data1
mov r14, rcx ; r14 = data2
;limpio parte alta
mov edi, edi
mov esi, esi
mov r12d, edi
mov r15d, esi
mov rax, r12
mul r15
shr rax, 2
xor r12, r12
mov r12, rax
xorps xmm5, xmm5 ; xmm5=0|0|0|0
movdqu xmm15, [v256]
mov r15d, 256
mulss xmm15, xmm0 ; xmm15=0|0|0|value*256
cvtss2si ebx, xmm15 ; lo convertimos a enteros de 32 bit ebx=value*256, pero como el numero es menor a 256 lo podemos pensar como un entero de 16 bit
pxor xmm1, xmm1
movd xmm1, ebx ; xmm1= value*256
sub r15d, ebx
xorps xmm9, xmm9
movd xmm9, r15d ; xmm9 = 256 -value*256(entero)
movdqu xmm14, [mask_shuf]
pshufb xmm9, xmm14; xmm9 = 256-value*256 | 256-value*256 | 256-value*256 | 256-value*256 | 256-value*256 | 256-value*256 | 256-value*256 | 256-value*256
pshufb xmm1, xmm14; xmm1 = value*256 | value*256 | value*256 | value*256 |value*256 | value*256 | value*256 | value*256
movdqu xmm14, [mask_ordenar]
.ciclo:
pxor xmm3, xmm3
movdqu xmm3, [r13] ;en xmm3 4 pixeles a procesar
pshufb xmm3, xmm14 ;xmm3= r|r|r|r|g|g|g|g|b|b|b|b|a|a|a|a
;(*) ojo el nombre de los colores b y r esta invertido(es decir que nos referimos con r al azul y con b al rojo) , pero solo es imporante la posicion de a
;desempaquetamos
movdqu xmm4, xmm3 ;xmm4=r|r|r|r|g|g|g|g|b|b|b|b|a|a|a|a
punpcklbw xmm4, xmm5 ;xmm4 = 0b|0b|0b|0b|0a|0a|0a|0a 8 numeros de 16 bit
pxor xmm2, xmm2
movdqu xmm2, xmm4
; limpio parte alta de xmm2
pslldq xmm2, 8
psrldq xmm2, 8 ; xmm2 = 0|0|0|0|0a|0a|0a|0a
punpcklwd xmm2, xmm5 ; xmm2= 000a|000a|000a|000a| 8 numeros de 16 bit
movdqu xmm7, xmm3
punpckhbw xmm7, xmm5 ; xmm7= 0r|0r|0r|0r|0g|0g|0g|0g| 8 numeros de 16 bit
movdqu xmm6, xmm7
;mutiplicamos los enteros de 16 bit de xmm7
pmullw xmm7, xmm1 ; parte baja de la multiplicacion de xmm7 con xmm1
pmulhuw xmm6, xmm1 ; parte alta de la multiplicacion de xmm7 con xmm1
movdqu xmm8, xmm7
punpcklwd xmm7, xmm6 ; xmm7= 0g*value*256|0g*value*256|0g*value*256|0g*value*256|
punpckhwd xmm8, xmm6 ; xmm8= 0r*value*256|0r*value*256|0r*value*256|0r*value*256
; tambien multiplicamos a b
psrldq xmm4, 8 ;xmm4 = 00|00|00|00|0b|0b|0b|0b 8 numeros de 16 bit
movdqu xmm6, xmm4
pmullw xmm4, xmm1 ; parte baja de la multiplicacion de xmm4 con xmm1
pmulhuw xmm6, xmm1 ; parte alta de la multiplicacion de xmm4 con xmm1
punpcklwd xmm4, xmm6 ; xmm4= 0b*value*256|0b*value*256|0b*value*256|0b*value*256|
; para la segunda imagen
pxor xmm10, xmm10
movdqu xmm10, [r14] ;en xmm10 4 pixeles a procesar
pshufb xmm10, xmm14 ;xmm10= r|r|r|r|g|g|g|g|b|b|b|b|a|a|a|a
;(*) ojo el nombre de los colores b y r esta invertido, pero solo es imporante la posicion de a
;desempaquetamos
movdqu xmm11, xmm10 ;xmm11=r|r|r|r|g|g|g|g|b|b|b|b|a|a|a|a
punpcklbw xmm11, xmm5 ;xmm11 = 0b|0b|0b|0b|0a|0a|0a|0a 8 numeros de 16 bit
pxor xmm15, xmm15
movdqu xmm15, xmm11
; limpio parte alta de xmm15
pslldq xmm15, 8
psrldq xmm15, 8 ; xmm15 = 0|0|0|0|0a|0a|0a|0a
punpcklwd xmm15, xmm5 ; xmm15= 000a|000a|000a|000a| 8 numeros de 16 bit
movdqu xmm12, xmm10
punpckhbw xmm12, xmm5 ; xmm12= 0r|0r|0r|0r|0g|0g|0g|0g| 8 numeros de 16 bit
;mutiplicamos los enteros de 16 bit de xmm12
movdqu xmm6, xmm12
pmullw xmm12, xmm9 ; parte baja de la multiplicacion de xmm12 con xmm1
pmulhuw xmm6, xmm9 ; parte alta de la multiplicacion de xmm12 con xmm1
movdqu xmm13, xmm12
punpcklwd xmm12, xmm6 ; xmm12= 0g*value*256|0g*value*256|0g*value*256|0g*value*256|
punpckhwd xmm13, xmm6 ; xmm13= 0r*value*256|0r*value*256|0r*value*256|0r*value*256
; tambien multiplicamos a b
psrldq xmm11, 8 ;xmm11 = 00|00|00|00|0b|0b|0b|0b 8 numeros de 16 bit
movdqu xmm6, xmm11
pmullw xmm11, xmm9 ; parte baja de la multiplicacion de xmm4 con xmm1
pmulhuw xmm6, xmm9 ; parte alta de la multiplicacion de xmm4 con xmm1
punpcklwd xmm11, xmm6 ; xmm4= 0b*value*256|0b*value*256|0b*value*256|0b*value*256|
;dividimos por 256
psrld xmm4, 8
psrld xmm7, 8
psrld xmm8, 8
psrld xmm11, 8
psrld xmm12, 8
psrld xmm13, 8
;sumamos
paddd xmm4, xmm11
paddd xmm7, xmm12
paddd xmm8, xmm13
; proceso de empaquetado:
packusdw xmm2, xmm4
packusdw xmm7, xmm8
packuswb xmm2, xmm7
pshufb xmm2, xmm14
movdqu [r13], xmm2
add r13, 16
add r14, 16
dec r12
cmp r12, 0
je .fin
jmp .ciclo
.fin:
add rsp, 8
pop r15
pop r14
pop r13
pop r12
pop rbx
pop rbp
ret
| 25.420561 | 155 | 0.63989 |
2290f4b45ebdb1c95aa2a24d296711baefb56e75 | 139 | asm | Assembly | src/testALU2.asm | JoshKing56/BB8-Breadboard-Computer | 6a14d5aeed856f1f2b0ef8843421bc69ec9ccb1a | [
"MIT"
] | null | null | null | src/testALU2.asm | JoshKing56/BB8-Breadboard-Computer | 6a14d5aeed856f1f2b0ef8843421bc69ec9ccb1a | [
"MIT"
] | 1 | 2018-04-08T21:48:49.000Z | 2018-04-08T21:48:49.000Z | src/testALU2.asm | JoshKing56/8-Bit-Computer | 6a14d5aeed856f1f2b0ef8843421bc69ec9ccb1a | [
"MIT"
] | null | null | null | LD A 14
LD B 17
AND C A B
AND C A 8
OR C A B
OR C A 8
NOT C A
GR C A B
GR C B A
GR C A 40
GEQ C A B
GEQ C B A
GEQ C A 14
EQ C A B
EQ C A 14 | 9.266667 | 10 | 0.597122 |
aa87e8e9d82538773a60936617dd38ea14bf1ace | 516 | asm | Assembly | programs/oeis/162/A162560.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/162/A162560.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/162/A162560.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A162560: a(n) = (4+sqrt(3))*(3+sqrt(3))^n + (4-sqrt(3))*(3-sqrt(3))^n.
; 3,8,30,132,612,2880,13608,64368,304560,1441152,6819552,32270400,152705088,722608128,3419418240,16180860672,76568654592,362326763520,1714548653568,8113331340288,38392696120320,181676188680192
add $0,1
mov $2,1
mov $3,47
mov $4,4
mov $5,-5
lpb $0,1
sub $0,1
add $2,$5
mul $2,2
add $3,$5
sub $4,$3
mul $3,2
mov $5,$3
add $3,$2
sub $3,$4
add $5,$4
mov $1,$5
add $3,1
mov $4,4
lpe
sub $1,$2
sub $1,53
div $1,7
add $1,3
| 18.428571 | 192 | 0.627907 |
af5ce2d40e9f4b924d95f0d3d4a9a25e2b8c82c4 | 542 | asm | Assembly | oeis/017/A017275.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/017/A017275.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/017/A017275.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A017275: a(n) = (10*n)^7.
; 0,10000000,1280000000,21870000000,163840000000,781250000000,2799360000000,8235430000000,20971520000000,47829690000000,100000000000000,194871710000000,358318080000000,627485170000000,1054135040000000,1708593750000000,2684354560000000,4103386730000000,6122200320000000,8938717390000000,12800000000000000,18010885410000000,24943578880000000,34048254470000000,45864714240000000,61035156250000000,80318101760000000,104603532030000000,134929285120000000,172498763090000000,218700000000000000
pow $0,7
mul $0,10000000
| 90.333333 | 487 | 0.894834 |
0cf875464549d4c0f5d160092c9ad8e1235191b0 | 99,172 | asm | Assembly | Testing/test_xloop.asm | DW0RKiN/M4_FORTH | b441b545707a12e5561cd50cbe902745caa9ed10 | [
"MIT"
] | 2 | 2020-09-12T08:26:40.000Z | 2022-03-08T23:06:19.000Z | Testing/test_xloop.asm | DW0RKiN/M4_FORTH | b441b545707a12e5561cd50cbe902745caa9ed10 | [
"MIT"
] | null | null | null | Testing/test_xloop.asm | DW0RKiN/M4_FORTH | b441b545707a12e5561cd50cbe902745caa9ed10 | [
"MIT"
] | 2 | 2021-02-05T05:43:02.000Z | 2021-06-30T19:10:15.000Z | ORG 0x8000
; === b e g i n ===
ld (Stop+1), SP ; 4:20 init storing the original SP value when the "bye" word is used
ld L, 0x1A ; 2:7 init Upper screen
call 0x1605 ; 3:17 init Open channel
ld HL, 60000 ; 3:10 init Init Return address stack
exx ; 1:4 init
;--- +1 ---
; 12345678901234567890123456789012
push DE ; 1:11 print "+1.A 251..(256) "
ld BC, size101 ; 3:10 print Length of string101
ld DE, string101 ; 3:10 print Address of string101
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 251 ; 3:10 xdo(256,251) 101
xdo101save: ; xdo(256,251) 101
ld (idx101),BC ; 4:20 xdo(256,251) 101
xdo101: ; xdo(256,251) 101
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[10:38] xloop 101 variant +1.A: 0 <= index < stop == 256, run 5x
idx101 EQU $+1 ; xloop 101 idx always points to a 16-bit index
ld A, 0 ; 2:7 xloop 101 251.. +1 ..(256), real_stop:0x0100
nop ; 1:4 xloop 101 hi(index) = 0 = nop -> idx always points to a 16-bit index.
inc A ; 1:4 xloop 101 index++
ld (idx101),A ; 3:13 xloop 101
jp nz, xdo101 ; 3:10 xloop 101 index-stop
xleave101: ; xloop 101
xexit101: ; xloop 101
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+1.B 241..(246) "
ld BC, size102 ; 3:10 print Length of string102
ld DE, string102 ; 3:10 print Address of string102
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 241 ; 3:10 xdo(246,241) 102
xdo102save: ; xdo(246,241) 102
ld (idx102),BC ; 4:20 xdo(246,241) 102
xdo102: ; xdo(246,241) 102
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[12:45] xloop 102 variant +1.B: 0 <= index < stop <= 256, run 5x
idx102 EQU $+1 ; xloop 102 idx always points to a 16-bit index
ld A, 0 ; 2:7 xloop 102 241.. +1 ..(246), real_stop:0x00F6
nop ; 1:4 xloop 102 hi(index) = 0 = nop -> idx always points to a 16-bit index.
inc A ; 1:4 xloop 102 index++
ld (idx102),A ; 3:13 xloop 102
xor 0xF6 ; 2:7 xloop 102 lo(real_stop)
jp nz, xdo102 ; 3:10 xloop 102 index-stop
xleave102: ; xloop 102
xexit102: ; xloop 102
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+1.C 0x3CFB..(0x3D00) "
ld BC, size103 ; 3:10 print Length of string103
ld DE, string103 ; 3:10 print Address of string103
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 0x3CFB ; 3:10 xdo(0x3D00,0x3CFB) 103
xdo103save: ; xdo(0x3D00,0x3CFB) 103
ld (idx103),BC ; 4:20 xdo(0x3D00,0x3CFB) 103
xdo103: ; xdo(0x3D00,0x3CFB) 103
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[9:34] xloop 103 variant +1.C: 0x3C00 <=index < stop == 0x3D00, run 5x
idx103 EQU $+1 ; xloop 103 idx always points to a 16-bit index
ld A, 0 ; 2:7 xloop 103 0x3CFB.. +1 ..(0x3D00), real_stop:0x3D00
inc A ; 1:4 xloop 103 = hi(index) = 0x3c = inc A -> idx always points to a 16-bit index
ld (idx103),A ; 3:13 xloop 103 save index
jp nz, xdo103 ; 3:10 xloop 103
xleave103: ; xloop 103
xexit103: ; xloop 103
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+1.D 0x3C05..(0x3C0A) "
ld BC, size104 ; 3:10 print Length of string104
ld DE, string104 ; 3:10 print Address of string104
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 0x3C05 ; 3:10 xdo(0x3C0A,0x3C05) 104
xdo104save: ; xdo(0x3C0A,0x3C05) 104
ld (idx104),BC ; 4:20 xdo(0x3C0A,0x3C05) 104
xdo104: ; xdo(0x3C0A,0x3C05) 104
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[11:41] xloop 104 variant +1.D: 0x3C00 <=index < stop <= 0x3D00, run 5x
idx104 EQU $+1 ; xloop 104 idx always points to a 16-bit index
ld A, 0 ; 2:7 xloop 104 0x3C05.. +1 ..(0x3C0A), real_stop:0x3C0A
inc A ; 1:4 xloop 104 = hi(index) = 0x3c = inc A -> idx always points to a 16-bit index
ld (idx104),A ; 3:13 xloop 104 save index
xor 0x0A ; 2:7 xloop 104 lo(real_stop)
jp nz, xdo104 ; 3:10 xloop 104
xleave104: ; xloop 104
xexit104: ; xloop 104
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+1.E 0x65FB..(0x6600) "
ld BC, size105 ; 3:10 print Length of string105
ld DE, string105 ; 3:10 print Address of string105
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 0x65FB ; 3:10 xdo(0x6600,0x65FB) 105
xdo105save: ; xdo(0x6600,0x65FB) 105
ld (idx105),BC ; 4:20 xdo(0x6600,0x65FB) 105
xdo105: ; xdo(0x6600,0x65FB) 105
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[11:41] xloop 105 variant +1.E: 256*(1+hi(index)) == stop, run 5x
idx105 EQU $+1 ; xloop 105 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 xloop 105 0x65FB.. +1 ..(0x6600), real_stop:0x6600
ld A, C ; 1:4 xloop 105
inc A ; 1:4 xloop 105 index++
ld (idx105),A ; 3:13 xloop 105 save index
jp nz, xdo105 ; 3:10 xloop 105
xleave105: ; xloop 105
xexit105: ; xloop 105
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+1.F 0x4050..(0x4055) "
ld BC, size106 ; 3:10 print Length of string106
ld DE, string106 ; 3:10 print Address of string106
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 0x4050 ; 3:10 xdo(0x4055,0x4050) 106
xdo106save: ; xdo(0x4055,0x4050) 106
ld (idx106),BC ; 4:20 xdo(0x4055,0x4050) 106
xdo106: ; xdo(0x4055,0x4050) 106
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[13:48] xloop 106 variant +1.F: hi(index) == hi(stop-1) && index < stop, run 5x
idx106 EQU $+1 ; xloop 106 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 xloop 106 0x4050.. +1 ..(0x4055), real_stop:0x4055
ld A, C ; 1:4 xloop 106
inc A ; 1:4 xloop 106 index++
ld (idx106),A ; 3:13 xloop 106 save index
xor 0x55 ; 2:7 xloop 106 lo(real_stop)
jp nz, xdo106 ; 3:10 xloop 106
xleave106: ; xloop 106
xexit106: ; xloop 106
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+1.G -5..(0) "
ld BC, size107 ; 3:10 print Length of string107
ld DE, string107 ; 3:10 print Address of string107
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, -5 ; 3:10 xdo(0,-5) 107
xdo107save: ; xdo(0,-5) 107
ld (idx107),BC ; 4:20 xdo(0,-5) 107
xdo107: ; xdo(0,-5) 107
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[9:54/34] xloop 107 variant +1.G: stop == 0, run 5x
idx107 EQU $+1 ; xloop 107 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 xloop 107 -5.. +1 ..(0), real_stop:0x0000
inc BC ; 1:6 xloop 107 index++
ld A, B ; 1:4 xloop 107
or C ; 1:4 xloop 107
jp nz, xdo107save ; 3:10 xloop 107
xleave107: ; xloop 107
xexit107: ; xloop 107
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+1.H -3..(2) "
ld BC, size108 ; 3:10 print Length of string108
ld DE, string108 ; 3:10 print Address of string108
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, -3 ; 3:10 xdo(2,-3) 108
xdo108save: ; xdo(2,-3) 108
ld (idx108),BC ; 4:20 xdo(2,-3) 108
xdo108: ; xdo(2,-3) 108
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[10:57/37] xloop 108 variant +1.H: step one with lo(real_stop) exclusivity, run 5x
idx108 EQU $+1 ; xloop 108 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 xloop 108 -3.. +1 ..(2), real_stop:0x0002
inc BC ; 1:6 xloop 108 index++
ld A, C ; 1:4 xloop 108
xor 0x02 ; 2:7 xloop 108 lo(real_stop)
jp nz, xdo108save ; 3:10 xloop 108
xleave108: ; xloop 108
xexit108: ; xloop 108
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+1.I 6318h..(26368)"
ld BC, size109 ; 3:10 print Length of string109
ld DE, string109 ; 3:10 print Address of string109
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
push DE ; 1:11 push2(0,0)
ld DE, 0 ; 3:10 push2(0,0)
push HL ; 1:11 push2(0,0)
ld HL, 0 ; 3:10 push2(0,0)
ld BC, 0x6318 ; 3:10 xdo(0x6700,0x6318) 109
xdo109save: ; xdo(0x6700,0x6318) 109
ld (idx109),BC ; 4:20 xdo(0x6700,0x6318) 109
xdo109: ; xdo(0x6700,0x6318) 109
ex DE, HL ; 1:4 drop
pop DE ; 1:10 drop ( a -- )
inc HL ; 1:6 1+
push DE ; 1:11 index(109) xi
ex DE, HL ; 1:4 index(109) xi
ld HL, (idx109) ; 3:16 index(109) xi idx always points to a 16-bit index
;[10:57/37] xloop 109 variant +1.I: step one with hi(real_stop) exclusivity, run 1000x
idx109 EQU $+1 ; xloop 109 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 xloop 109 0x6318.. +1 ..(0x6700), real_stop:0x6700
inc BC ; 1:6 xloop 109 index++
ld A, B ; 1:4 xloop 109
xor 0x67 ; 2:7 xloop 109 hi(real_stop)
jp nz, xdo109save ; 3:10 xloop 109
xleave109: ; xloop 109
xexit109: ; xloop 109
call PRINT_U16 ; 3:17 .
call PRINT_U16 ; 3:17 .
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+1.def -700..(300) "
ld BC, size110 ; 3:10 print Length of string110
ld DE, string110 ; 3:10 print Address of string110
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
push DE ; 1:11 push2(0,0)
ld DE, 0 ; 3:10 push2(0,0)
push HL ; 1:11 push2(0,0)
ld HL, 0 ; 3:10 push2(0,0)
ld BC, -700 ; 3:10 xdo(300,-700) 110
xdo110save: ; xdo(300,-700) 110
ld (idx110),BC ; 4:20 xdo(300,-700) 110
xdo110: ; xdo(300,-700) 110
ex DE, HL ; 1:4 drop
pop DE ; 1:10 drop ( a -- )
inc HL ; 1:6 1+
push DE ; 1:11 index(110) xi
ex DE, HL ; 1:4 index(110) xi
ld HL, (idx110) ; 3:16 index(110) xi idx always points to a 16-bit index
;[16:57/58] xloop 110 variant +1.default: step one, run 1000x
idx110 EQU $+1 ; xloop 110 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 xloop 110 -700.. +1 ..(300), real_stop:0x012C
inc BC ; 1:6 xloop 110 index++
ld A, C ; 1:4 xloop 110
xor 0x2C ; 2:7 xloop 110 lo(real_stop) first (44>3)
jp nz, xdo110save ; 3:10 xloop 110 3x false positive
ld A, B ; 1:4 xloop 110
xor 0x01 ; 2:7 xloop 110 hi(real_stop)
jp nz, xdo110save ; 3:10 xloop 110 44x false positive if he was first
xleave110: ; xloop 110
xexit110: ; xloop 110
call PRINT_U16 ; 3:17 .
call PRINT_U16 ; 3:17 .
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
;--- -1 ---
push DE ; 1:11 print "-1.A 4..0 "
ld BC, size111 ; 3:10 print Length of string111
ld DE, string111 ; 3:10 print Address of string111
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 4 ; 3:10 xdo(0,4) 111
xdo111save: ; xdo(0,4) 111
ld (idx111),BC ; 4:20 xdo(0,4) 111
xdo111: ; xdo(0,4) 111
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[9:54/34] -1 +xloop 111 variant -1.A: step -1 and stop 0, run 5x
idx111 EQU $+1 ; -1 +xloop 111 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -1 +xloop 111 4.. -1 ..0, real_stop:0xFFFF
ld A, C ; 1:4 -1 +xloop 111
or B ; 1:4 -1 +xloop 111
dec BC ; 1:6 -1 +xloop 111 index--
jp nz, xdo111save ; 3:10 -1 +xloop 111
xleave111: ; -1 +xloop 111
xexit111: ; xloop 111
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "-1.B 5..1 "
ld BC, size112 ; 3:10 print Length of string112
ld DE, string112 ; 3:10 print Address of string112
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 5 ; 3:10 xdo(1,5) 112
xdo112save: ; xdo(1,5) 112
ld (idx112),BC ; 4:20 xdo(1,5) 112
xdo112: ; xdo(1,5) 112
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[9:54/34] -1 +xloop 112 variant -1.B: step -1 and stop 1, run 5x
idx112 EQU $+1 ; -1 +xloop 112 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -1 +xloop 112 5.. -1 ..1, real_stop:0x0000
dec BC ; 1:6 -1 +xloop 112 index--
ld A, C ; 1:4 -1 +xloop 112
or B ; 1:4 -1 +xloop 112
jp nz, xdo112save ; 3:10 -1 +xloop 112
xleave112: ; -1 +xloop 112
xexit112: ; xloop 112
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "-1.C 258..254 "
ld BC, size113 ; 3:10 print Length of string113
ld DE, string113 ; 3:10 print Address of string113
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 258 ; 3:10 xdo(254,258) 113
xdo113save: ; xdo(254,258) 113
ld (idx113),BC ; 4:20 xdo(254,258) 113
xdo113: ; xdo(254,258) 113
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[10:57/37] -1 +xloop 113 variant -1.C: step -1 with lo(real_stop) exclusivity, run 5x
idx113 EQU $+1 ; -1 +xloop 113 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -1 +xloop 113 258.. -1 ..254, real_stop:0x00FD
dec BC ; 1:6 -1 +xloop 113 index--
ld A, C ; 1:4 -1 +xloop 113
xor 0xFD ; 2:7 -1 +xloop 113 lo(real_stop)
jp nz, xdo113save ; 3:10 -1 +xloop 113
xleave113: ; -1 +xloop 113
xexit113: ; xloop 113
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "-1.D 1255..256 "
ld BC, size114 ; 3:10 print Length of string114
ld DE, string114 ; 3:10 print Address of string114
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
push DE ; 1:11 push2(0,0)
ld DE, 0 ; 3:10 push2(0,0)
push HL ; 1:11 push2(0,0)
ld HL, 0 ; 3:10 push2(0,0)
ld BC, 1255 ; 3:10 xdo(256,1255) 114
xdo114save: ; xdo(256,1255) 114
ld (idx114),BC ; 4:20 xdo(256,1255) 114
xdo114: ; xdo(256,1255) 114
ex DE, HL ; 1:4 drop
pop DE ; 1:10 drop ( a -- )
inc HL ; 1:6 1+
push DE ; 1:11 index(114) xi
ex DE, HL ; 1:4 index(114) xi
ld HL, (idx114) ; 3:16 index(114) xi idx always points to a 16-bit index
;[10:57/37] -1 +xloop 114 variant -1.D: step -1 with hi(real_stop) exclusivity, run 1000x
idx114 EQU $+1 ; -1 +xloop 114 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -1 +xloop 114 1255.. -1 ..256, real_stop:0x00FF
dec BC ; 1:6 -1 +xloop 114 index--
ld A, B ; 1:4 -1 +xloop 114
xor 0x00 ; 2:7 -1 +xloop 114 hi(real_stop)
jp nz, xdo114save ; 3:10 -1 +xloop 114
xleave114: ; -1 +xloop 114
xexit114: ; xloop 114
call PRINT_S16 ; 3:17 .
call PRINT_U16 ; 3:17 .
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "-1.E 998..-1 "
ld BC, size115 ; 3:10 print Length of string115
ld DE, string115 ; 3:10 print Address of string115
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
push DE ; 1:11 push2(0,0)
ld DE, 0 ; 3:10 push2(0,0)
push HL ; 1:11 push2(0,0)
ld HL, 0 ; 3:10 push2(0,0)
ld BC, 998 ; 3:10 xdo(-1,998) 115
xdo115save: ; xdo(-1,998) 115
ld (idx115),BC ; 4:20 xdo(-1,998) 115
xdo115: ; xdo(-1,998) 115
ex DE, HL ; 1:4 drop
pop DE ; 1:10 drop ( a -- )
inc HL ; 1:6 1+
push DE ; 1:11 index(115) xi
ex DE, HL ; 1:4 index(115) xi
ld HL, (idx115) ; 3:16 index(115) xi idx always points to a 16-bit index
;[10:58/38] -1 +xloop 115 variant -1.E: step -1 and stop -1, run 1000x
idx115 EQU $+1 ; -1 +xloop 115 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -1 +xloop 115 998.. -1 ..-1, real_stop:0xFFFE
ld A, C ; 1:4 -1 +xloop 115
and B ; 1:4 -1 +xloop 115 0xFF & 0xFF = 0xFF
dec BC ; 1:6 -1 +xloop 115 index--
inc A ; 1:4 -1 +xloop 115 0xFF + 1 = zero
jp nz, xdo115save ; 3:10 -1 +xloop 115
xleave115: ; -1 +xloop 115
xexit115: ; xloop 115
call PRINT_S16 ; 3:17 .
call PRINT_U16 ; 3:17 .
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "-1.F 1001..2 "
ld BC, size116 ; 3:10 print Length of string116
ld DE, string116 ; 3:10 print Address of string116
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
push DE ; 1:11 push2(0,0)
ld DE, 0 ; 3:10 push2(0,0)
push HL ; 1:11 push2(0,0)
ld HL, 0 ; 3:10 push2(0,0)
ld BC, 1001 ; 3:10 xdo(2,1001) 116
xdo116save: ; xdo(2,1001) 116
ld (idx116),BC ; 4:20 xdo(2,1001) 116
xdo116: ; xdo(2,1001) 116
ex DE, HL ; 1:4 drop
pop DE ; 1:10 drop ( a -- )
inc HL ; 1:6 1+
push DE ; 1:11 index(116) xi
ex DE, HL ; 1:4 index(116) xi
ld HL, (idx116) ; 3:16 index(116) xi idx always points to a 16-bit index
;[10:58/38] -1 +xloop 116 variant -1.F: step -1 and stop 2, run 1000x
idx116 EQU $+1 ; -1 +xloop 116 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -1 +xloop 116 1001.. -1 ..2, real_stop:0x0001
dec BC ; 1:6 -1 +xloop 116 index--
ld A, C ; 1:4 -1 +xloop 116
dec A ; 1:4 -1 +xloop 116
or B ; 1:4 -1 +xloop 116
jp nz, xdo116save ; 3:10 -1 +xloop 116
xleave116: ; -1 +xloop 116
xexit116: ; xloop 116
call PRINT_S16 ; 3:17 .
call PRINT_U16 ; 3:17 .
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "-1.G 1199..200 "
ld BC, size117 ; 3:10 print Length of string117
ld DE, string117 ; 3:10 print Address of string117
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
push DE ; 1:11 push2(0,0)
ld DE, 0 ; 3:10 push2(0,0)
push HL ; 1:11 push2(0,0)
ld HL, 0 ; 3:10 push2(0,0)
ld BC, 1199 ; 3:10 xdo(200,1199) 117
xdo117save: ; xdo(200,1199) 117
ld (idx117),BC ; 4:20 xdo(200,1199) 117
xdo117: ; xdo(200,1199) 117
ex DE, HL ; 1:4 drop
pop DE ; 1:10 drop ( a -- )
inc HL ; 1:6 1+
push DE ; 1:11 index(117) xi
ex DE, HL ; 1:4 index(117) xi
ld HL, (idx117) ; 3:16 index(117) xi idx always points to a 16-bit index
;[11:61/41] -1 +xloop 117 variant -1.G: step -1 and hi(real_stop) = 0, run 1000x
idx117 EQU $+1 ; -1 +xloop 117 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -1 +xloop 117 1199.. -1 ..200, real_stop:0x00C7
dec BC ; 1:6 -1 +xloop 117 index--
ld A, C ; 1:4 -1 +xloop 117
xor 0xC7 ; 2:7 -1 +xloop 117 lo(real_stop)
or B ; 1:4 -1 +xloop 117
jp nz, xdo117save ; 3:10 -1 +xloop 117
xleave117: ; -1 +xloop 117
xexit117: ; xloop 117
call PRINT_S16 ; 3:17 .
call PRINT_U16 ; 3:17 .
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "-1.defA 375..-624 "
ld BC, size118 ; 3:10 print Length of string118
ld DE, string118 ; 3:10 print Address of string118
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
push DE ; 1:11 push2(0,0)
ld DE, 0 ; 3:10 push2(0,0)
push HL ; 1:11 push2(0,0)
ld HL, 0 ; 3:10 push2(0,0)
ld BC, 375 ; 3:10 xdo(-624,375) 118
xdo118save: ; xdo(-624,375) 118
ld (idx118),BC ; 4:20 xdo(-624,375) 118
xdo118: ; xdo(-624,375) 118
ex DE, HL ; 1:4 drop
pop DE ; 1:10 drop ( a -- )
inc HL ; 1:6 1+
push DE ; 1:11 index(118) xi
ex DE, HL ; 1:4 index(118) xi
ld HL, (idx118) ; 3:16 index(118) xi idx always points to a 16-bit index
;[16:57/58] -1 +xloop 118 variant -1.defaultA: step -1, LO first, run 1000x
idx118 EQU $+1 ; -1 +xloop 118 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -1 +xloop 118 375.. -1 ..-624, real_stop:0xFD8F
dec BC ; 1:6 -1 +xloop 118 index--
ld A, C ; 1:4 -1 +xloop 118
xor 0x8F ; 2:7 -1 +xloop 118 lo(real_stop)
jp nz, xdo118save ; 3:10 -1 +xloop 118 3x false positive
ld A, B ; 1:4 -1 +xloop 118
xor 0xFD ; 2:7 -1 +xloop 118 hi(real_stop)
jp nz, xdo118save ; 3:10 -1 +xloop 118 112x false positive if he was first
xleave118: ; -1 +xloop 118
xexit118: ; xloop 118
call PRINT_S16 ; 3:17 .
call PRINT_U16 ; 3:17 .
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "-1.defB 486..-513 "
ld BC, size119 ; 3:10 print Length of string119
ld DE, string119 ; 3:10 print Address of string119
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
push DE ; 1:11 push2(0,0)
ld DE, 0 ; 3:10 push2(0,0)
push HL ; 1:11 push2(0,0)
ld HL, 0 ; 3:10 push2(0,0)
ld BC, 486 ; 3:10 xdo(-513,486) 119
xdo119save: ; xdo(-513,486) 119
ld (idx119),BC ; 4:20 xdo(-513,486) 119
xdo119: ; xdo(-513,486) 119
ex DE, HL ; 1:4 drop
pop DE ; 1:10 drop ( a -- )
inc HL ; 1:6 1+
push DE ; 1:11 index(119) xi
ex DE, HL ; 1:4 index(119) xi
ld HL, (idx119) ; 3:16 index(119) xi idx always points to a 16-bit index
;[16:57/58] -1 +xloop 119 variant -1.defaultB: step -1, HI first, run 1000x
idx119 EQU $+1 ; -1 +xloop 119 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -1 +xloop 119 486.. -1 ..-513, real_stop:0xFDFE
dec BC ; 1:6 -1 +xloop 119 index--
ld A, B ; 1:4 -1 +xloop 119
xor 0xFD ; 2:7 -1 +xloop 119 hi(real_stop)
jp nz, xdo119save ; 3:10 -1 +xloop 119 1x false positive
ld A, C ; 1:4 -1 +xloop 119
xor 0xFE ; 2:7 -1 +xloop 119 lo(real_stop)
jp nz, xdo119save ; 3:10 -1 +xloop 119 3x false positive if he was first
xleave119: ; -1 +xloop 119
xexit119: ; xloop 119
call PRINT_S16 ; 3:17 .
call PRINT_U16 ; 3:17 .
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
;--- 2 ---
push DE ; 1:11 print "+2.A -10..(0) "
ld BC, size120 ; 3:10 print Length of string120
ld DE, string120 ; 3:10 print Address of string120
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, -10 ; 3:10 xdo(0,-10) 120
xdo120save: ; xdo(0,-10) 120
ld (idx120),BC ; 4:20 xdo(0,-10) 120
xdo120: ; xdo(0,-10) 120
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[10:58/38] 2 +xloop 120 variant +2.A: step 2 and real_stop is zero, run 5x
idx120 EQU $+1 ; 2 +xloop 120 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 2 +xloop 120 -10.. +2 ..(0), real_stop:0x0000
inc C ; 1:4 2 +xloop 120 index++
inc BC ; 1:6 2 +xloop 120 index++
ld A, C ; 1:4 2 +xloop 120
or B ; 1:4 2 +xloop 120
jp nz, xdo120save ; 3:10 2 +xloop 120
xleave120: ; 2 +xloop 120
xexit120: ; 2 +xloop 120
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+2.B -9..(1) "
ld BC, size121 ; 3:10 print Length of string121
ld DE, string121 ; 3:10 print Address of string121
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, -9 ; 3:10 xdo(1,-9) 121
xdo121save: ; xdo(1,-9) 121
ld (idx121),BC ; 4:20 xdo(1,-9) 121
xdo121: ; xdo(1,-9) 121
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[10:58/38] 2 +xloop 121 variant +2.B: step 2 and real_stop is one, run 5x
idx121 EQU $+1 ; 2 +xloop 121 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 2 +xloop 121 -9.. +2 ..(1), real_stop:0x0001
inc BC ; 1:6 2 +xloop 121 index++
ld A, C ; 1:4 2 +xloop 121
inc C ; 1:4 2 +xloop 121 index++
or B ; 1:4 2 +xloop 121
jp nz, xdo121save ; 3:10 2 +xloop 121
xleave121: ; 2 +xloop 121
xexit121: ; 2 +xloop 121
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+2.C -5..(5) "
ld BC, size122 ; 3:10 print Length of string122
ld DE, string122 ; 3:10 print Address of string122
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, -5 ; 3:10 xdo(5,-5) 122
xdo122save: ; xdo(5,-5) 122
ld (idx122),BC ; 4:20 xdo(5,-5) 122
xdo122: ; xdo(5,-5) 122
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[11:61/41] 2 +xloop 122 variant +2.C: step 2 with lo(real_stop) exclusivity, run 5x
idx122 EQU $+1 ; 2 +xloop 122 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 2 +xloop 122 -5.. +2 ..(5), real_stop:0x0005
inc BC ; 1:6 2 +xloop 122 index++
inc C ; 1:4 2 +xloop 122 index++
ld A, C ; 1:4 2 +xloop 122
xor 0x05 ; 2:7 2 +xloop 122 lo(real_stop)
jp nz, xdo122save ; 3:10 2 +xloop 122
xleave122: ; 2 +xloop 122
xexit122: ; 2 +xloop 122
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+2.D 304..(2304) "
ld BC, size123 ; 3:10 print Length of string123
ld DE, string123 ; 3:10 print Address of string123
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
push DE ; 1:11 push2(0,0)
ld DE, 0 ; 3:10 push2(0,0)
push HL ; 1:11 push2(0,0)
ld HL, 0 ; 3:10 push2(0,0)
ld BC, 304 ; 3:10 xdo(2304,304) 123
xdo123save: ; xdo(2304,304) 123
ld (idx123),BC ; 4:20 xdo(2304,304) 123
xdo123: ; xdo(2304,304) 123
ex DE, HL ; 1:4 drop
pop DE ; 1:10 drop ( a -- )
inc HL ; 1:6 1+
push DE ; 1:11 index(123) xi
ex DE, HL ; 1:4 index(123) xi
ld HL, (idx123) ; 3:16 index(123) xi idx always points to a 16-bit index
;[11:61/41] 2 +xloop 123 variant +2.D: step 2 with hi(real_stop) exclusivity, run 1000x
idx123 EQU $+1 ; 2 +xloop 123 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 2 +xloop 123 304.. +2 ..(2304), real_stop:0x0900
inc C ; 1:4 2 +xloop 123 index++
inc BC ; 1:6 2 +xloop 123 index++
ld A, B ; 1:4 2 +xloop 123
xor 0x09 ; 2:7 2 +xloop 123 hi(real_stop)
jp nz, xdo123save ; 3:10 2 +xloop 123
xleave123: ; 2 +xloop 123
xexit123: ; 2 +xloop 123
call PRINT_S16 ; 3:17 .
call PRINT_U16 ; 3:17 .
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+2.defA 50..(2050) "
ld BC, size124 ; 3:10 print Length of string124
ld DE, string124 ; 3:10 print Address of string124
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
push DE ; 1:11 push2(0,0)
ld DE, 0 ; 3:10 push2(0,0)
push HL ; 1:11 push2(0,0)
ld HL, 0 ; 3:10 push2(0,0)
ld BC, 50 ; 3:10 xdo(2050,50) 124
xdo124save: ; xdo(2050,50) 124
ld (idx124),BC ; 4:20 xdo(2050,50) 124
xdo124: ; xdo(2050,50) 124
ex DE, HL ; 1:4 drop
pop DE ; 1:10 drop ( a -- )
inc HL ; 1:6 1+
push DE ; 1:11 index(124) xi
ex DE, HL ; 1:4 index(124) xi
ld HL, (idx124) ; 3:16 index(124) xi idx always points to a 16-bit index
;[17:61/62] 2 +xloop 124 variant +2.defaultA: positive step 2, run 1000x
idx124 EQU $+1 ; 2 +xloop 124 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 2 +xloop 124 50.. +2 ..(2050), real_stop:0x0802
inc C ; 1:4 2 +xloop 124 index++
inc BC ; 1:6 2 +xloop 124 index++
ld A, B ; 1:4 2 +xloop 124
xor 0x08 ; 2:7 2 +xloop 124 hi(real_stop) first (1<=7)
jp nz, xdo124save ; 3:10 2 +xloop 124 1x false positive
ld A, C ; 1:4 2 +xloop 124
xor 0x02 ; 2:7 2 +xloop 124 lo(real_stop)
jp nz, xdo124save ; 3:10 2 +xloop 124 7x false positive if he was first
xleave124: ; 2 +xloop 124
xexit124: ; 2 +xloop 124
call PRINT_S16 ; 3:17 .
call PRINT_U16 ; 3:17 .
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+2.defB -10..(1990) "
ld BC, size125 ; 3:10 print Length of string125
ld DE, string125 ; 3:10 print Address of string125
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
push DE ; 1:11 push2(0,0)
ld DE, 0 ; 3:10 push2(0,0)
push HL ; 1:11 push2(0,0)
ld HL, 0 ; 3:10 push2(0,0)
ld BC, -10 ; 3:10 xdo(1990,-10) 125
xdo125save: ; xdo(1990,-10) 125
ld (idx125),BC ; 4:20 xdo(1990,-10) 125
xdo125: ; xdo(1990,-10) 125
ex DE, HL ; 1:4 drop
pop DE ; 1:10 drop ( a -- )
inc HL ; 1:6 1+
push DE ; 1:11 index(125) xi
ex DE, HL ; 1:4 index(125) xi
ld HL, (idx125) ; 3:16 index(125) xi idx always points to a 16-bit index
;[17:61/62] 2 +xloop 125 variant +2.defaultB: positive step 2, run 1000x
idx125 EQU $+1 ; 2 +xloop 125 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 2 +xloop 125 -10.. +2 ..(1990), real_stop:0x07C6
inc C ; 1:4 2 +xloop 125 index++
inc BC ; 1:6 2 +xloop 125 index++
ld A, C ; 1:4 2 +xloop 125
xor 0xC6 ; 2:7 2 +xloop 125 lo(real_stop) first (99>7)
jp nz, xdo125save ; 3:10 2 +xloop 125 7x false positive
ld A, B ; 1:4 2 +xloop 125
xor 0x07 ; 2:7 2 +xloop 125 hi(real_stop)
jp nz, xdo125save ; 3:10 2 +xloop 125 99x false positive if he was first
xleave125: ; 2 +xloop 125
xexit125: ; 2 +xloop 125
call PRINT_S16 ; 3:17 .
call PRINT_U16 ; 3:17 .
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
;--- -2 ---
push DE ; 1:11 print "-2.A 8..0 "
ld BC, size126 ; 3:10 print Length of string126
ld DE, string126 ; 3:10 print Address of string126
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 8 ; 3:10 xdo(0,8) 126
xdo126save: ; xdo(0,8) 126
ld (idx126),BC ; 4:20 xdo(0,8) 126
xdo126: ; xdo(0,8) 126
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[10:58/38] -2 +xloop 126 variant -2.A: step -2 and real_stop is -2, run 5x
idx126 EQU $+1 ; -2 +xloop 126 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -2 +xloop 126 8.. -2 ..0, real_stop:0xFFFE
ld A, B ; 1:4 -2 +xloop 126
dec BC ; 1:6 -2 +xloop 126 index--
dec C ; 1:4 -2 +xloop 126 index--
sub B ; 1:4 -2 +xloop 126
jp nc, xdo126save ; 3:10 -2 +xloop 126
xleave126: ; -2 +xloop 126
xexit126: ; -2 +xloop 126
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "-2.B 9..1 "
ld BC, size127 ; 3:10 print Length of string127
ld DE, string127 ; 3:10 print Address of string127
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 9 ; 3:10 xdo(1,9) 127
xdo127save: ; xdo(1,9) 127
ld (idx127),BC ; 4:20 xdo(1,9) 127
xdo127: ; xdo(1,9) 127
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[10:58/38] -2 +xloop 127 variant -2.B: step -2 and real_stop is -1, run 5x
idx127 EQU $+1 ; -2 +xloop 127 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -2 +xloop 127 9.. -2 ..1, real_stop:0xFFFF
dec C ; 1:4 -2 +xloop 127 index--
ld A, C ; 1:4 -2 +xloop 127
or B ; 1:4 -2 +xloop 127
dec BC ; 1:6 -2 +xloop 127 index--
jp nz, xdo127save ; 3:10 -2 +xloop 127
xleave127: ; -2 +xloop 127
xexit127: ; -2 +xloop 127
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "-2.C 10..2 "
ld BC, size128 ; 3:10 print Length of string128
ld DE, string128 ; 3:10 print Address of string128
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 10 ; 3:10 xdo(2,10) 128
xdo128save: ; xdo(2,10) 128
ld (idx128),BC ; 4:20 xdo(2,10) 128
xdo128: ; xdo(2,10) 128
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[10:58/38] -2 +xloop 128 variant -2.C: step -2 and real_stop is zero, run 5x
idx128 EQU $+1 ; -2 +xloop 128 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -2 +xloop 128 10.. -2 ..2, real_stop:0x0000
dec BC ; 1:6 -2 +xloop 128 index--
dec C ; 1:4 -2 +xloop 128 index--
ld A, C ; 1:4 -2 +xloop 128
or B ; 1:4 -2 +xloop 128
jp nz, xdo128save ; 3:10 -2 +xloop 128
xleave128: ; -2 +xloop 128
xexit128: ; -2 +xloop 128
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "-2.D 264..256 "
ld BC, size129 ; 3:10 print Length of string129
ld DE, string129 ; 3:10 print Address of string129
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 264 ; 3:10 xdo(256,264) 129
xdo129save: ; xdo(256,264) 129
ld (idx129),BC ; 4:20 xdo(256,264) 129
xdo129: ; xdo(256,264) 129
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[11:61/41] -2 +xloop 129 variant -2.D: step -2 with hi(real_stop) exclusivity, run 5x
idx129 EQU $+1 ; -2 +xloop 129 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -2 +xloop 129 264.. -2 ..256, real_stop:0x00FE
dec BC ; 1:6 -2 +xloop 129 index--
dec C ; 1:4 -2 +xloop 129 index--
ld A, B ; 1:4 -2 +xloop 129
xor 0x00 ; 2:7 -2 +xloop 129 hi(real_stop)
jp nz, xdo129save ; 3:10 -2 +xloop 129
xleave129: ; -2 +xloop 129
xexit129: ; -2 +xloop 129
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "-2.E 308..300 "
ld BC, size130 ; 3:10 print Length of string130
ld DE, string130 ; 3:10 print Address of string130
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 308 ; 3:10 xdo(300,308) 130
xdo130save: ; xdo(300,308) 130
ld (idx130),BC ; 4:20 xdo(300,308) 130
xdo130: ; xdo(300,308) 130
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[11:61/41] -2 +xloop 130 variant -2.E: step -2 with lo(real_stop) exclusivity, run 5x
idx130 EQU $+1 ; -2 +xloop 130 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -2 +xloop 130 308.. -2 ..300, real_stop:0x012A
dec BC ; 1:6 -2 +xloop 130 index--
dec C ; 1:4 -2 +xloop 130 index--
ld A, C ; 1:4 -2 +xloop 130
xor 0x2A ; 2:7 -2 +xloop 130 lo(real_stop)
jp nz, xdo130save ; 3:10 -2 +xloop 130
xleave130: ; -2 +xloop 130
xexit130: ; -2 +xloop 130
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "-2.F 2001..3 "
ld BC, size131 ; 3:10 print Length of string131
ld DE, string131 ; 3:10 print Address of string131
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
push DE ; 1:11 push2(0,0)
ld DE, 0 ; 3:10 push2(0,0)
push HL ; 1:11 push2(0,0)
ld HL, 0 ; 3:10 push2(0,0)
ld BC, 2001 ; 3:10 xdo(3,2001) 131
xdo131save: ; xdo(3,2001) 131
ld (idx131),BC ; 4:20 xdo(3,2001) 131
xdo131: ; xdo(3,2001) 131
ex DE, HL ; 1:4 drop
pop DE ; 1:10 drop ( a -- )
inc HL ; 1:6 1+
push DE ; 1:11 index(131) xi
ex DE, HL ; 1:4 index(131) xi
ld HL, (idx131) ; 3:16 index(131) xi idx always points to a 16-bit index
;[11:62/42] -2 +xloop 131 variant -2.F: step -2 and real_stop is one, run 1000x
idx131 EQU $+1 ; -2 +xloop 131 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -2 +xloop 131 2001.. -2 ..3, real_stop:0x0001
dec C ; 1:4 -2 +xloop 131 index--
dec BC ; 1:6 -2 +xloop 131 index--
ld A, C ; 1:4 -2 +xloop 131
dec A ; 1:4 -2 +xloop 131
or B ; 1:4 -2 +xloop 131
jp nz, xdo131save ; 3:10 -2 +xloop 131
xleave131: ; -2 +xloop 131
xexit131: ; -2 +xloop 131
call PRINT_S16 ; 3:17 .
call PRINT_U16 ; 3:17 .
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "-2.G 2232..234 "
ld BC, size132 ; 3:10 print Length of string132
ld DE, string132 ; 3:10 print Address of string132
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
push DE ; 1:11 push2(0,0)
ld DE, 0 ; 3:10 push2(0,0)
push HL ; 1:11 push2(0,0)
ld HL, 0 ; 3:10 push2(0,0)
ld BC, 2232 ; 3:10 xdo(234,2232) 132
xdo132save: ; xdo(234,2232) 132
ld (idx132),BC ; 4:20 xdo(234,2232) 132
xdo132: ; xdo(234,2232) 132
ex DE, HL ; 1:4 drop
pop DE ; 1:10 drop ( a -- )
inc HL ; 1:6 1+
push DE ; 1:11 index(132) xi
ex DE, HL ; 1:4 index(132) xi
ld HL, (idx132) ; 3:16 index(132) xi idx always points to a 16-bit index
;[12:65/45] -2 +xloop 132 variant -2.G: step -2 and real_stop 2..255, run 1000x
idx132 EQU $+1 ; -2 +xloop 132 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -2 +xloop 132 2232.. -2 ..234, real_stop:0x00E8
dec BC ; 1:6 -2 +xloop 132 index--
dec C ; 1:4 -2 +xloop 132 index--
ld A, C ; 1:4 -2 +xloop 132
xor 0xE8 ; 2:7 -2 +xloop 132 lo(real_stop)
or B ; 1:4 -2 +xloop 132
jp nz, xdo132save ; 3:10 -2 +xloop 132
xleave132: ; -2 +xloop 132
xexit132: ; -2 +xloop 132
call PRINT_S16 ; 3:17 .
call PRINT_U16 ; 3:17 .
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "-2.defA 196..-1802"
ld BC, size133 ; 3:10 print Length of string133
ld DE, string133 ; 3:10 print Address of string133
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
push DE ; 1:11 push2(0,0)
ld DE, 0 ; 3:10 push2(0,0)
push HL ; 1:11 push2(0,0)
ld HL, 0 ; 3:10 push2(0,0)
ld BC, 196 ; 3:10 xdo(-1802,196) 133
xdo133save: ; xdo(-1802,196) 133
ld (idx133),BC ; 4:20 xdo(-1802,196) 133
xdo133: ; xdo(-1802,196) 133
ex DE, HL ; 1:4 drop
pop DE ; 1:10 drop ( a -- )
inc HL ; 1:6 1+
push DE ; 1:11 index(133) xi
ex DE, HL ; 1:4 index(133) xi
ld HL, (idx133) ; 3:16 index(133) xi idx always points to a 16-bit index
;[17:61/62] -2 +xloop 133 variant -2.defaultA: positive step -2, run 1000x
idx133 EQU $+1 ; -2 +xloop 133 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -2 +xloop 133 196.. -2 ..-1802, real_stop:0xF8F4
dec BC ; 1:6 -2 +xloop 133 index--
dec C ; 1:4 -2 +xloop 133 index--
ld A, B ; 1:4 -2 +xloop 133
xor 0xF8 ; 2:7 -2 +xloop 133 hi(real_stop) first (5<=7)
jp nz, xdo133save ; 3:10 -2 +xloop 133 5x false positive
ld A, C ; 1:4 -2 +xloop 133
xor 0xF4 ; 2:7 -2 +xloop 133 lo(real_stop)
jp nz, xdo133save ; 3:10 -2 +xloop 133 7x false positive if he was first
xleave133: ; -2 +xloop 133
xexit133: ; -2 +xloop 133
call PRINT_S16 ; 3:17 .
call PRINT_U16 ; 3:17 .
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "-2.defB 250..-1748"
ld BC, size134 ; 3:10 print Length of string134
ld DE, string134 ; 3:10 print Address of string134
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
push DE ; 1:11 push2(0,0)
ld DE, 0 ; 3:10 push2(0,0)
push HL ; 1:11 push2(0,0)
ld HL, 0 ; 3:10 push2(0,0)
ld BC, 250 ; 3:10 xdo(-1748,250) 134
xdo134save: ; xdo(-1748,250) 134
ld (idx134),BC ; 4:20 xdo(-1748,250) 134
xdo134: ; xdo(-1748,250) 134
ex DE, HL ; 1:4 drop
pop DE ; 1:10 drop ( a -- )
inc HL ; 1:6 1+
push DE ; 1:11 index(134) xi
ex DE, HL ; 1:4 index(134) xi
ld HL, (idx134) ; 3:16 index(134) xi idx always points to a 16-bit index
;[17:61/62] -2 +xloop 134 variant -2.defaultB: positive step -2, run 1000x
idx134 EQU $+1 ; -2 +xloop 134 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -2 +xloop 134 250.. -2 ..-1748, real_stop:0xF92A
dec BC ; 1:6 -2 +xloop 134 index--
dec C ; 1:4 -2 +xloop 134 index--
ld A, C ; 1:4 -2 +xloop 134
xor 0x2A ; 2:7 -2 +xloop 134 lo(real_stop) first (106>7)
jp nz, xdo134save ; 3:10 -2 +xloop 134 7x false positive
ld A, B ; 1:4 -2 +xloop 134
xor 0xF9 ; 2:7 -2 +xloop 134 hi(real_stop)
jp nz, xdo134save ; 3:10 -2 +xloop 134 106x false positive if he was first
xleave134: ; -2 +xloop 134
xexit134: ; -2 +xloop 134
call PRINT_S16 ; 3:17 .
call PRINT_U16 ; 3:17 .
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
;--- -x ---
push DE ; 1:11 print "-X.A -3 13..0 "
ld BC, size135 ; 3:10 print Length of string135
ld DE, string135 ; 3:10 print Address of string135
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 13 ; 3:10 xdo(0,13) 135
xdo135save: ; xdo(0,13) 135
ld (idx135),BC ; 4:20 xdo(0,13) 135
xdo135: ; xdo(0,13) 135
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[11:66/46] -3 +xloop 135 variant -X.A: step -3 and stop 0, run 5x
idx135 EQU $+1 ; -3 +xloop 135 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -3 +xloop 135 13.. -3 ..0, real_stop:0xFFFE
ld A, B ; 1:4 -3 +xloop 135 hi old index
dec BC ; 1:6 -3 +xloop 135 index--
dec BC ; 1:6 -3 +xloop 135 index--
dec BC ; 1:6 -3 +xloop 135 index--
sub B ; 1:4 -3 +xloop 135 old-new = carry if index: positive -> negative
jp nc, xdo135save ; 3:10 -3 +xloop 135 carry if postivie index -> negative index
xleave135: ; -3 +xloop 135
xexit135: ; -3 +xloop 135
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "-X.B -10 43..0 "
ld BC, size136 ; 3:10 print Length of string136
ld DE, string136 ; 3:10 print Address of string136
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 43 ; 3:10 xdo(0,43) 136
xdo136save: ; xdo(0,43) 136
ld (idx136),BC ; 4:20 xdo(0,43) 136
xdo136: ; xdo(0,43) 136
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[14:70/50] -10 +xloop 136 variant -X.B: negative step and stop 0, run 5x
idx136 EQU $+1 ; -10 +xloop 136 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -10 +xloop 136 43.. -10 ..0, real_stop:0xFFF9
ld A, C ; 1:4 -10 +xloop 136
sub low 10 ; 2:7 -10 +xloop 136
ld C, A ; 1:4 -10 +xloop 136
ld A, B ; 1:4 -10 +xloop 136
sbc A, high 10 ; 2:7 -10 +xloop 136
ld B, A ; 1:4 -10 +xloop 136
jp nc, xdo136save ; 3:10 -10 +xloop 136 carry if postivie index -> negative index
xleave136: ; -10 +xloop 136
xexit136: ; -10 +xloop 136
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "-X.C -33 671..510 "
ld BC, size137 ; 3:10 print Length of string137
ld DE, string137 ; 3:10 print Address of string137
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 671 ; 3:10 xdo(510,671) 137
xdo137save: ; xdo(510,671) 137
ld (idx137),BC ; 4:20 xdo(510,671) 137
xdo137: ; xdo(510,671) 137
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[17:55/60] -33 +xloop 137 variant +X.C: negative step 3..255 and hi(real_stop) exclusivity, run 5x
idx137 EQU $+1 ; -33 +xloop 137 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -33 +xloop 137 671.. -33 ..510, real_stop:0x01FA
ld A, C ; 1:4 -33 +xloop 137
sub low 33 ; 2:7 -33 +xloop 137
ld C, A ; 1:4 -33 +xloop 137
jp nc, xdo137save ; 3:10 -33 +xloop 137
dec B ; 1:4 -33 +xloop 137
ld A, B ; 1:4 -33 +xloop 137
xor 0x01 ; 2:7 -33 +xloop 137 hi(real_stop)
jp nz, xdo137save ; 3:10 -33 +xloop 137
xleave137: ; -33 +xloop 137
xexit137: ; -33 +xloop 137
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "-X.D -300 50..-1160 "
ld BC, size138 ; 3:10 print Length of string138
ld DE, string138 ; 3:10 print Address of string138
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 50 ; 3:10 xdo(-1160,50) 138
xdo138save: ; xdo(-1160,50) 138
ld (idx138),BC ; 4:20 xdo(-1160,50) 138
xdo138: ; xdo(-1160,50) 138
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[16:77/57] -300 +xloop 138 variant +X.D: negative step 256+ and hi(real_stop) exclusivity, run 5x
idx138 EQU $+1 ; -300 +xloop 138 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -300 +xloop 138 50.. -300 ..-1160, real_stop:0xFA56
ld A, C ; 1:4 -300 +xloop 138
sub low 300 ; 2:7 -300 +xloop 138
ld C, A ; 1:4 -300 +xloop 138
ld A, B ; 1:4 -300 +xloop 138
sbc A, high 300 ; 2:7 -300 +xloop 138
ld B, A ; 1:4 -300 +xloop 138
xor 0xFA ; 2:7 -300 +xloop 138 hi(real_stop)
jp nz, xdo138save ; 3:10 -300 +xloop 138
xleave138: ; -300 +xloop 138
xexit138: ; -300 +xloop 138
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "-X.E -7 7027..30 "
ld BC, size139 ; 3:10 print Length of string139
ld DE, string139 ; 3:10 print Address of string139
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
push DE ; 1:11 push2(0,0)
ld DE, 0 ; 3:10 push2(0,0)
push HL ; 1:11 push2(0,0)
ld HL, 0 ; 3:10 push2(0,0)
ld BC, 7027 ; 3:10 xdo(30,7027) 139
xdo139save: ; xdo(30,7027) 139
ld (idx139),BC ; 4:20 xdo(30,7027) 139
xdo139: ; xdo(30,7027) 139
ex DE, HL ; 1:4 drop
pop DE ; 1:10 drop ( a -- )
inc HL ; 1:6 1+
push DE ; 1:11 index(139) xi
ex DE, HL ; 1:4 index(139) xi
ld HL, (idx139) ; 3:16 index(139) xi idx always points to a 16-bit index
;[20:70/71] -7 +xloop 139 variant -X.E: negative step and real_stop 0..255, run 1000x
idx139 EQU $+1 ; -7 +xloop 139 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -7 +xloop 139 7027.. -7 ..30, real_stop:0x001B
ld A, C ; 1:4 -7 +xloop 139
sub low 7 ; 2:7 -7 +xloop 139
ld C, A ; 1:4 -7 +xloop 139
ld A, B ; 1:4 -7 +xloop 139
sbc A, high 7 ; 2:7 -7 +xloop 139
ld B, A ; 1:4 -7 +xloop 139
jp nz, xdo139save ; 3:10 -7 +xloop 139
ld A, C ; 1:4 -7 +xloop 139 A = last_index
xor low 27 ; 2:7 -7 +xloop 139
jp nz, xdo139save ; 3:10 -7 +xloop 139
xleave139: ; -7 +xloop 139
xexit139: ; -7 +xloop 139
call PRINT_S16 ; 3:17 .
call PRINT_U16 ; 3:17 .
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "-X.def -7 6927..-70 "
ld BC, size140 ; 3:10 print Length of string140
ld DE, string140 ; 3:10 print Address of string140
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
push DE ; 1:11 push2(0,0)
ld DE, 0 ; 3:10 push2(0,0)
push HL ; 1:11 push2(0,0)
ld HL, 0 ; 3:10 push2(0,0)
ld BC, 6927 ; 3:10 xdo(-70,6927) 140
xdo140save: ; xdo(-70,6927) 140
ld (idx140),BC ; 4:20 xdo(-70,6927) 140
xdo140: ; xdo(-70,6927) 140
ex DE, HL ; 1:4 drop
pop DE ; 1:10 drop ( a -- )
inc HL ; 1:6 1+
push DE ; 1:11 index(140) xi
ex DE, HL ; 1:4 index(140) xi
ld HL, (idx140) ; 3:16 index(140) xi idx always points to a 16-bit index
;[23:81/82] -7 +xloop 140 variant -X.default: negative step, run 1000x
idx140 EQU $+1 ; -7 +xloop 140 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 -7 +xloop 140 6927.. -7 ..-70, real_stop:0xFFB7
ld A, C ; 1:4 -7 +xloop 140
sub low 7 ; 2:7 -7 +xloop 140
ld C, A ; 1:4 -7 +xloop 140
ld A, B ; 1:4 -7 +xloop 140
sbc A, high 7 ; 2:7 -7 +xloop 140
ld B, A ; 1:4 -7 +xloop 140
ld A, C ; 1:4 -7 +xloop 140
xor 0xB7 ; 2:7 -7 +xloop 140 lo(real_stop)
jp nz, xdo140save ; 3:10 -7 +xloop 140 3x
ld A, B ; 1:4 -7 +xloop 140
xor 0xFF ; 2:7 -7 +xloop 140 hi(real_stop)
jp nz, xdo140save ; 3:10 -7 +xloop 140 10x
xleave140: ; -7 +xloop 140
xexit140: ; -7 +xloop 140
call PRINT_S16 ; 3:17 .
call PRINT_U16 ; 3:17 .
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
;--- +x ---
push DE ; 1:11 print "+X.A 3 10..(25) "
ld BC, size141 ; 3:10 print Length of string141
ld DE, string141 ; 3:10 print Address of string141
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 10 ; 3:10 xdo(25,10) 141
xdo141save: ; xdo(25,10) 141
ld (idx141),BC ; 4:20 xdo(25,10) 141
xdo141: ; xdo(25,10) 141
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[13:48] 3 +xloop 141 variant +X.A: positive step and 0 <= index < stop < 256, run 5x
idx141 EQU $+1 ; 3 +xloop 141 idx always points to a 16-bit index
ld A, 0x00 ; 2:7 3 +xloop 141 10.. +3 ..(25), real_stop:0x0019
nop ; 1:4 3 +xloop 141 Contains a zero value because idx always points to a 16-bit index.
add A, low 3 ; 2:7 3 +xloop 141 A = index+step
ld (idx141), A ; 3:13 3 +xloop 141 save new index
xor 0x19 ; 2:7 3 +xloop 141 lo(real_stop)
jp nz, xdo141 ; 3:10 3 +xloop 141
xleave141: ; 3 +xloop 141
xexit141: ; 3 +xloop 141
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+X.B 3 0xC601..(0xC610)"
ld BC, size142 ; 3:10 print Length of string142
ld DE, string142 ; 3:10 print Address of string142
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 0xC601 ; 3:10 xdo(0xC610,0xC601) 142
xdo142save: ; xdo(0xC610,0xC601) 142
ld (idx142),BC ; 4:20 xdo(0xC610,0xC601) 142
xdo142: ; xdo(0xC610,0xC601) 142
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[12:44] 3 +xloop 142 variant +X.B: positive step and 0xC600 <= index < stop < 0xC700, run 5x
idx142 EQU $+1 ; 3 +xloop 142 idx always points to a 16-bit index
ld A, 0x00 ; 2:7 3 +xloop 142 0xC601.. +3 ..(0xC610), real_stop:0xC610
add A, low 3 ; 2:7 3 +xloop 142 First byte contains a 0xC6 value because idx always points to a 16-bit index.
ld (idx142), A ; 3:13 3 +xloop 142 save new index
xor 0x10 ; 2:7 3 +xloop 142 lo(real_stop)
jp nz, xdo142 ; 3:10 3 +xloop 142
xleave142: ; 3 +xloop 142
xexit142: ; 3 +xloop 142
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+X.C 512 25..(2500) "
ld BC, size143 ; 3:10 print Length of string143
ld DE, string143 ; 3:10 print Address of string143
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 25 ; 3:10 xdo(2500,25) 143
xdo143save: ; xdo(2500,25) 143
ld (idx143),BC ; 4:20 xdo(2500,25) 143
xdo143: ; xdo(2500,25) 143
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[14:51] 512 +xloop 143 variant +X.C: positive step = n*256, run 5x
idx143 EQU $+1 ; 512 +xloop 143 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 512 +xloop 143 25.. +512 ..(2500), real_stop:0x0A19
ld A, B ; 1:4 512 +xloop 143
add A, 0x02 ; 2:7 512 +xloop 143 hi(step)
ld (idx143+1),A ; 3:13 512 +xloop 143 save index
xor 0x0A ; 2:7 512 +xloop 143 hi(real_stop)
jp nz, xdo143 ; 3:10 512 +xloop 143
xleave143: ; 512 +xloop 143
xexit143: ; 512 +xloop 143
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+X.D 3 -15..(0) "
ld BC, size144 ; 3:10 print Length of string144
ld DE, string144 ; 3:10 print Address of string144
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, -15 ; 3:10 xdo(0,-15) 144
xdo144save: ; xdo(0,-15) 144
ld (idx144),BC ; 4:20 xdo(0,-15) 144
xdo144: ; xdo(0,-15) 144
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[14:55/49] 3 +xloop 144 variant +X.D: positive step 3..255 and stop 0, run 5x
idx144 EQU $+1 ; 3 +xloop 144 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 3 +xloop 144 -15.. +3 ..(0), real_stop:0x0000
ld A, C ; 1:4 3 +xloop 144
add A, low 3 ; 2:7 3 +xloop 144
ld C, A ; 1:4 3 +xloop 144
jp nc, xdo144save ; 3:10 3 +xloop 144
inc B ; 1:4 3 +xloop 144
jp nc, xdo144save ; 3:10 3 +xloop 144
xleave144: ; 3 +xloop 144
xexit144: ; 3 +xloop 144
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+X.E 7 -29..(5) "
ld BC, size145 ; 3:10 print Length of string145
ld DE, string145 ; 3:10 print Address of string145
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, -29 ; 3:10 xdo(5,-29) 145
xdo145save: ; xdo(5,-29) 145
ld (idx145),BC ; 4:20 xdo(5,-29) 145
xdo145: ; xdo(5,-29) 145
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[14:55/49] 7 +xloop 145 variant +X.E: positive step 3..255 and hi(real_stop) = exclusivity zero, run 5x
idx145 EQU $+1 ; 7 +xloop 145 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 7 +xloop 145 -29.. +7 ..(5), real_stop:0x0006
ld A, C ; 1:4 7 +xloop 145
add A, low 7 ; 2:7 7 +xloop 145
ld C, A ; 1:4 7 +xloop 145
jp nc, xdo145save ; 3:10 7 +xloop 145
inc B ; 1:4 7 +xloop 145
jp nz, xdo145save ; 3:10 7 +xloop 145
xleave145: ; 7 +xloop 145
xexit145: ; 7 +xloop 145
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+X.F 7 227..(260) "
ld BC, size146 ; 3:10 print Length of string146
ld DE, string146 ; 3:10 print Address of string146
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 227 ; 3:10 xdo(260,227) 146
xdo146save: ; xdo(260,227) 146
ld (idx146),BC ; 4:20 xdo(260,227) 146
xdo146: ; xdo(260,227) 146
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[17:55/60] 7 +xloop 146 variant +X.F: positive step 3..255 and hi(real_stop) exclusivity, run 5x
idx146 EQU $+1 ; 7 +xloop 146 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 7 +xloop 146 227.. +7 ..(260), real_stop:0x0106
ld A, C ; 1:4 7 +xloop 146
add A, low 7 ; 2:7 7 +xloop 146
ld C, A ; 1:4 7 +xloop 146
jp nc, xdo146save ; 3:10 7 +xloop 146
inc B ; 1:4 7 +xloop 146
ld A, B ; 1:4 7 +xloop 146
xor 0x01 ; 2:7 7 +xloop 146 hi(real_stop)
jp nz, xdo146save ; 3:10 7 +xloop 146
xleave146: ; 7 +xloop 146
xexit146: ; 7 +xloop 146
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+X.G 7 -23..(10) "
ld BC, size147 ; 3:10 print Length of string147
ld DE, string147 ; 3:10 print Address of string147
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, -23 ; 3:10 xdo(10,-23) 147
xdo147save: ; xdo(10,-23) 147
ld (idx147),BC ; 4:20 xdo(10,-23) 147
xdo147: ; xdo(10,-23) 147
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[19:67/68] 7 +xloop 147 variant +X.G: positive step 3..255 and real_stop 0..255, run 5x
idx147 EQU $+1 ; 7 +xloop 147 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 7 +xloop 147 -23.. +7 ..(10), real_stop:0x000C
ld A, C ; 1:4 7 +xloop 147
add A, low 7 ; 2:7 7 +xloop 147
ld C, A ; 1:4 7 +xloop 147
adc A, B ; 1:4 7 +xloop 147
sub C ; 1:4 7 +xloop 147
ld B, A ; 1:4 7 +xloop 147
jp nz, xdo147save ; 3:10 7 +xloop 147
ld A, C ; 1:4 7 +xloop 147
xor 0x0C ; 2:7 7 +xloop 147 lo(real_stop)
jp nz, xdo147save ; 3:10 7 +xloop 147
xleave147: ; 7 +xloop 147
xexit147: ; 7 +xloop 147
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+X.H 345 -1485..(230) "
ld BC, size148 ; 3:10 print Length of string148
ld DE, string148 ; 3:10 print Address of string148
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, -1485 ; 3:10 xdo(230,-1485) 148
xdo148save: ; xdo(230,-1485) 148
ld (idx148),BC ; 4:20 xdo(230,-1485) 148
xdo148: ; xdo(230,-1485) 148
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[14:70/50] 345 +xloop 148 variant +X.H: positive step 256+ and hi(real_stop) exclusivity zero, run 5x
idx148 EQU $+1 ; 345 +xloop 148 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 345 +xloop 148 -1485.. +345 ..(230), real_stop:0x00F0
ld A, C ; 1:4 345 +xloop 148
add A, low 345 ; 2:7 345 +xloop 148
ld C, A ; 1:4 345 +xloop 148
ld A, B ; 1:4 345 +xloop 148
adc A, high 345 ; 2:7 345 +xloop 148
ld B, A ; 1:4 345 +xloop 148
jp nz, xdo148save ; 3:10 345 +xloop 148
xleave148: ; 345 +xloop 148
xexit148: ; 345 +xloop 148
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+X.I 4 516..(4516) "
ld BC, size149 ; 3:10 print Length of string149
ld DE, string149 ; 3:10 print Address of string149
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
push DE ; 1:11 push2(0,0)
ld DE, 0 ; 3:10 push2(0,0)
push HL ; 1:11 push2(0,0)
ld HL, 0 ; 3:10 push2(0,0)
ld BC, 516 ; 3:10 xdo(4516,516) 149
xdo149save: ; xdo(4516,516) 149
ld (idx149),BC ; 4:20 xdo(4516,516) 149
xdo149: ; xdo(4516,516) 149
ex DE, HL ; 1:4 drop
pop DE ; 1:10 drop ( a -- )
inc HL ; 1:6 1+
push DE ; 1:11 index(149) xi
ex DE, HL ; 1:4 index(149) xi
ld HL, (idx149) ; 3:16 index(149) xi idx always points to a 16-bit index
;[21:74/75] 4 +xloop 149 variant +X.I: positive step 3..255, hi(real_stop) has fewer duplicate,run 1000x
idx149 EQU $+1 ; 4 +xloop 149 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 4 +xloop 149 516.. +4 ..(4516), real_stop:0x11A4
ld A, C ; 1:4 4 +xloop 149
add A, low 4 ; 2:7 4 +xloop 149
ld C, A ; 1:4 4 +xloop 149
adc A, B ; 1:4 4 +xloop 149
sub C ; 1:4 4 +xloop 149
ld B, A ; 1:4 4 +xloop 149
xor 0x11 ; 2:7 4 +xloop 149 hi(real_stop) first (21*41<=4*1000+21*15)
jp nz, xdo149save ; 3:10 4 +xloop 149 41x false positive
ld A, C ; 1:4 4 +xloop 149
xor 0xA4 ; 2:7 4 +xloop 149 lo(real_stop)
jp nz, xdo149save ; 3:10 4 +xloop 149 15x false positive if he was first
xleave149: ; 4 +xloop 149
xexit149: ; 4 +xloop 149
call PRINT_S16 ; 3:17 .
call PRINT_U16 ; 3:17 .
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+X.J 300 33..1234 "
ld BC, size150 ; 3:10 print Length of string150
ld DE, string150 ; 3:10 print Address of string150
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 33 ; 3:10 xdo(1234,33) 150
xdo150save: ; xdo(1234,33) 150
ld (idx150),BC ; 4:20 xdo(1234,33) 150
xdo150: ; xdo(1234,33) 150
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[16:77/57] 300 +xloop 150 variant +X.J: positive step 256+ and hi(real_stop) exclusivity, run 5x
idx150 EQU $+1 ; 300 +xloop 150 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 300 +xloop 150 33.. +300 ..(1234), real_stop:0x05FD
ld A, C ; 1:4 300 +xloop 150
add A, low 300 ; 2:7 300 +xloop 150
ld C, A ; 1:4 300 +xloop 150
ld A, B ; 1:4 300 +xloop 150
adc A, high 300 ; 2:7 300 +xloop 150
ld B, A ; 1:4 300 +xloop 150
xor 0x05 ; 2:7 300 +xloop 150 hi(real_stop)
jp nz, xdo150save ; 3:10 300 +xloop 150
xleave150: ; 300 +xloop 150
xexit150: ; 300 +xloop 150
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+X.K 3 1019..(1034) "
ld BC, size151 ; 3:10 print Length of string151
ld DE, string151 ; 3:10 print Address of string151
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
ld BC, 1019 ; 3:10 xdo(1034,1019) 151
xdo151save: ; xdo(1034,1019) 151
ld (idx151),BC ; 4:20 xdo(1034,1019) 151
xdo151: ; xdo(1034,1019) 151
ld A, '.' ; 2:7 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 putchar with ZX 48K ROM in, this will print char in A
;[16:78/58] 3 +xloop 151 variant +X.K : positive step 3..255 and lo(real_stop) exclusivity, run 5x
idx151 EQU $+1 ; 3 +xloop 151 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 3 +xloop 151 1019.. +3 ..(1034), real_stop:0x040A
ld A, C ; 1:4 3 +xloop 151
add A, low 3 ; 2:7 3 +xloop 151
ld C, A ; 1:4 3 +xloop 151
adc A, B ; 1:4 3 +xloop 151
sub C ; 1:4 3 +xloop 151
ld B, A ; 1:4 3 +xloop 151
ld A, C ; 1:4 3 +xloop 151
xor 0x0A ; 2:7 3 +xloop 151 lo(real_stop)
jp nz, xdo151save ; 3:10 3 +xloop 151
xleave151: ; 3 +xloop 151
xexit151: ; 3 +xloop 151
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
push DE ; 1:11 print "+X.L 4 100..(500) "
ld BC, size152 ; 3:10 print Length of string152
ld DE, string152 ; 3:10 print Address of string152
call 0x203C ; 3:17 print Print our string with ZX 48K ROM
pop DE ; 1:10 print
push DE ; 1:11 push2(0,0)
ld DE, 0 ; 3:10 push2(0,0)
push HL ; 1:11 push2(0,0)
ld HL, 0 ; 3:10 push2(0,0)
ld BC, 100 ; 3:10 xdo(500,100) 152
xdo152save: ; xdo(500,100) 152
ld (idx152),BC ; 4:20 xdo(500,100) 152
xdo152: ; xdo(500,100) 152
ex DE, HL ; 1:4 drop
pop DE ; 1:10 drop ( a -- )
inc HL ; 1:6 1+
push DE ; 1:11 index(152) xi
ex DE, HL ; 1:4 index(152) xi
ld HL, (idx152) ; 3:16 index(152) xi idx always points to a 16-bit index
;[22:78/79] 4 +xloop 152 variant +X.L: positive step 3..255, lo(real_stop) has fewer duplicate, run 100x
idx152 EQU $+1 ; 4 +xloop 152 idx always points to a 16-bit index
ld BC, 0x0000 ; 3:10 4 +xloop 152 100.. +4 ..(500), real_stop:0x01F4
ld A, C ; 1:4 4 +xloop 152
add A, low 4 ; 2:7 4 +xloop 152
ld C, A ; 1:4 4 +xloop 152
adc A, B ; 1:4 4 +xloop 152
sub C ; 1:4 4 +xloop 152
ld B, A ; 1:4 4 +xloop 152
ld A, C ; 1:4 4 +xloop 152
xor 0xF4 ; 2:7 4 +xloop 152 lo(real_stop) first (21*61>4*100+21*1)
jp nz, xdo152save ; 3:10 4 +xloop 152 1x false positive
ld A, B ; 1:4 4 +xloop 152
xor 0x01 ; 2:7 4 +xloop 152 hi(real_stop)
jp nz, xdo152save ; 3:10 4 +xloop 152 61x false positive if he was first
xleave152: ; 4 +xloop 152
xexit152: ; 4 +xloop 152
call PRINT_S16 ; 3:17 .
call PRINT_U16 ; 3:17 .
ld A, 0x0D ; 2:7 cr Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 cr with 48K ROM in, this will print char in A
;---xxx---
Stop: ; stop
ld SP, 0x0000 ; 3:10 stop restoring the original SP value when the "bye" word is used
ld HL, 0x2758 ; 3:10 stop
exx ; 1:4 stop
ret ; 1:10 stop
; ===== e n d =====
;==============================================================================
; Input: HL
; Output: Print space and signed decimal number in HL
; Pollutes: AF, BC, HL <- DE, DE <- (SP)
PRINT_S16: ; print_s16
ld A, H ; 1:4 print_s16
add A, A ; 1:4 print_s16
jr nc, PRINT_U16 ; 2:7/12 print_s16
xor A ; 1:4 print_s16 neg
sub L ; 1:4 print_s16 neg
ld L, A ; 1:4 print_s16 neg
sbc A, H ; 1:4 print_s16 neg
sub L ; 1:4 print_s16 neg
ld H, A ; 1:4 print_s16 neg
ld A, ' ' ; 2:7 print_s16 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 print_s16 putchar with ZX 48K ROM in, this will print char in A
ld A, '-' ; 2:7 print_s16 putchar Pollutes: AF, DE', BC'
db 0x01 ; 3:10 print_s16 ld BC, **
; fall to print_u16
;==============================================================================
; Input: HL
; Output: Print space and unsigned decimal number in HL
; Pollutes: AF, BC, HL <- DE, DE <- (SP)
PRINT_U16: ; print_u16
ld A, ' ' ; 2:7 print_u16 putchar Pollutes: AF, DE', BC'
rst 0x10 ; 1:11 print_u16 putchar with ZX 48K ROM in, this will print char in A
; fall to print_u16_only
;------------------------------------------------------------------------------
; Input: HL
; Output: Print unsigned decimal number in HL
; Pollutes: AF, BC, HL <- DE, DE <- (SP)
PRINT_U16_ONLY: ; print_u16_only
call BIN2DEC ; 3:17 print_u16_only
pop AF ; 1:10 print_u16_only load ret
ex DE, HL ; 1:4 print_u16_only
pop DE ; 1:10 print_u16_only
push AF ; 1:10 print_u16_only save ret
ret ; 1:10 print_u16_only
;------------------------------------------------------------------------------
; Input: HL = number
; Output: print number
; Pollutes: AF, HL, BC
BIN2DEC: ; bin2dec
xor A ; 1:4 bin2dec A=0 => 103, A='0' => 00103
ld BC, -10000 ; 3:10 bin2dec
call BIN2DEC_CHAR+2 ; 3:17 bin2dec
ld BC, -1000 ; 3:10 bin2dec
call BIN2DEC_CHAR ; 3:17 bin2dec
ld BC, -100 ; 3:10 bin2dec
call BIN2DEC_CHAR ; 3:17 bin2dec
ld C, -10 ; 2:7 bin2dec
call BIN2DEC_CHAR ; 3:17 bin2dec
ld A, L ; 1:4 bin2dec
add A,'0' ; 2:7 bin2dec
rst 0x10 ; 1:11 bin2dec putchar with ZX 48K ROM in, this will print char in A
ret ; 1:10 bin2dec
;------------------------------------------------------------------------------
; Input: A = '0'..'9' or 0..9, HL, BC
; Output: if ((HL/BC > 0) || (A >= '0')) print number HL/BC
; Pollutes: AF, HL
BIN2DEC_CHAR: ; bin2dec_char
and 0xF0 ; 2:7 bin2dec_char '0'..'9' => '0', unchanged 0
add HL, BC ; 1:11 bin2dec_char
inc A ; 1:4 bin2dec_char
jr c, $-2 ; 2:7/12 bin2dec_char
sbc HL, BC ; 2:15 bin2dec_char
dec A ; 1:4 bin2dec_char
ret z ; 1:5/11 bin2dec_char
or '0' ; 2:7 bin2dec_char 0 => '0', unchanged '0'..'9'
rst 0x10 ; 1:11 bin2dec_char putchar with ZX 48K ROM in, this will print char in A
ret ; 1:10 bin2dec_char
STRING_SECTION:
string152:
db "+X.L 4 100..(500) "
size152 EQU $ - string152
string151:
db "+X.K 3 1019..(1034) "
size151 EQU $ - string151
string150:
db "+X.J 300 33..1234 "
size150 EQU $ - string150
string149:
db "+X.I 4 516..(4516) "
size149 EQU $ - string149
string148:
db "+X.H 345 -1485..(230) "
size148 EQU $ - string148
string147:
db "+X.G 7 -23..(10) "
size147 EQU $ - string147
string146:
db "+X.F 7 227..(260) "
size146 EQU $ - string146
string145:
db "+X.E 7 -29..(5) "
size145 EQU $ - string145
string144:
db "+X.D 3 -15..(0) "
size144 EQU $ - string144
string143:
db "+X.C 512 25..(2500) "
size143 EQU $ - string143
string142:
db "+X.B 3 0xC601..(0xC610)"
size142 EQU $ - string142
string141:
db "+X.A 3 10..(25) "
size141 EQU $ - string141
string140:
db "-X.def -7 6927..-70 "
size140 EQU $ - string140
string139:
db "-X.E -7 7027..30 "
size139 EQU $ - string139
string138:
db "-X.D -300 50..-1160 "
size138 EQU $ - string138
string137:
db "-X.C -33 671..510 "
size137 EQU $ - string137
string136:
db "-X.B -10 43..0 "
size136 EQU $ - string136
string135:
db "-X.A -3 13..0 "
size135 EQU $ - string135
string134:
db "-2.defB 250..-1748"
size134 EQU $ - string134
string133:
db "-2.defA 196..-1802"
size133 EQU $ - string133
string132:
db "-2.G 2232..234 "
size132 EQU $ - string132
string131:
db "-2.F 2001..3 "
size131 EQU $ - string131
string130:
db "-2.E 308..300 "
size130 EQU $ - string130
string129:
db "-2.D 264..256 "
size129 EQU $ - string129
string128:
db "-2.C 10..2 "
size128 EQU $ - string128
string127:
db "-2.B 9..1 "
size127 EQU $ - string127
string126:
db "-2.A 8..0 "
size126 EQU $ - string126
string125:
db "+2.defB -10..(1990) "
size125 EQU $ - string125
string124:
db "+2.defA 50..(2050) "
size124 EQU $ - string124
string123:
db "+2.D 304..(2304) "
size123 EQU $ - string123
string122:
db "+2.C -5..(5) "
size122 EQU $ - string122
string121:
db "+2.B -9..(1) "
size121 EQU $ - string121
string120:
db "+2.A -10..(0) "
size120 EQU $ - string120
string119:
db "-1.defB 486..-513 "
size119 EQU $ - string119
string118:
db "-1.defA 375..-624 "
size118 EQU $ - string118
string117:
db "-1.G 1199..200 "
size117 EQU $ - string117
string116:
db "-1.F 1001..2 "
size116 EQU $ - string116
string115:
db "-1.E 998..-1 "
size115 EQU $ - string115
string114:
db "-1.D 1255..256 "
size114 EQU $ - string114
string113:
db "-1.C 258..254 "
size113 EQU $ - string113
string112:
db "-1.B 5..1 "
size112 EQU $ - string112
string111:
db "-1.A 4..0 "
size111 EQU $ - string111
string110:
db "+1.def -700..(300) "
size110 EQU $ - string110
string109:
db "+1.I 6318h..(26368)"
size109 EQU $ - string109
string108:
db "+1.H -3..(2) "
size108 EQU $ - string108
string107:
db "+1.G -5..(0) "
size107 EQU $ - string107
string106:
db "+1.F 0x4050..(0x4055) "
size106 EQU $ - string106
string105:
db "+1.E 0x65FB..(0x6600) "
size105 EQU $ - string105
string104:
db "+1.D 0x3C05..(0x3C0A) "
size104 EQU $ - string104
string103:
db "+1.C 0x3CFB..(0x3D00) "
size103 EQU $ - string103
string102:
db "+1.B 241..(246) "
size102 EQU $ - string102
string101:
db "+1.A 251..(256) "
size101 EQU $ - string101
| 56.572732 | 130 | 0.439277 |
2273022acf9c0680ead0e6489c86ef1f8b0e46e4 | 409 | asm | Assembly | src/firmware-tests/Platform/Motor/PollAfterMotorMock.asm | pete-restall/Cluck2Sesame-Prototype | 99119b6748847a7b6aeadc4bee42cbed726f7fdc | [
"MIT"
] | 1 | 2019-12-12T09:07:08.000Z | 2019-12-12T09:07:08.000Z | src/firmware-tests/Platform/Motor/PollAfterMotorMock.asm | pete-restall/Cluck2Sesame-Prototype | 99119b6748847a7b6aeadc4bee42cbed726f7fdc | [
"MIT"
] | null | null | null | src/firmware-tests/Platform/Motor/PollAfterMotorMock.asm | pete-restall/Cluck2Sesame-Prototype | 99119b6748847a7b6aeadc4bee42cbed726f7fdc | [
"MIT"
] | null | null | null | #include "Platform.inc"
#include "PollChain.inc"
#include "TestDoubles.inc"
radix decimal
udata
global calledPollAfterMotor
calledPollAfterMotor res 1
PollAfterMotorMock code
global initialisePollAfterMotorMock
global POLL_AFTER_MOTOR
initialisePollAfterMotorMock:
banksel calledPollAfterMotor
clrf calledPollAfterMotor
return
POLL_AFTER_MOTOR:
mockCalled calledPollAfterMotor
return
end
| 15.730769 | 36 | 0.838631 |
abece1b878d0d3a94bc7e0b57658145acafe0051 | 794 | asm | Assembly | Palmtree.Math.Core.Sint/vs_build/x86_Release/pmc_memory.asm | rougemeilland/Palmtree.Math.Core.Sint | 0895fd4988b146f01ec705e091ef3fd79a721b40 | [
"MIT"
] | null | null | null | Palmtree.Math.Core.Sint/vs_build/x86_Release/pmc_memory.asm | rougemeilland/Palmtree.Math.Core.Sint | 0895fd4988b146f01ec705e091ef3fd79a721b40 | [
"MIT"
] | null | null | null | Palmtree.Math.Core.Sint/vs_build/x86_Release/pmc_memory.asm | rougemeilland/Palmtree.Math.Core.Sint | 0895fd4988b146f01ec705e091ef3fd79a721b40 | [
"MIT"
] | null | null | null | ; Listing generated by Microsoft (R) Optimizing Compiler Version 19.16.27026.1
TITLE z:\sources\lunor\repos\rougemeilland\palmtree.math.core.sint\palmtree.math.core.sint\pmc_memory.c
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB OLDNAMES
EXTRN __imp__HeapDestroy@4:PROC
EXTRN __imp__HeapAlloc@12:PROC
EXTRN __imp__HeapFree@12:PROC
EXTRN __imp__HeapCreate@12:PROC
COMM _number_zero:BYTE:018H
COMM _number_minus_one:BYTE:018H
COMM _number_one:BYTE:018H
COMM _hLocalHeap:DWORD
_DATA ENDS
PUBLIC _DetatchNumber
PUBLIC _AttatchNumber
PUBLIC _PMC_GetConstantValue_I@8
PUBLIC _PMC_Dispose@4
PUBLIC _Initialize_Memory
PUBLIC _DeallocateNumber
PUBLIC _DuplicateNumber
PUBLIC _CheckNumber
PUBLIC _AllocateNumber
PUBLIC _Negate_Imp
PUBLIC _AllocateHeapArea
PUBLIC _DeallocateHeapArea
END
| 24.060606 | 104 | 0.856423 |
08f43ad010721b53007e3a2d6c2d4e8bdda94b04 | 732 | asm | Assembly | oeis/006/A006097.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/006/A006097.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/006/A006097.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A006097: Gaussian binomial coefficient [ n,4 ] for q=2.
; Submitted by Christian Krause
; 1,31,651,11811,200787,3309747,53743987,866251507,13910980083,222984027123,3571013994483,57162391576563,914807651274739,14638597687734259,234230965858250739,3747802679431278579,59965700687947706355,959458073589354016755,15351384078270441402355,245622584459786286215155,3929964865019186398572531,62879465949619557050036211,1006071680068460422671314931,16097148680091934491674619891,257554393273444244298166906867,4120870407510897250621338890227,65933927441260682754345641390067
mov $2,$0
add $2,1
mov $3,$0
lpb $2
mov $0,$3
sub $2,1
sub $0,$2
seq $0,28258 ; Expansion of 1/((1-2*x)*(1-4*x)(1-8*x)(1-16*x)).
add $1,$0
lpe
mov $0,$1
| 45.75 | 477 | 0.815574 |
c97b1c6170257e6ef4d5643cf5befa2f48908cd1 | 2,572 | asm | Assembly | savefile/maps/2F81_EasternEncampment.asm | stranck/fools2018-1 | 1c506b17343fcdfa708aafaf8e596153e2c63254 | [
"MIT"
] | 35 | 2018-04-01T06:55:28.000Z | 2021-05-09T19:09:42.000Z | savefile/maps/2F81_EasternEncampment.asm | stranck/fools2018-1 | 1c506b17343fcdfa708aafaf8e596153e2c63254 | [
"MIT"
] | 4 | 2018-04-01T15:32:55.000Z | 2019-02-23T20:46:49.000Z | savefile/maps/2F81_EasternEncampment.asm | stranck/fools2018-1 | 1c506b17343fcdfa708aafaf8e596153e2c63254 | [
"MIT"
] | 12 | 2018-04-01T15:48:09.000Z | 2021-01-27T10:22:33.000Z | SECTION "Map_2F81", ROM0[$B800]
Map_2F81_Header:
hdr_tileset 19
hdr_dimensions 4, 4
hdr_pointers_a Map_2F81_Blocks, Map_2F81_TextPointers
hdr_pointers_b Map_2F81_Script, Map_2F81_Objects
hdr_pointers_c Map_2F81_InitScript, Map_2F81_RAMScript
hdr_palette $01
hdr_music MUSIC_CELADON, AUDIO_1
hdr_connection NORTH, $0000, 0, 0
hdr_connection SOUTH, $0000, 0, 0
hdr_connection WEST, $0000, 0, 0
hdr_connection EAST, $0000, 0, 0
Map_2F81_Objects:
hdr_border $0f
hdr_warp_count 2
hdr_warp 5, 7, 14, 4, $2F38
hdr_warp 4, 7, 14, 4, $2F38
hdr_sign_count 3
hdr_signpost 5, 1, $05
hdr_signpost 1, 4, $04
hdr_signpost 1, 1, $03
hdr_object_count 2
hdr_object SPRITE_BUG_CATCHER, 0, 5, STAY, UP, $02
hdr_object SPRITE_BRUNETTE_GIRL, 3, 3, STAY, NONE, $01
Map_2F81_RAMScript:
rs_end
Map_2F81_Blocks:
db $0e,$05,$0e,$24
db $23,$0b,$23,$0b
db $0a,$0b,$0b,$0b
db $0b,$0b,$41,$0b
Map_2F81_TextPointers:
dw Map_2F81_TX1
dw Map_2F81_TX2
dw Map_2F81_TX3
dw Map_2F81_TX4
dw Map_2F81_TX5
Map_2F81_InitScript:
ret
Map_2F81_Script:
ret
Map_2F81_TX1:
TX_ASM
jp EnhancedTextOnly
text "We? We're just a humble"
next "game studio."
para "We're working on our launch"
next "title: Gears of Halo, Theft"
cont "Auto 5."
para "We were also designated by"
next "Valve to help in the"
cont "production and development"
cont "of Half-Life 3."
done
Map_2F81_TX2:
TX_ASM
jp EnhancedTextOnly
text "In our studio, we value"
next "simplicity and ease of use."
para "That's why we program all"
next "of our games in Assembly."
para "It is the simplest of"
next "programming languages,"
cont "no complicated constructs,"
cont "just processor instructions."
para "I think our launch title"
next "should be ready in about"
cont "5 or 6 years."
done
Map_2F81_TX3:
TX_ASM
jp EnhancedTextOnly
text "Someone was browsing xkcd"
next "instead of working..."
done
Map_2F81_TX4:
TX_ASM
jp EnhancedTextOnly
text "It's the game program!"
next "Messing with it could bug"
cont "out the game!"
done
Map_2F81_TX5:
TX_ASM
jp EnhancedTextOnly
text "Build failed: 3964 errors,"
next "1516 warnings."
para "That's what it says on the"
next "screen."
done
| 24.730769 | 67 | 0.631026 |
ed480810949379c2fd75b698ada1db0e79ed669a | 1,348 | asm | Assembly | examples/tests/expected/03_if.asm | aidnem/jenga-lang | c46ca79a85b9a5e19c621fa7cc68af5db8c10ddc | [
"MIT"
] | null | null | null | examples/tests/expected/03_if.asm | aidnem/jenga-lang | c46ca79a85b9a5e19c621fa7cc68af5db8c10ddc | [
"MIT"
] | null | null | null | examples/tests/expected/03_if.asm | aidnem/jenga-lang | c46ca79a85b9a5e19c621fa7cc68af5db8c10ddc | [
"MIT"
] | null | null | null | section .text
extern _printf
extern _exit
global _main
_main:
word_0:
;; -- push 0 --
push 0
word_1:
;; -- dup --
pop rax
push rax
push rax
word_2:
;; -- if --
pop rax
cmp rax, 0
je word_6
word_3:
;; -- push 0 --
push 0
word_4:
;; -- dump --
mov rdi, dump_msg
pop rsi
call _printf
word_5:
;; -- else --
jmp word_13
word_6:
;; -- if --
pop rax
cmp rax, 0
je word_10
word_7:
;; -- push 10 --
push 10
word_8:
;; -- dump --
mov rdi, dump_msg
pop rsi
call _printf
word_9:
;; -- else --
jmp word_12
word_10:
;; -- push 12 --
push 12
word_11:
;; -- dump --
mov rdi, dump_msg
pop rsi
call _printf
word_12:
;; -- end --
word_13:
;; -- end --
word_14:
;; -- push 1 --
push 1
word_15:
;; -- if --
pop rax
cmp rax, 0
je word_19
word_16:
;; -- push 87 --
push 87
word_17:
;; -- dump --
mov rdi, dump_msg
pop rsi
call _printf
word_18:
;; -- else --
jmp word_21
word_19:
;; -- push 78 --
push 78
word_20:
;; -- dump --
mov rdi, dump_msg
pop rsi
call _printf
word_21:
;; -- end --
;; -- EOF --
word_22:
xor rdi, rdi
call _exit
section .data
dump_msg: db `%d\n`, 0
section .bss
mem: resb 640000
| 11.521368 | 22 | 0.495549 |
0190370dcd5e90f262d060d623de13ce70e6d638 | 552 | asm | Assembly | oeis/017/A017376.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/017/A017376.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/017/A017376.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A017376: a(n) = (10*n + 8)^12.
; 68719476736,1156831381426176,232218265089212416,9065737908494995456,149587343098087735296,1449225352009601191936,9774779120406941925376,50714860157241037295616,215671155821681003462656,784716723734800033386496,2518170116818978404827136,7287592625109126008344576,19342813113834066795298816,47703367363695867545849856,110443607719611533356957696,242038829185737332250382336,505488617542763051300683776,1011672693003313726683222016,1949369609479181830042157056,3630632434549265533578448896
mul $0,10
add $0,8
pow $0,12
| 78.857143 | 488 | 0.903986 |
90ea5401dc0a93b79e9e60cc9faa322e0421c664 | 1,711 | asm | Assembly | 32. FIRST CAPITAL & LAST CAPITAL.asm | rng70/Assembly-Programming | 38c60807b944b49e52f189930c5bf1beadf80d74 | [
"MIT"
] | null | null | null | 32. FIRST CAPITAL & LAST CAPITAL.asm | rng70/Assembly-Programming | 38c60807b944b49e52f189930c5bf1beadf80d74 | [
"MIT"
] | null | null | null | 32. FIRST CAPITAL & LAST CAPITAL.asm | rng70/Assembly-Programming | 38c60807b944b49e52f189930c5bf1beadf80d74 | [
"MIT"
] | null | null | null | .MODEL SMALL
.STACK 100H
.DATA
PROMPT DB 'TYPE A LINE OF TEXT',0DH,0AH,'$'
NO_CAPMSG DB 0DH,0AH,'NO CAPITALS $'
CAP_MSG DB 0DH,0AH,'FIRST CAPITAL = '
FIRST DB '['
DB 0DH,0AH
DB 'LAST CAPITAL = '
LAST DB '@ $'
.CODE
MAIN PROC
;INITIALIZE DS
MOV AX,@DATA
MOV DS,AX
;DISPLAY OPENING MESSAGE
MOV AH,9
LEA DX,PROMPT
INT 21H
;READ CHARACTER FUNCTION
MOV AH,1
INT 21H
;WHILE CHARACTER IS NOT A CARRIAGE RETURN
WHILE_:
CMP AL,0DH ;IF CARRIAGE_RETURN
JE EXIT_WHILE ; YES, EXIT LOOP
;IF CHARACTER IS A CAPITAL LETTER
CMP AL,'A' ;IS CHARACTER CAPITAL?
JNGE END_IF ;IF NOT,END IF
CMP AL,'Z' ;IS CHARACTER CAPITAL AND BELOW 'Z'
JNLE END_IF ;IF NOT, END IF
;THEN
CMP AL,FIRST ; IS CHAR<FIRST
JNL CHECK_LAST ;IF NOT THEN CHECK FOR LAST CHARACTER
;THEN
MOV FIRST,AL ;FIRST = CHAR
CHECK_LAST:
CMP AL,LAST ;IS CHAR>LAST
JNG END_IF
;THEN
MOV LAST,AL ;LAST = AL
END_IF:
INT 21H
JMP WHILE_
EXIT_WHILE:
MOV AH,9
;IF NO CAPITALS WERE
CMP FIRST,'['
JNE CAPITAL
;THEN
LEA DX,NO_CAPMSG ;NO CAPITALS
JMP DISPLAY
CAPITAL:
LEA DX,CAP_MSG ;CAPITAL MESSAGE
DISPLAY:
INT 21H
MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN | 21.658228 | 64 | 0.468147 |
297cea6ff78fa3609685f8e3372b0e8b7fd6e6cd | 6,162 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1228.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1228.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1228.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 %r15
push %rax
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x2cf8, %r10
clflush (%r10)
nop
nop
dec %rdi
movups (%r10), %xmm1
vpextrq $1, %xmm1, %rax
nop
nop
nop
nop
sub $12314, %r15
lea addresses_normal_ht+0xafee, %rdx
nop
nop
nop
nop
cmp %r11, %r11
and $0xffffffffffffffc0, %rdx
movaps (%rdx), %xmm6
vpextrq $1, %xmm6, %rbp
nop
nop
and $54927, %rax
lea addresses_A_ht+0x10460, %rsi
lea addresses_WT_ht+0x6cf8, %rdi
nop
nop
nop
nop
nop
xor %r10, %r10
mov $36, %rcx
rep movsb
nop
nop
nop
nop
and $44794, %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r15
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r14
push %r15
push %rbp
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_D+0x18778, %rsi
lea addresses_D+0x1de8, %rdi
nop
nop
nop
nop
xor %r15, %r15
mov $54, %rcx
rep movsq
nop
nop
nop
cmp $6893, %r15
// Store
lea addresses_A+0x13f78, %r15
xor %rbp, %rbp
movb $0x51, (%r15)
nop
nop
cmp %rsi, %rsi
// REPMOV
lea addresses_UC+0x1cf8, %rsi
lea addresses_normal+0x14038, %rdi
nop
nop
and $65138, %r14
mov $31, %rcx
rep movsl
and $37770, %rcx
// Store
lea addresses_A+0x11cf8, %r15
nop
xor %rbp, %rbp
mov $0x5152535455565758, %r14
movq %r14, %xmm0
vmovups %ymm0, (%r15)
nop
inc %rbp
// Store
lea addresses_normal+0x3c38, %r10
nop
nop
nop
and $34300, %rcx
mov $0x5152535455565758, %r14
movq %r14, %xmm3
vmovups %ymm3, (%r10)
nop
nop
nop
nop
sub %r10, %r10
// Faulty Load
lea addresses_WC+0x14cf8, %rdi
clflush (%rdi)
nop
nop
nop
nop
cmp %r14, %r14
mov (%rdi), %r11d
lea oracles, %r15
and $0xff, %r11
shlq $12, %r11
mov (%r15,%r11,1), %r11
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r15
pop %r14
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WC', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 7}}
{'src': {'type': 'addresses_UC', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal', 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 6}}
[Faulty Load]
{'src': {'type': 'addresses_WC', 'AVXalign': False, 'size': 4, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 9}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 16, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}}
{'38': 21829}
38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38
*/
| 35.825581 | 2,999 | 0.658877 |
4b525a5f07bc19369fc185af6db0eff46a0bc5b8 | 8,185 | asm | Assembly | src/asm/macros.asm | Threetwosevensixseven/espreset | 27841519b6056559559c7eef10c8a53fca712cf5 | [
"Apache-2.0"
] | 1 | 2020-06-10T09:59:01.000Z | 2020-06-10T09:59:01.000Z | src/asm/macros.asm | Threetwosevensixseven/espreset | 27841519b6056559559c7eef10c8a53fca712cf5 | [
"Apache-2.0"
] | null | null | null | src/asm/macros.asm | Threetwosevensixseven/espreset | 27841519b6056559559c7eef10c8a53fca712cf5 | [
"Apache-2.0"
] | null | null | null | ; macros.asm
; Copyright 2020 Robin Verhagen-Guest
;
; 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.
include "version.asm", 1 ; Auto-generated by ..\build\cspect.bat or builddot.bat. Has
; date/time and git commit counts generated by an external tool.
Border macro(Colour)
if Colour=0 ; Convenience macro to help during debugging. The dot command
xor a ; doesn't change the border colour during regular operation.
else
ld a, Colour
endif
out (ULA_PORT), a
if Colour=0
xor a
else
ld a, Colour*8
endif
ld (23624), a
mend
Freeze macro(Colour1, Colour2) ; Convenience macro to help during debugging. Alternates
Loop: Border(Colour1) ; the border rapidly between two colours. This really helps
Border(Colour2) ; to show that the machine hasn't crashed. Also it give you
jr Loop ; 8*7=56 colour combinations to use, instead of 7.
mend
MFBreak macro() ; Intended for NextZXOS NMI debugging
push af ; MF must be enabled first, by pressing M1 button
ld a, r ; then choosing Return from the NMI menu.
di
in a, ($3f)
rst 8 ; It's possible the stack will end up unbalanced
mend ; if the MF break doesn't get triggered!
CSBreak macro() ; Intended for CSpect debugging
push bc ; enabled when the -brk switch is supplied
noflow ; Mitigate the worst effect of running on real hardware
db $DD, $01 ; On real Z80 or Z80N, this does NOP:LD BC, NNNN
nop ; so we set safe values for NN
nop ; and NN,
pop bc ; then we restore the value of bc we saved earlier
mend
CSExit macro() ; Intended for CSpect debugging
noflow ; enabled when the -exit switch is supplied
db $DD, $00 ; This executes as NOP:NOP on real hardware
mend
MirrorA macro() ; Macro for Z80N mirror a opcode
noflow
db $ED, $24
mend
CpHL macro(Register) ; Convenience wrapper to compare HL with BC or DE
or a ; Note that Zeus macros can accept register literals, so the
sbc hl, Register ; call would be CPHL(de) without enclosing quotes.
add hl, Register
mend
ErrorAlways macro(ErrAddr) ; Parameterised wrapper for unconditional custom error
ld hl, ErrAddr
jp ErrorProc
mend
ErrorIfCarry macro(ErrAddr) ; Parameterised wrapper for throwing custom esxDOS-style error
jp nc, Continue
ld hl, ErrAddr
jp ErrorProc
Continue:
mend
ErrorIfNoCarry macro(ErrAddr) ; Parameterised wrapper for throwing custom NextZXOS-style error
jp c, Continue
ld hl, ErrAddr
jp ErrorProc
Continue:
mend
ErrorIfZero macro(ErrAddr) ; Parameterised wrapper for throwing error if loop overruns
jp nz, Continue
ld hl, ErrAddr
jp ErrorProc
Continue:
mend
ErrorIfNotZero macro(ErrAddr) ; Parameterised wrapper for throwing error after comparison
jp z, Continue
ld hl, ErrAddr
jp ErrorProc
Continue:
mend
PrintMsg macro(Address) ; Parameterised wrapper for null-terminated buffer print routine
ld hl, Address
call PrintRst16
mend
PrintBufferHex macro(Addr, Len) ; Parameterised wrapper for fixed-length hex print routine
ld hl, Addr
ld de, Len
call PrintBufferHexProc
mend
SafePrintStart macro() ; Included at the start of every routine which calls rst 16
di ; Interrupts off while paging. Subsequent code will enable them.
ld (SavedStackPrint), sp ; Save current stack to be restored in SafePrintEnd()
ld sp, (Return.Stack1) ; Set stack back to what BASIC had at entry, so safe for rst 16
mend
SafePrintEnd macro() ; Included at the end of every routine which calls rst 16
di ; Interrupts off while paging. Subsequent code doesn't care.
SavedA equ $+1: ld a, SMC ; Restore A so it's completely free of side-effects
ld sp, (SavedStackPrint) ; Restore stack to what it was before SafePrintStart()
mend
Rst8 macro(Command) ; Parameterised wrapper for esxDOS API routine
rst $08
noflow
db Command
mend
NextRegRead macro(Register) ; Nextregs have to be read through the register I/O port pair,
ld bc, $243B ; as there is no dedicated ZX80N opcode like there is for
ld a, Register ; writes.
out (c), a
inc b
in a, (c)
mend
WaitFrames macro(Frames) ; Parameterised wrapper for safe halt routine
ld bc, Frames
call WaitFramesProc
mend
FillLDIR macro(SourceAddr, Size, Value) ; Parameterised wrapper for LDIR fill
ld a, Value
ld hl, SourceAddr
ld (hl), a
ld de, SourceAddr+1
ld bc, Size-1
ldir
mend
GetSizedArg macro(ArgTailPtr, DestAddr) ; Parameterised wrapper for arg parser
ld hl, (ArgTailPtr)
ld de, DestAddr
call GetSizedArgProc
mend
SetUARTBaud macro(BaudTable, BaudMsg) ; Parameterised wrapper for UART baud setting routine
ld hl, BaudTable ; Not currently used
ld de, BaudMsg
call SetUARTBaudProc
mend
| 48.431953 | 120 | 0.465974 |
6f8ee166c010181d644178cf8916094d8fd7f431 | 418 | asm | Assembly | Modules/Module4/FloatingPoint/doubleprecision2.asm | hackettccp/CSCI213 | c2b5c3e1b5f47fa329a59b0a7261ebeee8e64059 | [
"MIT"
] | null | null | null | Modules/Module4/FloatingPoint/doubleprecision2.asm | hackettccp/CSCI213 | c2b5c3e1b5f47fa329a59b0a7261ebeee8e64059 | [
"MIT"
] | null | null | null | Modules/Module4/FloatingPoint/doubleprecision2.asm | hackettccp/CSCI213 | c2b5c3e1b5f47fa329a59b0a7261ebeee8e64059 | [
"MIT"
] | null | null | null | #Demonstrates swapping double precision floating point numbers
.text
l.d $f0, double1 #Loads double1 into $f0
l.d $f2, double2 #Loads double2 into $f2
s.d $f2, double1 #Stores $f2 to double1
s.d $f0, double2 #Stores $f0 to double2
l.d $f12, double1 #Loads double1 to $f12.
li $v0, 3 #Sets the system call code for printing a double
syscall
.data
double1: .double 178.345
double2: .double 323.67 | 29.857143 | 62 | 0.703349 |
5924b0b210480965d0eca69f30875d3d119af804 | 687 | asm | Assembly | debugging.asm | ncot-tech/z80-life | 12643b5b227342f8817c40440fd76387a1a11528 | [
"MIT"
] | 9 | 2020-07-27T21:16:47.000Z | 2022-03-30T00:46:24.000Z | debugging.asm | ncot-tech/z80-life | 12643b5b227342f8817c40440fd76387a1a11528 | [
"MIT"
] | null | null | null | debugging.asm | ncot-tech/z80-life | 12643b5b227342f8817c40440fd76387a1a11528 | [
"MIT"
] | null | null | null | ; Puts neighbour count into grid for debugging
; set de to be cell to check
; set b to be neighbour count of that cell
setNewCellNeighbourCount:
ld hl,(otherGrid)
add hl,de
ld (hl),b
ret
printBoardNeighbourCount:
call cls
ld de,0
ld b,0
printLoopN:
ld hl,(currentGrid)
add hl,de
ld a,(hl)
add a,48
call printChr
inc de
inc b
ld hl,ScreenSize ; this is a constant
or a
sbc hl,de
add hl,de
jp z,printLoopDoneN
ld a,ScreenWidth
cp b
jp nz,printLoopN
call printNl
ld b,0
jp printLoopN
printLoopDoneN:
call printNl
ld a,'N'
call printChr
call printNl
ret | 16.756098 | 46 | 0.614265 |
c105cb4d360c7709e77ab844ec737e6871c02d2d | 233 | asm | Assembly | programs/oeis/017/A017575.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/017/A017575.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/017/A017575.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A017575: (12n+4)^7.
; 16384,268435456,13492928512,163840000000,1028071702528,4398046511104,14645194571776,40867559636992,100000000000000,221068140740608,450766669594624,860542568759296,1555363874947072
mul $0,12
add $0,4
pow $0,7
| 33.285714 | 181 | 0.83691 |
3f03b968680f6df5dc7b301df5860b9b7ada1d88 | 945 | asm | Assembly | HelloWorld.asm | AbnerStudy/OsMaking | 8284e7d5c41b91f1e61a5a2755985b545d6d7494 | [
"MIT"
] | null | null | null | HelloWorld.asm | AbnerStudy/OsMaking | 8284e7d5c41b91f1e61a5a2755985b545d6d7494 | [
"MIT"
] | null | null | null | HelloWorld.asm | AbnerStudy/OsMaking | 8284e7d5c41b91f1e61a5a2755985b545d6d7494 | [
"MIT"
] | null | null | null | org 0x7C00
bits 16
%define ENDL 0x0D, 0x0A
start:
jmp main
;
; Prints a string to the screen
; Params:
; - ds:si points to string
;
puts:
; save registers we will modify
push si
push ax
push bx
.loop:
lodsb ; loads next character in al
or al, al ; verify if next character is null?
jz .done
mov ah, 0x0E ; call bios interrupt
mov bh, 0 ; set page number to 0
int 0x10
jmp .loop
.done:
pop bx
pop ax
pop si
ret
main:
; setup data segments
mov ax, 0 ; can't set ds/es directly
mov ds, ax
mov es, ax
; setup stack
mov ss, ax
mov sp, 0x7C00 ; stack grows downwards from where we are loaded in memory
; print hello world message
mov si, msg_hello
call puts
hlt
.halt
jmp .halt
msg_hello: db 'Hello world!', ENDL, 0
times 510-($-$$) db 0
dw 0AA55h
| 14.104478 | 82 | 0.562963 |
2d4215c8032f4cbcb9338c602853c4d73621b7c6 | 693 | asm | Assembly | programs/oeis/033/A033547.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/033/A033547.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/033/A033547.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A033547: Otto Haxel's guess for magic numbers of nuclear shells.
; 0,2,6,14,28,50,82,126,184,258,350,462,596,754,938,1150,1392,1666,1974,2318,2700,3122,3586,4094,4648,5250,5902,6606,7364,8178,9050,9982,10976,12034,13158,14350,15612,16946,18354,19838,21400,23042,24766,26574,28468,30450,32522,34686,36944,39298,41750,44302,46956,49714,52578,55550,58632,61826,65134,68558,72100,75762,79546,83454,87488,91650,95942,100366,104924,109618,114450,119422,124536,129794,135198,140750,146452,152306,158314,164478,170800,177282,183926,190734,197708,204850,212162,219646,227304,235138,243150,251342,259716,268274,277018,285950,295072,304386,313894,323598
mov $1,$0
pow $0,2
add $0,5
mul $0,$1
div $0,3
| 77 | 577 | 0.79798 |
5c1f8dcc2eef2464787be1263e9a67b3ba1eb65b | 133 | asm | Assembly | libsrc/_DEVELOPMENT/font/fzx/fonts/ao/Kaitaia/_ff_ao_Kaitaia.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/font/fzx/fonts/ao/Kaitaia/_ff_ao_Kaitaia.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/font/fzx/fonts/ao/Kaitaia/_ff_ao_Kaitaia.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
SECTION rodata_font
SECTION rodata_font_fzx
PUBLIC _ff_ao_Kaitaia
_ff_ao_Kaitaia:
BINARY "font/fzx/fonts/ao/Kaitaia/Kaitaia.fzx"
| 13.3 | 46 | 0.834586 |
94abe9cee4427c0a3b3fbf27b7c68d1da4e61f9f | 452 | asm | Assembly | 8_kyu/Is_the_string_uppercase.asm | UlrichBerntien/Codewars-Katas | bbd025e67aa352d313564d3862db19fffa39f552 | [
"MIT"
] | null | null | null | 8_kyu/Is_the_string_uppercase.asm | UlrichBerntien/Codewars-Katas | bbd025e67aa352d313564d3862db19fffa39f552 | [
"MIT"
] | null | null | null | 8_kyu/Is_the_string_uppercase.asm | UlrichBerntien/Codewars-Katas | bbd025e67aa352d313564d3862db19fffa39f552 | [
"MIT"
] | null | null | null | SECTION .text
global is_uppercase
is_uppercase:
cld
mov rsi,rdi
mov cx,'az' ; range of lower case letters
jmp .next
.loop:
cmp al,cl
jb .next
cmp al,ch
ja .next
xor rax,rax ; found a lower case letter -> false
ret
.next:
lodsb ; next char from the string
test al,al ; 0 terminates the string
jnz .loop
mov rax,1 ; end of string reached -> true
ret
| 20.545455 | 57 | 0.564159 |
0148b18b99ea010f990835ad3d21e27283115d86 | 1,702 | asm | Assembly | savefile/maps/4026_BrokenBridge.asm | stranck/fools2018-1 | 1c506b17343fcdfa708aafaf8e596153e2c63254 | [
"MIT"
] | 35 | 2018-04-01T06:55:28.000Z | 2021-05-09T19:09:42.000Z | savefile/maps/4026_BrokenBridge.asm | stranck/fools2018-1 | 1c506b17343fcdfa708aafaf8e596153e2c63254 | [
"MIT"
] | 4 | 2018-04-01T15:32:55.000Z | 2019-02-23T20:46:49.000Z | savefile/maps/4026_BrokenBridge.asm | stranck/fools2018-1 | 1c506b17343fcdfa708aafaf8e596153e2c63254 | [
"MIT"
] | 12 | 2018-04-01T15:48:09.000Z | 2021-01-27T10:22:33.000Z | SECTION "Map_4026", ROM0[$B800]
Map_4026_Header:
hdr_tileset 0
hdr_dimensions 11, 6
hdr_pointers_a Map_4026_Blocks, Map_4026_TextPointers
hdr_pointers_b Map_4026_Script, Map_4026_Objects
hdr_pointers_c Map_4026_InitScript, Map_4026_RAMScript
hdr_palette $06
hdr_music MUSIC_ROUTES4, AUDIO_1
hdr_connection NORTH, $0000, 0, 0
hdr_connection SOUTH, $0000, 0, 0
hdr_connection WEST, $412E, 26, 7
hdr_connection EAST, $3F3D, 1, 15
Map_4026_Objects:
hdr_border $43
hdr_warp_count 0
hdr_sign_count 0
hdr_object_count 1
hdr_object SPRITE_MR_MASTERBALL, 14, 5, STAY, LEFT, $01
Map_4026_RAMScript:
rs_fill_byte $6b
rs_fill_3 $c71b
rs_fill_3 $c729
rs_fill_byte $54
rs_fill_3 $c73d
rs_fill_len $c74b, 6
rs_write_term $c75c
db $54,$54,$54,$78,$78,$78,$ff
rs_write_term $c76d
db $78,$78,$78,$6b,$6b,$6b,$ff
rs_fill_byte $6b
rs_fill_3 $c77e
rs_end
Map_4026_Blocks:
db $6b,$6b,$6b,$6b,$6b,$6b,$6b,$6b,$6b,$6b,$6b
db $43,$43,$43,$43,$43,$43,$43,$43,$43,$43,$43
db $54,$54,$54,$54,$43,$54,$43,$54,$54,$54,$54
db $54,$54,$78,$54,$54,$78,$43,$78,$54,$54,$54
db $78,$78,$43,$78,$78,$43,$43,$43,$78,$78,$78
db $6b,$6b,$6b,$6b,$6b,$6b,$6b,$6b,$6b,$6b,$6b
Map_4026_TextPointers:
dw Map_4026_TX1
Map_4026_InitScript:
ret
Map_4026_Script:
ret
Map_4026_TX1:
TX_ASM
jp EnhancedTextOnly
text "I'm sorry, it looks like"
next "the bridge here is out"
cont "of service."
para "If only there was a way"
next "to go across water..."
done
| 26.59375 | 68 | 0.613984 |
c5fe76c9a48da9b76a7a7829f173f0d54991fe58 | 1,095 | asm | Assembly | Assembly/textbox/express_missions.asm | WildGenie/Ninokuni | 019b4b7f069b311d0146d634f0af4c3096be7dd9 | [
"Apache-2.0"
] | 14 | 2015-01-15T19:08:06.000Z | 2021-09-27T17:27:22.000Z | Assembly/textbox/express_missions.asm | WildGenie/Ninokuni | 019b4b7f069b311d0146d634f0af4c3096be7dd9 | [
"Apache-2.0"
] | 5 | 2015-01-13T21:19:45.000Z | 2015-04-12T15:51:18.000Z | Assembly/textbox/express_missions.asm | WildGenie/Ninokuni | 019b4b7f069b311d0146d634f0af4c3096be7dd9 | [
"Apache-2.0"
] | 7 | 2015-02-02T20:14:00.000Z | 2017-05-14T07:58:12.000Z | ;;----------------------------------------------------------------------------;;
;; Align the position of the textbox in the express mission menu.
;; Copyright 2015 Benito Palacios (aka pleonex)
;;
;; 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.
;;----------------------------------------------------------------------------;;
.arm
;; Given stamp for the mission
.org 0x020AAF8C
MOV R1, #0xCC + 23 ; X pos
MOV R2, #0xAB ; Y pos
;; Number of mission in top screen
.org 0x020AAEB0
MOV R1, #0x30 ; X pos
MOV R2, #0xA - 2 ; Y pos
| 37.758621 | 80 | 0.580822 |
c447fd80a2068f340c797c4f71e8b61ef0a2aa65 | 232 | asm | Assembly | data/mapHeaders/BikeShop.asm | AmateurPanda92/pokemon-rby-dx | f7ba1cc50b22d93ed176571e074a52d73360da93 | [
"MIT"
] | 9 | 2020-07-12T19:44:21.000Z | 2022-03-03T23:32:40.000Z | data/mapHeaders/BikeShop.asm | JStar-debug2020/pokemon-rby-dx | c2fdd8145d96683addbd8d9075f946a68d1527a1 | [
"MIT"
] | 7 | 2020-07-16T10:48:52.000Z | 2021-01-28T18:32:02.000Z | data/mapHeaders/BikeShop.asm | JStar-debug2020/pokemon-rby-dx | c2fdd8145d96683addbd8d9075f946a68d1527a1 | [
"MIT"
] | 2 | 2021-03-28T18:33:43.000Z | 2021-05-06T13:12:09.000Z | BikeShop_h:
db CLUB ; tileset
db BIKE_SHOP_HEIGHT, BIKE_SHOP_WIDTH ; dimensions (y, x)
dw BikeShop_Blocks ; blocks
dw BikeShop_TextPointers ; texts
dw BikeShop_Script ; scripts
db 0 ; connections
dw BikeShop_Object ; objects
| 25.777778 | 57 | 0.780172 |
c57e1f9fbda886c37677b42dcb936cc3e8da3c44 | 4,625 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i7-7700_9_0x48_notsx.log_21829_309.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i7-7700_9_0x48_notsx.log_21829_309.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i7-7700_9_0x48_notsx.log_21829_309.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r15
push %r9
push %rbx
push %rdx
push %rsi
lea addresses_WC_ht+0x1b16c, %rsi
nop
nop
nop
dec %rdx
mov $0x6162636465666768, %r13
movq %r13, (%rsi)
nop
nop
nop
nop
cmp $1503, %r13
lea addresses_UC_ht+0xbc0, %rbx
add $4431, %r15
movups (%rbx), %xmm7
vpextrq $0, %xmm7, %r12
nop
nop
nop
sub $52500, %rdx
lea addresses_WT_ht+0xd56c, %rbx
nop
nop
nop
nop
lfence
movl $0x61626364, (%rbx)
cmp %rbx, %rbx
pop %rsi
pop %rdx
pop %rbx
pop %r9
pop %r15
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %rdi
push %rdx
push %rsi
// Faulty Load
lea addresses_normal+0xf16c, %r11
nop
nop
inc %rsi
movntdqa (%r11), %xmm4
vpextrq $1, %xmm4, %rdi
lea oracles, %rdx
and $0xff, %rdi
shlq $12, %rdi
mov (%rdx,%rdi,1), %rdi
pop %rsi
pop %rdx
pop %rdi
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': True, 'AVXalign': False, 'size': 32, 'type': 'addresses_normal', 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': True, 'AVXalign': False, 'size': 16, 'type': 'addresses_normal', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WC_ht', 'congruent': 11}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_UC_ht', 'congruent': 2}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_WT_ht', 'congruent': 10}, 'OP': 'STOR'}
{'08': 4, '47': 1, 'fe': 1, 'ff': 1, '00': 21822}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 52.556818 | 2,999 | 0.660108 |
d5a8ba9d963e2a0b4fe02d4bb8ff2151a48521d6 | 8,143 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xa0.log_21829_1355.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xa0.log_21829_1355.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xa0.log_21829_1355.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r14
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x5d58, %rbx
xor %r12, %r12
movw $0x6162, (%rbx)
nop
lfence
lea addresses_WC_ht+0x8e4, %rsi
lea addresses_normal_ht+0x210, %rdi
clflush (%rsi)
nop
nop
nop
nop
nop
dec %r14
mov $34, %rcx
rep movsb
nop
and %rcx, %rcx
lea addresses_WT_ht+0x1be38, %rsi
nop
nop
and $57220, %rbx
movb (%rsi), %r11b
nop
nop
nop
nop
nop
xor $46924, %r11
lea addresses_UC_ht+0x8c58, %r12
nop
nop
nop
nop
nop
and %rsi, %rsi
movups (%r12), %xmm6
vpextrq $0, %xmm6, %rdx
nop
nop
nop
nop
add %r14, %r14
lea addresses_WC_ht+0x9d1e, %rcx
sub %rdx, %rdx
mov $0x6162636465666768, %r14
movq %r14, %xmm2
movups %xmm2, (%rcx)
nop
nop
cmp %r12, %r12
lea addresses_WC_ht+0x19a50, %rsi
lea addresses_normal_ht+0x18a58, %rdi
nop
nop
and $63548, %rbx
mov $58, %rcx
rep movsb
nop
nop
nop
add %rsi, %rsi
lea addresses_normal_ht+0x15ea0, %r12
clflush (%r12)
nop
nop
add $12674, %rbx
movb $0x61, (%r12)
nop
nop
nop
nop
add $64814, %rdi
lea addresses_normal_ht+0x558, %rdx
nop
nop
cmp %rdi, %rdi
movl $0x61626364, (%rdx)
nop
nop
nop
nop
nop
add $45097, %rdx
lea addresses_WC_ht+0xa558, %rdi
nop
nop
nop
nop
sub $11540, %r14
movl $0x61626364, (%rdi)
nop
xor %r12, %r12
lea addresses_A_ht+0x1e058, %rsi
nop
nop
nop
sub %r12, %r12
vmovups (%rsi), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $0, %xmm5, %rbx
xor %r14, %r14
lea addresses_UC_ht+0x19518, %r11
nop
nop
nop
nop
nop
and %r14, %r14
mov (%r11), %rdx
nop
add $20955, %r14
lea addresses_A_ht+0xd710, %r12
nop
nop
nop
nop
dec %rbx
movb $0x61, (%r12)
nop
nop
xor $4750, %rbx
lea addresses_A_ht+0x9506, %rbx
clflush (%rbx)
dec %rsi
mov (%rbx), %r11
nop
inc %rbx
lea addresses_normal_ht+0x14018, %rsi
lea addresses_A_ht+0x15958, %rdi
nop
nop
add %r14, %r14
mov $102, %rcx
rep movsw
nop
nop
nop
cmp $55314, %rcx
lea addresses_UC_ht+0x18c78, %r14
nop
nop
nop
nop
xor %rcx, %rcx
movb (%r14), %dl
nop
nop
nop
nop
nop
cmp %rdi, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r14
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %r8
push %r9
push %rax
push %rcx
push %rdi
// Load
mov $0x7fc3f6000000076c, %rax
nop
nop
nop
add $61722, %r13
mov (%rax), %r14d
nop
nop
dec %r14
// Store
lea addresses_US+0x1f558, %rcx
nop
nop
and $18045, %r9
movl $0x51525354, (%rcx)
nop
nop
nop
nop
nop
add $18580, %rdi
// Faulty Load
lea addresses_WT+0x11558, %r9
nop
xor %rdi, %rdi
mov (%r9), %r13d
lea oracles, %rax
and $0xff, %r13
shlq $12, %r13
mov (%rax,%r13,1), %r13
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': True, 'same': False, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_US', 'AVXalign': False, 'size': 4}}
[Faulty Load]
{'src': {'NT': True, 'same': True, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 2}}
{'src': {'same': False, 'congruent': 1, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_normal_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16}}
{'src': {'same': False, 'congruent': 1, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': True, 'same': True, 'congruent': 11, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4}}
{'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': True, 'congruent': 6, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 1}}
{'src': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 5, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_A_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'54': 21829}
54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54
*/
| 32.313492 | 2,999 | 0.654427 |
75b524a0696e03561e1010c87bb30b6df4b80a1b | 551 | asm | Assembly | oeis/249/A249919.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/249/A249919.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/249/A249919.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A249919: Number of LCD (liquid-crystal display) segments needed to display n in binary.
; Submitted by Jamie Morken(s3.)
; 6,2,8,4,14,10,10,6,20,16,16,12,16,12,12,8,26,22,22,18,22,18,18,14,22,18,18,14,18,14,14,10,32,28,28,24,28,24,24,20,28,24,24,20,24,20,20,16,28,24,24,20,24,20,20,16,24,20,20,16,20,16,16,12,38,34,34,30,34,30,30,26,34,30,30,26,30,26,26,22,34,30,30,26,30,26,26,22,30,26,26,22,26,22,22,18,34,30,30,26
mov $1,267
sub $1,$0
div $0,2
lpb $0,2
add $2,$1
add $2,$1
mov $1,$0
div $0,2
add $2,3
lpe
mov $0,$2
sub $0,534
mul $0,2
| 30.611111 | 295 | 0.644283 |
db6cb4b34bc6ce6d759949575e603b2f937dd9c5 | 409 | asm | Assembly | oeis/091/A091429.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/091/A091429.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/091/A091429.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A091429: Numerator of a(n) = (integral_{x=0..1/3} (1-x^2)^n dx).
; Submitted by Jamie Morken(w3)
; 1,26,1128,68592,5368704,514149120,58253091840,7623288207360,1131761338122240,187970402507489280,34537682442564403200,6956566802152095744000,1524349874113331960217600
mul $0,2
mov $1,1
lpb $0
mov $2,$0
sub $0,1
add $3,$1
mul $3,$0
sub $0,1
mul $1,9
mul $1,$2
mul $3,8
lpe
add $1,$3
mov $0,$1
| 21.526316 | 167 | 0.691932 |
e65607a624b85a01fb19d5ae1a054483d53c215c | 1,058 | asm | Assembly | programs/oeis/101/A101862.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/101/A101862.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/101/A101862.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A101862: a(n) = n*(n+1)*(n+7)*(122+57*n+n^2)/120.
; 24,108,302,671,1296,2275,3724,5778,8592,12342,17226,23465,31304,41013,52888,67252,84456,104880,128934,157059,189728,227447,270756,320230,376480,440154,511938,592557,682776,783401,895280,1019304,1156408,1307572,1473822,1656231
mov $3,$0
add $3,1
mov $16,$0
lpb $3
mov $0,$16
sub $3,1
sub $0,$3
mov $13,$0
mov $14,0
mov $15,$0
add $15,1
lpb $15
mov $0,$13
mov $11,0
sub $15,1
sub $0,$15
mov $10,$0
mov $12,$0
add $12,1
lpb $12
mov $0,$10
mov $8,0
sub $12,1
sub $0,$12
mov $7,$0
mov $9,$0
add $9,1
lpb $9
mov $0,$7
sub $9,1
sub $0,$9
mov $2,$0
sub $2,1
mov $6,$0
add $0,1
mov $5,$0
lpb $0
add $0,$2
trn $0,1
mov $2,$6
mov $5,13
gcd $5,$0
lpe
mov $4,$5
add $4,11
add $8,$4
lpe
add $11,$8
lpe
add $14,$11
lpe
add $1,$14
lpe
mov $0,$1
| 18.241379 | 227 | 0.466919 |
26dfc4376e2897850a9853a62375681ad778c3c1 | 1,617 | asm | Assembly | programs/oeis/138/A138298.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/138/A138298.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/138/A138298.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A138298: First differences of A137976 after having added two leading ones.
; 0,2,10,21,110,233,1220,2584,13530,28657,150050,317811,1664080,3524578,18454930,39088169,204668310,433494437,2269806340,4807526976,25172538050,53316291173,279167724890,591286729879,3096017511840
mov $21,$0
mov $23,$0
lpb $23,1
clr $0,21
mov $0,$21
sub $23,1
sub $0,$23
mov $18,$0
mov $20,$0
lpb $20,1
mov $0,$18
sub $20,1
sub $0,$20
mov $14,$0
mov $16,2
lpb $16,1
mov $0,$14
sub $16,1
add $0,$16
sub $0,1
mov $10,$0
mov $12,2
lpb $12,1
mov $0,$10
sub $12,1
add $0,$12
sub $0,1
mov $6,$0
mov $8,2
lpb $8,1
clr $0,6
mov $0,$6
sub $8,1
add $0,$8
sub $0,1
mul $0,10
lpb $0,1
sub $0,4
mov $3,$2
add $2,$1
add $3,7
mov $1,$3
add $5,$3
lpe
mov $1,$5
mov $9,$8
lpb $9,1
mov $7,$1
sub $9,1
lpe
lpe
lpb $6,1
mov $6,0
sub $7,$1
lpe
mov $1,$7
mov $13,$12
lpb $13,1
mov $11,$1
sub $13,1
lpe
lpe
lpb $10,1
mov $10,0
sub $11,$1
lpe
mov $1,$11
mov $17,$16
lpb $17,1
mov $15,$1
sub $17,1
lpe
lpe
lpb $14,1
mov $14,0
sub $15,$1
lpe
mov $1,$15
div $1,7
add $19,$1
lpe
add $22,$19
lpe
mov $1,$22
| 18.375 | 195 | 0.41744 |
081fca13511414dc5c2066c9db9833701b05461e | 561 | asm | Assembly | oeis/017/A017440.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/017/A017440.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/017/A017440.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A017440: a(n) = (11*n + 4)^4.
; 256,50625,456976,1874161,5308416,12117361,24010000,43046721,71639296,112550881,168896016,244140625,342102016,466948881,623201296,815730721,1049760000,1330863361,1664966416,2058346161,2517630976,3049800625,3662186256,4362470401,5158686976,6059221281,7072810000,8208541201,9475854336,10884540241,12444741136,14166950625,16062013696,18141126721,20415837456,22898045041,25600000000,28534304241,31713911056,35152125121,38862602496,42859350625,47156728336,51769445841,56712564736,62001498001,67652010000
mul $0,11
add $0,4
pow $0,4
| 80.142857 | 499 | 0.857398 |
c1c3dc4add030263f96d24528ecec391c9dcf32c | 11,921 | asm | Assembly | src/app/zcom.asm | neri/osz | d1766e2f5daabd5914a80b838c0219f330a0d0af | [
"MIT"
] | 7 | 2017-01-11T17:13:10.000Z | 2022-02-17T06:40:50.000Z | src/app/zcom.asm | neri/osz | d1766e2f5daabd5914a80b838c0219f330a0d0af | [
"MIT"
] | null | null | null | src/app/zcom.asm | neri/osz | d1766e2f5daabd5914a80b838c0219f330a0d0af | [
"MIT"
] | 1 | 2019-06-24T09:49:43.000Z | 2019-06-24T09:49:43.000Z | ;;
;; MEG-OS Zero - CLI shell
;;
;; Copyright (c) MEG-OS project
;; All rights reserved.
;;
;; Redistribution and use in source and binary forms, with or without modification,
;; are permitted provided that the following conditions are met:
;;
;; * Redistributions of source code must retain the above copyright notice, this
;; list of conditions and the following disclaimer.
;;
;; * Redistributions in binary form must reproduce the above copyright notice, this
;; list of conditions and the following disclaimer in the documentation and/or
;; other materials provided with the distribution.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
;; ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
;; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
;; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
;; ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;
%include "osz.inc"
%define BS 8
%define HTAB 9
%define LF 10
%define CR 13
%define MCB_PID_SYSTEM 8
%define MAX_CMDBUFF 128
%define ARGBUFF 0x0080
%define MAX_ARGBUFF 126
%define MAX_CMDLINE 126
%define IO_BUFFER_SIZE 1024
[CPU 8086]
[BITS 16]
[ORG 0x0100]
xor bp, bp
jmp _init
alignb 2
__bdos resw 1
_call_bdos:
jmp word [cs:__bdos]
; ---------------------------------------------------------------------
_init:
;; save bdos
mov [__bdos], bp
;; adjust memory
mov sp, _END
mov bx, sp
add bx, 15
mov cl, 4
shr bx, cl
mov cx, bx
mov dx, cs
mov ah, OSZ_MCB_REALLOC
call _call_bdos
;; banner
; call _cmd_memory
call _cmd_ver
;; begin repl
_repl:
mov ax, ss
mov ds, ax
mov es, ax
call _prompt
mov dx, cmdline
mov cx, MAX_CMDLINE
mov bx, STDIN_FILENO
mov ah, OSZ_READ
call _call_bdos
or ax, ax
jz _repl
; REMOVE LEAD WHITESPACE
dec ax
mov cx, ax
mov si, dx
mov di, dx
.loop0:
jcxz .eof
lodsb
cmp al, HTAB
jz .skip0
cmp al, ' '
jnz .end0
.skip0:
dec cx
jmp .loop0
.eof:
jmp _repl
.end0:
dec si
rep movsb
xor al, al
stosb
; SELECT DRIVE COMMAND
mov si, dx
cmp byte [si+1], ':'
jnz .nodrv
mov al, [si+2]
or al, al
jz .chkdrv
cmp al, ' '
jz .chkdrv
cmp al, HTAB
jnz .nodrv
.chkdrv:
mov al, [si]
call _to_upper
cmp al, '@'
jb .nodrv
cmp al, 'Z'
ja .nodrv
and al, 0x1F
dec ax
mov dl, al
mov ah, OSZ_SELECT_DRIVE
call _call_bdos
jmp _repl
.nodrv:
; FILL CMDBUFF
mov bx, CMDBUFF
mov di, bx
xor ax, ax
stosb
push di
stosw
stosw
stosw
stosw
pop di
mov si, dx
xor dx, dx
mov cx, 8
.loop1:
mov al, [si]
call _to_upper
cmp al, '0'
jb .end1
cmp al, '9'
jna .skip1
cmp al, 'A'
jb .end1
cmp al, 'Z'
ja .end1
.skip1:
stosb
inc dx
inc si
loop .loop1
.end1:
mov [bx], dl
; FILL ARG
mov bx, ARGBUFF
; xor al, al
; mov cx, MAX_ARGBUFF
; mov di, bx
; rep stosb
lea di, [bx+1]
xor dx, dx
.loop2:
lodsb
or al, al
jz .end3
inc dx
stosb
jmp .loop2
.end3:
xor al, al
stosb
mov [bx], dl
; [DEBUG] DUMP CMD AND ARG
%if 0
mov si, CMDBUFF
call _dump_line
mov si, ARGBUFF
mov al, [si]
.loop21:
push ax
call _dump_line
pop ax
sub al, 0x10
jae .loop21
%endif
; Parse command
mov bx, CMDBUFF
mov si, CMD_TABLE
xor ah, ah
.loop3:
mov al, [si]
or al, al
jz .nocmd
mov cx, ax
inc cx
mov dx, si
add dx, cx
mov di, bx
rep cmpsb
jnz .not_equal
mov si, dx
call [si]
jmp _repl
.not_equal:
mov si, dx
inc si
inc si
jmp .loop3
;; then exec
.nocmd:
_exec:
mov si, cmdline
mov di, exename
.loop0:
lodsb
cmp al, ' '
jbe .skip0
stosb
jmp .loop0
.skip0:
; jb .end0
push si
mov si, COM_EXT
.loop1:
lodsb
stosb
or al, al
jnz .loop1
pop si
mov bx, ARGBUFF
lea di, [bx+1]
xor dx, dx
.loop2:
lodsb
cmp al, ' '
jb .skip2
stosb
inc dx
jmp .loop2
.skip2:
xor al, al
stosb
mov [bx], dl
.end0:
mov dx, exename
mov bx, ARGBUFF
mov ah, OSZ_EXEC
call _call_bdos
cmp ax, ENOENT
jz _bad_cmd
or ax, ax
jnz .error
call _crlf
jmp _repl
.error:
mov dx, ax
call _disp_error
jmp _repl
_bad_cmd:
mov dx, bad_cmd_msg
call _puts
jmp _repl
_to_upper:
cmp al, 'a'
jb .noa
cmp al, 'z'
ja .noa
sub al, 0x20
.noa:
ret
_is_a:
cmp al, 'A'
jb .noa
cmp al, 'z'
ja .noa
cmp al, 'a'
jae .isa
cmp al, 'Z'
ja .noa
.isa:
and al, 0x1F
ret
.noa:
xor al, al
ret
; ---------------------------------------------------------------------
_cmd_dir:
xor cx, cx
.loop:
mov ah, OSZ_READDIR
mov dx, IO_BUFFER
call _call_bdos
cmp ax, 0
jl .err
jz .end
push ax
mov di, strbuff
mov si, IO_BUFFER
mov cx, 8
rep movsb
mov al, ' '
stosb
mov cx, 3
rep movsb
mov al, ' '
stosb
mov al, ' '
mov cl, 10
mov bx, di
mov dx, [IO_BUFFER+0x1C]
call _itoa
add di, 5
mov ax, 10
stosw
mov dx, strbuff
call _puts
pop cx
jmp .loop
.end:
ret
.err:
mov dx, ax
jmp _disp_error
_cmd_reserved:
mov dx, cmd_reserved_msg
jmp _puts
_cmd_echo:
xor ch, ch
mov cl, [ARGBUFF]
dec cx
cmp cx, byte 0
jle .skip
mov dx, ARGBUFF+2
mov bx, STDOUT_FILENO
mov ah, OSZ_WRITE
call _call_bdos
.skip:
jmp _crlf
_cmd_type:
mov ah, OSZ_OPEN
mov dx, ARGBUFF+2
call _call_bdos
or ax, ax
js .error
mov bx, ax
.loop:
mov dx, IO_BUFFER
mov cx, IO_BUFFER_SIZE
mov ah, OSZ_READ
call _call_bdos
or ax, ax
jz .end
js .error
mov cx, ax
call _find_eof
push ax
push bx
mov cx, ax
mov bx, STDOUT_FILENO
mov ah, OSZ_WRITE
call _call_bdos
pop bx
pop si
or ax, ax
jz .end
js .error
add si, dx
mov dl, [EOF]
cmp [si], dl
jnz .loop
.end:
push ax
mov ah, OSZ_CLOSE
call _call_bdos
pop ax
cmp ax, 0
js .error
jmp _crlf
.error:
mov dx, ax
jmp _disp_error
_cmd_mem:
push es
push ds
mov dx, mcb_header_msg
call _puts
mov ax, OSZ_GET_MEMINFO
call _call_bdos
mov di, bx
mov cx, 20
.loop:
push cx
mov ds, di
xor si, si
mov dx, ds
call _disp_hex_16
mov al, ' '
int 0x29
mov al, [si]
int 0x29
mov al, ' '
int 0x29
mov dx, [si+1]
call _disp_hex_16
mov al, ' '
int 0x29
mov dx, [si+3]
push dx
call _disp_hex_16
mov al, ' '
int 0x29
pop dx
mov cl, 5
shr dx, cl
shr dx, 1
adc dx, byte 0
mov al, ' '
mov cx, 0x030A
call _disp_decx
cmp word [ds:1], 0x0000
jz .noname
cmp word [ds:1], MCB_PID_SYSTEM
jz .system
mov al, ' '
int 0x29
mov si, 8
mov cx, 8
.loop_name:
lodsb
or al, al
jz .end_name
int 0x29
loop .loop_name
jmp .end_name
.system:
push ds
push cs
pop ds
mov dx, mcb_owner_sys
call _puts
pop ds
jmp .end_name
.noname:
push ds
push cs
pop ds
mov dx, mcb_owner_free
call _puts
pop ds
.end_name:
mov al, 10
int 0x29
cmp byte [0x0000], 'M'
jnz .end
add di, [0x0003]
inc di
pop cx
dec cx
jz .endloop
jmp .loop
.endloop:
push cx
.end:
pop cx
pop ds
pop es
ret
_cmd_ver:
mov dx, ver_msg
call _puts
mov ax, OSZ_GET_VERSION
call _call_bdos
mov si, bx
mov bx, ax
mov dl, bl
xor dh, dh
call _disp_dec
mov al, '.'
int 0x29
mov dl, bh
xor dh, dh
call _disp_dec
mov al, '.'
int 0x29
mov dx, si
call _disp_dec
mov al, 10
int 0x29
ret
_cmd_memory:
mov dx, mem_1_msg
call _puts
mov ax, OSZ_GET_MEMINFO
call _call_bdos
push cx
mov dx, ax
mov cl, 6
shr dx, cl
call _disp_dec
mov dx, mem_2_msg
call _puts
pop dx
add dx, 0x03FF
and dx, 0xFC00
mov cl, 6
shr dx, cl
call _disp_dec
mov dx, mem_kb_msg
call _puts
; mov si, 0x0080
; mov dx, si
; mov ah, OSZ_TEMP_RTC
; call _call_bdos
; call _dump_line
ret
; ---------------------------------------------------------------------
_dump_line:
mov dx, si
call _disp_hex_16
push si
mov cx, 16
.loop:
push cx
mov al, ' '
int 0x29
lodsb
mov dl, al
call _disp_hex_8
pop cx
loop .loop
pop si
mov al, ' '
int 0x29
mov cx, 16
.loop_asc:
lodsb
cmp al, ' '
jb .noascii
cmp al, 0x7F
jb .skip
.noascii:
mov al, '.'
.skip:
int 0x29
loop .loop_asc
mov al, 13
int 0x29
mov al, 10
int 0x29
ret
_itoa:
mov ah, OSZ_ITOA
jmp _call_bdos
; in AL: Leading char (' ' or '0')
; CL: base CH: length (0=natural) DX: value
_disp_decx:
push bp
push dx
push bx
push si
push ds
push ss
pop ds
mov bp, sp
sub sp, BYTE 8
mov bx, sp
push cx
push ax
call _itoa
pop ax
pop cx
mov si, sp
or ch, ch
jz .find_space
mov dx, 5
sub dl, ch
add si, dx
jmp .skip
.find_space:
.loop:
cmp [si], al
jnz .skip
inc si
jmp .loop
.skip:
mov dx, si
call _puts
mov sp, bp
pop ds
pop si
pop bx
pop dx
pop bp
ret
_disp_hex_8:
mov al, '0'
mov cx, 0x0210
xor dh, dh
jmp _disp_decx
_disp_hex_16:
mov al, '0'
mov cx, 0x0410
jmp _disp_decx
_disp_dec:
push cx
mov al, '*'
mov cx, 10
call _disp_decx
pop cx
ret
; in ds:dx
; out ax
_strlen:
push es
push di
push cx
push ds
pop es
mov cx, 0xFFFF
xor al, al
mov di, dx
repnz scasb
mov ax, -2
sub ax, cx
pop cx
pop di
pop es
ret
; in ds:dx
_puts:
push cx
push bx
call _strlen
mov cx, ax
mov bx, STDOUT_FILENO
mov ah, OSZ_WRITE
call _call_bdos
pop bx
pop cx
ret
; DX:str CX:maxlength
_find_eof:
push bx
push dx
mov si, dx
xor dx, dx
mov bl, [cs:EOF]
.loop:
lodsb
cmp al, bl
jz .eof
inc dx
loop .loop
.eof:
mov ax, dx
pop dx
pop bx
ret
_disp_error:
push si
mov si, ERR_TABLE
.loop:
lodsb
or al, al
jz .notfound
cmp al, dl
jnz .skip
mov dx, si
call _puts
jmp .end
.skip:
lodsb
or al, al
jnz .skip
jmp .loop
.notfound:
push dx
mov dx, error_msg1
call _puts
pop dx
neg dx
call _disp_dec
.end:
pop si
_crlf:
mov dx, crlf_msg
jmp _puts
_cmd_cls:
mov dx, cls_msg
jmp _puts
_prompt:
mov dx, strbuff
mov ah, OSZ_GET_DRIVE
call _call_bdos
mov di, dx
add al, 'A'
stosb
mov ax, '>'
stosw
call _puts
ret
; ---------------------------------------------------------------------
alignb 16
CMD_TABLE:
db 2, "CD"
dw _cmd_reserved
db 3, "CLS"
dw _cmd_cls
db 4, "COPY"
dw _cmd_reserved
db 4, "DATE"
dw _cmd_reserved
db 3, "DEL"
dw _cmd_reserved
db 3, "DIR"
dw _cmd_dir
db 4, "ECHO"
dw _cmd_echo
db 4, "EXIT"
dw 0 ; EXIT
db 3, "MEM"
dw _cmd_mem
db 6, "MEMORY"
dw _cmd_memory
db 5, "MKDIR"
dw _cmd_reserved
db 5, "PAUSE"
dw _cmd_reserved
db 3, "REN"
dw _cmd_reserved
db 5, "RMDIR"
dw _cmd_reserved
db 3, "SET"
dw _cmd_reserved
db 4, "TIME"
dw _cmd_reserved
db 4, "TYPE"
dw _cmd_type
db 3, "VER"
dw _cmd_ver
db 0
ERR_TABLE:
db EPERM, "Operation not permitted", 0
db ENOENT, "No such file or directory", 0
db EIO, "I/O error", 0
db E2BIG, "Argument list too long", 0
db ENOEXEC, "Exec format error", 0
db EBADF, "Bad file number", 0
db ENOMEM, "Out of memory", 0
db EACCES, "Permission denied", 0
db EBUSY, "Device or resource busy", 0
db EEXIST, "File exists", 0
db ENFILE, "File table overflow", 0
db EMFILE, "Too many open files", 0
db 0
cls_msg db 0x1B, "[2J", 0
crlf_msg db 13, 10, 0
bad_cmd_msg db "Bad command or file name", 10, 0
cmd_reserved_msg db "Feature not available", 10, 0
mcb_header_msg db "MCB T PID SIZE KB OWNER", 10, 0
mcb_owner_free db " (Free)", 0
mcb_owner_sys db " System", 0
ver_msg db "MEG-OS Zero version ", 0
mem_1_msg db "MEMORY ", 0
mem_2_msg db "KB / ", 0
mem_kb_msg db "KB", 10, 0
error_msg1 db "ERROR ", 0
EOF db 0x1A
COM_EXT db ".com", 0
; ---------------------------------------------------------------------
alignb 16
_BSS:
strbuff resb 256
exename resb MAX_CMDBUFF
cmdline resb MAX_CMDBUFF
CMDBUFF resb 12
WORKING_FCB resb 40
IO_BUFFER resb IO_BUFFER_SIZE
alignb 16
_STACK resw 256
_END:
; ---------------------------------------------------------------------
| 13 | 83 | 0.642144 |
6ffa3b320f878921b27863afa9d263d7ef0983b4 | 3,422 | asm | Assembly | Examples/Prime.asm | Pumuckl007/8BitCompiler | dbcdb7e439dcc2a2d5b7b28f399997267ee2bba8 | [
"MIT"
] | 5 | 2019-03-28T07:27:37.000Z | 2020-08-30T09:07:55.000Z | Examples/Prime.asm | Pumuckl007/8BitCompiler | dbcdb7e439dcc2a2d5b7b28f399997267ee2bba8 | [
"MIT"
] | null | null | null | Examples/Prime.asm | Pumuckl007/8BitCompiler | dbcdb7e439dcc2a2d5b7b28f399997267ee2bba8 | [
"MIT"
] | 1 | 2022-01-23T19:23:19.000Z | 2022-01-23T19:23:19.000Z | ********************************************************************************
* *
* (c) 2018 Max Apodaca *
* This code is licensed under MIT license (see LICENSE for details) *
* *
********************************************************************************
********************************************************************************
* Prime Number Example *
* *
* This program computes the prime numbers in a given range. It does this *
* by checking whether each number in that range is divisible by a number *
* smaller than it but larger than one. *
* *
********************************************************************************
LDI 1 * Start of the range to check
STA 255 * Store this in 255 which will be the counter for the a loop
LDI 1 * Load the constant 1 which is used for incrementing
STA 254 * Address 254 will contain this value
LDI 113 * The end of the range to check
STA 253 * Address 254 will be used to determine when to break out of a
a: * The outer loop which iterates the numbers in the given range.
LDA 255 * Load address 255 which contains the loop counter.
SUB 253 * subtract the ending bound of the range, this will result in a
JEZ end * negative number unless the loop has reached the desired value
* in which case we jump.
LDA 255 * Load the counter for the loop.
ADD 254 * Increment the counter by one.
STA 255 * Update the stored value of the counter
LDI 2 * Load and store the starting location for the inner loop, this
STA 252 * is the first divisor we will use. In addition this value is used
* as a counter for the inner loop.
b:
SUB 255 * Subtract the outer loop's counter to determine if the inner loop
JGZ aend * should exit.
JEZ aend
LDA 252 * Load the inner loop counter.
STA 250 * Store it in memory location 250 which the modulo routine uses as
* the divisor.
LDA 255 * Load the outer loop counter which will be used as the dividend.
JMP modulo * Jump to the modulo sequence. This will leave a modulo %250 in
* memory location 251. "a" refers to the value in the a register
* and "%250" to the value in memory address 250.
bcont:
LDA 251 * Load the result of a modulo %250 into the a register.
JEZ a * If the result is zero we know the number is not prime, therefor
* we jump to the next number.
LDA 252 * Load the inner loop counter.
ADD 254 * Increment the counter by 1.
STA 252 * Save the new value.
JMP b
aend:
LDA 255 * Load the value that is now determined to be prime
OUT * Output the value
JMP a
modulo:
STA 251 * Store the a register value to preserve the last known good value
SUB 250 * subtract divisor
JGZ modulo * if dividend is less than zero, exit
JEZ modulo
JMP bcont
end:
HLT
| 48.197183 | 80 | 0.508182 |
b679fc367bb992abbacafc80f34dc08cb9ef88f9 | 7,843 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_519.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_519.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_519.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 %r8
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x17a5f, %r9
clflush (%r9)
nop
nop
nop
nop
nop
sub $40070, %rdi
mov $0x6162636465666768, %rax
movq %rax, %xmm5
movups %xmm5, (%r9)
dec %rsi
lea addresses_WC_ht+0x101ed, %rsi
lea addresses_UC_ht+0xf97f, %rdi
cmp %r14, %r14
mov $127, %rcx
rep movsl
nop
cmp $62119, %rcx
lea addresses_WT_ht+0xd94f, %rax
nop
cmp %r8, %r8
mov $0x6162636465666768, %rcx
movq %rcx, %xmm0
movups %xmm0, (%rax)
nop
nop
nop
nop
add $6458, %rsi
lea addresses_normal_ht+0x23ef, %r14
nop
cmp $9208, %rdi
movb $0x61, (%r14)
nop
cmp $28603, %rcx
lea addresses_WT_ht+0x171cf, %rsi
lea addresses_WT_ht+0x1a21f, %rdi
nop
nop
nop
nop
cmp %rbp, %rbp
mov $120, %rcx
rep movsl
nop
nop
nop
nop
nop
dec %rdi
lea addresses_normal_ht+0xeb2f, %rsi
lea addresses_WC_ht+0x17d0f, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
cmp %r14, %r14
mov $77, %rcx
rep movsb
sub $7785, %rax
lea addresses_A_ht+0x450f, %rax
nop
cmp %r14, %r14
vmovups (%rax), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $0, %xmm4, %r8
nop
nop
nop
sub %rbp, %rbp
lea addresses_D_ht+0xb04f, %rcx
nop
nop
nop
nop
cmp %r14, %r14
mov $0x6162636465666768, %rdi
movq %rdi, %xmm1
and $0xffffffffffffffc0, %rcx
vmovntdq %ymm1, (%rcx)
inc %r14
lea addresses_WC_ht+0x16a6f, %rsi
lea addresses_normal_ht+0x718f, %rdi
nop
nop
nop
dec %r9
mov $4, %rcx
rep movsl
nop
nop
inc %r8
lea addresses_D_ht+0x394f, %r14
nop
nop
sub $57834, %rax
movb (%r14), %r8b
nop
nop
sub %rax, %rax
lea addresses_A_ht+0x1950f, %rax
nop
nop
nop
nop
nop
add $20044, %rdi
movups (%rax), %xmm1
vpextrq $0, %xmm1, %rsi
xor %rsi, %rsi
lea addresses_WC_ht+0xe10f, %rcx
nop
nop
sub $2580, %r8
movups (%rcx), %xmm0
vpextrq $0, %xmm0, %rax
nop
nop
add %rax, %rax
lea addresses_WT_ht+0xd8ef, %rcx
nop
nop
nop
nop
xor %r9, %r9
movb $0x61, (%rcx)
nop
nop
and %r9, %r9
lea addresses_WC_ht+0xc1e9, %rsi
add %rcx, %rcx
mov (%rsi), %rdi
nop
nop
sub %rsi, %rsi
lea addresses_A_ht+0x6d0f, %rsi
lea addresses_UC_ht+0x11e4f, %rdi
clflush (%rsi)
nop
nop
nop
nop
cmp %r8, %r8
mov $14, %rcx
rep movsl
nop
nop
cmp %r8, %r8
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r8
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %rbp
push %rdi
push %rdx
// Faulty Load
lea addresses_UC+0x1ed0f, %rdx
nop
nop
nop
nop
sub $36157, %r13
mov (%rdx), %r11d
lea oracles, %rdx
and $0xff, %r11
shlq $12, %r11
mov (%rdx,%r11,1), %r11
pop %rdx
pop %rdi
pop %rbp
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 4, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 4}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 5}}
{'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}}
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32, 'NT': True, 'same': False, 'congruent': 5}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 11}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 9}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 5}}
{'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
| 35.013393 | 2,999 | 0.657529 |
e2ca67a5d7219399ca10a1dc7320a440e89ef572 | 623 | asm | Assembly | programs/oeis/064/A064226.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/064/A064226.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/064/A064226.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A064226: a(n) = (9*n^2 + 13*n + 6) / 2.
; 3,14,34,63,101,148,204,269,343,426,518,619,729,848,976,1113,1259,1414,1578,1751,1933,2124,2324,2533,2751,2978,3214,3459,3713,3976,4248,4529,4819,5118,5426,5743,6069,6404,6748,7101,7463,7834,8214,8603,9001,9408,9824,10249,10683,11126,11578,12039,12509,12988,13476,13973,14479,14994,15518,16051,16593,17144,17704,18273,18851,19438,20034,20639,21253,21876,22508,23149,23799,24458,25126,25803,26489,27184,27888,28601,29323,30054,30794,31543,32301,33068,33844,34629,35423,36226,37038,37859,38689,39528,40376,41233,42099,42974,43858,44751
mul $0,9
add $0,7
bin $0,2
add $0,7
div $0,9
| 69.222222 | 534 | 0.76244 |
a637e253f821d5b1ee0bdc6b0b959aac28372310 | 190 | asm | Assembly | libsrc/target/multi8/tape_load.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/target/multi8/tape_load.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/target/multi8/tape_load.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
MODULE tape_load
SECTION code_clib
PUBLIC tape_load
PUBLIC _tape_load
EXTERN asm_tape_load
tape_load:
_tape_load:
call asm_tape_load
ld hl,0
ret nc ;Success
dec hl
ret
| 10 | 22 | 0.747368 |
d51e299455fd595670b37556a4d8f4a48b000b8e | 385 | asm | Assembly | MySource/2-singel char input-output.asm | mdabdullahibnaharun/Assembly-Language | a56500622b961c7ecf9690ad9d2136c3e05ea1f7 | [
"MIT"
] | null | null | null | MySource/2-singel char input-output.asm | mdabdullahibnaharun/Assembly-Language | a56500622b961c7ecf9690ad9d2136c3e05ea1f7 | [
"MIT"
] | null | null | null | MySource/2-singel char input-output.asm | mdabdullahibnaharun/Assembly-Language | a56500622b961c7ecf9690ad9d2136c3e05ea1f7 | [
"MIT"
] | null | null | null |
; You may customize this and other start-up templates;
; The location of this template is c:\emu8086\inc\0_com_template.txt
org 100h
include 'emu8086.inc'
main proc
mov ah,01h
int 21h
mov bl,al
mov dl,bl
mov ah,02h
int 21h
mov ah,4ch
int 21h
main endp
end main
ret
| 11 | 69 | 0.52987 |
954bb36fe075069035a2ff8c3736bb3cc75a313b | 412 | asm | Assembly | programs/oeis/053/A053158.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/053/A053158.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/053/A053158.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A053158: Sum of n and its cototient function value (A051953).
; 1,3,4,6,6,10,8,12,12,16,12,20,14,22,22,24,18,30,20,32,30,34,24,40,30,40,36,44,30,52,32,48,46,52,46,60,38,58,54,64,42,72,44,68,66,70,48,80,56,80,70,80,54,90,70,88,78,88,60,104,62,94,90,96,82,112,68,104,94,116
mov $1,2
mov $2,$0
mov $3,$0
cal $0,10 ; Euler totient function phi(n): count numbers <= n and prime to n.
add $1,$2
sub $1,$0
add $1,$3
| 37.454545 | 209 | 0.65534 |
4bc45cfdb3e8485e088100005c3a5466015fb7cd | 20,163 | asm | Assembly | OS2.1/CPinti/core/older/i386/dpmi.asm | Cwc-Test/CpcdosOS2.1 | d52c170be7f11cc50de38ef536d4355743d21706 | [
"Apache-2.0"
] | null | null | null | OS2.1/CPinti/core/older/i386/dpmi.asm | Cwc-Test/CpcdosOS2.1 | d52c170be7f11cc50de38ef536d4355743d21706 | [
"Apache-2.0"
] | null | null | null | OS2.1/CPinti/core/older/i386/dpmi.asm | Cwc-Test/CpcdosOS2.1 | d52c170be7f11cc50de38ef536d4355743d21706 | [
"Apache-2.0"
] | null | null | null | ; Adaptation du STUB dpmi pour CPinti Core. Par Sebastien FAVIER
; 14-04-2015
; MaJ : 02-11-2015
; Auteur principal : Delorie (Copyright (C) 1995-2000 DJ Delorie)
; Un grand merci a lui pour son aide.
ideal
p386
assume cs:_TEXT, ds:DGROUP, es:nothing, ss:nothing, fs:_TEXT
group DGROUP _DATA, _BSS
SEGMENT _TEXT PUBLIC USE16 'CODE'
;*****************************************************************************
; structure definitions
;
; Entete coff
coff_magic = 0
aout_entry = 16
s_paddr = 8
s_vaddr = 12
s_size = 16
s_scnptr = 20
stack_sz = 100h ; bytes - must be a multiple of 16!
EXTRN lsetup:near, _main:near
;-----------------------------------------------------------------------------
; Interface de l'executable 32bits :)
;
; cs:eip Entete COFF
; ds Donnes du segment COFF du programme 32bits
; fs selecteur pour nos donnes
; ss:sp notre pile!
;-----------------------------------------------------------------------------
;-----------------------------------------------------------------------------
start:
; On installe le dpmi
call lsetup
; Sauvegarder les segments psp
mov [dos_block_seg],es
cld
; ====================================================================
; ********** A SUPPRIMER -> FreeDos temporairement utilisé **********
; ====================================================================
;-----------------------------------------------------------------------------
; Anciennement il cherche si la version de DOS est superieur a 3.0
; Sauf que l'independance du dos dit qu'il faudra simuler ces fonctions.
; Simuler la presence d'un DOS (Debut d'independance mouaha)
call _CPINTI_CORE_SIMUL_VER3
jmp dos3ok
; ///// N'est pas execute
mov ah, 030h
int 021h
cmp al, 3
jae short dos3ok
mov al, 109
mov dx, offset msg_bad_dos
jmp error
; N'est pas execute \\\\
dos3ok:
mov [dos_major],al
mov ah, 3Eh
mov bx, 19
int 21h
mov ah, 3Eh
mov bx, 18
int 21h
;-----------------------------------------------------------------------------
; Obtenir les informations DPMI (Compatible 386 et +)
; nb boucles
xor bp,bp
jmp short boucle
dpmi_non_present:
; Premiere boucle, on installe le dpmi
call _main
; 2eme, CWSDPMI
inc bp
boucle:
; Obtenir info dpmi
mov ax,1687h
int 2fh
; Est-il present?
or ax,ax
jnz short dpmi_non_present
; Verifier s'il est en 32bits
test bl,1
jz short dpmi_non_present
; Enmaganiser les points d'entrés du pointeur
mov [word ptr modesw], di
mov [word ptr modesw+2], es
mov [modesw_mem], si
mov cl,4
mov si, offset stubinfo_minkeep
or bp,bp
jz short @@dpmi
label stubinfo byte
stubinfo_magic \ ; char [16]
db "go32stub, v 2.02" ; version may change, [0..7] won't
stubinfo_size \ ; unsigned long
dw stubinfo_end,0 ; bytes in structure
stubinfo_minstack \ ; unsigned long
dd 80000h ; minimum amount of DPMI stack space (512K)
stubinfo_memory_handle \ ; unsigned long
dd 0 ; DPMI memory handle
stubinfo_initial_size \ ; unsigned long
dd 0 ; size of initial segment
stubinfo_minkeep \ ; unsigned short
dw 16384 ; amount of automatic real-mode buffer
stubinfo_ds_selector \ ; unsigned short
dw 0 ; our DS selector (used for transfer buffer)
stubinfo_ds_segment \ ; unsigned short
dw 0 ; our DS segment (used for simulated calls)
stubinfo_psp_selector \ ; unsigned short
dw 0 ; PSP selector
stubinfo_cs_selector \ ; unsigned short
dw 0 ; to be freed
stubinfo_env_size \ ; unsigned short
dw 0 ; number of bytes of environment
stubinfo_basename \ ; char [8]
db 8 dup (0) ; base name of executable to load (asciiz if < 8)
stubinfo_argv0 \ ; char [16]
db 16 dup (0) ; used ONLY by the application (asciiz if < 16)
stubinfo_dpmi_server \ ; char [16]
db 16 dup (0) ; Not used by CWSDSTUB
align 4
label stubinfo_end byte
;-----------------------------------------------------------------------------
; Embedded DPMI is active - allocate a separate transfer buffer
; Minimum TB size is end of code in this module plus stack (around 2.5Kb)
; Data (DS) stays in original image (so extra selector on PM transition)
; We transfer to code copy in TB so CS is in TB which is what DJGPP expects
mov bx, offset end_stub_text+stack_sz+15
and bl, 0f0h ; round to paragraph
mov ax, [cs:si] ; stubinfo_minkeep
cmp bx, ax
ja short @@w2e
mov bx, ax
@@w2e: mov [cs:si], bx ; stubinfo_minkeep
mov dx, bx
call include_umb
mov bx, dx
shr bx, cl
mov ah,48h
int 21h ; Allocate transbuffer
call restore_umb
jc error_no_dos_memory
; Copy stubinfo and code to TB; set SS:SP to end of TB; jump to TB as CS
mov es, ax
mov ss, ax
mov sp, dx ; TB size from above
xor si, si ; si=0 offset for _TEXT start
xor di, di
mov cx, offset end_stub_text+1
shr cx, 1 ; words
rep movs [word ptr es:di],[word ptr cs:si]
push ax ; new cs in TB
push offset @@cont ; new EIP in TB
retf
; jmp short @@cont
;-----------------------------------------------------------------------------
; A DPMI host is active - this loader can be overwritten as TB
; Minimum TB size is end of code and data in this module plus stack
; currently CS = TB; set SS:SP to end of TB
@@dpmi: mov bx, offset end_stub_data+511 ; Data size in bytes
shr bx, cl ; Paragraphs
add bx, _DATA + (stack_sz/16) ; Add stack
sub bx, _TEXT ; Add (DS-CS) paragraphs
and bl, 0e0h ; round to 512 bytes
shl bx, cl ; Convert back to bytes
mov ax, [cs:si] ; stubinfo_minkeep
cmp bx, ax
ja short @@w2
mov bx, ax
@@w2: mov [cs:si], bx ; stubinfo_minkeep
push cs
pop ss
mov sp, bx ; Move down on stack
inc bh ; Add extra for psp
shr bx, cl
mov es, [dos_block_seg]
mov ah, 04ah
int 021h ; resize our memory block
jc error_no_dos_memory ; should never fail since decrease
@@cont:
mov [cs:stubinfo_ds_segment], cs
;-----------------------------------------------------------------------------
; Scan environment for the stub's full name after environment
mov es, [dos_block_seg]
mov es, [es:02ch] ; get environment segment
xor di, di ; begin search for NUL/NUL (di = 0)
mov cx, 0ff04h ; effectively `infinite' loop
xor al, al
scan_environment:
repne scasb ; search for NUL
scasb
jne short scan_environment ; no, still environment
scasw ; adjust pointer to point to prog name
;-----------------------------------------------------------------------------
; copy the filename to loadname
sub al,al
push di
mov cx,-1
repne scasb
not cx
mov [cs:stubinfo_env_size], di
pop si
mov di,offset loadname
push ds
push es
push ds
pop es
pop ds
rep movsb
pop ds
cmp [byte ptr cs:stubinfo_basename+0], 0
je short no_symlink
mov bx,di
@@lp2: dec bx
cmp [byte ptr bx],'\' ; always succeeds, because filename
jne short @@lp2 ; is qualified if no debugger
inc bx
;-----------------------------------------------------------------------------
; Replace the stub's file name with the link's name after the directory
mov cx, 8 ; max length of basename
mov di, offset stubinfo_basename ; pointer to new basename
@@b11:
mov al, [cs:di] ; get next character
inc di
or al, al ; end of basename?
je short @@f12
mov [bx], al ; store character
inc bx
loop @@b11 ; eight characters?
@@f12:
mov [dword ptr bx+0], 04558452eh ; append ".EXE"
mov [byte ptr bx+4], 0
no_symlink:
;-----------------------------------------------------------------------------
; Load the COFF information from the file
mov ax, 03d00h ; open file for reading
mov dx, offset loadname
int 021h
jc error_no_progfile ; do rest of error message
mov [program_file], ax ; store for future reference
mov bx, ax
mov cx, exe_header_length
mov dx, offset exe_header
mov ah, 03fh ; read EXE header
int 021h
xor dx, dx ; dx = 0
xor cx, cx ; offset of COFF header
mov ax, [exe_magic]
cmp ax, 0014ch ; COFF?
je short file_is_just_coff
cmp ax, 05a4dh ; EXE magic value
jne error_not_exe
mov dx, [exe_sectors]
shl dx, 9 ; 512 bytes per sector
mov bx, [exe_bytes_last_page]
or bx, bx ; is bx = 0 ?
je short @@f13
sub dh, 2 ; dx -= 512
add dx, bx
@@f13:
file_is_just_coff: ; cx:dx is offset
mov [word ptr coff_offset+0], dx
mov [word ptr coff_offset+2], cx
mov ax, 04200h ; seek from beginning
mov bx, [program_file]
int 021h
mov cx, coff_header_length
mov dx, offset coff_header
mov ah, 03fh ; read file (bx = handle)
int 021h
cmp ax, cx ; coff_header_length
jne short @@f21
cmp [word ptr coff_header + coff_magic], 0014ch
@@f21:
jne error_not_coff
mov eax, [dword ptr aout_header + aout_entry]
mov [start_eip], eax
mov ecx, [coff_offset]
mov eax, [dword ptr text_section + s_scnptr]
add eax, ecx
mov [text_foffset], eax
mov eax, [dword ptr data_section+ s_scnptr]
add eax, ecx
mov [data_foffset], eax
mov ebx, [dword ptr bss_section + s_vaddr]
add ebx, [dword ptr bss_section + s_size]
mov eax, 00010001h
cmp ebx, eax
jae short @@f1
mov ebx, eax ; ensure 32-bit segment
@@f1:
add ebx, 0000ffffh ; ensure 64K rounded
xor bx, bx ; clear rounded bits
mov [cs:stubinfo_initial_size], ebx
;-----------------------------------------------------------------------------
; Set up for the DPMI environment
call include_umb
mov bx, [modesw_mem]
or bx, bx ; or clears carry
jz short no_dos_alloc
mov ah, 048h ; allocate memory for the DPMI host
int 021h
jc error_no_dos_memory_umb
mov es, ax
no_dos_alloc:
call restore_umb
mov ax, 1 ; indicates a 32-bit client
call [modesw] ; enter protected mode
jc error_in_modesw
;-----------------------------------------------------------------------------
; We're in protected mode at this point.
mov [ss:stubinfo_psp_selector],es
mov [ss:stubinfo_cs_selector],cs
mov [ss:stubinfo_ds_selector],ss
push ds
pop es
xor ax, ax ; AX = 0x0000
mov cx, 1
int 031h ; allocate LDT descriptor
jc short @@f2
mov [client_cs], ax
xor ax, ax ; AX = 0x0000
; mov cx, 1 ; already set above
int 031h ; allocate LDT descriptor
@@f2:
jc perror_no_selectors
mov [client_ds], ax
; Try getting a DPMI 1.0 memory block first, then try DPMI 0.9
; Note: This causes the Borland Windows VxD to puke, commented for now with ;*
;* mov ax, 0x0504
;* xor ebx, ebx ; don't specify linear address
mov ecx, [ss:stubinfo_initial_size + 0]
;* mov edx, 1 ; allocate committed pages
;* int 0x31 ; allocate memory block
;* jc try_old_dpmi_alloc
;* mov client_memory[0], ebx
;* mov ss:stubinfo_memory_handle[0], esi
;* jmp got_dpmi_memory
try_old_dpmi_alloc:
mov ax, 00501h
mov bx, [word ptr ss:stubinfo_initial_size + 2]
; mov cx, stubinfo_initial_size[0] ;Set above
int 031h ; allocate memory block
jc perror_dpmi_non_present_memory
mov [word ptr client_memory + 2], bx
mov [word ptr client_memory + 0], cx
mov [word ptr ss:stubinfo_memory_handle + 2], si
mov [word ptr ss:stubinfo_memory_handle + 0], di
got_dpmi_memory:
mov ax, 00007h
mov bx, [client_cs] ; initialize client CS
mov cx, [word ptr client_memory + 2]
mov dx, [word ptr client_memory + 0]
int 031h ; set segment base address
mov ax, 00009h
; mov bx, [client_cs] ; already set above
mov cx, cs ; get CPL
and cx, 00003h
shl cx, 5
push cx ; save shifted CPL for below
or cx, 0c09bh ; 32-bit, big, code, non-conforming, readable
int 031h ; set descriptor access rights
mov ax, 00008h
; mov bx, [client_cs] ; already set above
mov cx, [word ptr ss:stubinfo_initial_size + 2]
dec cx
mov dx, 0ffffh
int 031h ; set segment limit
mov ax, 00007h
mov bx, [client_ds] ; initialize client DS
mov cx, [word ptr client_memory + 2]
mov dx, [word ptr client_memory + 0]
int 031h ; set segment base address
mov ax, 00009h
; mov bx, [client_ds] ; already set above
pop cx ; shifted CPL from above
or cx, 0c093h ; 32-bit, big, data, r/w, expand-up
int 031h ; set descriptor access rights
mov ax, 00008h
; mov bx, [client_ds] ; already set above
mov cx, [word ptr ss:stubinfo_initial_size + 2]
dec cx
mov dx, 0ffffh
int 031h ; set segment limit
;-----------------------------------------------------------------------------
; Load the program data
mov ax, 00100h
mov bx, 00f00h ; 60K DOS block size
int 031h ; allocate DOS memory
jnc short @@f1
cmp ax, 00008h
jne error_no_dos_memory
mov ax, 00100h ; try boucle with new value in bx
int 031h ; allocate DOS memory
jc error_no_dos_memory
@@f1:
mov [dos_block_seg], ax
mov [dos_block_sel], dx
shl bx, 4 ; paragraphs to bytes
mov [dos_block_size], bx
mov esi, [text_foffset] ; load text section
mov edi, [dword ptr text_section + s_vaddr]
mov ecx, [dword ptr text_section + s_size]
call read_section
mov esi, [data_foffset] ; load data section
mov edi, [dword ptr data_section + s_vaddr]
mov ecx, [dword ptr data_section + s_size]
call read_section
mov es, [client_ds] ; clear the BSS section
mov edi, [dword ptr bss_section + s_vaddr]
mov ecx, [dword ptr bss_section + s_size]
xor eax,eax
shr ecx,2
rep stos [dword ptr es:edi]
mov ah,03eh
mov bx, [program_file]
int 021h ; close the file
mov ax, 00101h
mov dx, [dos_block_sel]
int 031h ; free the DOS memory
; Original Stub code:
; push ds
; pop fs
; mov ds, [client_ds]
; .opsize
; jmpf fs:[start_eip] ; start program
push [dword ptr client_cs]
push [dword ptr start_eip]
push ss
pop fs
mov bx, ds
mov ds, [client_ds]
mov ax, 1
int 31h ; free old DS selector (_DATA)
db 66h
retf ; jump far double to start_eip
;-----------------------------------------------------------------------------
; Read a section from the program file
read_section:
mov eax, esi ; sector alignment by default
and eax, 01ffh
add ecx, eax
sub si, ax ; sector align disk offset (can't carry)
sub edi, eax ; memory maybe not aligned!
mov [read_size], ecx ; store for later reference
mov [read_soffset], edi
call zero_regs
mov [word ptr dpmi_regs + dr_dx], si ; store file offset
shr esi, 16
mov [word ptr dpmi_regs + dr_cx], si
mov bx, [program_file]
mov [word ptr dpmi_regs + dr_bx], bx
mov [word ptr dpmi_regs + dr_ax], 04200h
call pm_dos ; seek to start of data
; Note, handle set above
mov ax, [dos_block_seg]
mov [word ptr dpmi_regs + dr_ds], ax
mov [word ptr dpmi_regs + dr_dx], 0 ; store file offset
read_loop:
mov [byte ptr dpmi_regs + dr_ah], 03fh
mov ax, [word ptr read_size + 2] ; see how many bytes to read
or ax, ax
jnz short read_too_big
mov ax, [word ptr read_size + 0]
cmp ax, [dos_block_size]
jna short read_size_in_ax ; jna shorter than jmp
read_too_big:
mov ax, [dos_block_size]
read_size_in_ax:
mov [word ptr dpmi_regs + dr_cx], ax
call pm_dos ; read the next chunk of file data
xor ecx, ecx
mov cx, [word ptr dpmi_regs + dr_ax] ; get byte count
mov edi, [read_soffset] ; adjust pointers
add [read_soffset], ecx
sub [read_size], ecx
xor esi, esi ; esi=0 offset for copy data
shr cx, 2 ; ecx < 64K
push ds
push es
mov es, [client_ds]
mov ds, [dos_block_sel]
rep movs [dword ptr es:edi],[dword ptr ds:esi]
pop es
pop ds
add ecx, [read_size] ; ecx zero from the rep movsd
jnz read_loop
ret
;-----------------------------------------------------------------------------
; Most errors come here, early ones jump direct (8088 instructions)
error_no_progfile:
mov al, 102
mov dx, offset msg_no_progfile
jmp short error_fn
error_not_exe:
mov al, 103
mov dx, offset msg_not_exe
jmp short error_fn
error_not_coff:
mov al, 104
mov dx, offset msg_not_coff
; jmp error_fn
error_fn:
push dx
mov bx, offset loadname
jmp short error_in
error_no_dos_memory_umb:
call restore_umb
error_no_dos_memory:
mov al, 105
mov dx, offset msg_no_dos_memory
jmp short error
error_in_modesw:
mov al, 106
mov dx, offset msg_error_in_modesw
jmp short error
perror_no_selectors:
mov al, 107
mov dx, offset msg_no_selectors
jmp short error
perror_dpmi_non_present_memory:
mov al, 108
mov dx, offset msg_dpmi_non_present_memory
; jmp error
error:
push dx
mov bx, offset err_string
error_in:
call printstr
pop bx
call printstr
mov bx, offset crlfdollar
call printstr
mov ah, 04ch ; error exit - exit code is in al
int 021h
printstr1:
inc bx
push ax ; have to preserve al set by error call
mov ah, 2
int 021h
pop ax ; restore ax (John A.)
printstr:
mov dl, [bx]
cmp dl, 0
jne printstr1
ret
;-----------------------------------------------------------------------------
; DPMI utility functions
zero_regs:
push ax
push cx
push di
xor ax, ax
mov di, offset dpmi_regs
mov cx, 019h
rep
stosw
pop di
pop cx
pop ax
ret
pm_dos:
mov ax, 00300h ; simulate interrupt
mov bx, 00021h ; int 21, no flags
xor cx, cx ; cx = 0x0000 (copy no args)
sub edi,edi
mov di, offset dpmi_regs
int 031h
ret
;-----------------------------------------------------------------------------
; Make upper memory allocatable. Clobbers Ax and Bx.
include_umb:
cmp [dos_major], 5 ; Won't work before dos 5
jb short @f1
mov ax, 05800h ; get allocation strategy
int 021h
mov [old_strategy],al
mov ax, 05802h ; Get UMB status.
int 021h
mov [old_umb],al
mov ax, 05801h
mov bx, 00080h ; first fit, first high then low
int 021h
mov ax, 05803h
; mov bx, 00001h ; include UMB in memory chain
mov bl, 1
int 021h
@f1:
ret
; Restore upper memory status. All registers and flags preserved.
restore_umb:
pushf
cmp [dos_major], 5 ; Won't work before dos 5
jb short @f2
push ax
push bx
mov ax, 05803h ; restore UMB status.
mov bl,[old_umb]
xor bh, bh
int 021h
mov ax, 05801h ; restore allocation strategy
mov bl,[old_strategy]
; xor bh, bh
int 021h
pop bx
pop ax
@f2:
popf
ret
label end_stub_text byte
ENDS
;*****************************************************************************
; Data
SEGMENT _DATA PUBLIC USE16 'DATA'
;-----------------------------------------------------------------------------
; Stored Data
err_string db "Load error: ",0
msg_no_progfile db ": can't open",0
msg_not_exe db ": not EXE",0
msg_not_coff db ": not COFF (Check for viruses)",0
msg_no_dos_memory db "no DOS memory",0
msg_bad_dos db "need DOS 3",0
msg_error_in_modesw db "can't switch mode",0
msg_no_selectors db "no DPMI selectors",0
msg_dpmi_non_present_memory db "no DPMI memory",0
crlfdollar db 13,10,0
label last_generated_byte byte ; data after this isn't in file.
ENDS
;-----------------------------------------------------------------------------
; Unstored Data, available during and after mode switch
SEGMENT _BSS PUBLIC USE16 'BSS'
modesw dd ? ; address of DPMI mode switch
modesw_mem dw ? ; amount of memory DPMI needs
program_file dw ? ; file ID of program data
text_foffset dd ? ; offset in file
data_foffset dd ? ; offset in file
start_eip dd ? ; EIP value to start at
client_cs dw ? ; must follow start_eip
client_ds dw ?
client_memory dd ?
dos_block_seg dw ?
dos_block_sel dw ?
dos_block_size dw ?
read_soffset dd ?
read_size dd ?
dos_major db ?
old_umb db ?
old_strategy db ?
ALIGN 2
dpmi_regs db 32h dup (?)
dr_edi = 000h
dr_di = 000h
dr_esi = 004h
dr_si = 004h
dr_ebp = 008h
dr_bp = 008h
dr_ebx = 010h
dr_bx = 010h
dr_bl = 010h
dr_bh = 011h
dr_edx = 014h
dr_dx = 014h
dr_dl = 014h
dr_dh = 015h
dr_ecx = 018h
dr_cx = 018h
dr_cl = 018h
dr_ch = 019h
dr_eax = 01ch
dr_ax = 01ch
dr_al = 01ch
dr_ah = 01dh
dr_efl = 020h
dr_es = 022h
dr_ds = 024h
dr_fs = 026h
dr_gs = 028h
dr_ip = 02ah
dr_cs = 02ch
dr_sp = 02eh
dr_ss = 030h
;-----------------------------------------------------------------------------
; At one time real mode only data. Header stuff now used during image load.
loadname db 81 dup (?) ; name of program file to load, if it
; gets really long ok to overwrite next
label exe_header byte ; loaded from front of loadfile
exe_magic dw ?
exe_bytes_last_page dw ?
exe_sectors dw ?
exe_header_length = $ - exe_header
coff_offset dd ? ; from start of file
coff_header db 20 dup (?) ; loaded from after stub
aout_header db 28 dup (?)
text_section db 40 dup (?)
data_section db 40 dup (?)
bss_section db 40 dup (?)
coff_header_length = $ - coff_header
label end_stub_data byte
ENDS
SEGMENT _STACK STACK 'STACK'
db stack_sz dup (?)
ENDS
END start
| 24.032181 | 79 | 0.638744 |
797826a258815b2da6ff18c3e5200421d98a7442 | 632 | asm | Assembly | oeis/315/A315738.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/315/A315738.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/315/A315738.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A315738: Coordination sequence Gal.6.343.6 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; Submitted by Simon Strandgaard
; 1,6,12,18,23,27,32,37,41,46,52,58,64,70,76,82,87,91,96,101,105,110,116,122,128,134,140,146,151,155,160,165,169,174,180,186,192,198,204,210,215,219,224,229,233,238,244,250,256,262
mov $1,$0
seq $0,315741 ; Coordination sequence Gal.6.210.5 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
mul $0,4
add $0,1
div $0,3
mul $1,2
sub $0,$1
| 52.666667 | 182 | 0.742089 |
b8bdee64604d02894c5d5aba3cc5e680655eb5bb | 227 | asm | Assembly | first program in Assembly.asm | Antoino0704/First_Assembly_Program | 2d26d7236152b5ad831f055b4fefbbcbe2ade732 | [
"MIT"
] | null | null | null | first program in Assembly.asm | Antoino0704/First_Assembly_Program | 2d26d7236152b5ad831f055b4fefbbcbe2ade732 | [
"MIT"
] | null | null | null | first program in Assembly.asm | Antoino0704/First_Assembly_Program | 2d26d7236152b5ad831f055b4fefbbcbe2ade732 | [
"MIT"
] | null | null | null | JMP start
string: DB "1° program in Assembly"
DB 0
start:
MOV D, 232
CALL print
HLT
print:
PUSH A
PUSH B
MOV B, 0
MOV A, string
loop:
MOV C, [A]
MOV [D], C
INC A
INC D
CMP B, [A]
JNE loop
POP A
POP B
RET
| 8.730769 | 38 | 0.599119 |
42086c05b0618167239c5a4117e51cd632214ab9 | 513 | asm | Assembly | programs/oeis/082/A082570.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | null | null | null | programs/oeis/082/A082570.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | null | null | null | programs/oeis/082/A082570.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | null | null | null | ; A082570: a(1)=1, a(n)=ceiling(n*(a(n-1)+1/a(n-1))).
; 1,4,13,53,266,1597,11180,89441,804970,8049701,88546712,1062560545,13813287086,193386019205,2900790288076,46412644609217,789014958356690,14202269250420421,269843115757988000,5396862315159760001,113334108618354960022,2493350389603809120485
add $0,1
mov $2,$0
lpb $0
mov $3,$2
mov $4,$0
cmp $4,0
add $0,$4
dif $3,$0
cmp $3,$2
cmp $3,0
lpb $0
mul $3,$0
sub $0,1
add $1,$3
lpe
div $3,2
lpe
add $1,1
mov $0,$1
sub $5,$3
add $0,$5
| 20.52 | 239 | 0.666667 |
dfd53eb9117350eb658554de181e4bfe8e48ebca | 1,196 | asm | Assembly | test/sgmul-sgdiv-sgmod.asm | kspalaiologos/asmbf | c98a51d61724a46855de291a27d68a49a034810b | [
"MIT"
] | 67 | 2020-08-03T06:26:35.000Z | 2022-03-24T19:50:51.000Z | test/sgmul-sgdiv-sgmod.asm | pyautogui/asmbf | 37c54a8a62df2fc4bab28bdeb43237b4905cbecd | [
"MIT"
] | 55 | 2019-10-02T19:37:08.000Z | 2020-06-12T19:40:53.000Z | test/sgmul-sgdiv-sgmod.asm | pyautogui/asmbf | 37c54a8a62df2fc4bab28bdeb43237b4905cbecd | [
"MIT"
] | 9 | 2019-05-18T11:59:41.000Z | 2020-06-21T20:40:25.000Z |
$(
function auto(a, b, op, c)
print("mov r1, " .. signed(a))
print("mov r2, " .. signed(b))
print("sg" .. op .. " r1, r2")
print("eq r1, " .. signed(c))
print("eq r2, " .. signed(b))
print("and r1, r2")
print("add r1, .0")
print("out r1")
end
)
#auto(5, 5, "mul", 25)
#auto(-5, 5, "mul", -25)
#auto(5, -5, "mul", -25)
#auto(-5, -5, "mul", 25)
#auto(-1, 0, "mul", 0)
#auto(0, -1, "mul", 0)
#auto(0, 0, "mul", 0)
#auto(1, 1, "mul", 1)
#auto(-1, 1, "mul", -1)
#auto(1, -1, "mul", -1)
#auto(-1, -1, "mul", 1)
#auto(2, 3, "mul", 6)
#auto(-2, 3, "mul", -6)
#auto(2, -3, "mul", -6)
#auto(-2, -3, "mul", 6)
#auto(8, 2, "div", 4)
#auto(8, -2, "div", -4)
#auto(-8, 2, "div", -4)
#auto(-8, -2, "div", 4)
#auto(2, 2, "div", 1)
#auto(2, -2, "div", -1)
#auto(-2, 2, "div", -1)
#auto(-2, -2, "div", 1)
#auto(0, -2, "div", 0)
#auto(0, 2, "div", 0)
#auto(8, 2, "div", 4)
#auto(8, -2, "div", -4)
#auto(-8, 2, "div", -4)
#auto(-8, -2, "div", 4)
#auto(2, 2, "div", 1)
#auto(2, -2, "div", -1)
#auto(-2, 2, "div", -1)
#auto(-2, -2, "div", 1)
#auto(8, 2, "mod", 0)
#auto(9, 2, "mod", 1)
#auto(-9, 2, "mod", -1)
#auto(-9, -2, "mod", 1)
| 19.290323 | 38 | 0.423077 |
4556ad497cc52873f451e5db1f212cee39c63e0e | 413 | asm | Assembly | programs/oeis/110/A110659.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/110/A110659.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/110/A110659.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A110659: a(n) = A028242(A110654(n)).
; 1,0,0,2,2,1,1,3,3,2,2,4,4,3,3,5,5,4,4,6,6,5,5,7,7,6,6,8,8,7,7,9,9,8,8,10,10,9,9,11,11,10,10,12,12,11,11,13,13,12,12,14,14,13,13,15,15,14,14,16,16,15,15,17,17,16,16,18,18,17,17,19,19,18,18,20,20,19,19,21,21,20,20,22,22,21,21,23,23,22,22,24,24,23,23,25,25,24,24,26
mov $1,1
mov $2,1
lpb $0
sub $0,1
trn $0,1
trn $3,$1
mov $1,$3
add $2,1
mov $3,$2
lpe
mov $0,$1
| 27.533333 | 264 | 0.578692 |
e60d751ea2701988af6604310191cac4623e6701 | 442 | asm | Assembly | base/mvdm/dos/v86/inc/dpl.asm | npocmaka/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | base/mvdm/dos/v86/inc/dpl.asm | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | base/mvdm/dos/v86/inc/dpl.asm | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | ; SCCSID = @(#)dpl.asm 1.1 85/04/10
; SCCSID = @(#)dpl.asm 1.1 85/04/10
DPL STRUC
DPL_AX DW ? ; AX register
DPL_BX DW ? ; BX register
DPL_CX DW ? ; CX register
DPL_DX DW ? ; DX register
DPL_SI DW ? ; SI register
DPL_DI DW ? ; DI register
DPL_DS DW ? ; DS register
DPL_ES DW ? ; ES register
DPL_reserved DW ? ; Reserved
DPL_UID DW ? ; User (Machine) ID (0 = local macine)
DPL_PID DW ? ; Process ID (0 = local user PID)
DPL ENDS
| 27.625 | 52 | 0.647059 |
017be3d173ce4357959d403489787c4aa401401d | 1,641 | asm | Assembly | bootloader/Oak64/src/oak64.asm | ker2x/zymology | 29bf8913efbd0469ae636ba3af823158e390cfd9 | [
"MIT"
] | 3 | 2016-04-14T17:23:14.000Z | 2021-05-31T05:07:02.000Z | bootloader/Oak64/src/oak64.asm | ker2x/zymology | 29bf8913efbd0469ae636ba3af823158e390cfd9 | [
"MIT"
] | null | null | null | bootloader/Oak64/src/oak64.asm | ker2x/zymology | 29bf8913efbd0469ae636ba3af823158e390cfd9 | [
"MIT"
] | null | null | null | ; First stage of the bootloader
USE16
ORG 0x00008000
start:
; Clear registers, again
cli
xor eax, eax
xor ebx, ebx
xor ecx, ecx
xor edx, edx
xor esi, esi
xor edi, edi
xor ebp, ebp
mov ds, ax
mov es, ax
mov ss, ax
mov fs, ax
mov gs, ax
mov esp, 0x8000 ; set stack pointer, again
sti
; Print a friendly greetings :)
mov si, msg_hello
call print16
; Now... Let's clear some more stuff left by the MBR
; Wipe 0500->7BFF
; Wipe 7C00->7DFF
mov si, msg_wipe
call print16
mov edi, 0x00000500 ; from 0x500
xor eax, eax ; write 0 (yes, it's useless, eax is already 0)
mov ecx, 0x7900 ; 30463 + 512 + 1 times
rep stosb ; stosb and not stosd (yes, i did it, it wiped A LOT more than expected :D)
mov si, msg_done
call print16
; Memory map
; ----------
; 0000:0000 -> 0000:04FF : Here be dragon !
; 0000:0500 -> 0000:7DFF : free and zero'd
; 0000:???? -> 0000:7FFF : stack
; 0000:8000 -> 0000:FFFF : bootloader
; 0001:0000 -> 00EF:FFFF : free (kernel will be loaded at 0001:0000)
; Memory detection (using e820)
mov si, msg_e820
call print16
; TODO
;mov si, msg_done
;call print16
hang:
;xchg bx, bx
jmp hang
; Print null terminated string in 16 bit real mode
print16:
pusha
mov ah, 0x0E
.print16_repeat:
lodsb
cmp al, 0
je .print16_done
int 0x10
jmp short .print16_repeat
.print16_done:
popa
ret
; DATA
msg_done db "Done ! ", 0x0D, 0x0A, 0
msg_hello db "Oak64 Loaded... konnichiwa =^_^= !", 0x0D, 0x0A, "----------------------------------", 0x0D, 0x0A, 0x0D, 0x0A, 0
msg_wipe db "1) Collecting garbage left by MBR ... ", 0
msg_e820 db "2) Detecting memory (using e820) ... ", 0
| 19.535714 | 126 | 0.652651 |
f473d7d34aa7a16b7a394d023e368f5369680cef | 346 | asm | Assembly | src/src/c/borlandc/dpmi32/getdta.asm | amindlost/wdosx | 1e256d22c1547e7b1f1ccd23e400f5b81b8bd013 | [
"Unlicense"
] | 7 | 2022-01-20T08:27:54.000Z | 2022-03-17T10:15:31.000Z | src/src/c/borlandc/dpmi32/getdta.asm | amindlost/wdosx | 1e256d22c1547e7b1f1ccd23e400f5b81b8bd013 | [
"Unlicense"
] | null | null | null | src/src/c/borlandc/dpmi32/getdta.asm | amindlost/wdosx | 1e256d22c1547e7b1f1ccd23e400f5b81b8bd013 | [
"Unlicense"
] | null | null | null | .386
.model flat,C
PUBLIC getdta
; the current version of WDOSX (0.93) does not support an extended 21/2f yet
; Don't use this one with WDOSX 0.93. I'm sure 0.94 will have support
; added.
; The DTA is in the real mode region at psp:[80h].
.code
getdta proc near
push ebx
mov ah,2Fh
int 21h
mov eax,ebx
pop ebx
ret
getdta endp
end
| 13.307692 | 76 | 0.702312 |
2127860f5ef8f633e81aa6e78ee5802d48109585 | 682 | asm | Assembly | oeis/093/A093361.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/093/A093361.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/093/A093361.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A093361: Add/multiply sequence, see example.
; Submitted by Jon Maiga
; 1,3,7,11,27,33,69,77,141,151,251,263,407,421,617,633,889,907,1231,1251,1651,1673,2157,2181,2757,2783,3459,3487,4271,4301,5201,5233,6257,6291,7447,7483,8779,8817,10261,10301,11901,11943,13707,13751,15687,15733,17849,17897,20201,20251,22751,22803,25507,25561,28477,28533,31669,31727,35091,35151,38751,38813,42657,42721,46817,46883,51239,51307,55931,56001,60901,60973,66157,66231,71707,71783,77559,77637,83721,83801,90201,90283,97007,97091,104147,104233,111629,111717,119461,119551,127651,127743,136207
lpb $0
add $2,$0
div $0,2
mul $0,2
trn $0,1
add $1,$2
sub $2,2
lpe
mov $0,$1
mul $0,2
add $0,1
| 42.625 | 501 | 0.753666 |
2097f7adba508b2e9f144f0cea65cc3f23d50058 | 490 | asm | Assembly | hacks/images/m6502/colors.asm | MBrassey/xscreensaver_BlueMatrix | 2152a79ec08a676d940158735700087323d4a556 | [
"CC0-1.0"
] | 2 | 2020-07-15T07:40:50.000Z | 2020-09-01T05:51:36.000Z | hacks/images/m6502/colors.asm | luc1dLife/xscreensaver_BlueMatrix | 2152a79ec08a676d940158735700087323d4a556 | [
"CC0-1.0"
] | null | null | null | hacks/images/m6502/colors.asm | luc1dLife/xscreensaver_BlueMatrix | 2152a79ec08a676d940158735700087323d4a556 | [
"CC0-1.0"
] | null | null | null | ; submitted by Anonymous
jmp $700
*=$700
ldx #0
ldy #0
;init screen
lda #0
sta $0
sta $3
lda #2
sta $1
loop:
lda colors,x
bpl ok
inc $0
ldx #0
lda colors,x
ok:
inx
sta ($0),y
iny
bne ok2
inc $1
lda $1
cmp #6
beq end
ok2:
jmp loop
end:
inc $3
lda $3
and #$3f
tax
ldy #0
lda #2
sta $1
sty $0
jmp loop
colors:
dcb 0,2,0,2,2,8,2,8,8,7,8,7,7,1,7,1,1,7,1,7,7,8,7,8
dcb 8,2,8,2,2,0,2,0,2,2,8,2,8,8,7,8,7,7,1,7,1,1,1,1
dcb 1,1,1,1,7,1,7,7,8,7,8,8,2,8,2,2,255
| 10.425532 | 51 | 0.561224 |
2d2cd6b5002e9f6f012f659a96524a9cc1aea6a1 | 8,129 | asm | Assembly | lib/target/micro8085/classic/micro8085_crt0.asm | UnivEngineer/z88dk | 9047beba62595b1d88991bc934da75c0e2030d07 | [
"ClArtistic"
] | 4 | 2021-12-23T15:34:05.000Z | 2021-12-23T15:36:16.000Z | lib/target/micro8085/classic/micro8085_crt0.asm | UnivEngineer/z88dk | 9047beba62595b1d88991bc934da75c0e2030d07 | [
"ClArtistic"
] | 2 | 2022-03-20T22:17:35.000Z | 2022-03-24T16:10:00.000Z | lib/target/micro8085/classic/micro8085_crt0.asm | jorgegv/z88dk | 127130cf11f9ff268ba53e308138b12d2b9be90a | [
"ClArtistic"
] | null | null | null | ;-------------------------------------------------------------------------
; Embedded target Micro8085 by Anders Hjelm
; https://hackaday.io/project/176653-micro8085
; for target clib support see /z88dk/examples/micro8085/micro8085.h
;-------------------------------------------------------------------------
module micro8085_crt0
;-------------------------------------------------------------------------
; Include zcc_opt.def to find out some info
;-------------------------------------------------------------------------
defc crt0 = 1
INCLUDE "zcc_opt.def"
;-------------------------------------------------------------------------
; Some scope definitions
;-------------------------------------------------------------------------
EXTERN _main ;main() is always external to crt0 code
PUBLIC cleanup ;jp'd to by exit()
PUBLIC l_dcal ;jp(hl)
PUBLIC _urxbuf
PUBLIC _putidx
PUBLIC _getidx
PUBLIC _get_msec
PUBLIC puartd
PUBLIC puartc
PUBLIC pspiclk
PUBLIC pselect
PUBLIC padc1
PUBLIC padc2
PUBLIC uenabl
PUBLIC udtr
PUBLIC urts
PUBLIC eepgsz
PUBLIC CPU_CLK_kHz
;-------------------------------------------------------------------------
; *** IO PORT MAP AND RELATED DEFINES FOR MICRO8085 ***
piocmd equ 00H
pioa equ 01H
piob equ 02H
pioc equ 03H
ptiml equ 04H
ptimh equ 05H
puartd equ 10H
puartc equ 11H
pspiclk equ 20H ;DUMMY WRITE TO GENERATE CLOCK
pselect equ 30H ;TWO BIT OUTPUT REGISTER
padc1 equ 40H ;ADC CONV.TIME 140 MICROSEC FROM
padc2 equ 50H ;OUT(WRITE/START) TO IN(READ)
pdac equ 60H
; *** INTEL8251 UART COMMANDS ETC ***
ureset equ 40H ;01000000b ;RESET COMMAND
usetup equ 4EH ;01001110b ;8 DATA, 1 STOP, X16
uenabl equ 15H ;00010101b ; - ,ERRST,RXEN, - ,TXEN
udtr equ 02H ;00000010b ; - , - , - ,DTR, -
urts equ 20H ;00100000b ;RTS, - , - , - , -
; *** SERIAL EEPROM COMMANDS AND SIZE ***
eepgsz equ 64 ;IMPLEMENTATION ALLOWS MAX PAGE SIZE 256 BYTE
eesize equ 32768 ;IMPLEMENTATION ALLOWS MAX SIZE 65536 - PAGE SIZE
;-------------------------------------------------------------------------
defc CRT_ORG_CODE = 0x0000
defc CRT_ORG_DATA = 0x8000
defc CRT_ORG_BSS = 0x8000
;------ place uart rx buff at top of ram align to 256 byte boundary ------
;------ locate get & put index together for single 16bit r/w access ------
defc _urxbuf = 0xFF00
defc _putidx = (_urxbuf-1)
defc _getidx = (_urxbuf-2)
defc _mstick = (_urxbuf-4)
defc _scrtchpd = (_urxbuf-16)
;------ below rx buffer and some additional data we place the stack ------
defc REGISTER_SP = _scrtchpd
defc CLIB_EXIT_STACK_SIZE = 0
defc __CPU_CLOCK = 6144000
defc CPU_CLK_kHz = 6144
;------ overide default definition clib_fopn_max = 10 in crt_rules ------
defc DEFINED_CLIB_FOPEN_MAX = 1
defc CLIB_FOPEN_MAX = 3
INCLUDE "crt/classic/crt_rules.inc"
;-------------------------------------------------------------------------
org CRT_ORG_CODE
rst0: ld sp,__register_sp
jp program ;RST0 standard entry
defs $08-ASMPC
rst1: ret ;RST1 not used
defs $10-ASMPC
rst2: ret ;RST2 not used
defs $18-ASMPC
rst3: ret ;RST3 not used
defs $20-ASMPC
rst4: ret ;RST4 not used
defs $24-ASMPC
trap: ret ;TRAP not used
defs $28-ASMPC
rst5: ret ;RST5 not used
defs $2C-ASMPC
rst55: ret ;RST5.5 not used
defs $30-ASMPC
rst6: ret ;RST6 not used
defs $34-ASMPC
rst65: di ;RST6.5 uart rx isr
jp intr65 ;jmp to interrupt code
defs $38-ASMPC
rst7: ret ;RST7 not used
defs $3C-ASMPC
rst75: di ;RST7.5 timer isr
push af
push hl
lhld _mstick ;millisec count location
inc hl ;increment milliseconds
shld _mstick ;back to its location
ld a,10H ;reset rst7.5 f/f
sim
pop hl
pop af
ei
ret
intr65: push af
push hl
ld a,(_putidx) ;get the buffer put index
ld l,a ;prepare for memory access
ld h,_urxbuf/256 ;msb of buffer address
in a,(puartd) ;get the char from uart
ld (hl),a ;poke it to buffer
inc l ;bump buf put index
ld a,(_getidx) ;peek the get index
cp l ;compare with put
jp z,i_skip ;put==get means buffer full
ld a,l ;updated put index to a
ld (_putidx),a ;and store it
i_skip: pop hl
pop af
ei
ret
;-------------------------------------------------------------------------
; extern uint16 get_msec(void) ;returns the millisec tick value
_get_msec:
di
lhld _mstick ;millisec count location
ei
ret
;-------------------------------------------------------------------------
program:
; Optional definition for auto MALLOC init it assumes we have free
; space between the end of the compiled program and the stack pointer
IF DEFINED_USING_amalloc
INCLUDE "crt/classic/crt_init_amalloc.asm"
ENDIF
call target_init
call crt0_init_bss
call _main ;void main(void) so no args or retval
cleanup: jp rst0 ;restart if main should return
l_dcal: jp (hl) ;Used for function pointer calls
;-------------------------------------------------------------------------
target_init:
ld hl,0
shld _getidx ;RESET PUT & GET INDEXES
shld _mstick ;RESET MILLISEC COUNT
ld a,80H
out (pdac),a ;PUT OUT HALF VCC ON DAC
sub a ;RESET A
out (pselect),a ;RESET D F/F select LINES
;8251_uart
out (puartc),a ;PUT 8251 IN COMMAND MODE
out (puartc),a ;WRITE 0 THREE TIMES
out (puartc),a
ld a,ureset ;RESET COMMAND
out (puartc),a ;WRITE IT TO 8251 USART
ld a,usetup ;8 DATA, 1 STOP, X16
out (puartc),a ;WRITE IT TO 8251 USART
ld a,uenabl ;ERRST, RXEN, TXEN
out (puartc),a ;WRITE IT TO 8251 USART
;8155_timer
ld hl,CPU_CLK_kHz
sra hl ;DIV BY 2 TO GET TIMER COUNT
ld a,l ;LOW BYTE OF COUNT
out (ptiml),a ;SEND TO TIMER LOW REGISTER
ld a,h ;COUNTER IN 8155 IS 14 BIT
and 3FH ;MAKE SURE BITS 6,7 ARE ZERO
or 40H ;SET MODE CONT. SQUARE WAVE
out (ptimh),a ;SEND TO TIMER HI REGISTER
ld a,0C0H ;START TIMER COMMAND
out (piocmd),a ;SEND TO 8155 CONFIG REG
;8085_interrupt
ld a,19H ;RST F/F & ENABLE 7.5 & 6.5
sim ;SET THE NEW MASK
ei ;ENABLE INTERRUPT
ret
;-------------------------------------------------------------------------
defc __crt_org_bss = CRT_ORG_BSS
defc __crt_model = 1
INCLUDE "crt/classic/crt_runtime_selection.asm"
INCLUDE "crt/classic/crt_section.asm"
;-------------------------------------------------------------------------
| 35.810573 | 74 | 0.453192 |
0d7808e4c7468e19ba9bb2c1f0123e8c6e14570e | 21,315 | asm | Assembly | myco.asm | Steve-Teal/myco-fpga | a2e78e4d0a78a210c3d1f64b7f2305325c58b15c | [
"Unlicense"
] | null | null | null | myco.asm | Steve-Teal/myco-fpga | a2e78e4d0a78a210c3d1f64b7f2305325c58b15c | [
"Unlicense"
] | null | null | null | myco.asm | Steve-Teal/myco-fpga | a2e78e4d0a78a210c3d1f64b7f2305325c58b15c | [
"Unlicense"
] | null | null | null | ;-----------------------------------------------------
;
; myco-fpga
; An emulator for the MyCo/TPS 4-bit computer system
;
;-----------------------------------------------------
BR START
;
; Register definitions
;
REGA DW 0 ; A,B,C and D are the internal Myco registers
REGB DW 0
REGC DW 0
REGD DW 0
PC DW 0 ; Program Counter
PAGE DW 0 ; Page register, contains the top 4-bits for absolute jump instructions
CALLFROM DW 0 ; Address where subroutine was called from
DATA DW 0 ; DATA (low nibble) part of current Myco instruction
INSTRUCTION DW 0
R0 DW 0 ; General purpose registers used by the emulator
R1 DW 0
PREVSWITCH DW 0
;
; IO Addresses for various peripherals
;
SWITCH DW 0 ; Switch inputs, bit 0 is switch 1, bit 1 switch 2, 0 when pressed, 1 when not pressed
DOUT DW 1 ; Output port LEDS (bits 0 - 3)
DIN DW 2 ; Input port (bits 0 - 3)
TIMER DW 3 ; Timer port, the CPU will pause for the number of milli-seconds written to this port
PWM DW 4 ; PWM control register 0 = full off, 15 = full on, frequency ~16KHz
;
; Start of program
;
START LOAD #0 ; Clear MyCo registers
STORE REGA
STORE REGB
STORE REGC
STORE REGD
STORE PAGE
STORE CALLFROM
OUT PWM ; Set PWM and DOUT to 0
OUT DOUT
IN SWITCH ; Read switches (push buttons SW1 and SW2)
STORE PREVSWITCH
AND #2 ; Mask SW2
BNZ RUN ; Branch to RUN if SW2 is not pressed
PROGRAMLOOP STORE PC ; Programming mode, falling into this A will equal 0 and clear PC
OUT DOUT ; Display lower nibble of PC on LEDS...
LOAD #300 ; ...for 300mS
OUT TIMER
CALL FETCH ; Read instruction (and data)
CALL PROGRAMINST ; Display/Change instruction
CALL PROGRAMDATA ; Display/Chnage data
LOAD PC ; Increment PC
ADD #1
BR PROGRAMLOOP ; Loop
RUN LOAD #0 ; RUN mode, clear program counter
RUNLOOP STORE PC
CALL FETCH ; Read instruction (and data)
LOAD @INSTTABLE ; Get address of instruction jump table
ADD INSTRUCTION ; Add the 4-bit instruction to it
OR #0xB000 ; Turn it into a 'BR' branch instruction
STORE BRINST ; and store it
BRINST NOP ; Replaced with BR into instruction table
; Instruction jump table
INSTTABLE BR INCPC ; NOP
BR TOPORT ; To Port
BR WAIT ; Wait
BR JUMPBACK ; Jump Back
BR SETA ; A<=
BR ATO ; <=A
BR TOA ; A<=
BR CALC ; <=A
BR SETPAGE ; Set Page
BR JUMPPAGE ; Jump Page
BR CLOOP ; C*
BR DLOOP ; D*
BR SKIPIF ; Skip If
BR CALLSUB ; Call
BR SUBRETURN ; Ret
BR INCPC ; NOP
; Display/Change instruction
PROGRAMINST LOAD INSTRUCTION ; Get instruction nibble
OUT DOUT ; Display on LEDS
CALL WAITSWITCH ; Wait for switch press
BNZ PINST2 ; Return if SW2 is pressed (leaving instruction unchanged)
LOAD #0 ; SW1 pressed new instruction entry start at 0
PINST1 STORE INSTRUCTION
OUT DOUT ; Display new instruction on LEDS
CALL STOREPROGRAM ; Store new instruction in RAM
CALL WAITSWITCH ; Wait for switch press
BNZ PINST2 ; Return if SW2 is pressed (done editing)
LOAD INSTRUCTION ; SW1 pressed, increment new instruction
ADD #1
BR PINST1 ; Continue editing, loop
PINST2 RETURN
; Display/Change data
PROGRAMDATA LOAD DATA ; Get instruction data nibble
OUT DOUT ; Display on LEDS
CALL WAITSWITCH ; Wait for switch press
BNZ PDATA2 ; Return if SW2 is pressed (leaving data unchanged)
LOAD #0 ; SW1 pressed new data start at 0
PDATA1 STORE DATA
OUT DOUT ; Display new data on LEDS
CALL STOREPROGRAM ; Store new data in RAM
CALL WAITSWITCH ; Wait fro switch press
BNZ PDATA2 ; Return if SW2 is pressed (done editing)
LOAD DATA ; SW1 pressed, increment new data
ADD #1
BR PDATA1 ; Continue editing, loop
PDATA2 RETURN
; Store Instruction/Data to RAM
; The RAM is 16 bits wide, each location stores two MyCo instruction bytes
; Bit 0 of the program counter is used to decide
STOREPROGRAM LOAD INSTRUCTION ; Load 'new' instruction
STORE R1
CALL R1MUL16 ; Shift instruction to upper nibble
OR DATA ; Store data part of instruction in lower nibble
STORE R0 ; Store new instruction and data in lower byte of R0
CALL R0SWAPPCEVEN ; Byte swap R0 if PC is even
LOAD R0
STORE R1
CALL READPC ; Read program memory word (two instructions) and store in R0
ROR PC ; Carry flag = bit 0 of PC
LOAD #0x00FF
BNC SPGM1
LOAD #0xFF00
SPGM1 AND R0 ; Mask high/low instruction byte depending on state of carry
OR R1 ; Store new instruction
STORE R0
ROR PC ; Calculate location to store instruction
AND #0x3F
ADD @PROGRAM
OR #0x1000 ; Convert address into STORE instruction
STORE WRPC1
LOAD R0
WRPC1 NOP ; NOP is replaced with STORE instruction
RETURN
; Read program memory and store in R0, PC is used to address program memory
READPC ROR PC ; Divide PC by two to get word address
AND #0x3F ; Mask off other bits
ADD @PROGRAM ; Add offset to start of program memory
STORE RDPC1 ; Store 'LOAD' instruction
RDPC1 NOP ; NOP replaced by LOAD instruction
STORE R0
RETURN
; Byte SWAP R0 based on state of PC bit 0
; Used to address program memory high/low bytes
R0SWAPPCEVEN ROR PC
BNC SWPC2
SWPC1 RETURN
SWPC2 SWAP R0
STORE R0
RETURN
; Loop until a switch (SW1 or SW2) is pressed
; On return A=0 if SW1 is pressed or A=1 if SW2 is pressed
WAITSWITCH CALL READSWITCHES
SUB #1
BNC WAITSWITCH
RETURN
; Multiply R1 by 16
R1MUL16 CALL R1MUL2
CALL R1MUL2
CALL R1MUL2
R1MUL2 LOAD R1
ADD R1
STORE R1
RETURN
; Divide R0 by 16
R0DIV16 CALL R0DIV2
CALL R0DIV2
CALL R0DIV2
R0DIV2 ROR R0
STORE R0
RETURN
; Read, debounce and edge detect switches (SW1 and SW2)
; On return A.0 = 1 when SW1 pressed since last call
; A.1 = 1 when SW2 pressed since last call
READSWITCHES IN SWITCH ; Read switch inputs
XOR PREVSWITCH ; XOR to see if switche state has changed since previous call
BNZ RSW2 ; Branch if switches have changed
RSW1 LOAD #0
RETURN
RSW2 STORE R0 ; Store differance between new and old switch state
LOAD #30 ; Wait 30mS (debounce time)
OUT TIMER
IN SWITCH ; Read switches again
XOR PREVSWITCH ; Check for match with first read
XOR R0
BNZ RSW1 ; Branch if switch state is different from first read
LOAD R0 ; XOR'ing differance between old state and new state...
XOR PREVSWITCH ; and old state will result in the new state
STORE PREVSWITCH ; Update PREVSWITCH with new switch state
XOR #3 ; A = new switch state, complement because inputs are low when switch is pressed
AND R0 ; Mask bits that have not changed
RETURN
; Fetch instruction from program memory using PC and split into INSTRUCTION and DATA nibbles
FETCH CALL READPC
CALL R0SWAPPCEVEN
LOAD R0 ; R0 is instruction byte
AND #0xF ; Mask and store DATA nibble
STORE DATA
CALL R0DIV16 ; Shift instruction byte 4 bits right
LOAD R0
AND #0xF ; Mask and store INSTRUCTION nibble
STORE INSTRUCTION
RETURN
; Add one to the program counter and branch to the main run loop
INCPC LOAD PC
ADD #1
BR RUNLOOP
; Execute the 'to port' instruction, write the contents of the DATA nibble to DOUT
TOPORT LOAD DATA
OUT DOUT
BR INCPC
; Execute the 'wait' instruction, lookup the timer value in a table indexed by the DATA nibble and write to the timer
WAIT LOAD @WAITTABLE ; Add DATA value to the timer table offset
ADD DATA
STORE READWAITTIME ; Store 'LOAD' instruction
READWAITTIME NOP ; NOP replaced with LOAD instruction
OUT TIMER ; Write to timer, stops CPU for number of milli-seconds written
BR INCPC
; Lookup table used by the wait instruction
WAITTABLE DW 1 ; 1mS
DW 2 ; 2mS
DW 5 ; 5mS
DW 10 ; 10mS
DW 20 ; 20mS
DW 50 ; 50mS
DW 100 ; 100mS
DW 200 ; 200mS
DW 500 ; 500mS
DW 1000 ; 1S
DW 2000 ; 2S
DW 5000 ; 5S
DW 10000 ; 10S
DW 20000 ; 20S
DW 30000 ; 30S
DW 60000 ; 60S
; Execute the 'jump back' instruction - subtract the DATA value from the program counter
JUMPBACK LOAD PC
SUB DATA
BR RUNLOOP
; Execute the 'seta' instruction
SETA LOAD DATA
STORE REGA
BR INCPC
; Execute the '...<=A' instructions the DATA nibble indexes a branch table
ATO LOAD @ATOTABLE ; Offset to branch table
ADD DATA ; add DATA
OR #0xB000 ; convert to BR instruction
STORE BRATO ; Store instruction
LOAD REGA ; LOAD A with REGA - this is common to all 'set to A' instructions
BRATO NOP
ATOTABLE BR INCPC
BR ATOB
BR ATOC
BR ATOD
BR ATODOUT
BR ATODOUT0
BR ATODOUT1
BR ATODOUT2
BR ATODOUT3
BR ATOPWM
BR INCPC
BR INCPC
BR INCPC
BR INCPC
BR INCPC
BR INCPC
BR INCPC
; Execute B<=A instruction
ATOB STORE REGB
BR INCPC
; Execute C<=A instruction
ATOC STORE REGC
BR INCPC
; Execute D<=A instruction
ATOD STORE REGD
BR INCPC
; Execute DOUT<=A instruction
ATODOUT OUT DOUT
BR INCPC
ATODOUT0 LOAD #1 ; DOUT0 <= A.0
BR ATX1
ATODOUT1 LOAD #2 ; DOUT1 <= A.0
BR ATX1
ATODOUT2 LOAD #4 ; DOUT2 <= A.0
BR ATX1
ATODOUT3 LOAD #8 ; DOUT3 <= A.0
ATX1 STORE R0
ROR REGA ; Copy A.0 to carry flag
BNC ATX2 ; branch if A.0 = 0
IN DOUT ; Set selected bit in DOUT
OR R0
BR ATODOUT
ATX2 LOAD R0 ; Clear selected bit in DOUT...
XOR #0xF ; Complement bit selection
STORE R0
IN DOUT ; Read current DOUT
AND R0 ; Mask bit to be cleared
BR ATODOUT ; Write new value to DOUT
; Execute PWM<=A
ATOPWM OUT PWM
BR INCPC
; Execute the 'A<=...' instructions the DATA nibble indexes a branch table
TOA LOAD @TOATABLE ; Offset to branch table
ADD DATA ; add DATA nibble
OR #0xB000 ; Convert to BR instruction
STORE BRTOA ; Store instruction
IN DIN ; Read DIN some instructions require DIN reading
BRTOA NOP ; Replaced by BR instruction
TOATABLE BR INCPC
BR BTOA
BR CTOA
BR DTOA
BR DINTOA
BR DIN0TOA
BR DIN1TOA
BR DIN2TOA
BR DIN3TOA
BR AD1TOA
BR AD2TOA
BR INCPC
BR INCPC
BR INCPC
BR INCPC
BR INCPC
; Execute A<=B
BTOA LOAD REGB
TXA1 STORE REGA
BR INCPC
; Execute A<=C
CTOA LOAD REGC
BR TXA1
; Execute A<=D
DTOA LOAD REGD
BR TXA1
; Execute A<=DIN
DINTOA IN DIN
BR TXA1
DIN0TOA AND #1 ; A<=DIN.0
BR TXA2
DIN1TOA AND #2 ; A<=DIN.1
BR TXA2
DIN2TOA AND #4 ; A<=DIN.2
BR TXA2
DIN3TOA AND #8 ; A<=DIN.3
TXA2 BNZ TXA3
BR TXA1
TXA3 LOAD #1
BR TXA1
; ADC not implemented - set REGA to 0 when A<=AD1 or A<=AD2 is executed
AD1TOA
AD2TOA LOAD #0
BR TXA1
; Calculation instructions - branch table
CALC LOAD @CALCTABLE
ADD DATA
OR #0xB000
STORE BRCALC
LOAD REGA
BRCALC NOP
CALCTABLE BR INCPC
BR ADD1
BR SUB1
BR ADDB
BR SUBB
BR MULB
BR DIVB
BR ANDB
BR ORB
BR XORB
BR NOTA
BR INCPC
BR INCPC
BR INCPC
BR INCPC
BR INCPC
; A<=A+1
ADD1 ADD #1
CALCX STORE REGA
BR INCPC
; A<=A-1
SUB1 SUB #1
BR CALCX
; A<=A+B
ADDB ADD REGB
BR CALCX
; A<=A-B
SUBB SUB REGB
BR CALCX
; A<=A*B
MULB LOAD REGB
STORE R1
CALL R1MUL16
LOAD #4
MUL1 STORE R0
LOAD R1
ADD R1
STORE R1
AND #0x100
BNZ MUL2
BR MUL3
MUL2 LOAD R1
ADD REGA
STORE R1
MUL3 LOAD R0
SUB #1
BNZ MUL1
LOAD R1
AND #0xF
BR CALCX
; A<=A/B
DIVB LOAD REGB
STORE R1
CALL R1MUL16
LOAD #4
DIV1 STORE R0
LOAD REGA
ADD REGA
STORE REGA
SUB R1
BNC DIV2
OR #1
STORE REGA
DIV2 LOAD R0
SUB #1
BNZ DIV1
LOAD REGA
AND #0xF
BR CALCX
; A<=A&B
ANDB AND REGB
BR CALCX
; A <=A|B
ORB OR REGB
BR CALCX
; A <=A^B
XORB XOR REGB
BR CALCX
; A <= ~A
NOTA XOR #0xF
BR CALCX
SETPAGE LOAD DATA
STORE R1
CALL R1MUL16
STORE PAGE
BR INCPC
JUMPPAGE LOAD PAGE
OR DATA
BR RUNLOOP
CLOOP LOAD REGC
SUB #1
BNC INCPC
STORE REGC
BR JUMPPAGE
DLOOP LOAD REGD
SUB #1
BNC INCPC
STORE REGD
BR JUMPPAGE
SKIPIF LOAD @SKIPTABLE
ADD DATA
OR #0xB000
STORE BRSKIP
BRSKIP NOP
SKIPTABLE BR INCPC
BR AGTB
BR ALTB
BR AEQB
BR DIN01
BR DIN11
BR DIN21
BR DIN31
BR DIN00
BR DIN10
BR DIN20
BR DIN30
BR S10
BR S20
BR S11
BR S21
AGTB LOAD REGB
SUB REGA
BNC SKIP
BR INCPC
ALTB LOAD REGA
SUB REGB
BNC SKIP
BR INCPC
AEQB LOAD REGA
SUB REGB
BNZ INCPC
BR SKIP
DIN01 LOAD #1
BR DINX1
DIN11 LOAD #2
BR DINX1
DIN21 LOAD #4
BR DINX1
DIN31 LOAD #8
DINX1 STORE R1
IN DIN
AND R1
BNZ SKIP
BR INCPC
DIN00 LOAD #1
BR DINX0
DIN10 LOAD #2
BR DINX0
DIN20 LOAD #4
BR DINX0
DIN30 LOAD #8
DINX0 STORE R1
IN DIN
AND R1
BNZ INCPC
BR SKIP
S10 IN SWITCH
AND #1
BNZ INCPC
BR SKIP
S20 IN SWITCH
AND #2
BNZ INCPC
BR SKIP
S11 IN SWITCH
AND #1
BNZ SKIP
BR INCPC
S21 IN SWITCH
AND #2
BNZ SKIP
BR INCPC
SKIP LOAD PC
ADD #2
BR RUNLOOP
CALLSUB LOAD PC
STORE CALLFROM
BR JUMPPAGE
SUBRETURN LOAD CALLFROM
STORE PC
BR INCPC
PROGRAM DB 0x64,0x51,0x4E,0x80,0xC3,0x98,0x82,0x95
DB 0x4D,0x80,0xC3,0x9E,0x82,0x9A,0x4B,0x81
DB 0xC3,0x94,0x83,0x90,0x47,0x81,0xC3,0x9A
DB 0x83,0x94,0x43,0x82,0xC3,0x90,0x84,0x90
DB 0x11,0x28,0x18,0x28,0x34,0x71,0x54,0x59
DB 0x26,0x34,0x69,0x54,0x59,0x26,0x34,0xFF
DB 0x54,0xCE,0x71,0x33,0x22,0xCC,0x32,0x40
DB 0x22,0x71,0x54,0xCE,0x34,0x39,0xFF,0xFF
DB 0x86,0xD0,0x40,0x71,0x54,0x23,0xCD,0x34
DB 0xD8,0x40,0x54,0x3B,0xFF,0xFF,0xFF,0xFF
DB 0x4F,0x93,0x45,0x53,0x19,0x11,0x21,0x19
DB 0x11,0x21,0x19,0x11,0x20,0xB4,0x10,0xE0
DB 0x23,0xCE,0x32,0x23,0xCC,0x31,0xE0,0xFF
DB 0x23,0xCF,0x32,0x23,0xCD,0x31,0xE0,0xFF
DB 0xCC,0x31,0x40,0x54,0x23,0xCE,0x32,0xCF
DB 0xE0,0xCC,0x33,0x71,0x23,0xCC,0x31,0x3C
; End of file
| 31.813433 | 120 | 0.436547 |
076153e306a6a0d4d76593058bf73074b02a4c17 | 2,233 | asm | Assembly | counter.asm | Digital-Electronics-LLC/bootOS | 6ce1cce3bae2f12cd47b844ac4800c5f4a971df1 | [
"BSD-2-Clause"
] | 1,466 | 2019-07-29T18:29:37.000Z | 2022-03-30T21:49:46.000Z | counter.asm | dev747368/bootOS | a0e9b676883c3d926071651d84e6b4e4ffd502a9 | [
"BSD-2-Clause"
] | 16 | 2019-07-31T05:30:29.000Z | 2021-11-11T19:29:22.000Z | counter.asm | dev747368/bootOS | a0e9b676883c3d926071651d84e6b4e4ffd502a9 | [
"BSD-2-Clause"
] | 88 | 2019-07-30T03:38:23.000Z | 2022-03-18T15:54:12.000Z | ;
; Shows how to use bootOS services
;
; by Oscar Toledo G.
; http://nanochess.org/
;
; Creation date: Jul/31/2019.
;
org 0x7c00
;
; These segment values and addresses are for
; testing the correct bootOS behavior.
;
name_segment: equ 0x1000
name_address: equ 0x0100
data_segment: equ 0x1100
data_address: equ 0x0200
start:
mov ax,name_segment
mov es,ax
mov si,name
mov di,name_address
mov bx,di
mov cx,9
rep movsb
push es
pop ds ; ds:bx ready pointing to filename
mov ax,data_segment
mov es,ax
mov di,data_address ; es:di ready pointing to data
push bx
push ds
push di
push es
int 0x23 ; Load file.
pop ds
pop di
push di
push ds
mov al,'*' ; Exists.
jnc .1
mov al,'?' ; Doesn't exist.
mov word [di],0x0000 ; Setup counter to zero.
.1:
int 0x22 ; Output character.
mov ax,[di] ; Read data.
inc al ; Increase right digit.
cmp al,10 ; Is it 10?
jne .2 ; No, jump.
mov al,0 ; Reset to zero.
inc ah ; Increase left digit.
cmp ah,10 ; Is it 10?
jne .2 ; No, jump.
mov ah,0 ; Reset to zero.
.2: mov [di],ax ; Save data.
push ax
mov al,ah
add al,'0' ; Convert to ASCII.
int 0x22 ; Output character.
pop ax
add al,'0' ; Convert to ASCII.
int 0x22 ; Output character.
mov al,0x0d ; Go to next row on screen.
int 0x22 ; Output character.
pop es
pop di
pop ds
pop bx
int 0x24 ; Save file.
int 0x20 ; Return to bootOS.
name: db "data.bin",0 ; Filename.
| 24.538462 | 66 | 0.425437 |
048db39100c6482d6a182265038d0f715a6d5bbd | 1,880 | asm | Assembly | boot/loader/memory.asm | EmilNorden/tunaos | fccaeb90609b08066470fe8e4cde0e64f85c2f15 | [
"MIT"
] | null | null | null | boot/loader/memory.asm | EmilNorden/tunaos | fccaeb90609b08066470fe8e4cde0e64f85c2f15 | [
"MIT"
] | null | null | null | boot/loader/memory.asm | EmilNorden/tunaos | fccaeb90609b08066470fe8e4cde0e64f85c2f15 | [
"MIT"
] | null | null | null | [bits 16]
; The entry structure looks like this:
; uint64 - base address
; uint64 - length of region (can apparently be 0, in which case it should be skipped)
; uint32 - type
; uint32 - extended ACPI attribute (unused?)
; total size of structure is 24 bytes
;
; Creates a memory map.
; Inputs:
; ES:DI - memory address to store map at
; AX - size of memory region at ES:DI
create_memory_map:
pusha
; Store base address for memory map, we will need it later.
mov [MEMORY_MAP_START_ADDR], DI
; Skip two first bytes. We will use them for storing the entry count later
add DI, 2
; Decrement total region size by 2, since we have kinda "claimed" the first two bytes nowl.
SUB AX, 2
; Divide AX with 24 to find out how many entries we can pull out
mov BX, 0x18
xor DX, DX
div BX
mov [MAX_ENTRIES], AX
; Clear our entry counter (bp)
xor bp, bp
; Clear EBX (status register for this procedure)
xor EBX, EBX
mov EDX, 0x534D4150
loop:
mov EAX, 0xE820
mov ECX, 24
INT 0x15
; If carry flag is set, the call failed
jc fail
; EAX should be set to the magic word if call was successful
mov EDX, 0x534D4150
cmp EAX, EDX
jne fail
; Should "investigate" entry here. For instance if length is zero we can skip it.
; (and by skipping, its just a matter of NOT incrementing DI, so it will be overwritten by the next entry)
; entry looks good, keep it in memory by incrementing ES:DI
add DI, 24
; If EBX is 0, we have reached the end of the list
cmp EBX, 0
je done
inc BP
cmp BP, [MAX_ENTRIES]
je done
jmp loop
done:
; Place the entry count (from BP) at the base address of the supplied memory range
mov BX, [MEMORY_MAP_START_ADDR]
mov [BX], BP
popa
ret
fail:
mov BX, MSG_MEMORY_MAP_FAIL
call print_string
jmp $
MEMORY_MAP_START_ADDR: dw 0
MAX_ENTRIES: dw 0
MSG_MEMORY_MAP_FAIL: db 'Failed to create memory map', 0 | 22.650602 | 107 | 0.712766 |
77be28081065a76199b8e2c7f1050c7caf902c48 | 632 | asm | Assembly | libsrc/graphics/gray/ticalc/g_clg.asm | andydansby/z88dk-mk2 | 51c15f1387293809c496f5eaf7b196f8a0e9b66b | [
"ClArtistic"
] | 1 | 2020-09-15T08:35:49.000Z | 2020-09-15T08:35:49.000Z | libsrc/graphics/gray/ticalc/g_clg.asm | andydansby/z88dk-MK2 | 51c15f1387293809c496f5eaf7b196f8a0e9b66b | [
"ClArtistic"
] | null | null | null | libsrc/graphics/gray/ticalc/g_clg.asm | andydansby/z88dk-MK2 | 51c15f1387293809c496f5eaf7b196f8a0e9b66b | [
"ClArtistic"
] | null | null | null | ;
; TI Gray Library Functions
;
; Written by Stefano Bodrato - Mar 2001
;
;
; $Id: g_clg.asm,v 1.5 2011/08/12 16:56:33 pauloscustodio Exp $
;
;Usage: g_clg(GrayLevel)
INCLUDE "graphics/grafix.inc" ; Contains fn defs
XLIB g_clg
XREF graybit1
XREF graybit2
.g_clg
ld ix,0
add ix,sp
ld a,(ix+2) ;GrayLevel
ld hl,(graybit1)
rra
jr nc,lbl1
push af
ld a,0
call cls
pop af
jr lbl2
.lbl1
push af
ld a,255
call cls
pop af
.lbl2
ld hl,(graybit2)
rra
ld a,0
jr c,lbl3
ld a,255
.lbl3
.cls
ld (hl),a
ld d,h
ld e,l
inc de
ld bc,row_bytes*64-1
ldir
ret
| 11.285714 | 63 | 0.602848 |
c15054c8a495d7c55fc646d890759c27014769ea | 696 | asm | Assembly | oeis/078/A078032.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/078/A078032.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/078/A078032.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A078032: Expansion of (1-x)/(1+x^2+x^3).
; Submitted by Jamie Morken(s1)
; 1,-1,-1,0,2,1,-2,-3,1,5,2,-6,-7,4,13,3,-17,-16,14,33,2,-47,-35,45,82,-10,-127,-72,137,199,-65,-336,-134,401,470,-267,-871,-203,1138,1074,-935,-2212,-139,3147,2351,-3008,-5498,657,8506,4841,-9163,-13347,4322,22510,9025,-26832,-31535,17807,58367,13728,-76174,-72095,62446,148269,9649,-210715,-157918,201066,368633,-43148,-569699,-325485,612847,895184,-287362,-1508031,-607822,1795393,2115853,-1187571,-3911246,-928282,5098817,4839528,-4170535,-9938345,-668993,14108880,10607338,-13439887,-24716218
mov $1,1
mov $3,1
lpb $0
sub $0,1
mul $2,-1
sub $3,$1
add $1,$3
add $1,$2
sub $2,$1
add $3,$2
lpe
mov $0,$3
| 40.941176 | 497 | 0.668103 |
0aff8e115b8bebcc76921917d7c5506507735f68 | 2,772 | asm | Assembly | src/kernel/hal/tss.asm | dgaur/dx | 701232e4ba67036de7594f33c3f5445d0c49942f | [
"MIT"
] | null | null | null | src/kernel/hal/tss.asm | dgaur/dx | 701232e4ba67036de7594f33c3f5445d0c49942f | [
"MIT"
] | null | null | null | src/kernel/hal/tss.asm | dgaur/dx | 701232e4ba67036de7594f33c3f5445d0c49942f | [
"MIT"
] | null | null | null | //
// tss.asm
//
// Logic for creating the Task State Segment (TSS) structure + loading it
// into the CPU
//
#include "hal/address_space_layout.h"
#include "selector.h"
#include "thread_layout.h"
#include "tss.h"
///
/// Creates + installs a TSS on this CPU. Populates the SS0, bitmap base and
/// bitmap terminator fields; all others are zero. The I/O bitmap is initially
/// invalid/empty
///
/// C/C++ prototype --
/// void_t load_tss(void_t)
///
.align 4
.global load_tss
load_tss:
pushl %eax
pushl %ecx
pushl %edi
//
// Wipe the entire region of memory reserved for this TSS. Assumes the
// TSS begins + ends on 32b boundaries. Assumes %es already contains the
// (new) flat data descriptor
//
movl $KERNEL_TSS_BASE, %edi //@SMP: each CPU needs its own TSS
movl $(KERNEL_TSS_SIZE >> 2), %ecx // sizeof(TSS) in 32-bit words
xorl %eax, %eax
rep
stosl
//
// Initialize the basic fields used by the CPU:
// - the selector for the kernel stack; once loaded, this should never
// change
// - an empty I/O bitmap; this may change or be overwritten on each
// context switch
//
movl $KERNEL_TSS_BASE, %edi
movw $GDT_KERNEL_DATA_SELECTOR, TSS_SS0_OFFSET(%edi)
movw $TSS_IO_BITMAP_ADDRESS_INVALID, TSS_IO_BITMAP_ADDRESS_OFFSET(%edi)
//
// Automatically write the TSS terminator value immediately following the
// I/O bitmap. Like the SS0 value, the terminator should never be
// overwritten or cleared, etc; it marks the end of any possible I/O bitmap
// that might be loaded here
//
movb $TSS_IO_BITMAP_TERMINATOR, TSS_IO_BITMAP_TERMINATOR_OFFSET(%edi)
//
// Make the TSS visible to the CPU
//
movw $GDT_TSS_SELECTOR, %ax
ltrw %ax //@SMP: each CPU needs its own TSS
popl %edi
popl %ecx
popl %eax
ret
///
/// Reload/refresh the I/O port bitmap at the end of the TSS. This is intended
/// to allow threads to modify their I/O port bitmap (permissions) and then
/// immediately activate the new permissions without waiting for a context
/// switch to reload the TSS. This is typically only used to support
/// MAP/UNMAP_DEVICE system calls
///
/// On return, the new bitmap is installed and active; the current/calling
/// thread is now bound by the permissions of the new bitmap
///
/// C/C++ prototype --
/// void_t reload_io_port_map(const uint8_tp bitmap)
///
.align 4
.global reload_io_port_map
reload_io_port_map:
pushl %ebp
movl %esp, %ebp
pushl %esi
pushl %edi
pushl %ecx
//
// Load pointers to the bitmap; and the current TSS
//
movl 8(%ebp), %esi
movl $KERNEL_TSS_BASE, %edi //@SMP: each CPU needs its own TSS
//
// Mark the I/O bitmap as valid; and copy (overwrite) the contents with
// the new bitmap
//
TSS_RELOAD_BITMAP
popl %ecx
popl %edi
popl %esi
popl %ebp
ret
| 22.354839 | 79 | 0.703824 |
705af5a2ea81ff6c935ea614987a15d83733b180 | 893 | asm | Assembly | programs/oeis/106/A106610.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/106/A106610.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/106/A106610.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A106610: Numerator of n/(n+9).
; 0,1,2,1,4,5,2,7,8,1,10,11,4,13,14,5,16,17,2,19,20,7,22,23,8,25,26,3,28,29,10,31,32,11,34,35,4,37,38,13,40,41,14,43,44,5,46,47,16,49,50,17,52,53,6,55,56,19,58,59,20,61,62,7,64,65,22,67,68,23,70,71,8,73,74,25,76,77,26,79,80,9,82,83,28,85,86,29,88,89,10,91,92,31,94,95,32,97,98,11,100,101,34,103,104,35,106,107,12,109,110,37,112,113,38,115,116,13,118,119,40,121,122,41,124,125,14,127,128,43,130,131,44,133,134,15,136,137,46,139,140,47,142,143,16,145,146,49,148,149,50,151,152,17,154,155,52,157,158,53,160,161,18,163,164,55,166,167,56,169,170,19,172,173,58,175,176,59,178,179,20,181,182,61,184,185,62,187,188,21,190,191,64,193,194,65,196,197,22,199,200,67,202,203,68,205,206,23,208,209,70,211,212,71,214,215,24,217,218,73,220,221,74,223,224,25,226,227,76,229,230,77,232,233,26,235,236,79,238,239,80,241,242,27,244,245,82,247,248,83
mov $1,$0
gcd $0,9
div $1,$0
| 127.571429 | 829 | 0.68757 |
cb6ad5ebff2e722460d613f575a88901e5d98ed5 | 401 | asm | Assembly | BigNum/Mod/Base/bnShr1.asm | FloydZ/Crypto-Hash | 2635450fb16d4d8dc4578d6539cc25ce599f7e21 | [
"MIT"
] | 11 | 2015-03-17T10:31:23.000Z | 2022-01-21T17:42:43.000Z | BigNum/Mod/Base/bnShr1.asm | 0xFF1E071F/Crypto-Hash | 2635450fb16d4d8dc4578d6539cc25ce599f7e21 | [
"MIT"
] | null | null | null | BigNum/Mod/Base/bnShr1.asm | 0xFF1E071F/Crypto-Hash | 2635450fb16d4d8dc4578d6539cc25ce599f7e21 | [
"MIT"
] | 6 | 2018-01-29T16:06:36.000Z | 2021-05-08T19:22:24.000Z | .686
.model flat,stdcall
option casemap:none
include .\bnlib.inc
include .\bignum.inc
.code
bnShr1 proc uses edi bn:DWORD
mov edi,bn
xor eax,eax; CLC
mov ecx,[edi].BN.dwSize
lea edi,[edi].BN.dwArray[ecx*4-4]
.repeat
mov edx,[edi]
lea edi,[edi-4]
rcr edx,1
dec ecx
mov [edi+4],edx
.until zero?
mov edi,bn
adc eax,eax
mov ecx,[edi].BN.dwSize
call _bn_normalize
ret
bnShr1 endp
end | 14.851852 | 34 | 0.695761 |
bcef4e8868c735a51d6a3d6feb445e019b0b4f47 | 1,111 | asm | Assembly | lib/target/multi8/classic/multi8_crt0.asm | ahjelm/z88dk | c4de367f39a76b41f6390ceeab77737e148178fa | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | lib/target/multi8/classic/multi8_crt0.asm | C-Chads/z88dk | a4141a8e51205c6414b4ae3263b633c4265778e6 | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | lib/target/multi8/classic/multi8_crt0.asm | C-Chads/z88dk | a4141a8e51205c6414b4ae3263b633c4265778e6 | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z | ; CRT0 for the Multi8
;
MODULE multi8_crt0
defc crt0 = 1
INCLUDE "zcc_opt.def"
EXTERN _main ;main() is always external to crt0 code
PUBLIC cleanup ;jp'd to by exit()
PUBLIC l_dcal ;jp(hl)
defc SYSVAR_PORT29_COPY = 0xf0bb
defc TAR__fputc_cons_generic = 1
defc CONSOLE_ROWS = 25
defc CONSOLE_COLUMNS = 40
defc CRT_KEY_DEL = 8
defc __CPU_CLOCK = 4000000
IF startup = 2
INCLUDE "target/multi8/classic/64k.asm"
ELSE
INCLUDE "target/multi8/def/maths_mbf.def"
INCLUDE "target/multi8/classic/16k.asm"
ENDIF
l_dcal: jp (hl) ;Used for function pointer calls
INCLUDE "crt/classic/crt_runtime_selection.asm"
INCLUDE "crt/classic/crt_section.asm"
SECTION data_crt
PUBLIC __vram_in
PUBLIC __vram_out
__vram_in: defb VRAM_IN
__vram_out: defb VRAM_OUT
SECTION bss_crt
PUBLIC __port29_copy
__port29_copy: defb 0
; Create the bootstrap as well
IF startup = 2
INCLUDE "target/multi8/classic/bootstrap.asm"
ENDIF
| 20.962264 | 69 | 0.643564 |
d9985995be12600337b4548f2d7ed6486fb7d663 | 1,539 | asm | Assembly | third_party/antlr_grammars_v4/asm/asmMASM/examples/powers.asm | mikhan808/rsyntaxtextarea-antlr4-extension | be6a7881e0f6e1a5e8c8e65f7ca4898a2298aa77 | [
"BSD-3-Clause"
] | 127 | 2018-09-03T16:54:24.000Z | 2022-03-27T15:07:28.000Z | third_party/antlr_grammars_v4/asm/asmMASM/examples/powers.asm | mikhan808/rsyntaxtextarea-antlr4-extension | be6a7881e0f6e1a5e8c8e65f7ca4898a2298aa77 | [
"BSD-3-Clause"
] | 63 | 2018-09-03T16:18:02.000Z | 2022-03-14T13:44:17.000Z | third_party/antlr_grammars_v4/asm/asmMASM/examples/powers.asm | mikhan808/rsyntaxtextarea-antlr4-extension | be6a7881e0f6e1a5e8c8e65f7ca4898a2298aa77 | [
"BSD-3-Clause"
] | 39 | 2018-09-03T16:11:27.000Z | 2022-01-14T01:22:31.000Z | ; ----------------------------------------------------------------------------
; powers.asm
;
; Displays powers of 2 from 2^0 to 2^31, one per line, to standard output.
;
; Processor: 386 or later
; Assembler: MASM
; OS: Any Win32-based OS
; Other libraries: Use a Microsoft-compatible C library (e.g. libc.lib).
; Assemble with "ml powers.asm /c"
; Link with "link powers libc.lib"
;
; By default, the linker uses "/subsystem:console /entry:mainCRTStartup".
; The function "mainCRTStartup" is inside libc.lib. It does some
; initialization, calls a function "_main" (which will end up in powers.obj)
; then does more work and finally calls ExitProcess.
; ----------------------------------------------------------------------------
.386P
.model flat
extern _printf:near
public _main
.code
_main:
push esi ; callee-save registers
push edi
mov esi, 1 ; current value
mov edi, 31 ; counter
L1:
push esi ; push value to print
push offset format ; push address of format string
call _printf
add esp, 8 ; pop off parameters passed to printf
add esi, esi ; double value
dec edi ; keep counting
jnz L1
pop edi
pop esi
ret
format: byte '%d', 10, 0
end
| 32.744681 | 78 | 0.473034 |
f43f59d11852e7df05dabf34b52e0ee5debf8f37 | 493 | asm | Assembly | newitems/jump/stairs.asm | fcard/z3randomizer | f2d0c2e58512e9c4c7f37996b52f6a0dc828f3ec | [
"MIT"
] | null | null | null | newitems/jump/stairs.asm | fcard/z3randomizer | f2d0c2e58512e9c4c7f37996b52f6a0dc828f3ec | [
"MIT"
] | null | null | null | newitems/jump/stairs.asm | fcard/z3randomizer | f2d0c2e58512e9c4c7f37996b52f6a0dc828f3ec | [
"MIT"
] | null | null | null | ; Allow jumping into outdoor stairs
CheckMidairBeforeEnteringStairs:
LDA !IsJumping : BNE .branch
LDA $46 : BEQ .branch
JML CheckMidairBeforeEnteringStairs.Continue
.branch
JML CheckMidairBeforeEnteringStairs.Branch
; Set outdoor stairs flag
SetOutdoorStairsState:
LDA #1 : STA !OutdoorStairs
LDA #2 : STA $5E ; thing we wrote over
RTL
; Set indoor stairs flag
SetIndoorStairsState:
LDA #0 : STA !OutdoorStairs
LDA #2 : STA $5E ; thing we wrote over
RTL
| 23.47619 | 52 | 0.728195 |
192647fbbcbfe95812caed8559ddf02fb2dba5dc | 258 | asm | Assembly | exampl05/hlldemo/smalled/lib/tstlib/tstlib.asm | AlexRogalskiy/Masm | d39498878f140696b299c76436f209156961429e | [
"MIT"
] | null | null | null | exampl05/hlldemo/smalled/lib/tstlib/tstlib.asm | AlexRogalskiy/Masm | d39498878f140696b299c76436f209156961429e | [
"MIT"
] | null | null | null | exampl05/hlldemo/smalled/lib/tstlib/tstlib.asm | AlexRogalskiy/Masm | d39498878f140696b299c76436f209156961429e | [
"MIT"
] | null | null | null |
.486 ; create 32 bit code
.model flat, stdcall ; 32 bit memory model
option casemap :none ; case sensitive
ReEntryPoint PROTO
includelib smalled.lib
.code
start:
call ReEntryPoint
end start
| 16.125 | 52 | 0.581395 |
b02e8f2c26b3dd1a1c931bd6f4d99d90ce0f93ea | 807 | asm | Assembly | programs/oeis/185/A185908.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/185/A185908.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/185/A185908.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A185908: Array: T(n,k) = n-1 + min{n,k}, by antidiagonals.
; 1,1,2,1,3,3,1,3,4,4,1,3,5,5,5,1,3,5,6,6,6,1,3,5,7,7,7,7,1,3,5,7,8,8,8,8,1,3,5,7,9,9,9,9,9,1,3,5,7,9,10,10,10,10,10,1,3,5,7,9,11,11,11,11,11,11,1,3,5,7,9,11,12,12,12,12,12,12,1,3,5,7,9,11,13,13,13,13,13,13,13,1,3,5,7,9,11,13,14,14,14,14,14,14,14,1,3,5,7,9,11,13,15,15,15,15,15,15,15,15,1,3,5,7,9,11,13,15,16,16,16,16,16,16,16,16,1,3,5,7,9,11,13,15,17,17,17,17,17,17,17,17,17,1,3,5,7,9,11,13,15,17,18,18,18,18,18,18,18,18,18,1,3,5,7,9,11,13,15,17,19,19,19,19,19,19,19,19,19,19,1,3,5,7,9,11,13,15,17,19,20,20,20,20,20,20,20,20,20,20,1,3,5,7,9,11,13,15,17,19,21,21,21,21,21,21,21,21,21,21,21,1,3,5,7,9,11,13,15,17,19,21,22,22,22,22,22,22,22,22
add $0,1
lpb $0,1
add $1,1
lpb $0,4
mov $1,$0
add $1,$0
sub $1,1
lpe
sub $0,$1
lpe
| 57.642857 | 641 | 0.586121 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.